@abtnode/blocklet-services 1.17.8-beta-20260104-120132-cb5b1914 → 1.17.8-beta-20260108-021819-e099f0ca
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/dist/assets/{AdapterDayjs-DyRP0A_7.js → AdapterDayjs-C1bdndja.js} +1 -1
- package/dist/assets/Community-3AO97CCq.js +1 -0
- package/dist/assets/{Google-Bjq5o7qL.js → Google-JbLVL0lz.js} +1 -1
- package/dist/assets/Holiday-CqSw2e8m.js +1 -0
- package/dist/assets/Meeting-DKbNRI16.js +1 -0
- package/dist/assets/OffSick-BvEREz3_.js +1 -0
- package/dist/assets/WorkingRemotely-DNtYHcSB.js +1 -0
- package/dist/assets/{access-control-Cv1j0YWJ.js → access-control-DMsY0Jfu.js} +1 -1
- package/dist/assets/{actions-Dfiiwkit.js → actions-m1acuA78.js} +1 -1
- package/dist/assets/{add-component-core-8nx00xJP.js → add-component-core-DXBsHpN1.js} +7 -7
- package/dist/assets/add-resource-B1owMSeP.js +1 -0
- package/dist/assets/addon-B42_QFF5.js +14 -0
- package/dist/assets/advanced-BnFynWN7.js +14 -0
- package/dist/assets/aigne-Qq2FBVAW.js +10 -0
- package/dist/assets/api-B24x7kOD.js +1 -0
- package/dist/assets/{appearance-CkrEEbhp.js → appearance-Dnc6HNzY.js} +1 -1
- package/dist/assets/{ar-BukCw0OI.js → ar-BHqjWgUQ.js} +2 -2
- package/dist/assets/arrow-down.svg-7ME6T1BL.js +1 -0
- package/dist/assets/{audit-logs-XPxQHo2y.js → audit-logs-Cfw8JmA4.js} +2 -2
- package/dist/assets/{authorize-ByHCjaXS.js → authorize-B_1efpwx.js} +1 -1
- package/dist/assets/{base-chart-ChBZtUEG.js → base-chart-DT--nPCU.js} +1 -1
- package/dist/assets/base32-r3F0yIbl.js +1 -0
- package/dist/assets/bind-account-Cw-tBmC3.js +1 -0
- package/dist/assets/{branding-khY0G2TO.js → branding-BxEmV2m2.js} +2 -2
- package/dist/assets/{branding-CBzX3Xum.js → branding-CBavw5s2.js} +1 -1
- package/dist/assets/branding-CbYOEW_s.js +1 -0
- package/dist/assets/bundle-avatar-1zs0l21j.js +1 -0
- package/dist/assets/button-LwkniwV9.js +1 -0
- package/dist/assets/{click-to-copy-BEM1P78p.js → click-to-copy-Dk6ZAJOw.js} +1 -1
- package/dist/assets/cloneDeep-rgNCMFod.js +1 -0
- package/dist/assets/{collapse-B7gUzFaX.js → collapse-D72lnPa9.js} +1 -1
- package/dist/assets/{complete-CuyAiV3B.js → complete-CIQgRJri.js} +4 -4
- package/dist/assets/{component-nxxcEAFR.js → component-qZAbczHw.js} +3 -3
- package/dist/assets/{config-DweHAJPq.js → config-BaKRlJau.js} +2 -2
- package/dist/assets/config-CoSaZVwp.js +53 -0
- package/dist/assets/{config-DOcJbRFr.js → config-btuzRTop.js} +1 -1
- package/dist/assets/{config-navigation-BG6durqz.js → config-navigation-BNsZpUQd.js} +8 -8
- package/dist/assets/config-space-BZQrckxG.js +1 -0
- package/dist/assets/{confirm-BRnYfcDD.js → confirm-D6AvlbAp.js} +1 -1
- package/dist/assets/connect-BC85oS0g.js +1 -0
- package/dist/assets/connect-BV6BUhDJ.css +1 -0
- package/dist/assets/connect-Dv4BPfET.js +5 -0
- package/dist/assets/connect-_I5q1wXN.js +5 -0
- package/dist/assets/connect-to-CVH3cw77.js +1 -0
- package/dist/assets/{content-layout-DmSBGGVm.js → content-layout-Dtfb5X6M.js} +1 -1
- package/dist/assets/{create-passport-svg-BKhJ2ufW.js → create-passport-svg-DeDfPZeD.js} +1 -1
- package/dist/assets/createClass-07c4wbGU.js +1 -0
- package/dist/assets/{dashboard-CDOqgUmx.js → dashboard-BQgUp8NI.js} +7 -7
- package/dist/assets/{de-Br0tDZam.js → de-QUGQFv2K.js} +1 -1
- package/dist/assets/{delete-confirm-1vzcMsM2.js → delete-confirm-BLy-Oo1o.js} +1 -1
- package/dist/assets/did-address-Cq16cwTy.js +1 -0
- package/dist/assets/{domain-D75xKDoP.js → domain-BqtauLm5.js} +1 -1
- package/dist/assets/{domain-action-card-BgDPfYMr.js → domain-action-card-nuzd77mn.js} +2 -2
- package/dist/assets/domains-Cg8723ho.js +1 -0
- package/dist/assets/edit.svg-CTE5eATX.js +1 -0
- package/dist/assets/email-CCNEyVGq.js +17 -0
- package/dist/assets/{empty-spinner-BYDonf35.js → empty-spinner-BClWI15N.js} +1 -1
- package/dist/assets/engine-DOYgeVKF.js +1 -0
- package/dist/assets/{es-D_e0gGgp.js → es-C4w6cL07.js} +2 -2
- package/dist/assets/exchange-passport-DR-pKNHM.js +1 -0
- package/dist/assets/{form-BblKAylu.js → form-Bkig0Zr5.js} +3 -3
- package/dist/assets/{form-text-input-C-JBHNfU.js → form-text-input-BsCymY_c.js} +2 -2
- package/dist/assets/{form-wrapper-PT5ZzMQy.js → form-wrapper-pwkkz4we.js} +1 -1
- package/dist/assets/{fr-DXizOT4b.js → fr-Bq3UipEu.js} +2 -2
- package/dist/assets/{fuel-BPg61IpB.js → fuel-tC2bCgpP.js} +1 -1
- package/dist/assets/{gen-access-key-B-PvqBv6.js → gen-access-key-BbtCn0wJ.js} +1 -1
- package/dist/assets/gen-simple-access-key-DbKaLz9m.js +1 -0
- package/dist/assets/get-safe-url-DxqVk96E.js +1 -0
- package/dist/assets/google-icon-vNOJy67F.js +1 -0
- package/dist/assets/{hi-D2FEb_Tx.js → hi-DGZy0DLh.js} +2 -2
- package/dist/assets/{home-CT38dHBL.js → home-BdXWvJM-.js} +1 -1
- package/dist/assets/{id-Dw9URVwP.js → id-DOzDilAf.js} +2 -2
- package/dist/assets/{iframe-D119MMHU.js → iframe-BHP6CYbe.js} +1 -1
- package/dist/assets/index-5IYIk-ZG.js +150 -0
- package/dist/assets/{index-OTENuoZ0.js → index-B0O4cfgn.js} +22 -22
- package/dist/assets/index-B3RkYGd7.js +1 -0
- package/dist/assets/{index-BcIeEF3v.js → index-B7hLDto7.js} +4 -4
- package/dist/assets/{index-BpWFE-ry.js → index-BB8sYq-N.js} +1 -1
- package/dist/assets/index-BEfIUbZC.js +1039 -0
- package/dist/assets/{index-CIC0R_Qc.js → index-BGo7DXlf.js} +1 -1
- package/dist/assets/{index-arhRQhsc.js → index-BHnD9G0G.js} +8 -8
- package/dist/assets/index-BPZITdMW.js +200 -0
- package/dist/assets/{index-BWCHnVga.js → index-BSZ3mQac.js} +2 -2
- package/dist/assets/{index-tfYDa2i6.js → index-BasnkqHA.js} +5 -5
- package/dist/assets/index-BbSDwNE6.js +120 -0
- package/dist/assets/index-Bm1VCAzZ.js +81 -0
- package/dist/assets/{index-bCC4mzZc.js → index-BnOC3Ium.js} +1 -1
- package/dist/assets/index-BoLm67SH.js +1 -0
- package/dist/assets/{index-DSVwCr5p.js → index-BrDWLIA2.js} +2 -2
- package/dist/assets/{index-DoDx-vpV.js → index-Bv2O-NCZ.js} +3 -3
- package/dist/assets/{index-D1f4dwYF.js → index-BvB9yPsA.js} +12 -12
- package/dist/assets/{index-uODjznr3.js → index-C96Fw4Lj.js} +6 -6
- package/dist/assets/{index-DdojJXSn.js → index-CNGNZ6kv.js} +3 -3
- package/dist/assets/{index-D1SIrheh.js → index-CaQuyP_U.js} +1 -1
- package/dist/assets/{index-DGbr3NAq.js → index-Cvt4JvUl.js} +1 -1
- package/dist/assets/{index-CRAuhYSg.js → index-D-O_eFad.js} +1 -1
- package/dist/assets/index-D320ZZ3W.js +281 -0
- package/dist/assets/index-D3L_FG1K.js +1 -0
- package/dist/assets/{index-sBtfsjBo.js → index-DTdf57JC.js} +2 -2
- package/dist/assets/{index-BNAs76qj.js → index-DUL9RfTo.js} +2 -2
- package/dist/assets/{index-CSCCjNba.js → index-DVrxzIzr.js} +1 -1
- package/dist/assets/index-DixUQBnm.js +1 -0
- package/dist/assets/index-DrCTi6nm.css +1 -0
- package/dist/assets/{index-VaUGnCuU.js → index-KUC3HPt0.js} +1 -1
- package/dist/assets/{index-8bzrOXqv.js → index-Ly6A31IO.js} +2 -2
- package/dist/assets/{index-TzwTiNQ7.js → index-dC2vB2_g.js} +1 -1
- package/dist/assets/{index-B0Q9wWG1.js → index-oucqu2vy.js} +1 -1
- package/dist/assets/{index-CGrk0HiP.js → index-yvRJAzQn.js} +1 -1
- package/dist/assets/info-outline-rounded-YiCh4oGg.js +1 -0
- package/dist/assets/invitation-CnuNtRnn.js +177 -0
- package/dist/assets/invitations-D_3NLIPO.js +3 -0
- package/dist/assets/{invite-uHE_P5fP.js → invite-CUVHQCSI.js} +1 -1
- package/dist/assets/{isURL-CRZ7iI7F.js → isURL-vNa-ZfGd.js} +2 -2
- package/dist/assets/issue-passport-Do2LhI-f.js +1 -0
- package/dist/assets/{item-BJSHAMwK.js → item-BabsiwzU.js} +1 -1
- package/dist/assets/{ja-DBxpsmGJ.js → ja-DMq-YXDX.js} +2 -2
- package/dist/assets/{ko-CCAdSyce.js → ko-BrYbXurh.js} +2 -2
- package/dist/assets/landing-page-B5QvkHHO.js +1 -0
- package/dist/assets/{launch-result-message-MNpx7ysR.js → launch-result-message-C04PaKk0.js} +1 -1
- package/dist/assets/{layout-D9M0eiNw.js → layout-DRVZ4L0D.js} +1 -1
- package/dist/assets/list-B22ZyQqz.js +2 -0
- package/dist/assets/{list-DVUI92a2.js → list-BbHzj-7w.js} +3 -3
- package/dist/assets/{list-header-Cl3jykCe.js → list-header-wJF4c6BN.js} +1 -1
- package/dist/assets/localization-BFHoFo4B.js +1 -0
- package/dist/assets/lock.svg-CiT4rEpi.js +1 -0
- package/dist/assets/{log-DbdNMVuv.js → log-BigiLZw2.js} +1 -1
- package/dist/assets/logger-DhW79f4a.js +1 -0
- package/dist/assets/login-DeBY1fPe.js +1 -0
- package/dist/assets/{login-oauth-callback-RLp-7ubu.js → login-oauth-callback-Du-bMipe.js} +1 -1
- package/dist/assets/{logo-uploader-BFMnNkRn.js → logo-uploader-DEFzQY0j.js} +3 -3
- package/dist/assets/{lost-passport-CB5SFq30.js → lost-passport-DkN5GdCK.js} +2 -2
- package/dist/assets/omit-BeaKJrg9.js +1 -0
- package/dist/assets/{open-window-xMdq1GjU.js → open-window-CdadJ5vo.js} +1 -1
- package/dist/assets/{over-due-invoice-payment-DvKFY6t9.js → over-due-invoice-payment-CXZ42RZu.js} +1 -1
- package/dist/assets/{overview-DNVfcZQO.js → overview-a9TXaGnH.js} +3 -3
- package/dist/assets/{page-header-CHAwrgX-.js → page-header-BZv-tfgN.js} +1 -1
- package/dist/assets/passport-C_PAxd9K.js +1 -0
- package/dist/assets/passport-item-BudJHbYX.js +1 -0
- package/dist/assets/{permission-C0rLyhnq.js → permission-CeqEAPPT.js} +1 -1
- package/dist/assets/preferences-ixUbb8gE.js +1 -0
- package/dist/assets/profile-embed-BIwa1Yt3.js +1 -0
- package/dist/assets/provider-icon-CkqIY6iX.js +1 -0
- package/dist/assets/{pt-CrMGrBZ6.js → pt-Dl6732JN.js} +2 -2
- package/dist/assets/publish-resource-BpvxLOlV.js +1 -0
- package/dist/assets/question-mark-circle.svg-GhTaklFN.js +1 -0
- package/dist/assets/{react-beautiful-dnd.esm-BZjy3RlT.js → react-beautiful-dnd.esm-BwIgGfYj.js} +4 -4
- package/dist/assets/{react-stripe.esm-CVZErl8X.js → react-stripe.esm-5Snjx_mn.js} +1 -1
- package/dist/assets/{required-BQln5OcV.js → required-DHjZE3-Y.js} +1 -1
- package/dist/assets/revoke.svg-DUoaRyPZ.js +1 -0
- package/dist/assets/{ru-up3R57Pv.js → ru-CVUeN9AX.js} +2 -2
- package/dist/assets/runtime-TkU2snTc.js +1 -0
- package/dist/assets/{sanitize-yVk8VEIO.js → sanitize-yX1j-ggS.js} +1 -1
- package/dist/assets/sdk-CMvNWVGa.js +1 -0
- package/dist/assets/{section-jXB9AxBb.js → section-CenHBXqj.js} +1 -1
- package/dist/assets/{security-Ch3TxRbd.js → security-Dw0iwARQ.js} +3 -3
- package/dist/assets/server-logo-notext.svg-BLAdvsmP.js +1 -0
- package/dist/assets/{session-5s-U-ruq.js → session-Cin9Rizr.js} +1 -1
- package/dist/assets/setup-Daw0Bdkr.js +24 -0
- package/dist/assets/{shorten-label-C4py9TLA.js → shorten-label-DXFyDHDr.js} +1 -1
- package/dist/assets/simple-select-DtCsUIHR.js +1 -0
- package/dist/assets/{spaces-BE9CZzeJ.js → spaces-DghHe7uP.js} +1 -1
- package/dist/assets/start-SLdZOtVD.js +187 -0
- package/dist/assets/{starting-progress-MyalFKYG.js → starting-progress-BiI8hmaj.js} +2 -2
- package/dist/assets/status-DRNtY6SL.js +1 -0
- package/dist/assets/{step-actions-X2c_czAD.js → step-actions-Cb6B0FCJ.js} +1 -1
- package/dist/assets/{studio-BcQoXvqZ.js → studio-CVfdma-R.js} +1 -1
- package/dist/assets/{switch-BjA8SIAh.js → switch-C49IloVU.js} +1 -1
- package/dist/assets/{switch-control-D2RiXLWV.js → switch-control-npfWE_aC.js} +1 -1
- package/dist/assets/{table-tips-Dgzi4H1y.js → table-tips-DMrnJF8e.js} +1 -1
- package/dist/assets/team-DkV63Yjl.js +146 -0
- package/dist/assets/{th-DdNj2Ao6.js → th-32eBNQes.js} +2 -2
- package/dist/assets/{traffic-CvgJe_3z.js → traffic-C8BReAMz.js} +1 -1
- package/dist/assets/transfer-Dt4V38KL.js +16 -0
- package/dist/assets/unsubscribe-rCcvC6Dj.js +1 -0
- package/dist/assets/{use-app-logo-Cfo-T8ZY.js → use-app-logo-DnCfhAzv.js} +1 -1
- package/dist/assets/{use-mobile-BINJTzMb.js → use-mobile-Bz2ML4Gk.js} +1 -1
- package/dist/assets/{use-mobile-D5clNlrm.js → use-mobile-_vjPRYx2.js} +1 -1
- package/dist/assets/use-server-logo-Da86xnyt.js +1 -0
- package/dist/assets/{use-window-close-4WCUBrSc.js → use-window-close-DUJmRIjM.js} +1 -1
- package/dist/assets/{useAsync-DVl73fmG.js → useAsync-D0xh4Var.js} +1 -1
- package/dist/assets/{useAsync-Dotoxibi.js → useAsync-D6IP8T2e.js} +1 -1
- package/dist/assets/{useAsyncRetry-r8dEPb-x.js → useAsyncRetry-B_bXUXWM.js} +1 -1
- package/dist/assets/{useLocalStorage-Cl1rEjxs.js → useLocalStorage-Brr2PSz9.js} +1 -1
- package/dist/assets/user-center-Cnc61do7.js +125 -0
- package/dist/assets/user-follower-Cc2pWcSL.js +32 -0
- package/dist/assets/{util-CDBgZOAd.js → util-BgLSp_5A.js} +1 -1
- package/dist/assets/{util-BNGEGQGN.js → util-CMCJQTXJ.js} +1 -1
- package/dist/assets/{vendor-arcblock-B1iA4v4a.js → vendor-arcblock-BCP2x3BR.js} +19 -19
- package/dist/assets/{vendor-hooks-qxhUUbW5.js → vendor-hooks-DQAdyHrE.js} +2 -2
- package/dist/assets/{vendor-mui-core-DnR6WYuU.js → vendor-mui-core-CKKG_1TN.js} +2 -2
- package/dist/assets/{vendor-mui-x-CQc01l4r.js → vendor-mui-x-DHGvg6Bj.js} +1 -1
- package/dist/assets/{vendor-utils-CxWN1dT3.js → vendor-utils-CUs2ebe7.js} +17 -17
- package/dist/assets/vendor-ux-DjXlxcvL.js +1560 -0
- package/dist/assets/{vi-HNh41Xxk.js → vi-DF8IinAc.js} +2 -2
- package/dist/assets/{wait-connect-VFnD4S6k.js → wait-connect-TKbZWSFd.js} +1 -1
- package/dist/assets/{wizard-D6nEp8xR.js → wizard-BSaM_cSr.js} +1 -1
- package/dist/assets/wizard-components-BOHnkwWH.js +52 -0
- package/dist/assets/wrap-locale-CFhaO2KZ.js +1 -0
- package/dist/assets/{zh-MM5bvwO_.js → zh-ByJkLAV1.js} +2 -2
- package/dist/assets/{zh-LGxmNDus.js → zh-DG89vJJ6.js} +1 -1
- package/dist/assets/{zh-tw-Dr5DyPwA.js → zh-tw-34G9tsUP.js} +2 -2
- package/dist/index.html +2 -2
- package/package.json +46 -46
- package/dist/assets/Community-CELsDteM.js +0 -1
- package/dist/assets/Holiday-DOCjSYjH.js +0 -1
- package/dist/assets/Meeting-BAXt_LiK.js +0 -1
- package/dist/assets/OffSick-BGEr8Nkc.js +0 -1
- package/dist/assets/WorkingRemotely-BcneAIXG.js +0 -1
- package/dist/assets/add-resource-B3-VwSQg.js +0 -1
- package/dist/assets/addon-DckWyYy3.js +0 -14
- package/dist/assets/advanced-BcLdGbJh.js +0 -14
- package/dist/assets/aigne-Dehkd-7B.js +0 -10
- package/dist/assets/api-FQQlzPOP.js +0 -1
- package/dist/assets/arrow-down.svg-C4FUKwt4.js +0 -1
- package/dist/assets/base32-BPZDlXZz.js +0 -1
- package/dist/assets/bind-account-DtN3r3bu.js +0 -1
- package/dist/assets/branding-Aq4o2tjp.js +0 -1
- package/dist/assets/bundle-avatar-Dtpi1uSw.js +0 -1
- package/dist/assets/button-D6aVYj2n.js +0 -1
- package/dist/assets/cloneDeep-C2rlAYcK.js +0 -1
- package/dist/assets/config-n9Go4CIg.js +0 -53
- package/dist/assets/config-space-DNGDnW7P.js +0 -1
- package/dist/assets/connect-B84DSta0.js +0 -1
- package/dist/assets/connect-CmaOf6IU.js +0 -5
- package/dist/assets/connect-to-BEfFI4oa.js +0 -1
- package/dist/assets/createClass-DXSToV70.js +0 -1
- package/dist/assets/did-address-B3eXeL7H.js +0 -1
- package/dist/assets/domains-BmgTqdar.js +0 -1
- package/dist/assets/edit.svg-RRSklUg-.js +0 -1
- package/dist/assets/email-0rfuUid8.js +0 -17
- package/dist/assets/engine-D-_cbl3F.js +0 -1
- package/dist/assets/exchange-passport-DtpDKfXH.js +0 -1
- package/dist/assets/gen-simple-access-key-BRpJnjDR.js +0 -1
- package/dist/assets/get-safe-url-xl2OarvZ.js +0 -1
- package/dist/assets/index-BMtr5-CV.js +0 -1
- package/dist/assets/index-BODmBNkm.js +0 -200
- package/dist/assets/index-C6oxUE_X.js +0 -281
- package/dist/assets/index-CfA9D2iF.js +0 -1
- package/dist/assets/index-DUo9jXH_.js +0 -81
- package/dist/assets/index-DcjD74XY.js +0 -1
- package/dist/assets/index-DrVXX4fX.css +0 -1
- package/dist/assets/index-E4Hos_Sx.js +0 -150
- package/dist/assets/index-NWCpUGtr.js +0 -1039
- package/dist/assets/index-TG3kf9io.js +0 -120
- package/dist/assets/invitation-CVulfNR5.js +0 -177
- package/dist/assets/invitations-CuhR5Qhr.js +0 -3
- package/dist/assets/issue-passport-CgdZdVEa.js +0 -1
- package/dist/assets/landing-page-Bu1ZaLGu.js +0 -1
- package/dist/assets/list-BYNjj68R.js +0 -2
- package/dist/assets/localization-CZX-M3IK.js +0 -1
- package/dist/assets/lock.svg-BgybwZNe.js +0 -1
- package/dist/assets/logger-Biwe4SzB.js +0 -1
- package/dist/assets/login-DUYsZ42N.js +0 -1
- package/dist/assets/omit-spWLSLbo.js +0 -1
- package/dist/assets/passport-BNRZfcVH.js +0 -1
- package/dist/assets/passport-item-Bf_kXmId.js +0 -1
- package/dist/assets/preferences-XGJx_7ht.js +0 -1
- package/dist/assets/profile-embed-DROgyynT.js +0 -1
- package/dist/assets/publish-resource-C3tnQoPG.js +0 -1
- package/dist/assets/question-mark-circle.svg-CByEVDhb.js +0 -1
- package/dist/assets/revoke.svg-CNl4LAbv.js +0 -1
- package/dist/assets/runtime-DiEn6rZ9.js +0 -1
- package/dist/assets/sdk-C45BrgFy.js +0 -1
- package/dist/assets/server-logo-notext.svg-xZ-i1SpD.js +0 -1
- package/dist/assets/setup-DgF_JFoX.js +0 -24
- package/dist/assets/simple-select-EppOca29.js +0 -1
- package/dist/assets/start-D6EkscL8.js +0 -187
- package/dist/assets/status-vSa6pwrP.js +0 -1
- package/dist/assets/team-D9lFN8Pe.js +0 -146
- package/dist/assets/transfer-IRaap94c.js +0 -16
- package/dist/assets/unsubscribe-7WUPZn-b.js +0 -1
- package/dist/assets/use-server-logo-Cv1kAPgB.js +0 -1
- package/dist/assets/user-center-BoGQKLvn.js +0 -125
- package/dist/assets/user-follower-D8NzTP2C.js +0 -32
- package/dist/assets/vendor-ux-jvAfFAl1.js +0 -1563
- package/dist/assets/wizard-components-CQAhuCn-.js +0 -52
- package/dist/assets/wrap-locale-qgV7mOv6.js +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{W as B,j as l,a6 as Tt,at as tt,ak as te,D as $t,T as je,J as Yt,bX as ei,a5 as ti,I as No,cy as Ao,S as Do,cu as va,ba as ya,aP as Mo,F as ba,z as Hn,bv as xa,bw as wa,bx as Sa,bf as Ea,aZ as Bo,V as ka,aO as Ta,cP as ja,cQ as Oa,cq as Ca,cG as Ia,M as ni,am as Fo,aq as Ra,b6 as lt,c5 as Pa,c7 as La,a8 as $o,ad as Uo,aV as _a,aj as qo,Q as jn,Y as Na,ca as Wo,o as zo,aU as Aa,ar as Ht,cR as Da,cS as Ma,b4 as ki,U as Ti,ah as Ba,bg as Fa,O as $a,K as Ua,P as qa,ai as Wa,an as Vo,A as ji,aI as za,cT as Va}from"./vendor-mui-core-
|
|
1
|
+
import{W as B,j as l,a6 as Tt,at as tt,ak as te,D as $t,T as je,J as Yt,bX as ei,a5 as ti,I as No,cy as Ao,S as Do,cu as va,ba as ya,aP as Mo,F as ba,z as Hn,bv as xa,bw as wa,bx as Sa,bf as Ea,aZ as Bo,V as ka,aO as Ta,cP as ja,cQ as Oa,cq as Ca,cG as Ia,M as ni,am as Fo,aq as Ra,b6 as lt,c5 as Pa,c7 as La,a8 as $o,ad as Uo,aV as _a,aj as qo,Q as jn,Y as Na,ca as Wo,o as zo,aU as Aa,ar as Ht,cR as Da,cS as Ma,b4 as ki,U as Ti,ah as Ba,bg as Fa,O as $a,K as Ua,P as qa,ai as Wa,an as Vo,A as ji,aI as za,cT as Va}from"./vendor-mui-core-CKKG_1TN.js";import{r as q,g as ri,j as Ka,u as Ga,p as Ha,e as Xa,a as Ft,d as Ya,f as Rn,m as Ja}from"./vendor-react-CTtPmzVP.js";import{r as ii,S as Qa,s as Ko,A as Za}from"./item-BabsiwzU.js";import{F as vt,a_ as oi,a1 as Go,V as xt,K as yt,ay as el,W as Xn,bE as Oi,l as Qt,a3 as Ho,Y as Vn,bd as Xo,al as tl,b2 as nl,u as Fr,bF as rl}from"./vendor-ux-DjXlxcvL.js";import{Z as dn,q as Bt,c as il,bx as ol,by as Yn,bv as sl,bz as al,bA as ll,bB as Yo,bC as cl,bD as ul,bE as dl,ba as hl,z as fl,_ as pl,w as Jo,bF as ml,bG as gl,ay as vl,bH as yl,Y as Jn,bI as Qo,bq as Zo,k as Qn,b8 as Ci,bJ as bl,bo as xl,bK as wl,J as Xt,bL as Sl,bM as Pn,bN as Ii,bO as El}from"./index-BEfIUbZC.js";import{j as Ri,o as kl,T as Tl,L as jl,P as Ol}from"./vendor-arcblock-BCP2x3BR.js";import{u as Pi}from"./launch-result-message-C04PaKk0.js";import{a as $r}from"./page-header-BZv-tfgN.js";import{e as gt,B as Cl,z as rn,F as Zn,A as Li,a8 as es,a3 as Il,ad as Rl,x as Pl,o as sr,ae as Ll,ak as _l,al as Nl,am as Al,a as xn,an as Dl,b as Ml}from"./vendor-utils-CUs2ebe7.js";import{f as Ur}from"./index-DBs9Ljax.js";import{e as Bl}from"./engine-DOYgeVKF.js";import{u as Fl,C as $l}from"./config-space-BZQrckxG.js";import{R as Ln}from"./required-DHjZE3-Y.js";import{S as Ul}from"./index-BrDWLIA2.js";import{s as ts,h as ql,w as Wl,f as zl,a as Vl,b as Kl,c as Gl,M as Hl}from"./index-oucqu2vy.js";import{p as On,a as Xl,b as Yl,u as ns,g as Jl,s as Ql}from"./vendor-hooks-DQAdyHrE.js";import{g as Zl}from"./get-safe-url-DxqVk96E.js";import{r as rs,A as ec}from"./config-CoSaZVwp.js";import{r as tc}from"./index-_tncRnTu.js";import{r as nc}from"./cloneDeep-rgNCMFod.js";import{u as si}from"./useLocalStorage-Brr2PSz9.js";import{v as _i}from"./index-BSZ3mQac.js";import{u as rc}from"./session-Cin9Rizr.js";import{W as ic}from"./did-address-Cq16cwTy.js";import{a as Ni}from"./api-B24x7kOD.js";import{v as oc,e as sc}from"./util-CMCJQTXJ.js";import{u as is}from"./use-mobile-_vjPRYx2.js";import{C as ac}from"./content-layout-Dtfb5X6M.js";import{C as lc,D as cc,a as uc}from"./connect-to-CVH3cw77.js";import{d as ar}from"./search-4YYphs0l.js";const Nf="blocklet-add-component-registry",Af="server-add-registry",Df=e=>`resource-${e}-add-registry`;function os(e){const{info:t}=dn();return q.useMemo(()=>!e||!e.docker?.image||e.docker?.image&&e.docker?.runBaseScript?!0:window.blocklet?window.blocklet.enableDocker&&window.blocklet.enableDockerNetwork:t.enableDocker&&t.enableDockerNetwork,[e,t])}function ss({disabled:e=!1,children:t,onConfirm:r}){return q.useEffect(()=>{if(e)return()=>{};const i=s=>{s.code==="Enter"&&(s.metaKey===!0||s.ctrlKey===!0)&&(s.preventDefault(),s.stopPropagation(),r())};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[e,r]),t}ss.propTypes={disabled:B.bool,children:B.any.isRequired,onConfirm:B.func.isRequired};function as({onContinue:e,nextDisabled:t=!1,launching:r=!1,texts:i={listenName:"",launchingText:"",buttonNext:""},description:s=""}){const[n,o]=q.useState(!1);return l.jsxs(l.Fragment,{children:[l.jsx(dc,{children:l.jsxs(ss,{disabled:t,onConfirm:e,children:[l.jsx("div",{className:"eula-trigger",onClick:()=>o(a=>!a),children:i.listenName}),l.jsx(vt,{disabled:t,color:"primary",variant:"contained",className:"next-button",onClick:e,children:r?l.jsxs(l.Fragment,{children:[l.jsx(Tt,{size:14}),i.launchingText]}):i.buttonNext})]})}),l.jsx(oi,{open:n,title:i.listenName,onClose:()=>o(!1),children:s})]})}as.propTypes={onContinue:B.func.isRequired,nextDisabled:B.bool,launching:B.bool,description:B.any,texts:B.object};const dc=tt.div`
|
|
2
2
|
margin: 0 auto;
|
|
3
3
|
display: flex;
|
|
4
4
|
justify-content: space-between;
|
|
@@ -113,7 +113,7 @@ import{W as B,j as l,a6 as Tt,at as tt,ak as te,D as $t,T as je,J as Yt,bX as ei
|
|
|
113
113
|
.wmde-markdown[data-color-mode='dark'] {
|
|
114
114
|
background: transparent;
|
|
115
115
|
}
|
|
116
|
-
`;ds.propTypes={blockletMeta:B.object.isRequired,locale:B.string.isRequired,handleDescEle:B.node};function Fc({...e}){return l.jsxs("div",{...e,style:{width:"100%"},children:[l.jsx("h3",{children:"End User License Agreement for Application"}),l.jsxs("p",{children:["Blocklet Server License Agreement ",
|
|
116
|
+
`;ds.propTypes={blockletMeta:B.object.isRequired,locale:B.string.isRequired,handleDescEle:B.node};function Fc({...e}){return l.jsxs("div",{...e,style:{width:"100%"},children:[l.jsx("h3",{children:"End User License Agreement for Application"}),l.jsxs("p",{children:["Blocklet Server License Agreement ",il.COPYRIGHT_OWNER," version 2020-08-28"]}),l.jsx("p",{children:"BLOCKLET SERVER LICENSE AGREEMENT"}),l.jsx("p",{children:"暂无"})]})}function $c(e){return`${e.bundleSource?.store||e.meta.homepage}/assets/${e.meta?.did}/${e.meta?.logo||"logo.png"}?v=${e.meta?.version}`}function hs({installRelated:e=!1,meta:t=null,show:r=!1,onClose:i,components:s,loading:n}){const{t:o}=xt(),a=Yt(f=>f.breakpoints.down("md"));if(!r)return null;const d=!n&&s.length===0,h=!n&&s.length!==0,u=40;return l.jsxs(oi,{title:o("blocklet.component.relatedComponents",{name:t.title}),maxWidth:!1,fullWidth:!1,onClose:(f,j)=>{j!=="backdropClick"&&i(!1)},PaperProps:{style:a?{width:"100%",height:window.innerHeight}:{maxWidth:500,minWidth:300,width:"80%"}},showCloseButton:!0,disableEscapeKeyDown:!0,open:!0,children:[n&&l.jsx(te,{sx:{marginTop:4,display:"flex",flexDirection:"row",justifyContent:"center",alignItems:"center"},children:l.jsx(te,{component:yt,icon:"line-md:loading-loop",sx:{color:"primary.main",fontSize:32}})}),d&&l.jsx(te,{sx:{textAlign:"center"},children:o("blocklet.component.noDependencies",{name:t.title})}),h&&l.jsx(te,{sx:{marginBottom:2},children:s.map(f=>{if(!f.meta)return null;const{required:j}=f;let m;return e||j?m=1:m=.5,l.jsxs(te,{sx:{opacity:m,padding:"10px 0px",paddingBottom:.5,marginTop:0,display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"flex-start"},children:[l.jsx("img",{style:{width:u,height:u,minWidth:u,minHeight:u},src:$c(f),alt:f.meta.title}),l.jsxs(te,{sx:{display:"flex",flexDirection:"column",justifyContent:"start",alignItems:"start",flex:1,marginLeft:2},children:[l.jsxs(te,{sx:{display:"flex",flexDirection:"row",justifyContent:"start",alignItems:"center",fontSize:"16px",fontWeight:"bold",cursor:"pointer",".link-icon":{opacity:0},":hover .link-icon":{opacity:1}},onClick:()=>{window.open(Zl(`${f.bundleSource?.store||f.meta.homepage}/blocklets/${f.meta.did}`,{allowDomains:null}),"_blank")},children:[f.meta.title,l.jsx(te,{sx:{display:j?"inline-block":"none",fontSize:"12px",fontWeight:"bold",marginLeft:1},children:o("blocklet.component.required")}),l.jsxs(te,{sx:{paddingLeft:1,fontSize:"13px",fontWeight:"400"},component:"span",children:[f.meta.version,l.jsx(te,{className:"link-icon",icon:"fluent:open-20-filled",component:yt,sx:{color:"primary.main",fontSize:16,transform:"translate(6px, 3px)",transition:"all 0.1s"}})]})]}),l.jsx(te,{sx:{marginTop:0,opacity:.7},children:f.meta.description})]})]},f.meta.did)})})]})}hs.propTypes={meta:B.object,show:B.bool,onClose:B.func.isRequired,installRelated:B.func,components:B.array.isRequired,loading:B.bool.isRequired};function Uc(e){return e&&e.registryUrl&&e.did?`${e.registryUrl}/api/blocklets/${e?.did}/blocklet.json`:""}function qc(e){const{api:t}=dn(),[r]=Ka(),i=r.get("blocklet_meta_url")||Uc(e),[s,n]=q.useState([]),[o,a]=q.useState(!1);return q.useEffect(()=>{!i||e?.inputUrl||(a(!0),t.getDynamicComponents({input:{url:i}}).then(d=>{n(d.components)}).finally(()=>{a(!1)}))},[i]),{components:s,loading:o}}function fs({installRelated:e=!0,onChangeInstallRelated:t=null,meta:r,onClickNext:i=null,handleDescEle:s=""}){const n=Ga(),{t:o,locale:a}=xt(),[d,h]=q.useState(!1),{components:u,loading:f}=qc(r),j=os(r),m=i||(()=>{n(`/launch-blocklet/install${window.location.search}`)}),S=()=>{h(!0)},E=()=>{h(!1)};return l.jsxs(Wc,{children:[l.jsx("div",{className:"app-content",children:l.jsx("div",{className:"agreement",children:l.jsx("div",{className:"agreement-content",children:j?l.jsx(ds,{blockletMeta:{data:r},locale:a,handleDescEle:s}):l.jsx(te,{sx:{p:3},children:l.jsx(je,{children:o("launchBlocklet.dockerBlockletCantInstall")})})})})}),l.jsxs(te,{className:"agreement-bottom",sx:{"> .agreement-loading":{color:"primary.main"}},children:[f?l.jsx(yt,{className:"agreement-loading",icon:"line-md:loading-loop",style:{fontSize:42,transform:"scale(0.6)"}}):null,j&&t&&u?.length?l.jsxs(te,{sx:{display:"flex",flexDirection:"row",justifyContent:"flex-start",alignItems:"center"},children:[l.jsx(ei,{sx:{mr:.5},checked:e,onChange:C=>t(C.currentTarget.checked),control:l.jsx(ti,{}),label:l.jsx("span",{children:o("launchBlocklet.installRelatedComponents")})}),l.jsx(te,{sx:{"> button svg":{color:"primary.main"}},children:l.jsx(No,{size:"small",onClick:S,children:l.jsx(yt,{icon:"octicon:package-dependencies-16"})})})]}):null,l.jsx("div",{className:"button-container","data-cy":"agree-all",children:j?l.jsx(as,{onContinue:m,description:l.jsx(Fc,{}),texts:{listenName:o("launchBlocklet.license"),buttonNext:o("launchBlocklet.next")}}):null})]}),l.jsx(hs,{installRelated:e,meta:r,show:d,onClose:E,components:u,loading:f})]})}fs.propTypes={meta:B.object.isRequired,onClickNext:B.func,handleDescEle:B.node,installRelated:B.bool,onChangeInstallRelated:B.func};const Wc=tt.div`
|
|
117
117
|
display: flex;
|
|
118
118
|
flex-direction: column;
|
|
119
119
|
align-items: center;
|
|
@@ -189,7 +189,7 @@ import{W as B,j as l,a6 as Tt,at as tt,ak as te,D as $t,T as je,J as Yt,bX as ei
|
|
|
189
189
|
padding-bottom: 16px;
|
|
190
190
|
}
|
|
191
191
|
}
|
|
192
|
-
`;var kt={},Nn={exports:{}},fr={exports:{}},qi;function ps(){if(qi)return fr.exports;qi=1;var e=fr.exports={github:{protocols:["git","http","git+ssh","git+https","ssh","https"],domain:"github.com",treepath:"tree",filetemplate:"https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}",bugstemplate:"https://{domain}/{user}/{project}/issues",gittemplate:"git://{auth@}{domain}/{user}/{project}.git{#committish}",tarballtemplate:"https://codeload.{domain}/{user}/{project}/tar.gz/{committish}"},bitbucket:{protocols:["git+ssh","git+https","ssh","https"],domain:"bitbucket.org",treepath:"src",tarballtemplate:"https://{domain}/{user}/{project}/get/{committish}.tar.gz"},gitlab:{protocols:["git+ssh","git+https","ssh","https"],domain:"gitlab.com",treepath:"tree",bugstemplate:"https://{domain}/{user}/{project}/issues",httpstemplate:"git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}",tarballtemplate:"https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}",pathmatch:/^\/([^/]+)\/((?!.*(\/-\/|\/repository(\/[^/]+)?\/archive\.tar\.gz)).*?)(?:\.git|\/)?$/},gist:{protocols:["git","git+ssh","git+https","ssh","https"],domain:"gist.github.com",pathmatch:/^[/](?:([^/]+)[/])?([a-z0-9]{7,})(?:[.]git)?$/,filetemplate:"https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}",bugstemplate:"https://{domain}/{project}",gittemplate:"git://{domain}/{project}.git{#committish}",sshtemplate:"git@{domain}:/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{project}.git{#committish}",browsetemplate:"https://{domain}/{project}{/committish}",browsefiletemplate:"https://{domain}/{project}{/committish}{#path}",docstemplate:"https://{domain}/{project}{/committish}",httpstemplate:"git+https://{domain}/{project}.git{#committish}",shortcuttemplate:"{type}:{project}{#committish}",pathtemplate:"{project}{#committish}",tarballtemplate:"https://codeload.github.com/gist/{project}/tar.gz/{committish}",hashformat:function(i){return"file-"+r(i)}}},t={sshtemplate:"git@{domain}:{user}/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{user}/{project}.git{#committish}",browsetemplate:"https://{domain}/{user}/{project}{/tree/committish}",browsefiletemplate:"https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}",docstemplate:"https://{domain}/{user}/{project}{/tree/committish}#readme",httpstemplate:"git+https://{auth@}{domain}/{user}/{project}.git{#committish}",filetemplate:"https://{domain}/{user}/{project}/raw/{committish}/{path}",shortcuttemplate:"{type}:{user}/{project}{#committish}",pathtemplate:"{user}/{project}{#committish}",pathmatch:/^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/,hashformat:r};Object.keys(e).forEach(function(i){Object.keys(t).forEach(function(s){e[i][s]||(e[i][s]=t[s])}),e[i].protocols_re=RegExp("^("+e[i].protocols.map(function(s){return s.replace(/([\\+*{}()[\]$^|])/g,"\\$1")}).join("|")+"):$")});function r(i){return i.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-")}return fr.exports}var pr,Wi;function zc(){if(Wi)return pr;Wi=1;var e=ps(),t=Object.assign||function(s,n){if(n===null||typeof n!="object")return s;const o=Object.keys(n);let a=o.length;for(;a--;)s[o[a]]=n[o[a]];return s};pr=r;function r(i,s,n,o,a,d,h){var u=this;u.type=i,Object.keys(e[i]).forEach(function(f){u[f]=e[i][f]}),u.user=s,u.auth=n,u.project=o,u.committish=a,u.default=d,u.opts=h||{}}return r.prototype.hash=function(){return this.committish?"#"+this.committish:""},r.prototype._fill=function(i,s){if(i){var n=t({},s);n.path=n.path?n.path.replace(/^[/]+/g,""):"",s=t(t({},this.opts),s);var o=this;Object.keys(this).forEach(function(m){o[m]!=null&&n[m]==null&&(n[m]=o[m])});var a=n.auth,d=n.committish,h=n.fragment,u=n.path,f=n.project;Object.keys(n).forEach(function(m){var S=n[m];(m==="path"||m==="project")&&typeof S=="string"?n[m]=S.split("/").map(function(E){return encodeURIComponent(E)}).join("/"):m!=="domain"&&(n[m]=encodeURIComponent(S))}),n["auth@"]=a?a+"@":"",n["#fragment"]=h?"#"+this.hashformat(h):"",n.fragment=n.fragment?n.fragment:"",n["#path"]=u?"#"+this.hashformat(u):"",n["/path"]=n.path?"/"+n.path:"",n.projectPath=f.split("/").map(encodeURIComponent).join("/"),s.noCommittish?(n["#committish"]="",n["/tree/committish"]="",n["/committish"]="",n.committish=""):(n["#committish"]=d?"#"+d:"",n["/tree/committish"]=n.committish?"/"+n.treepath+"/"+n.committish:"",n["/committish"]=n.committish?"/"+n.committish:"",n.committish=n.committish||"master");var j=i;return Object.keys(n).forEach(function(m){j=j.replace(new RegExp("[{]"+m+"[}]","g"),n[m])}),s.noGitPlus?j.replace(/^git[+]/,""):j}},r.prototype.ssh=function(i){return this._fill(this.sshtemplate,i)},r.prototype.sshurl=function(i){return this._fill(this.sshurltemplate,i)},r.prototype.browse=function(i,s,n){return typeof i=="string"?(typeof s!="string"&&(n=s,s=null),this._fill(this.browsefiletemplate,t({fragment:s,path:i},n))):this._fill(this.browsetemplate,i)},r.prototype.docs=function(i){return this._fill(this.docstemplate,i)},r.prototype.bugs=function(i){return this._fill(this.bugstemplate,i)},r.prototype.https=function(i){return this._fill(this.httpstemplate,i)},r.prototype.git=function(i){return this._fill(this.gittemplate,i)},r.prototype.shortcut=function(i){return this._fill(this.shortcuttemplate,i)},r.prototype.path=function(i){return this._fill(this.pathtemplate,i)},r.prototype.tarball=function(i){var s=t({},i,{noCommittish:!1});return this._fill(this.tarballtemplate,s)},r.prototype.file=function(i,s){return this._fill(this.filetemplate,t({path:i},s))},r.prototype.getDefaultRepresentation=function(){return this.default},r.prototype.toString=function(i){return this.default&&typeof this[this.default]=="function"?this[this.default](i):this.sshurl(i)},pr}var mr,zi;function Vc(){return zi||(zi=1,mr=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),mr}var gr,Vi;function Kc(){if(Vi)return gr;Vi=1,gr=e,e.Node=s,e.create=e;function e(n){var o=this;if(o instanceof e||(o=new e),o.tail=null,o.head=null,o.length=0,n&&typeof n.forEach=="function")n.forEach(function(h){o.push(h)});else if(arguments.length>0)for(var a=0,d=arguments.length;a<d;a++)o.push(arguments[a]);return o}e.prototype.removeNode=function(n){if(n.list!==this)throw new Error("removing node which does not belong to this list");var o=n.next,a=n.prev;return o&&(o.prev=a),a&&(a.next=o),n===this.head&&(this.head=o),n===this.tail&&(this.tail=a),n.list.length--,n.next=null,n.prev=null,n.list=null,o},e.prototype.unshiftNode=function(n){if(n!==this.head){n.list&&n.list.removeNode(n);var o=this.head;n.list=this,n.next=o,o&&(o.prev=n),this.head=n,this.tail||(this.tail=n),this.length++}},e.prototype.pushNode=function(n){if(n!==this.tail){n.list&&n.list.removeNode(n);var o=this.tail;n.list=this,n.prev=o,o&&(o.next=n),this.tail=n,this.head||(this.head=n),this.length++}},e.prototype.push=function(){for(var n=0,o=arguments.length;n<o;n++)r(this,arguments[n]);return this.length},e.prototype.unshift=function(){for(var n=0,o=arguments.length;n<o;n++)i(this,arguments[n]);return this.length},e.prototype.pop=function(){if(this.tail){var n=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,n}},e.prototype.shift=function(){if(this.head){var n=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,n}},e.prototype.forEach=function(n,o){o=o||this;for(var a=this.head,d=0;a!==null;d++)n.call(o,a.value,d,this),a=a.next},e.prototype.forEachReverse=function(n,o){o=o||this;for(var a=this.tail,d=this.length-1;a!==null;d--)n.call(o,a.value,d,this),a=a.prev},e.prototype.get=function(n){for(var o=0,a=this.head;a!==null&&o<n;o++)a=a.next;if(o===n&&a!==null)return a.value},e.prototype.getReverse=function(n){for(var o=0,a=this.tail;a!==null&&o<n;o++)a=a.prev;if(o===n&&a!==null)return a.value},e.prototype.map=function(n,o){o=o||this;for(var a=new e,d=this.head;d!==null;)a.push(n.call(o,d.value,this)),d=d.next;return a},e.prototype.mapReverse=function(n,o){o=o||this;for(var a=new e,d=this.tail;d!==null;)a.push(n.call(o,d.value,this)),d=d.prev;return a},e.prototype.reduce=function(n,o){var a,d=this.head;if(arguments.length>1)a=o;else if(this.head)d=this.head.next,a=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var h=0;d!==null;h++)a=n(a,d.value,h),d=d.next;return a},e.prototype.reduceReverse=function(n,o){var a,d=this.tail;if(arguments.length>1)a=o;else if(this.tail)d=this.tail.prev,a=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var h=this.length-1;d!==null;h--)a=n(a,d.value,h),d=d.prev;return a},e.prototype.toArray=function(){for(var n=new Array(this.length),o=0,a=this.head;a!==null;o++)n[o]=a.value,a=a.next;return n},e.prototype.toArrayReverse=function(){for(var n=new Array(this.length),o=0,a=this.tail;a!==null;o++)n[o]=a.value,a=a.prev;return n},e.prototype.slice=function(n,o){o=o||this.length,o<0&&(o+=this.length),n=n||0,n<0&&(n+=this.length);var a=new e;if(o<n||o<0)return a;n<0&&(n=0),o>this.length&&(o=this.length);for(var d=0,h=this.head;h!==null&&d<n;d++)h=h.next;for(;h!==null&&d<o;d++,h=h.next)a.push(h.value);return a},e.prototype.sliceReverse=function(n,o){o=o||this.length,o<0&&(o+=this.length),n=n||0,n<0&&(n+=this.length);var a=new e;if(o<n||o<0)return a;n<0&&(n=0),o>this.length&&(o=this.length);for(var d=this.length,h=this.tail;h!==null&&d>o;d--)h=h.prev;for(;h!==null&&d>n;d--,h=h.prev)a.push(h.value);return a},e.prototype.splice=function(n,o,...a){n>this.length&&(n=this.length-1),n<0&&(n=this.length+n);for(var d=0,h=this.head;h!==null&&d<n;d++)h=h.next;for(var u=[],d=0;h&&d<o;d++)u.push(h.value),h=this.removeNode(h);h===null&&(h=this.tail),h!==this.head&&h!==this.tail&&(h=h.prev);for(var d=0;d<a.length;d++)h=t(this,h,a[d]);return u},e.prototype.reverse=function(){for(var n=this.head,o=this.tail,a=n;a!==null;a=a.prev){var d=a.prev;a.prev=a.next,a.next=d}return this.head=o,this.tail=n,this};function t(n,o,a){var d=o===n.head?new s(a,null,o,n):new s(a,o,o.next,n);return d.next===null&&(n.tail=d),d.prev===null&&(n.head=d),n.length++,d}function r(n,o){n.tail=new s(o,n.tail,null,n),n.head||(n.head=n.tail),n.length++}function i(n,o){n.head=new s(o,null,n.head,n),n.tail||(n.tail=n.head),n.length++}function s(n,o,a,d){if(!(this instanceof s))return new s(n,o,a,d);this.list=d,this.value=n,o?(o.next=this,this.prev=o):this.prev=null,a?(a.prev=this,this.next=a):this.next=null}try{Vc()(e)}catch{}return gr}var vr,Ki;function Gc(){if(Ki)return vr;Ki=1;const e=Kc(),t=Symbol("max"),r=Symbol("length"),i=Symbol("lengthCalculator"),s=Symbol("allowStale"),n=Symbol("maxAge"),o=Symbol("dispose"),a=Symbol("noDisposeOnSet"),d=Symbol("lruList"),h=Symbol("cache"),u=Symbol("updateAgeOnGet"),f=()=>1;class j{constructor(O){if(typeof O=="number"&&(O={max:O}),O||(O={}),O.max&&(typeof O.max!="number"||O.max<0))throw new TypeError("max must be a non-negative number");this[t]=O.max||1/0;const w=O.length||f;if(this[i]=typeof w!="function"?f:w,this[s]=O.stale||!1,O.maxAge&&typeof O.maxAge!="number")throw new TypeError("maxAge must be a number");this[n]=O.maxAge||0,this[o]=O.dispose,this[a]=O.noDisposeOnSet||!1,this[u]=O.updateAgeOnGet||!1,this.reset()}set max(O){if(typeof O!="number"||O<0)throw new TypeError("max must be a non-negative number");this[t]=O||1/0,E(this)}get max(){return this[t]}set allowStale(O){this[s]=!!O}get allowStale(){return this[s]}set maxAge(O){if(typeof O!="number")throw new TypeError("maxAge must be a non-negative number");this[n]=O,E(this)}get maxAge(){return this[n]}set lengthCalculator(O){typeof O!="function"&&(O=f),O!==this[i]&&(this[i]=O,this[r]=0,this[d].forEach(w=>{w.length=this[i](w.value,w.key),this[r]+=w.length})),E(this)}get lengthCalculator(){return this[i]}get length(){return this[r]}get itemCount(){return this[d].length}rforEach(O,w){w=w||this;for(let R=this[d].tail;R!==null;){const F=R.prev;N(this,O,R,w),R=F}}forEach(O,w){w=w||this;for(let R=this[d].head;R!==null;){const F=R.next;N(this,O,R,w),R=F}}keys(){return this[d].toArray().map(O=>O.key)}values(){return this[d].toArray().map(O=>O.value)}reset(){this[o]&&this[d]&&this[d].length&&this[d].forEach(O=>this[o](O.key,O.value)),this[h]=new Map,this[d]=new e,this[r]=0}dump(){return this[d].map(O=>S(this,O)?!1:{k:O.key,v:O.value,e:O.now+(O.maxAge||0)}).toArray().filter(O=>O)}dumpLru(){return this[d]}set(O,w,R){if(R=R||this[n],R&&typeof R!="number")throw new TypeError("maxAge must be a number");const F=R?Date.now():0,D=this[i](w,O);if(this[h].has(O)){if(D>this[t])return C(this,this[h].get(O)),!1;const W=this[h].get(O).value;return this[o]&&(this[a]||this[o](O,W.value)),W.now=F,W.maxAge=R,W.value=w,this[r]+=D-W.length,W.length=D,this.get(O),E(this),!0}const ne=new c(O,w,D,F,R);return ne.length>this[t]?(this[o]&&this[o](O,w),!1):(this[r]+=ne.length,this[d].unshift(ne),this[h].set(O,this[d].head),E(this),!0)}has(O){if(!this[h].has(O))return!1;const w=this[h].get(O).value;return!S(this,w)}get(O){return m(this,O,!0)}peek(O){return m(this,O,!1)}pop(){const O=this[d].tail;return O?(C(this,O),O.value):null}del(O){C(this,this[h].get(O))}load(O){this.reset();const w=Date.now();for(let R=O.length-1;R>=0;R--){const F=O[R],D=F.e||0;if(D===0)this.set(F.k,F.v);else{const ne=D-w;ne>0&&this.set(F.k,F.v,ne)}}}prune(){this[h].forEach((O,w)=>m(this,w,!1))}}const m=($,O,w)=>{const R=$[h].get(O);if(R){const F=R.value;if(S($,F)){if(C($,R),!$[s])return}else w&&($[u]&&(R.value.now=Date.now()),$[d].unshiftNode(R));return F.value}},S=($,O)=>{if(!O||!O.maxAge&&!$[n])return!1;const w=Date.now()-O.now;return O.maxAge?w>O.maxAge:$[n]&&w>$[n]},E=$=>{if($[r]>$[t])for(let O=$[d].tail;$[r]>$[t]&&O!==null;){const w=O.prev;C($,O),O=w}},C=($,O)=>{if(O){const w=O.value;$[o]&&$[o](w.key,w.value),$[r]-=w.length,$[h].delete(w.key),$[d].removeNode(O)}};class c{constructor(O,w,R,F,D){this.key=O,this.value=w,this.length=R,this.now=F,this.maxAge=D||0}}const N=($,O,w,R)=>{let F=w.value;S($,F)&&(C($,w),$[s]||(F=void 0)),F&&O.call(R,F.value,F.key,$)};return vr=j,vr}var Gi;function Hc(){if(Gi)return Nn.exports;Gi=1;var e=al,t=ps(),r=Nn.exports=zc(),i=Gc(),s=new i({max:1e3}),n={"git+ssh:":"sshurl","git+https:":"https","ssh:":"sshurl","git:":"git"};function o(j){return n[j]||j.slice(0,-1)}var a={"git:":!0,"https:":!0,"git+https:":!0,"http:":!0,"git+http:":!0};Nn.exports.fromUrl=function(j,m){if(typeof j=="string"){var S=j+JSON.stringify(m||{});return s.has(S)||s.set(S,d(j,m)),s.get(S)}};function d(j,m){if(!(j==null||j==="")){var S=u(h(j)?"github:"+j:j),E=f(S),C=S.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/),c=Object.keys(t).map(function(N){try{var $=t[N],O=null;E.auth&&a[E.protocol]&&(O=E.auth);var w=E.hash?decodeURIComponent(E.hash.substr(1)):null,R=null,F=null,D=null;if(C&&C[1]===N)R=C[2]&&decodeURIComponent(C[2]),F=decodeURIComponent(C[3].replace(/\.git$/,"")),D="shortcut";else{if(E.host&&E.host!==$.domain&&E.host.replace(/^www[.]/,"")!==$.domain||!$.protocols_re.test(E.protocol)||!E.path)return;var ne=$.pathmatch,Y=E.path.match(ne);if(!Y)return;Y[1]!==null&&Y[1]!==void 0&&(R=decodeURIComponent(Y[1].replace(/^:/,""))),F=decodeURIComponent(Y[2]),D=o(E.protocol)}return new r(N,R,O,F,w,D,m)}catch(W){if(!(W instanceof URIError))throw W}}).filter(function(N){return N});if(c.length===1)return c[0]}}function h(j){return/^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(j)}function u(j){var m=e.parse(j);return m.protocol==="gist:"&&m.host&&!m.path?m.protocol+"/"+m.host:j}function f(j){var m=j.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/);if(!m){var S=e.parse(j);if(S.auth){const C=j.match(/[^@]+@[^:/]+/);if(C){var E=new e.URL(C[0]);S.auth=E.username||"",E.password&&(S.auth+=":"+E.password)}}return S}return{protocol:"git+ssh:",slashes:!0,auth:m[1],host:m[2],port:null,hostname:m[2],hash:m[4],search:null,query:null,pathname:"/"+m[3],path:"/"+m[3],href:"git+ssh://"+m[1]+"@"+m[2]+"/"+m[3]+(m[4]||"")}}return Nn.exports}var Kt={},ae={},yr,Hi;function Xc(){return Hi||(Hi=1,yr={charsWide:["ᄀ-ᇹ"," -〿","ぁ-ゔ","゙-ゞ","ァ-ヾ","ㄱ-ㆎ","㆐-㆟","㈀-㈜","㈠-㉃","㉠-㊰","㋀-㍶","㍻-㏝","㏠-㏾","一-龥","가-힣","-","豈-鶴"],charsFullWidth:["︰-﹄","﹉-﹒","﹔-﹫","!-~","¢-₩"]}),yr}var br,Xi;function Yc(){if(Xi)return br;Xi=1;const{charsWide:e,charsFullWidth:t}=Xc(),r=new RegExp(`[${e.join("")}${t.join("")}]`,"g");return br={default:s=>s.replace(r,"xx").length,charsRegex:r},br}/*!
|
|
192
|
+
`;var kt={},Nn={exports:{}},fr={exports:{}},qi;function ps(){if(qi)return fr.exports;qi=1;var e=fr.exports={github:{protocols:["git","http","git+ssh","git+https","ssh","https"],domain:"github.com",treepath:"tree",filetemplate:"https://{auth@}raw.githubusercontent.com/{user}/{project}/{committish}/{path}",bugstemplate:"https://{domain}/{user}/{project}/issues",gittemplate:"git://{auth@}{domain}/{user}/{project}.git{#committish}",tarballtemplate:"https://codeload.{domain}/{user}/{project}/tar.gz/{committish}"},bitbucket:{protocols:["git+ssh","git+https","ssh","https"],domain:"bitbucket.org",treepath:"src",tarballtemplate:"https://{domain}/{user}/{project}/get/{committish}.tar.gz"},gitlab:{protocols:["git+ssh","git+https","ssh","https"],domain:"gitlab.com",treepath:"tree",bugstemplate:"https://{domain}/{user}/{project}/issues",httpstemplate:"git+https://{auth@}{domain}/{user}/{projectPath}.git{#committish}",tarballtemplate:"https://{domain}/{user}/{project}/repository/archive.tar.gz?ref={committish}",pathmatch:/^\/([^/]+)\/((?!.*(\/-\/|\/repository(\/[^/]+)?\/archive\.tar\.gz)).*?)(?:\.git|\/)?$/},gist:{protocols:["git","git+ssh","git+https","ssh","https"],domain:"gist.github.com",pathmatch:/^[/](?:([^/]+)[/])?([a-z0-9]{7,})(?:[.]git)?$/,filetemplate:"https://gist.githubusercontent.com/{user}/{project}/raw{/committish}/{path}",bugstemplate:"https://{domain}/{project}",gittemplate:"git://{domain}/{project}.git{#committish}",sshtemplate:"git@{domain}:/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{project}.git{#committish}",browsetemplate:"https://{domain}/{project}{/committish}",browsefiletemplate:"https://{domain}/{project}{/committish}{#path}",docstemplate:"https://{domain}/{project}{/committish}",httpstemplate:"git+https://{domain}/{project}.git{#committish}",shortcuttemplate:"{type}:{project}{#committish}",pathtemplate:"{project}{#committish}",tarballtemplate:"https://codeload.github.com/gist/{project}/tar.gz/{committish}",hashformat:function(i){return"file-"+r(i)}}},t={sshtemplate:"git@{domain}:{user}/{project}.git{#committish}",sshurltemplate:"git+ssh://git@{domain}/{user}/{project}.git{#committish}",browsetemplate:"https://{domain}/{user}/{project}{/tree/committish}",browsefiletemplate:"https://{domain}/{user}/{project}/{treepath}/{committish}/{path}{#fragment}",docstemplate:"https://{domain}/{user}/{project}{/tree/committish}#readme",httpstemplate:"git+https://{auth@}{domain}/{user}/{project}.git{#committish}",filetemplate:"https://{domain}/{user}/{project}/raw/{committish}/{path}",shortcuttemplate:"{type}:{user}/{project}{#committish}",pathtemplate:"{user}/{project}{#committish}",pathmatch:/^[/]([^/]+)[/]([^/]+?)(?:[.]git|[/])?$/,hashformat:r};Object.keys(e).forEach(function(i){Object.keys(t).forEach(function(s){e[i][s]||(e[i][s]=t[s])}),e[i].protocols_re=RegExp("^("+e[i].protocols.map(function(s){return s.replace(/([\\+*{}()[\]$^|])/g,"\\$1")}).join("|")+"):$")});function r(i){return i.toLowerCase().replace(/^\W+|\/|\W+$/g,"").replace(/\W+/g,"-")}return fr.exports}var pr,Wi;function zc(){if(Wi)return pr;Wi=1;var e=ps(),t=Object.assign||function(s,n){if(n===null||typeof n!="object")return s;const o=Object.keys(n);let a=o.length;for(;a--;)s[o[a]]=n[o[a]];return s};pr=r;function r(i,s,n,o,a,d,h){var u=this;u.type=i,Object.keys(e[i]).forEach(function(f){u[f]=e[i][f]}),u.user=s,u.auth=n,u.project=o,u.committish=a,u.default=d,u.opts=h||{}}return r.prototype.hash=function(){return this.committish?"#"+this.committish:""},r.prototype._fill=function(i,s){if(i){var n=t({},s);n.path=n.path?n.path.replace(/^[/]+/g,""):"",s=t(t({},this.opts),s);var o=this;Object.keys(this).forEach(function(m){o[m]!=null&&n[m]==null&&(n[m]=o[m])});var a=n.auth,d=n.committish,h=n.fragment,u=n.path,f=n.project;Object.keys(n).forEach(function(m){var S=n[m];(m==="path"||m==="project")&&typeof S=="string"?n[m]=S.split("/").map(function(E){return encodeURIComponent(E)}).join("/"):m!=="domain"&&(n[m]=encodeURIComponent(S))}),n["auth@"]=a?a+"@":"",n["#fragment"]=h?"#"+this.hashformat(h):"",n.fragment=n.fragment?n.fragment:"",n["#path"]=u?"#"+this.hashformat(u):"",n["/path"]=n.path?"/"+n.path:"",n.projectPath=f.split("/").map(encodeURIComponent).join("/"),s.noCommittish?(n["#committish"]="",n["/tree/committish"]="",n["/committish"]="",n.committish=""):(n["#committish"]=d?"#"+d:"",n["/tree/committish"]=n.committish?"/"+n.treepath+"/"+n.committish:"",n["/committish"]=n.committish?"/"+n.committish:"",n.committish=n.committish||"master");var j=i;return Object.keys(n).forEach(function(m){j=j.replace(new RegExp("[{]"+m+"[}]","g"),n[m])}),s.noGitPlus?j.replace(/^git[+]/,""):j}},r.prototype.ssh=function(i){return this._fill(this.sshtemplate,i)},r.prototype.sshurl=function(i){return this._fill(this.sshurltemplate,i)},r.prototype.browse=function(i,s,n){return typeof i=="string"?(typeof s!="string"&&(n=s,s=null),this._fill(this.browsefiletemplate,t({fragment:s,path:i},n))):this._fill(this.browsetemplate,i)},r.prototype.docs=function(i){return this._fill(this.docstemplate,i)},r.prototype.bugs=function(i){return this._fill(this.bugstemplate,i)},r.prototype.https=function(i){return this._fill(this.httpstemplate,i)},r.prototype.git=function(i){return this._fill(this.gittemplate,i)},r.prototype.shortcut=function(i){return this._fill(this.shortcuttemplate,i)},r.prototype.path=function(i){return this._fill(this.pathtemplate,i)},r.prototype.tarball=function(i){var s=t({},i,{noCommittish:!1});return this._fill(this.tarballtemplate,s)},r.prototype.file=function(i,s){return this._fill(this.filetemplate,t({path:i},s))},r.prototype.getDefaultRepresentation=function(){return this.default},r.prototype.toString=function(i){return this.default&&typeof this[this.default]=="function"?this[this.default](i):this.sshurl(i)},pr}var mr,zi;function Vc(){return zi||(zi=1,mr=function(e){e.prototype[Symbol.iterator]=function*(){for(let t=this.head;t;t=t.next)yield t.value}}),mr}var gr,Vi;function Kc(){if(Vi)return gr;Vi=1,gr=e,e.Node=s,e.create=e;function e(n){var o=this;if(o instanceof e||(o=new e),o.tail=null,o.head=null,o.length=0,n&&typeof n.forEach=="function")n.forEach(function(h){o.push(h)});else if(arguments.length>0)for(var a=0,d=arguments.length;a<d;a++)o.push(arguments[a]);return o}e.prototype.removeNode=function(n){if(n.list!==this)throw new Error("removing node which does not belong to this list");var o=n.next,a=n.prev;return o&&(o.prev=a),a&&(a.next=o),n===this.head&&(this.head=o),n===this.tail&&(this.tail=a),n.list.length--,n.next=null,n.prev=null,n.list=null,o},e.prototype.unshiftNode=function(n){if(n!==this.head){n.list&&n.list.removeNode(n);var o=this.head;n.list=this,n.next=o,o&&(o.prev=n),this.head=n,this.tail||(this.tail=n),this.length++}},e.prototype.pushNode=function(n){if(n!==this.tail){n.list&&n.list.removeNode(n);var o=this.tail;n.list=this,n.prev=o,o&&(o.next=n),this.tail=n,this.head||(this.head=n),this.length++}},e.prototype.push=function(){for(var n=0,o=arguments.length;n<o;n++)r(this,arguments[n]);return this.length},e.prototype.unshift=function(){for(var n=0,o=arguments.length;n<o;n++)i(this,arguments[n]);return this.length},e.prototype.pop=function(){if(this.tail){var n=this.tail.value;return this.tail=this.tail.prev,this.tail?this.tail.next=null:this.head=null,this.length--,n}},e.prototype.shift=function(){if(this.head){var n=this.head.value;return this.head=this.head.next,this.head?this.head.prev=null:this.tail=null,this.length--,n}},e.prototype.forEach=function(n,o){o=o||this;for(var a=this.head,d=0;a!==null;d++)n.call(o,a.value,d,this),a=a.next},e.prototype.forEachReverse=function(n,o){o=o||this;for(var a=this.tail,d=this.length-1;a!==null;d--)n.call(o,a.value,d,this),a=a.prev},e.prototype.get=function(n){for(var o=0,a=this.head;a!==null&&o<n;o++)a=a.next;if(o===n&&a!==null)return a.value},e.prototype.getReverse=function(n){for(var o=0,a=this.tail;a!==null&&o<n;o++)a=a.prev;if(o===n&&a!==null)return a.value},e.prototype.map=function(n,o){o=o||this;for(var a=new e,d=this.head;d!==null;)a.push(n.call(o,d.value,this)),d=d.next;return a},e.prototype.mapReverse=function(n,o){o=o||this;for(var a=new e,d=this.tail;d!==null;)a.push(n.call(o,d.value,this)),d=d.prev;return a},e.prototype.reduce=function(n,o){var a,d=this.head;if(arguments.length>1)a=o;else if(this.head)d=this.head.next,a=this.head.value;else throw new TypeError("Reduce of empty list with no initial value");for(var h=0;d!==null;h++)a=n(a,d.value,h),d=d.next;return a},e.prototype.reduceReverse=function(n,o){var a,d=this.tail;if(arguments.length>1)a=o;else if(this.tail)d=this.tail.prev,a=this.tail.value;else throw new TypeError("Reduce of empty list with no initial value");for(var h=this.length-1;d!==null;h--)a=n(a,d.value,h),d=d.prev;return a},e.prototype.toArray=function(){for(var n=new Array(this.length),o=0,a=this.head;a!==null;o++)n[o]=a.value,a=a.next;return n},e.prototype.toArrayReverse=function(){for(var n=new Array(this.length),o=0,a=this.tail;a!==null;o++)n[o]=a.value,a=a.prev;return n},e.prototype.slice=function(n,o){o=o||this.length,o<0&&(o+=this.length),n=n||0,n<0&&(n+=this.length);var a=new e;if(o<n||o<0)return a;n<0&&(n=0),o>this.length&&(o=this.length);for(var d=0,h=this.head;h!==null&&d<n;d++)h=h.next;for(;h!==null&&d<o;d++,h=h.next)a.push(h.value);return a},e.prototype.sliceReverse=function(n,o){o=o||this.length,o<0&&(o+=this.length),n=n||0,n<0&&(n+=this.length);var a=new e;if(o<n||o<0)return a;n<0&&(n=0),o>this.length&&(o=this.length);for(var d=this.length,h=this.tail;h!==null&&d>o;d--)h=h.prev;for(;h!==null&&d>n;d--,h=h.prev)a.push(h.value);return a},e.prototype.splice=function(n,o,...a){n>this.length&&(n=this.length-1),n<0&&(n=this.length+n);for(var d=0,h=this.head;h!==null&&d<n;d++)h=h.next;for(var u=[],d=0;h&&d<o;d++)u.push(h.value),h=this.removeNode(h);h===null&&(h=this.tail),h!==this.head&&h!==this.tail&&(h=h.prev);for(var d=0;d<a.length;d++)h=t(this,h,a[d]);return u},e.prototype.reverse=function(){for(var n=this.head,o=this.tail,a=n;a!==null;a=a.prev){var d=a.prev;a.prev=a.next,a.next=d}return this.head=o,this.tail=n,this};function t(n,o,a){var d=o===n.head?new s(a,null,o,n):new s(a,o,o.next,n);return d.next===null&&(n.tail=d),d.prev===null&&(n.head=d),n.length++,d}function r(n,o){n.tail=new s(o,n.tail,null,n),n.head||(n.head=n.tail),n.length++}function i(n,o){n.head=new s(o,null,n.head,n),n.tail||(n.tail=n.head),n.length++}function s(n,o,a,d){if(!(this instanceof s))return new s(n,o,a,d);this.list=d,this.value=n,o?(o.next=this,this.prev=o):this.prev=null,a?(a.prev=this,this.next=a):this.next=null}try{Vc()(e)}catch{}return gr}var vr,Ki;function Gc(){if(Ki)return vr;Ki=1;const e=Kc(),t=Symbol("max"),r=Symbol("length"),i=Symbol("lengthCalculator"),s=Symbol("allowStale"),n=Symbol("maxAge"),o=Symbol("dispose"),a=Symbol("noDisposeOnSet"),d=Symbol("lruList"),h=Symbol("cache"),u=Symbol("updateAgeOnGet"),f=()=>1;class j{constructor(O){if(typeof O=="number"&&(O={max:O}),O||(O={}),O.max&&(typeof O.max!="number"||O.max<0))throw new TypeError("max must be a non-negative number");this[t]=O.max||1/0;const w=O.length||f;if(this[i]=typeof w!="function"?f:w,this[s]=O.stale||!1,O.maxAge&&typeof O.maxAge!="number")throw new TypeError("maxAge must be a number");this[n]=O.maxAge||0,this[o]=O.dispose,this[a]=O.noDisposeOnSet||!1,this[u]=O.updateAgeOnGet||!1,this.reset()}set max(O){if(typeof O!="number"||O<0)throw new TypeError("max must be a non-negative number");this[t]=O||1/0,E(this)}get max(){return this[t]}set allowStale(O){this[s]=!!O}get allowStale(){return this[s]}set maxAge(O){if(typeof O!="number")throw new TypeError("maxAge must be a non-negative number");this[n]=O,E(this)}get maxAge(){return this[n]}set lengthCalculator(O){typeof O!="function"&&(O=f),O!==this[i]&&(this[i]=O,this[r]=0,this[d].forEach(w=>{w.length=this[i](w.value,w.key),this[r]+=w.length})),E(this)}get lengthCalculator(){return this[i]}get length(){return this[r]}get itemCount(){return this[d].length}rforEach(O,w){w=w||this;for(let R=this[d].tail;R!==null;){const F=R.prev;N(this,O,R,w),R=F}}forEach(O,w){w=w||this;for(let R=this[d].head;R!==null;){const F=R.next;N(this,O,R,w),R=F}}keys(){return this[d].toArray().map(O=>O.key)}values(){return this[d].toArray().map(O=>O.value)}reset(){this[o]&&this[d]&&this[d].length&&this[d].forEach(O=>this[o](O.key,O.value)),this[h]=new Map,this[d]=new e,this[r]=0}dump(){return this[d].map(O=>S(this,O)?!1:{k:O.key,v:O.value,e:O.now+(O.maxAge||0)}).toArray().filter(O=>O)}dumpLru(){return this[d]}set(O,w,R){if(R=R||this[n],R&&typeof R!="number")throw new TypeError("maxAge must be a number");const F=R?Date.now():0,D=this[i](w,O);if(this[h].has(O)){if(D>this[t])return C(this,this[h].get(O)),!1;const W=this[h].get(O).value;return this[o]&&(this[a]||this[o](O,W.value)),W.now=F,W.maxAge=R,W.value=w,this[r]+=D-W.length,W.length=D,this.get(O),E(this),!0}const ne=new c(O,w,D,F,R);return ne.length>this[t]?(this[o]&&this[o](O,w),!1):(this[r]+=ne.length,this[d].unshift(ne),this[h].set(O,this[d].head),E(this),!0)}has(O){if(!this[h].has(O))return!1;const w=this[h].get(O).value;return!S(this,w)}get(O){return m(this,O,!0)}peek(O){return m(this,O,!1)}pop(){const O=this[d].tail;return O?(C(this,O),O.value):null}del(O){C(this,this[h].get(O))}load(O){this.reset();const w=Date.now();for(let R=O.length-1;R>=0;R--){const F=O[R],D=F.e||0;if(D===0)this.set(F.k,F.v);else{const ne=D-w;ne>0&&this.set(F.k,F.v,ne)}}}prune(){this[h].forEach((O,w)=>m(this,w,!1))}}const m=($,O,w)=>{const R=$[h].get(O);if(R){const F=R.value;if(S($,F)){if(C($,R),!$[s])return}else w&&($[u]&&(R.value.now=Date.now()),$[d].unshiftNode(R));return F.value}},S=($,O)=>{if(!O||!O.maxAge&&!$[n])return!1;const w=Date.now()-O.now;return O.maxAge?w>O.maxAge:$[n]&&w>$[n]},E=$=>{if($[r]>$[t])for(let O=$[d].tail;$[r]>$[t]&&O!==null;){const w=O.prev;C($,O),O=w}},C=($,O)=>{if(O){const w=O.value;$[o]&&$[o](w.key,w.value),$[r]-=w.length,$[h].delete(w.key),$[d].removeNode(O)}};class c{constructor(O,w,R,F,D){this.key=O,this.value=w,this.length=R,this.now=F,this.maxAge=D||0}}const N=($,O,w,R)=>{let F=w.value;S($,F)&&(C($,w),$[s]||(F=void 0)),F&&O.call(R,F.value,F.key,$)};return vr=j,vr}var Gi;function Hc(){if(Gi)return Nn.exports;Gi=1;var e=ol,t=ps(),r=Nn.exports=zc(),i=Gc(),s=new i({max:1e3}),n={"git+ssh:":"sshurl","git+https:":"https","ssh:":"sshurl","git:":"git"};function o(j){return n[j]||j.slice(0,-1)}var a={"git:":!0,"https:":!0,"git+https:":!0,"http:":!0,"git+http:":!0};Nn.exports.fromUrl=function(j,m){if(typeof j=="string"){var S=j+JSON.stringify(m||{});return s.has(S)||s.set(S,d(j,m)),s.get(S)}};function d(j,m){if(!(j==null||j==="")){var S=u(h(j)?"github:"+j:j),E=f(S),C=S.match(/^([^:]+):(?:[^@]+@)?(?:([^/]*)\/)?([^#]+)/),c=Object.keys(t).map(function(N){try{var $=t[N],O=null;E.auth&&a[E.protocol]&&(O=E.auth);var w=E.hash?decodeURIComponent(E.hash.substr(1)):null,R=null,F=null,D=null;if(C&&C[1]===N)R=C[2]&&decodeURIComponent(C[2]),F=decodeURIComponent(C[3].replace(/\.git$/,"")),D="shortcut";else{if(E.host&&E.host!==$.domain&&E.host.replace(/^www[.]/,"")!==$.domain||!$.protocols_re.test(E.protocol)||!E.path)return;var ne=$.pathmatch,Y=E.path.match(ne);if(!Y)return;Y[1]!==null&&Y[1]!==void 0&&(R=decodeURIComponent(Y[1].replace(/^:/,""))),F=decodeURIComponent(Y[2]),D=o(E.protocol)}return new r(N,R,O,F,w,D,m)}catch(W){if(!(W instanceof URIError))throw W}}).filter(function(N){return N});if(c.length===1)return c[0]}}function h(j){return/^[^:@%/\s.-][^:@%/\s]*[/][^:@\s/%]+(?:#.*)?$/.test(j)}function u(j){var m=e.parse(j);return m.protocol==="gist:"&&m.host&&!m.path?m.protocol+"/"+m.host:j}function f(j){var m=j.match(/^([^@]+)@([^:/]+):[/]?((?:[^/]+[/])?[^/]+?)(?:[.]git)?(#.*)?$/);if(!m){var S=e.parse(j);if(S.auth){const C=j.match(/[^@]+@[^:/]+/);if(C){var E=new e.URL(C[0]);S.auth=E.username||"",E.password&&(S.auth+=":"+E.password)}}return S}return{protocol:"git+ssh:",slashes:!0,auth:m[1],host:m[2],port:null,hostname:m[2],hash:m[4],search:null,query:null,pathname:"/"+m[3],path:"/"+m[3],href:"git+ssh://"+m[1]+"@"+m[2]+"/"+m[3]+(m[4]||"")}}return Nn.exports}var Kt={},ae={},yr,Hi;function Xc(){return Hi||(Hi=1,yr={charsWide:["ᄀ-ᇹ"," -〿","ぁ-ゔ","゙-ゞ","ァ-ヾ","ㄱ-ㆎ","㆐-㆟","㈀-㈜","㈠-㉃","㉠-㊰","㋀-㍶","㍻-㏝","㏠-㏾","一-龥","가-힣","-","豈-鶴"],charsFullWidth:["︰-﹄","﹉-﹒","﹔-﹫","!-~","¢-₩"]}),yr}var br,Xi;function Yc(){if(Xi)return br;Xi=1;const{charsWide:e,charsFullWidth:t}=Xc(),r=new RegExp(`[${e.join("")}${t.join("")}]`,"g");return br={default:s=>s.replace(r,"xx").length,charsRegex:r},br}/*!
|
|
193
193
|
* is-extglob <https://github.com/jonschlinkert/is-extglob>
|
|
194
194
|
*
|
|
195
195
|
* Copyright (c) 2014-2016, Jon Schlinkert.
|
|
@@ -203,7 +203,7 @@ import{W as B,j as l,a6 as Tt,at as tt,ak as te,D as $t,T as je,J as Yt,bX as ei
|
|
|
203
203
|
* is-var-name | ISC (c) Shinnosuke Watanabe
|
|
204
204
|
* https://github.com/shinnn/is-var-name
|
|
205
205
|
*/function tu(e){if(typeof e!="string"||e.trim()!==e)return!1;try{new Function(e,"var "+e)}catch{return!1}return!0}const nu=Object.freeze(Object.defineProperty({__proto__:null,default:tu},Symbol.toStringTag,{value:"Module"})),ru=Xa(nu);var Ge={},eo;function iu(){if(eo)return Ge;eo=1;const e=ii();function t(W){return W&&typeof W=="object"&&"default"in W?W.default:W}const r=t(e),i={"-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"},s={"--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},n={"-rm":!0,"--name":!0,"--label":!0,"--network":!0,"--user":!0},o={"--volume":!0,"--publish":!0},a=new Set(["--publish","--volume"]),d=W=>{const[U]=W.split(":");return U?.startsWith("/")||U?.startsWith("./")||U?.startsWith("../")||U?.startsWith("~")||U?.startsWith("$BLOCKLET")};function h(W){return W.map(U=>{if(U.key!=="--volume"||U.value.startsWith("$BLOCKLET_APP_DIR/")||U.value.startsWith("$BLOCKLET_DATA_DIR/"))return U;const[H,...A]=U.value.split(":");if(!H||!d(U.value))return U;const J=H.startsWith("/")?`$BLOCKLET_DATA_DIR${H}`:`$BLOCKLET_DATA_DIR/${H}`;return{...U,value:[J,...A].join(":")}})}function u(W){let U=!0;return W.find(A=>A.key==="--publish"&&A.type==="web")?W.map(A=>{if(A.key==="--publish"){const J={...A,type:U?"docker":A.type};return U=A.type==="web",J}return A}):W.map(A=>{if(A.key==="--publish"){const J={...A,type:U?"web":"docker"};return U=!1,J}return A})}function f(W){if(!W)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};if(W=W.trim(),W.startsWith("$ docker run")&&(W=W.replace("$ docker run","docker run")),!W.startsWith("docker run"))return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const H=W.replace(/\\\n/g,"").replace(/\n/g," ").trim().match(/(?:[^\s"']+|'[^']*'|"[^"]*")+/g);if(!H)return{dockerArgs:[],dockerEnvs:[],dockerImage:"",dockerCommand:""};const A=[],J=[];let M=0,ue="",Ie="";const K=[];for(;M<H.length;){const ce=H[M];if(!ce){M++;continue}if(ce==="docker"||ce==="run"){M++;continue}if((ce==="-e"||ce==="--env")&&M+1<H.length){const Me=H[M+1]||"",[me,...Oe]=Me.split("=");if(me){const Pe=Oe.join("=").replace(/^['"]|['"]$/g,"");J.push({key:me,value:Pe})}M+=2;continue}if(ce.startsWith("-")&&K.length===0){const Me=ce.indexOf("=");let me=ce,Oe=null;Me!==-1&&(me=ce.substring(0,Me),Oe=ce.substring(Me+1).replace(/^['"]|['"]$/g,""));const Pe=i[me];if(!Pe){M+=2;continue}if(Pe==="--publish"){let nt="";if(Oe)nt=Oe,A.push({key:Pe,value:nt});else if(M+1<H.length&&!(H[M+1]||"").startsWith("-")){nt=(H[M+1]||"").replace(/^['"]|['"]$/g,""),A.push({key:Pe,value:nt}),M+=2;continue}else{A.push({key:Pe,value:"true"}),M++;continue}M++;continue}if(Oe!==null){A.push({key:Pe,value:Oe}),M++;continue}else if(M+1<H.length&&!(H[M+1]||"").startsWith("-")){const nt=(H[M+1]||"").replace(/^['"]|['"]$/g,"");A.push({key:Pe,value:nt}),M+=2;continue}else{A.push({key:Pe,value:"true"}),M++;continue}}K.push(ce),M++}ue=K[0]||"",Ie=K.slice(1).join(" ");const Ee=[];for(const ce of A)ce.name="",ce.path="",ce.prefix="",ce.protocol="",ce.proxyBehavior="service",ce.type="docker",!(a.has(ce.key)&&ce.value==="true")&&Ee.push(ce);for(const ce of J)ce.custom="",ce.description="",ce.secure=!1,ce.shared=!1,ce.required=!1;return{dockerArgs:u(h(Ee)),dockerEnvs:J,dockerImage:ue,dockerCommand:Ie}}function j({dockerArgs:W,dockerEnvs:U,dockerImage:H,dockerCommand:A}){if(W.length===0&&U.length===0&&!H)return"";const J=["docker run \\"],M=new Set(["--publish","--volume","--expose","--device","--mount","--label","--cap-add","--cap-drop","--add-host","--dns","--network-alias","--sysctl","--ulimit","--network"]);for(const ue of W){const{key:Ie,value:K}=ue;if(M.has(Ie))if(K==="true")J.push(` ${Ie} \\`);else{const Ee=/[\s"']/g.test(K)?`"${K}"`:K;J.push(` ${Ie} ${Ee} \\`)}else if(!J.some(Ee=>Ee.startsWith(` ${Ie}`)))if(K==="true")J.push(` ${Ie} \\`);else{const Ee=/[\s"']/g.test(K)?`"${K}"`:K;J.push(` ${Ie} ${Ee} \\`)}}for(const ue of U){const{key:Ie,value:K}=ue,Ee=/["']/g.test(K)?K:`"${K}"`;J.push(` -e ${Ie}=${Ee} \\`)}return H&&J.push(` ${H} \\`),A&&J.push(` ${A} \\`),J[J.length-1]?.endsWith(" \\")&&(J[J.length-1]=(J[J.length-1]||"").slice(0,-2)),J.join(`
|
|
206
|
-
`)}const m={"--volume":W=>{const[U]=W.split(":");return U?d(W)&&!W.startsWith("$BLOCKLET_APP_DIR/")&&!W.startsWith("$BLOCKLET_DATA_DIR/")?"Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR":W.indexOf("..")>-1?'Volume cannot contain ".."':"":"Volume must start with key:value"}},S=W=>W.replace(/^[-]+/,"").replace(/-([a-z])/g,(A,J)=>J.toUpperCase()),E=W=>`--${W.replace(/([A-Z])/g,"-$1").toLowerCase()}`,C=[" -- ","~","&","|",">","<","{","}","[","]",";","$","!","*","%","&&","||",","],c=["rm ","sudo "];function N(W){if(W==="")return;if(/(\n|\\n|\\\n|\t|\\t|\\\t)/.test(W))throw new Error("Docker CMD is invalid");const H=W.toLocaleLowerCase();if(c.some(J=>H.indexOf(J)!==-1))throw new Error("Docker CMD is invalid");if(C.some(J=>W.indexOf(J)!==-1))throw new Error("Docker CMD is invalid");if(!/^(?:(?:[a-zA-Z0-9\-_.\/:=\s]+)|(?:\@{1,2}[a-zA-Z_][a-zA-Z0-9_]*))+$/.test(W))throw new Error("Docker CMD is invalid")}const $=Array.from(new Set(Object.keys(s).map(S))),O=["publish","volume"],w=r.object({workdir:r.string().trim().optional(),image:r.string().trim().regex(/^[^\s]+$/).optional(),shell:r.string().trim().optional(),volumes:r.array().items(r.string().trim()).optional(),script:r.string().trim().optional(),installNodeModules:r.boolean().optional(),skipWrapDockerfile:r.boolean().optional(),tmpfs:r.string().trim().optional(),command:r.string().allow("").default("").optional().custom((W,U)=>{try{return N(W),W}catch(H){return U.error("any.invalid",{message:H.message})}},"Docker CMD validation"),runBaseScript:r.boolean().optional(),...$.reduce((W,U)=>{const H=m[E(U)];return O.includes(U)?(W[U]=r.array().items(r.string().trim()).optional(),H?W[U]=r.array().items(r.string().trim().custom((A,J)=>{const M=H(A);return M?J.message(M):A})).optional():W[U]=r.array().items(r.string().trim()).optional(),W):(H?W[U]=r.string().trim().custom((A,J)=>{const M=H(A);return M?J.message(M):A}).optional():W[U]=r.string().trim().optional(),W)},{})}).optional(),R=W=>{const U=/^(?:[a-zA-Z0-9.-]+(?::[0-9]+)?\/)?(?:[a-z0-9]+(?:[._-][a-z0-9]+)*\/)?[a-z0-9]+(?:[._-][a-z0-9]+)*(:[a-zA-Z0-9_.-]+)?$/;return r.string().trim().regex(U).required().validate(W)},F=(W,U,H)=>{const A={};H.forEach(M=>{const ue=S(M.key);O.includes(ue)?A[ue]=[...A[ue]||[],M.value]:A[ue]=M.value});const{error:J}=R(W);if(J)return{error:J,value:A};try{N(W)}catch(M){return{error:M,value:A}}return A.image=W,A.command=U||"",w.validate(A)};function D(W,U){const H=JSON.parse(JSON.stringify(U)),A=new Map;let J=1;const M=[];return H.forEach(ue=>{if(ue.key==="--publish"){const K=ue.value.split(":");let Ee="127.0.0.1",ce="",Me="";K.length===2?[ce,Me]=K:K.length===3?[Ee,ce,Me]=K:K.length===1&&(Me=K[0]||"");let me=A.get(ce||"");if(me||(me=`$BLOCKLET_PORT_${J++}`,A.set(ce||"",me)),!M.find(Oe=>Oe.port===ce)){const Oe=ue.type||"docker",Pe=`${W.replace(/\W/g,"-")}-${M.length+1}`;M.push({type:Oe,proxyBehavior:ue.proxyBehavior||"",name:Pe,path:`/${Pe}`,port:ce||Me,containerPort:Number(Me)||0,hostIP:Ee,prefix:Oe==="docker"?`/${Pe}`:ue.prefix||"*"})}}}),M}function ne(W,U=!1){const H=[];if(!W)return H;for(const A of W){const J={name:A.key,default:A.value===`$${A.key}`?"":A.value,secure:A.secure!==void 0?A.secure:!1,shared:A.shared!==void 0?A.shared:!1,required:A.required!==void 0?A.required:!1,description:A.description||A.key};U||(J.custom=A.custom||""),H.push(J)}return H}function Y(W,U){const H=JSON.parse(JSON.stringify(W));return U.split(".").map(J=>{const M=J.match(/(.+)\[(.+?)\]/);return M?[M[1],M[2]]:J}).flat().filter(Boolean).reduce((J,M)=>{if(!J||!M)return;const ue=M?.match(/(.+?)=(.+)/);if(Array.isArray(J)&&ue){const[,K,Ee]=ue;return K&&Ee&&(J=J.find(ce=>{const Me=Object.keys(ce).find(me=>me.toLowerCase()===K.toLowerCase());return Me&&ce[Me]===Ee})),J}const Ie=Object.keys(J).find(K=>K.toLowerCase()===M.toLowerCase());return Ie?J[Ie]:void 0},H)}return Ge.addBlockletPrefixVolume=h,Ge.allowDockerArgs=s,Ge.autoSetDockerArgs=n,Ge.dockerArgsToCamelCase=S,Ge.dockerArgsValidator=m,Ge.dockerBuildCommand=j,Ge.dockerCamelCaseToDash=E,Ge.dockerCmdValidator=N,Ge.dockerParseCommand=f,Ge.dockerParseEnvironments=ne,Ge.dockerParsePublishPorts=D,Ge.dockerSchema=w,Ge.getObjByPath=Y,Ge.isVolumePath=d,Ge.multiValueArgs=O,Ge.notAllowUseCustomDockerArgs=o,Ge.parseDockerArgsToSchema=F,Ge.whiteDockerArgs=i,Ge}var vn={},to;function ou(){if(to)return vn;to=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.toBlockletDid=void 0;const e=
|
|
206
|
+
`)}const m={"--volume":W=>{const[U]=W.split(":");return U?d(W)&&!W.startsWith("$BLOCKLET_APP_DIR/")&&!W.startsWith("$BLOCKLET_DATA_DIR/")?"Volume must start with $BLOCKLET_APP_DIR or $BLOCKLET_DATA_DIR":W.indexOf("..")>-1?'Volume cannot contain ".."':"":"Volume must start with key:value"}},S=W=>W.replace(/^[-]+/,"").replace(/-([a-z])/g,(A,J)=>J.toUpperCase()),E=W=>`--${W.replace(/([A-Z])/g,"-$1").toLowerCase()}`,C=[" -- ","~","&","|",">","<","{","}","[","]",";","$","!","*","%","&&","||",","],c=["rm ","sudo "];function N(W){if(W==="")return;if(/(\n|\\n|\\\n|\t|\\t|\\\t)/.test(W))throw new Error("Docker CMD is invalid");const H=W.toLocaleLowerCase();if(c.some(J=>H.indexOf(J)!==-1))throw new Error("Docker CMD is invalid");if(C.some(J=>W.indexOf(J)!==-1))throw new Error("Docker CMD is invalid");if(!/^(?:(?:[a-zA-Z0-9\-_.\/:=\s]+)|(?:\@{1,2}[a-zA-Z_][a-zA-Z0-9_]*))+$/.test(W))throw new Error("Docker CMD is invalid")}const $=Array.from(new Set(Object.keys(s).map(S))),O=["publish","volume"],w=r.object({workdir:r.string().trim().optional(),image:r.string().trim().regex(/^[^\s]+$/).optional(),shell:r.string().trim().optional(),volumes:r.array().items(r.string().trim()).optional(),script:r.string().trim().optional(),installNodeModules:r.boolean().optional(),skipWrapDockerfile:r.boolean().optional(),tmpfs:r.string().trim().optional(),command:r.string().allow("").default("").optional().custom((W,U)=>{try{return N(W),W}catch(H){return U.error("any.invalid",{message:H.message})}},"Docker CMD validation"),runBaseScript:r.boolean().optional(),...$.reduce((W,U)=>{const H=m[E(U)];return O.includes(U)?(W[U]=r.array().items(r.string().trim()).optional(),H?W[U]=r.array().items(r.string().trim().custom((A,J)=>{const M=H(A);return M?J.message(M):A})).optional():W[U]=r.array().items(r.string().trim()).optional(),W):(H?W[U]=r.string().trim().custom((A,J)=>{const M=H(A);return M?J.message(M):A}).optional():W[U]=r.string().trim().optional(),W)},{})}).optional(),R=W=>{const U=/^(?:[a-zA-Z0-9.-]+(?::[0-9]+)?\/)?(?:[a-z0-9]+(?:[._-][a-z0-9]+)*\/)?[a-z0-9]+(?:[._-][a-z0-9]+)*(:[a-zA-Z0-9_.-]+)?$/;return r.string().trim().regex(U).required().validate(W)},F=(W,U,H)=>{const A={};H.forEach(M=>{const ue=S(M.key);O.includes(ue)?A[ue]=[...A[ue]||[],M.value]:A[ue]=M.value});const{error:J}=R(W);if(J)return{error:J,value:A};try{N(W)}catch(M){return{error:M,value:A}}return A.image=W,A.command=U||"",w.validate(A)};function D(W,U){const H=JSON.parse(JSON.stringify(U)),A=new Map;let J=1;const M=[];return H.forEach(ue=>{if(ue.key==="--publish"){const K=ue.value.split(":");let Ee="127.0.0.1",ce="",Me="";K.length===2?[ce,Me]=K:K.length===3?[Ee,ce,Me]=K:K.length===1&&(Me=K[0]||"");let me=A.get(ce||"");if(me||(me=`$BLOCKLET_PORT_${J++}`,A.set(ce||"",me)),!M.find(Oe=>Oe.port===ce)){const Oe=ue.type||"docker",Pe=`${W.replace(/\W/g,"-")}-${M.length+1}`;M.push({type:Oe,proxyBehavior:ue.proxyBehavior||"",name:Pe,path:`/${Pe}`,port:ce||Me,containerPort:Number(Me)||0,hostIP:Ee,prefix:Oe==="docker"?`/${Pe}`:ue.prefix||"*"})}}}),M}function ne(W,U=!1){const H=[];if(!W)return H;for(const A of W){const J={name:A.key,default:A.value===`$${A.key}`?"":A.value,secure:A.secure!==void 0?A.secure:!1,shared:A.shared!==void 0?A.shared:!1,required:A.required!==void 0?A.required:!1,description:A.description||A.key};U||(J.custom=A.custom||""),H.push(J)}return H}function Y(W,U){const H=JSON.parse(JSON.stringify(W));return U.split(".").map(J=>{const M=J.match(/(.+)\[(.+?)\]/);return M?[M[1],M[2]]:J}).flat().filter(Boolean).reduce((J,M)=>{if(!J||!M)return;const ue=M?.match(/(.+?)=(.+)/);if(Array.isArray(J)&&ue){const[,K,Ee]=ue;return K&&Ee&&(J=J.find(ce=>{const Me=Object.keys(ce).find(me=>me.toLowerCase()===K.toLowerCase());return Me&&ce[Me]===Ee})),J}const Ie=Object.keys(J).find(K=>K.toLowerCase()===M.toLowerCase());return Ie?J[Ie]:void 0},H)}return Ge.addBlockletPrefixVolume=h,Ge.allowDockerArgs=s,Ge.autoSetDockerArgs=n,Ge.dockerArgsToCamelCase=S,Ge.dockerArgsValidator=m,Ge.dockerBuildCommand=j,Ge.dockerCamelCaseToDash=E,Ge.dockerCmdValidator=N,Ge.dockerParseCommand=f,Ge.dockerParseEnvironments=ne,Ge.dockerParsePublishPorts=D,Ge.dockerSchema=w,Ge.getObjByPath=Y,Ge.isVolumePath=d,Ge.multiValueArgs=O,Ge.notAllowUseCustomDockerArgs=o,Ge.parseDockerArgsToSchema=F,Ge.whiteDockerArgs=i,Ge}var vn={},to;function ou(){if(to)return vn;to=1,Object.defineProperty(vn,"__esModule",{value:!0}),vn.toBlockletDid=void 0;const e=al(),t=sl(),r=Yn(),i=s=>{if((0,r.isValid)(s))return s;const n=(0,t.toHex)(Cl.from(typeof s=="string"?s.trim():s));return(0,r.fromPublicKey)(n,{role:e.types.RoleType.ROLE_ANY})};return vn.toBlockletDid=i,vn}var Nt={},no;function su(){if(no)return Nt;no=1;var e=Nt&&Nt.__importDefault||function(o){return o&&o.__esModule?o:{default:o}};Object.defineProperty(Nt,"__esModule",{value:!0}),Nt.didExtension=Nt.fileExtension=void 0;const t=e(rs),r=e(tc()),i=Yn(),s=o=>({type:"file",base:o.string(),validate(a,{error:d}){return a&&typeof a=="string"?{value:a}:{errors:d("file.empty",{file:a})}},messages:{"file.empty":'file "{{#file}}" must be non-empty string',"file.enoent":'file "{{#file}}" does not exist',"file.error.generic":'file could not be read. message: "{{#message}}"'},rules:{exists:{multi:!1,method({baseDir:a=null,canSkip:d=()=>!1}={}){return this.$_addRule({name:"exists",args:{baseDir:a,canSkip:d}})},args:[{name:"baseDir",assert:a=>t.default.existsSync(a),message:"baseDir must exist"},{name:"canSkip",assert:a=>typeof a=="function",message:"canSkip must be a function"}],validate(a,{error:d},{baseDir:h,canSkip:u}={}){if(typeof u=="function"&&u(h,a))return a;try{return t.default.statSync(r.default.join(h,a)),a}catch(f){switch(f.code){case"ENOENT":return d("file.enoent",{file:a})}return d("file.error.generic",{message:f.message})}}}}});Nt.fileExtension=s;const n=o=>({type:"DID",base:o.string(),validate(a,{error:d}){return!a||typeof a!="string"?{errors:d("did.empty",{did:a})}:(0,i.isValid)(a)===!1?{errors:d("did.invalid",{did:a})}:{value:a}},messages:{"did.empty":'did "{{#did}}" must be non-empty string',"did.invalid":'did "{{#did}}" is not valid'}});return Nt.didExtension=n,Nt.default={fileExtension:s,didExtension:n},Nt}var yn={},Er={exports:{}};const au=["assert","buffer","child_process","cluster","console","constants","crypto","dgram","dns","domain","events","fs","http","https","module","net","os","path","process","punycode","querystring","readline","repl","stream","string_decoder","timers","tls","tty","url","util","v8","vm","zlib"];var ro;function lu(){if(ro)return Er.exports;ro=1;var e=new RegExp("^(?:@([^/]+?)[/])?([^/]+?)$"),t=au,r=["node_modules","favicon.ico"],i=Er.exports=function(n){var o=[],a=[];if(n===null)return a.push("name cannot be null"),s(o,a);if(n===void 0)return a.push("name cannot be undefined"),s(o,a);if(typeof n!="string")return a.push("name must be a string"),s(o,a);if(n.length||a.push("name length must be greater than zero"),n.match(/^\./)&&a.push("name cannot start with a period"),n.match(/^_/)&&a.push("name cannot start with an underscore"),n.trim()!==n&&a.push("name cannot contain leading or trailing spaces"),r.forEach(function(f){n.toLowerCase()===f&&a.push(f+" is a blacklisted name")}),t.forEach(function(f){n.toLowerCase()===f&&o.push(f+" is a core module name")}),n.length>214&&o.push("name can no longer contain more than 214 characters"),n.toLowerCase()!==n&&o.push("name can no longer contain capital letters"),/[~'!()*]/.test(n.split("/").slice(-1)[0])&&o.push(`name can no longer contain special characters ("~'!()*")`),encodeURIComponent(n)!==n){var d=n.match(e);if(d){var h=d[1],u=d[2];if(encodeURIComponent(h)===h&&encodeURIComponent(u)===u)return s(o,a)}a.push("name can only contain URL-friendly characters")}return s(o,a)};i.scopedPackagePattern=e;var s=function(n,o){var a={validForNewPackages:o.length===0&&n.length===0,validForOldPackages:o.length===0,warnings:n,errors:o};return a.warnings.length||delete a.warnings,a.errors.length||delete a.errors,a};return Er.exports}var io;function ms(){return io||(io=1,function(e){var t=yn&&yn.__importDefault||function(a){return a&&a.__esModule?a:{default:a}};Object.defineProperty(e,"__esModule",{value:!0}),e.validateName=e.validateNewDid=void 0;const r=Yn(),i=t(lu()),s=32,n=a=>{if((0,r.toTypeInfo)(a).role!==r.types.RoleType.ROLE_BLOCKLET)throw new Error("Blocklet DID's type must be ROLE_BLOCKLET")};e.validateNewDid=n;const o=(a,{checkDid:d=!0}={})=>{if((0,r.isValid)(a))d&&(0,e.validateNewDid)(a);else{const{validForNewPackages:h,errors:u=[],warnings:f=[]}=(0,i.default)(a);if(!h)throw new Error(u[0]||f[0]);if(a.length>s)throw new Error("Blocklet name is too long")}};e.validateName=o,e.default={validateName:e.validateName,validateNewDid:e.validateNewDid}}(yn)),yn}var oo;function gs(){if(oo)return ae;oo=1;var e=ae&&ae.__importDefault||function(V){return V&&V.__esModule?V:{default:V}};Object.defineProperty(ae,"__esModule",{value:!0}),ae.Joi=ae.eventsSchema=ae.installBlockletDescriptionSchema=ae.installBlockletTitleSchema=ae.resourceBundleSchema=ae.authConfigSchema=ae.cacheableSchema=ae.statsSchema=ae.titleSchema=ae.themeSchema=ae.signatureSchema=ae.serviceSchema=ae.scriptsSchema=ae.personSchema=ae.navigationSchema=ae.navigationItemSchema=ae.updateMountPointSchema=ae.mountPointSchema=ae.logoSchema=ae.interfaceSchema=ae.environmentNameSchema=ae.environmentSchema=ae.engineSchema=ae.endpointSchema=ae.distSchema=ae.descriptionSchema=ae.createBlockletSchema=ae.componentSchema=ae.blockletNameSchema=ae.blockletMetaSchema=void 0;const t=e(rs),r=e(ii()),i=e(Yc()),s=e(Qc()),n=eu(),o=e(ru),a=ll(),d=Yn(),h=iu(),u=Yo(),f=ou(),j=su(),m=ms(),S=cl(),E=i.default.default,C="/.well-known",c=r.default.extend(n.semver).extend(n.semverRange).extend(j.fileExtension).extend(j.didExtension);ae.Joi=c;const N=(V,he)=>(0,S.checkLink)(V)?V:he.message(`Invalid navigation link: ${V}
|
|
207
207
|
|
|
208
208
|
A valid navigation link should be a relative url which start with '/' or a absolute url, such as:
|
|
209
209
|
- /en/home
|
|
@@ -217,7 +217,7 @@ A valid navigation id is should follow the rules of javascript variables, such a
|
|
|
217
217
|
- foo123
|
|
218
218
|
|
|
219
219
|
see detail in https://www.npmjs.com/package/is-var-name
|
|
220
|
-
`),O=c.string().trim().min(1).custom(V=>{if(E(V)>u.MAX_TITLE_LENGTH)throw new Error(`title length should not exceed ${u.MAX_TITLE_LENGTH} (see: https://www.npmjs.com/package/cjk-length)`);return V}).meta({className:"TTitle"});ae.titleSchema=O;const w=c.string().trim().min(3).max(160).meta({className:"TDescription"});ae.descriptionSchema=w;const R=c.string().trim().min(3).max(20).messages({"*":"Title length must be between 3 and 20 characters"}).meta({className:"TInstallBlockletTitle"});ae.installBlockletTitleSchema=R;const F=c.string().trim().min(3).max(80).messages({"*":"Description length must be between 3 and 80 characters"}).meta({className:"TInstallBlockletDescription"});ae.installBlockletDescriptionSchema=F;const D=c.string().uri({scheme:["http","https"],allowRelative:!0}).allow("").custom((V,he)=>V.includes(a.WELLKNOWN_BLOCKLET_LOGO_PATH)?he.message(`logo url should not include ${a.WELLKNOWN_BLOCKLET_LOGO_PATH}`):V).meta({className:"TLogo"});ae.logoSchema=D;const ne=c.string().trim().min(1),Y=ne.meta({className:"TMountPoint"}).custom((V,he)=>(0,S.isValidUrlPath)(V)?V:he.message(`mountPoint cannot contain such characters space $*+~()'"!:@\\`));ae.mountPointSchema=Y;const W=ne.meta({className:"TUpdateMountPoint"}).custom(V=>(0,S.urlPathFriendly)(V));ae.updateMountPointSchema=W;const U=c.string().custom(V=>((0,m.validateName)(V),V)).meta({className:"TBlockletName"});ae.blockletNameSchema=U;const H=[],A=c.string().trim().min(1).max(50).required().custom((V,he)=>V.startsWith("BLOCKLET")&&!H.includes(V)?he.message("Env name can not start with BLOCKLET_"):V.startsWith("COMPONENT")?he.message("Env name can not start with COMPONENT_"):V.startsWith("ABTNODE")?he.message("Env name can not start with ABTNODE_"):/[^\w]/.test(V)?he.message('Env name can include only numbers or letters or "_"'):V).meta({className:"TEnvironmentName",unknownType:"any"});ae.environmentNameSchema=A;const J=c.object({name:A.required(),description:c.string().trim().required(),default:c.string().optional().allow("").default(""),required:c.boolean().default(!1),secure:c.boolean().default(!1),validation:c.string().optional(),shared:c.boolean().default(V=>V.secure?!1:void 0)}).custom((V,he)=>V.secure&&V.default?he.message(`Cannot declare default value for secure env ${V.name}`):V).meta({className:"TEnvironment",unknownType:"any"});ae.environmentSchema=J;const M=c.object({dev:c.string().trim().min(1),e2eDev:c.string().trim().min(1),preFlight:c.string().trim().min(1),preInstall:c.string().trim().min(1),postInstall:c.string().trim().min(1),preStart:c.string().trim().min(1),postStart:c.string().trim().min(1),preStop:c.string().trim().min(1),preUninstall:c.string().trim().min(1),preConfig:c.string().trim().min(1)}).rename("pre-flight","preFlight").rename("pre-install","preInstall").rename("post-install","postInstall").rename("pre-start","preStart").rename("post-start","postStart").rename("pre-stop","preStop").rename("pre-uninstall","preUninstall").rename("pre-config","preConfig").optional().meta({className:"TScripts",unknownType:"any"});ae.scriptsSchema=M;const ue=c.object({name:c.string().required().trim(),config:c.object().optional().default({})}).unknown(!0).meta({className:"TService",unknownType:"any"});ae.serviceSchema=ue;const Ie=c.object({type:c.string().trim(!0).min(1).required(),path:c.string().required(),meta:c.object({vcType:c.string(),payable:c.boolean(),params:c.array().items({name:c.string().required().trim(),description:c.string().required().trim()})})}).meta({className:"TEndpoint",unknownType:"any"});ae.endpointSchema=Ie;const K=c.string().trim().custom((V,he)=>{const De=V.split("/").filter(Boolean);return De.length===0?he.message("cacheable path must be a valid pathname that is not /"):`/${De.join("/")}`}).meta({className:"TPathPrefix",unknownType:"any"});ae.cacheableSchema=K;const Ee=c.object({type:c.string().lowercase().valid(...u.BLOCKLET_INTERFACE_TYPES).required(),name:c.string().trim().required(),path:c.string().trim().default("/"),prefix:c.string().trim().min(1).default(u.BLOCKLET_DYNAMIC_PATH_PREFIX),containerPort:c.number().port().optional(),hostIP:c.string().trim().ip({version:["ipv4","ipv6"]}).optional(),protocol:c.string().lowercase().valid(...u.BLOCKLET_INTERFACE_PROTOCOLS).default("http"),port:c.alternatives().try(c.string().uppercase().default(u.BLOCKLET_DEFAULT_PORT_NAME),c.object({internal:c.string().uppercase().required(),external:c.number().port().required()})).default(u.BLOCKLET_DEFAULT_PORT_NAME),cacheable:c.array().items(K).unique(),services:c.array().items(ue).unique("name"),endpoints:c.array().items(Ie).unique("type"),pageGroups:c.array().items(c.string().min(1).max(255).trim()).unique(),proxyBehavior:c.string().valid("service","direct").default("service").optional()}).meta({className:"TInterface",unknownType:"any"});ae.interfaceSchema=Ee;const ce=c.alternatives().try(c.string().required(),c.object({url:c.string().uri({scheme:["http","https","file"]}).required(),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}).required(),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})),Me=c.object({platform:c.string().valid(...u.BLOCKLET_PLATFORMS).optional(),interpreter:c.string().valid("binary","node","blocklet","bun").default("node"),source:ce,args:c.array().items(c.string()).optional().default([])}).meta({className:"TEngine",unknownType:"any"});ae.engineSchema=Me;const me=c.object({name:c.string().min(1).required(),email:c.string().email({tlds:!1}).optional(),url:c.string().uri().optional()}).meta({className:"TPerson",unknownType:"any"});ae.personSchema=me;const Oe=c.object({tarball:c.alternatives().try(c.string().uri(),c.string()).required(),integrity:c.string().required(),size:c.number().optional()}).meta({className:"TDist",unknownType:"any"});ae.distSchema=Oe;const Pe=c.object({downloads:c.number().integer().greater(-1),star:c.number().default(0),purchases:c.number().default(0)}).meta({className:"TStats",unknownType:"any"});ae.statsSchema=Pe;const ut={source:c.alternatives().try(c.object({url:c.alternatives().try(c.string().uri(),c.array().items(c.string().uri()).min(1)).required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})).required(),required:c.boolean(),title:O,description:w,mountPoint:Y,name:U},ft=(V,he)=>c.object(V).custom((De,Xe)=>!he&&De.source&&De.source.name&&!De.source.store?Xe.message(`missing 'store' in source of component ${De.name}`):De),rt=ft(ut).meta({className:"TComponent",unknownType:"any"});ae.componentSchema=rt;const we=ft(ut,!0),de=({checkStore:V}={})=>{const he=[rt,we];return c.array().items(V?he[0]:he[1]).optional().default([])},ge=c.object({type:c.string().required(),name:c.string().required(),signer:c.string().required(),pk:c.string().required(),created:c.string().isoDate().required(),sig:c.string().required(),excludes:c.array().items(c.string()).optional(),appended:c.array().items(c.string()).optional(),delegatee:c.string(),delegateePk:c.string(),delegation:c.string()}).meta({className:"TSignature",unknownType:"any"});ae.signatureSchema=ge;const Fe=["en","zh","fr","ru","ar","es","de","pt","ja","hi"],$e={id:c.string().custom($),title:c.alternatives().try(c.string().min(1).max(u.MAX_TITLE_LENGTH),c.object().min(1).pattern(c.string().valid(...Fe),c.string().min(1).max(u.MAX_TITLE_LENGTH))).required(),description:c.alternatives().try(c.string().min(1).max(u.MAX_DESCRIPTION_LENGTH),c.object().min(1).pattern(c.string().valid(...Fe),c.string().min(1).max(u.MAX_DESCRIPTION_LENGTH))),link:c.alternatives().try(c.string().custom(N),c.object().min(1).pattern(c.string().valid(...Fe),c.string().custom(N))),component:c.string().min(1),section:c.array().items(c.string().valid("header","footer","bottom","social","dashboard","sessionManager","userCenter","bottomNavigation")).single(),role:c.array().items(c.string().min(1)).single(),icon:c.string().min(1),visible:c.boolean(),private:c.boolean()},jt=c.object({...$e,items:c.array().items(c.object({...$e}).rename("child","component"))}).rename("child","component").meta({className:"TNavigationItem",unknownType:"any"});ae.navigationItemSchema=jt;const Ae=c.array().items(jt).unique((V,he)=>V.id&&he.id?V.id===he.id:!1).meta({className:"TNavigation",unknownType:"any"});ae.navigationSchema=Ae;const Et=c.object({background:c.alternatives().try(c.string().min(1),c.object({header:c.string().min(1),footer:c.string().min(1),default:c.string().min(1)}).min(1))}).meta({className:"TTheme",unknownType:"any"});ae.themeSchema=Et;const Ot=c.object({whoCanAccess:c.string().valid("owner","invited","all"),profileFields:c.array().items(c.string().valid("fullName","email","avatar","phone")).unique(),ignoreUrls:c.array().items(c.string().min(1)),allowSwitchProfile:c.boolean(),blockUnauthenticated:c.boolean(),blockUnauthorized:c.boolean()}).options({stripUnknown:!0}).meta({className:"TAuthConfig",unknownType:"any"});ae.authConfigSchema=Ot;const Ct=c.object({type:c.string().trim().min(1).required(),description:c.string().trim().min(1)}),It=c.object({did:c.DID().trim().required(),type:c.string().trim().min(1).required(),public:c.boolean()}).meta({className:"TResourceBundle",unknownType:"any"});ae.resourceBundleSchema=It;const Ve=c.array().items(c.object({type:c.string().trim().min(1).max(128).pattern(/^(?!blocklet\.)[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/).message('Event type must be in format of "[noun.]verb" like "post.published" or "post.comment.published", and prefix "blocklet." is reserved').required(),description:c.string().trim().min(1).max(256).required()})).unique("type").meta({className:"TEvent",unknownType:"any"});ae.eventsSchema=Ve;const Rt={did:c.DID().trim().required(),version:c.semver().valid().required(),name:c.string().optional(),description:w.required(),group:c.string().valid(...u.BLOCKLET_GROUPS),main:c.string().trim(),title:O.optional().allow(""),logo:c.string().trim().optional(),specVersion:c.semver().valid().gte("1.0.0").optional(),author:me.optional(),contributors:c.array().items(me).optional(),maintainers:c.array().items(me).optional(),community:c.string().uri().optional().allow("").default(""),documentation:c.string().uri().optional().allow("").default(""),homepage:c.string().uri().optional().allow("").default(""),license:c.string().optional().allow("").default(""),support:c.alternatives().try(c.string().uri(),c.string().email({tlds:!1})).optional(),nftFactory:c.DID().optional().allow("").default(""),payment:c.object({price:c.array().max(1).items(c.object({value:c.number().greater(0).required(),address:c.DID().required()})).default([]),share:c.array().max(4).items(c.object({name:c.string().required(),address:c.DID().required(),value:c.number().greater(0).max(1).required()})).default([]).custom(V=>{if(V.length===0)return V;const he=V.reduce((De,Xe)=>De+Xe.value,0);if(he!==1)throw new Error(`Invalid blocklet payment share config: total share must be 1, got ${he}`);return V},"invalid blocklet share"),componentPrice:c.array().items(c.object({parentPriceRange:c.array().items(c.number()).custom((V,he)=>V.length!==2?he.message("length of range should be 2"):V[0]<0?he.message("the first value should not less than 0 in range"):V[1]<=V[0]?he.message("the second value should greater than the first value in range"):V),type:c.string().valid("fixed","percentage").required(),value:c.number().greater(0).required()})).single()}).default({price:[],share:[]}),keywords:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),tags:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),gitHash:c.string().optional().allow(""),repository:c.alternatives().try(c.string().min(1),c.object({type:c.string().valid("git","https","svn").required(),url:c.string().uri().required(),directory:c.string()})).optional(),timeout:c.object({start:c.number().min(10).max(600),script:c.number().min(1).max(1800)}).default({start:60}),requirements:c.object({abtnode:c.semverRange().valid(),server:c.semverRange().valid(),os:c.alternatives().try(c.string().valid("*",...u.BLOCKLET_PLATFORMS),c.array().items(c.string().valid(...u.BLOCKLET_PLATFORMS)).min(1)),cpu:c.alternatives().try(c.string().valid("*",...u.BLOCKLET_ARCHITECTURES),c.array().items(c.string().valid(...u.BLOCKLET_ARCHITECTURES)).min(1)),fuels:c.array().items(c.object({endpoint:c.string().trim().required(),address:c.string().trim(),value:c.string().trim().required(),reason:c.string().trim().required()})),nodejs:c.semverRange().valid(),aigne:c.boolean().optional()}).default({server:u.BLOCKLET_LATEST_REQUIREMENT_SERVER,os:"*",cpu:"*",nodejs:"*"}),interfaces:c.array().items(Ee).unique("name").custom((V,he)=>{if(V.filter(it=>it.type===u.BLOCKLET_INTERFACE_TYPE_WEB).length>1)return he.message(`Only one ${u.BLOCKLET_INTERFACE_TYPE_WEB} interface can be declared`);const Xe=V.filter(it=>it.type===u.BLOCKLET_INTERFACE_TYPE_WELLKNOWN);for(const it of Xe)if(!it.prefix.startsWith(C))return he.message(`Wellknown path prefix must start with: ${C}`);return V}).default([]),environments:c.array().items(J).default([]).optional().custom((V,he)=>{if(V&&V.length){const De=V.filter((Xe,it)=>V.findIndex(wt=>wt.name===Xe.name)!==it);if(De.length)return he.message(`find duplicate environment names ${De.map(Xe=>Xe.name).join(", ")}`)}return V}),scripts:M,capabilities:c.object({clusterMode:c.boolean(),didSpace:c.string().valid(...Object.values(u.BLOCKLET_APP_SPACE_REQUIREMENT)).optional(),navigation:c.boolean().default(!0),serverless:c.boolean().optional(),component:c.boolean(),sitemap:c.boolean().optional(),mcp:c.boolean().optional(),singleton:c.boolean().optional()}).default({}),files:c.array().items(c.string().trim()).optional(),resource:c.object({exportApi:c.string().trim(),bundles:c.array().items(It),types:c.array().items(Ct).max(10)}),engine:c.alternatives().try(Me,c.array().items(Me)).optional(),screenshots:c.array().items(c.string().min(1)).optional().default([]),videos:c.array().items(c.string().pattern(/^https:\/\/(www\.)?(youtube\.com|youtu\.be|vimeo\.com)\/[\w\-/?&=]+/).message("Each video URL must be a valid YouTube or Vimeo link")).max(3).optional(),logoUrl:c.string().optional().allow(""),dist:Oe.optional(),stats:Pe.optional(),htmlAst:c.any().optional(),path:c.string().optional(),signatures:c.array().items(ge).optional(),lastPublishedAt:c.string().isoDate().optional().allow(null),components:de(),navigation:Ae,theme:Et,copyright:c.object({owner:c.string().min(1),year:c.alternatives().try(c.string(),c.number())}),bundleName:c.string(),bundleDid:c.DID().trim(),storeId:c.string(),events:Ve.optional()},pt=c.object(Rt).options({stripUnknown:!0,noDefaults:!1}).meta({className:"TBlockletMeta",unknownType:"any"});ae.blockletMetaSchema=pt;const st=(V,{ensureFiles:he=!1,ensureDist:De=!1,ensureComponentStore:Xe=!0,ensureName:it=!1,skipValidateDidName:wt=!1,...Ut}={})=>((!V||!t.default.existsSync(V))&&(he=!1),c.object({...Rt,owner:c.object({avatar:c.string().optional(),did:c.DID().trim().required(),fullName:c.string().trim().required(),email:c.string().optional().allow(null).empty("").default("")}).optional(),logo:he?c.file().trim().exists({baseDir:V}).optional():c.string().trim().optional(),files:c.array().items(he?c.file().exists({baseDir:V,canSkip:(Ue,L)=>[u.BLOCKLET_ENTRY_FILE,u.BLOCKLET_BUNDLE_FILE].includes(L)||(0,s.default)(L)}):c.string().trim()).optional(),dist:De?Oe.required():Oe.optional(),components:de({checkStore:Xe}),name:it?c.string().optional():c.string().required(),egress:c.boolean().optional().default(!0),docker:h.dockerSchema}).options({stripUnknown:!0,noDefaults:!1,...Ut}).rename("children","components").custom((Ue,L)=>{const{did:re,name:ve,docker:Re}=Ue;if(Re){const{image:b,dockerfile:k,network:_}=Re;if(b&&k)return L.message("Image and dockerfile cannot be set at the same time");if(_)return L.message("ExportPorts and network cannot be set at the same time");k&&(Ue.files||(Ue.files=[]),Ue.files.push(k))}let p;if((0,d.isValid)(re))try{return(0,m.validateNewDid)(re),Ue}catch(b){p=b}if(ve){(0,m.validateName)(ve,{checkDid:!wt});const b=(0,f.toBlockletDid)(ve);return b!==re?L.message(`The did of name "${ve}" should be "${b}"`):Ue}return p?L.message(p.message):Ue}));return ae.createBlockletSchema=st,ae.default={blockletNameSchema:U,componentSchema:rt,endpointSchema:Ie,serviceSchema:ue,createBlockletSchema:st,interfaceSchema:Ee,environmentSchema:J,environmentNameSchema:A,scriptsSchema:M,personSchema:me,distSchema:Oe,titleSchema:O,descriptionSchema:w,logoSchema:D,navigationSchema:Ae,themeSchema:Et,mountPointSchema:Y,updateMountPointSchema:W,authConfigSchema:Ot,resourceBundleSchema:It,installBlockletTitleSchema:R,installBlockletDescriptionSchema:F,eventsSchema:Ve,Joi:c},ae}var ht={},so;function cu(){if(so)return ht;so=1;var e=ht&&ht.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(ht,"__esModule",{value:!0}),ht.setService=ht.findService=ht.getDefaultServiceConfig=ht.getServiceConfig=void 0;const t=e(nc),r=gs(),i={},s=h=>{i[h.name]={validate:h.schema.validate.bind(h.schema),defaultConfig:h.default}};ht.setService=s,s({name:"auth",schema:r.authConfigSchema,default:{}});const n=h=>{if(!h)throw new Error("service name should not be empty");const u=i[h];if(!u)throw new Error(`service ${h} does not exist`);return u},o=(h,u,{validate:f}={})=>{const j=n(h),m=(0,t.default)(u||{}),{value:S,error:E}=j.validate(m);if(f&&E)throw new Error(`Invalid blocklet service config: ${E.details.map(C=>C.message).join(", ")}`);return S};ht.getServiceConfig=o;const a=h=>{const{defaultConfig:u}=n(h);return u};ht.getDefaultServiceConfig=a;const d=(h,u)=>{const f=[u];return(h||[]).find(j=>f.includes(j.name))};return ht.findService=d,ht.default={getServiceConfig:o,getDefaultServiceConfig:a,findService:d,setService:s},ht}var ao;function uu(){if(ao)return Kt;ao=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.fixAndValidateService=Kt.validateMeta=void 0;const e=gs(),t=cu(),r=s=>(!s.interfaces||!s.interfaces.length||s.interfaces.forEach(n=>{n.services&&n.services.length&&n.services.forEach(o=>{o.config=(0,t.getServiceConfig)(o.name,o.config,{validate:!0})})}),s);Kt.fixAndValidateService=r;const i=(s,{ensureFiles:n=!1,ensureDist:o=!1,ensureComponentStore:a=!0,ensureName:d=!1,skipValidateDidName:h=!1,schemaOptions:u={}}={})=>{const f=(0,e.createBlockletSchema)(null,{ensureFiles:n,ensureDist:o,ensureComponentStore:a,ensureName:d,skipValidateDidName:h,...u}),{value:j,error:m}=f.validate(s);if(m)throw new Error(`Invalid blocklet meta: ${m.details.map(S=>S.message).join(", ")}`);return j};return Kt.validateMeta=i,Kt.default=i,Kt}var lo;function du(){return lo||(lo=1,function(e){var t=kt&&kt.__createBinding||(Object.create?function(w,R,F,D){D===void 0&&(D=F);var ne=Object.getOwnPropertyDescriptor(R,F);(!ne||("get"in ne?!R.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return R[F]}}),Object.defineProperty(w,D,ne)}:function(w,R,F,D){D===void 0&&(D=F),w[D]=R[F]}),r=kt&&kt.__setModuleDefault||(Object.create?function(w,R){Object.defineProperty(w,"default",{enumerable:!0,value:R})}:function(w,R){w.default=R}),i=kt&&kt.__importStar||function(){var w=function(R){return w=Object.getOwnPropertyNames||function(F){var D=[];for(var ne in F)Object.prototype.hasOwnProperty.call(F,ne)&&(D[D.length]=ne);return D},w(R)};return function(R){if(R&&R.__esModule)return R;var F={};if(R!=null)for(var D=w(R),ne=0;ne<D.length;ne++)D[ne]!=="default"&&t(F,R,D[ne]);return r(F,R),F}}(),s=kt&&kt.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(e,"__esModule",{value:!0}),e.fixService=e.fixInterfaces=e.parsePerson=e.formatPerson=e.fixName=e.fixTags=e.fixPerson=e.fixKeywords=e.fixFiles=e.fixRepository=e.fixRequired=void 0;const n=s(ul),o=i(Hc()),a=Yo(),d=uu();Object.defineProperty(e,"fixService",{enumerable:!0,get:function(){return d.fixAndValidateService}});const h=ms(),u=(w,R)=>{w.description||(w.description=`Blocklet from ${R}`),w.version||(w.version=a.BLOCKLET_DEFAULT_VERSION)};e.fixRequired=u;const f=w=>{if(w.repository&&(typeof w.repository=="string"&&(w.repository={type:"git",url:w.repository}),w.repository.url)){const R=o.fromUrl(w.repository.url);R&&(w.repository.url=R.getDefaultRepresentation()==="shortcut"?R.https():R.toString())}};e.fixRepository=f;const j=w=>{Array.isArray(w.files)?w.files&&(w.files=w.files.filter(R=>!(!R||typeof R!="string"))):delete w.files};e.fixFiles=j;const m=w=>{typeof w.keywords=="string"&&(w.keywords=w.keywords.split(/,\s+/)),w.keywords&&!Array.isArray(w.keywords)?delete w.keywords:w.keywords&&(w.keywords=w.keywords.filter(R=>!(typeof R!="string"||!R)))};e.fixKeywords=m;const S=w=>{typeof w.tags=="string"&&(w.tags=w.tags.split(/,\s+/)),w.tags&&!Array.isArray(w.tags)?delete w.tags:w.tags&&(w.tags=w.tags.filter(R=>!(typeof R!="string"||!R)))};e.fixTags=S;const E=(w,R)=>(w.author&&(w.author=R(w.author)),["maintainers","contributors"].forEach(F=>{Array.isArray(w[F])&&(w[F]=w[F].map(R))}),w),C=w=>{if(!w)return"";if(typeof w=="string")return w;const R=w.name||"",F=w.url||w.web,D=F?` (${F})`:"",ne=w.email||w.mail,Y=ne?` <${ne}>`:"";return R+Y+D};e.formatPerson=C;const c=w=>{if(typeof w!="string")return w;const R=w.match(/^([^(<]+)/),F=w.match(/\(([^)]+)\)/),D=w.match(/<([^>]+)>/),ne={};return R&&R[0].trim()&&(ne.name=R[0].trim()),D&&([,ne.email]=D),F&&([,ne.url]=F),ne};e.parsePerson=c;const N=w=>(E(w,C),E(w,c),w);e.fixPerson=N;const $=(w,R=!0)=>{if(Array.isArray(w.interfaces)||(w.interfaces=[]),w.interfaces.length)return w.interfaces.forEach(Y=>{Y.type===a.BLOCKLET_INTERFACE_TYPE_WEB&&(Y.protocol="http")}),w;const D=(0,n.default)(w,"capabilities.dynamicPathPrefix",!0)?a.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",ne=({type:Y="web",name:W,path:U="/",protocol:H="http",port:A=a.BLOCKLET_DEFAULT_PORT_NAME})=>{w.interfaces.push({type:Y,name:W,path:U,prefix:D,port:A,protocol:H})};return[a.BLOCKLET_INTERFACE_PUBLIC].forEach(Y=>{w[Y]&&ne({name:Y,path:w[Y]})}),Array.isArray(w.exposeServices)&&w.exposeServices.forEach(Y=>{ne({type:"service",name:Y.protocol,protocol:Y.protocol,port:{internal:`BLOCKLET_${Y.protocol}_PORT`.toUpperCase(),external:Y.port}})}),R&&(delete w.publicUrl,delete w.adminUrl,delete w.configUrl,delete w.docUrl,delete w.exposeServices,w.capabilities&&delete w.capabilities.dynamicPathPrefix),w};e.fixInterfaces=$;const O=w=>{const{did:R}=w;try{(0,h.validateNewDid)(R),w.name=R}catch{}return w};e.fixName=O,e.default={fixRequired:u,fixRepository:f,fixFiles:j,fixKeywords:m,fixPerson:N,fixTags:S,fixName:O,formatPerson:C,parsePerson:c,fixInterfaces:$,fixService:d.fixAndValidateService}}(kt)),kt}var hu=du();function vs({owner:e,locale:t}){return l.jsxs(te,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.fullName,e.did?l.jsx(Go,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:e.did,compact:!0,size:14,locale:t}):null]})}vs.propTypes={owner:B.object.isRequired,locale:B.string.isRequired};const fu="install-blocklet-from-URL",ys=()=>{const[e,t]=si(fu,"[]",{raw:!0}),r=s=>{const n=s.trim(),o=JSON.parse(e),a=o.findIndex(d=>d===n);a!==0&&(a>0&&o.splice(a,1),o.length>=10&&o.splice(9),o.unshift(n),t(JSON.stringify(o)))},i=s=>{if(!s)return;const n=JSON.parse(e),o=s.trim(),a=n.findIndex(d=>d===o);a>-1&&(n.splice(a,1),t(JSON.stringify(n)))};return{urls:e?JSON.parse(e):[],addUrlRecord:r,removeUrlRecord:i}};function bs({value:e="",onValueChange:t=()=>{},children:r=null,helperText:i=""}){const{urls:s,removeUrlRecord:n}=ys(),o=(a,d)=>{a.preventDefault(),a.stopPropagation(),n(d)};return l.jsxs(te,{children:[l.jsx(Ao,{freeSolo:!0,options:s,inputValue:e,onInputChange:(a,d)=>{t(d)},disableClearable:!0,popupIcon:null,renderInput:a=>Ft.cloneElement(r,{...a}),renderOption:(a,d)=>q.createElement(Do,{...a,key:d,secondaryAction:l.jsx(No,{edge:"end","aria-label":"delete",onClick:h=>o(h,d),children:l.jsx(va,{})})},l.jsx(ya,{role:void 0,dense:!0,sx:{paddingLeft:0,paddingRight:30,"&:hover":{backgroundColor:"transparent"}},children:l.jsx(Mo,{primary:d,sx:{"& span":{display:"block",width:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})})),slotProps:{listbox:{sx:{maxHeight:300,overflow:"auto"}}}}),l.jsx(ba,{style:{margin:0},children:i})]})}bs.propTypes={onValueChange:B.func,children:B.node,value:B.string,helperText:B.string};function xs({onClick:e}){const{t}=xt();return l.jsx(dl,{title:t("launchBlocklet.withoutWallet"),icon:l.jsx(yt,{icon:hl,fontSize:"1em"}),onClick:e})}xs.propTypes={onClick:B.func.isRequired};function ws({defaultUrl:e="",onCancel:t,onSuccess:r,onError:i=()=>{},mode:s="install",handleText:n={}}){const{api:o}=dn(),{api:a,session:d}=rc(),[h,u]=q.useState(!1),[f,j]=q.useState(""),{t:m,locale:S}=xt(),E={dist:{}},{encryptKey:C}=fl(),[c,N]=q.useState(e),[$,O]=q.useState(e?1:0),[w,R]=q.useState(E),[F,D]=q.useState(!1),[ne,Y]=q.useState(""),[W]=si("instant-blocklet-install",!1),[U,H]=q.useState({}),A=s==="component",J=A?!0:!e,{addUrlRecord:M}=ys(),ue=q.useMemo(()=>(d.user?.connectedAccounts||[]).some(Fe=>Fe.provider===nl.WALLET),[d.user]),Ie=q.useMemo(()=>{let de=c.trim();return!de.startsWith("https://")&&!de.startsWith("http://")&&!de.startsWith("file://")&&(de=`file://${de}`),de},[c]),K=async()=>{R(E),j(null),u(!0);const de=Ie;try{const ge=decodeURIComponent(de);try{new URL(ge)}catch{throw new Error("Invalid URL")}const{meta:Fe,inStore:$e,registryUrl:jt}=await o.getBlockletMetaFromUrl({input:{url:ge}});R(Fe),H({inStore:$e,registryUrl:jt,inputUrl:de}),M(de)}catch(ge){console.error(ge);const Fe=`Blocklet Install failed: ${Ur(ge)}`;j(Fe),i(ge)}finally{u(!1)}},Ee=()=>{if(A){r({meta:w,...U}),t();return}if(W){u(!0),D(!0);return}const de=rn(window?.env?.apiPrefix??"/","/launch-blocklet/install");window.location.href=Zn(de,{blocklet_meta_url:decodeURIComponent(Ie.trim()),from:"url"})},ce=()=>{u(!1),D(!1),r({meta:w,...U}),t()},Me=()=>{u(!1),D(!1)};q.useEffect(()=>{e&&K()},[e]);const me=q.useMemo(()=>({title:w.title,wt:pl(w),blockletMetaUrl:decodeURIComponent(c.trim())}),[w,c]),Oe=q.useCallback(async()=>{if(ue||W){Y("");return}const de=new URL(window.location.href);de.pathname=rn(window?.env?.apiPrefix??"/","/api/did/launch-free-blocklet-by-session/token"),de.searchParams.set("_ek_",C),Object.keys(me).forEach(Fe=>{de.searchParams.set(Fe,me[Fe])});const{data:ge}=await a.get(de.href);ge.url?Y(ge.url):Y("")},[ue,me,a,C,W]);q.useEffect(()=>{Oe()},[Oe]);const Pe=q.useMemo(()=>ue&&ne?{...me,nw:ne,skipMigrateAccount:!0}:me,[me,ne,ue]),nt=[{name:m("common.name"),value:Bt.getDisplayName({meta:w},!0)},{name:m("common.version"),value:w.version},{name:m("common.did"),value:w.did?l.jsx(ic,{did:w.did}):null},{name:m("common.author"),value:w.owner?l.jsx(vs,{owner:w.owner,locale:S}):hu.formatPerson(w.author)},{name:m("blocklet.dist.downloadLink"),value:w.dist.tarball}],ut=()=>h?l.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:l.jsx(Tt,{})}):w.did?l.jsx("div",{style:{paddingLeft:"10%"},children:nt.map(de=>de.name===m("common.did")?l.jsx(_i,{valueComponent:"div",nameWidth:120,name:de.name,nameFormatter:()=>m("common.did"),children:de.value},de.name):l.jsx(_i,{valueComponent:"div",nameWidth:120,name:de.name,children:de.value},de.name))}):null,ft=Yl(async()=>{let de=w.title;d.user&&(de=`${d.user.fullName}'s ${w.title}`);try{ce(),await o.launchBlockletWithoutWallet({input:{title:de,blockletMetaUrl:decodeURIComponent(c.trim()),type:"store",storeUrl:U.registryUrl,onlyRequired:!0}})}catch(ge){console.error("launchBlockletWithoutWallet error:",ge),Yn.error(Ur(ge),{autoHideDuration:3e3})}}),rt=[{label:m("blocklet.fromUrl.step0"),body:l.jsx(je,{component:"div",children:l.jsx(bs,{style:{marginBottom:32},value:c,helperText:m("blocklet.fromUrl.description"),onValueChange:de=>{j(null),N(de)},children:l.jsx(Hn,{label:m("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,margin:"dense",value:c,onChange:de=>{j(null),N(de.target.value)},disabled:h,onKeyPress:de=>{de.key==="Enter"&&(de.preventDefault(),K(),O(1))}})})}),cancel:m("common.cancel"),confirm:m("common.next"),onCancel:t,onConfirm:()=>{K(),O(1)}},{label:m("blocklet.fromUrl.step1"),body:ut(),cancel:m(J?"common.pre":"common.cancel"),confirm:n?.confirm||m("blocklet.fromUrl.confirm"),onCancel:()=>{J?O(de=>de-1):t()},onConfirm:()=>{Ee()}}],we=rt[$];return l.jsxs(l.Fragment,{children:[l.jsxs(oi,{title:n?.title||m("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>we.onCancel(),showCloseButton:$===0,disableEscapeKeyDown:!0,open:!0,actions:l.jsxs(l.Fragment,{children:[we.cancel&&l.jsx(vt,{onClick:de=>{de.stopPropagation(),j(null),we.onCancel()},color:"inherit",children:we.cancel||m("common.cancel")}),l.jsxs(vt,{onClick:de=>{de.stopPropagation(),we.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:h||!c||f,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[h&&$===0&&l.jsx(Tt,{size:16}),we.confirm]})]}),children:[J&&l.jsx(xa,{alternativeLabel:!0,activeStep:$,children:rt.map(({label:de})=>l.jsx(wa,{children:l.jsx(Sa,{children:de})},de))}),l.jsx(Ea,{component:"div",style:{marginTop:24},children:we.body}),!!f&&l.jsx(Bo,{severity:"error",style:{width:"100%",marginTop:8},children:f})]}),w&&F&&l.jsx(Jo,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:!ue&&!W?"bind-wallet":"launch-free-blocklet-by-session",checkFn:a.get,checkTimeout:5*60*1e3,onSuccess:ce,extraParams:Pe,messages:{title:m("setup.keyPair.title"),scan:m("setup.keyPair.scan"),confirm:m("setup.keyPair.confirm"),success:m("setup.keyPair.success")},onClose:Me,customItems:W?[]:[l.jsx(xs,{onClick:ft})]})]})}ws.propTypes={defaultUrl:B.string,onCancel:B.func.isRequired,onSuccess:B.func.isRequired,onError:B.func,mode:B.oneOf(["install","component"]),handleText:B.object};const pu={meta:B.object.isRequired,onCancel:B.func.isRequired};function Ss({action:e,onSelect:t,onNext:r}){const{t:i}=xt(),s=[{action:"purchase",title:i("store.purchase.purchase.title"),description:i("store.purchase.purchase.description")},{action:"verify",title:i("store.purchase.verify.title"),description:i("store.purchase.verify.description")}];return l.jsxs(l.Fragment,{children:[l.jsx(ka,{children:s.map(n=>l.jsxs(Do,{button:!0,selected:e===n.action,onClick:()=>t(n.action),children:[l.jsx(Ta,{sx:{minWidth:48},children:n.action==="purchase"?l.jsx(ja,{style:{color:e==="purchase"?Oi.primary.main:"#AAA",fontSize:32}}):l.jsx(Oa,{style:{color:e==="verify"?Oi.primary.main:"#AAA",fontSize:32}})}),l.jsx(Mo,{primary:n.title,secondary:n.description})]},n.action))}),r&&l.jsx(vt,{fullWidth:!0,disabled:!e,variant:"contained",color:"primary",style:{marginTop:16},onClick:r,children:i("common.next")})]})}Ss.propTypes={action:B.oneOf(["both","purchase","verify"]).isRequired,onSelect:B.func.isRequired,onNext:B.func.isRequired};function Es({meta:e,onCancel:t,mode:r,handlePaySuccess:i=()=>{}}){const{t:s,locale:n}=xt(),{info:o}=dn(),a=ml(o),[d,h]=q.useState(null),u=new URL(e?.registryUrl).origin,f=Bt.getDisplayName({meta:e}),j=async(S,E)=>{const C=({downloadTokenList:$})=>{i({downloadTokenList:$})},c=$=>{Yn.error($),t($)};function N($){return vl(()=>Ni.get($).then(async({data:O})=>{const w=O?.downloadTokenList;if(O.status==="succeed"){if(w&&w.length)await C({downloadTokenList:w});else return await c(s("blocklet.component.missDownloadTokenTip")),!0;return!0}return O.status==="error"?(console.error("vc error: ",O),await c(O?.error),!0):!1}),{interval:1e3})}if(r==="purchase"&&d){const{statusUrl:$}=gl(d);await N($)}else await C({downloadTokenList:S.downloadTokenList&&E(S.downloadTokenList)})};if(q.useEffect(()=>{if(r==="purchase"){const S=new URL(u);S.pathname="/api/did/verify-purchase-blocklet/token",S.searchParams.set("serverDid",o.did),S.searchParams.set("blockletDid",e?.did);try{Ni.get(S.href).then(({data:E})=>{const C=`${E.url}`;h(C)})}catch(E){console.error("get next workflow url error: ",E)}}return()=>{h(null)}},[r]),r==="purchase"&&!d)return"";const m={verify:{action:"verify-purchase-blocklet",checkFn:Li.create({baseURL:u}).get,extraParams:{serverDid:o.did,blockletDid:e?.did},messages:{title:s("store.purchase.verify.auth.title",{name:f}),scan:s("store.purchase.verify.auth.scan"),confirm:s("store.purchase.verify.auth.confirm"),success:s("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:Li.create({baseURL:rn(u,"/store")}).get,extraParams:{factory:e.nftFactory,nw:d},messages:{title:s("store.purchase.auth.title",{name:f}),scan:s("store.purchase.auth.scan"),confirm:s("store.purchase.auth.confirm"),success:l.jsxs(l.Fragment,{children:[l.jsx("p",{children:s("store.purchase.auth.success")}),l.jsx("p",{children:s("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return l.jsx(Jo,{open:!0,locale:n,popup:!1,saveConnect:!1,className:"connect",baseUrl:u,onSuccess:j,cancelWhenScanned:t,onClose:t,checkTimeout:60*5e3,webWalletUrl:a,disableClose:!0,showDownload:!1,...m[r]})}Es.propTypes={...pu,handlePaySuccess:B.func,mode:B.oneOf(["verify","purchase"]).isRequired};function ks({ref:e=null,mode:t,...r}){const[i,s]=q.useState(t!=="both"?t:"verify"),[n,o]=q.useState(t!=="both"?2:1),a=h=>{h!==i&&s(h)},d=()=>{i&&n!==2&&o(2)};return q.useImperativeHandle(e,()=>({onNext:d,getCurrentStep:()=>n})),n===1?l.jsx("div",{style:{maxWidth:520},children:l.jsx(Ss,{action:i,onNext:null,onSelect:a})}):l.jsx(Es,{...r,mode:i})}ks.propTypes={mode:B.oneOf(["both","verify","purchase"]).isRequired,ref:B.any};function mu({...e}){return l.jsx(vt,{className:"bottom-button",variant:"contained",color:"primary",...e})}function Ts({blocklet:e=null,onStartNow:t=()=>{},children:r=null,disabled:i=!1}){const{t:s}=xt(),n=is();return!e||yl(e.meta)?l.jsx(gu,{children:r}):l.jsxs(vu,{isMobile:n,children:[l.jsx(mu,{className:"start-now",variant:"contained",color:"primary",disabled:i,onClick:()=>t(),children:s("setup.startNow")}),l.jsx(te,{sx:{display:"flex",alignItems:"center"},children:r})]})}Ts.propTypes={blocklet:B.object,onStartNow:B.func,children:B.any,disabled:B.bool};const gu=tt(te)`
|
|
220
|
+
`),O=c.string().trim().min(1).custom(V=>{if(E(V)>u.MAX_TITLE_LENGTH)throw new Error(`title length should not exceed ${u.MAX_TITLE_LENGTH} (see: https://www.npmjs.com/package/cjk-length)`);return V}).meta({className:"TTitle"});ae.titleSchema=O;const w=c.string().trim().min(3).max(160).meta({className:"TDescription"});ae.descriptionSchema=w;const R=c.string().trim().min(3).max(20).messages({"*":"Title length must be between 3 and 20 characters"}).meta({className:"TInstallBlockletTitle"});ae.installBlockletTitleSchema=R;const F=c.string().trim().min(3).max(80).messages({"*":"Description length must be between 3 and 80 characters"}).meta({className:"TInstallBlockletDescription"});ae.installBlockletDescriptionSchema=F;const D=c.string().uri({scheme:["http","https"],allowRelative:!0}).allow("").custom((V,he)=>V.includes(a.WELLKNOWN_BLOCKLET_LOGO_PATH)?he.message(`logo url should not include ${a.WELLKNOWN_BLOCKLET_LOGO_PATH}`):V).meta({className:"TLogo"});ae.logoSchema=D;const ne=c.string().trim().min(1),Y=ne.meta({className:"TMountPoint"}).custom((V,he)=>(0,S.isValidUrlPath)(V)?V:he.message(`mountPoint cannot contain such characters space $*+~()'"!:@\\`));ae.mountPointSchema=Y;const W=ne.meta({className:"TUpdateMountPoint"}).custom(V=>(0,S.urlPathFriendly)(V));ae.updateMountPointSchema=W;const U=c.string().custom(V=>((0,m.validateName)(V),V)).meta({className:"TBlockletName"});ae.blockletNameSchema=U;const H=[],A=c.string().trim().min(1).max(50).required().custom((V,he)=>V.startsWith("BLOCKLET")&&!H.includes(V)?he.message("Env name can not start with BLOCKLET_"):V.startsWith("COMPONENT")?he.message("Env name can not start with COMPONENT_"):V.startsWith("ABTNODE")?he.message("Env name can not start with ABTNODE_"):/[^\w]/.test(V)?he.message('Env name can include only numbers or letters or "_"'):V).meta({className:"TEnvironmentName",unknownType:"any"});ae.environmentNameSchema=A;const J=c.object({name:A.required(),description:c.string().trim().required(),default:c.string().optional().allow("").default(""),required:c.boolean().default(!1),secure:c.boolean().default(!1),validation:c.string().optional(),shared:c.boolean().default(V=>V.secure?!1:void 0)}).custom((V,he)=>V.secure&&V.default?he.message(`Cannot declare default value for secure env ${V.name}`):V).meta({className:"TEnvironment",unknownType:"any"});ae.environmentSchema=J;const M=c.object({dev:c.string().trim().min(1),e2eDev:c.string().trim().min(1),preFlight:c.string().trim().min(1),preInstall:c.string().trim().min(1),postInstall:c.string().trim().min(1),preStart:c.string().trim().min(1),postStart:c.string().trim().min(1),preStop:c.string().trim().min(1),preUninstall:c.string().trim().min(1),preConfig:c.string().trim().min(1)}).rename("pre-flight","preFlight").rename("pre-install","preInstall").rename("post-install","postInstall").rename("pre-start","preStart").rename("post-start","postStart").rename("pre-stop","preStop").rename("pre-uninstall","preUninstall").rename("pre-config","preConfig").optional().meta({className:"TScripts",unknownType:"any"});ae.scriptsSchema=M;const ue=c.object({name:c.string().required().trim(),config:c.object().optional().default({})}).unknown(!0).meta({className:"TService",unknownType:"any"});ae.serviceSchema=ue;const Ie=c.object({type:c.string().trim(!0).min(1).required(),path:c.string().required(),meta:c.object({vcType:c.string(),payable:c.boolean(),params:c.array().items({name:c.string().required().trim(),description:c.string().required().trim()})})}).meta({className:"TEndpoint",unknownType:"any"});ae.endpointSchema=Ie;const K=c.string().trim().custom((V,he)=>{const De=V.split("/").filter(Boolean);return De.length===0?he.message("cacheable path must be a valid pathname that is not /"):`/${De.join("/")}`}).meta({className:"TPathPrefix",unknownType:"any"});ae.cacheableSchema=K;const Ee=c.object({type:c.string().lowercase().valid(...u.BLOCKLET_INTERFACE_TYPES).required(),name:c.string().trim().required(),path:c.string().trim().default("/"),prefix:c.string().trim().min(1).default(u.BLOCKLET_DYNAMIC_PATH_PREFIX),containerPort:c.number().port().optional(),hostIP:c.string().trim().ip({version:["ipv4","ipv6"]}).optional(),protocol:c.string().lowercase().valid(...u.BLOCKLET_INTERFACE_PROTOCOLS).default("http"),port:c.alternatives().try(c.string().uppercase().default(u.BLOCKLET_DEFAULT_PORT_NAME),c.object({internal:c.string().uppercase().required(),external:c.number().port().required()})).default(u.BLOCKLET_DEFAULT_PORT_NAME),cacheable:c.array().items(K).unique(),services:c.array().items(ue).unique("name"),endpoints:c.array().items(Ie).unique("type"),pageGroups:c.array().items(c.string().min(1).max(255).trim()).unique(),proxyBehavior:c.string().valid("service","direct").default("service").optional()}).meta({className:"TInterface",unknownType:"any"});ae.interfaceSchema=Ee;const ce=c.alternatives().try(c.string().required(),c.object({url:c.string().uri({scheme:["http","https","file"]}).required(),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}).required(),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})),Me=c.object({platform:c.string().valid(...u.BLOCKLET_PLATFORMS).optional(),interpreter:c.string().valid("binary","node","blocklet","bun").default("node"),source:ce,args:c.array().items(c.string()).optional().default([])}).meta({className:"TEngine",unknownType:"any"});ae.engineSchema=Me;const me=c.object({name:c.string().min(1).required(),email:c.string().email({tlds:!1}).optional(),url:c.string().uri().optional()}).meta({className:"TPerson",unknownType:"any"});ae.personSchema=me;const Oe=c.object({tarball:c.alternatives().try(c.string().uri(),c.string()).required(),integrity:c.string().required(),size:c.number().optional()}).meta({className:"TDist",unknownType:"any"});ae.distSchema=Oe;const Pe=c.object({downloads:c.number().integer().greater(-1),star:c.number().default(0),purchases:c.number().default(0)}).meta({className:"TStats",unknownType:"any"});ae.statsSchema=Pe;const ut={source:c.alternatives().try(c.object({url:c.alternatives().try(c.string().uri(),c.array().items(c.string().uri()).min(1)).required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid())}),c.object({store:c.string().uri({scheme:["http","https"]}),name:U.required(),version:c.alternatives().try(c.string().valid("latest"),c.semverRange().valid()).default("latest")})).required(),required:c.boolean(),title:O,description:w,mountPoint:Y,name:U},ft=(V,he)=>c.object(V).custom((De,Xe)=>!he&&De.source&&De.source.name&&!De.source.store?Xe.message(`missing 'store' in source of component ${De.name}`):De),rt=ft(ut).meta({className:"TComponent",unknownType:"any"});ae.componentSchema=rt;const we=ft(ut,!0),de=({checkStore:V}={})=>{const he=[rt,we];return c.array().items(V?he[0]:he[1]).optional().default([])},ge=c.object({type:c.string().required(),name:c.string().required(),signer:c.string().required(),pk:c.string().required(),created:c.string().isoDate().required(),sig:c.string().required(),excludes:c.array().items(c.string()).optional(),appended:c.array().items(c.string()).optional(),delegatee:c.string(),delegateePk:c.string(),delegation:c.string()}).meta({className:"TSignature",unknownType:"any"});ae.signatureSchema=ge;const Fe=["en","zh","fr","ru","ar","es","de","pt","ja","hi"],$e={id:c.string().custom($),title:c.alternatives().try(c.string().min(1).max(u.MAX_TITLE_LENGTH),c.object().min(1).pattern(c.string().valid(...Fe),c.string().min(1).max(u.MAX_TITLE_LENGTH))).required(),description:c.alternatives().try(c.string().min(1).max(u.MAX_DESCRIPTION_LENGTH),c.object().min(1).pattern(c.string().valid(...Fe),c.string().min(1).max(u.MAX_DESCRIPTION_LENGTH))),link:c.alternatives().try(c.string().custom(N),c.object().min(1).pattern(c.string().valid(...Fe),c.string().custom(N))),component:c.string().min(1),section:c.array().items(c.string().valid("header","footer","bottom","social","dashboard","sessionManager","userCenter","bottomNavigation")).single(),role:c.array().items(c.string().min(1)).single(),icon:c.string().min(1),visible:c.boolean(),private:c.boolean()},jt=c.object({...$e,items:c.array().items(c.object({...$e}).rename("child","component"))}).rename("child","component").meta({className:"TNavigationItem",unknownType:"any"});ae.navigationItemSchema=jt;const Ae=c.array().items(jt).unique((V,he)=>V.id&&he.id?V.id===he.id:!1).meta({className:"TNavigation",unknownType:"any"});ae.navigationSchema=Ae;const Et=c.object({background:c.alternatives().try(c.string().min(1),c.object({header:c.string().min(1),footer:c.string().min(1),default:c.string().min(1)}).min(1))}).meta({className:"TTheme",unknownType:"any"});ae.themeSchema=Et;const Ot=c.object({whoCanAccess:c.string().valid("owner","invited","all"),profileFields:c.array().items(c.string().valid("fullName","email","avatar","phone")).unique(),ignoreUrls:c.array().items(c.string().min(1)),allowSwitchProfile:c.boolean(),blockUnauthenticated:c.boolean(),blockUnauthorized:c.boolean()}).options({stripUnknown:!0}).meta({className:"TAuthConfig",unknownType:"any"});ae.authConfigSchema=Ot;const Ct=c.object({type:c.string().trim().min(1).required(),description:c.string().trim().min(1)}),It=c.object({did:c.DID().trim().required(),type:c.string().trim().min(1).required(),public:c.boolean()}).meta({className:"TResourceBundle",unknownType:"any"});ae.resourceBundleSchema=It;const Ve=c.array().items(c.object({type:c.string().trim().min(1).max(128).pattern(/^(?!blocklet\.)[a-zA-Z0-9_-]+(\.[a-zA-Z0-9_-]+)+$/).message('Event type must be in format of "[noun.]verb" like "post.published" or "post.comment.published", and prefix "blocklet." is reserved').required(),description:c.string().trim().min(1).max(256).required()})).unique("type").meta({className:"TEvent",unknownType:"any"});ae.eventsSchema=Ve;const Rt={did:c.DID().trim().required(),version:c.semver().valid().required(),name:c.string().optional(),description:w.required(),group:c.string().valid(...u.BLOCKLET_GROUPS),main:c.string().trim(),title:O.optional().allow(""),logo:c.string().trim().optional(),specVersion:c.semver().valid().gte("1.0.0").optional(),author:me.optional(),contributors:c.array().items(me).optional(),maintainers:c.array().items(me).optional(),community:c.string().uri().optional().allow("").default(""),documentation:c.string().uri().optional().allow("").default(""),homepage:c.string().uri().optional().allow("").default(""),license:c.string().optional().allow("").default(""),support:c.alternatives().try(c.string().uri(),c.string().email({tlds:!1})).optional(),nftFactory:c.DID().optional().allow("").default(""),payment:c.object({price:c.array().max(1).items(c.object({value:c.number().greater(0).required(),address:c.DID().required()})).default([]),share:c.array().max(4).items(c.object({name:c.string().required(),address:c.DID().required(),value:c.number().greater(0).max(1).required()})).default([]).custom(V=>{if(V.length===0)return V;const he=V.reduce((De,Xe)=>De+Xe.value,0);if(he!==1)throw new Error(`Invalid blocklet payment share config: total share must be 1, got ${he}`);return V},"invalid blocklet share"),componentPrice:c.array().items(c.object({parentPriceRange:c.array().items(c.number()).custom((V,he)=>V.length!==2?he.message("length of range should be 2"):V[0]<0?he.message("the first value should not less than 0 in range"):V[1]<=V[0]?he.message("the second value should greater than the first value in range"):V),type:c.string().valid("fixed","percentage").required(),value:c.number().greater(0).required()})).single()}).default({price:[],share:[]}),keywords:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),tags:c.alternatives().try(c.string().trim().min(1),c.array().items(c.string().min(1))).optional(),gitHash:c.string().optional().allow(""),repository:c.alternatives().try(c.string().min(1),c.object({type:c.string().valid("git","https","svn").required(),url:c.string().uri().required(),directory:c.string()})).optional(),timeout:c.object({start:c.number().min(10).max(600),script:c.number().min(1).max(1800)}).default({start:60}),requirements:c.object({abtnode:c.semverRange().valid(),server:c.semverRange().valid(),os:c.alternatives().try(c.string().valid("*",...u.BLOCKLET_PLATFORMS),c.array().items(c.string().valid(...u.BLOCKLET_PLATFORMS)).min(1)),cpu:c.alternatives().try(c.string().valid("*",...u.BLOCKLET_ARCHITECTURES),c.array().items(c.string().valid(...u.BLOCKLET_ARCHITECTURES)).min(1)),fuels:c.array().items(c.object({endpoint:c.string().trim().required(),address:c.string().trim(),value:c.string().trim().required(),reason:c.string().trim().required()})),nodejs:c.semverRange().valid(),aigne:c.boolean().optional()}).default({server:u.BLOCKLET_LATEST_REQUIREMENT_SERVER,os:"*",cpu:"*",nodejs:"*"}),interfaces:c.array().items(Ee).unique("name").custom((V,he)=>{if(V.filter(it=>it.type===u.BLOCKLET_INTERFACE_TYPE_WEB).length>1)return he.message(`Only one ${u.BLOCKLET_INTERFACE_TYPE_WEB} interface can be declared`);const Xe=V.filter(it=>it.type===u.BLOCKLET_INTERFACE_TYPE_WELLKNOWN);for(const it of Xe)if(!it.prefix.startsWith(C))return he.message(`Wellknown path prefix must start with: ${C}`);return V}).default([]),environments:c.array().items(J).default([]).optional().custom((V,he)=>{if(V&&V.length){const De=V.filter((Xe,it)=>V.findIndex(wt=>wt.name===Xe.name)!==it);if(De.length)return he.message(`find duplicate environment names ${De.map(Xe=>Xe.name).join(", ")}`)}return V}),scripts:M,capabilities:c.object({clusterMode:c.boolean(),didSpace:c.string().valid(...Object.values(u.BLOCKLET_APP_SPACE_REQUIREMENT)).optional(),navigation:c.boolean().default(!0),serverless:c.boolean().optional(),component:c.boolean(),sitemap:c.boolean().optional(),mcp:c.boolean().optional(),singleton:c.boolean().optional()}).default({}),files:c.array().items(c.string().trim()).optional(),resource:c.object({exportApi:c.string().trim(),bundles:c.array().items(It),types:c.array().items(Ct).max(10)}),engine:c.alternatives().try(Me,c.array().items(Me)).optional(),screenshots:c.array().items(c.string().min(1)).optional().default([]),videos:c.array().items(c.string().pattern(/^https:\/\/(www\.)?(youtube\.com|youtu\.be|vimeo\.com)\/[\w\-/?&=]+/).message("Each video URL must be a valid YouTube or Vimeo link")).max(3).optional(),logoUrl:c.string().optional().allow(""),dist:Oe.optional(),stats:Pe.optional(),htmlAst:c.any().optional(),path:c.string().optional(),signatures:c.array().items(ge).optional(),lastPublishedAt:c.string().isoDate().optional().allow(null),components:de(),navigation:Ae,theme:Et,copyright:c.object({owner:c.string().min(1),year:c.alternatives().try(c.string(),c.number())}),bundleName:c.string(),bundleDid:c.DID().trim(),storeId:c.string(),events:Ve.optional()},pt=c.object(Rt).options({stripUnknown:!0,noDefaults:!1}).meta({className:"TBlockletMeta",unknownType:"any"});ae.blockletMetaSchema=pt;const st=(V,{ensureFiles:he=!1,ensureDist:De=!1,ensureComponentStore:Xe=!0,ensureName:it=!1,skipValidateDidName:wt=!1,...Ut}={})=>((!V||!t.default.existsSync(V))&&(he=!1),c.object({...Rt,owner:c.object({avatar:c.string().optional(),did:c.DID().trim().required(),fullName:c.string().trim().required(),email:c.string().optional().allow(null).empty("").default("")}).optional(),logo:he?c.file().trim().exists({baseDir:V}).optional():c.string().trim().optional(),files:c.array().items(he?c.file().exists({baseDir:V,canSkip:(Ue,L)=>[u.BLOCKLET_ENTRY_FILE,u.BLOCKLET_BUNDLE_FILE].includes(L)||(0,s.default)(L)}):c.string().trim()).optional(),dist:De?Oe.required():Oe.optional(),components:de({checkStore:Xe}),name:it?c.string().optional():c.string().required(),egress:c.boolean().optional().default(!0),docker:h.dockerSchema}).options({stripUnknown:!0,noDefaults:!1,...Ut}).rename("children","components").custom((Ue,L)=>{const{did:re,name:ve,docker:Re}=Ue;if(Re){const{image:b,dockerfile:k,network:_}=Re;if(b&&k)return L.message("Image and dockerfile cannot be set at the same time");if(_)return L.message("ExportPorts and network cannot be set at the same time");k&&(Ue.files||(Ue.files=[]),Ue.files.push(k))}let p;if((0,d.isValid)(re))try{return(0,m.validateNewDid)(re),Ue}catch(b){p=b}if(ve){(0,m.validateName)(ve,{checkDid:!wt});const b=(0,f.toBlockletDid)(ve);return b!==re?L.message(`The did of name "${ve}" should be "${b}"`):Ue}return p?L.message(p.message):Ue}));return ae.createBlockletSchema=st,ae.default={blockletNameSchema:U,componentSchema:rt,endpointSchema:Ie,serviceSchema:ue,createBlockletSchema:st,interfaceSchema:Ee,environmentSchema:J,environmentNameSchema:A,scriptsSchema:M,personSchema:me,distSchema:Oe,titleSchema:O,descriptionSchema:w,logoSchema:D,navigationSchema:Ae,themeSchema:Et,mountPointSchema:Y,updateMountPointSchema:W,authConfigSchema:Ot,resourceBundleSchema:It,installBlockletTitleSchema:R,installBlockletDescriptionSchema:F,eventsSchema:Ve,Joi:c},ae}var ht={},so;function cu(){if(so)return ht;so=1;var e=ht&&ht.__importDefault||function(h){return h&&h.__esModule?h:{default:h}};Object.defineProperty(ht,"__esModule",{value:!0}),ht.setService=ht.findService=ht.getDefaultServiceConfig=ht.getServiceConfig=void 0;const t=e(nc),r=gs(),i={},s=h=>{i[h.name]={validate:h.schema.validate.bind(h.schema),defaultConfig:h.default}};ht.setService=s,s({name:"auth",schema:r.authConfigSchema,default:{}});const n=h=>{if(!h)throw new Error("service name should not be empty");const u=i[h];if(!u)throw new Error(`service ${h} does not exist`);return u},o=(h,u,{validate:f}={})=>{const j=n(h),m=(0,t.default)(u||{}),{value:S,error:E}=j.validate(m);if(f&&E)throw new Error(`Invalid blocklet service config: ${E.details.map(C=>C.message).join(", ")}`);return S};ht.getServiceConfig=o;const a=h=>{const{defaultConfig:u}=n(h);return u};ht.getDefaultServiceConfig=a;const d=(h,u)=>{const f=[u];return(h||[]).find(j=>f.includes(j.name))};return ht.findService=d,ht.default={getServiceConfig:o,getDefaultServiceConfig:a,findService:d,setService:s},ht}var ao;function uu(){if(ao)return Kt;ao=1,Object.defineProperty(Kt,"__esModule",{value:!0}),Kt.fixAndValidateService=Kt.validateMeta=void 0;const e=gs(),t=cu(),r=s=>(!s.interfaces||!s.interfaces.length||s.interfaces.forEach(n=>{n.services&&n.services.length&&n.services.forEach(o=>{o.config=(0,t.getServiceConfig)(o.name,o.config,{validate:!0})})}),s);Kt.fixAndValidateService=r;const i=(s,{ensureFiles:n=!1,ensureDist:o=!1,ensureComponentStore:a=!0,ensureName:d=!1,skipValidateDidName:h=!1,schemaOptions:u={}}={})=>{const f=(0,e.createBlockletSchema)(null,{ensureFiles:n,ensureDist:o,ensureComponentStore:a,ensureName:d,skipValidateDidName:h,...u}),{value:j,error:m}=f.validate(s);if(m)throw new Error(`Invalid blocklet meta: ${m.details.map(S=>S.message).join(", ")}`);return j};return Kt.validateMeta=i,Kt.default=i,Kt}var lo;function du(){return lo||(lo=1,function(e){var t=kt&&kt.__createBinding||(Object.create?function(w,R,F,D){D===void 0&&(D=F);var ne=Object.getOwnPropertyDescriptor(R,F);(!ne||("get"in ne?!R.__esModule:ne.writable||ne.configurable))&&(ne={enumerable:!0,get:function(){return R[F]}}),Object.defineProperty(w,D,ne)}:function(w,R,F,D){D===void 0&&(D=F),w[D]=R[F]}),r=kt&&kt.__setModuleDefault||(Object.create?function(w,R){Object.defineProperty(w,"default",{enumerable:!0,value:R})}:function(w,R){w.default=R}),i=kt&&kt.__importStar||function(){var w=function(R){return w=Object.getOwnPropertyNames||function(F){var D=[];for(var ne in F)Object.prototype.hasOwnProperty.call(F,ne)&&(D[D.length]=ne);return D},w(R)};return function(R){if(R&&R.__esModule)return R;var F={};if(R!=null)for(var D=w(R),ne=0;ne<D.length;ne++)D[ne]!=="default"&&t(F,R,D[ne]);return r(F,R),F}}(),s=kt&&kt.__importDefault||function(w){return w&&w.__esModule?w:{default:w}};Object.defineProperty(e,"__esModule",{value:!0}),e.fixService=e.fixInterfaces=e.parsePerson=e.formatPerson=e.fixName=e.fixTags=e.fixPerson=e.fixKeywords=e.fixFiles=e.fixRepository=e.fixRequired=void 0;const n=s(ul),o=i(Hc()),a=Yo(),d=uu();Object.defineProperty(e,"fixService",{enumerable:!0,get:function(){return d.fixAndValidateService}});const h=ms(),u=(w,R)=>{w.description||(w.description=`Blocklet from ${R}`),w.version||(w.version=a.BLOCKLET_DEFAULT_VERSION)};e.fixRequired=u;const f=w=>{if(w.repository&&(typeof w.repository=="string"&&(w.repository={type:"git",url:w.repository}),w.repository.url)){const R=o.fromUrl(w.repository.url);R&&(w.repository.url=R.getDefaultRepresentation()==="shortcut"?R.https():R.toString())}};e.fixRepository=f;const j=w=>{Array.isArray(w.files)?w.files&&(w.files=w.files.filter(R=>!(!R||typeof R!="string"))):delete w.files};e.fixFiles=j;const m=w=>{typeof w.keywords=="string"&&(w.keywords=w.keywords.split(/,\s+/)),w.keywords&&!Array.isArray(w.keywords)?delete w.keywords:w.keywords&&(w.keywords=w.keywords.filter(R=>!(typeof R!="string"||!R)))};e.fixKeywords=m;const S=w=>{typeof w.tags=="string"&&(w.tags=w.tags.split(/,\s+/)),w.tags&&!Array.isArray(w.tags)?delete w.tags:w.tags&&(w.tags=w.tags.filter(R=>!(typeof R!="string"||!R)))};e.fixTags=S;const E=(w,R)=>(w.author&&(w.author=R(w.author)),["maintainers","contributors"].forEach(F=>{Array.isArray(w[F])&&(w[F]=w[F].map(R))}),w),C=w=>{if(!w)return"";if(typeof w=="string")return w;const R=w.name||"",F=w.url||w.web,D=F?` (${F})`:"",ne=w.email||w.mail,Y=ne?` <${ne}>`:"";return R+Y+D};e.formatPerson=C;const c=w=>{if(typeof w!="string")return w;const R=w.match(/^([^(<]+)/),F=w.match(/\(([^)]+)\)/),D=w.match(/<([^>]+)>/),ne={};return R&&R[0].trim()&&(ne.name=R[0].trim()),D&&([,ne.email]=D),F&&([,ne.url]=F),ne};e.parsePerson=c;const N=w=>(E(w,C),E(w,c),w);e.fixPerson=N;const $=(w,R=!0)=>{if(Array.isArray(w.interfaces)||(w.interfaces=[]),w.interfaces.length)return w.interfaces.forEach(Y=>{Y.type===a.BLOCKLET_INTERFACE_TYPE_WEB&&(Y.protocol="http")}),w;const D=(0,n.default)(w,"capabilities.dynamicPathPrefix",!0)?a.BLOCKLET_DYNAMIC_PATH_PREFIX:"/",ne=({type:Y="web",name:W,path:U="/",protocol:H="http",port:A=a.BLOCKLET_DEFAULT_PORT_NAME})=>{w.interfaces.push({type:Y,name:W,path:U,prefix:D,port:A,protocol:H})};return[a.BLOCKLET_INTERFACE_PUBLIC].forEach(Y=>{w[Y]&&ne({name:Y,path:w[Y]})}),Array.isArray(w.exposeServices)&&w.exposeServices.forEach(Y=>{ne({type:"service",name:Y.protocol,protocol:Y.protocol,port:{internal:`BLOCKLET_${Y.protocol}_PORT`.toUpperCase(),external:Y.port}})}),R&&(delete w.publicUrl,delete w.adminUrl,delete w.configUrl,delete w.docUrl,delete w.exposeServices,w.capabilities&&delete w.capabilities.dynamicPathPrefix),w};e.fixInterfaces=$;const O=w=>{const{did:R}=w;try{(0,h.validateNewDid)(R),w.name=R}catch{}return w};e.fixName=O,e.default={fixRequired:u,fixRepository:f,fixFiles:j,fixKeywords:m,fixPerson:N,fixTags:S,fixName:O,formatPerson:C,parsePerson:c,fixInterfaces:$,fixService:d.fixAndValidateService}}(kt)),kt}var hu=du();function vs({owner:e,locale:t}){return l.jsxs(te,{sx:{display:"flex",alignItems:"center",gap:1},children:[e.fullName,e.did?l.jsx(Go,{sx:{lineHeight:"initial","&::before":{content:'"("'},"&::after":{content:'")"'}},did:e.did,compact:!0,size:14,locale:t}):null]})}vs.propTypes={owner:B.object.isRequired,locale:B.string.isRequired};const fu="install-blocklet-from-URL",ys=()=>{const[e,t]=si(fu,"[]",{raw:!0}),r=s=>{const n=s.trim(),o=JSON.parse(e),a=o.findIndex(d=>d===n);a!==0&&(a>0&&o.splice(a,1),o.length>=10&&o.splice(9),o.unshift(n),t(JSON.stringify(o)))},i=s=>{if(!s)return;const n=JSON.parse(e),o=s.trim(),a=n.findIndex(d=>d===o);a>-1&&(n.splice(a,1),t(JSON.stringify(n)))};return{urls:e?JSON.parse(e):[],addUrlRecord:r,removeUrlRecord:i}};function bs({value:e="",onValueChange:t=()=>{},children:r=null,helperText:i=""}){const{urls:s,removeUrlRecord:n}=ys(),o=(a,d)=>{a.preventDefault(),a.stopPropagation(),n(d)};return l.jsxs(te,{children:[l.jsx(Ao,{freeSolo:!0,options:s,inputValue:e,onInputChange:(a,d)=>{t(d)},disableClearable:!0,popupIcon:null,renderInput:a=>Ft.cloneElement(r,{...a}),renderOption:(a,d)=>q.createElement(Do,{...a,key:d,secondaryAction:l.jsx(No,{edge:"end","aria-label":"delete",onClick:h=>o(h,d),children:l.jsx(va,{})})},l.jsx(ya,{role:void 0,dense:!0,sx:{paddingLeft:0,paddingRight:30,"&:hover":{backgroundColor:"transparent"}},children:l.jsx(Mo,{primary:d,sx:{"& span":{display:"block",width:"100%",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"}}})})),slotProps:{listbox:{sx:{maxHeight:300,overflow:"auto"}}}}),l.jsx(ba,{style:{margin:0},children:i})]})}bs.propTypes={onValueChange:B.func,children:B.node,value:B.string,helperText:B.string};function xs({onClick:e}){const{t}=xt();return l.jsx(dl,{title:t("launchBlocklet.withoutWallet"),icon:l.jsx(yt,{icon:hl,fontSize:"1em"}),onClick:e})}xs.propTypes={onClick:B.func.isRequired};function ws({defaultUrl:e="",onCancel:t,onSuccess:r,onError:i=()=>{},mode:s="install",handleText:n={}}){const{api:o}=dn(),{api:a,session:d}=rc(),[h,u]=q.useState(!1),[f,j]=q.useState(""),{t:m,locale:S}=xt(),E={dist:{}},{encryptKey:C}=fl(),[c,N]=q.useState(e),[$,O]=q.useState(e?1:0),[w,R]=q.useState(E),[F,D]=q.useState(!1),[ne,Y]=q.useState(""),[W]=si("instant-blocklet-install",!1),[U,H]=q.useState({}),A=s==="component",J=A?!0:!e,{addUrlRecord:M}=ys(),ue=q.useMemo(()=>(d.user?.connectedAccounts||[]).some(Fe=>Fe.provider===el.WALLET),[d.user]),Ie=q.useMemo(()=>{let de=c.trim();return!de.startsWith("https://")&&!de.startsWith("http://")&&!de.startsWith("file://")&&(de=`file://${de}`),de},[c]),K=async()=>{R(E),j(null),u(!0);const de=Ie;try{const ge=decodeURIComponent(de);try{new URL(ge)}catch{throw new Error("Invalid URL")}const{meta:Fe,inStore:$e,registryUrl:jt}=await o.getBlockletMetaFromUrl({input:{url:ge}});R(Fe),H({inStore:$e,registryUrl:jt,inputUrl:de}),M(de)}catch(ge){console.error(ge);const Fe=`Blocklet Install failed: ${Ur(ge)}`;j(Fe),i(ge)}finally{u(!1)}},Ee=()=>{if(A){r({meta:w,...U}),t();return}if(W){u(!0),D(!0);return}const de=rn(window?.env?.apiPrefix??"/","/launch-blocklet/install");window.location.href=Zn(de,{blocklet_meta_url:decodeURIComponent(Ie.trim()),from:"url"})},ce=()=>{u(!1),D(!1),r({meta:w,...U}),t()},Me=()=>{u(!1),D(!1)};q.useEffect(()=>{e&&K()},[e]);const me=q.useMemo(()=>({title:w.title,wt:pl(w),blockletMetaUrl:decodeURIComponent(c.trim())}),[w,c]),Oe=q.useCallback(async()=>{if(ue||W){Y("");return}const de=new URL(window.location.href);de.pathname=rn(window?.env?.apiPrefix??"/","/api/did/launch-free-blocklet-by-session/token"),de.searchParams.set("_ek_",C),Object.keys(me).forEach(Fe=>{de.searchParams.set(Fe,me[Fe])});const{data:ge}=await a.get(de.href);ge.url?Y(ge.url):Y("")},[ue,me,a,C,W]);q.useEffect(()=>{Oe()},[Oe]);const Pe=q.useMemo(()=>ue&&ne?{...me,nw:ne,skipMigrateAccount:!0}:me,[me,ne,ue]),nt=[{name:m("common.name"),value:Bt.getDisplayName({meta:w},!0)},{name:m("common.version"),value:w.version},{name:m("common.did"),value:w.did?l.jsx(ic,{did:w.did}):null},{name:m("common.author"),value:w.owner?l.jsx(vs,{owner:w.owner,locale:S}):hu.formatPerson(w.author)},{name:m("blocklet.dist.downloadLink"),value:w.dist.tarball}],ut=()=>h?l.jsx("div",{style:{height:200,width:"100%",display:"flex",alignItems:"center",justifyContent:"center",flexDirection:"column"},children:l.jsx(Tt,{})}):w.did?l.jsx("div",{style:{paddingLeft:"10%"},children:nt.map(de=>de.name===m("common.did")?l.jsx(_i,{valueComponent:"div",nameWidth:120,name:de.name,nameFormatter:()=>m("common.did"),children:de.value},de.name):l.jsx(_i,{valueComponent:"div",nameWidth:120,name:de.name,children:de.value},de.name))}):null,ft=Yl(async()=>{let de=w.title;d.user&&(de=`${d.user.fullName}'s ${w.title}`);try{ce(),await o.launchBlockletWithoutWallet({input:{title:de,blockletMetaUrl:decodeURIComponent(c.trim()),type:"store",storeUrl:U.registryUrl,onlyRequired:!0}})}catch(ge){console.error("launchBlockletWithoutWallet error:",ge),Xn.error(Ur(ge),{autoHideDuration:3e3})}}),rt=[{label:m("blocklet.fromUrl.step0"),body:l.jsx(je,{component:"div",children:l.jsx(bs,{style:{marginBottom:32},value:c,helperText:m("blocklet.fromUrl.description"),onValueChange:de=>{j(null),N(de)},children:l.jsx(Hn,{label:m("blocklet.fromUrl.label"),autoComplete:"off",variant:"outlined",name:"url","data-cy":"blocklet-url-input",fullWidth:!0,autoFocus:!0,margin:"dense",value:c,onChange:de=>{j(null),N(de.target.value)},disabled:h,onKeyPress:de=>{de.key==="Enter"&&(de.preventDefault(),K(),O(1))}})})}),cancel:m("common.cancel"),confirm:m("common.next"),onCancel:t,onConfirm:()=>{K(),O(1)}},{label:m("blocklet.fromUrl.step1"),body:ut(),cancel:m(J?"common.pre":"common.cancel"),confirm:n?.confirm||m("blocklet.fromUrl.confirm"),onCancel:()=>{J?O(de=>de-1):t()},onConfirm:()=>{Ee()}}],we=rt[$];return l.jsxs(l.Fragment,{children:[l.jsxs(oi,{title:n?.title||m("blocklet.fromUrl.title"),fullWidth:!0,maxWidth:"md",onClose:()=>we.onCancel(),showCloseButton:$===0,disableEscapeKeyDown:!0,open:!0,actions:l.jsxs(l.Fragment,{children:[we.cancel&&l.jsx(vt,{onClick:de=>{de.stopPropagation(),j(null),we.onCancel()},color:"inherit",children:we.cancel||m("common.cancel")}),l.jsxs(vt,{onClick:de=>{de.stopPropagation(),we.onConfirm()},color:"primary","data-cy":"install-blocklet-next-step",disabled:h||!c||f,variant:"contained",autoFocus:!0,style:{marginLeft:8},children:[h&&$===0&&l.jsx(Tt,{size:16}),we.confirm]})]}),children:[J&&l.jsx(xa,{alternativeLabel:!0,activeStep:$,children:rt.map(({label:de})=>l.jsx(wa,{children:l.jsx(Sa,{children:de})},de))}),l.jsx(Ea,{component:"div",style:{marginTop:24},children:we.body}),!!f&&l.jsx(Bo,{severity:"error",style:{width:"100%",marginTop:8},children:f})]}),w&&F&&l.jsx(Jo,{popup:!0,open:!0,forceConnected:!1,className:"launch-from-url-auth",action:!ue&&!W?"bind-wallet":"launch-free-blocklet-by-session",checkFn:a.get,checkTimeout:5*60*1e3,onSuccess:ce,extraParams:Pe,messages:{title:m("setup.keyPair.title"),scan:m("setup.keyPair.scan"),confirm:m("setup.keyPair.confirm"),success:m("setup.keyPair.success")},onClose:Me,customItems:W?[]:[l.jsx(xs,{onClick:ft})]})]})}ws.propTypes={defaultUrl:B.string,onCancel:B.func.isRequired,onSuccess:B.func.isRequired,onError:B.func,mode:B.oneOf(["install","component"]),handleText:B.object};const pu={meta:B.object.isRequired,onCancel:B.func.isRequired};function Ss({action:e,onSelect:t,onNext:r}){const{t:i}=xt(),s=[{action:"purchase",title:i("store.purchase.purchase.title"),description:i("store.purchase.purchase.description")},{action:"verify",title:i("store.purchase.verify.title"),description:i("store.purchase.verify.description")}];return l.jsxs(l.Fragment,{children:[l.jsx(ka,{children:s.map(n=>l.jsxs(Do,{button:!0,selected:e===n.action,onClick:()=>t(n.action),children:[l.jsx(Ta,{sx:{minWidth:48},children:n.action==="purchase"?l.jsx(ja,{style:{color:e==="purchase"?Oi.primary.main:"#AAA",fontSize:32}}):l.jsx(Oa,{style:{color:e==="verify"?Oi.primary.main:"#AAA",fontSize:32}})}),l.jsx(Mo,{primary:n.title,secondary:n.description})]},n.action))}),r&&l.jsx(vt,{fullWidth:!0,disabled:!e,variant:"contained",color:"primary",style:{marginTop:16},onClick:r,children:i("common.next")})]})}Ss.propTypes={action:B.oneOf(["both","purchase","verify"]).isRequired,onSelect:B.func.isRequired,onNext:B.func.isRequired};function Es({meta:e,onCancel:t,mode:r,handlePaySuccess:i=()=>{}}){const{t:s,locale:n}=xt(),{info:o}=dn(),a=ml(o),[d,h]=q.useState(null),u=new URL(e?.registryUrl).origin,f=Bt.getDisplayName({meta:e}),j=async(S,E)=>{const C=({downloadTokenList:$})=>{i({downloadTokenList:$})},c=$=>{Xn.error($),t($)};function N($){return vl(()=>Ni.get($).then(async({data:O})=>{const w=O?.downloadTokenList;if(O.status==="succeed"){if(w&&w.length)await C({downloadTokenList:w});else return await c(s("blocklet.component.missDownloadTokenTip")),!0;return!0}return O.status==="error"?(console.error("vc error: ",O),await c(O?.error),!0):!1}),{interval:1e3})}if(r==="purchase"&&d){const{statusUrl:$}=gl(d);await N($)}else await C({downloadTokenList:S.downloadTokenList&&E(S.downloadTokenList)})};if(q.useEffect(()=>{if(r==="purchase"){const S=new URL(u);S.pathname="/api/did/verify-purchase-blocklet/token",S.searchParams.set("serverDid",o.did),S.searchParams.set("blockletDid",e?.did);try{Ni.get(S.href).then(({data:E})=>{const C=`${E.url}`;h(C)})}catch(E){console.error("get next workflow url error: ",E)}}return()=>{h(null)}},[r]),r==="purchase"&&!d)return"";const m={verify:{action:"verify-purchase-blocklet",checkFn:Li.create({baseURL:u}).get,extraParams:{serverDid:o.did,blockletDid:e?.did},messages:{title:s("store.purchase.verify.auth.title",{name:f}),scan:s("store.purchase.verify.auth.scan"),confirm:s("store.purchase.verify.auth.confirm"),success:s("store.purchase.verify.auth.success")}},purchase:{action:"acquire-asset",checkFn:Li.create({baseURL:rn(u,"/store")}).get,extraParams:{factory:e.nftFactory,nw:d},messages:{title:s("store.purchase.auth.title",{name:f}),scan:s("store.purchase.auth.scan"),confirm:s("store.purchase.auth.confirm"),success:l.jsxs(l.Fragment,{children:[l.jsx("p",{children:s("store.purchase.auth.success")}),l.jsx("p",{children:s("blocklet.component.purchaseComponentSecondCheckTip")})]})}}};return l.jsx(Jo,{open:!0,locale:n,popup:!1,saveConnect:!1,className:"connect",baseUrl:u,onSuccess:j,cancelWhenScanned:t,onClose:t,checkTimeout:60*5e3,webWalletUrl:a,disableClose:!0,showDownload:!1,...m[r]})}Es.propTypes={...pu,handlePaySuccess:B.func,mode:B.oneOf(["verify","purchase"]).isRequired};function ks({ref:e=null,mode:t,...r}){const[i,s]=q.useState(t!=="both"?t:"verify"),[n,o]=q.useState(t!=="both"?2:1),a=h=>{h!==i&&s(h)},d=()=>{i&&n!==2&&o(2)};return q.useImperativeHandle(e,()=>({onNext:d,getCurrentStep:()=>n})),n===1?l.jsx("div",{style:{maxWidth:520},children:l.jsx(Ss,{action:i,onNext:null,onSelect:a})}):l.jsx(Es,{...r,mode:i})}ks.propTypes={mode:B.oneOf(["both","verify","purchase"]).isRequired,ref:B.any};function mu({...e}){return l.jsx(vt,{className:"bottom-button",variant:"contained",color:"primary",...e})}function Ts({blocklet:e=null,onStartNow:t=()=>{},children:r=null,disabled:i=!1}){const{t:s}=xt(),n=is();return!e||yl(e.meta)?l.jsx(gu,{children:r}):l.jsxs(vu,{isMobile:n,children:[l.jsx(mu,{className:"start-now",variant:"contained",color:"primary",disabled:i,onClick:()=>t(),children:s("setup.startNow")}),l.jsx(te,{sx:{display:"flex",alignItems:"center"},children:r})]})}Ts.propTypes={blocklet:B.object,onStartNow:B.func,children:B.any,disabled:B.bool};const gu=tt(te)`
|
|
221
221
|
width: 100%;
|
|
222
222
|
margin-top: auto;
|
|
223
223
|
padding-top: 24px;
|
|
@@ -550,7 +550,7 @@ see detail in https://www.npmjs.com/package/is-var-name
|
|
|
550
550
|
color: ${e=>e.theme.palette.grey[500]};
|
|
551
551
|
font-size: 16px;
|
|
552
552
|
cursor: pointer;
|
|
553
|
-
`;function Ih(){const{search:e,t,endpoint:r,locale:i,getCategoryLocale:s,developerName:n,showResourcesSwitch:o,layout:a,baseSearch:d,categoryOptions:h,compact:u}=ct(),{filters:f,handleSort:j,handlePrice:m,handleDeveloper:S,handleSwitchShowResources:E,cleanFilter:C,handleCategory:c,handleSwitchIsOfficial:N}=e,$=Zs(t);return l.jsxs(lt,{className:"filter-bar",direction:{xs:"column",md:"row"},spacing:{xs:1,md:0},sx:{position:"sticky",top:0,zIndex:1e3,alignItems:{xs:"flex-start",md:"center"},justifyContent:"space-between",gap:2,pt:{xs:2,md:0},px:0,pb:u?2:3,backgroundColor:"background.default"},children:[!u&&l.jsx(je,{variant:"h2",sx:{textTransform:"capitalize"},children:s(f.category)}),l.jsxs(lt,{direction:"row",sx:{flex:1,alignItems:"center",flexWrap:{xs:"wrap",md:"nowrap"},width:"100%",justifyContent:{xs:"flex-start",md:"flex-end"},gap:2},children:[a.showSearch?l.jsx(te,{sx:{flex:1,flexBasis:{xs:"100%",md:"auto"}},children:d?l.jsx(Th,{}):l.jsx(aa,{locale:i,endpoint:r,sx:{display:{md:"block",xs:"none"},flex:1,mr:1,width:"350px"},t,filters:e.filters,handleKeyword:e.handleKeyword,handleSearchSelect:e.handleSearchSelect})}):null,f.owner&&n&&l.jsx(Ti,{label:t("blocklet.authorTag",{name:n}),size:"small",onDelete:()=>S("")}),f.resourceDid&&f.resourceBlocklet&&l.jsx(Ti,{label:t("blocklet.resourceTag",{name:f.resourceBlocklet}),size:"small",onDelete:()=>C(["resourceDid","resourceBlocklet","showResources"])}),l.jsx(Ar,{checked:f.isOfficial==="true",onChange:O=>N(O?"true":"false"),label:t("common.official")}),o?l.jsx(Ar,{checked:f.showResources!=="false",onChange:O=>E(O?"true":"false"),label:t("common.showResources")}):null,l.jsx(Ar,{checked:f.price==="free",onChange:O=>m(O?"free":""),label:t("blocklet.free")}),u&&l.jsx(te,{children:l.jsx(Qr,{value:f.category||h[0]?.value,options:h,placeholder:t("common.category"),onChange:O=>c(O)})}),l.jsx(Qr,{value:f.sortBy||$[0].value,options:$,placeholder:t("sort.sort"),onChange:O=>j(O)})]})]})}function Ar({checked:e,onChange:t,label:r}){const i=$t();return l.jsx(ei,{sx:{m:0,p:0},className:"check-button",control:l.jsx(ti,{checked:e,icon:l.jsx(Mt,{style:{padding:0,color:i.palette.text.secondary},icon:Bd}),checkedIcon:l.jsx(Mt,{style:{padding:0,color:i.palette.primary.main},icon:Fd}),size:"large",sx:{p:0,mr:1},onChange:s=>t(s.target.checked)}),label:r})}function $n({children:e}){return l.jsxs(te,{sx:{display:"flex",mt:2,flexDirection:"column",alignItems:"center",justifyContent:"center",color:"text.hint"},children:[l.jsx(il,{}),e]})}function Io(){const{t:e}=ct();return l.jsx(je,{style:{textAlign:"center"},variant:"subtitle2",children:e("blocklet.noResults")})}function Dr({filterTip:e=!1,keywordTip:t=!1}){const{t:r,locale:i}=ct(),s=()=>i==="zh"?"、":" , ";return l.jsxs(te,{sx:{mt:1,display:"flex"},children:[l.jsx(je,{style:{marginRight:"16px"},children:r("blocklet.emptyTip")}),e&&l.jsx(je,{children:r("blocklet.filterTip")}),e&&t&&s(),t&&l.jsx(je,{children:r("blocklet.keywordTip")})]})}function Mr({primaryStart:e,primaryEnd:t,filter:r}){return l.jsxs(je,{variant:"subtitle2",sx:{display:"flex",gap:.5,mx:.5},children:[l.jsx(je,{children:e}),l.jsx(je,{title:r,color:"primary",sx:{maxWidth:"30vw",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),l.jsxs(je,{children:[t," "]})]})}function Rh(){const{t:e,search:t,getCategoryLocale:r,selectedCategory:i}=ct(),{filters:s}=t,n=!!i||!!s.price;if(s.keyword&&n)return l.jsxs($n,{children:[l.jsx(Mr,{primaryStart:e("blocklet.noBlockletPart1"),primaryEnd:e("blocklet.noBlockletPart2"),filter:s.keyword}),l.jsx(Dr,{keywordTip:!0,filterTip:!0})]});if(s.keyword)return l.jsxs($n,{children:[l.jsx(Mr,{primaryStart:e("blocklet.noBlockletPart1"),primaryEnd:e("blocklet.noBlockletPart2"),filter:s.keyword}),l.jsx(Dr,{keywordTip:!0})]});if(n){const o=r(i);return l.jsxs($n,{children:[o?l.jsx(Mr,{primaryStart:e("blocklet.noCategoryResults1"),primaryEnd:e("blocklet.noCategoryResults2"),filter:o}):l.jsx(Io,{}),l.jsx(Dr,{filterTip:!0})]})}return l.jsx($n,{children:l.jsx(Io,{})})}const Ph=(e,t,r,i)=>Ql(async s=>{s||(r.currentPage=r.defaultCurrentPage);const{currentPage:n,pageSize:o}=r,a={...t,category:t.category==="All"?"":t.category,sortBy:St[t.sortBy],page:n,pageSize:o};i(null);const{data:d={}}=await e.get(St.blockletsPath,{params:a});return r.currentPage++,{page:n,pageSize:o,list:d?.dataList||[],total:d?.total||0}},{isNoMore:s=>s?s.page*s.pageSize>=s.total:!1,reloadDeps:[e,bl(t)],onError:i});function Lh(){const{storeApi:e,search:t,extraFilter:r,errors:i,updateDeveloperName:s}=ct(),{filters:n}=t,o=Jl({currentPage:St.currentPage,pageSize:ah()?St.mobilePageSize:St.pageSize,defaultCurrentPage:St.defaultCurrentPage}),[a,d]=q.useState(null),h=Ph(e,n,o,d),u=q.useMemo(()=>r?r(h.data?.list||[]):h.data?.list||[],[h.data,r]);return q.useEffect(()=>{const f=u.find(j=>j.owner.did===n.owner);s(f?.owner.fullName||f?.author.name||"")},[n.owner,u,s]),{blocklets:u,fetchBlockletsError:a,loadMore:h.loadMore,hasNextPage:!h.noMore,total:h.data?.total||0,loadings:{fetchBlockletsLoading:h.loading,loadingMore:h.loadingMore},errors:{...i,fetchBlockletsError:a}}}function _h(){const{t:e,search:t,endpoint:r,blockletRender:i,serverVersion:s,minItemWidth:n,layout:o,baseSearch:a,compact:d}=ct(),{filters:h}=t,{blocklets:u,errors:f,loadMore:j,loadings:m,hasNextPage:S,total:E}=Lh(),[C]=Md({loading:m.fetchBlockletsLoading||m.loadingMore,hasNextPage:S,onLoadMore:j});if(f.fetchBlockletsError){const O=new Error(`Failed to fetch blocklets from ${r}: ${oh(f.fetchBlockletsError)}`);return l.jsx(Qn,{error:O})}const c=a&&o.showSearch||!h.keyword;return l.jsxs(l.Fragment,{children:[c?l.jsx(Ih,{}):l.jsxs(l.Fragment,{children:[l.jsx(gi,{xs:l.jsx(oa,{}),md:null}),$()]}),N(),!m.fetchBlockletsLoading&&S&&l.jsx(te,{ref:C,sx:{height:70,minHeight:70,display:"flex",justifyContent:"center",py:2,overflow:"hidden"},children:m.loadingMore?l.jsx(Tt,{}):null})]});function N(){return m.fetchBlockletsLoading?l.jsx(sa,{mt:15}):u.length?l.jsx(te,{className:"blocklet-list",sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:`repeat(auto-fill, minmax(${n}px, 1fr))`},p:"2px",rowGap:2,columnGap:d?0:2},children:u.map(O=>l.jsx(te,{"data-blocklet-did":O.did,sx:{minWidth:{xs:"100%",sm:n},maxWidth:"calc(100vw - 32px)"},children:i({blocklet:O,blocklets:u,serverVersion:s})},O.did))}):l.jsx(Rh,{})}function $(){return l.jsxs(lt,{direction:"row",className:"search-result-title",sx:{alignItems:"center",justifyContent:"space-between",mb:2,mt:{xs:2,md:0}},children:[l.jsx(je,{variant:"h3",title:h.keyword,sx:{maxWidth:"50vw",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e("blocklet.search",{keyword:h.keyword})}),l.jsx(je,{variant:"body1",sx:{color:"text.hint",fontSize:13},children:e("blocklet.resultCount",{count:E})})]})}}function Nh(){const{t:e,selectedCategory:t,getCategoryLocale:r,locale:i,search:s}=ct(),{toggleOpen:n}=mi(),o=rl().arcSphere,a=!!window.blocklet?.navigation?.some(d=>d.section==="bottomNavigation");return l.jsxs(te,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[l.jsxs(je,{variant:"body1",sx:{display:{xs:"flex",md:"none"},alignItems:"center",gap:1,py:2,fontWeight:"fontWeightMedium"},children:[l.jsx(ia,{onClick:()=>n(!0),children:l.jsx(_a,{})}),r(t)||e("common.category")]}),o&&a&&l.jsx(aa,{locale:i,endpoint:window.blocklet?.prefix||"/",sx:{display:{md:"block",xs:"none"},mr:1,width:"350px"},t:e,filters:s.filters,handleKeyword:s.handleKeyword,handleSearchSelect:s.handleSearchSelect})]})}function Ah({menus:e=[],children:t=void 0}){const{search:r,layout:i,compact:s}=ct(),{filters:n}=r,o=q.useRef(null),a=n.category||n.keyword||n.price,d=e.find(h=>h.key===n.menu)?.key;return l.jsx(Zd,{children:l.jsxs(Xo,{FallbackComponent:Qn,children:[!s&&l.jsx(Nh,{}),l.jsxs(te,{ref:o,className:"list-container",sx:{display:"flex",height:"100%",pt:{xs:0,md:s?0:5}},children:[l.jsx(vh,{menus:e}),l.jsxs(lt,{sx:[{height:"100%",position:"relative",flex:1},s?{overflowY:"auto",ml:-2,pr:1,pb:2}:{overflow:"visible"}],children:[d&&t?.(d),!d&&(i.showExplore&&!a?l.jsx(kh,{}):l.jsx(_h,{}))]})]})]})})}function Dh(e){const{menus:t,children:r,...i}=e,s=$t(),n=$o(Il({},s,{typography:{h1:{fontSize:32,fontWeight:700,lineHeight:1.375,textAlign:"left"},h2:{fontSize:24,fontWeight:700,lineHeight:1.3333333,textAlign:"left"},h3:{fontSize:18,fontWeight:600,lineHeight:1.5,textAlign:"left"},fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:700}}));return l.jsx(Uo,{theme:n,children:l.jsx(hh,{...i,children:l.jsx(Ah,{menus:t,children:r})})})}const Mh={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm0 10a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm10 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zm0-8h6m-3-3v6"/>'},Bh={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m17 10l-2-6m-8 6l2-6m4 16H7.244a3 3 0 0 1-2.965-2.544l-1.255-7.152A2 2 0 0 1 5.001 8H19a2 2 0 0 1 1.977 2.304"/><path d="M10 14a2 2 0 1 0 4 0a2 2 0 0 0-4 0m11 1h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3H17m2 0v1m0-8v1"/></g>'},Fh={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M22 12.54c-1.804-.345-2.701-1.08-3.523-2.94c-.487.696-1.102 1.568-.92 2.4c.028.238-.32 1-.557 1H3c0 5.208 3.164 7 6.196 7c4.124.022 7.828-1.376 9.854-5c1.146-.101 2.296-1.505 2.95-2.46z"/><path d="M5 10h3v3H5zm3 0h3v3H8zm3 0h3v3h-3zM8 7h3v3H8zm3 0h3v3h-3zm0-3h3v3h-3zM4.571 18c1.5 0 2.047-.074 2.958-.78M10 16v.01"/></g>'},$h={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m7 11l5-5l5 5M7 17l5-5l5 5"/>'},Uh=(e,t)=>!t||!e?!0:Fr.satisfies(Fr.coerce(e),t);function la({children:e,serverVersion:t="",requirementVersion:r="",...i}){const{t:s}=xt();return Uh(t,r)?e:l.jsx(Fo,{title:s("store.tooltip.upgradeServer",{serverVersion:t,version:r}),arrow:!0,children:l.jsx(je,{children:l.jsx(jn,{disabled:!0,variant:"outlined",...i,children:s("common.upgradeServer")})})})}la.propTypes={children:B.node.isRequired,serverVersion:B.string,requirementVersion:B.string};const qh=(e,t)=>rn(t,`/blocklets/${e.did}`),Ro=({blocklet:e,attribute:t,value:r})=>e._formatted?e._formatted[t]:r,Wh=e=>e.inStore&&Bt.isFreeBlocklet(e)===!1;function ca({blocklet:e,blocklets:t=[],handleButtonClick:r=null,endpoint:i="",serverVersion:s=""}){const{t:n}=xt();let o=rn(i,xl(e.did,e.logo||""));try{const C=new URL(o);C.searchParams.set("v",e.version||+new Date),o=C.href}catch{}const[a,d]=q.useState(!1),h=async()=>{try{d(!0),await r({meta:e,registryUrl:i,blocklets:t})}catch(C){Yn.error(C.message)}finally{d(!1)}},{blocklet:u}=Jn(),f=()=>(u?.children||[]).find(N=>N.meta.bundleDid===e.did).meta.version,m=(()=>{const C=(u?.children||[]).find(c=>c.meta.bundleDid===e.did);if(C){try{const c=C.meta.version,N=e.version;if(Fr.gt(N,c))return"upgrade"}catch{return"install"}return"disable"}return"install"})(),S=e.requirements?.server,E=[];return m==="upgrade"?E.push({key:"upgrade",icon:l.jsx(yt,{icon:$h,color:"success.light",width:20,height:20},"version"),title:`${f()} -> ${e.version}`,align:"right",color:"success.light",maxWidth:300,text:l.jsx(te,{sx:{fontWeight:"bold"},children:n("blocklet.component.upgradeAvailable")})}):m==="disable"?E.push({key:"disable",icon:l.jsx(yt,{icon:Mh,color:"text.disabled",width:20,height:20},"disable"),align:"right",maxWidth:300,color:"text.disabled",text:n("blocklet.component.installed")}):Wh(e)&&E.push({key:"purchase",icon:l.jsx(yt,{icon:Bh,color:"primary.main",width:20,height:20},"purchase"),align:"right",maxWidth:300,color:"primary.main",text:n("blocklet.component.needBuy")}),l.jsx(zh,{title:Ro({blocklet:e,attribute:"title",value:e.title||e.name}),did:e.did,description:Ro({blocklet:e,attribute:"description",value:e.description}),cover:e.logo?o:"",version:e.version,onButtonClick:null,"data-cy":"install-blocklet",sx:m!=="disable"?{"&:hover, && *":{cursor:"pointer"}}:{"&:after, &:before":{content:'""',opacity:"0 !important"}},onMainClick:m==="disable"?void 0:h,icons:e.docker?.image?[{key:"docker",icon:l.jsx(te,{sx:{display:"flex",color:"primary.main"},children:l.jsx(yt,{icon:Fh})}),title:n("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:n("blocklet.component.isOfficial")}:void 0,download:e.stats.downloads,status:E,button:l.jsx(la,{serverVersion:s,requirementVersion:S,size:"small",children:l.jsx("div",{style:{display:"flex",alignItems:"center"},children:l.jsx(xu,{children:l.jsx(vt,{size:"small",disabled:a,variant:"outlined",color:"primary",onClick:C=>{C.preventDefault(),C.stopPropagation();const c=qh(e,i);c&&window.open(c,"_blank","noopener,noreferrer")},children:n("common.detail")},e.did)})})})})}ca.propTypes={blocklet:B.object.isRequired,blocklets:B.array,handleButtonClick:B.func,endpoint:B.string,serverVersion:B.string};function ua({handleButtonClick:e=null,handleSearchSelect:t=null,storeUrl:r,handleBlockletRender:i=null,extraFilter:s=void 0,serverVersion:n="",resourceType:o="",resourceDid:a="",showResourcesSwitch:d=!0,showCategory:h=!0,compact:u=!1,...f}){const j=$t(),{locale:m}=xt(),[S,E]=q.useState(!1),[C,c]=q.useState({}),N=w=>{c(w)},$=r,O=q.useMemo(()=>$o(j,{palette:{background:{default:j.palette.background.paper}}}),[j]);return q.useEffect(()=>{c({showResources:!0,resourceType:o,resourceDid:a})},[$,o,a]),q.useEffect(()=>{E(!0),c({showResources:!0,resourceType:o,resourceDid:a})},[]),l.jsx(Uo,{theme:O,children:l.jsx(Xo,{FallbackComponent:Qn,resetKeys:[$],children:l.jsxs(te,{...f,sx:Ho({overflow:"auto",".title-bar + div":{height:"unset"}},f.sx),children:[S&&l.jsx(Dh,{showCategory:h,showResourcesSwitch:d,blockletRender:w=>{const R={...w,handleButtonClick:e,endpoint:$};return i({...w,defaultRender:l.jsx(ca,{...R})})},compact:u,minItemWidth:300,baseSearch:!0,endpoint:$,locale:m,onFilterChange:N,onSearchSelect:t,filters:C,extraFilter:s,serverVersion:n,fetchCategoryDelay:500}),l.jsx(te,{sx:{mt:2},children:" "})]})})})}ua.propTypes={storeUrl:B.string.isRequired,handleButtonClick:B.func,handleSearchSelect:B.func,handleBlockletRender:B.func,extraFilter:B.func,serverVersion:B.string,resourceType:B.string,resourceDid:B.string,showResourcesSwitch:B.bool,showCategory:B.bool,compact:B.bool};const zh=tt(Su)`
|
|
553
|
+
`;function Ih(){const{search:e,t,endpoint:r,locale:i,getCategoryLocale:s,developerName:n,showResourcesSwitch:o,layout:a,baseSearch:d,categoryOptions:h,compact:u}=ct(),{filters:f,handleSort:j,handlePrice:m,handleDeveloper:S,handleSwitchShowResources:E,cleanFilter:C,handleCategory:c,handleSwitchIsOfficial:N}=e,$=Zs(t);return l.jsxs(lt,{className:"filter-bar",direction:{xs:"column",md:"row"},spacing:{xs:1,md:0},sx:{position:"sticky",top:0,zIndex:1e3,alignItems:{xs:"flex-start",md:"center"},justifyContent:"space-between",gap:2,pt:{xs:2,md:0},px:0,pb:u?2:3,backgroundColor:"background.default"},children:[!u&&l.jsx(je,{variant:"h2",sx:{textTransform:"capitalize"},children:s(f.category)}),l.jsxs(lt,{direction:"row",sx:{flex:1,alignItems:"center",flexWrap:{xs:"wrap",md:"nowrap"},width:"100%",justifyContent:{xs:"flex-start",md:"flex-end"},gap:2},children:[a.showSearch?l.jsx(te,{sx:{flex:1,flexBasis:{xs:"100%",md:"auto"}},children:d?l.jsx(Th,{}):l.jsx(aa,{locale:i,endpoint:r,sx:{display:{md:"block",xs:"none"},flex:1,mr:1,width:"350px"},t,filters:e.filters,handleKeyword:e.handleKeyword,handleSearchSelect:e.handleSearchSelect})}):null,f.owner&&n&&l.jsx(Ti,{label:t("blocklet.authorTag",{name:n}),size:"small",onDelete:()=>S("")}),f.resourceDid&&f.resourceBlocklet&&l.jsx(Ti,{label:t("blocklet.resourceTag",{name:f.resourceBlocklet}),size:"small",onDelete:()=>C(["resourceDid","resourceBlocklet","showResources"])}),l.jsx(Ar,{checked:f.isOfficial==="true",onChange:O=>N(O?"true":"false"),label:t("common.official")}),o?l.jsx(Ar,{checked:f.showResources!=="false",onChange:O=>E(O?"true":"false"),label:t("common.showResources")}):null,l.jsx(Ar,{checked:f.price==="free",onChange:O=>m(O?"free":""),label:t("blocklet.free")}),u&&l.jsx(te,{children:l.jsx(Qr,{value:f.category||h[0]?.value,options:h,placeholder:t("common.category"),onChange:O=>c(O)})}),l.jsx(Qr,{value:f.sortBy||$[0].value,options:$,placeholder:t("sort.sort"),onChange:O=>j(O)})]})]})}function Ar({checked:e,onChange:t,label:r}){const i=$t();return l.jsx(ei,{sx:{m:0,p:0},className:"check-button",control:l.jsx(ti,{checked:e,icon:l.jsx(Mt,{style:{padding:0,color:i.palette.text.secondary},icon:Bd}),checkedIcon:l.jsx(Mt,{style:{padding:0,color:i.palette.primary.main},icon:Fd}),size:"large",sx:{p:0,mr:1},onChange:s=>t(s.target.checked)}),label:r})}function $n({children:e}){return l.jsxs(te,{sx:{display:"flex",mt:2,flexDirection:"column",alignItems:"center",justifyContent:"center",color:"text.hint"},children:[l.jsx(nl,{}),e]})}function Io(){const{t:e}=ct();return l.jsx(je,{style:{textAlign:"center"},variant:"subtitle2",children:e("blocklet.noResults")})}function Dr({filterTip:e=!1,keywordTip:t=!1}){const{t:r,locale:i}=ct(),s=()=>i==="zh"?"、":" , ";return l.jsxs(te,{sx:{mt:1,display:"flex"},children:[l.jsx(je,{style:{marginRight:"16px"},children:r("blocklet.emptyTip")}),e&&l.jsx(je,{children:r("blocklet.filterTip")}),e&&t&&s(),t&&l.jsx(je,{children:r("blocklet.keywordTip")})]})}function Mr({primaryStart:e,primaryEnd:t,filter:r}){return l.jsxs(je,{variant:"subtitle2",sx:{display:"flex",gap:.5,mx:.5},children:[l.jsx(je,{children:e}),l.jsx(je,{title:r,color:"primary",sx:{maxWidth:"30vw",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:r}),l.jsxs(je,{children:[t," "]})]})}function Rh(){const{t:e,search:t,getCategoryLocale:r,selectedCategory:i}=ct(),{filters:s}=t,n=!!i||!!s.price;if(s.keyword&&n)return l.jsxs($n,{children:[l.jsx(Mr,{primaryStart:e("blocklet.noBlockletPart1"),primaryEnd:e("blocklet.noBlockletPart2"),filter:s.keyword}),l.jsx(Dr,{keywordTip:!0,filterTip:!0})]});if(s.keyword)return l.jsxs($n,{children:[l.jsx(Mr,{primaryStart:e("blocklet.noBlockletPart1"),primaryEnd:e("blocklet.noBlockletPart2"),filter:s.keyword}),l.jsx(Dr,{keywordTip:!0})]});if(n){const o=r(i);return l.jsxs($n,{children:[o?l.jsx(Mr,{primaryStart:e("blocklet.noCategoryResults1"),primaryEnd:e("blocklet.noCategoryResults2"),filter:o}):l.jsx(Io,{}),l.jsx(Dr,{filterTip:!0})]})}return l.jsx($n,{children:l.jsx(Io,{})})}const Ph=(e,t,r,i)=>Ql(async s=>{s||(r.currentPage=r.defaultCurrentPage);const{currentPage:n,pageSize:o}=r,a={...t,category:t.category==="All"?"":t.category,sortBy:St[t.sortBy],page:n,pageSize:o};i(null);const{data:d={}}=await e.get(St.blockletsPath,{params:a});return r.currentPage++,{page:n,pageSize:o,list:d?.dataList||[],total:d?.total||0}},{isNoMore:s=>s?s.page*s.pageSize>=s.total:!1,reloadDeps:[e,bl(t)],onError:i});function Lh(){const{storeApi:e,search:t,extraFilter:r,errors:i,updateDeveloperName:s}=ct(),{filters:n}=t,o=Jl({currentPage:St.currentPage,pageSize:ah()?St.mobilePageSize:St.pageSize,defaultCurrentPage:St.defaultCurrentPage}),[a,d]=q.useState(null),h=Ph(e,n,o,d),u=q.useMemo(()=>r?r(h.data?.list||[]):h.data?.list||[],[h.data,r]);return q.useEffect(()=>{const f=u.find(j=>j.owner.did===n.owner);s(f?.owner.fullName||f?.author.name||"")},[n.owner,u,s]),{blocklets:u,fetchBlockletsError:a,loadMore:h.loadMore,hasNextPage:!h.noMore,total:h.data?.total||0,loadings:{fetchBlockletsLoading:h.loading,loadingMore:h.loadingMore},errors:{...i,fetchBlockletsError:a}}}function _h(){const{t:e,search:t,endpoint:r,blockletRender:i,serverVersion:s,minItemWidth:n,layout:o,baseSearch:a,compact:d}=ct(),{filters:h}=t,{blocklets:u,errors:f,loadMore:j,loadings:m,hasNextPage:S,total:E}=Lh(),[C]=Md({loading:m.fetchBlockletsLoading||m.loadingMore,hasNextPage:S,onLoadMore:j});if(f.fetchBlockletsError){const O=new Error(`Failed to fetch blocklets from ${r}: ${oh(f.fetchBlockletsError)}`);return l.jsx(Qn,{error:O})}const c=a&&o.showSearch||!h.keyword;return l.jsxs(l.Fragment,{children:[c?l.jsx(Ih,{}):l.jsxs(l.Fragment,{children:[l.jsx(gi,{xs:l.jsx(oa,{}),md:null}),$()]}),N(),!m.fetchBlockletsLoading&&S&&l.jsx(te,{ref:C,sx:{height:70,minHeight:70,display:"flex",justifyContent:"center",py:2,overflow:"hidden"},children:m.loadingMore?l.jsx(Tt,{}):null})]});function N(){return m.fetchBlockletsLoading?l.jsx(sa,{mt:15}):u.length?l.jsx(te,{className:"blocklet-list",sx:{display:"grid",gridTemplateColumns:{xs:"1fr",sm:`repeat(auto-fill, minmax(${n}px, 1fr))`},p:"2px",rowGap:2,columnGap:d?0:2},children:u.map(O=>l.jsx(te,{"data-blocklet-did":O.did,sx:{minWidth:{xs:"100%",sm:n},maxWidth:"calc(100vw - 32px)"},children:i({blocklet:O,blocklets:u,serverVersion:s})},O.did))}):l.jsx(Rh,{})}function $(){return l.jsxs(lt,{direction:"row",className:"search-result-title",sx:{alignItems:"center",justifyContent:"space-between",mb:2,mt:{xs:2,md:0}},children:[l.jsx(je,{variant:"h3",title:h.keyword,sx:{maxWidth:"50vw",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e("blocklet.search",{keyword:h.keyword})}),l.jsx(je,{variant:"body1",sx:{color:"text.hint",fontSize:13},children:e("blocklet.resultCount",{count:E})})]})}}function Nh(){const{t:e,selectedCategory:t,getCategoryLocale:r,locale:i,search:s}=ct(),{toggleOpen:n}=mi(),o=tl().arcSphere,a=!!window.blocklet?.navigation?.some(d=>d.section==="bottomNavigation");return l.jsxs(te,{sx:{display:"flex",alignItems:"center",justifyContent:"space-between"},children:[l.jsxs(je,{variant:"body1",sx:{display:{xs:"flex",md:"none"},alignItems:"center",gap:1,py:2,fontWeight:"fontWeightMedium"},children:[l.jsx(ia,{onClick:()=>n(!0),children:l.jsx(_a,{})}),r(t)||e("common.category")]}),o&&a&&l.jsx(aa,{locale:i,endpoint:window.blocklet?.prefix||"/",sx:{display:{md:"block",xs:"none"},mr:1,width:"350px"},t:e,filters:s.filters,handleKeyword:s.handleKeyword,handleSearchSelect:s.handleSearchSelect})]})}function Ah({menus:e=[],children:t=void 0}){const{search:r,layout:i,compact:s}=ct(),{filters:n}=r,o=q.useRef(null),a=n.category||n.keyword||n.price,d=e.find(h=>h.key===n.menu)?.key;return l.jsx(Zd,{children:l.jsxs(Xo,{FallbackComponent:Qn,children:[!s&&l.jsx(Nh,{}),l.jsxs(te,{ref:o,className:"list-container",sx:{display:"flex",height:"100%",pt:{xs:0,md:s?0:5}},children:[l.jsx(vh,{menus:e}),l.jsxs(lt,{sx:[{height:"100%",position:"relative",flex:1},s?{overflowY:"auto",ml:-2,pr:1,pb:2}:{overflow:"visible"}],children:[d&&t?.(d),!d&&(i.showExplore&&!a?l.jsx(kh,{}):l.jsx(_h,{}))]})]})]})})}function Dh(e){const{menus:t,children:r,...i}=e,s=$t(),n=$o(Il({},s,{typography:{h1:{fontSize:32,fontWeight:700,lineHeight:1.375,textAlign:"left"},h2:{fontSize:24,fontWeight:700,lineHeight:1.3333333,textAlign:"left"},h3:{fontSize:18,fontWeight:600,lineHeight:1.5,textAlign:"left"},fontWeightLight:300,fontWeightRegular:400,fontWeightMedium:500,fontWeightBold:700}}));return l.jsx(Uo,{theme:n,children:l.jsx(hh,{...i,children:l.jsx(Ah,{menus:t,children:r})})})}const Mh={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 5a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm0 10a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1zm10 0a1 1 0 0 1 1-1h4a1 1 0 0 1 1 1v4a1 1 0 0 1-1 1h-4a1 1 0 0 1-1-1zm0-8h6m-3-3v6"/>'},Bh={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="m17 10l-2-6m-8 6l2-6m4 16H7.244a3 3 0 0 1-2.965-2.544l-1.255-7.152A2 2 0 0 1 5.001 8H19a2 2 0 0 1 1.977 2.304"/><path d="M10 14a2 2 0 1 0 4 0a2 2 0 0 0-4 0m11 1h-2.5a1.5 1.5 0 0 0 0 3h1a1.5 1.5 0 0 1 0 3H17m2 0v1m0-8v1"/></g>'},Fh={width:24,height:24,body:'<g fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2"><path d="M22 12.54c-1.804-.345-2.701-1.08-3.523-2.94c-.487.696-1.102 1.568-.92 2.4c.028.238-.32 1-.557 1H3c0 5.208 3.164 7 6.196 7c4.124.022 7.828-1.376 9.854-5c1.146-.101 2.296-1.505 2.95-2.46z"/><path d="M5 10h3v3H5zm3 0h3v3H8zm3 0h3v3h-3zM8 7h3v3H8zm3 0h3v3h-3zm0-3h3v3h-3zM4.571 18c1.5 0 2.047-.074 2.958-.78M10 16v.01"/></g>'},$h={width:24,height:24,body:'<path fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="m7 11l5-5l5 5M7 17l5-5l5 5"/>'},Uh=(e,t)=>!t||!e?!0:Fr.satisfies(Fr.coerce(e),t);function la({children:e,serverVersion:t="",requirementVersion:r="",...i}){const{t:s}=xt();return Uh(t,r)?e:l.jsx(Fo,{title:s("store.tooltip.upgradeServer",{serverVersion:t,version:r}),arrow:!0,children:l.jsx(je,{children:l.jsx(jn,{disabled:!0,variant:"outlined",...i,children:s("common.upgradeServer")})})})}la.propTypes={children:B.node.isRequired,serverVersion:B.string,requirementVersion:B.string};const qh=(e,t)=>rn(t,`/blocklets/${e.did}`),Ro=({blocklet:e,attribute:t,value:r})=>e._formatted?e._formatted[t]:r,Wh=e=>e.inStore&&Bt.isFreeBlocklet(e)===!1;function ca({blocklet:e,blocklets:t=[],handleButtonClick:r=null,endpoint:i="",serverVersion:s=""}){const{t:n}=xt();let o=rn(i,xl(e.did,e.logo||""));try{const C=new URL(o);C.searchParams.set("v",e.version||+new Date),o=C.href}catch{}const[a,d]=q.useState(!1),h=async()=>{try{d(!0),await r({meta:e,registryUrl:i,blocklets:t})}catch(C){Xn.error(C.message)}finally{d(!1)}},{blocklet:u}=Jn(),f=()=>(u?.children||[]).find(N=>N.meta.bundleDid===e.did).meta.version,m=(()=>{const C=(u?.children||[]).find(c=>c.meta.bundleDid===e.did);if(C){try{const c=C.meta.version,N=e.version;if(Fr.gt(N,c))return"upgrade"}catch{return"install"}return"disable"}return"install"})(),S=e.requirements?.server,E=[];return m==="upgrade"?E.push({key:"upgrade",icon:l.jsx(yt,{icon:$h,color:"success.light",width:20,height:20},"version"),title:`${f()} -> ${e.version}`,align:"right",color:"success.light",maxWidth:300,text:l.jsx(te,{sx:{fontWeight:"bold"},children:n("blocklet.component.upgradeAvailable")})}):m==="disable"?E.push({key:"disable",icon:l.jsx(yt,{icon:Mh,color:"text.disabled",width:20,height:20},"disable"),align:"right",maxWidth:300,color:"text.disabled",text:n("blocklet.component.installed")}):Wh(e)&&E.push({key:"purchase",icon:l.jsx(yt,{icon:Bh,color:"primary.main",width:20,height:20},"purchase"),align:"right",maxWidth:300,color:"primary.main",text:n("blocklet.component.needBuy")}),l.jsx(zh,{title:Ro({blocklet:e,attribute:"title",value:e.title||e.name}),did:e.did,description:Ro({blocklet:e,attribute:"description",value:e.description}),cover:e.logo?o:"",version:e.version,onButtonClick:null,"data-cy":"install-blocklet",sx:m!=="disable"?{"&:hover, && *":{cursor:"pointer"}}:{"&:after, &:before":{content:'""',opacity:"0 !important"}},onMainClick:m==="disable"?void 0:h,icons:e.docker?.image?[{key:"docker",icon:l.jsx(te,{sx:{display:"flex",color:"primary.main"},children:l.jsx(yt,{icon:Fh})}),title:n("blocklet.dockerImage")}]:[],official:e.isOfficial?{tooltip:n("blocklet.component.isOfficial")}:void 0,download:e.stats.downloads,status:E,button:l.jsx(la,{serverVersion:s,requirementVersion:S,size:"small",children:l.jsx("div",{style:{display:"flex",alignItems:"center"},children:l.jsx(xu,{children:l.jsx(vt,{size:"small",disabled:a,variant:"outlined",color:"primary",onClick:C=>{C.preventDefault(),C.stopPropagation();const c=qh(e,i);c&&window.open(c,"_blank","noopener,noreferrer")},children:n("common.detail")},e.did)})})})})}ca.propTypes={blocklet:B.object.isRequired,blocklets:B.array,handleButtonClick:B.func,endpoint:B.string,serverVersion:B.string};function ua({handleButtonClick:e=null,handleSearchSelect:t=null,storeUrl:r,handleBlockletRender:i=null,extraFilter:s=void 0,serverVersion:n="",resourceType:o="",resourceDid:a="",showResourcesSwitch:d=!0,showCategory:h=!0,compact:u=!1,...f}){const j=$t(),{locale:m}=xt(),[S,E]=q.useState(!1),[C,c]=q.useState({}),N=w=>{c(w)},$=r,O=q.useMemo(()=>$o(j,{palette:{background:{default:j.palette.background.paper}}}),[j]);return q.useEffect(()=>{c({showResources:!0,resourceType:o,resourceDid:a})},[$,o,a]),q.useEffect(()=>{E(!0),c({showResources:!0,resourceType:o,resourceDid:a})},[]),l.jsx(Uo,{theme:O,children:l.jsx(Xo,{FallbackComponent:Qn,resetKeys:[$],children:l.jsxs(te,{...f,sx:Ho({overflow:"auto",".title-bar + div":{height:"unset"}},f.sx),children:[S&&l.jsx(Dh,{showCategory:h,showResourcesSwitch:d,blockletRender:w=>{const R={...w,handleButtonClick:e,endpoint:$};return i({...w,defaultRender:l.jsx(ca,{...R})})},compact:u,minItemWidth:300,baseSearch:!0,endpoint:$,locale:m,onFilterChange:N,onSearchSelect:t,filters:C,extraFilter:s,serverVersion:n,fetchCategoryDelay:500}),l.jsx(te,{sx:{mt:2},children:" "})]})})})}ua.propTypes={storeUrl:B.string.isRequired,handleButtonClick:B.func,handleSearchSelect:B.func,handleBlockletRender:B.func,extraFilter:B.func,serverVersion:B.string,resourceType:B.string,resourceDid:B.string,showResourcesSwitch:B.bool,showCategory:B.bool,compact:B.bool};const zh=tt(Su)`
|
|
554
554
|
.ms-highlight {
|
|
555
555
|
color: ${e=>e.theme.palette.primary.main};
|
|
556
556
|
}
|
|
@@ -695,7 +695,7 @@ see detail in https://www.npmjs.com/package/is-var-name
|
|
|
695
695
|
& .connect {
|
|
696
696
|
background: white;
|
|
697
697
|
}
|
|
698
|
-
`,Gh=(e,t)=>(e?.children||[]).find(r=>r.mountPoint===t)?.meta,Hh=e=>e.inStore&&Bt.isFreeBlocklet(e)===!1,Xh=e=>[Xt.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,Xt.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes(e?.capabilities?.didSpace),Br=e=>e?.configs?.find(t=>t.key===Xt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)?.value||null,Yh=e=>(e.environments||[]).some(t=>t.required),Lo=(e,t)=>e?.some(r=>r.required&&!t[r.key]),Jh=({params:e,blocklet:t,t:r})=>{const i=e.title||e.name;return i?(t?.children||[]).find(n=>n.meta.bundleDid===e.bundleDid)?r("blocklet.component.upgradeNext",{name:i}):r("blocklet.component.addNext",{name:i}):r("common.next")},_o=({componentDid:e,timeout:t=1e3,manual:r=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:e,manual:r},"*")},t)},Qh=e=>e?.store?e.store:e?.url||"";function Zh({onClose:e=()=>{},mode:t="normal",stores:r=[],resourceType:i="",resourceDid:s="",storageKey:n="",inDialog:o=!0,selectedMeta:a=null,storeUrl:d="",showResourcesSwitch:h=!0,showFromUrl:u=!0,enableRunBackground:f=!0,showCategory:j=!0,installFromUrlParams:m=null}){const{t:S,locale:E}=xt(),[C,c]=q.useState(!1),[N,$]=q.useState(null),[O,w]=q.useState(""),[R,F]=q.useState(""),{api:D,ws:{useSubscription:ne},inService:Y,info:W}=dn(),{blocklet:U,actions:{refreshBlocklet:H}}=Jn(),[A,J]=q.useState(null),[M,ue]=q.useState(!1),Ie={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1,isUpload:!1,upgradeDid:""},[K,Ee]=q.useState(Ie),[ce,Me]=q.useState(0),me=q.useRef({}),Oe=q.useRef({}),Pe=q.useRef({}),nt=Yt(re=>re.breakpoints.down("md")),ut=Ja(),[ft,rt]=q.useState(!0),{meta:we}=me.current,de=os(we),ge=q.useRef(!1),Fe=q.useRef(null),$e=re=>Ee(ve=>({...ve,...re}));q.useEffect(()=>{if(K.pathPrefix){const{errMsg:re}=st({...K,pathPrefix:K.pathPrefix,locale:E});w(re)}},[K.pathPrefix]),q.useEffect(()=>{ce===0&&Ee(Ie)},[ce]);const jt=()=>{const re=Br(U)??"";$e({didSpaceEndpoint:re})},Ae=()=>me?.current?.meta?Bt.getDisplayName(me.current):"",Et=()=>{c(!1),Ee({}),ge.current=!1,me.current={},e()},Ot=re=>{const ve=Re=>{$e({installResultProps:{variant:"error",title:Ae(),subTitle:re,footer:l.jsx(vt,{className:"bottom-button",disabled:Re,"data-cy":"retry-install-component",onClick:async()=>{ve(!0),await pt(me.current.installInput)},children:l.jsxs(te,{sx:{display:"flex",alignItems:"center"},children:[Re&&l.jsx(Tt,{size:16,style:{marginRight:8}}),S("common.retry")]})})}})};ve()},Ct=re=>ve=>{(ve?.meta?.did||ve?.meta)===U?.meta?.did&&re(ve)},It=()=>{_o({timeout:0,componentDid:ut.componentDid,manual:!0}),Et(),setTimeout(()=>{const re=document.getElementsByClassName("dashboard-main")[0];re&&(re.scrollTop=re.scrollHeight)},200)};ne(Xt.BlockletEvents.componentInstalled,Ct(()=>{$e({installResultProps:{variant:"success",title:Ae(),subTitle:S("blocklet.component.installSuccessTip")}}),_o({componentDid:ut.componentDid})}),[U?.meta?.did]),ne(Xt.BlockletEvents.statusChange,Ct(()=>{const re=Br(U);$e(ve=>({...ve,didSpaceEndpoint:re}))}),[U?.meta?.did]),ne(Xt.BlockletEvents.downloadFailed,Ct(()=>{ge.current=!1,Ot(S("blocklet.component.installComponentError"))}),[U?.meta?.did]),ne(Xt.BlockletEvents.installFailed,Ct(()=>{ge.current=!1,Ot(S("blocklet.component.installComponentError"))}),[U?.meta?.did]);const Ve=[],Rt=re=>(U?.children||[]).find(ve=>ve.meta.did===re),pt=async re=>{ge.current=!0;const{pathPrefix:ve,bundleDid:Re,title:p,componentName:b="",componentDid:k=""}=K,_=me.current?.meta||{},{configs:z=[],registryUrl:ee,inStore:oe,inputUrl:Se,dist:xe}=_,Qe=me.current?.downloadTokenList,Je=Se||(oe?Ii(ee,Re,xe):"");c(!0);const Le={rootDid:U.meta.did,url:Je,mountPoint:ve?Pn.urlPathFriendly(ve):`/${Pn.urlPathFriendly(_.title||_.name)}`,title:p,name:b,did:K.isUpload&&K.upgradeDid?K.upgradeDid:k,dist:{tarball:"",integrity:""},onlyRequired:!ft,...K.hasEnvironmentsStep&&z.length>0?{configs:z.map(Be=>({...Be,value:K.configsValue[Be.key]||""}))}:{},...Qe?{downloadTokenList:Qe}:{},...re};try{if(await D.installComponent({input:Le}),ee){const{teamDid:Be,storeList:Ye}=Qo({fromBlocklet:Y,nodeInfo:W,blocklet:U}),{isNew:At,decoded:sn}=El(ee,Ye);At&&D.addBlockletStore({input:{teamDid:Be,url:sn}}).catch(Zt=>{console.error("addBlockletStore error: ",Zt)})}$e({installResultProps:{}}),H({showError:!1,attachRuntimeInfo:!1})}catch(Be){const Ye=Ur(Be);Yn.error(Ye),console.error("installComponent error: ",Be),Ot(Ye)}finally{c(!1),me.current.installInput=Le}},st=re=>{const ve=oc({params:{...re,did:re.bundleDid},blocklets:[U],blocklet:U,locale:E,isUpload:K.isUpload});let Re=ve;const p=Gh(U,K.pathPrefix);if(ve==="overwrite"&&p&&p.did!==re.bundleDid?($e({upgradeDid:p.did}),Re=""):($e({upgradeDid:""}),Re=ve),Re){const b=Rt(re.bundleDid),k=sc({params:{...re,did:re.bundleDid},blocklet:U});if(b&&b.mountPoint===k)return{errMsg:""}}return{errMsg:Re}},V=async re=>{const{errMsg:ve}=st({...K,locale:E});w(ve),ce===Ve.length-2&&!ge.current&&await pt(re),Oe.current?.setActiveStepByIndex?.(Re=>Re+1)},he=()=>{Oe.current?.setActiveStepByIndex?.(re=>re-1)},De=()=>{const{pathPrefix:re,bundleDid:ve,title:Re,componentName:p="",componentDid:b=""}=K,{meta:k={}}=me.current||{},{registryUrl:_,inStore:z,inputUrl:ee,dist:oe}=k,Se=z?Ii(_,ve,oe):ee;J({meta:k,installOpts:{type:"component",rootDid:U.meta.did,mountPoint:re,url:Se,title:Re,name:p,did:b}})},Xe=re=>{ue(!1),$e({purchaseResultProps:{variant:"error",title:Ae(),subTitle:re,style:{paddingTop:120},footer:l.jsx(vt,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{$e({purchaseResultProps:{}})},children:S("common.retry")})}})},it=({downloadTokenList:re})=>{me.current.downloadTokenList=re,ue(!1),V()},wt=({chooseParams:re=me.current,componentDid:ve,isInit:Re=!1,isUpload:p=!1})=>{const{meta:b,registryUrl:k,inStore:_,inputUrl:z}=re,{did:ee,title:oe,name:Se}=b,xe=(U.settings?.children||[]).filter(ot=>ot.status==="deleted"&&ot.meta.bundleDid===ee),Qe=ve||"",Je=b.environments?.map(ot=>{const{name:hn,validation:Pt,...qt}=ot,an={validation:Ml(Pt)?"":Pt};return{...qt,key:hn,...an}});me.current={...re,meta:{...b,configs:Je,registryUrl:k,inStore:_,inputUrl:z}};let Le={};if(Re){const ot=[U],hn=Je||[],Pt=[],qt=es(Dl([...hn,...Pt]),"key").filter(Wt=>!!Wt.key).sort((Wt,en)=>Wt.required&&!en.required?-1:en.required&&!Wt.required?1:0),an=Bt.getSharedConfigObj(ot[0],{configs:qt}),ln={},Cn=qt.map(Wt=>{const{default:en,key:tn,...zt}=Wt;return ln[tn]=an[tn]||en,{...zt,key:tn,hidden:!!Xt.BLOCKLET_CONFIGURABLE_KEY[tn]}});Le={...Le,configsList:Cn,configsValue:ln,hasMissRequiredConfigs:Lo(Cn,ln)}}const Be=U.children.some(ot=>ot.mountPoint==="/"),Ye=xe.find(ot=>ot.meta.bundleDid===ee),At=U.children.find(ot=>ot.meta.bundleDid===ee);Le.title=oe||"",Ye?Le={...Le,pathPrefix:Ye.mountPoint||"",componentName:Ye.meta.name,hasEnvironmentsStep:!1}:At?Le={...Le,pathPrefix:At.mountPoint||"",componentName:At.meta.name,hasEnvironmentsStep:!1}:Le={...Le,pathPrefix:Be?`/${Pn.urlPathFriendly(oe)||Pn.urlPathFriendly(Se)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:me.current.meta?.environments?.length>0};const sn=Hh(me.current.meta),Zt=Xh(me.current.meta),rr=Br(U);$e({bundleDid:ee,componentDid:Qe,...Le,hasRequiredEnvironments:Yh(me.current.meta),requirePurchase:sn,didSpaceIsRequiredSetup:Zt,didSpaceEndpoint:rr,isUpload:p}),Re&&sn&&De()},Ut=async()=>{if(!Fe.current.loading)try{c(!0),await Fe.current.onSubmit()&&V()}catch(re){console.error("error",re)}finally{c(!1)}};q.useEffect(()=>{if(!a&&!m?.meta||ce!==0||!U)return;const{meta:re,inputUrl:ve="",inStore:Re=!0,registryUrl:p="",isUpload:b=!1}=m||{};wt({chooseParams:{blocklets:[a||re],meta:a||re,registryUrl:p||d||Qh(a?.bundleSource),inStore:Re,inputUrl:ve},isInit:!0,isUpload:b}),$e({showFromUrlDialog:!1}),V()},[a,ce,U,m]),Ve.push({key:"selectComponent",name:S("blocklet.component.selectComponent"),body:l.jsxs(Gt,{sx:{width:400,display:"flex",flexDirection:"column"},component:"div",children:[u&&K.showFromUrlDialog&&l.jsx(ws,{mode:"component",onCancel:()=>{$e({showFromUrlDialog:!1})},onSuccess:({meta:re,inputUrl:ve,inStore:Re,registryUrl:p})=>{wt({chooseParams:{meta:re,inputUrl:ve,inStore:Re,registryUrl:p},isInit:!0}),$e({showFromUrlDialog:!1}),V()},handleText:{title:S("blocklet.component.addComponentTip.fromUrl"),confirm:S("blocklet.component.choose")}}),l.jsx(Os,{stores:r,extra:Ko.isInServerlessMode(W)?null:u?l.jsxs(vt,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{$e({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[l.jsx(Va,{style:{fontSize:20,marginRight:4}}),S("blocklet.component.addComponentTip.fromUrl")]}):null,loading:C,onChange:()=>{Ee({}),me.current={}},storageKey:n,children:({currentRegistry:re})=>l.jsx(ua,{showResourcesSwitch:h,showCategory:j,serverVersion:W?.version,compact:!0,style:{flex:1,overflow:"hidden",height:"100%"},storeUrl:re.url,resourceType:i,resourceDid:s,handleButtonClick:ve=>{wt({chooseParams:{...ve,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:ve,defaultRender:Re})=>{const p=K?.bundleDid&&K?.bundleDid===ve?.did;return l.jsxs(tf,{children:[l.jsx(te,{className:p?"choose-blocklet":"",sx:{"& > div":{position:"relative","&:before, &:after":{content:'""',position:"absolute",width:"0",height:"0",opacity:0,transition:"width 0.3s, height 0.3s, opacity 0.3s",borderRadius:"8px",pointerEvents:"none",...p?{width:"100%",height:"100%",opacity:1}:{}},"&:before":{top:0,left:0,borderTop:"1px solid",borderLeft:"1px solid",borderColor:"primary.main"},"&:after":{bottom:0,right:0,borderBottom:"1px solid",borderRight:"1px solid",borderColor:"primary.main"},"&:hover":{"&:before, &:after":{width:"100%",height:"100%",opacity:1}}}},style:{marginLeft:16},children:Re}),p&&l.jsx(te,{className:"check-container",children:l.jsx(Vo,{className:"check-icon"})})]})}})})]}),cancel:t==="embed"?void 0:S("common.cancel"),confirm:Jh({params:K,blocklet:U,t:S}),onCancel:Et,onConfirm:()=>{V()}}),Ve.push({key:"agreement",name:S("launchBlocklet.introduction"),body:l.jsxs(Gt,{component:"div",className:"agreement-wrapper",children:[l.jsx($r,{title:S("launchBlocklet.introduction"),subTitle:S("blocklet.component.addComponentTip.introduction")}),we?l.jsx(fs,{meta:we,onClickNext:V,installRelated:ft,onChangeInstallRelated:rt,handleDescEle:l.jsx("p",{children:S("blocklet.component.addComponentTip.belowInformation")})}):null]}),cancel:a?void 0:S("common.pre"),disabled:!de,confirm:S(de?"launchBlocklet.next":"launchBlocklet.canNotInstall"),onCancel:a?Et:he,onConfirm:()=>{ue(!1),V()}}),we&&K.requirePurchase&&Ve.push({key:"purchase",name:l.jsxs(l.Fragment,{children:[S("common.verifyNFT"),l.jsx(Ln,{})]}),body:l.jsxs(Gt,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(Pe.current?.getCurrentStep?.()===2||M)&&l.jsx(Un,{title:S("common.verifyNFT"),subTitle:S("blocklet.component.addComponentTip.verifyNFT")}),xn(K.purchaseResultProps)?A&&l.jsx(ks,{ref:Pe,meta:A.meta,mode:K.componentDid?"verify":"both",onCancel:Xe,installOpts:A.installOpts,handlePaySuccess:it}):l.jsx("div",{className:"flex-align-center flex-justify-center",children:l.jsx(Pi,{...K.purchaseResultProps})})]}),disabled:Pe.current?.getCurrentStep?.()===2||M,cancel:S("common.pre"),confirm:S("common.next"),onConfirm:()=>{typeof Pe.current.onNext=="function"&&(Pe.current.onNext(),ue(!0))},onCancel:()=>{he()}}),Bt.hasStartEngine(we)&&Bl.hasMountPoint(we)?Ve.push({key:"config",name:S("common.config"),error:O,body:l.jsxs(Gt,{component:"div",children:[l.jsx(Un,{title:S("common.config"),subTitle:S("blocklet.component.addComponentTip.config")}),l.jsx(Hn,{label:S("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",fullWidth:!0,helperText:R||S("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:K.pathPrefix,onChange:re=>{const ve=re.target.value;$e({pathPrefix:ve}),F(S("common.slugifyHint",{value:Sl(ve)}))},slotProps:{htmlInput:{"data-cy":"mount-point-input"}}}),!!O&&l.jsx(Bo,{severity:"error",style:{width:"100%",marginTop:8},children:O})]}),cancel:S("common.pre"),confirm:S("common.next"),onCancel:he,onConfirm:()=>{V()}}):we&&(K.pathPrefix=we.interfaces?.[0]?.path||`/${we.did}`),we&&we?.requirements?.aigne&&Ve.push({key:"aigne",name:l.jsxs(je,{component:"div",title:S("setting.aigne.config"),sx:{whiteSpace:"break-spaces"},children:[S("setting.aigne.config")," ",l.jsx(Ln,{})]}),body:()=>l.jsxs(Gt,{component:"div",className:"aigne-config-wrapper",children:[l.jsx($r,{title:S("setting.aigne.config")}),l.jsx(te,{className:"form-container",sx:{"> div":{maxWidth:"unset",width:"100%"}},children:l.jsx(ec,{orientation:"vertical",hideSubmitButton:!0,hideDivider:!0,source:"setup",forceValidate:!0,ref:Fe})})]}),cancel:S("common.pre"),confirm:S("common.next"),onCancel:()=>{Fe.current.loading||he()},onConfirm:Ut,loading:C||Fe.current?.loading,disabled:C||Fe.current?.loading}),we&&K?.hasEnvironmentsStep&&Ve.push({key:"environment",name:l.jsxs(l.Fragment,{children:[S("common.environment")," ",K.hasRequiredEnvironments&&l.jsx(Ln,{})]}),disabled:!!N||K?.hasMissRequiredConfigs,body:()=>l.jsxs(Gt,{component:"div",style:{overflowY:"auto"},children:[l.jsx(Un,{title:S("common.environment"),subTitle:S("blocklet.component.addComponentTip.environment")}),l.jsx(Ul,{style:{marginTop:-12,width:"100%"},schema:K.configsList,defaultValue:K.configsValue,onChange:(re,{action:ve,currentItem:Re,allValues:p})=>{ve==="confirm"&&$e({hasMissRequiredConfigs:Lo(K.configsList,p),configsValue:p}),ve==="edit"?$(Re):["cancel","confirm"].includes(ve)&&$(null)}})]}),cancel:S("common.pre"),confirm:S("common.next"),onCancel:he,onConfirm:V}),we&&K?.didSpaceIsRequiredSetup&&Ve.push({key:"didSpace",name:l.jsxs(l.Fragment,{children:[S("blocklet.component.didSpaceConfig")," ",K.didSpaceIsRequiredSetup==="required"&&l.jsx(Ln,{})]}),disabled:K?.didSpaceIsRequiredSetup&&!K.didSpaceEndpoint,body:()=>l.jsx($l,{children:l.jsxs(Gt,{component:"div",children:[l.jsx(Un,{title:S("blocklet.component.didSpaceConfig"),subTitle:S("blocklet.component.didSpaceConfigTip")}),l.jsx(te,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:l.jsx(js,{blockletMeta:me.current.meta,onNext:()=>{V()},onEndpointUpdate:jt})})]})}),cancel:S("common.pre"),confirm:S("common.next"),onCancel:he,onConfirm:V}),Ve.push({key:"install",name:Rt(we?.did)?S("common.upgrade"):S("common.install"),disabled:f?!1:xn(K.installResultProps),loading:f?!1:xn(K.installResultProps),body:l.jsx(Gt,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:xn(K.installResultProps)?l.jsx(ol,{message:l.jsx(nf,{children:S(f?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):l.jsx("div",{style:{marginTop:120},children:l.jsx(Pi,{...K.installResultProps})})}),confirm:S("common.complete"),onConfirm:It});const Ue=Ve[ce]||{},L=()=>C||Ue.error||!K.bundleDid?!0:ce>1?!K.pathPrefix:!1;return U?l.jsxs(ef,{sx:o?{height:{xs:"calc(100vh - 72px - 32px)",md:"72vh"},"&& .ll-header":{p:3},"&& .MuiDialogContent-root":{p:0},"&& .layout-content":{p:0,pl:{xs:0,md:2},pb:0,"& .filter-bar":{pt:0,pl:2}}}:{width:"100%",height:"100vh"},children:[l.jsx(Ol,{steps:Ve,mode:"memory",children:l.jsx(da,{ref:Oe,meta:we,isMobile:nt,onStepChange:re=>{Me(re)}})}),l.jsxs(te,{className:"action-bar",children:[Ue.cancel&&l.jsx(vt,{onClick:re=>{re.stopPropagation(),Ue.onCancel()},disabled:ce===Ve.length-2&&C,color:"inherit",children:Ue.cancel||S("common.cancel")}),Ue.confirm&&l.jsx(vt,{onClick:re=>{re.stopPropagation(),Ue.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:C||(typeof Ue.disabled=="boolean"?Ue.disabled:L()),variant:"contained",autoFocus:!0,title:Ue.confirm,style:{marginLeft:8,overflow:"hidden",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:l.jsxs(te,{sx:{display:"flex",alignItems:"center",overflow:"hidden"},children:[(typeof Ue.loading=="boolean"?Ue.loading:C)&&l.jsx(Tt,{style:{marginRight:8},size:16}),l.jsx(te,{component:"span",sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Ue.confirm})]})})]})]}):null}Zh.propTypes={onClose:B.func,mode:B.oneOf(["normal","embed"]),inDialog:B.bool,stores:B.arrayOf(B.string),storeUrl:B.string,resourceType:B.string,resourceDid:B.string,storageKey:B.string,selectedMeta:B.object,showResourcesSwitch:B.bool,showFromUrl:B.bool,enableRunBackground:B.bool,showCategory:B.bool,installFromUrlParams:B.object};const ef=tt(te)`
|
|
698
|
+
`,Gh=(e,t)=>(e?.children||[]).find(r=>r.mountPoint===t)?.meta,Hh=e=>e.inStore&&Bt.isFreeBlocklet(e)===!1,Xh=e=>[Xt.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED,Xt.BLOCKLET_APP_SPACE_REQUIREMENT.REQUIRED_ON_SETUP].includes(e?.capabilities?.didSpace),Br=e=>e?.configs?.find(t=>t.key===Xt.BLOCKLET_CONFIGURABLE_KEY.BLOCKLET_APP_SPACE_ENDPOINT)?.value||null,Yh=e=>(e.environments||[]).some(t=>t.required),Lo=(e,t)=>e?.some(r=>r.required&&!t[r.key]),Jh=({params:e,blocklet:t,t:r})=>{const i=e.title||e.name;return i?(t?.children||[]).find(n=>n.meta.bundleDid===e.bundleDid)?r("blocklet.component.upgradeNext",{name:i}):r("blocklet.component.addNext",{name:i}):r("common.next")},_o=({componentDid:e,timeout:t=1e3,manual:r=!1}={})=>{setTimeout(()=>{window.parent.postMessage({event:"component.installed",componentDid:e,manual:r},"*")},t)},Qh=e=>e?.store?e.store:e?.url||"";function Zh({onClose:e=()=>{},mode:t="normal",stores:r=[],resourceType:i="",resourceDid:s="",storageKey:n="",inDialog:o=!0,selectedMeta:a=null,storeUrl:d="",showResourcesSwitch:h=!0,showFromUrl:u=!0,enableRunBackground:f=!0,showCategory:j=!0,installFromUrlParams:m=null}){const{t:S,locale:E}=xt(),[C,c]=q.useState(!1),[N,$]=q.useState(null),[O,w]=q.useState(""),[R,F]=q.useState(""),{api:D,ws:{useSubscription:ne},inService:Y,info:W}=dn(),{blocklet:U,actions:{refreshBlocklet:H}}=Jn(),[A,J]=q.useState(null),[M,ue]=q.useState(!1),Ie={bundleDid:"",componentDid:"",componentName:"",pathPrefix:"",name:"",title:"",configsList:[],configsValue:{},hasMissRequiredConfigs:!1,hasEnvironmentsStep:!1,hasRequiredEnvironments:!1,requirePurchase:!1,didSpaceIsRequiredSetup:null,installResultProps:{},purchaseResultProps:{},showFromUrlDialog:!1,isUpload:!1,upgradeDid:""},[K,Ee]=q.useState(Ie),[ce,Me]=q.useState(0),me=q.useRef({}),Oe=q.useRef({}),Pe=q.useRef({}),nt=Yt(re=>re.breakpoints.down("md")),ut=Ja(),[ft,rt]=q.useState(!0),{meta:we}=me.current,de=os(we),ge=q.useRef(!1),Fe=q.useRef(null),$e=re=>Ee(ve=>({...ve,...re}));q.useEffect(()=>{if(K.pathPrefix){const{errMsg:re}=st({...K,pathPrefix:K.pathPrefix,locale:E});w(re)}},[K.pathPrefix]),q.useEffect(()=>{ce===0&&Ee(Ie)},[ce]);const jt=()=>{const re=Br(U)??"";$e({didSpaceEndpoint:re})},Ae=()=>me?.current?.meta?Bt.getDisplayName(me.current):"",Et=()=>{c(!1),Ee({}),ge.current=!1,me.current={},e()},Ot=re=>{const ve=Re=>{$e({installResultProps:{variant:"error",title:Ae(),subTitle:re,footer:l.jsx(vt,{className:"bottom-button",disabled:Re,"data-cy":"retry-install-component",onClick:async()=>{ve(!0),await pt(me.current.installInput)},children:l.jsxs(te,{sx:{display:"flex",alignItems:"center"},children:[Re&&l.jsx(Tt,{size:16,style:{marginRight:8}}),S("common.retry")]})})}})};ve()},Ct=re=>ve=>{(ve?.meta?.did||ve?.meta)===U?.meta?.did&&re(ve)},It=()=>{_o({timeout:0,componentDid:ut.componentDid,manual:!0}),Et(),setTimeout(()=>{const re=document.getElementsByClassName("dashboard-main")[0];re&&(re.scrollTop=re.scrollHeight)},200)};ne(Xt.BlockletEvents.componentInstalled,Ct(()=>{$e({installResultProps:{variant:"success",title:Ae(),subTitle:S("blocklet.component.installSuccessTip")}}),_o({componentDid:ut.componentDid})}),[U?.meta?.did]),ne(Xt.BlockletEvents.statusChange,Ct(()=>{const re=Br(U);$e(ve=>({...ve,didSpaceEndpoint:re}))}),[U?.meta?.did]),ne(Xt.BlockletEvents.downloadFailed,Ct(()=>{ge.current=!1,Ot(S("blocklet.component.installComponentError"))}),[U?.meta?.did]),ne(Xt.BlockletEvents.installFailed,Ct(()=>{ge.current=!1,Ot(S("blocklet.component.installComponentError"))}),[U?.meta?.did]);const Ve=[],Rt=re=>(U?.children||[]).find(ve=>ve.meta.did===re),pt=async re=>{ge.current=!0;const{pathPrefix:ve,bundleDid:Re,title:p,componentName:b="",componentDid:k=""}=K,_=me.current?.meta||{},{configs:z=[],registryUrl:ee,inStore:oe,inputUrl:Se,dist:xe}=_,Qe=me.current?.downloadTokenList,Je=Se||(oe?Ii(ee,Re,xe):"");c(!0);const Le={rootDid:U.meta.did,url:Je,mountPoint:ve?Pn.urlPathFriendly(ve):`/${Pn.urlPathFriendly(_.title||_.name)}`,title:p,name:b,did:K.isUpload&&K.upgradeDid?K.upgradeDid:k,dist:{tarball:"",integrity:""},onlyRequired:!ft,...K.hasEnvironmentsStep&&z.length>0?{configs:z.map(Be=>({...Be,value:K.configsValue[Be.key]||""}))}:{},...Qe?{downloadTokenList:Qe}:{},...re};try{if(await D.installComponent({input:Le}),ee){const{teamDid:Be,storeList:Ye}=Qo({fromBlocklet:Y,nodeInfo:W,blocklet:U}),{isNew:At,decoded:sn}=El(ee,Ye);At&&D.addBlockletStore({input:{teamDid:Be,url:sn}}).catch(Zt=>{console.error("addBlockletStore error: ",Zt)})}$e({installResultProps:{}}),H({showError:!1,attachRuntimeInfo:!1})}catch(Be){const Ye=Ur(Be);Xn.error(Ye),console.error("installComponent error: ",Be),Ot(Ye)}finally{c(!1),me.current.installInput=Le}},st=re=>{const ve=oc({params:{...re,did:re.bundleDid},blocklets:[U],blocklet:U,locale:E,isUpload:K.isUpload});let Re=ve;const p=Gh(U,K.pathPrefix);if(ve==="overwrite"&&p&&p.did!==re.bundleDid?($e({upgradeDid:p.did}),Re=""):($e({upgradeDid:""}),Re=ve),Re){const b=Rt(re.bundleDid),k=sc({params:{...re,did:re.bundleDid},blocklet:U});if(b&&b.mountPoint===k)return{errMsg:""}}return{errMsg:Re}},V=async re=>{const{errMsg:ve}=st({...K,locale:E});w(ve),ce===Ve.length-2&&!ge.current&&await pt(re),Oe.current?.setActiveStepByIndex?.(Re=>Re+1)},he=()=>{Oe.current?.setActiveStepByIndex?.(re=>re-1)},De=()=>{const{pathPrefix:re,bundleDid:ve,title:Re,componentName:p="",componentDid:b=""}=K,{meta:k={}}=me.current||{},{registryUrl:_,inStore:z,inputUrl:ee,dist:oe}=k,Se=z?Ii(_,ve,oe):ee;J({meta:k,installOpts:{type:"component",rootDid:U.meta.did,mountPoint:re,url:Se,title:Re,name:p,did:b}})},Xe=re=>{ue(!1),$e({purchaseResultProps:{variant:"error",title:Ae(),subTitle:re,style:{paddingTop:120},footer:l.jsx(vt,{className:"bottom-button","data-cy":"retry-purchase-component",onClick:()=>{$e({purchaseResultProps:{}})},children:S("common.retry")})}})},it=({downloadTokenList:re})=>{me.current.downloadTokenList=re,ue(!1),V()},wt=({chooseParams:re=me.current,componentDid:ve,isInit:Re=!1,isUpload:p=!1})=>{const{meta:b,registryUrl:k,inStore:_,inputUrl:z}=re,{did:ee,title:oe,name:Se}=b,xe=(U.settings?.children||[]).filter(ot=>ot.status==="deleted"&&ot.meta.bundleDid===ee),Qe=ve||"",Je=b.environments?.map(ot=>{const{name:hn,validation:Pt,...qt}=ot,an={validation:Ml(Pt)?"":Pt};return{...qt,key:hn,...an}});me.current={...re,meta:{...b,configs:Je,registryUrl:k,inStore:_,inputUrl:z}};let Le={};if(Re){const ot=[U],hn=Je||[],Pt=[],qt=es(Dl([...hn,...Pt]),"key").filter(Wt=>!!Wt.key).sort((Wt,en)=>Wt.required&&!en.required?-1:en.required&&!Wt.required?1:0),an=Bt.getSharedConfigObj(ot[0],{configs:qt}),ln={},Cn=qt.map(Wt=>{const{default:en,key:tn,...zt}=Wt;return ln[tn]=an[tn]||en,{...zt,key:tn,hidden:!!Xt.BLOCKLET_CONFIGURABLE_KEY[tn]}});Le={...Le,configsList:Cn,configsValue:ln,hasMissRequiredConfigs:Lo(Cn,ln)}}const Be=U.children.some(ot=>ot.mountPoint==="/"),Ye=xe.find(ot=>ot.meta.bundleDid===ee),At=U.children.find(ot=>ot.meta.bundleDid===ee);Le.title=oe||"",Ye?Le={...Le,pathPrefix:Ye.mountPoint||"",componentName:Ye.meta.name,hasEnvironmentsStep:!1}:At?Le={...Le,pathPrefix:At.mountPoint||"",componentName:At.meta.name,hasEnvironmentsStep:!1}:Le={...Le,pathPrefix:Be?`/${Pn.urlPathFriendly(oe)||Pn.urlPathFriendly(Se)}`.toLowerCase():"/",componentName:"",hasEnvironmentsStep:me.current.meta?.environments?.length>0};const sn=Hh(me.current.meta),Zt=Xh(me.current.meta),rr=Br(U);$e({bundleDid:ee,componentDid:Qe,...Le,hasRequiredEnvironments:Yh(me.current.meta),requirePurchase:sn,didSpaceIsRequiredSetup:Zt,didSpaceEndpoint:rr,isUpload:p}),Re&&sn&&De()},Ut=async()=>{if(!Fe.current.loading)try{c(!0),await Fe.current.onSubmit()&&V()}catch(re){console.error("error",re)}finally{c(!1)}};q.useEffect(()=>{if(!a&&!m?.meta||ce!==0||!U)return;const{meta:re,inputUrl:ve="",inStore:Re=!0,registryUrl:p="",isUpload:b=!1}=m||{};wt({chooseParams:{blocklets:[a||re],meta:a||re,registryUrl:p||d||Qh(a?.bundleSource),inStore:Re,inputUrl:ve},isInit:!0,isUpload:b}),$e({showFromUrlDialog:!1}),V()},[a,ce,U,m]),Ve.push({key:"selectComponent",name:S("blocklet.component.selectComponent"),body:l.jsxs(Gt,{sx:{width:400,display:"flex",flexDirection:"column"},component:"div",children:[u&&K.showFromUrlDialog&&l.jsx(ws,{mode:"component",onCancel:()=>{$e({showFromUrlDialog:!1})},onSuccess:({meta:re,inputUrl:ve,inStore:Re,registryUrl:p})=>{wt({chooseParams:{meta:re,inputUrl:ve,inStore:Re,registryUrl:p},isInit:!0}),$e({showFromUrlDialog:!1}),V()},handleText:{title:S("blocklet.component.addComponentTip.fromUrl"),confirm:S("blocklet.component.choose")}}),l.jsx(Os,{stores:r,extra:Ko.isInServerlessMode(W)?null:u?l.jsxs(vt,{variant:"text",color:"primary","data-cy":"add-component-from-url",onClick:()=>{$e({showFromUrlDialog:!0})},style:{padding:"0 2px"},children:[l.jsx(Va,{style:{fontSize:20,marginRight:4}}),S("blocklet.component.addComponentTip.fromUrl")]}):null,loading:C,onChange:()=>{Ee({}),me.current={}},storageKey:n,children:({currentRegistry:re})=>l.jsx(ua,{showResourcesSwitch:h,showCategory:j,serverVersion:W?.version,compact:!0,style:{flex:1,overflow:"hidden",height:"100%"},storeUrl:re.url,resourceType:i,resourceDid:s,handleButtonClick:ve=>{wt({chooseParams:{...ve,inStore:!0},isInit:!0})},handleBlockletRender:({blocklet:ve,defaultRender:Re})=>{const p=K?.bundleDid&&K?.bundleDid===ve?.did;return l.jsxs(tf,{children:[l.jsx(te,{className:p?"choose-blocklet":"",sx:{"& > div":{position:"relative","&:before, &:after":{content:'""',position:"absolute",width:"0",height:"0",opacity:0,transition:"width 0.3s, height 0.3s, opacity 0.3s",borderRadius:"8px",pointerEvents:"none",...p?{width:"100%",height:"100%",opacity:1}:{}},"&:before":{top:0,left:0,borderTop:"1px solid",borderLeft:"1px solid",borderColor:"primary.main"},"&:after":{bottom:0,right:0,borderBottom:"1px solid",borderRight:"1px solid",borderColor:"primary.main"},"&:hover":{"&:before, &:after":{width:"100%",height:"100%",opacity:1}}}},style:{marginLeft:16},children:Re}),p&&l.jsx(te,{className:"check-container",children:l.jsx(Vo,{className:"check-icon"})})]})}})})]}),cancel:t==="embed"?void 0:S("common.cancel"),confirm:Jh({params:K,blocklet:U,t:S}),onCancel:Et,onConfirm:()=>{V()}}),Ve.push({key:"agreement",name:S("launchBlocklet.introduction"),body:l.jsxs(Gt,{component:"div",className:"agreement-wrapper",children:[l.jsx($r,{title:S("launchBlocklet.introduction"),subTitle:S("blocklet.component.addComponentTip.introduction")}),we?l.jsx(fs,{meta:we,onClickNext:V,installRelated:ft,onChangeInstallRelated:rt,handleDescEle:l.jsx("p",{children:S("blocklet.component.addComponentTip.belowInformation")})}):null]}),cancel:a?void 0:S("common.pre"),disabled:!de,confirm:S(de?"launchBlocklet.next":"launchBlocklet.canNotInstall"),onCancel:a?Et:he,onConfirm:()=>{ue(!1),V()}}),we&&K.requirePurchase&&Ve.push({key:"purchase",name:l.jsxs(l.Fragment,{children:[S("common.verifyNFT"),l.jsx(Ln,{})]}),body:l.jsxs(Gt,{component:"div",className:"flex-align-center",style:{flexDirection:"column"},children:[!(Pe.current?.getCurrentStep?.()===2||M)&&l.jsx(Un,{title:S("common.verifyNFT"),subTitle:S("blocklet.component.addComponentTip.verifyNFT")}),xn(K.purchaseResultProps)?A&&l.jsx(ks,{ref:Pe,meta:A.meta,mode:K.componentDid?"verify":"both",onCancel:Xe,installOpts:A.installOpts,handlePaySuccess:it}):l.jsx("div",{className:"flex-align-center flex-justify-center",children:l.jsx(Pi,{...K.purchaseResultProps})})]}),disabled:Pe.current?.getCurrentStep?.()===2||M,cancel:S("common.pre"),confirm:S("common.next"),onConfirm:()=>{typeof Pe.current.onNext=="function"&&(Pe.current.onNext(),ue(!0))},onCancel:()=>{he()}}),Bt.hasStartEngine(we)&&Bl.hasMountPoint(we)?Ve.push({key:"config",name:S("common.config"),error:O,body:l.jsxs(Gt,{component:"div",children:[l.jsx(Un,{title:S("common.config"),subTitle:S("blocklet.component.addComponentTip.config")}),l.jsx(Hn,{label:S("blocklet.component.mountPoint"),autoComplete:"off",variant:"outlined",name:"pathPrefix",fullWidth:!0,helperText:R||S("blocklet.component.mountPointTip"),style:{marginBottom:32},margin:"normal",value:K.pathPrefix,onChange:re=>{const ve=re.target.value;$e({pathPrefix:ve}),F(S("common.slugifyHint",{value:Sl(ve)}))},slotProps:{htmlInput:{"data-cy":"mount-point-input"}}}),!!O&&l.jsx(Bo,{severity:"error",style:{width:"100%",marginTop:8},children:O})]}),cancel:S("common.pre"),confirm:S("common.next"),onCancel:he,onConfirm:()=>{V()}}):we&&(K.pathPrefix=we.interfaces?.[0]?.path||`/${we.did}`),we&&we?.requirements?.aigne&&Ve.push({key:"aigne",name:l.jsxs(je,{component:"div",title:S("setting.aigne.config"),sx:{whiteSpace:"break-spaces"},children:[S("setting.aigne.config")," ",l.jsx(Ln,{})]}),body:()=>l.jsxs(Gt,{component:"div",className:"aigne-config-wrapper",children:[l.jsx($r,{title:S("setting.aigne.config")}),l.jsx(te,{className:"form-container",sx:{"> div":{maxWidth:"unset",width:"100%"}},children:l.jsx(ec,{orientation:"vertical",hideSubmitButton:!0,hideDivider:!0,source:"setup",forceValidate:!0,ref:Fe})})]}),cancel:S("common.pre"),confirm:S("common.next"),onCancel:()=>{Fe.current.loading||he()},onConfirm:Ut,loading:C||Fe.current?.loading,disabled:C||Fe.current?.loading}),we&&K?.hasEnvironmentsStep&&Ve.push({key:"environment",name:l.jsxs(l.Fragment,{children:[S("common.environment")," ",K.hasRequiredEnvironments&&l.jsx(Ln,{})]}),disabled:!!N||K?.hasMissRequiredConfigs,body:()=>l.jsxs(Gt,{component:"div",style:{overflowY:"auto"},children:[l.jsx(Un,{title:S("common.environment"),subTitle:S("blocklet.component.addComponentTip.environment")}),l.jsx(Ul,{style:{marginTop:-12,width:"100%"},schema:K.configsList,defaultValue:K.configsValue,onChange:(re,{action:ve,currentItem:Re,allValues:p})=>{ve==="confirm"&&$e({hasMissRequiredConfigs:Lo(K.configsList,p),configsValue:p}),ve==="edit"?$(Re):["cancel","confirm"].includes(ve)&&$(null)}})]}),cancel:S("common.pre"),confirm:S("common.next"),onCancel:he,onConfirm:V}),we&&K?.didSpaceIsRequiredSetup&&Ve.push({key:"didSpace",name:l.jsxs(l.Fragment,{children:[S("blocklet.component.didSpaceConfig")," ",K.didSpaceIsRequiredSetup==="required"&&l.jsx(Ln,{})]}),disabled:K?.didSpaceIsRequiredSetup&&!K.didSpaceEndpoint,body:()=>l.jsx($l,{children:l.jsxs(Gt,{component:"div",children:[l.jsx(Un,{title:S("blocklet.component.didSpaceConfig"),subTitle:S("blocklet.component.didSpaceConfigTip")}),l.jsx(te,{sx:{mt:"36px","& > div":{maxWidth:"unset !important","& .MuiAutocomplete-root":{maxWidth:"unset !important"}}},children:l.jsx(js,{blockletMeta:me.current.meta,onNext:()=>{V()},onEndpointUpdate:jt})})]})}),cancel:S("common.pre"),confirm:S("common.next"),onCancel:he,onConfirm:V}),Ve.push({key:"install",name:Rt(we?.did)?S("common.upgrade"):S("common.install"),disabled:f?!1:xn(K.installResultProps),loading:f?!1:xn(K.installResultProps),body:l.jsx(Gt,{component:"div",className:"flex-justify-center flex-align-center",style:{flexDirection:"column"},children:xn(K.installResultProps)?l.jsx(rl,{message:l.jsx(nf,{children:S(f?"blocklet.component.installingCanCloseWindowTip":"blocklet.component.installingTip")}),increaseSpeed:.3,messageLoop:!1}):l.jsx("div",{style:{marginTop:120},children:l.jsx(Pi,{...K.installResultProps})})}),confirm:S("common.complete"),onConfirm:It});const Ue=Ve[ce]||{},L=()=>C||Ue.error||!K.bundleDid?!0:ce>1?!K.pathPrefix:!1;return U?l.jsxs(ef,{sx:o?{height:{xs:"calc(100vh - 72px - 32px)",md:"72vh"},"&& .ll-header":{p:3},"&& .MuiDialogContent-root":{p:0},"&& .layout-content":{p:0,pl:{xs:0,md:2},pb:0,"& .filter-bar":{pt:0,pl:2}}}:{width:"100%",height:"100vh"},children:[l.jsx(Ol,{steps:Ve,mode:"memory",children:l.jsx(da,{ref:Oe,meta:we,isMobile:nt,onStepChange:re=>{Me(re)}})}),l.jsxs(te,{className:"action-bar",children:[Ue.cancel&&l.jsx(vt,{onClick:re=>{re.stopPropagation(),Ue.onCancel()},disabled:ce===Ve.length-2&&C,color:"inherit",children:Ue.cancel||S("common.cancel")}),Ue.confirm&&l.jsx(vt,{onClick:re=>{re.stopPropagation(),Ue.onConfirm()},color:"primary","data-cy":"submit-confirm-next",disabled:C||(typeof Ue.disabled=="boolean"?Ue.disabled:L()),variant:"contained",autoFocus:!0,title:Ue.confirm,style:{marginLeft:8,overflow:"hidden",minWidth:"140px",maxWidth:"280px",textAlign:"center"},children:l.jsxs(te,{sx:{display:"flex",alignItems:"center",overflow:"hidden"},children:[(typeof Ue.loading=="boolean"?Ue.loading:C)&&l.jsx(Tt,{style:{marginRight:8},size:16}),l.jsx(te,{component:"span",sx:{flex:1,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:Ue.confirm})]})})]})]}):null}Zh.propTypes={onClose:B.func,mode:B.oneOf(["normal","embed"]),inDialog:B.bool,stores:B.arrayOf(B.string),storeUrl:B.string,resourceType:B.string,resourceDid:B.string,storageKey:B.string,selectedMeta:B.object,showResourcesSwitch:B.bool,showFromUrl:B.bool,enableRunBackground:B.bool,showCategory:B.bool,installFromUrlParams:B.object};const ef=tt(te)`
|
|
699
699
|
.action-bar {
|
|
700
700
|
display: flex;
|
|
701
701
|
justify-content: flex-end;
|