ghost 6.68.0 → 6.69.0
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/components/ghost-storage-base-3.0.1.tgz +0 -0
- package/components/tryghost-adapter-base-cache-0.2.1.tgz +0 -0
- package/components/tryghost-adapter-base-scheduling-0.2.5.tgz +0 -0
- package/components/tryghost-adapter-base-sso-0.1.4.tgz +0 -0
- package/components/tryghost-app-contracts-0.0.0.tgz +0 -0
- package/components/tryghost-checkout-0.0.0.tgz +0 -0
- package/components/tryghost-i18n-0.0.0.tgz +0 -0
- package/components/tryghost-kg-card-factory-5.2.6.tgz +0 -0
- package/components/tryghost-kg-clean-basic-html-4.3.6.tgz +0 -0
- package/components/tryghost-kg-converters-1.2.6.tgz +0 -0
- package/components/tryghost-kg-default-cards-10.3.7.tgz +0 -0
- package/components/tryghost-kg-default-nodes-2.2.3.tgz +0 -0
- package/components/tryghost-kg-default-transforms-1.3.6.tgz +0 -0
- package/components/tryghost-kg-html-to-lexical-1.4.1.tgz +0 -0
- package/components/tryghost-kg-lexical-html-renderer-1.5.1.tgz +0 -0
- package/components/tryghost-kg-markdown-html-renderer-7.2.7.tgz +0 -0
- package/components/tryghost-kg-utils-1.1.6.tgz +0 -0
- package/components/tryghost-metafield-csv-0.0.0.tgz +0 -0
- package/components/tryghost-metafield-types-0.1.1.tgz +0 -0
- package/core/boot.js +6 -0
- package/core/built/admin/assets/{about-D_nwtf7X.js → about-Dxp30cNg.js} +1 -1
- package/core/built/admin/assets/{account-migration-BaecWw1T.js → account-migration-D05akW4q.js} +1 -1
- package/core/built/admin/assets/activitypub/{account-migration-4saTEZ6p.js → account-migration-BmiwuzXI.js} +6 -6
- package/core/built/admin/assets/activitypub/activitypub.js +2 -2
- package/core/built/admin/assets/activitypub/{bluesky-sharing-BHBNuZQH.js → bluesky-sharing-B1fzMdFb.js} +6 -6
- package/core/built/admin/assets/activitypub/{content-formatters-DVx9YktY.js → content-formatters-G0qBT5QE.js} +3 -3
- package/core/built/admin/assets/activitypub/{domain-rAmlMXBC.js → domain-B3UtdA1m.js} +7 -7
- package/core/built/admin/assets/activitypub/{edit-profile-CXYL4ZrS.js → edit-profile-9EodzviR.js} +4 -4
- package/core/built/admin/assets/activitypub/{explore-dqpEx3GA.js → explore-DmwPdxHI.js} +8 -8
- package/core/built/admin/assets/activitypub/{feed-Cb-wYNw9.js → feed-yauqnu7A.js} +5 -5
- package/core/built/admin/assets/activitypub/{field-JxegcPt6.js → field-CsrMjbg2.js} +2 -2
- package/core/built/admin/assets/activitypub/{inbox-2hXDJBn5.js → inbox-DV3RrpFH.js} +7 -7
- package/core/built/admin/assets/activitypub/{label-DRQzZ7lb.js → label-DPs40NLn.js} +2 -2
- package/core/built/admin/assets/activitypub/layout-CvOhndCA.js +1 -0
- package/core/built/admin/assets/activitypub/{moderation-BnYKcTXY.js → moderation-DGa6hVNH.js} +7 -7
- package/core/built/admin/assets/activitypub/{note-C6ucS3Wu.js → note-BVL6LVHF.js} +5 -5
- package/core/built/admin/assets/activitypub/{notifications-DgBW9wEC.js → notifications-CRUu_uMC.js} +5 -5
- package/core/built/admin/assets/activitypub/{onboarding-DGu6yG4L.js → onboarding-Dpm-nLkQ.js} +2 -2
- package/core/built/admin/assets/activitypub/{onboarding-Bq3fNf_a.js → onboarding-KtpJA-xb.js} +2 -2
- package/core/built/admin/assets/activitypub/{preferences-C3jI1eVN.js → preferences-CdFuVqIt.js} +7 -7
- package/core/built/admin/assets/activitypub/{profile-Cn3vRb5Z.js → profile-KnNAoHYu.js} +8 -8
- package/core/built/admin/assets/activitypub/{routes-DbrwlS9h.js → routes-BRndai50.js} +26 -26
- package/core/built/admin/assets/activitypub/{settings-D0BALDQu.js → settings-DU7ftJ8w.js} +4 -4
- package/core/built/admin/assets/activitypub/{site-BFGj8HuQ.js → site-D1ZYV3AT.js} +2 -2
- package/core/built/admin/assets/activitypub/{step-1-CaoPg0a5.js → step-1-9IHheE78.js} +4 -4
- package/core/built/admin/assets/activitypub/{step-3-5k0TkyC9.js → step-3-DBERnfa-.js} +3 -3
- package/core/built/admin/assets/activitypub/{tabs-BV4JU7Vg.js → tabs-CvkwStij.js} +4 -4
- package/core/built/admin/assets/activitypub/{topic-filter-71sX5nfN.js → topic-filter-CS0Jsf_4.js} +2 -2
- package/core/built/admin/assets/activitypub/{use-activity-pub-queries-B3srUuKt.js → use-activity-pub-queries-CGgtQrxL.js} +2 -2
- package/core/built/admin/assets/activitypub/{use-reply-chain-data-Cl6bGNy7.js → use-reply-chain-data-CLdUpx1t.js} +4 -4
- package/core/built/admin/assets/activitypub/{users-EcSPpds5.js → users-CyoMXlwX.js} +11 -3
- package/core/built/admin/assets/{add-integration-modal-DBFzeAUT.js → add-integration-modal-BVg-ec8i.js} +1 -1
- package/core/built/admin/assets/{add-newsletter-modal-CYJe-dTC.js → add-newsletter-modal-Du6th521.js} +1 -1
- package/core/built/admin/assets/{add-recommendation-modal-CgwGKH-_.js → add-recommendation-modal-BiCJ0-q5.js} +1 -1
- package/core/built/admin/assets/{analytics-CcXT_WqF.js → analytics-CQJzDDdJ.js} +1 -1
- package/core/built/admin/assets/{announcement-bar-modal-Ldcg-PB-.js → announcement-bar-modal-CskyZLzT.js} +1 -1
- package/core/built/admin/assets/{api-BLteQZ7W.js → api-BFocMbDg.js} +2 -2
- package/core/built/admin/assets/{api-keys-CoeerpwI.js → api-keys-CqKJHuAV.js} +1 -1
- package/core/built/admin/assets/{audience-Deg9lzfk.js → audience-Dn7LuH-r.js} +1 -1
- package/core/built/admin/assets/{auth-layout-CRaMX7g6.js → auth-layout-VLhXgXn5.js} +1 -1
- package/core/built/admin/assets/{automated-emails-WcjjRkRV.js → automated-emails-D5cFl1wr.js} +1 -1
- package/core/built/admin/assets/{automations-CbIdX0rd.js → automations-BpweKEcq.js} +1 -1
- package/core/built/admin/assets/automations-DBTYwNTJ.js +1 -0
- package/core/built/admin/assets/{bluesky-sharing-BJMNRwnU.js → bluesky-sharing-CrfpFHQ9.js} +1 -1
- package/core/built/admin/assets/{chart-helpers-D-3N170i.js → chart-helpers-BSuFLd6-.js} +1 -1
- package/core/built/admin/assets/{chunk.524.94ab17e1199b4c3f4615.js → chunk.524.e24d68bc6253b274b726.js} +4 -4
- package/core/built/admin/assets/{chunk.582.6f09b19a007e2805824e.js → chunk.582.47834285406dfa1abb29.js} +6 -6
- package/core/built/admin/assets/{chunk.476.53b5794a67d68111e0bf.js → chunk.837.e1454abc054e1fba1fe5.js} +5 -5
- package/core/built/admin/assets/{code-editor-view-DhTwpxxv.js → code-editor-view-BrGe3eS4.js} +1 -1
- package/core/built/admin/assets/{code-editor-view-C7wXGiuv.js → code-editor-view-CY6JCXNv.js} +1 -1
- package/core/built/admin/assets/{color-picker-field-Cjz2zY11.js → color-picker-field-DGe9HH6W.js} +1 -1
- package/core/built/admin/assets/{comments-DY-VLVxh.js → comments-iRbF6XiJ.js} +1 -1
- package/core/built/admin/assets/{config-B3HuCo0y.js → config-CRAZ4Civ.js} +1 -1
- package/core/built/admin/assets/{content-api-modal-2jt-jWiM.js → content-api-modal-B-XRbzeW.js} +1 -1
- package/core/built/admin/assets/{content-formatters-VqvNA7Pv.js → content-formatters-C08JJbUJ.js} +2 -2
- package/core/built/admin/assets/{context-menu-BWbk9nd5.js → context-menu-BxGXsgQO.js} +1 -1
- package/core/built/admin/assets/{custom-field-type-option-CIatEwIN.js → custom-field-type-option-C8Nt4X6x.js} +1 -1
- package/core/built/admin/assets/{custom-integration-modal-Cw0w2Tb3.js → custom-integration-modal-DzI16qjN.js} +1 -1
- package/core/built/admin/assets/{date-range-select-O-uA-BRV.js → date-range-select-BZqsYsGx.js} +1 -1
- package/core/built/admin/assets/{design-and-theme-modal-BLjNHRYN.js → design-and-theme-modal-1ty_KEkM.js} +2 -2
- package/core/built/admin/assets/{dist-DJhCsld6.js → dist-B4jqKAG5.js} +1 -1
- package/core/built/admin/assets/{dist-5Ol0DC_t.js → dist-Bmo2j_KH.js} +1 -1
- package/core/built/admin/assets/{dist-p52UDdoR.js → dist-C-_aTlvJ.js} +1 -1
- package/core/built/admin/assets/{dist-CcN1a5SB.js → dist-CWHIoxYn.js} +1 -1
- package/core/built/admin/assets/{dist-BcfsaiCV.js → dist-Cp2M5TzT.js} +1 -1
- package/core/built/admin/assets/{dist-kjTYGivb.js → dist-DQAAPbtg.js} +1 -1
- package/core/built/admin/assets/{dist-IMek6Acg.js → dist-DyO279y5.js} +1 -1
- package/core/built/admin/assets/{domain-DaPAeOFF.js → domain-DiFl_Z1A.js} +1 -1
- package/core/built/admin/assets/{edit-profile-BKO5qonH.js → edit-profile-PrLbJV3P.js} +1 -1
- package/core/built/admin/assets/editor-BBJDJL8U.js +8 -0
- package/core/built/admin/assets/{editor-screen-l4BUPE2o.js → editor-screen-nblrp808.js} +3 -3
- package/core/built/admin/assets/{email-previews-B1Ska3CF.js → email-previews-BKJxrW29.js} +1 -1
- package/core/built/admin/assets/{email-sending-status-provider-Bjn5KTy2.js → email-sending-status-provider-DB9ylBWk.js} +1 -1
- package/core/built/admin/assets/{emails-qxNbhO6X.js → emails-8YiSmC2X.js} +1 -1
- package/core/built/admin/assets/{embed-signup-form-modal-DSgds6Js.js → embed-signup-form-modal-CZmbYKfd.js} +1 -1
- package/core/built/admin/assets/{error-boundary-CJODV8Rg.js → error-boundary-DrxPFFO-.js} +1 -1
- package/core/built/admin/assets/{esm-CNLDtBMc.js → esm-_iCUCvbN.js} +1 -1
- package/core/built/admin/assets/{explore-C6V_JpUZ.js → explore-C69LSRVg.js} +1 -1
- package/core/built/admin/assets/{feed-B_TyFn9E.js → feed-B_0m7WhZ.js} +1 -1
- package/core/built/admin/assets/{feedback-gKOzmiGt.js → feedback-DW1DXdzT.js} +1 -1
- package/core/built/admin/assets/{filters-Bf6E1qAP.js → filters-Dr3vMnjZ.js} +1 -1
- package/core/built/admin/assets/{filters-DhsiEotO.js → filters-M2sRWPoF.js} +1 -1
- package/core/built/admin/assets/{first-promoter-modal-LmTXHr-z.js → first-promoter-modal-D43R2zhI.js} +1 -1
- package/core/built/admin/assets/{focus-koenig-editor-on-bottom-click-BAcLNJti.js → focus-koenig-editor-on-bottom-click-BzS8jiJf.js} +1 -1
- package/core/built/admin/assets/fullscreen-close-button-CWSp-MsK.js +1 -0
- package/core/built/admin/assets/{ghost-63bc7da4336844000c523a5a0819531e.js → ghost-ffde29676517b768b1aef5ec8d492418.js} +93 -96
- package/core/built/admin/assets/{gift-link-modal-uZtwRHzl.js → gift-link-modal-CNE7dfPD.js} +1 -1
- package/core/built/admin/assets/{gift-links-HVqaXear.js → gift-links-lQ7H_D8Z.js} +1 -1
- package/core/built/admin/assets/global-search-modal-DzRM3aON.js +1 -0
- package/core/built/admin/assets/{growth-BlPW4DHj.js → growth-CAi_5HIf.js} +1 -1
- package/core/built/admin/assets/{growth-CflU3vR0.js → growth-CMHbTWKE.js} +1 -1
- package/core/built/admin/assets/history-modal-BIz13vhr.js +1 -0
- package/core/built/admin/assets/{hooks-C-BDQ6Hs.js → hooks-0r7qxGEo.js} +2 -2
- package/core/built/admin/assets/{html-field-D6G0G1d_.js → html-field-vTe2q1be.js} +1 -1
- package/core/built/admin/assets/{iframe-buffering-DW-Axhvc.js → iframe-buffering-cu-yK7NA.js} +1 -1
- package/core/built/admin/assets/{images-BSUWxquu.js → images-DTZtaIAr.js} +1 -1
- package/core/built/admin/assets/{inbox-BkU3sg13.js → inbox-BHfpmmzn.js} +1 -1
- package/core/built/admin/assets/{index-z8-nEVdb.css → index-B02LJqc8.css} +1 -1
- package/core/built/admin/assets/{index-CuDhPtkB.js → index-RuRs_qGS.js} +3 -3
- package/core/built/admin/assets/{index.es-H6HOI4DG.js → index.es-rdb1skp_.js} +1 -1
- package/core/built/admin/assets/{integrations-BRo5DwA5.js → integrations-Deg9-u8X.js} +1 -1
- package/core/built/admin/assets/{invite-user-modal-CydBOG99.js → invite-user-modal-C4DeNcoO.js} +1 -1
- package/core/built/admin/assets/koenig-lexical/koenig-lexical.js +10483 -10455
- package/core/built/admin/assets/koenig-lexical/koenig-lexical.umd.js +131 -131
- package/core/built/admin/assets/{koenig-lexical-CG_eb4dw.js → koenig-lexical-BhXu1__-.js} +96 -96
- package/core/built/admin/assets/{kpi-helpers-CyRx_yD6.js → kpi-helpers-H-Hl6h7h.js} +1 -1
- package/core/built/admin/assets/{kpi-tabs-V1_Nu9sh.js → kpi-tabs-k4A9-imn.js} +1 -1
- package/core/built/admin/assets/{label-picker-GTIIlBQ6.js → label-picker-DaivLdMw.js} +1 -1
- package/core/built/admin/assets/{labels-BVGLgdAj.js → labels-BCj6D_nl.js} +1 -1
- package/core/built/admin/assets/{layout-CG58T6P7.js → layout-_g2xhB0L.js} +1 -1
- package/core/built/admin/assets/{lib-Dkic19kH.js → lib-Bre6UXdJ.js} +2 -2
- package/core/built/admin/assets/{links-jD8AkkIu.js → links-C8RnEJVJ.js} +1 -1
- package/core/built/admin/assets/{member-activity-JggQ0VNQ.js → member-activity-DNJPUW5X.js} +1 -1
- package/core/built/admin/assets/{member-activity-feed-BBeCZmLM.js → member-activity-feed-CvKEetHS.js} +1 -1
- package/core/built/admin/assets/{member-custom-fields-DPsyP1Hq.js → member-custom-fields-CBdiwPD9.js} +1 -1
- package/core/built/admin/assets/{member-detail-D7qugPN7.js → member-detail-BIoyIIsl.js} +1 -1
- package/core/built/admin/assets/{members-Cj_BUZUL.js → members-CH6KeXQc.js} +1 -1
- package/core/built/admin/assets/{members-alDWPKDd.js → members-Dd9RczFK.js} +1 -1
- package/core/built/admin/assets/{migrate-2uKKakld.js → migrate-CVQIWsXO.js} +1 -1
- package/core/built/admin/assets/{moderation-pCUKsxbF.js → moderation-OtjZoNOc.js} +1 -1
- package/core/built/admin/assets/{navigation-modal-D0FBI5-m.js → navigation-modal-Bl02NjtO.js} +1 -1
- package/core/built/admin/assets/{newsletter-4urgCSR_.js → newsletter-BXyT7o69.js} +1 -1
- package/core/built/admin/assets/{newsletter-detail-modal-Chh1jvjH.js → newsletter-detail-modal-DxuKNu_1.js} +1 -1
- package/core/built/admin/assets/{newsletter-emails-CzVCiC2K.js → newsletter-emails-DicgmnMU.js} +1 -1
- package/core/built/admin/assets/{newsletters-eRQTtOBH.js → newsletters-By25FmUs.js} +1 -1
- package/core/built/admin/assets/{newsletters-BMEgeL2l.js → newsletters-CACa0VCx.js} +1 -1
- package/core/built/admin/assets/{note-dqog4Bua.js → note-CF4LrSmR.js} +1 -1
- package/core/built/admin/assets/{notifications-rcEVv-gx.js → notifications-BmHJmqIJ.js} +1 -1
- package/core/built/admin/assets/{offers-hV7zBtsI.js → offers-Df9Jzay5.js} +1 -1
- package/core/built/admin/assets/{offers-container-modal-DgZgkMsA.js → offers-container-modal-R0HRwugm.js} +1 -1
- package/core/built/admin/assets/{onboarding-4TxbZb90.js → onboarding-Bpo1yTzA.js} +1 -1
- package/core/built/admin/assets/{onboarding-SGscZLIc.js → onboarding-bMq3R8jB.js} +1 -1
- package/core/built/admin/assets/{onboarding-route-B3mN9l7E.js → onboarding-route-flf5YWti.js} +1 -1
- package/core/built/admin/assets/{overview-D4EanvDG.js → overview-C9WvmmOC.js} +1 -1
- package/core/built/admin/assets/{overview-CCwbHet8.js → overview-CDkHdIJM.js} +1 -1
- package/core/built/admin/assets/{page-header-Baymg6VR.js → page-header-CxTb0je5.js} +1 -1
- package/core/built/admin/assets/{pagemenu--UL0gW1x.js → pagemenu-DXr_U43J.js} +1 -1
- package/core/built/admin/assets/{pages-Cbq1M2kG.js → pages-Bm-zFXyP.js} +1 -1
- package/core/built/admin/assets/pages-route-LCw94aIO.js +1 -0
- package/core/built/admin/assets/{pintura-modal-D6HGlnJa.js → pintura-modal-B5sIPWcj.js} +1 -1
- package/core/built/admin/assets/{portal-modal-Bhqsevn_.js → portal-modal-DjOO3Unv.js} +1 -1
- package/core/built/admin/assets/{post-analytics-header-DX9fETdi.js → post-analytics-header-D2anehCj.js} +1 -1
- package/core/built/admin/assets/{post-analytics-provider-U7RtOle1.js → post-analytics-provider-BLQvV5C0.js} +1 -1
- package/core/built/admin/assets/{post-analytics-BJWDtC3a.js → post-analytics-wdu9gq8u.js} +1 -1
- package/core/built/admin/assets/{post-debug-D1b8Amju.js → post-debug-BnABXMfD.js} +1 -1
- package/core/built/admin/assets/{posts-Lg-p_ZHg.js → posts-CftunZgV.js} +1 -1
- package/core/built/admin/assets/{posts-list-screen-CmsW18e_.js → posts-list-screen-CwXmvY68.js} +2 -2
- package/core/built/admin/assets/posts-route-J74fMhCe.js +1 -0
- package/core/built/admin/assets/{preferences-CMlDfHfa.js → preferences-DFhf_pJF.js} +1 -1
- package/core/built/admin/assets/{preview-modal-D8om_cQv.js → preview-modal-BrZza3R_.js} +1 -1
- package/core/built/admin/assets/{profile-yFsIoZom.js → profile-CS4fP60N.js} +1 -1
- package/core/built/admin/assets/{radio-group-DwgLjwWB.js → radio-group-Xfp-frJz.js} +1 -1
- package/core/built/admin/assets/{referrers-DzP5QoXL.js → referrers-C8LJlrBm.js} +1 -1
- package/core/built/admin/assets/{reload-CZ-KP3IQ.js → reload-D0fnKoCm.js} +1 -1
- package/core/built/admin/assets/{reset-CCAa8v35.js → reset-CB-ATcLE.js} +1 -1
- package/core/built/admin/assets/{restore-screen-Ba0i2Y1K.js → restore-screen-EaZf4V8j.js} +1 -1
- package/core/built/admin/assets/{routes-DrnhmKTT.js → routes-DKfpFMfF.js} +2 -2
- package/core/built/admin/assets/search-index-sM3OjEUl.js +1 -0
- package/core/built/admin/assets/settings-BWzod-5X.js +4 -0
- package/core/built/admin/assets/{settings-lqWkfSmT.js → settings-DvgngbFt.js} +1 -1
- package/core/built/admin/assets/{setup-BopRPuaM.js → setup-CdHAchG5.js} +1 -1
- package/core/built/admin/assets/{signin-e8NgsU9M.js → signin-CUEEme88.js} +1 -1
- package/core/built/admin/assets/{signin-verify-CHkFJevb.js → signin-verify-CYRphSrj.js} +1 -1
- package/core/built/admin/assets/{signout-DRvQZuWa.js → signout-kLCJau9G.js} +1 -1
- package/core/built/admin/assets/{signup-DQHi7jZz.js → signup-J2Vjq7Gt.js} +1 -1
- package/core/built/admin/assets/{slack-modal-BuGESzgn.js → slack-modal-DKamr_94.js} +1 -1
- package/core/built/admin/assets/source-icon-DqBCPDIK.js +1 -0
- package/core/built/admin/assets/{stats-CHOikfoP.js → stats-BL_FJ7Ns.js} +1 -1
- package/core/built/admin/assets/{stats-view-DQZzKeEz.js → stats-view-BwbdkdOQ.js} +1 -1
- package/core/built/admin/assets/{step-1-C8XwHcKt.js → step-1-CLYhNmG9.js} +1 -1
- package/core/built/admin/assets/{step-2-BXaXAdwY.js → step-2-B2ujMlpa.js} +1 -1
- package/core/built/admin/assets/{step-3-DytbqpJi.js → step-3-DoaTWqqj.js} +1 -1
- package/core/built/admin/assets/{stripe-connect-modal-BhudjSeO.js → stripe-connect-modal-DytxH9DJ.js} +1 -1
- package/core/built/admin/assets/{tabs-CDb_TceL.js → tabs-fHs3A8WC.js} +1 -1
- package/core/built/admin/assets/{tag-detail-V72Zlro8.js → tag-detail-BcO46Ids.js} +2 -2
- package/core/built/admin/assets/{tag-picker-M3fC-yOF.js → tag-picker-Ct6NeqWK.js} +1 -1
- package/core/built/admin/assets/{tags-CXqE2A2T.js → tags-C1h3wCpW.js} +1 -1
- package/core/built/admin/assets/{tags-ZhqbPPc6.js → tags-OlmRJ6Ps.js} +1 -1
- package/core/built/admin/assets/{testimonials-modal-Cn8gvIFA.js → testimonials-modal-DMsQzSCB.js} +1 -1
- package/core/built/admin/assets/{themes-pOHHvnkt.js → themes-CPJSMo_W.js} +1 -1
- package/core/built/admin/assets/{tier-detail-modal-CeDla1OO.js → tier-detail-modal-DssSmhkF.js} +1 -1
- package/core/built/admin/assets/{tiers-D7aGzwZ-.js → tiers-DlvS8D6_.js} +1 -1
- package/core/built/admin/assets/{toggle-group-D7ly9OGa.js → toggle-group-BFWCtH3p.js} +1 -1
- package/core/built/admin/assets/{topic-filter-DQ3pr6AB.js → topic-filter-DAJ-DFPb.js} +1 -1
- package/core/built/admin/assets/{transistor-modal-4_Yx2vRo.js → transistor-modal-CtyFRsD0.js} +1 -1
- package/core/built/admin/assets/{unsplash-modal-Dm7R4k4k.js → unsplash-modal-DHnnTPmZ.js} +1 -1
- package/core/built/admin/assets/{use-activity-pub-queries-Gy9_locM.js → use-activity-pub-queries-BgR1USeY.js} +1 -1
- package/core/built/admin/assets/{use-analytics-data-oJ2o0pSS.js → use-analytics-data-Byf83QE-.js} +1 -1
- package/core/built/admin/assets/{use-availability-BqL7Dvn_.js → use-availability-CgZC6L_V.js} +1 -1
- package/core/built/admin/assets/{use-check-theme-limit-error-CxC9uKJz.js → use-check-theme-limit-error-DjprzKAN.js} +1 -1
- package/core/built/admin/assets/use-definitions-CJuXLSob.js +1 -0
- package/core/built/admin/assets/{use-email-sending-status-BFAg5TIb.js → use-email-sending-status-7kopNcza.js} +1 -1
- package/core/built/admin/assets/{use-filter-params-BOo9yZ5j.js → use-filter-params-DQ7uX-Zp.js} +1 -1
- package/core/built/admin/assets/{use-filterable-api-BnNLaS_r.js → use-filterable-api-CDrrxoGD.js} +1 -1
- package/core/built/admin/assets/{use-growth-stats-BS62uyyn.js → use-growth-stats-CCpnBgqS.js} +1 -1
- package/core/built/admin/assets/{use-host-limits-CNh4AAEs.js → use-host-limits-BZx7rzRI.js} +1 -1
- package/core/built/admin/assets/{use-limiter-DPKxoO1_.js → use-limiter-gF219BEg.js} +1 -1
- package/core/built/admin/assets/{use-pintura-config-CyVO62ZV.js → use-pintura-config-D-pmGkn2.js} +1 -1
- package/core/built/admin/assets/{use-pintura-editor-B5VBPbiO.js → use-pintura-editor-D_4zhlGE.js} +1 -1
- package/core/built/admin/assets/{use-post-referrers-nUPolSk7.js → use-post-referrers-Bc8eq4uy.js} +1 -1
- package/core/built/admin/assets/{use-post-top-links-DCH4eO11.js → use-post-top-links-DjltnQuI.js} +1 -1
- package/core/built/admin/assets/{use-reply-chain-data-UMzFbDvh.js → use-reply-chain-data-BiV3Cl0B.js} +1 -1
- package/core/built/admin/assets/use-sending-eta-gE-2B0Zw.js +1 -0
- package/core/built/admin/assets/{use-setting-group-Bf3vY8br.js → use-setting-group-YP84CqrJ.js} +1 -1
- package/core/built/admin/assets/{use-staff-users-CcQzTHqH.js → use-staff-users-CnwfdSx1.js} +1 -1
- package/core/built/admin/assets/{use-tinybird-query-CPy5ipAP.js → use-tinybird-query-BYbl5gKY.js} +1 -1
- package/core/built/admin/assets/{use-tinybird-token-DVNHuhu_.js → use-tinybird-token-Dz37zvb7.js} +1 -1
- package/core/built/admin/assets/{use-unsaved-changes-guard-Bvcp_Rny.js → use-unsaved-changes-guard-BkCuSlvU.js} +1 -1
- package/core/built/admin/assets/{use-upgrade-route-Bsxw9ZLN.js → use-upgrade-route-C-V-Xfak.js} +1 -1
- package/core/built/admin/assets/{use-url-input-DPJ592FB.js → use-url-input-BeYKYMGh.js} +1 -1
- package/core/built/admin/assets/{user-detail-modal-6UY6GdNy.js → user-detail-modal-CSoj7vOC.js} +1 -1
- package/core/built/admin/assets/{users-CzgQKbfO.js → users-CKJaAxEJ.js} +1 -1
- package/core/built/admin/assets/{view-site-DA_-zfGq.js → view-site-SpMx4P7G.js} +1 -1
- package/core/built/admin/assets/{web-Cq5YiD2r.js → web-CZf-k4F0.js} +1 -1
- package/core/built/admin/assets/{web-DqFIrOxt.js → web-uAqgYPK9.js} +1 -1
- package/core/built/admin/assets/{zapier-modal-DgqU-OBB.js → zapier-modal-DENbgTyE.js} +1 -1
- package/core/built/admin/index.html +24 -24
- package/core/frontend/helpers/color_to_rgba.js +15 -13
- package/core/frontend/helpers/facebook_url.js +27 -15
- package/core/frontend/services/assets-minification/card-assets.js +1 -1
- package/core/frontend/services/helpers/register-ghost-helpers.js +2 -2
- package/core/server/api/endpoints/app-installations.js +36 -0
- package/core/server/api/endpoints/automations.js +1 -1
- package/core/server/api/endpoints/index.js +4 -0
- package/core/server/data/exporter/table-lists.js +2 -0
- package/core/server/data/migrations/versions/6.69/2026-10-07-06-20-43-add-app-installation-permissions.js +40 -0
- package/core/server/data/schema/fixtures/fixtures.json +21 -0
- package/core/server/data/schema/in-development.js +1 -1
- package/core/server/data/schema/schema.js +53 -0
- package/core/server/lib/after-commit.js +20 -0
- package/core/server/models/action.js +6 -0
- package/core/server/services/app-installations/actions.js +44 -0
- package/core/server/services/app-installations/codec.js +20 -0
- package/core/server/services/app-installations/index.js +42 -0
- package/core/server/services/app-installations/schema.js +52 -0
- package/core/server/services/app-installations/service.js +160 -0
- package/core/server/services/automations/README.md +3 -3
- package/core/server/services/automations/automations-api.js +1 -1
- package/core/server/services/comments/comments-service-emails.js +8 -6
- package/core/server/services/email-service/README.md +16 -0
- package/core/server/services/email-service/email-service-wrapper.js +1 -0
- package/core/server/services/email-service/email-service.js +94 -53
- package/core/server/services/email-service/sending-status-serializers.js +4 -1
- package/core/server/services/email-service/sending-status-service.js +13 -0
- package/core/server/services/email-service/sending-status.js +12 -1
- package/core/server/services/members/members-api/repositories/member-repository.js +5 -23
- package/core/server/services/posts/post-email-handler.js +61 -28
- package/core/server/services/posts/posts-service.js +27 -2
- package/core/server/services/service-inventory.yaml +93 -7
- package/core/server/services/stats/stats-service.js +1 -5
- package/core/server/services/tinybird-sync/index.js +0 -3
- package/core/server/services/tinybird-sync/tinybird-sync-service.js +2 -6
- package/core/server/web/api/endpoints/admin/routes.js +25 -12
- package/core/shared/labs.js +4 -6
- package/package.json +11 -10
- package/pnpm-lock.yaml +112 -100
- package/pnpm-workspace.yaml +14 -12
- package/components/ghost-storage-base-3.0.0.tgz +0 -0
- package/components/tryghost-adapter-base-cache-0.2.0.tgz +0 -0
- package/components/tryghost-checkout-0.0.1.tgz +0 -0
- package/components/tryghost-kg-card-factory-5.2.4.tgz +0 -0
- package/components/tryghost-kg-clean-basic-html-4.3.4.tgz +0 -0
- package/components/tryghost-kg-converters-1.2.5.tgz +0 -0
- package/components/tryghost-kg-default-transforms-1.3.4.tgz +0 -0
- package/components/tryghost-kg-html-to-lexical-1.4.0.tgz +0 -0
- package/components/tryghost-kg-markdown-html-renderer-7.2.6.tgz +0 -0
- package/components/tryghost-kg-utils-1.1.4.tgz +0 -0
- package/components/tryghost-metafield-csv-0.0.1.tgz +0 -0
- package/core/built/admin/assets/activitypub/layout-QTbY0t8e.js +0 -1
- package/core/built/admin/assets/automations-DVToctfJ.js +0 -1
- package/core/built/admin/assets/editor-CMXR0YvR.js +0 -8
- package/core/built/admin/assets/fullscreen-close-button-DXssPeDB.js +0 -1
- package/core/built/admin/assets/global-search-modal-C8LVJmiz.js +0 -1
- package/core/built/admin/assets/history-modal-parBtjpz.js +0 -1
- package/core/built/admin/assets/pages-route-CDk3V9rq.js +0 -1
- package/core/built/admin/assets/posts-route-CexHhklY.js +0 -1
- package/core/built/admin/assets/settings-xqakrAWa.js +0 -4
- package/core/built/admin/assets/source-icon-BjVangBd.js +0 -1
- package/core/built/admin/assets/use-definitions-DMVU3mTG.js +0 -1
- package/core/built/admin/assets/use-sending-eta-BsnKdQhv.js +0 -1
package/core/built/admin/assets/{content-formatters-VqvNA7Pv.js → content-formatters-C08JJbUJ.js}
RENAMED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`326c8ad6-c04d-4393-8a56-55a927d11dea`,e._sentryDebugIdIdentifier=`sentry-dbid-326c8ad6-c04d-4393-8a56-55a927d11dea`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{n as r}from"./dist-pogVoW2G.js";import{Z as i}from"./shade-provider-DvrXKKQZ.js";import{d as a,dt as o,or as s,t as c}from"./button-CTHYSI-d.js";import{t as l}from"./skeleton-C1s6yr9e.js";import{t as u}from"./use-navigate-with-base-path-pweMCFf6.js";import{R as d,y as f}from"./use-activity-pub-queries-BgR1USeY.js";var p=e(t(),1);function ee(e){if(e.handle)return e.handle;if(!e.preferredUsername||!e.id)return`@unknown@unknown`;try{return`@${e.preferredUsername}@${new URL(e.id).hostname.replace(/^www\./,``)}`}catch{return`@unknown@unknown`}}var m=n(),h=null,g=({onFollow:e,onUnfollow:t,authorHandle:n,followedByMe:r})=>{let[,i]=p.useReducer(e=>e+1,0),a=h===n&&!r;return(0,m.jsx)(c,{className:`absolute -right-1.5 bottom-px z-10 flex size-4 items-center justify-center rounded-full p-0 outline-2 outline-white transition-transform hover:scale-105 active:scale-100 dark:outline-black`,title:a?`Unfollow`:`Follow`,onClick:r=>{a?(t(r),setTimeout(()=>{h=null,i()},0)):(h=n,i(),e(r))},children:a?(0,m.jsx)(s,{className:`-mb-px size-3! stroke-[2.4]!`}):(0,m.jsx)(o,{className:`size-[14px]! stroke-2!`})})},_=({author:e,size:t,isLoading:n=!1,disabled:o=!1,className:s=``,showFollowButton:c=!1})=>{let _=20,v=`shrink-0 items-center justify-center rounded-full relative z-10 flex bg-black/5 dark:bg-gray-900 ${t===`lg`||o?``:`cursor-pointer`} ${s}`,y=`z-10 object-cover rounded-full outline-[0.5px] outline-offset-[-0.5px] outline-black/10`,[b,x]=(0,p.useState)(e?.icon?.url),S=u(),te=f(`index`,()=>{r.success(`Followed ${e?.name}`)},()=>{r.error(`Failed to follow`)}),C=d(`index`,()=>{r.info(`Unfollowed ${e?.name}`)},()=>{r.error(`Failed to unfollow`)});switch((0,p.useEffect)(()=>{x(e?.icon?.url)},[e?.icon?.url]),t){case`2xs`:_=10,v=i(`size-4`,v),y=i(`size-4`,y);break;case`xs`:_=12,v=i(`size-6`,v),y=i(`size-6`,y);break;case`notification`:_=16,v=i(`size-9`,v),y=i(`size-9`,y);break;case`sm`:v=i(`size-10`,v),y=i(`size-10`,y);break;case`md`:v=i(`size-[60px]`,v),y=i(`size-[60px]`,y);break;case`lg`:_=32,v=i(`size-22`,v),y=i(`size-22`,y);break;default:v=i(`size-10`,v),y=i(`size-10`,y);break}if(!e||n)return(0,m.jsx)(l,{className:y,containerClassName:v});let w=ee(e),ne=e=>{e.stopPropagation(),S(`/profile/${w}`)},T=e=>{e.stopPropagation(),te.mutate(w)},re=e=>{e.stopPropagation(),C.mutate(w)},E=c||h===w;return b?(0,m.jsxs)(`div`,{className:v,onClick:t===`lg`||o?void 0:ne,children:[(0,m.jsx)(`img`,{className:y,referrerPolicy:`no-referrer`,src:b,onError:()=>x(void 0)}),E&&(0,m.jsx)(g,{authorHandle:w,followedByMe:!1,onFollow:T,onUnfollow:re})]}):(0,m.jsxs)(`div`,{className:v,onClick:o?void 0:ne,children:[(0,m.jsx)(a,{className:`text-gray-600`,size:_,strokeWidth:1.5}),E&&(0,m.jsx)(g,{authorHandle:w,followedByMe:!1,onFollow:T,onUnfollow:re})]})};function v(e,t){this.v=e,this.k=t}function y(e,t){(t==null||t>e.length)&&(t=e.length);for(var n=0,r=Array(t);n<t;n++)r[n]=e[n];return r}function b(e){if(Array.isArray(e))return e}function x(e,t){var n=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(n!=null){var r,i,a,o,s=[],c=!0,l=!1;try{if(a=(n=n.call(e)).next,t===0){if(Object(n)!==n)return;c=!1}else for(;!(c=(r=a.call(n)).done)&&(s.push(r.value),s.length!==t);c=!0);}catch(e){l=!0,i=e}finally{try{if(!c&&n.return!=null&&(o=n.return(),Object(o)!==o))return}finally{if(l)throw i}}return s}}function S(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function te(e,t){return b(e)||x(e,t)||C(e,t)||S()}function C(e,t){if(e){if(typeof e==`string`)return y(e,t);var n={}.toString.call(e).slice(8,-1);return n===`Object`&&e.constructor&&(n=e.constructor.name),n===`Map`||n===`Set`?Array.from(e):n===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?y(e,t):void 0}}function w(e){var t,n;function r(t,n){try{var a=e[t](n),o=a.value,s=o instanceof v;Promise.resolve(s?o.v:o).then(function(n){if(s){var c=t===`return`&&o.k?t:`next`;if(!o.k||n.done)return r(c,n);n=e[c](n).value}i(!!a.done,n)},function(e){r(`throw`,e)})}catch(e){i(2,e)}}function i(e,i){e===2?t.reject(i):t.resolve({value:i,done:e}),(t=t.next)?r(t.key,t.arg):n=null}this._invoke=function(e,i){return new Promise(function(a,o){var s={key:e,arg:i,resolve:a,reject:o,next:null};n?n=n.next=s:(t=n=s,r(e,i))})},typeof e.return!=`function`&&(this.return=void 0)}w.prototype[typeof Symbol==`function`&&Symbol.asyncIterator||`@@asyncIterator`]=function(){return this},w.prototype.next=function(e){return this._invoke(`next`,e)},w.prototype.throw=function(e){return this._invoke(`throw`,e)},w.prototype.return=function(e){return this._invoke(`return`,e)};var ne=Object.entries,T=Object.setPrototypeOf,re=Object.isFrozen,E=Object.getPrototypeOf,ie=Object.getOwnPropertyDescriptor,D=Object.freeze,O=Object.seal,ae=Object.create,k=typeof Reflect<`u`&&Reflect,oe=k.apply,se=k.construct;D||=function(e){return e},O||=function(e){return e},oe||=function(e,t){var n=[...arguments].slice(2);return e.apply(t,n)},se||=function(e){return new e(...[...arguments].slice(1))};var A=P(Array.prototype.forEach);Array.prototype.indexOf;var ce=P(Array.prototype.lastIndexOf),le=P(Array.prototype.pop),ue=P(Array.prototype.push);Array.prototype.slice;var de=P(Array.prototype.splice),fe=Array.isArray,pe=P(String.prototype.toLowerCase),me=P(String.prototype.toString),he=P(String.prototype.match),ge=P(String.prototype.replace),_e=P(String.prototype.indexOf),ve=P(String.prototype.trim),ye=P(Number.prototype.toString),be=P(Boolean.prototype.toString),xe=typeof BigInt>`u`?null:P(BigInt.prototype.toString),Se=typeof Symbol>`u`?null:P(Symbol.prototype.toString),j=P(Object.prototype.hasOwnProperty),Ce=P(Object.prototype.toString),M=P(RegExp.prototype.test),N=F(TypeError);function P(e){return function(t){t instanceof RegExp&&(t.lastIndex=0);var n=[...arguments].slice(1);return oe(e,t,n)}}function F(e){return function(){return se(e,[...arguments])}}function I(e,t){let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:pe;if(T&&T(e,null),!fe(t))return e;let r=t.length;for(;r--;){let i=t[r];if(typeof i==`string`){let e=n(i);e!==i&&(re(t)||(t[r]=e),i=e)}e[i]=!0}return e}function we(e){for(let t=0;t<e.length;t++)j(e,t)||(e[t]=null);return e}function L(e){let t=ae(null);for(let r of ne(e)){var n=te(r,2);let i=n[0],a=n[1];j(e,i)&&(fe(a)?t[i]=we(a):a&&typeof a==`object`&&a.constructor===Object?t[i]=L(a):t[i]=a)}return t}function Te(e){switch(typeof e){case`string`:return e;case`number`:return ye(e);case`boolean`:return be(e);case`bigint`:return xe?xe(e):`0`;case`symbol`:return Se?Se(e):`Symbol()`;case`undefined`:return Ce(e);case`function`:case`object`:{if(e===null)return Ce(e);let t=e,n=R(t,`toString`);if(typeof n==`function`){let e=n(t);return typeof e==`string`?e:Ce(e)}return Ce(e)}default:return Ce(e)}}function R(e,t){for(;e!==null;){let n=ie(e,t);if(n){if(n.get)return P(n.get);if(typeof n.value==`function`)return P(n.value)}e=E(e)}function n(){return null}return n}function Ee(e){try{return M(e,``),!0}catch{return!1}}var De=D(`a.abbr.acronym.address.area.article.aside.audio.b.bdi.bdo.big.blink.blockquote.body.br.button.canvas.caption.center.cite.code.col.colgroup.content.data.datalist.dd.decorator.del.details.dfn.dialog.dir.div.dl.dt.element.em.fieldset.figcaption.figure.font.footer.form.h1.h2.h3.h4.h5.h6.head.header.hgroup.hr.html.i.img.input.ins.kbd.label.legend.li.main.map.mark.marquee.menu.menuitem.meter.nav.nobr.ol.optgroup.option.output.p.picture.pre.progress.q.rp.rt.ruby.s.samp.search.section.select.shadow.slot.small.source.spacer.span.strike.strong.style.sub.summary.sup.table.tbody.td.template.textarea.tfoot.th.thead.time.tr.track.tt.u.ul.var.video.wbr`.split(`.`)),Oe=D(`svg.a.altglyph.altglyphdef.altglyphitem.animatecolor.animatemotion.animatetransform.circle.clippath.defs.desc.ellipse.enterkeyhint.exportparts.filter.font.g.glyph.glyphref.hkern.image.inputmode.line.lineargradient.marker.mask.metadata.mpath.part.path.pattern.polygon.polyline.radialgradient.rect.stop.style.switch.symbol.text.textpath.title.tref.tspan.view.vkern`.split(`.`)),ke=D([`feBlend`,`feColorMatrix`,`feComponentTransfer`,`feComposite`,`feConvolveMatrix`,`feDiffuseLighting`,`feDisplacementMap`,`feDistantLight`,`feDropShadow`,`feFlood`,`feFuncA`,`feFuncB`,`feFuncG`,`feFuncR`,`feGaussianBlur`,`feImage`,`feMerge`,`feMergeNode`,`feMorphology`,`feOffset`,`fePointLight`,`feSpecularLighting`,`feSpotLight`,`feTile`,`feTurbulence`]),Ae=D([`animate`,`color-profile`,`cursor`,`discard`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`foreignobject`,`hatch`,`hatchpath`,`mesh`,`meshgradient`,`meshpatch`,`meshrow`,`missing-glyph`,`script`,`set`,`solidcolor`,`unknown`,`use`]),je=D(`math.menclose.merror.mfenced.mfrac.mglyph.mi.mlabeledtr.mmultiscripts.mn.mo.mover.mpadded.mphantom.mroot.mrow.ms.mspace.msqrt.mstyle.msub.msup.msubsup.mtable.mtd.mtext.mtr.munder.munderover.mprescripts`.split(`.`)),Me=D([`maction`,`maligngroup`,`malignmark`,`mlongdiv`,`mscarries`,`mscarry`,`msgroup`,`mstack`,`msline`,`msrow`,`semantics`,`annotation`,`annotation-xml`,`mprescripts`,`none`]),Ne=D([`#text`]),Pe=D(`accept.action.align.alt.autocapitalize.autocomplete.autopictureinpicture.autoplay.background.bgcolor.border.capture.cellpadding.cellspacing.checked.cite.class.clear.color.cols.colspan.command.commandfor.controls.controlslist.coords.crossorigin.datetime.decoding.default.dir.disabled.disablepictureinpicture.disableremoteplayback.download.draggable.enctype.enterkeyhint.exportparts.face.for.headers.height.hidden.high.href.hreflang.id.inert.inputmode.integrity.ismap.kind.label.lang.list.loading.loop.low.max.maxlength.media.method.min.minlength.multiple.muted.name.nonce.noshade.novalidate.nowrap.open.optimum.part.pattern.placeholder.playsinline.popover.popovertarget.popovertargetaction.poster.preload.pubdate.radiogroup.readonly.rel.required.rev.reversed.role.rows.rowspan.spellcheck.scope.selected.shape.size.sizes.slot.span.srclang.start.src.srcset.step.style.summary.tabindex.title.translate.type.usemap.valign.value.width.wrap.xmlns`.split(`.`)),Fe=D(`accent-height.accumulate.additive.alignment-baseline.amplitude.ascent.attributename.attributetype.azimuth.basefrequency.baseline-shift.begin.bias.by.class.clip.clippathunits.clip-path.clip-rule.color.color-interpolation.color-interpolation-filters.color-profile.color-rendering.cx.cy.d.dx.dy.diffuseconstant.direction.display.divisor.dominant-baseline.dur.edgemode.elevation.end.exponent.fill.fill-opacity.fill-rule.filter.filterunits.flood-color.flood-opacity.font-family.font-size.font-size-adjust.font-stretch.font-style.font-variant.font-weight.fx.fy.g1.g2.glyph-name.glyphref.gradientunits.gradienttransform.height.href.id.image-rendering.in.in2.intercept.k.k1.k2.k3.k4.kerning.keypoints.keysplines.keytimes.lang.lengthadjust.letter-spacing.kernelmatrix.kernelunitlength.lighting-color.local.marker-end.marker-mid.marker-start.markerheight.markerunits.markerwidth.maskcontentunits.maskunits.max.mask.mask-type.media.method.mode.min.name.numoctaves.offset.operator.opacity.order.orient.orientation.origin.overflow.paint-order.path.pathlength.patterncontentunits.patterntransform.patternunits.pointer-events.points.preservealpha.preserveaspectratio.primitiveunits.r.rx.ry.radius.refx.refy.repeatcount.repeatdur.restart.result.rotate.scale.seed.shape-rendering.slope.specularconstant.specularexponent.spreadmethod.startoffset.stddeviation.stitchtiles.stop-color.stop-opacity.stroke-dasharray.stroke-dashoffset.stroke-linecap.stroke-linejoin.stroke-miterlimit.stroke-opacity.stroke.stroke-width.style.surfacescale.systemlanguage.tabindex.tablevalues.targetx.targety.transform.transform-origin.text-anchor.text-decoration.text-orientation.text-rendering.textlength.type.u1.u2.unicode.values.vector-effect.viewbox.visibility.version.vert-adv-y.vert-origin-x.vert-origin-y.width.word-spacing.wrap.writing-mode.xchannelselector.ychannelselector.x.x1.x2.xmlns.y.y1.y2.z.zoomandpan`.split(`.`)),Ie=D(`accent.accentunder.align.bevelled.close.columnalign.columnlines.columnspacing.columnspan.denomalign.depth.dir.display.displaystyle.encoding.fence.frame.height.href.id.largeop.length.linethickness.lquote.lspace.mathbackground.mathcolor.mathsize.mathvariant.maxsize.minsize.movablelimits.notation.numalign.open.rowalign.rowlines.rowspacing.rowspan.rspace.rquote.scriptlevel.scriptminsize.scriptsizemultiplier.selection.separator.separators.stretchy.subscriptshift.supscriptshift.symmetric.voffset.width.xmlns`.split(`.`)),Le=D([`xlink:href`,`xml:id`,`xlink:title`,`xml:space`,`xmlns:xlink`]),Re=O(/{{[\w\W]*|^[\w\W]*}}/g),ze=O(/<%[\w\W]*|^[\w\W]*%>/g),Be=O(/\${[\w\W]*/g),Ve=O(/^data-[\-\w.\u00B7-\uFFFF]+$/),He=O(/^aria-[\-\w]+$/),Ue=O(/^(?:(?:(?:f|ht)tps?|mailto|tel|callto|sms|cid|xmpp|matrix):|[^a-z]|[a-z+.\-]+(?:[^a-z+.\-:]|$))/i),We=O(/^(?:\w+script|data):/i),Ge=O(/[\u0000-\u0020\u00A0\u1680\u180E\u2000-\u2029\u205F\u3000]/g),Ke=O(/^html$/i),qe=O(/^[a-z][.\w]*(-[.\w]+)+$/i),Je=O(/<[/\w!]/g),Ye=O(/<[/\w]/g),Xe=O(/<\/no(script|embed|frames)/i),Ze=O(/\/>/i),z={element:1,attribute:2,text:3,cdataSection:4,entityReference:5,entityNode:6,processingInstruction:7,comment:8,document:9,documentType:10,documentFragment:11,notation:12},Qe=[`style`,`script`,`xmp`,`iframe`,`noembed`,`noframes`,`plaintext`,`noscript`],$e=D(I({},Qe)),et=function(){let e={};return A(Qe,t=>{e[t]=O(RegExp(`</`+t+`(?=[\\t\\n\\f\\r />])`,`i`))}),D(e)}(),tt=function(){return typeof window>`u`?null:window},nt=function(e,t){if(typeof e!=`object`||typeof e.createPolicy!=`function`)return null;let n=null,r=`data-tt-policy-suffix`;t&&t.hasAttribute(r)&&(n=t.getAttribute(r));let i=`dompurify`+(n?`#`+n:``);try{return e.createPolicy(i,{createHTML(e){return e},createScriptURL(e){return e}})}catch{return console.warn(`TrustedTypes policy `+i+` could not be created.`),null}},rt=function(){return{afterSanitizeAttributes:[],afterSanitizeElements:[],afterSanitizeShadowDOM:[],beforeSanitizeAttributes:[],beforeSanitizeElements:[],beforeSanitizeShadowDOM:[],uponSanitizeAttribute:[],uponSanitizeElement:[],uponSanitizeShadowNode:[]}},B=function(e,t,n,r){return j(e,t)&&fe(e[t])?I(r.base?L(r.base):{},e[t],r.transform):n},it=function(e,t,n){let r=j(e,t)?e[t]:void 0;return r&&typeof r==`object`?L(r):n()};function at(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:tt(),t=e=>at(e);if(t.version=`3.4.16`,t.removed=[],!e||!e.document||e.document.nodeType!==z.document||!e.Element)return t.isSupported=!1,t;let n=e.document,r=n,i=r.currentScript;e.DocumentFragment;let a=e.HTMLTemplateElement,o=e.Node,s=e.Element,c=e.NodeFilter;e.NamedNodeMap===void 0&&(e.NamedNodeMap||e.MozNamedAttrMap),e.HTMLFormElement;let l=e.DOMParser,u=e.trustedTypes,d=s.prototype,f=R(d,`cloneNode`),p=R(d,`remove`),ee=R(d,`removeAttributeNode`),m=R(d,`nextSibling`),h=R(d,`childNodes`),g=R(d,`parentNode`),_=R(d,`shadowRoot`),v=R(d,`attributes`),y=o&&o.prototype?R(o.prototype,`nodeType`):null,b=o&&o.prototype?R(o.prototype,`nodeName`):null,x=o&&o.prototype?R(o.prototype,`ownerDocument`):null,S=function(e){return y?y(e):e.nodeType},te=function(e){return b?b(e):e.nodeName};if(typeof a==`function`){let e=n.createElement(`template`);e.content&&e.content.ownerDocument&&(n=e.content.ownerDocument)}let C,w=``,T,re=!1,E=0,ie=function(){if(E>0)throw N(`A configured TRUSTED_TYPES_POLICY callback (createHTML or createScriptURL) must not call DOMPurify.sanitize, as that causes infinite recursion. Do not pass a policy whose callbacks wrap DOMPurify as TRUSTED_TYPES_POLICY; see the "DOMPurify and Trusted Types" section of the README.`)},k=function(e){ie(),E++;try{return C.createHTML(e)}finally{E--}},oe=function(e){ie(),E++;try{return C.createScriptURL(e)}finally{E--}},se=function(){return re||=(T=nt(u,i),!0),T},ye=n,be=ye.implementation,xe=ye.createNodeIterator,Se=ye.createDocumentFragment,Ce=ye.getElementsByTagName,P=r.importNode,F=rt();t.isSupported=typeof ne==`function`&&typeof g==`function`&&be&&be.createHTMLDocument!==void 0;let we=Re,Qe=ze,ot=Be,st=Ve,ct=He,lt=We,ut=Ge,dt=qe,ft=Ue,V=null,pt=I({},[...De,...Oe,...ke,...je,...Ne]),H=null,mt=I({},[...Pe,...Fe,...Ie,...Le]),U=Object.seal(ae(null,{tagNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeNameCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},allowCustomizedBuiltInElements:{writable:!0,configurable:!1,enumerable:!0,value:!1}})),ht=null,gt=null,W=Object.seal(ae(null,{tagCheck:{writable:!0,configurable:!1,enumerable:!0,value:null},attributeCheck:{writable:!0,configurable:!1,enumerable:!0,value:null}})),_t=!0,vt=!0,yt=!1,bt=!0,G=!1,K=!0,q=!1,xt=!1,St=null,Ct=null,wt=!1,Tt=!1,Et=!1,Dt=!1,Ot=!0,kt=!1,At=`user-content-`,jt=!0,Mt=!1,Nt={},Pt=null,Ft=I({},`annotation-xml.audio.colgroup.desc.foreignobject.head.iframe.math.mi.mn.mo.ms.mtext.noembed.noframes.noscript.plaintext.script.selectedcontent.style.svg.template.thead.title.video.xmp`.split(`.`)),It=null,Lt=I({},[`audio`,`video`,`img`,`source`,`image`,`track`]),Rt=null,zt=I({},[`alt`,`class`,`for`,`id`,`label`,`name`,`pattern`,`placeholder`,`role`,`summary`,`title`,`value`,`style`,`xmlns`]),Bt=`http://www.w3.org/1998/Math/MathML`,Vt=`http://www.w3.org/2000/svg`,J=`http://www.w3.org/1999/xhtml`,Ht=J,Ut=!1,Wt=null,Gt=I({},[Bt,Vt,J],me),Kt=D([`mi`,`mo`,`mn`,`ms`,`mtext`]),qt=I({},Kt),Jt=D([`annotation-xml`]),Yt=I({},Jt),Xt=I({},[`title`,`style`,`font`,`a`,`script`]),Zt=null,Qt=[`application/xhtml+xml`,`text/html`],Y=null,X=null,$t=n.createElement(`form`),en=function(e){return e instanceof RegExp||e instanceof Function},tn=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};if(X&&X===e)return;(!e||typeof e!=`object`)&&(e={}),e=L(e),Zt=Qt.indexOf(e.PARSER_MEDIA_TYPE)===-1?`text/html`:e.PARSER_MEDIA_TYPE,Y=Zt===`application/xhtml+xml`?me:pe,V=B(e,`ALLOWED_TAGS`,pt,{transform:Y}),H=B(e,`ALLOWED_ATTR`,mt,{transform:Y}),Wt=B(e,`ALLOWED_NAMESPACES`,Gt,{transform:me}),Rt=B(e,`ADD_URI_SAFE_ATTR`,zt,{transform:Y,base:zt}),It=B(e,`ADD_DATA_URI_TAGS`,Lt,{transform:Y,base:Lt}),Pt=B(e,`FORBID_CONTENTS`,Ft,{transform:Y}),ht=B(e,`FORBID_TAGS`,L({}),{transform:Y}),gt=B(e,`FORBID_ATTR`,L({}),{transform:Y}),Nt=j(e,`USE_PROFILES`)?e.USE_PROFILES&&typeof e.USE_PROFILES==`object`?L(e.USE_PROFILES):e.USE_PROFILES:!1,_t=e.ALLOW_ARIA_ATTR!==!1,vt=e.ALLOW_DATA_ATTR!==!1,yt=e.ALLOW_UNKNOWN_PROTOCOLS||!1,bt=e.ALLOW_SELF_CLOSE_IN_ATTR!==!1,G=e.SAFE_FOR_TEMPLATES||!1,K=e.SAFE_FOR_XML!==!1,q=e.WHOLE_DOCUMENT||!1,Tt=e.RETURN_DOM||!1,Et=e.RETURN_DOM_FRAGMENT||!1,Dt=e.RETURN_TRUSTED_TYPE||!1,wt=e.FORCE_BODY||!1,Ot=e.SANITIZE_DOM!==!1,kt=e.SANITIZE_NAMED_PROPS||!1,jt=e.KEEP_CONTENT!==!1,Mt=e.IN_PLACE||!1,ft=Ee(e.ALLOWED_URI_REGEXP)?e.ALLOWED_URI_REGEXP:Ue,Ht=typeof e.NAMESPACE==`string`?e.NAMESPACE:J,qt=it(e,`MATHML_TEXT_INTEGRATION_POINTS`,()=>I({},Kt)),Yt=it(e,`HTML_INTEGRATION_POINTS`,()=>I({},Jt));let t=it(e,`CUSTOM_ELEMENT_HANDLING`,()=>ae(null));if(U=ae(null),j(t,`tagNameCheck`)&&en(t.tagNameCheck)&&(U.tagNameCheck=t.tagNameCheck),j(t,`attributeNameCheck`)&&en(t.attributeNameCheck)&&(U.attributeNameCheck=t.attributeNameCheck),j(t,`allowCustomizedBuiltInElements`)&&typeof t.allowCustomizedBuiltInElements==`boolean`&&(U.allowCustomizedBuiltInElements=t.allowCustomizedBuiltInElements),O(U),G&&(vt=!1),Et&&(Tt=!0),Nt&&(V=I({},Ne),H=ae(null),Nt.html===!0&&(I(V,De),I(H,Pe)),Nt.svg===!0&&(I(V,Oe),I(H,Fe),I(H,Le)),Nt.svgFilters===!0&&(I(V,ke),I(H,Fe),I(H,Le)),Nt.mathMl===!0&&(I(V,je),I(H,Ie),I(H,Le))),W.tagCheck=null,W.attributeCheck=null,j(e,`ADD_TAGS`)&&(typeof e.ADD_TAGS==`function`?W.tagCheck=e.ADD_TAGS:fe(e.ADD_TAGS)&&(V===pt&&(V=L(V)),I(V,e.ADD_TAGS,Y))),j(e,`ADD_ATTR`)&&(typeof e.ADD_ATTR==`function`?W.attributeCheck=e.ADD_ATTR:fe(e.ADD_ATTR)&&(H===mt&&(H=L(H)),I(H,e.ADD_ATTR,Y))),j(e,`ADD_FORBID_CONTENTS`)&&fe(e.ADD_FORBID_CONTENTS)&&(Pt===Ft&&(Pt=L(Pt)),I(Pt,e.ADD_FORBID_CONTENTS,Y)),jt&&(V[`#text`]=!0),q&&I(V,[`html`,`head`,`body`]),V.table&&(I(V,[`tbody`]),delete ht.tbody),e.TRUSTED_TYPES_POLICY){if(typeof e.TRUSTED_TYPES_POLICY.createHTML!=`function`)throw N(`TRUSTED_TYPES_POLICY configuration option must provide a "createHTML" hook.`);if(typeof e.TRUSTED_TYPES_POLICY.createScriptURL!=`function`)throw N(`TRUSTED_TYPES_POLICY configuration option must provide a "createScriptURL" hook.`);let t=C;C=e.TRUSTED_TYPES_POLICY;try{w=k(``)}catch(e){throw C=t,e}}else e.TRUSTED_TYPES_POLICY===null?(C=void 0,w=``):(C===void 0&&(C=se()),C&&typeof w==`string`&&(w=k(``)));D&&D(e),X=e},nn=I({},[...Oe,...ke,...Ae]),rn=I({},[...je,...Me]),an=function(e,t,n){return t.namespaceURI===J?e===`svg`:t.namespaceURI===Bt?e===`svg`&&(n===`annotation-xml`||qt[n]):!!nn[e]},on=function(e,t,n){return t.namespaceURI===J?e===`math`:t.namespaceURI===Vt?e===`math`&&Yt[n]:!!rn[e]},sn=function(e,t,n){return t.namespaceURI===Vt&&!Yt[n]||t.namespaceURI===Bt&&!qt[n]?!1:!rn[e]&&(Xt[e]||!nn[e])},cn=function(e){let t=g(e);(!t||!t.tagName)&&(t={namespaceURI:Ht,tagName:`template`});let n=pe(e.tagName),r=pe(t.tagName);return Wt[e.namespaceURI]?e.namespaceURI===Vt?an(n,t,r):e.namespaceURI===Bt?on(n,t,r):e.namespaceURI===J?sn(n,t,r):!!(Zt===`application/xhtml+xml`&&Wt[e.namespaceURI]):!1},Z=function(e){ue(t.removed,{element:e});try{g(e).removeChild(e)}catch{if(p(e),!g(e))throw N(`a node selected for removal could not be detached from its tree and cannot be safely returned; refusing to sanitize in place`)}},ln=function(e,t,n){try{ee(e,t)}catch{try{e.removeAttribute(n)}catch{}}},un=function(e){fn(e);let t=h(e);if(t){let e=[];A(t,t=>{ue(e,t)}),A(e,e=>{try{p(e)}catch{}})}let n=v(e);if(n)for(let t=n.length-1;t>=0;--t){let r=n[t],i=r&&r.name;typeof i==`string`&&ln(e,r,i)}},Q=function(e,n,r){if(!r)try{r=n.getAttributeNode(e)}catch{r=null}ue(t.removed,{attribute:r||null,from:n});try{r?ee(n,r):n.removeAttribute(e)}catch{try{n.removeAttribute(e)}catch{}}if(e===`is`)if(Tt||Et)try{Z(n)}catch{}else try{n.setAttribute(e,``)}catch{}},dn=function(e){let t=v(e);if(t)for(let n=t.length-1;n>=0;--n){let r=t[n],i=r&&r.name;typeof i!=`string`||H[Y(i)]||ln(e,r,i)}},fn=function(e){let t=[e];for(;t.length>0;){let e=t.pop();S(e)===z.element&&dn(e);let n=h(e);if(n)for(let e=n.length-1;e>=0;--e)t.push(n[e])}},pn=function(e,t){return K?e===`patchsrc`?!0:e===`for`&&t!==`label`&&t!==`output`:!1},mn=function(e){if(!K)return;let t=[e];for(;t.length>0;){let e=t.pop(),n=S(e);if(n===z.processingInstruction||n===z.comment&&M(Ye,e.data)){try{p(e)}catch{}continue}if(n===z.element){let t=e,n=Y(te(e));try{t.hasAttribute&&t.hasAttribute(`patchsrc`)&&t.removeAttribute(`patchsrc`),t.hasAttribute&&t.hasAttribute(`for`)&&pn(`for`,n)&&t.removeAttribute(`for`)}catch{}}let r=h(e);if(r)for(let e=r.length-1;e>=0;--e)t.push(r[e])}},hn=function(e){let t=null,r=null;if(wt)e=`<remove></remove>`+e;else{let t=he(e,/^[\r\n\t ]+/);r=t&&t[0]}Zt===`application/xhtml+xml`&&Ht===J&&(e=`<html xmlns="http://www.w3.org/1999/xhtml"><head></head><body>`+e+`</body></html>`);let i=C?k(e):e;if(Ht===J)try{t=new l().parseFromString(i,Zt)}catch{}if(!t||!t.documentElement){t=be.createDocument(Ht,`template`,null);try{t.documentElement.innerHTML=Ut?w:i}catch{}}let a=t.body||t.documentElement;return e&&r&&a.insertBefore(n.createTextNode(r),a.childNodes[0]||null),Ht===J?Ce.call(t,q?`html`:`body`)[0]:q?t.documentElement:a},gn=function(e){let t=x?x(e):e.ownerDocument;return xe.call(t||e,e,c.SHOW_ELEMENT|c.SHOW_COMMENT|c.SHOW_TEXT|c.SHOW_PROCESSING_INSTRUCTION|c.SHOW_CDATA_SECTION,null)},_n=function(e){return e=ge(e,we,` `),e=ge(e,Qe,` `),e=ge(e,ot,` `),e},vn=function(e){e.normalize();let t=x?x(e):e.ownerDocument,n=xe.call(t||e,e,c.SHOW_TEXT|c.SHOW_COMMENT|c.SHOW_CDATA_SECTION|c.SHOW_PROCESSING_INSTRUCTION,null),r=n.nextNode();for(;r;)r.data=_n(r.data),r=n.nextNode();let i=e.querySelectorAll?.call(e,`template`);i&&A(i,e=>{bn(e.content)&&vn(e.content)})},yn=function(e){let t=b?b(e):null;return typeof t!=`string`||Y(t)!==`form`?!1:typeof e.nodeName!=`string`||typeof e.textContent!=`string`||typeof e.removeChild!=`function`||e.attributes!==v(e)||typeof e.removeAttribute!=`function`||typeof e.removeAttributeNode!=`function`||typeof e.getAttributeNode!=`function`||typeof e.setAttribute!=`function`||typeof e.namespaceURI!=`string`||typeof e.insertBefore!=`function`||typeof e.hasChildNodes!=`function`||e.nodeType!==y(e)||e.childNodes!==h(e)},bn=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return y(e)===z.documentFragment}catch{return!1}},xn=function(e){if(!y||typeof e!=`object`||!e)return!1;try{return typeof y(e)==`number`}catch{return!1}};function $(e,n,r){e.length!==0&&A(e,e=>{e.call(t,n,r,X)})}let Sn=function(e,t){return!!(K&&e.hasChildNodes()&&!xn(e.firstElementChild)&&M(Je,e.textContent)&&M(Je,e.innerHTML)||K&&e.namespaceURI===J&&$e[t]&&(xn(e.firstElementChild)||typeof e.textContent==`string`&&M(et[t],e.textContent))||e.nodeType===z.processingInstruction||K&&e.nodeType===z.comment&&M(Ye,e.data))},Cn=function(e,t){return e instanceof RegExp?M(e,t):e instanceof Function?!!e(t,...[...arguments].slice(2)):!1},wn=function(e,t,n){if(!ht[t]&&An(t)&&Cn(U.tagNameCheck,t))return!1;if(jt&&!Pt[t]){let t=g(e),r=h(e);if(r&&t){let i=r.length;for(let a=i-1;a>=0;--a){let i=e===n?f(r[a],!0):r[a];t.insertBefore(i,m(e))}}}return Z(e),!0},Tn=function(e,t,n,r){return e.length===0?t:t===n||t===r?L(t):t},En=function(e,t){return e===t||g(e)!==null?!1:(Mt&&fn(e),!0)},Dn=function(e,n){if($(F.beforeSanitizeElements,e,null),En(e,n))return!0;if(yn(e))return Z(e),!0;let r=Y(te(e));if(V=Tn(F.uponSanitizeElement,V,pt,St),$(F.uponSanitizeElement,e,{tagName:r,allowedTags:V}),En(e,n))return!0;if(Sn(e,r))return Z(e),!0;if(ht[r]||!(W.tagCheck instanceof Function&&W.tagCheck(r))&&!V[r]){let t=wn(e,r,n);return t===!1&&($(F.afterSanitizeElements,e,null),En(e,n))?!0:t}if(S(e)===z.element&&!cn(e)||(r===`noscript`||r===`noembed`||r===`noframes`)&&M(Xe,e.innerHTML))return Z(e),!0;if(G&&e.nodeType===z.text){let n=_n(e.textContent);e.textContent!==n&&(ue(t.removed,{element:e.cloneNode()}),e.textContent=n)}return $(F.afterSanitizeElements,e,null),En(e,n)},On=function(e,t,r){if(gt[t]||pn(t,e)||Ot&&(t===`id`||t===`name`)&&(r in n||r in $t))return!1;let i=H[t]||W.attributeCheck instanceof Function&&W.attributeCheck(t,e);return vt&&M(st,t)||_t&&M(ct,t)?!0:i?Rt[t]||M(ft,ge(r,ut,``))||(t===`src`||t===`xlink:href`||t===`href`)&&e!==`script`&&_e(r,`data:`)===0&&It[e]||yt&&!M(lt,ge(r,ut,``))?!0:!r:An(e)&&Cn(U.tagNameCheck,e)&&Cn(U.attributeNameCheck,t,e)||t===`is`&&U.allowCustomizedBuiltInElements&&Cn(U.tagNameCheck,r)},kn=I({},[`annotation-xml`,`color-profile`,`font-face`,`font-face-format`,`font-face-name`,`font-face-src`,`font-face-uri`,`missing-glyph`]),An=function(e){return!kn[pe(e)]&&M(dt,e)},jn=function(e,t,n,r){if(C&&typeof u==`object`&&typeof u.getAttributeType==`function`&&!n)switch(u.getAttributeType(e,t)){case`TrustedHTML`:return k(r);case`TrustedScriptURL`:return oe(r)}return r},Mn=function(e,t,n,r){try{return n?e.setAttributeNS(n,t,r):e.setAttribute(t,r),yn(e)?(Z(e),!1):!0}catch{return Q(t,e),!1}},Nn=function(e,n){if($(F.beforeSanitizeAttributes,e,null),En(e,n))return;let r=e.attributes;if(!r||yn(e))return;H=Tn(F.uponSanitizeAttribute,H,mt,Ct);let i={attrName:``,attrValue:``,keepAttr:!0,allowedAttributes:H,forceKeepAttr:void 0},a=r.length,o=Y(e.nodeName);for(;a--;){let n=r[a],s=n.name,c=n.namespaceURI,l=n.value,u=Y(s),d=l,f=s===`value`?d:ve(d),p=!1;if(i.attrName=u,i.attrValue=f,i.keepAttr=!0,i.forceKeepAttr=void 0,$(F.uponSanitizeAttribute,e,i),f=i.attrValue,kt&&(u===`id`||u===`name`)&&_e(f,At)!==0&&(Q(s,e,n),f=At+f,p=!0),K&&M(/((--!?|])>)|<\/(style|script|title|xmp|textarea|noscript|iframe|noembed|noframes)/i,f)){Q(s,e,n);continue}if(u===`attributename`&&he(f,`href`)){Q(s,e,n);continue}if(!i.forceKeepAttr){if(!i.keepAttr){Q(s,e,n);continue}if(!bt&&M(Ze,f)){Q(s,e,n);continue}if(G&&(f=_n(f)),!On(o,u,f)){Q(s,e,n);continue}f=jn(o,u,c,f),f!==d&&Mn(e,s,c,f)&&p&&le(t.removed)}}$(F.afterSanitizeAttributes,e,null),En(e,n)},Pn=function(e){let t=null,n=gn(e);for($(F.beforeSanitizeShadowDOM,e,null);t=n.nextNode();)if($(F.uponSanitizeShadowNode,t,null),Dn(t,e),Nn(t,e),bn(t.content)&&Pn(t.content),S(t)===z.element){let e=_(t);bn(e)&&(Fn(e),Pn(e))}$(F.afterSanitizeShadowDOM,e,null)},Fn=function(e){let t=[{node:e,shadow:null}];for(;t.length>0;){let e=t.pop();if(e.shadow){Pn(e.shadow);continue}let n=e.node,r=S(n)===z.element,i=h(n);if(i)for(let e=i.length-1;e>=0;--e)t.push({node:i[e],shadow:null});if(r){let e=b?b(n):null;if(typeof e==`string`&&Y(e)===`template`){let e=n.content;bn(e)&&t.push({node:e,shadow:null})}}if(r){let e=_(n);bn(e)&&t.push({node:null,shadow:e},{node:e,shadow:null})}}};return t.sanitize=function(e){let n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=null,a=null,o=null,s=null;if(Ut=!e,Ut&&(e=`<!-->`),typeof e!=`string`&&!xn(e)&&(e=Te(e),typeof e!=`string`))throw N(`dirty is not a string, aborting`);if(!t.isSupported)return e;xt?(V=St,H=Ct):tn(n),(F.uponSanitizeElement.length>0||F.uponSanitizeAttribute.length>0)&&(V=L(V)),F.uponSanitizeAttribute.length>0&&(H=L(H)),t.removed=[];let c=Mt&&typeof e!=`string`&&xn(e);if(c){mn(e);let t=te(e);if(typeof t==`string`){let n=Y(t);if(!V[n]||ht[n])throw un(e),N(`root node is forbidden and cannot be sanitized in-place`)}if(yn(e))throw un(e),N(`root node is clobbered and cannot be sanitized in-place`);try{Fn(e)}catch(t){throw un(e),t}}else if(xn(e))i=hn(`<!---->`),a=i.ownerDocument.importNode(e,!0),a.nodeType===z.element&&a.nodeName===`BODY`||a.nodeName===`HTML`?i=a:i.appendChild(a),Fn(i);else{if(!Tt&&!G&&!q&&e.indexOf(`<`)===-1)return C&&Dt?k(e):e;if(i=hn(e),!i)return Tt?null:Dt?w:``}i&&wt&&Z(i.firstChild);let l=c?e:i;try{let e=gn(l);for(;o=e.nextNode();)Dn(o,l),Nn(o,l),bn(o.content)&&Pn(o.content)}catch(n){throw c&&(un(e),A(t.removed,e=>{e.element&&fn(e.element)})),n}if(c){let n=!1;if(A(t.removed,t=>{t.element&&(t.element===e&&(n=!0),fn(t.element))}),n)throw N(`a node selected for removal could not be safely returned; refusing to sanitize in place`);return G&&vn(e),e}if(Tt){if(G&&vn(i),Et)for(s=Se.call(i.ownerDocument);i.firstChild;)s.appendChild(i.firstChild);else s=i;return(H.shadowroot||H.shadowrootmode)&&(s=P.call(r,s,!0)),s}let u=q?i.outerHTML:i.innerHTML;return q&&V[`!doctype`]&&i.ownerDocument&&i.ownerDocument.doctype&&i.ownerDocument.doctype.name&&M(Ke,i.ownerDocument.doctype.name)&&(u=`<!DOCTYPE `+i.ownerDocument.doctype.name+`>
|
|
3
|
-
`+u),G&&(u=_n(u)),C&&Dt?k(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tn(e),xt=!0,St=V,Ct=H},t.clearConfig=function(){X=null,xt=!1,St=null,Ct=null,C=T,w=``},t.isValidAttribute=function(e,t,n){X||tn({});let r=Y(e),i=Y(t);return On(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&j(F,e)&&ue(F[e],t)},t.removeHook=function(e,t){if(j(F,e)){if(t!==void 0){let n=ce(F[e],t);return n===-1?void 0:de(F[e],n,1)[0]}return le(F[e])}},t.removeHooks=function(e){j(F,e)&&(F[e]=[])},t.removeAllHooks=function(){F=rt()},t}var ot=at(),st=[`http:`,`https:`,`mailto:`];function ct(e){try{let t=new URL(e);return st.includes(t.protocol)}catch{return!1}}function lt(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function ut(e){return ot.sanitize(e)}function dt(e){let t=[`platform.twitter.com`,`platform.x.com`],n=!1;try{let r=new URL(e.getAttribute(`src`)||``);n=r.protocol===`https:`&&t.includes(r.hostname)}catch{n=!1}if(!n){e.parentNode?.removeChild(e);return}e.textContent=``}function ft(e){let t=!1;try{let n=new URL(e.getAttribute(`src`)||``,window.location.href);t=(n.protocol===`https:`||n.protocol===`http:`)&&n.origin!==window.location.origin}catch{t=!1}if(!t){e.parentNode?.removeChild(e);return}e.setAttribute(`sandbox`,`allow-scripts allow-same-origin allow-popups allow-presentation allow-forms`)}var V=ot(window);V.addHook(`uponSanitizeElement`,(e,t)=>{let n=e;t.tagName===`script`?dt(n):t.tagName===`iframe`&&ft(n)});function pt(e){return V.sanitize(e,{ADD_TAGS:[`iframe`,`script`],ADD_ATTR:[`target`,`frameborder`,`allowfullscreen`,`async`,`charset`,`sandbox`],FORCE_BODY:!0})}function H(e,t=[]){if(t.length===0)return e.replace(/<br\s*\/?>/gi,` `).replace(/<\/p>\s*<p>|<\/div>\s*<div>|<\/h[1-6]>\s
|
|
3
|
+
`+u),G&&(u=_n(u)),C&&Dt?k(u):u},t.setConfig=function(){let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};tn(e),xt=!0,St=V,Ct=H},t.clearConfig=function(){X=null,xt=!1,St=null,Ct=null,C=T,w=``},t.isValidAttribute=function(e,t,n){X||tn({});let r=Y(e),i=Y(t);return On(r,i,n)},t.addHook=function(e,t){typeof t==`function`&&j(F,e)&&ue(F[e],t)},t.removeHook=function(e,t){if(j(F,e)){if(t!==void 0){let n=ce(F[e],t);return n===-1?void 0:de(F[e],n,1)[0]}return le(F[e])}},t.removeHooks=function(e){j(F,e)&&(F[e]=[])},t.removeAllHooks=function(){F=rt()},t}var ot=at(),st=[`http:`,`https:`,`mailto:`];function ct(e){try{let t=new URL(e);return st.includes(t.protocol)}catch{return!1}}function lt(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function ut(e){return ot.sanitize(e)}function dt(e){let t=[`platform.twitter.com`,`platform.x.com`],n=!1;try{let r=new URL(e.getAttribute(`src`)||``);n=r.protocol===`https:`&&t.includes(r.hostname)}catch{n=!1}if(!n){e.parentNode?.removeChild(e);return}e.textContent=``}function ft(e){let t=!1;try{let n=new URL(e.getAttribute(`src`)||``,window.location.href);t=(n.protocol===`https:`||n.protocol===`http:`)&&n.origin!==window.location.origin}catch{t=!1}if(!t){e.parentNode?.removeChild(e);return}e.setAttribute(`sandbox`,`allow-scripts allow-same-origin allow-popups allow-presentation allow-forms`)}var V=ot(window);V.addHook(`uponSanitizeElement`,(e,t)=>{let n=e;t.tagName===`script`?dt(n):t.tagName===`iframe`&&ft(n)});function pt(e){return V.sanitize(e,{ADD_TAGS:[`iframe`,`script`],ADD_ATTR:[`target`,`frameborder`,`allowfullscreen`,`async`,`charset`,`sandbox`],FORCE_BODY:!0})}function H(e,t=[]){if(t.length===0)return e.replace(/<br\s*\/?>/gi,` `).replace(/<\/p>\s*<p>|<\/div>\s*<div>|<\/h[1-6]>\s*(?=<)|<\/li>\s*<li>|<\/a>/gi,` `).replace(/<[^>]*>/g,``).replace(/\s+/g,` `).trim();let n=t.map(e=>e.toLowerCase()),r={},i=0,a=e.replace(/<\/(h[1-6]|p|div|li|blockquote|pre)>/gi,`<br>`);for(let e of n){let t=RegExp(`<${e}[^>]*>.*?<\\/${e}>|<${e}[^>]*\\/?>`,`gis`);a=a.replace(t,e=>{let t=`__EXCLUDED_TAG_${i+=1}__`;return r[t]=e,t})}let o=a;n.includes(`br`)||(o=a.replace(/<br\s*\/?>/gi,` `));let s=o.replace(/<[^>]*>/g,``).replace(/\s+/g,` `).trim();for(let[e,t]of Object.entries(r))s=s.replace(e,t);return s}var mt=e=>{let t=document.createElement(`div`);t.innerHTML=e;let n=t.getElementsByTagName(`a`);for(let e=0;e<n.length;e++)(n[e].getAttribute(`href`)||``).match(/^\s*(javascript|data|vbscript):/i)&&n[e].removeAttribute(`href`),n[e].setAttribute(`target`,`_blank`),n[e].setAttribute(`rel`,`noopener noreferrer`);return t.innerHTML},U=e=>{let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelectorAll(`.kg-video-card video`);for(let e=0;e<n.length;e++){let t=n[e];t.setAttribute(`playsinline`,``),t.setAttribute(`webkit-playsinline`,``),t.setAttribute(`x5-playsinline`,``),t.hasAttribute(`autoplay`)&&(t.setAttribute(`muted`,``),t.muted=!0)}return t.innerHTML};export{pt as a,ot as c,mt as i,_ as l,lt as n,ut as o,ct as r,H as s,U as t,ee as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`cae1b8d2-da13-46dc-931e-e8710fcc8711`,e._sentryDebugIdIdentifier=`sentry-dbid-cae1b8d2-da13-46dc-931e-e8710fcc8711`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{L as r,O as i,c as a,j as o,u as s,w as c}from"./shade-provider-DvrXKKQZ.js";import{or as l,qn as u,rr as d}from"./button-CTHYSI-d.js";import{At as f,Ct as p,Dt as ee,Et as te,Ft as m,Mt as ne,Nt as re,Ot as ie,Pt as ae,St as oe,Tt as se,bt as ce,jt as le,kt as ue,wt as de,xt as fe,yt as h}from"./index-
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`cae1b8d2-da13-46dc-931e-e8710fcc8711`,e._sentryDebugIdIdentifier=`sentry-dbid-cae1b8d2-da13-46dc-931e-e8710fcc8711`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{L as r,O as i,c as a,j as o,u as s,w as c}from"./shade-provider-DvrXKKQZ.js";import{or as l,qn as u,rr as d}from"./button-CTHYSI-d.js";import{At as f,Ct as p,Dt as ee,Et as te,Ft as m,Mt as ne,Nt as re,Ot as ie,Pt as ae,St as oe,Tt as se,bt as ce,jt as le,kt as ue,wt as de,xt as fe,yt as h}from"./index-RuRs_qGS.js";var g=e(t(),1),_=n(),v=`ContextMenu`,[pe,me]=i(v,[m]),y=m(),[he,b]=pe(v),x=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,dir:a,modal:o=!0}=e,c=g.useRef(!1);{let e=g.useRef(!1);g.useEffect(()=>{i===!0&&!c.current&&!e.current&&(e.current=!0,console.warn("ContextMenu: The `open` prop has been set to `true` before the user has interacted with the trigger, so its position is indeterminate. This is likely unintended and will result in the menu being anchored to the top-left corner of the viewport."))},[i])}let[l,u]=s({prop:i,defaultProp:!1,onChange:r,caller:v}),d=y(t);return(0,_.jsx)(he,{scope:t,open:l,onOpenChange:u,modal:o,hasInteractedRef:c,children:(0,_.jsx)(f,{...d,dir:a,open:l,onOpenChange:u,modal:o,children:n})})};x.displayName=v;var S=`ContextMenuTrigger`,C=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,disabled:r=!1,...i}=e,a=b(S,n),s=y(n),l=g.useRef({x:0,y:0}),u=g.useRef({getBoundingClientRect:()=>DOMRect.fromRect({width:0,height:0,...l.current})}),d=g.useRef(0),f=g.useCallback(()=>window.clearTimeout(d.current),[]),p=e=>{a.hasInteractedRef.current=!0,l.current={x:e.clientX,y:e.clientY},a.onOpenChange(!0)};return g.useEffect(()=>f,[f]),g.useEffect(()=>void(r&&f()),[r,f]),(0,_.jsxs)(_.Fragment,{children:[(0,_.jsx)(h,{...s,virtualRef:u}),(0,_.jsx)(c.span,{"data-state":a.open?`open`:`closed`,"data-disabled":r?``:void 0,...i,ref:t,style:{WebkitTouchCallout:`none`,...e.style},onContextMenu:r?e.onContextMenu:o(e.onContextMenu,e=>{f(),p(e),e.preventDefault()}),onPointerDown:r?e.onPointerDown:o(e.onPointerDown,B(e=>{f(),a.open&&a.onOpenChange(!1),d.current=window.setTimeout(()=>p(e),700)})),onPointerMove:r?e.onPointerMove:o(e.onPointerMove,B(f)),onPointerCancel:r?e.onPointerCancel:o(e.onPointerCancel,B(f)),onPointerUp:r?e.onPointerUp:o(e.onPointerUp,B(f))})]})});C.displayName=S;var ge=`ContextMenuPortal`,w=e=>{let{__scopeContextMenu:t,...n}=e,r=y(t);return(0,_.jsx)(ee,{...r,...n})};w.displayName=ge;var T=`ContextMenuContent`,E=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=b(T,n),a=y(n),o=g.useRef(!1);return(0,_.jsx)(oe,{...a,...r,ref:t,side:`right`,sideOffset:2,align:`start`,onCloseAutoFocus:t=>{e.onCloseAutoFocus?.(t),!t.defaultPrevented&&o.current&&t.preventDefault(),o.current=!1},onInteractOutside:t=>{e.onInteractOutside?.(t),!t.defaultPrevented&&!i.modal&&(o.current=!0)},style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});E.displayName=T;var _e=`ContextMenuGroup`,ve=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=y(n);return(0,_.jsx)(p,{...i,...r,ref:t})});ve.displayName=_e;var ye=`ContextMenuLabel`,D=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=y(n);return(0,_.jsx)(te,{...i,...r,ref:t})});D.displayName=ye;var be=`ContextMenuItem`,O=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=y(n);return(0,_.jsx)(de,{...i,...r,ref:t})});O.displayName=be;var k=`ContextMenuCheckboxItem`,A=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=y(n);return(0,_.jsx)(fe,{...i,...r,ref:t})});A.displayName=k;var j=`ContextMenuRadioGroup`,M=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=y(n);return(0,_.jsx)(ie,{...i,...r,ref:t})});M.displayName=j;var N=`ContextMenuRadioItem`,P=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=y(n);return(0,_.jsx)(ue,{...i,...r,ref:t})});P.displayName=N;var xe=`ContextMenuItemIndicator`,F=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=y(n);return(0,_.jsx)(se,{...i,...r,ref:t})});F.displayName=xe;var Se=`ContextMenuSeparator`,I=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=y(n);return(0,_.jsx)(le,{...i,...r,ref:t})});I.displayName=Se;var Ce=`ContextMenuArrow`,we=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=y(n);return(0,_.jsx)(ce,{...i,...r,ref:t})});we.displayName=Ce;var L=`ContextMenuSub`,Te=e=>{let{__scopeContextMenu:t,children:n,onOpenChange:r,open:i,defaultOpen:a}=e,o=y(t),[c,l]=s({prop:i,defaultProp:a??!1,onChange:r,caller:L});return(0,_.jsx)(ne,{...o,open:c,onOpenChange:l,children:n})};Te.displayName=L;var Ee=`ContextMenuSubTrigger`,R=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=y(n);return(0,_.jsx)(ae,{...i,...r,ref:t})});R.displayName=Ee;var De=`ContextMenuSubContent`,z=g.forwardRef((e,t)=>{let{__scopeContextMenu:n,...r}=e,i=y(n);return(0,_.jsx)(re,{...i,...r,ref:t,style:{...e.style,"--radix-context-menu-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-context-menu-content-available-width":`var(--radix-popper-available-width)`,"--radix-context-menu-content-available-height":`var(--radix-popper-available-height)`,"--radix-context-menu-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-context-menu-trigger-height":`var(--radix-popper-anchor-height)`}})});z.displayName=De;function B(e){return t=>t.pointerType===`mouse`?void 0:e(t)}var Oe=x,ke=C,Ae=w,V=E,H=D,U=O,W=A,G=P,K=F,q=I,J=R,Y=z,je=Oe,Me=ke,Ne=g.forwardRef(({className:e,inset:t,children:n,...i},a)=>(0,_.jsxs)(J,{ref:a,className:r(`flex cursor-default items-center gap-2 rounded-menu-item px-2 py-1.5 text-sm outline-hidden select-none hover:bg-accent focus:bg-accent data-[state=open]:bg-accent [&_svg]:pointer-events-none [&_svg]:size-4 [&_svg]:shrink-0`,t&&`pl-8`,e),...i,children:[n,(0,_.jsx)(d,{className:`ml-auto`})]}));Ne.displayName=J.displayName;var X=g.forwardRef(({className:e,...t},n)=>(0,_.jsx)(a,{children:(0,_.jsx)(Y,{ref:n,className:r(`z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-lg data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...t})}));X.displayName=Y.displayName;var Z=g.forwardRef(({className:e,...t},n)=>(0,_.jsx)(Ae,{children:(0,_.jsx)(a,{children:(0,_.jsx)(V,{ref:n,className:r(`z-50 min-w-[8rem] overflow-hidden rounded-menu border bg-popover p-1 text-popover-foreground shadow-md`,`data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[state=open]:animate-in data-[state=open]:fade-in-0 data-[state=open]:zoom-in-95`,e),...t})})}));Z.displayName=V.displayName;var Q=g.forwardRef(({className:e,inset:t,variant:n=`default`,...i},a)=>(0,_.jsx)(U,{ref:a,className:r(`relative flex cursor-pointer items-center gap-2 rounded-menu-item px-2 py-1.5 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50 [&>svg]:size-4 [&>svg]:shrink-0`,n===`destructive`&&`text-destructive focus:bg-destructive/10 focus:text-destructive`,t&&`pl-8`,e),...i}));Q.displayName=U.displayName;var Pe=g.forwardRef(({className:e,children:t,checked:n,...i},a)=>(0,_.jsxs)(W,{ref:a,checked:n,className:r(`relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...i,children:[(0,_.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,_.jsx)(K,{children:(0,_.jsx)(l,{className:`size-4`})})}),t]}));Pe.displayName=W.displayName;var Fe=g.forwardRef(({className:e,children:t,...n},i)=>(0,_.jsxs)(G,{ref:i,className:r(`relative flex cursor-default items-center rounded-menu-item py-1.5 pr-2 pl-8 text-sm outline-hidden transition-colors select-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,e),...n,children:[(0,_.jsx)(`span`,{className:`absolute left-2 flex size-3.5 items-center justify-center`,children:(0,_.jsx)(K,{children:(0,_.jsx)(u,{className:`size-2 fill-current`})})}),t]}));Fe.displayName=G.displayName;var Ie=g.forwardRef(({className:e,inset:t,...n},i)=>(0,_.jsx)(H,{ref:i,className:r(`px-2 py-1.5 text-sm font-semibold`,t&&`pl-8`,e),...n}));Ie.displayName=H.displayName;var $=g.forwardRef(({className:e,...t},n)=>(0,_.jsx)(q,{ref:n,className:r(`-mx-1 my-1 h-px bg-muted`,e),...t}));$.displayName=q.displayName;var Le=({className:e,...t})=>(0,_.jsx)(`span`,{className:r(`ml-auto text-xs tracking-wider opacity-60`,e),...t});Le.displayName=`ContextMenuShortcut`;export{Me as a,$ as i,Z as n,Q as r,je as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`b0224153-9532-4711-b981-a1caa5813be5`,e._sentryDebugIdIdentifier=`sentry-dbid-b0224153-9532-4711-b981-a1caa5813be5`)}catch{}})();import{t as e}from"./jsx-runtime-Bm2_KH-0.js";import{Ht as t,N as n,S as r}from"./button-CTHYSI-d.js";import{h as i}from"./member-custom-fields-CBdiwPD9.js";var a=e(),o={short_text:r,long_text:n,address:t},s=({type:e,className:t})=>(0,a.jsx)(o[e]||r,{className:t});function c({type:e}){return(0,a.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,a.jsx)(`span`,{className:`flex w-5 shrink-0 items-center justify-center`,children:(0,a.jsx)(s,{className:`size-4`,type:e})}),(0,a.jsx)(`span`,{children:i(e).label})]})}export{s as n,c as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`ed5ee12e-cac5-4e2d-aa4b-604964894f75`,e._sentryDebugIdIdentifier=`sentry-dbid-ed5ee12e-cac5-4e2d-aa4b-604964894f75`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{g as n,m as r,n as i}from"./hooks-C-BDQ6Hs.js";import{t as a}from"./jsx-runtime-Bm2_KH-0.js";import{n as o}from"./dist-pogVoW2G.js";import{t as s}from"./use-form-ElCUnbKi.js";import{h as c}from"./chunk-OB3PAWPO-D3muQBsq.js";import{H as l}from"./shade-provider-DvrXKKQZ.js";import{t as u}from"./box-BOIwAOVT.js";import{t as d}from"./inline-Qoyy4r2g.js";import{t as f}from"./stack-C3OmgpUv.js";import{D as p,dt as m,o as h,t as g}from"./button-CTHYSI-d.js";import{t as _}from"./empty-indicator-BhVwqSVH.js";import{a as v,i as y,o as b,t as x}from"./field-DCPPrQDr.js";import{a as ee,c as S,i as C,n as w,o as T,r as E,s as te,t as D}from"./images-BSUWxquu.js";import{t as O}from"./input-BHb2A_DU.js";import{a as k,i as A,n as j,o as M,r as N,s as P,t as F}from"./select-DeloOYCg.js";import{a as I,c as L,n as ne,r as R,s as re,t as z}from"./table-DQ63Yu4a.js";import{t as B}from"./settings-modal-3x4v8abr.js";import{st as V}from"./index-CuDhPtkB.js";import{t as H}from"./validator-DgUCXsE8.js";import{t as U}from"./use-settings-navigation-CO2nUqDW.js";import{n as W}from"./confirmation-context-By_jX_cA.js";import{a as G,n as K,t as q}from"./integrations-BRo5DwA5.js";import{t as J}from"./api-keys-COZMaKEL.js";import{t as Y}from"./api-keys-CoeerpwI.js";var X=e(t(),1),ie=e(H(),1),Z=[{label:`Global`,options:[{value:`site.changed`,label:`Site changed (rebuild)`}]},{label:`Posts`,options:[{value:`post.added`,label:`Post created`},{value:`post.deleted`,label:`Post deleted`},{value:`post.edited`,label:`Post updated`},{value:`post.published`,label:`Post published`},{value:`post.published.edited`,label:`Published post updated`},{value:`post.unpublished`,label:`Post unpublished`},{value:`post.scheduled`,label:`Post scheduled`},{value:`post.unscheduled`,label:`Post unscheduled`},{value:`post.tag.attached`,label:`Tag added to post`},{value:`post.tag.detached`,label:`Tag removed from post`}]},{label:`Pages`,options:[{value:`page.added`,label:`Page created`},{value:`page.deleted`,label:`Page deleted`},{value:`page.edited`,label:`Page updated`},{value:`page.published`,label:`Page published`},{value:`page.published.edited`,label:`Published page updated`},{value:`page.unpublished`,label:`Page unpublished`},{value:`page.tag.attached`,label:`Tag added to page`},{value:`page.tag.detached`,label:`Tag removed from page`}]},{label:`Tags`,options:[{value:`tag.added`,label:`Tag created`},{value:`tag.edited`,label:`Tag updated`},{value:`tag.deleted`,label:`Tag deleted`}]},{label:`Members`,options:[{value:`member.added`,label:`Member added`},{value:`member.edited`,label:`Member updated`},{value:`member.deleted`,label:`Member deleted`}]}],ae=e=>Z.flatMap(({options:e})=>e).find(t=>t.value===e)?.label,oe=i({method:`POST`,path:()=>`/webhooks/`,body:e=>({webhooks:[e]}),updateQueries:{dataType:q,emberUpdateType:`createOrUpdate`,update:(e,t)=>t&&{...t,integrations:t.integrations.map(t=>{let n=e.webhooks[0];return n.integration_id===t.id?{...t,webhooks:[...t.webhooks||[],n]}:t})}}}),se=i({method:`PUT`,path:e=>`/webhooks/${e.id}/`,body:e=>({webhooks:[e]}),updateQueries:{dataType:q,emberUpdateType:`createOrUpdate`,update:(e,t)=>t&&{...t,integrations:t.integrations.map(t=>({...t,webhooks:t.webhooks?.map(t=>t.id===e.webhooks[0].id?e.webhooks[0]:t)}))}}}),ce=i({method:`DELETE`,path:e=>`/webhooks/${e}/`,updateQueries:{dataType:q,emberUpdateType:`createOrUpdate`,update:(e,t,n)=>({...t,integrations:t.integrations.map(e=>({...e,webhooks:e.webhooks?.filter(e=>e.id!==n)}))})}}),Q=a(),$=({webhook:e,integrationId:t,onClose:r})=>{let i=X.useId(),{mutateAsync:a}=oe(),{mutateAsync:o}=se(),c=n(),{formState:l,updateForm:u,handleSave:d,errors:f,clearError:p}=s({initialState:e||{},onSave:async()=>{l.id?await o(l):await a({...l,integration_id:t})},onSaveError:c,onValidate:()=>{let e={};return l.name||(e.name=`Enter a name`),l.event||(e.event=`Select an event`),l.target_url||(e.target_url=`Enter a target URL`),l.target_url&&!ie.default.isURL(l.target_url,{require_tld:!1})&&(e.target_url=`Enter a valid URL`),e}});return(0,Q.jsx)(B,{okLabel:e?`Update`:`Add`,okVariant:`default`,size:`sm`,testId:`webhook-modal`,title:`Add webhook`,formSheet:!0,onClose:r,onOk:async()=>{await d()&&r()},children:(0,Q.jsx)(`div`,{className:`mt-5`,children:(0,Q.jsxs)(v,{className:`gap-8`,children:[(0,Q.jsxs)(x,{"data-invalid":!!f.name||void 0,children:[(0,Q.jsx)(b,{htmlFor:`webhook-name`,children:`Name`}),(0,Q.jsx)(O,{"aria-invalid":!!f.name||void 0,id:`webhook-name`,maxLength:191,placeholder:`Custom webhook`,value:l.name??``,onChange:e=>u(t=>({...t,name:e.target.value})),onKeyDown:()=>p(`name`)}),f.name&&(0,Q.jsx)(y,{children:f.name})]}),(0,Q.jsxs)(x,{"data-invalid":!!f.event||void 0,children:[(0,Q.jsx)(b,{className:`sr-only`,children:`Event`}),(0,Q.jsxs)(F,{value:l.event??``,onValueChange:e=>{u(t=>({...t,event:e})),p(`event`)},children:[(0,Q.jsx)(M,{"aria-describedby":f.event?i:void 0,"aria-invalid":!!f.event||void 0,"aria-label":`Event`,"data-testid":`event-select`,children:(0,Q.jsx)(P,{placeholder:`Select an event`})}),(0,Q.jsx)(j,{children:Z.map(e=>(0,Q.jsxs)(N,{children:[(0,Q.jsx)(k,{children:e.label}),e.options.map(e=>(0,Q.jsx)(A,{value:e.value,children:e.label},e.value))]},e.label))})]}),f.event&&(0,Q.jsx)(y,{id:i,children:f.event})]}),(0,Q.jsxs)(x,{"data-invalid":!!f.target_url||void 0,children:[(0,Q.jsx)(b,{htmlFor:`webhook-target-url`,children:`Target URL`}),(0,Q.jsx)(O,{"aria-invalid":!!f.target_url||void 0,id:`webhook-target-url`,maxLength:2e3,placeholder:`https://example.com`,type:`url`,value:l.target_url??``,onChange:e=>u(t=>({...t,target_url:e.target.value})),onKeyDown:()=>p(`target_url`)}),f.target_url&&(0,Q.jsx)(y,{children:f.target_url})]}),(0,Q.jsxs)(x,{children:[(0,Q.jsx)(b,{htmlFor:`webhook-secret`,children:`Secret`}),(0,Q.jsx)(O,{id:`webhook-secret`,maxLength:191,placeholder:`https://example.com`,value:l.secret||``,onChange:e=>u(t=>({...t,secret:e.target.value}))})]})]})})})},le=({integration:e})=>{let{mutateAsync:t}=ce(),r=n(),{confirm:i}=W(),a=e.webhooks||[],[s,c]=(0,X.useState)(null),[u,p]=(0,X.useState)(!1),v=()=>{p(!0)},y=()=>{p(!1),c(null)},b=u?(0,Q.jsx)($,{integrationId:e.id,onClose:y}):s&&(0,Q.jsx)($,{integrationId:e.id,webhook:s,onClose:y},s.id),x=e=>{i({title:`Are you sure?`,prompt:`Deleting this webhook may prevent the integration from functioning.`,okVariant:`destructive`,okLabel:`Delete Webhook`,onOk:async n=>{try{await t(e),n?.remove(),o.info(`Webhook deleted`)}catch(e){r(e)}}})};return a.length===0?(0,Q.jsxs)(f,{gap:`none`,children:[(0,Q.jsx)(V,{}),(0,Q.jsx)(_,{actions:(0,Q.jsxs)(g,{type:`button`,variant:`outline`,onClick:v,children:[(0,Q.jsx)(m,{}),` Add webhook`]}),className:`py-8`,description:`Add a webhook to send Ghost events to another service.`,title:`No webhooks`,children:(0,Q.jsx)(h,{})}),(0,Q.jsx)(V,{}),b]}):(0,Q.jsxs)(f,{gap:`none`,children:[(0,Q.jsxs)(z,{children:[(0,Q.jsx)(re,{children:(0,Q.jsxs)(L,{children:[(0,Q.jsxs)(I,{children:[l(e.webhooks?.length||0),` `,e.webhooks?.length===1?`webhook`:`webhooks`]}),(0,Q.jsx)(I,{children:`Last triggered`}),(0,Q.jsx)(I,{children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,Q.jsx)(ne,{children:a.map(e=>(0,Q.jsxs)(L,{className:`cursor-pointer`,onClick:()=>c(e),children:[(0,Q.jsxs)(R,{className:`w-3/4 py-3 pr-6`,children:[(0,Q.jsx)(`div`,{className:`font-semibold`,children:e.name}),(0,Q.jsxs)(`div`,{className:`mt-1 grid grid-cols-[max-content_1fr] gap-1 text-sm leading-snug`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Event:`}),(0,Q.jsx)(`span`,{children:ae(e.event)}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`URL:`}),(0,Q.jsx)(`span`,{className:`line-clamp-3 break-all`,title:e.target_url,children:e.target_url})]})]}),(0,Q.jsx)(R,{className:`w-1/4 py-3 pr-6 text-sm`,children:e.last_triggered_at&&new Date(e.last_triggered_at).toLocaleString(`default`,{weekday:`short`,month:`short`,day:`numeric`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,Q.jsx)(R,{className:`w-0 text-right`,children:(0,Q.jsx)(g,{size:`sm`,type:`button`,variant:`destructive-ghost`,onClick:t=>{t.stopPropagation(),x(e.id)},children:`Delete`})})]},e.id))})]}),(0,Q.jsx)(d,{className:`py-4`,justify:`center`,children:(0,Q.jsxs)(g,{size:`sm`,type:`button`,variant:`outline`,onClick:v,children:[(0,Q.jsx)(m,{}),` Add webhook`]})}),(0,Q.jsx)(V,{}),b]})},ue=({integration:e})=>{let{updateRoute:t}=U(),{mutateAsync:i}=G(),{mutateAsync:a}=Y(),{mutateAsync:o}=w(),c=n(),{confirm:l}=W(),{formState:d,updateForm:m,handleSave:h,saveState:g,errors:_,clearError:v,okProps:k}=s({initialState:e,savingDelay:500,savedDelay:500,onSave:async()=>{await i(d)},onSavedStateReset:()=>{t(`integrations`)},onSaveError:c,onValidate:()=>{let e={};return d.name||(e.name=`Enter integration title`),e}}),A=async e=>{try{let t=D(await o({file:e}));m(e=>({...e,icon_image:t}))}catch(e){let t=e;t.response.status===415&&(t.message=`Unsupported file type`),c(t)}},j=e.api_keys?.find(e=>e.type===`admin`),M=e.api_keys?.find(e=>e.type===`content`),[N,P]=(0,X.useState)(!1),[F,I]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e.type!==`custom`&&t(`integrations`)},[e.type,t]);let L=(t,n)=>{n(!1);let r=t.type===`content`?`Content`:`Admin`;l({title:`Regenerate ${r} API Key`,prompt:`You can regenerate ${r} API Key any time, but any scripts or applications using it will need to be updated.`,okLabel:`Regenerate ${r} API Key`,onOk:async r=>{try{await a({integrationId:e.id,apiKeyId:t.id}),n(!0),r?.remove()}catch(e){c(e)}}})};return(0,Q.jsxs)(B,{buttonsDisabled:k.disabled,cancelLabel:`Close`,dirty:g===`unsaved`,okLabel:k.label||`Save`,okVariant:k.variant,size:`md`,testId:`custom-integration-modal`,title:d.name||`Custom integration`,stickyFooter:!0,onClose:()=>{t(`integrations`)},onOk:async()=>{await h({fakeWhenUnchanged:!0})},children:[(0,Q.jsxs)(f,{className:`w-full pt-6 md:flex-row`,gap:`xl`,children:[(0,Q.jsx)(`div`,{className:`shrink-0`,children:(0,Q.jsx)(E,{className:`size-25`,children:d.icon_image?(0,Q.jsxs)(S,{children:[(0,Q.jsx)(te,{id:`custom-integration-icon`,src:d.icon_image}),(0,Q.jsx)(ee,{children:(0,Q.jsx)(C,{"aria-label":`Remove icon`,onClick:()=>m(e=>({...e,icon_image:null})),children:(0,Q.jsx)(p,{})})})]}):(0,Q.jsx)(T,{className:`text-center`,inputId:`custom-integration-icon`,onDropAccepted:([e])=>void A(e),children:`Upload icon`})})}),(0,Q.jsxs)(f,{className:`min-w-0 grow`,gap:`2xl`,children:[(0,Q.jsxs)(f,{gap:`md`,children:[(0,Q.jsxs)(x,{"data-invalid":!!_.name||void 0,children:[(0,Q.jsx)(b,{htmlFor:`integration-title`,children:`Title`}),(0,Q.jsx)(O,{"aria-invalid":!!_.name||void 0,id:`integration-title`,maxLength:191,value:d.name,onChange:e=>m(t=>({...t,name:e.target.value})),onKeyDown:()=>v(`name`)}),_.name&&(0,Q.jsx)(y,{children:_.name})]}),(0,Q.jsxs)(x,{children:[(0,Q.jsx)(b,{htmlFor:`integration-description`,children:`Description`}),(0,Q.jsx)(O,{id:`integration-description`,maxLength:2e3,value:d.description||``,onChange:e=>m(t=>({...t,description:e.target.value}))})]})]}),(0,Q.jsx)(J,{keys:[{id:`content-api-key`,label:`Content API key`,text:M?.secret,hint:F?(0,Q.jsx)(`div`,{className:`text-green`,children:`Content API Key was successfully regenerated`}):void 0,onRegenerate:()=>M&&L(M,I)},{id:`admin-api-key`,label:`Admin API key`,text:j?.secret,hint:N?(0,Q.jsx)(`div`,{className:`text-green`,children:`Admin API Key was successfully regenerated`}):void 0,onRegenerate:()=>j&&L(j,P)},{id:`api-url`,label:`API URL`,text:window.location.origin+r().subdir}]})]})]}),(0,Q.jsx)(u,{className:`mt-8`,children:(0,Q.jsx)(le,{integration:e})})]})};function de(){let{integrationId:e}=c(),{data:{integrations:t}={}}=K(),n=t?.find(({id:t})=>t===e);return n?(0,Q.jsx)(ue,{integration:n}):null}export{de as default};
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`b66884f4-7e9f-4ac9-aebd-346be4e0158d`,e._sentryDebugIdIdentifier=`sentry-dbid-b66884f4-7e9f-4ac9-aebd-346be4e0158d`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{g as n,m as r,n as i}from"./hooks-0r7qxGEo.js";import{t as a}from"./jsx-runtime-Bm2_KH-0.js";import{n as o}from"./dist-pogVoW2G.js";import{t as s}from"./use-form-ElCUnbKi.js";import{h as c}from"./chunk-OB3PAWPO-D3muQBsq.js";import{H as l}from"./shade-provider-DvrXKKQZ.js";import{t as u}from"./box-BOIwAOVT.js";import{t as d}from"./inline-Qoyy4r2g.js";import{t as f}from"./stack-C3OmgpUv.js";import{D as p,dt as m,o as h,t as g}from"./button-CTHYSI-d.js";import{t as _}from"./empty-indicator-BhVwqSVH.js";import{a as v,i as y,o as b,t as x}from"./field-DCPPrQDr.js";import{a as ee,c as S,i as C,n as w,o as T,r as E,s as te,t as D}from"./images-DTZtaIAr.js";import{t as O}from"./input-BHb2A_DU.js";import{a as k,i as A,n as j,o as M,r as N,s as P,t as F}from"./select-DeloOYCg.js";import{a as I,c as L,n as ne,r as R,s as re,t as z}from"./table-DQ63Yu4a.js";import{t as B}from"./settings-modal-3x4v8abr.js";import{st as V}from"./index-RuRs_qGS.js";import{t as H}from"./validator-DgUCXsE8.js";import{t as U}from"./use-settings-navigation-CO2nUqDW.js";import{n as W}from"./confirmation-context-By_jX_cA.js";import{a as G,n as K,t as q}from"./integrations-Deg9-u8X.js";import{t as J}from"./api-keys-COZMaKEL.js";import{t as Y}from"./api-keys-CqKJHuAV.js";var X=e(t(),1),ie=e(H(),1),Z=[{label:`Global`,options:[{value:`site.changed`,label:`Site changed (rebuild)`}]},{label:`Posts`,options:[{value:`post.added`,label:`Post created`},{value:`post.deleted`,label:`Post deleted`},{value:`post.edited`,label:`Post updated`},{value:`post.published`,label:`Post published`},{value:`post.published.edited`,label:`Published post updated`},{value:`post.unpublished`,label:`Post unpublished`},{value:`post.scheduled`,label:`Post scheduled`},{value:`post.unscheduled`,label:`Post unscheduled`},{value:`post.tag.attached`,label:`Tag added to post`},{value:`post.tag.detached`,label:`Tag removed from post`}]},{label:`Pages`,options:[{value:`page.added`,label:`Page created`},{value:`page.deleted`,label:`Page deleted`},{value:`page.edited`,label:`Page updated`},{value:`page.published`,label:`Page published`},{value:`page.published.edited`,label:`Published page updated`},{value:`page.unpublished`,label:`Page unpublished`},{value:`page.tag.attached`,label:`Tag added to page`},{value:`page.tag.detached`,label:`Tag removed from page`}]},{label:`Tags`,options:[{value:`tag.added`,label:`Tag created`},{value:`tag.edited`,label:`Tag updated`},{value:`tag.deleted`,label:`Tag deleted`}]},{label:`Members`,options:[{value:`member.added`,label:`Member added`},{value:`member.edited`,label:`Member updated`},{value:`member.deleted`,label:`Member deleted`}]}],ae=e=>Z.flatMap(({options:e})=>e).find(t=>t.value===e)?.label,oe=i({method:`POST`,path:()=>`/webhooks/`,body:e=>({webhooks:[e]}),updateQueries:{dataType:q,emberUpdateType:`createOrUpdate`,update:(e,t)=>t&&{...t,integrations:t.integrations.map(t=>{let n=e.webhooks[0];return n.integration_id===t.id?{...t,webhooks:[...t.webhooks||[],n]}:t})}}}),se=i({method:`PUT`,path:e=>`/webhooks/${e.id}/`,body:e=>({webhooks:[e]}),updateQueries:{dataType:q,emberUpdateType:`createOrUpdate`,update:(e,t)=>t&&{...t,integrations:t.integrations.map(t=>({...t,webhooks:t.webhooks?.map(t=>t.id===e.webhooks[0].id?e.webhooks[0]:t)}))}}}),ce=i({method:`DELETE`,path:e=>`/webhooks/${e}/`,updateQueries:{dataType:q,emberUpdateType:`createOrUpdate`,update:(e,t,n)=>({...t,integrations:t.integrations.map(e=>({...e,webhooks:e.webhooks?.filter(e=>e.id!==n)}))})}}),Q=a(),$=({webhook:e,integrationId:t,onClose:r})=>{let i=X.useId(),{mutateAsync:a}=oe(),{mutateAsync:o}=se(),c=n(),{formState:l,updateForm:u,handleSave:d,errors:f,clearError:p}=s({initialState:e||{},onSave:async()=>{l.id?await o(l):await a({...l,integration_id:t})},onSaveError:c,onValidate:()=>{let e={};return l.name||(e.name=`Enter a name`),l.event||(e.event=`Select an event`),l.target_url||(e.target_url=`Enter a target URL`),l.target_url&&!ie.default.isURL(l.target_url,{require_tld:!1})&&(e.target_url=`Enter a valid URL`),e}});return(0,Q.jsx)(B,{okLabel:e?`Update`:`Add`,okVariant:`default`,size:`sm`,testId:`webhook-modal`,title:`Add webhook`,formSheet:!0,onClose:r,onOk:async()=>{await d()&&r()},children:(0,Q.jsx)(`div`,{className:`mt-5`,children:(0,Q.jsxs)(v,{className:`gap-8`,children:[(0,Q.jsxs)(x,{"data-invalid":!!f.name||void 0,children:[(0,Q.jsx)(b,{htmlFor:`webhook-name`,children:`Name`}),(0,Q.jsx)(O,{"aria-invalid":!!f.name||void 0,id:`webhook-name`,maxLength:191,placeholder:`Custom webhook`,value:l.name??``,onChange:e=>u(t=>({...t,name:e.target.value})),onKeyDown:()=>p(`name`)}),f.name&&(0,Q.jsx)(y,{children:f.name})]}),(0,Q.jsxs)(x,{"data-invalid":!!f.event||void 0,children:[(0,Q.jsx)(b,{className:`sr-only`,children:`Event`}),(0,Q.jsxs)(F,{value:l.event??``,onValueChange:e=>{u(t=>({...t,event:e})),p(`event`)},children:[(0,Q.jsx)(M,{"aria-describedby":f.event?i:void 0,"aria-invalid":!!f.event||void 0,"aria-label":`Event`,"data-testid":`event-select`,children:(0,Q.jsx)(P,{placeholder:`Select an event`})}),(0,Q.jsx)(j,{children:Z.map(e=>(0,Q.jsxs)(N,{children:[(0,Q.jsx)(k,{children:e.label}),e.options.map(e=>(0,Q.jsx)(A,{value:e.value,children:e.label},e.value))]},e.label))})]}),f.event&&(0,Q.jsx)(y,{id:i,children:f.event})]}),(0,Q.jsxs)(x,{"data-invalid":!!f.target_url||void 0,children:[(0,Q.jsx)(b,{htmlFor:`webhook-target-url`,children:`Target URL`}),(0,Q.jsx)(O,{"aria-invalid":!!f.target_url||void 0,id:`webhook-target-url`,maxLength:2e3,placeholder:`https://example.com`,type:`url`,value:l.target_url??``,onChange:e=>u(t=>({...t,target_url:e.target.value})),onKeyDown:()=>p(`target_url`)}),f.target_url&&(0,Q.jsx)(y,{children:f.target_url})]}),(0,Q.jsxs)(x,{children:[(0,Q.jsx)(b,{htmlFor:`webhook-secret`,children:`Secret`}),(0,Q.jsx)(O,{id:`webhook-secret`,maxLength:191,placeholder:`https://example.com`,value:l.secret||``,onChange:e=>u(t=>({...t,secret:e.target.value}))})]})]})})})},le=({integration:e})=>{let{mutateAsync:t}=ce(),r=n(),{confirm:i}=W(),a=e.webhooks||[],[s,c]=(0,X.useState)(null),[u,p]=(0,X.useState)(!1),v=()=>{p(!0)},y=()=>{p(!1),c(null)},b=u?(0,Q.jsx)($,{integrationId:e.id,onClose:y}):s&&(0,Q.jsx)($,{integrationId:e.id,webhook:s,onClose:y},s.id),x=e=>{i({title:`Are you sure?`,prompt:`Deleting this webhook may prevent the integration from functioning.`,okVariant:`destructive`,okLabel:`Delete Webhook`,onOk:async n=>{try{await t(e),n?.remove(),o.info(`Webhook deleted`)}catch(e){r(e)}}})};return a.length===0?(0,Q.jsxs)(f,{gap:`none`,children:[(0,Q.jsx)(V,{}),(0,Q.jsx)(_,{actions:(0,Q.jsxs)(g,{type:`button`,variant:`outline`,onClick:v,children:[(0,Q.jsx)(m,{}),` Add webhook`]}),className:`py-8`,description:`Add a webhook to send Ghost events to another service.`,title:`No webhooks`,children:(0,Q.jsx)(h,{})}),(0,Q.jsx)(V,{}),b]}):(0,Q.jsxs)(f,{gap:`none`,children:[(0,Q.jsxs)(z,{children:[(0,Q.jsx)(re,{children:(0,Q.jsxs)(L,{children:[(0,Q.jsxs)(I,{children:[l(e.webhooks?.length||0),` `,e.webhooks?.length===1?`webhook`:`webhooks`]}),(0,Q.jsx)(I,{children:`Last triggered`}),(0,Q.jsx)(I,{children:(0,Q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,Q.jsx)(ne,{children:a.map(e=>(0,Q.jsxs)(L,{className:`cursor-pointer`,onClick:()=>c(e),children:[(0,Q.jsxs)(R,{className:`w-3/4 py-3 pr-6`,children:[(0,Q.jsx)(`div`,{className:`font-semibold`,children:e.name}),(0,Q.jsxs)(`div`,{className:`mt-1 grid grid-cols-[max-content_1fr] gap-1 text-sm leading-snug`,children:[(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`Event:`}),(0,Q.jsx)(`span`,{children:ae(e.event)}),(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:`URL:`}),(0,Q.jsx)(`span`,{className:`line-clamp-3 break-all`,title:e.target_url,children:e.target_url})]})]}),(0,Q.jsx)(R,{className:`w-1/4 py-3 pr-6 text-sm`,children:e.last_triggered_at&&new Date(e.last_triggered_at).toLocaleString(`default`,{weekday:`short`,month:`short`,day:`numeric`,year:`numeric`,hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}),(0,Q.jsx)(R,{className:`w-0 text-right`,children:(0,Q.jsx)(g,{size:`sm`,type:`button`,variant:`destructive-ghost`,onClick:t=>{t.stopPropagation(),x(e.id)},children:`Delete`})})]},e.id))})]}),(0,Q.jsx)(d,{className:`py-4`,justify:`center`,children:(0,Q.jsxs)(g,{size:`sm`,type:`button`,variant:`outline`,onClick:v,children:[(0,Q.jsx)(m,{}),` Add webhook`]})}),(0,Q.jsx)(V,{}),b]})},ue=({integration:e})=>{let{updateRoute:t}=U(),{mutateAsync:i}=G(),{mutateAsync:a}=Y(),{mutateAsync:o}=w(),c=n(),{confirm:l}=W(),{formState:d,updateForm:m,handleSave:h,saveState:g,errors:_,clearError:v,okProps:k}=s({initialState:e,savingDelay:500,savedDelay:500,onSave:async()=>{await i(d)},onSavedStateReset:()=>{t(`integrations`)},onSaveError:c,onValidate:()=>{let e={};return d.name||(e.name=`Enter integration title`),e}}),A=async e=>{try{let t=D(await o({file:e}));m(e=>({...e,icon_image:t}))}catch(e){let t=e;t.response.status===415&&(t.message=`Unsupported file type`),c(t)}},j=e.api_keys?.find(e=>e.type===`admin`),M=e.api_keys?.find(e=>e.type===`content`),[N,P]=(0,X.useState)(!1),[F,I]=(0,X.useState)(!1);(0,X.useEffect)(()=>{e.type!==`custom`&&t(`integrations`)},[e.type,t]);let L=(t,n)=>{n(!1);let r=t.type===`content`?`Content`:`Admin`;l({title:`Regenerate ${r} API Key`,prompt:`You can regenerate ${r} API Key any time, but any scripts or applications using it will need to be updated.`,okLabel:`Regenerate ${r} API Key`,onOk:async r=>{try{await a({integrationId:e.id,apiKeyId:t.id}),n(!0),r?.remove()}catch(e){c(e)}}})};return(0,Q.jsxs)(B,{buttonsDisabled:k.disabled,cancelLabel:`Close`,dirty:g===`unsaved`,okLabel:k.label||`Save`,okVariant:k.variant,size:`md`,testId:`custom-integration-modal`,title:d.name||`Custom integration`,stickyFooter:!0,onClose:()=>{t(`integrations`)},onOk:async()=>{await h({fakeWhenUnchanged:!0})},children:[(0,Q.jsxs)(f,{className:`w-full pt-6 md:flex-row`,gap:`xl`,children:[(0,Q.jsx)(`div`,{className:`shrink-0`,children:(0,Q.jsx)(E,{className:`size-25`,children:d.icon_image?(0,Q.jsxs)(S,{children:[(0,Q.jsx)(te,{id:`custom-integration-icon`,src:d.icon_image}),(0,Q.jsx)(ee,{children:(0,Q.jsx)(C,{"aria-label":`Remove icon`,onClick:()=>m(e=>({...e,icon_image:null})),children:(0,Q.jsx)(p,{})})})]}):(0,Q.jsx)(T,{className:`text-center`,inputId:`custom-integration-icon`,onDropAccepted:([e])=>void A(e),children:`Upload icon`})})}),(0,Q.jsxs)(f,{className:`min-w-0 grow`,gap:`2xl`,children:[(0,Q.jsxs)(f,{gap:`md`,children:[(0,Q.jsxs)(x,{"data-invalid":!!_.name||void 0,children:[(0,Q.jsx)(b,{htmlFor:`integration-title`,children:`Title`}),(0,Q.jsx)(O,{"aria-invalid":!!_.name||void 0,id:`integration-title`,maxLength:191,value:d.name,onChange:e=>m(t=>({...t,name:e.target.value})),onKeyDown:()=>v(`name`)}),_.name&&(0,Q.jsx)(y,{children:_.name})]}),(0,Q.jsxs)(x,{children:[(0,Q.jsx)(b,{htmlFor:`integration-description`,children:`Description`}),(0,Q.jsx)(O,{id:`integration-description`,maxLength:2e3,value:d.description||``,onChange:e=>m(t=>({...t,description:e.target.value}))})]})]}),(0,Q.jsx)(J,{keys:[{id:`content-api-key`,label:`Content API key`,text:M?.secret,hint:F?(0,Q.jsx)(`div`,{className:`text-green`,children:`Content API Key was successfully regenerated`}):void 0,onRegenerate:()=>M&&L(M,I)},{id:`admin-api-key`,label:`Admin API key`,text:j?.secret,hint:N?(0,Q.jsx)(`div`,{className:`text-green`,children:`Admin API Key was successfully regenerated`}):void 0,onRegenerate:()=>j&&L(j,P)},{id:`api-url`,label:`API URL`,text:window.location.origin+r().subdir}]})]})]}),(0,Q.jsx)(u,{className:`mt-8`,children:(0,Q.jsx)(le,{integration:e})})]})};function de(){let{integrationId:e}=c(),{data:{integrations:t}={}}=K(),n=t?.find(({id:t})=>t===e);return n?(0,Q.jsx)(ue,{integration:n}):null}export{de as default};
|
package/core/built/admin/assets/{date-range-select-O-uA-BRV.js → date-range-select-BZqsYsGx.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`64ef1455-48b2-42e8-a224-b72def63c751`,e._sentryDebugIdIdentifier=`sentry-dbid-64ef1455-48b2-42e8-a224-b72def63c751`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{pr as r}from"./button-CTHYSI-d.js";import{t as i}from"./page-header-
|
|
1
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`64ef1455-48b2-42e8-a224-b72def63c751`,e._sentryDebugIdIdentifier=`sentry-dbid-64ef1455-48b2-42e8-a224-b72def63c751`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./jsx-runtime-Bm2_KH-0.js";import{pr as r}from"./button-CTHYSI-d.js";import{t as i}from"./page-header-CxTb0je5.js";import{a,i as o,n as s,r as c,s as l,t as u}from"./select-DeloOYCg.js";import{J as d,q as f}from"./index-RuRs_qGS.js";var p=e(t(),1),m=n(),h=({range:e,onRangeChange:t,excludeRanges:n=[]})=>{let h=n.map(e=>f[e].value),g=d.filter(e=>!h.includes(e.value));return(0,p.useEffect)(()=>{if(h.includes(e)&&g.length>0){let e=g.find(e=>e.value===f.last7Days.value);t(e?e.value:g[0].value)}},[e,h,g,t]),(0,m.jsxs)(u,{value:`${e}`,onValueChange:e=>{t(Number(e))},children:[(0,m.jsxs)(i.SelectTrigger,{label:`Date range`,tooltip:!1,children:[(0,m.jsx)(r,{className:`mr-2`,size:16,strokeWidth:1.5}),(0,m.jsx)(l,{placeholder:`Select a period`})]}),(0,m.jsx)(s,{align:`end`,children:(0,m.jsxs)(c,{children:[(0,m.jsx)(a,{children:`Period`}),g.map(e=>(0,m.jsx)(o,{value:`${e.value}`,children:e.name},e.value))]})})]})};export{h as t};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-
|
|
2
|
-
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`329cf099-9dc2-4342-88dc-9d85c139844d`,e._sentryDebugIdIdentifier=`sentry-dbid-329cf099-9dc2-4342-88dc-9d85c139844d`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./react-dom-t7VxfrkA.js";import{r}from"./framework-provider-CIvHFnik.js";import{D as i,_ as a,b as o,c as s,g as c,p as l,u}from"./hooks-C-BDQ6Hs.js";import{t as d}from"./jsx-runtime-Bm2_KH-0.js";import{n as f}from"./dist-pogVoW2G.js";import{t as p}from"./use-form-ElCUnbKi.js";import{r as m}from"./posts-Lg-p_ZHg.js";import{t as h}from"./preload-helper-Ba4JejZL.js";import{a as g}from"./router-provider-Cf-bcYZr.js";import{H as _,Z as v,r as y}from"./shade-provider-DvrXKKQZ.js";import{t as b}from"./inline-Qoyy4r2g.js";import{t as x}from"./text-BnCSdzao.js";import{An as S,Cn as C,D as w,Pn as T,Y as E,a as D,ar as O,b as k,dn as ee,dt as A,in as j,j as te,rr as ne,rt as M,t as N,wn as P,yt as F}from"./button-CTHYSI-d.js";import{i as re,n as ie,r as ae,t as oe}from"./action-list-CGRkUA1s.js";import{i as se,r as ce,t as le}from"./esm-CNLDtBMc.js";import{t as ue}from"./dropzone-C0p6KEsa.js";import{a as I,c as de,n as L,o as R,r as z,s as fe,t as B}from"./field-DCPPrQDr.js";import{a as V,c as H,i as U,n as W,o as pe,r as me,s as he,t as ge}from"./images-BSUWxquu.js";import{t as _e}from"./input-BHb2A_DU.js";import{n as ve}from"./loading-indicator-DaRyGrxv.js";import{t as G}from"./page-header-Baymg6VR.js";import{t as K}from"./preview-chrome-Dcu3p6mp.js";import{i as ye,n as be,o as xe,s as Se,t as Ce}from"./select-DeloOYCg.js";import{t as we}from"./switch-BppWscjz.js";import{i as q,n as Te,r as Ee,t as De}from"./tabs-CDb_TceL.js";import{n as Oe,t as ke}from"./toggle-group-D7ly9OGa.js";import{a as Ae,f as je,g as Me,p as Ne,r as Pe}from"./schemas-21VB7GGY.js";import{t as Fe}from"./settings-modal-3x4v8abr.js";import{a as Ie,c as Le,d as Re,f as ze,i as Be,l as Ve,m as He,n as Ue,p as We,r as Ge,s as Ke,t as qe,u as Je}from"./themes-pOHHvnkt.js";import{C as Ye,Jt as Xe,S as Ze,T as Qe,Ut as $e,Wt as J,b as et,ct as tt,ft as nt,g as rt,h as it,ut as at,vt as ot,w as st,x as ct,y as lt}from"./index-CuDhPtkB.js";import{t as ut}from"./modal-page--y-_IuN6.js";import{t as dt}from"./index.es-H6HOI4DG.js";import{t as ft}from"./brand-icon-BFOhZhQt.js";import{t as pt}from"./nql-Cjj71Bsg.js";import{t as Y}from"./use-settings-navigation-CO2nUqDW.js";import{i as mt,n as ht}from"./confirmation-context-By_jX_cA.js";import{n as gt}from"./global-data-context-ogIy0FUG.js";import{t as _t}from"./use-upgrade-route-Bsxw9ZLN.js";import{i as vt}from"./zapier-modal-DgqU-OBB.js";import{rt as yt}from"./dist-tI811Kyl.js";import{t as bt}from"./color-picker-field-Cjz2zY11.js";import{t as xt}from"./preview-modal-D8om_cQv.js";import{t as St}from"./use-pintura-editor-B5VBPbiO.js";import{t as Ct}from"./iframe-buffering-DW-Axhvc.js";import{t as wt}from"./settings-breadcrumbs-Bq3nGk-N.js";import{t as Tt}from"./use-query-params-C_4J-y5d.js";import{n as Et,t as Dt}from"./use-check-theme-limit-error-CxC9uKJz.js";var X=e(t(),1),Z=d(),Ot=({title:e,themeName:t,action:n=`uploaded`,cancelLabel:r=`Cancel`,okLabel:i,fatalErrors:a,onRetry:o,onClose:s})=>{let{blockingProblems:c,secondaryProblems:l,stringErrors:u}=Ze(a);return(0,Z.jsx)(mt,{cancelLabel:r,contentClassName:c.length+u.length+l.length>0?`max-w-[600px]`:void 0,okLabel:i??(o?`Try again`:``),okVariant:`default`,prompt:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`p`,{className:`text-base text-foreground`,children:[t?(0,Z.jsx)(`strong`,{children:t}):`This theme`,` couldn't be `,n,`. Fix the errors below and try again.`]}),(0,Z.jsx)(et,{errorLabel:`Blocking`,messages:u,problems:c,expandedByDefault:!0}),(0,Z.jsx)(lt,{problems:l})]}),stickyFooter:!0,title:e,onOk:o,onRemove:s})},kt=()=>{let e=Le();return{supportsCustomFonts:!(e.data?.themes[0])?.warnings?.some(e=>e.code===`GS051-CUSTOM-FONTS`),refreshActiveThemeData:(0,X.useCallback)(()=>{e.refetch()},[e])}};function At(e){let t=e.package?.name||e.name,n=t;return Ge(e)?n=`${t} (default)`:Ie(e)?n=`${t} (legacy)`:e.package?.name!==e.name&&(n=(0,Z.jsxs)(`span`,{className:`md:text-base`,children:[n,` `,(0,Z.jsxs)(`span`,{className:`text-gray-600`,children:[`(`,e.name,`)`]})]})),qe(e)&&(n=(0,Z.jsxs)(`span`,{className:`font-bold md:text-base`,children:[n,` — `,(0,Z.jsx)(`span`,{className:`text-green`,children:` Active`})]})),n}function jt(e){return e.package?.version||`1.0`}var Mt=({theme:e})=>{let{mutateAsync:t}=Ke(),{mutateAsync:n}=Je(),{refreshActiveThemeData:r}=kt(),i=c(),{route:a,updateRoute:s}=Y(),u=_t(),{checkThemeLimitError:d}=Dt(),{confirm:p,showLimit:m}=ht(),[h,g]=(0,X.useState)(null),_=async()=>{try{await t(e.name),r(),f.success(`Theme activated`,{description:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),` is now your active theme`]})})}catch(e){let t=null;e instanceof o&&e.response?.status===422&&e.data?.errors?t=e.data.errors:i(e),t&&g(t)}},v=()=>{l(`/themes/${e.name}/download`)},y=()=>{p({title:`Are you sure you want to delete this?`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[`You are about to delete `,(0,Z.jsxs)(`strong`,{children:[`"`,e.name,`".`]}),` This is permanent! We warned you, k? Maybe download`,` `,(0,Z.jsx)(`span`,{className:`cursor-pointer text-green-500`,onClick:v,children:`your theme before continuing`})]}),okLabel:`Delete`,okRunningLabel:`Deleting`,okVariant:`destructive`,onOk:async t=>{try{await n(e.name),t?.remove()}catch(e){i(e)}}})},b=async()=>{let t=await d(`.`);if(t){m({prompt:t,onOk:()=>s({route:u,isExternal:!0})});return}s(`theme/edit/${encodeURIComponent(e.name)}?from=${encodeURIComponent(a??``)}`)},x=[];return qe(e)||x.push((0,Z.jsx)(N,{className:`ml-2`,size:`sm`,type:`button`,variant:`ghost`,onClick:()=>void _(),children:`Activate`},`activate`)),(0,Z.jsxs)(`div`,{className:`-mr-3 flex items-center gap-4`,children:[x,(0,Z.jsxs)(tt,{children:[(0,Z.jsx)(ot,{asChild:!0,children:(0,Z.jsx)(N,{"aria-label":`Menu`,size:`icon`,type:`button`,variant:`ghost`,children:(0,Z.jsx)(T,{})})}),(0,Z.jsxs)(at,{align:`end`,className:`z-[9999]`,children:[(0,Z.jsx)(nt,{onSelect:()=>void b(),children:`Edit code`}),(0,Z.jsx)(nt,{onSelect:v,children:`Download`}),Be(e)&&(0,Z.jsx)(nt,{onSelect:y,children:`Delete`})]})]}),h&&(0,Z.jsx)(Ot,{action:`activated`,fatalErrors:h,themeName:e.package?.name||e.name,title:`Theme not activated`,onClose:()=>g(null),onRetry:()=>{g(null),_()}})]})},Nt=({themes:e})=>(e.sort((e,t)=>e.active&&!t.active?-1:!e.active&&t.active?1:e.package?.name&&t.package?.name?e.package.name.localeCompare(t.package.name):e.name.localeCompare(t.name)),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`h1`,{className:`mb-5 text-2xl font-bold`,children:`Installed themes`}),(0,Z.jsx)(oe,{className:`border-t border-border`,children:e.map(e=>{let t=At(e),n=jt(e);return(0,Z.jsxs)(ie,{"data-testid":`theme-list-item`,children:[(0,Z.jsxs)(re,{className:`py-3 pr-6`,id:`theme-${e.name}`,children:[(0,Z.jsx)(`div`,{children:t}),n&&(0,Z.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:n})]}),(0,Z.jsx)(ae,{children:(0,Z.jsx)(Mt,{theme:e})})]},e.name)})})]})),Pt=({themes:e})=>(0,Z.jsx)(ut,{children:(0,Z.jsx)(Nt,{themes:e})}),Ft=``+new URL(`footer-marketplace-bg-cXGt4GLt.png`,import.meta.url).href,It=3e3,Lt=e=>e.variants&&e.variants.length>0,Rt=e=>{let t=[{category:e.category,previewUrl:e.previewUrl,image:e.image}];return e.variants&&e.variants.length>0&&t.push(...e.variants),t},zt=({onSelectTheme:e})=>{let t=vt(),[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(0),o=e=>{r(e),a(e!==null&&Lt(e)&&Rt(e).length>1?1:0)};return(0,X.useEffect)(()=>{if(n===null)return;let e=setInterval(()=>{a((i+1)%(Rt(n).length||0))},It);return()=>clearInterval(e)},[n,i]),(0,Z.jsxs)(ut,{children:[(0,Z.jsx)(ut.Title,{children:`Themes`}),(0,Z.jsx)(`div`,{className:`mt-[6vmin] grid grid-cols-1 gap-[6vmin] sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4`,children:t.map(t=>{let r=Lt(t),a=Rt(t),s=n===t;return(0,Z.jsxs)(`button`,{className:`flex cursor-pointer flex-col gap-3 text-left`,type:`button`,onClick:()=>{e?.(t)},children:[(0,Z.jsx)(`div`,{className:`relative w-full bg-gray-100 shadow-md transition-all duration-500 hover:scale-[1.05]`,onMouseEnter:()=>o(t),onMouseLeave:()=>o(null),children:r?(0,Z.jsx)(Z.Fragment,{children:a.map((e,n)=>(0,Z.jsx)(`img`,{alt:`${t.name} Theme - ${e.category}`,className:v(`size-full object-contain opacity-0 transition-opacity duration-500`,{"opacity-100":n===i&&s||!s&&n===0,relative:n===i,absolute:n!==i,"left-0":n!==i,"top-0":n!==i}),src:e.image},`theme-variant-${e.category.toLowerCase()}`))}):(0,Z.jsx)(`img`,{alt:`${t.name} Theme`,className:`size-full object-contain`,src:t.image})}),(0,Z.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Z.jsx)(x,{as:`h4`,className:`md:text-xl`,leading:`heading`,size:`lg`,weight:`bold`,children:t.name}),r?a.map((e,t)=>(0,Z.jsx)(`span`,{className:v(`absolute left-0 translate-y-px text-gray-700 opacity-0`,{"opacity-100":t===i&&s||!s&&t===0}),children:e.category},e.category)):(0,Z.jsx)(`span`,{className:`text-gray-700`,children:t.category})]})]},t.name)})}),(0,Z.jsxs)(`div`,{className:`mx-[-8vmin] mt-[8vmin] mb-[-8vmin] bg-black px-[8vmin] py-16 text-center text-lg text-white`,style:{background:`#15171a url(${Ft}) 100% 100% / 35vw no-repeat`},children:[`Find and buy third-party, premium themes from independent developers in the`,` `,(0,Z.jsx)(`a`,{className:`inline-block font-semibold text-lime`,href:`https://ghost.org/themes/`,rel:`noopener noreferrer`,target:`_blank`,children:`Ghost Marketplace →`})]})]})},Bt=({title:e,action:t=`uploaded`,statusMessage:n,installedTheme:r,onActivate:i,onClose:a})=>{let{mutateAsync:o}=Ke(),{refreshActiveThemeData:s}=kt(),l=c(),{data:u}=rt(),d=Ye(r),p=u?.site?it(u.site):void 0,m=r.active?`OK`:st(d)?`Activate with errors`:`Activate theme`,h=r.active?(0,Z.jsx)(`span`,{className:`text-green`,children:`It's live!`}):e,g;return g=r.active?(0,Z.jsxs)(Z.Fragment,{children:[`Your theme `,(0,Z.jsx)(`strong`,{children:r.name}),` was saved successfully and is now visible to your readers.`,p?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsx)(`a`,{className:`font-semibold text-foreground hover:underline`,href:p,rel:`noreferrer`,target:`_blank`,children:`Take a look →`})]}):null]}):n||(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`strong`,{children:r.name}),` was `,ct(t,d),`. Do you want to activate it?`]}),(0,Z.jsx)(mt,{cancelLabel:`Close`,contentClassName:d.length>0?`max-w-[600px]`:void 0,okLabel:m,okRunningLabel:`Activating...`,okVariant:`default`,prompt:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`p`,{className:`text-base text-foreground`,children:g}),(0,Z.jsx)(lt,{problems:d})]}),stickyFooter:!0,title:h,onOk:async e=>{if(!r.active)try{let e=(await o(r.name)).themes[0];s(),f.success(`Theme activated`,{description:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),` is now your active theme.`]})})}catch(e){l(e);return}i?.(),e?.remove()},onRemove:a})},Vt=e=>e.variants&&e.variants.length>0,Ht=e=>{let t=[{image:e.image,category:e.category,previewUrl:e.previewUrl}];return e.variants&&e.variants.length>0&&t.push(...e.variants),t},Ut=e=>e.category.toLowerCase(),Wt=({selectedTheme:e,isInstalling:t,installedTheme:n,onBack:r,onInstall:i})=>{let[a,o]=(0,X.useState)(`desktop`),[s,c]=(0,X.useState)(void 0);if(!e)return null;let l=e.previewUrl,u=Ht(e).map(e=>({label:e.category,value:Ut(e)}));Vt(e)&&(s===void 0&&c(u[0].value),l=Ht(e).find(e=>Ut(e)===s)?.previewUrl||l);let d=`Install ${e.name}`;t?d=`Installing...`:Ue(e)&&!n?.active?d=`Activate ${e.name}`:n&&(d=`Update ${e.name}`);let f=()=>{i?.()},p=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(wt,{current:e.name,label:`Change theme`,onBack:r}),Vt(e)?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`hidden md:!visible md:!block`,children:`–`}),(0,Z.jsxs)(B,{className:`w-auto`,children:[(0,Z.jsx)(R,{className:`sr-only`,children:`Theme variant`}),(0,Z.jsxs)(Ce,{value:s,onValueChange:c,children:[(0,Z.jsx)(xe,{"aria-label":`Theme variant`,className:`w-auto border-0 bg-transparent shadow-none`,children:(0,Z.jsx)(Se,{})}),(0,Z.jsx)(be,{className:`min-w-max`,children:u.map(e=>(0,Z.jsx)(ye,{value:e.value,children:e.label},e.value))})]})]})]}):null]}),m=(0,Z.jsxs)(`div`,{className:`flex justify-end gap-8`,children:[(0,Z.jsxs)(b,{gap:`sm`,children:[(0,Z.jsx)(N,{"aria-label":`Desktop preview`,size:`icon`,type:`button`,variant:`ghost`,onClick:()=>o(`desktop`),children:(0,Z.jsx)(j,{className:a===`desktop`?`text-foreground`:`text-muted-foreground`})}),(0,Z.jsx)(N,{"aria-label":`Mobile preview`,size:`icon`,type:`button`,variant:`ghost`,onClick:()=>o(`mobile`),children:(0,Z.jsx)(E,{className:a===`mobile`?`text-foreground`:`text-muted-foreground`})})]}),(0,Z.jsx)(N,{disabled:t,type:`button`,onClick:f,children:t?`Installing...`:d})]});return(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-[100]`,children:[(0,Z.jsxs)(G,{blurredBackground:!1,className:`z-[100] h-22 min-h-[92px] bg-background p-8`,sticky:!1,children:[(0,Z.jsx)(G.Left,{className:`flex-auto`,children:p}),(0,Z.jsx)(G.Actions,{className:`flex-auto justify-end`,children:m})]}),(0,Z.jsx)(`div`,{className:`flex h-[calc(100%-92px)] grow flex-col items-center justify-center bg-background`,children:a===`desktop`?(0,Z.jsx)(K,{device:`desktop`,children:(0,Z.jsx)(`iframe`,{className:`size-full`,src:l,title:`Theme preview`})}):(0,Z.jsx)(K,{device:`mobile`,children:(0,Z.jsx)(`iframe`,{className:`size-full`,src:l,title:`Theme preview`})})})]})},Gt=({onUpload:e})=>(0,Z.jsx)(ue,{accept:{"application/zip":[`.zip`]},inputId:`theme-upload`,onDropAccepted:([t])=>{e(t)},children:`Click to select or drag & drop zip file`}),Kt=({currentTab:e,setCurrentTab:t,themes:n})=>{let{updateRoute:r}=Y(),i=_t(),{mutateAsync:a}=ze(),{checkThemeLimitError:s,isThemeLimited:l}=Dt(),u=c(),{confirm:d,showLimit:f}=ht(),[p,m]=(0,X.useState)(),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(null);(0,X.useEffect)(()=>{(async()=>{if(l){let e=await s(`.`);m({enabled:!1,error:e||`Your current plan doesn't support uploading custom themes.`})}else m({enabled:!0})})()},[s,l]);let x=()=>{r(`/`)},S=e=>{let r=e?.name.replace(/\.zip$/,``),i=n.map(e=>e.name);Ue({name:r})?d({title:`Upload failed`,cancelLabel:`Cancel`,okLabel:``,prompt:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{children:[`The default `,(0,Z.jsx)(`strong`,{children:r}),` theme cannot be overwritten.`]}),(0,Z.jsx)(`p`,{children:`Rename your zip file and try again.`})]}),onOk:e=>{e?.remove()}}):i.includes(r)?d({title:`Overwrite theme`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[`The theme `,(0,Z.jsx)(`strong`,{children:r}),` already exists. Do you want to overwrite it?`]}),okLabel:`Overwrite`,cancelLabel:`Cancel`,okRunningLabel:`Overwriting...`,okVariant:`destructive`,onOk:async a=>{g(!0);let o=i.indexOf(r);n.splice(o,1),await C({file:e,onActivate:x}),g(!1),t(`installed`),a?.remove()}}):(t(`installed`),C({file:e,onActivate:x}))},C=async({file:e,onActivate:t})=>{let n,r=null;try{g(!0),n=await a({file:e}),g(!1)}catch(e){g(!1),e instanceof o&&e.response?.status===422&&e.data?.errors?r=e.data.errors:u(e)}r&&!n&&v({themeName:e.name.replace(/\.zip$/,``),fatalErrors:r}),n&&b({title:`Upload successful`,action:`uploaded`,installedTheme:n.themes[0],onActivate:t})},w=(0,Z.jsx)(`div`,{className:`hidden md:!visible md:!block`,children:(0,Z.jsx)(De,{value:e,variant:`button`,onValueChange:t,children:(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(q,{value:`official`,children:`Official themes`}),(0,Z.jsx)(q,{value:`installed`,children:`Installed`})]})})}),T=()=>{if(p)if(p.enabled){let e={current:null};e.current=d({title:`Upload theme`,prompt:(0,Z.jsx)(Gt,{onUpload:t=>{e.current?.remove(),S(t)}}),okLabel:``,formSheet:!1})}else f({title:`Upgrade to enable custom themes`,prompt:p.error||(0,Z.jsxs)(Z.Fragment,{children:[`Your current plan only supports official themes. You can install them from the`,` `,(0,Z.jsx)(`a`,{href:`https://ghost.org/marketplace/`,children:`Ghost theme marketplace`}),`.`]}),onOk:()=>r({route:i,isExternal:!0})})},E=(0,Z.jsx)(`div`,{className:`flex items-center gap-14`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(G.Action,{label:`Close`,type:`button`,onClick:x,children:`Close`}),(0,Z.jsxs)(N,{disabled:h,type:`button`,onClick:T,children:[h&&(0,Z.jsx)(ve,{size:`sm`}),`Upload theme`]})]})});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(G,{blurredBackground:!1,className:`sticky -top-px z-50 h-22 min-h-[92px] bg-background p-8`,sticky:!1,children:[(0,Z.jsx)(G.Left,{className:`flex-auto`,children:w}),(0,Z.jsx)(G.Actions,{className:`flex-auto justify-end`,children:E})]}),(0,Z.jsx)(`div`,{className:`px-[8vmin] md:hidden`,children:(0,Z.jsx)(De,{value:e,variant:`button`,onValueChange:t,children:(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(q,{value:`official`,children:`Official themes`}),(0,Z.jsx)(q,{value:`installed`,children:`Installed`})]})})}),_&&(0,Z.jsx)(Ot,{action:`uploaded`,fatalErrors:_.fatalErrors,okLabel:`Re-upload`,themeName:_.themeName,title:`Theme not uploaded`,onClose:()=>v(null),onRetry:()=>{v(null),T()}}),y&&(0,Z.jsx)(Bt,{...y,onClose:()=>b(null)})]})},qt=({currentTab:e,onSelectTheme:t,themes:n})=>{switch(e){case`official`:return(0,Z.jsx)(zt,{onSelectTheme:t});case`installed`:return(0,Z.jsx)(Pt,{themes:n})}return null},Jt=({source:e,themeRef:t})=>{let[n,r]=(0,X.useState)(`official`),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(`desktop`),[l,u]=(0,X.useState)(!1),[d,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),{updateRoute:v}=Y(),y=_t(),{data:{themes:b}={}}=Ve(),{mutateAsync:x}=Re(),{mutateAsync:S}=Ke(),{checkThemeLimitError:C}=Dt(),w=c(),{confirm:T,showLimit:E}=ht(),D=e=>{a(e)};if((0,X.useEffect)(()=>{h(!0)},[]),(0,X.useEffect)(()=>{(async()=>{if(e&&t&&!d&&m){let e=t.split(`/`)[1];if(await C(e)){v(`theme`);return}let n=b?.map(e=>e.name)||[],r=n.includes(e.toLowerCase()),i=n.indexOf(e.toLowerCase()),a=b?.[i],o=(0,Z.jsxs)(Z.Fragment,{children:[`By clicking below, `,(0,Z.jsx)(`strong`,{children:e}),` will automatically be activated as the theme for your site.`,r&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`br`,{}),(0,Z.jsx)(`br`,{}),`This will overwrite your existing version of `,(0,Z.jsx)(`strong`,{children:e}),a?.active?` which is your active theme`:``,`. All custom changes will be lost.`]})]});T({title:`Install Theme`,prompt:o,okLabel:`Install`,cancelLabel:`Cancel`,okRunningLabel:`Installing...`,okVariant:`default`,onOk:async e=>{let n;p(!0);try{r&&b&&b.splice(i,1),n=await x(t),n?.themes[0]&&(await S(n.themes[0].name),f.success(`Theme activated`,{description:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:n.themes[0].name}),` is now your active theme`]})})),e?.remove(),v(``)}catch(e){w(e)}}})}})()},[t,e,x,w,S,v,b,d,C,T,m]),!b)return;let O,k;if(i){O=b.find(e=>e.name.toLowerCase()===i.name.toLowerCase()),k=async()=>{let t=await C(i.name);if(t){E({prompt:t,onOk:()=>v({route:y,isExternal:!0})});return}return O&&!Ue(i)?new Promise(t=>{T({title:`Overwrite theme`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[`This will overwrite your existing version of `,i.name,O?.active?`, which is your active theme`:``,`. All custom changes will be lost.`]}),okLabel:`Overwrite`,okRunningLabel:`Installing...`,cancelLabel:`Cancel`,okVariant:`destructive`,onOk:async n=>{n?.remove(),await e(),t()}})}):e()};let e=async()=>{let e=`Installed successfully`,t;if(Ue(i))e=`Activate theme`,t=(0,Z.jsxs)(Z.Fragment,{children:[`Do you want to activate `,(0,Z.jsx)(`strong`,{children:i.name}),` as the theme for your site?`]});else{u(!0);let e;try{e=await x(i.ref)}catch(e){w(e)}finally{u(!1)}if(!e)return;O=e.themes[0]}_({title:e,action:`installed`,statusMessage:t,installedTheme:O,onActivate:()=>{v(``)}})}}return(0,Z.jsxs)(Fe,{animate:!1,cancelLabel:``,footer:!1,padding:!1,size:`full`,testId:`theme-modal`,title:``,scrolling:!0,onCancel:()=>{v(``)},onClose:()=>{v(``)},children:[(0,Z.jsx)(`div`,{className:`flex h-full justify-between`,children:(0,Z.jsxs)(`div`,{className:`grow`,children:[i&&(0,Z.jsx)(Wt,{installedTheme:O,isInstalling:l,selectedTheme:i,onBack:()=>{a(null)},onClose:()=>{v(``)},onInstall:k}),(0,Z.jsx)(Kt,{currentTab:n,previewMode:o,selectedTheme:i,setCurrentTab:r,setPreviewMode:s,setSelectedTheme:a,themes:b}),!i&&(0,Z.jsx)(qt,{currentTab:n,themes:b,onSelectTheme:D})]})}),g&&(0,Z.jsx)(Bt,{...g,onClose:()=>_(null)})]})},Yt=e(n(),1),Xt=({children:e,to:t,classNames:n})=>{let r=t||document.body;return r?(0,Yt.createPortal)((0,Z.jsx)(`div`,{className:n,onMouseDown:e=>{e.stopPropagation()},children:(0,Z.jsx)(`div`,{children:e})}),r):(0,Z.jsx)(Z.Fragment,{children:e})},Zt=({unsplashProviderConfig:e,onClose:t,onImageInsert:n})=>(0,Z.jsx)(Xt,{classNames:`settings-app`,children:(0,Z.jsx)(dt,{unsplashProviderConfig:e,onClose:t,onImageInsert:n})}),Q={heading:[{name:`Cardo`,creator:`David Perry`},{name:`Chakra Petch`,creator:`Cadson Demak`},{name:`Fira Mono`,creator:`Carrois Apostrophe`},{name:`Fira Sans`,creator:`Carrois Apostrophe`},{name:`IBM Plex Serif`,creator:`Mike Abbink`},{name:`Inter`,creator:`Rasmus Andersson`},{name:`JetBrains Mono`,creator:`JetBrains`},{name:`Libre Baskerville`,creator:`Impallari Type`},{name:`Lora`,creator:`Cyreal`},{name:`Manrope`,creator:`Mikhail Sharanda`},{name:`Merriweather`,creator:`Sorkin Type`},{name:`Noto Sans`,creator:`Google`},{name:`Noto Serif`,creator:`Google`},{name:`Nunito`,creator:`Vernon Adams`},{name:`Old Standard TT`,creator:`Alexey Kryukov`},{name:`Poppins`,creator:`Indian Type Foundry`},{name:`Roboto`,creator:`Christian Robertson`},{name:`Rufina`,creator:`Martin Sommaruga`},{name:`Space Grotesk`,creator:`Florian Karsten`},{name:`Space Mono`,creator:`Colophon Foundry`},{name:`Tenor Sans`,creator:`Denis Masharov`}],body:[{name:`Fira Mono`,creator:`Carrois Apostrophe`},{name:`Fira Sans`,creator:`Carrois Apostrophe`},{name:`IBM Plex Serif`,creator:`Mike Abbink`},{name:`Inter`,creator:`Rasmus Andersson`},{name:`JetBrains Mono`,creator:`JetBrains`},{name:`Lora`,creator:`Cyreal`},{name:`Manrope`,creator:`Mikhail Sharanda`},{name:`Merriweather`,creator:`Sorkin Type`},{name:`Noto Sans`,creator:`Google`},{name:`Noto Serif`,creator:`Google`},{name:`Nunito`,creator:`Vernon Adams`},{name:`Poppins`,creator:`Indian Type Foundry`},{name:`Roboto`,creator:`Christian Robertson`},{name:`Space Mono`,creator:`Colophon Foundry`}]},$=`Theme default`,Qt=({option:e,selected:t})=>(0,Z.jsxs)(`span`,{className:`flex w-full items-center gap-4 ${e.className??``}`,"data-testid":t?`select-current-option`:`select-option`,"data-value":e.value,children:[(0,Z.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-md border border-border-default bg-surface-elevated text-2xl font-bold shadow-xs`,children:`Aa`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`text-md`,children:e.label}),(0,Z.jsx)(`span`,{className:`truncate font-sans text-sm font-normal text-muted-foreground`,children:e.hint})]})]}),$t=e=>e.split(` `).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `),en=({values:e,updateSetting:t})=>{let{isAdmin7:n}=y(),i=n?N:U,{mutateAsync:a}=W(),{settings:o}=gt(),[s]=$e(o,[`unsplash`]),[l,u]=(0,X.useState)(!1),{unsplashConfig:d}=r(),f=c(),p=async(e,n)=>{try{t(e,ge(await a({file:n})))}catch(e){let t=e;t.response.status===415&&(t.message=`Unsupported file type`),f(t)}},m=St(),{data:h}=Ve(),g=h?.themes.find(e=>e.active),b=g?`${$t(g.name)} (v${g.package?.version||`1.0`})`:`Loading...`,[x,S]=(0,X.useState)(Q.heading.find(t=>t.name===e.headingFont)||{name:$,creator:b}),[C,T]=(0,X.useState)(Q.heading.find(t=>t.name===e.bodyFont)||{name:$,creator:b}),E=(e,t=!0)=>{let n=``;return e===`Cardo`?n=v(`font-cardo`,t&&`font-bold`):e===`Manrope`?n=v(`font-manrope`,t&&`font-bold`):e===`Merriweather`?n=v(`font-merriweather`,t&&`font-bold`):e===`Nunito`?n=v(`font-nunito`,t&&`font-semibold`):e===`Old Standard TT`?n=v(`font-old-standard-tt`,t&&`font-bold`):e===`Prata`?n=v(`font-prata`,t&&`font-normal`):e===`Roboto`?n=v(`font-roboto`,t&&`font-bold`):e===`Rufina`?n=v(`font-rufina`,t&&`font-bold`):e===`Tenor Sans`?n=v(`font-tenor-sans`,t&&`font-normal`):e===`Chakra Petch`?n=v(`font-chakra-petch`,t&&`font-normal`):e===`Fira Mono`?n=v(`font-fira-mono`,t&&`font-bold`):e===`Fira Sans`?n=v(`font-fira-sans`,t&&`font-bold`):e===`IBM Plex Serif`?n=v(`font-ibm-plex-serif`,t&&`font-bold`):e===`Inter`?n=v(`font-inter`,t&&`font-bold`):e===`JetBrains Mono`?n=v(`font-jetbrains-mono`,t&&`font-bold`):e===`Lora`?n=v(`font-lora`,t&&`font-bold`):e===`Noto Sans`?n=v(`font-noto-sans`,t&&`font-bold`):e===`Noto Serif`?n=v(`font-noto-serif`,t&&`font-bold`):e===`Poppins`?n=v(`font-poppins`,t&&`font-bold`):e===`Space Grotesk`?n=v(`font-space-grotesk`,t&&`font-bold`):e===`Space Mono`&&(n=v(`font-space-mono`,t&&`font-bold`)),n},D=Q.heading.map(e=>{let t=E(e.name,!0);return{label:e.name,value:e.name,hint:e.creator,className:t}});D.unshift({label:$,value:$,hint:b,className:`font-sans font-normal`});let O=Q.body.map(e=>{let t=E(e.name,!1);return{label:e.name,value:e.name,hint:e.creator,className:t}});O.unshift({label:$,value:$,hint:b,className:`font-sans font-normal`});let k=(e,t)=>e===$?``:E(e,t),A=D.find(e=>e.value===x.name)||D[0],j=O.find(e=>e.value===C.name)||O[0];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(I,{className:`mt-6 mb-12 gap-6`,children:[(0,Z.jsx)(bt,{debounceMs:200,direction:`rtl`,testId:`accent-color-picker`,title:(0,Z.jsx)(`div`,{children:`Accent color`}),value:e.accentColor,onChange:e=>t(`accent_color`,e)}),(0,Z.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{children:`Publication icon`}),(0,Z.jsxs)(z,{className:`mr-5 max-w-[160px]`,children:[`A square, social icon, at least `,_(60),`×`,_(60),`px`]})]}),(0,Z.jsx)(`div`,{className:`flex gap-3`,children:(0,Z.jsx)(me,{className:e.icon?`size-16.5`:`h-9 w-40`,children:e.icon?(0,Z.jsxs)(H,{background:`checkerboard`,children:[(0,Z.jsx)(he,{id:`logo`,src:e.icon}),(0,Z.jsx)(V,{className:`top-1 right-1`,children:(0,Z.jsx)(U,{"aria-label":`Remove publication icon`,"data-testid":`image-delete-button`,onClick:()=>t(`icon`,null),children:(0,Z.jsx)(w,{})})})]}):(0,Z.jsx)(pe,{inputId:`logo`,onDropAccepted:([e])=>void p(`icon`,e),children:`Upload icon`})})})]}),(0,Z.jsxs)(`div`,{className:`flex items-start justify-between ${e.icon&&`mt-2`}`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{children:`Publication logo`}),(0,Z.jsx)(z,{className:`mr-5 max-w-[160px]`,children:`Appears usually in the main header of your theme`})]}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(me,{className:`h-15 w-40`,children:e.logo?(0,Z.jsxs)(H,{background:`checkerboard`,children:[(0,Z.jsx)(he,{className:`object-contain`,id:`site-logo`,src:e.logo}),(0,Z.jsx)(V,{className:`top-1 right-1`,children:(0,Z.jsx)(U,{"aria-label":`Remove publication logo`,"data-testid":`image-delete-button`,onClick:()=>t(`logo`,null),children:(0,Z.jsx)(w,{})})})]}):(0,Z.jsx)(pe,{inputId:`site-logo`,onDropAccepted:([e])=>void p(`logo`,e),children:`Upload logo`})})})]}),(0,Z.jsxs)(`div`,{className:`mt-2 flex items-start justify-between`,"data-testid":`publication-cover`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{children:`Publication cover`}),(0,Z.jsx)(z,{className:`mr-5 max-w-[160px]`,children:`Usually as a large banner image on your index pages`})]}),(0,Z.jsx)(me,{className:`h-23.75 w-40`,children:e.coverImage?(0,Z.jsxs)(H,{children:[(0,Z.jsx)(he,{id:`cover`,src:e.coverImage}),(0,Z.jsxs)(V,{className:`top-1 right-1`,children:[m.isEnabled&&(0,Z.jsx)(U,{"aria-label":`Edit publication cover`,onClick:()=>m.openEditor({image:e.coverImage||``,handleSave:async e=>{try{t(`cover_image`,ge(await a({file:e})))}catch(e){f(e)}}}),children:(0,Z.jsx)(F,{})}),(0,Z.jsx)(U,{"aria-label":`Remove publication cover`,"data-testid":`image-delete-button`,onClick:()=>t(`cover_image`,null),children:(0,Z.jsx)(w,{})})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pe,{inputId:`cover`,onDropAccepted:([e])=>void p(`cover_image`,e),children:`Upload cover`}),s&&(0,Z.jsx)(V,{className:`top-1 right-1 opacity-100`,children:(0,Z.jsx)(i,{"aria-label":`Select publication cover from Unsplash`,"data-testid":`toggle-unsplash-button`,size:`icon`,variant:`ghost`,onClick:()=>u(!0),children:n?(0,Z.jsx)(ft,{name:`unsplash`,size:16}):(0,Z.jsx)(ee,{})})})]})}),l&&d&&s&&(0,Z.jsx)(Zt,{unsplashProviderConfig:d,onClose:()=>{u(!1)},onImageInsert:e=>{e.src&&t(`cover_image`,e.src),u(!1)}})]})]}),(0,Z.jsxs)(de,{className:`-mt-4 gap-0`,children:[(0,Z.jsx)(fe,{className:`mb-4 text-md! leading-supertight font-bold md:text-lg!`,children:`Typography`}),(0,Z.jsxs)(I,{className:`mb-12 gap-6`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{children:`Heading font`}),(0,Z.jsxs)(Ce,{value:A.value,onValueChange:e=>{e===$?(S({name:$,creator:b}),t(`heading_font`,``)):(S({name:e,creator:Q.heading.find(t=>t.name===e)?.creator||``}),t(`heading_font`,e))},children:[(0,Z.jsx)(xe,{"aria-label":`Heading font`,className:`h-16 pl-2 text-left ${k(A.label,!0)}`,"data-testid":`heading-font-select`,children:(0,Z.jsx)(Se,{children:(0,Z.jsx)(Qt,{option:A,selected:!0})})}),(0,Z.jsx)(be,{children:D.map(e=>(0,Z.jsx)(ye,{value:e.value,children:(0,Z.jsx)(Qt,{option:e})},e.value))})]})]}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{children:`Body font`}),(0,Z.jsxs)(Ce,{value:j.value,onValueChange:e=>{e===$?(T({name:$,creator:b}),t(`body_font`,``)):(T({name:e,creator:Q.body.find(t=>t.name===e)?.creator||``}),t(`body_font`,e))},children:[(0,Z.jsx)(xe,{"aria-label":`Body font`,className:`h-16 pl-2 text-left ${k(j.label,!1)}`,"data-testid":`body-font-select`,children:(0,Z.jsx)(Se,{children:(0,Z.jsx)(Qt,{option:j,selected:!0})})}),(0,Z.jsx)(be,{className:`max-h-52`,children:O.map(e=>(0,Z.jsx)(ye,{value:e.value,children:(0,Z.jsx)(Qt,{option:e})},e.value))})]})]})]})]})]})},tn=e(pt(),1);function nn(e,t){return e.visibility?(0,tn.default)(e.visibility).queryJSON(t):!0}function rn({description:e,accentColor:t,icon:n,logo:r,coverImage:i,themeSettings:a,bodyFont:o,headingFont:s}){if(!a)return;let c=a.reduce((e,{key:t,value:n})=>({...e,[t]:n}),{}),l=new URLSearchParams;l.append(`c`,t),l.append(`d`,e),l.append(`icon`,n),l.append(`logo`,r),l.append(`cover`,i),l.append(`bf`,o),l.append(`hf`,s);let u={};return a.forEach(e=>{u[e.key]=nn(e,c)?e.value:null}),l.append(`custom`,JSON.stringify(u)),l.toString()}var an=({settings:e,url:t,isVisible:n=!0})=>{let r=rn({...e});return(0,Z.jsx)(Ct,{addDelay:!1,className:`absolute -top-px -left-px size-[calc(110%_+_3px)] origin-top-left scale-[.90909] bg-white max-[1600px]:size-[calc(130%_+_3px)] max-[1600px]:scale-[.76923]`,generateContent:(0,X.useCallback)(e=>{if(!t||!r)return;let n=new URL(t);n.searchParams.set(`admin_toolbar`,`0`),fetch(n.toString(),{method:`POST`,headers:{"Content-Type":`text/html;charset=utf-8`,"x-ghost-preview":r,Accept:`text/html`},mode:`cors`,credentials:`include`}).then(e=>e.text()).then(t=>{let n=`html { pointer-events: none; }`,r=new DOMParser().parseFromString(t,`text/html`),i=r.querySelector(`style`),a=i?.innerHTML;a?i.innerHTML=`${a}\n\n${n}`:r.head.innerHTML+=`<style>${n}</style>`;let o=(r.doctype?new XMLSerializer().serializeToString(r.doctype):``)+r.documentElement.outerHTML;e.contentDocument?.open(),e.contentDocument?.write(o),e.contentDocument?.close()})},[r,t]),height:`100%`,parentClassName:`absolute inset-0 overflow-hidden ${n?`z-10 opacity-100`:`z-0 opacity-0 pointer-events-none`}`,testId:`theme-preview`,width:`100%`})},on=({setting:e,setSetting:t})=>{let[n,r]=(0,X.useState)({});(0,X.useEffect)(()=>{let t=e.value===null?``:String(e.value);r(n=>({...n,[e.key]:t}))},[e]);let i=e=>{n[e]!==void 0&&t(n[e])},a=(e,t)=>{r(n=>({...n,[e]:t}))},{mutateAsync:o}=W(),s=c(),l=async e=>{try{t(ge(await o({file:e})))}catch(e){s(e)}};switch(e.type){case`text`:return(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{htmlFor:`theme-setting-${e.key}`,children:J(e.key)}),(0,Z.jsx)(_e,{id:`theme-setting-${e.key}`,value:n[e.key]||``,onBlur:()=>i(e.key),onChange:t=>a(e.key,t.target.value)}),e.description&&(0,Z.jsx)(z,{children:e.description})]});case`boolean`:return(0,Z.jsxs)(B,{orientation:`horizontal`,children:[(0,Z.jsxs)(L,{children:[(0,Z.jsx)(R,{htmlFor:`theme-setting-${e.key}`,children:J(e.key)}),e.description&&(0,Z.jsx)(z,{children:e.description})]}),(0,Z.jsx)(we,{checked:!!e.value,id:`theme-setting-${e.key}`,onCheckedChange:t})]});case`select`:return(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{children:J(e.key)}),(0,Z.jsxs)(Ce,{value:e.value,onValueChange:t,children:[(0,Z.jsx)(xe,{"aria-label":J(e.key),"data-testid":`setting-select-${e.key}`,children:(0,Z.jsx)(Se,{})}),(0,Z.jsx)(be,{children:e.options.map(e=>(0,Z.jsx)(ye,{value:e,children:e},e))})]}),e.description&&(0,Z.jsx)(z,{children:e.description})]});case`color`:return(0,Z.jsx)(bt,{debounceMs:200,direction:`rtl`,hint:e.description,title:J(e.key),value:e.value||``,onChange:e=>t(e)});case`image`:return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(R,{children:J(e.key)}),(0,Z.jsx)(me,{className:e.value?`h-25`:`h-8`,children:e.value?(0,Z.jsxs)(H,{children:[(0,Z.jsx)(he,{id:`custom-${e.key}`,src:e.value}),(0,Z.jsx)(V,{children:(0,Z.jsx)(U,{"aria-label":`Remove image`,onClick:()=>t(null),children:(0,Z.jsx)(w,{})})})]}):(0,Z.jsx)(pe,{inputId:`custom-${e.key}`,onDropAccepted:e=>void l(e[0]),children:`Upload image`})}),e.description&&(0,Z.jsx)(z,{children:e.description})]})}},sn={source:[`title_font`,`body_font`],casper:[`title_font`,`body_font`],alto:[`title_font`,`body_font`],bulletin:[`title_font`,`body_font`],dawn:[`title_font`,`body_font`],digest:[`title_font`,`body_font`],dope:[`title_font`,`body_font`],ease:[`title_font`,`body_font`],edge:[`title_font`,`body_font`],edition:[`title_font`,`body_font`],episode:[`typography`],headline:[`title_font`,`body_font`],journal:[`title_font`,`body_font`],london:[`title_font`,`body_font`],ruby:[`title_font`,`body_font`],solo:[`typography`],taste:[`style`],wave:[`title_font`,`body_font`]},cn=({sections:e,updateSetting:t})=>{let{data:n}=Ve(),r=n?.themes.find(e=>e.active),i=r?.package.name?.toLowerCase()||``,a=r?.package.author?.name||``,{supportsCustomFonts:o}=kt();return(0,Z.jsx)(Z.Fragment,{children:e.map(e=>{let n=e.settings.filter(t=>nn(t,e.settings.reduce((e,{key:t,value:n})=>({...e,[t]:n}),{}))),r;return(0,Z.jsxs)(de,{className:`gap-0 first-of-type:mt-6`,children:[(0,Z.jsx)(fe,{className:`mb-4 text-md! leading-supertight font-bold md:text-lg!`,children:e.title}),(0,Z.jsx)(I,{className:`mb-12 gap-4`,children:n.map(e=>{let n=``;e.type===`boolean`&&r!==`boolean`&&r!==void 0&&(n=`mt-3`),(e.type===`text`||e.type===`select`)&&(r===`text`||r===`select`)&&(n=`mt-2`);let s=sn[i];return s&&s.includes(e.key)&&a===`Ghost Foundation`&&o&&(n+=` hidden`),r=e.type,(0,Z.jsx)(`div`,{className:n,children:(0,Z.jsx)(on,{setSetting:n=>t({...e,value:n}),setting:e},e.key)},e.key)})})]},e.id)})})},ln=({globalSettings:e,themeSettingSections:t,updateGlobalSetting:n,updateThemeSetting:r,onTabChange:i})=>{let[a,o]=(0,X.useState)(`global`);return(0,Z.jsx)(`div`,{className:`flex h-full flex-col justify-between`,children:(0,Z.jsx)(`div`,{className:`grow p-7 pt-0`,"data-testid":`design-setting-tabs`,children:t.length>0?(0,Z.jsxs)(De,{value:a,variant:`underline`,onValueChange:e=>{o(e),i(e)},children:[(0,Z.jsxs)(Ee,{className:`sticky top-0 z-50 bg-surface-elevated-2`,children:[(0,Z.jsx)(q,{value:`global`,children:`Brand`}),(0,Z.jsx)(q,{value:`theme-settings`,children:`Theme`})]}),(0,Z.jsx)(Te,{value:`global`,children:(0,Z.jsx)(en,{updateSetting:n,values:e})}),(0,Z.jsx)(Te,{value:`theme-settings`,children:(0,Z.jsx)(cn,{sections:t,updateSetting:r})})]}):(0,Z.jsx)(en,{updateSetting:n,values:e})})})},un=()=>{let{settings:e,siteData:t}=gt(),{mutateAsync:n}=Xe(),{data:{posts:[r]}={posts:[]}}=m({searchParams:{filter:`status:published`,order:`published_at DESC`,limit:`1`,fields:`id,url`}}),{data:i}=We(),{mutateAsync:a}=He(),o=c(),[s,l]=(0,X.useState)(`homepage`),[u,d]=(0,X.useState)(`desktop`),{updateRoute:f}=Y(),h=g(),_=Tt().getParam(`ref`),{formState:v,saveState:y,handleSave:b,updateForm:x,setFormState:S,okProps:C}=p({initialState:{settings:e,themeSettings:i?.custom_theme_settings},savingDelay:500,onSave:async()=>{if(v.themeSettings?.some(e=>e.dirty)){let e=await a(v.themeSettings);S(t=>({...t,themeSettings:e.custom_theme_settings}))}if(v.settings.some(e=>e.dirty)){let{settings:e}=await n(v.settings.filter(e=>e.dirty));S(t=>({...t,settings:e}))}},onSaveError:o});(0,X.useEffect)(()=>{i&&S(e=>({...e,themeSettings:i.custom_theme_settings}))},[S,i]);let w=(e,t)=>{x(n=>({...n,settings:n.settings.map(n=>n.key===e?{...n,value:t,dirty:!0}:n)}))},T=e=>{x(t=>({...t,themeSettings:t.themeSettings?.map(t=>t.key===e.key?{...e,dirty:!0}:t)}))},[D,O,k,ee,A,te,ne]=$e(v.settings,[`description`,`accent_color`,`icon`,`logo`,`cover_image`,`heading_font`,`body_font`]),M=(v.themeSettings||[]).reduce((e,t)=>{let n=t.group===`homepage`||t.group===`post`?t.group:`site-wide`;return{...e,[n]:(e[n]||[]).concat(t)}},{}),N=Object.entries(M).map(([e,t])=>({id:e,settings:t||[],title:e===`site-wide`?`Site wide`:e===`homepage`?`Homepage`:`Post`})),P=e=>{r&&l(e)},F=e=>{l(e===`post`&&r?`post`:`homepage`)},re=[{id:`homepage`,url:it(t)},...r?[{id:`post`,url:r.url}]:[]],ie={description:D,accentColor:O,icon:k,logo:ee,coverImage:A,themeSettings:v.themeSettings,headingFont:te,bodyFont:ne},ae=(0,Z.jsx)(`div`,{className:`relative size-full`,children:re.map(({id:e,url:t})=>(0,Z.jsx)(an,{isVisible:s===e,settings:ie,url:t},e))}),oe=u===`desktop`?(0,Z.jsx)(K,{"data-testid":`preview-desktop`,device:`desktop`,children:ae}):(0,Z.jsx)(K,{"data-testid":`preview-mobile`,device:`mobile`,children:ae}),se=r?(0,Z.jsx)(De,{value:s,variant:`button`,onValueChange:P,children:(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(q,{value:`homepage`,children:`Homepage`}),(0,Z.jsx)(q,{value:`post`,children:`Post`})]})}):void 0,ce=(0,Z.jsxs)(ke,{size:`default`,type:`single`,value:u,onValueChange:e=>{(e===`desktop`||e===`mobile`)&&d(e)},children:[(0,Z.jsx)(Oe,{"aria-label":`Desktop`,value:`desktop`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(Oe,{"aria-label":`Mobile`,value:`mobile`,children:(0,Z.jsx)(E,{})})]}),le=(0,Z.jsx)(ln,{globalSettings:{description:D,accentColor:O,icon:k,logo:ee,coverImage:A,headingFont:te,bodyFont:ne},handleSave:b,themeSettingSections:N,updateGlobalSetting:w,updateThemeSetting:T,onTabChange:F});return(0,Z.jsx)(xt,{buttonsDisabled:C.disabled,cancelLabel:`Close`,deviceSelector:ce,dirty:y===`unsaved`,okLabel:C.label||`Save`,okVariant:C.variant,preview:oe,previewToolbarTabs:se,sidebar:le,sidebarPadding:!1,siteLink:it(t),size:`full`,testId:`design-modal`,title:`Design`,onClose:()=>{_===`setup`?h(`/analytics`):f(`design`)},onOk:async()=>{await b({fakeWhenUnchanged:!0})}})},dn=({title:e,prompt:t,cancelLabel:n=`Cancel`,okLabel:r=`OK`,okVariant:i=`default`,onResolve:a})=>(0,Z.jsx)(Fe,{backDropClick:!1,cancelLabel:n,okLabel:r,okVariant:i,testId:`theme-editor-confirm-modal`,title:e,width:540,onCancel:()=>a(!1),onClose:()=>a(!1),onOk:()=>a(!0),children:(0,Z.jsx)(`div`,{className:`py-4`,children:t})}),fn=({title:e,prompt:t,fieldTitle:n,initialValue:r,placeholder:i,cancelLabel:a=`Cancel`,okLabel:o=`Continue`,onResolve:s})=>{let[c,l]=(0,X.useState)(r);return(0,Z.jsx)(Fe,{backDropClick:!1,cancelLabel:a,okDisabled:!c.trim(),okLabel:o,testId:`theme-editor-input-modal`,title:e,width:540,onCancel:()=>s(null),onClose:()=>s(null),onOk:()=>s(c),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 py-4`,children:[t,(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{htmlFor:`theme-editor-input`,children:n}),(0,Z.jsx)(_e,{id:`theme-editor-input`,placeholder:i,value:c,autoFocus:!0,onChange:e=>l(e.target.value)})]})]})})},pn=`inline-flex items-center gap-2 rounded-md border px-3 py-1.5 text-[13px] font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#4a9eff] disabled:cursor-not-allowed disabled:opacity-50`,mn=`${pn} border-[#2f333b] bg-transparent text-[#e6e7ea] hover:bg-[#1f2228]`,hn=`${pn} border-transparent bg-green text-black hover:bg-green-400`,gn=({currentThemeName:e,changes:t,isSaving:n,onClose:r,onSave:i})=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-[#23262c] bg-[#1a1d21] px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-[14px] font-semibold text-[#f4f5f7]`,children:`Edit theme`}),(0,Z.jsx)(`span`,{className:`truncate text-[12px] text-[#8a8f98]`,children:e})]}),t.length>0&&(0,Z.jsxs)(`span`,{className:`rounded-full border border-transparent bg-[#3b2a16] px-2.5 py-1 text-[11px] leading-none text-[#f5a623]`,children:[_(t.length),` `,t.length===1?`file modified`:`files modified`]}),(0,Z.jsx)(`div`,{className:`grow`}),(0,Z.jsxs)(`button`,{className:mn,type:`button`,onClick:r,children:[(0,Z.jsx)(D,{size:14}),`Close`]}),(0,Z.jsxs)(`button`,{className:hn,disabled:n,type:`button`,onClick:i,children:[(0,Z.jsx)(M,{size:14}),n?`Saving…`:`Save`]})]}),_n=e=>{let t={type:`dir`,name:``,path:``,children:new Map};for(let n of Object.keys(e).sort()){let r=n.split(`/`),i=t;for(let t=0;t<r.length;t+=1){let a=r[t];if(t===r.length-1){i.children.set(a,{type:`file`,name:a,path:n,editable:e[n].editable});continue}let o=`${r.slice(0,t+1).join(`/`)}/`,s=i.children.get(a);if(s?.type===`dir`){i=s;continue}let c={type:`dir`,name:a,path:o,children:new Map};i.children.set(a,c),i=c}}return t},vn=e=>e.sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`dir`?-1:1),yn=`inline-flex h-5 w-5 items-center justify-center rounded-sm text-[#c8ccd3] transition-opacity hover:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#4a9eff] disabled:cursor-not-allowed disabled:opacity-30`,bn=({currentFiles:e,selectedNode:t,setSelectedNode:n,expandedDirectories:r,setExpandedDirectories:i,changesMap:a,isLoading:o,onCreateFile:s,onRenameSelected:c,onDeleteSelected:l,onOpenFile:u})=>{let d=(e,o=0)=>{if(e.type===`file`){let n=t?.type===`file`&&t.path===e.path,r=a.get(e.path);return(0,Z.jsxs)(`button`,{className:`flex min-h-6 w-full items-center gap-1.5 rounded px-2 py-1 text-left text-[13px] leading-5 ${n?`bg-[#243043] text-white`:`text-[#c8ccd3] hover:bg-[#1f2228]`} ${e.editable?``:`opacity-70`}`,style:{paddingLeft:`${o*14+8}px`},type:`button`,onClick:()=>u(e.path),children:[(0,Z.jsx)(`span`,{className:`w-3 shrink-0`}),(0,Z.jsx)(S,{size:14}),(0,Z.jsx)(`span`,{className:`min-w-0 grow truncate`,children:e.name}),r&&(0,Z.jsx)(`span`,{className:`mr-1 size-1.5 shrink-0 rounded-full ${r===`deleted`?`bg-[#ff6b6b]`:r===`added`?`bg-[#14b886]`:`bg-[#f5a623]`}`})]},e.path)}let s=r.has(e.path),c=t?.type===`dir`&&t.path===e.path,l=vn(Array.from(e.children?.values()||[]));return(0,Z.jsxs)(`div`,{children:[e.path&&(0,Z.jsxs)(`button`,{className:`flex min-h-6 w-full items-center gap-1.5 rounded px-2 py-1 text-left text-[13px] leading-5 ${c?`bg-[#202630] text-white`:`text-[#c8ccd3] hover:bg-[#1f2228]`}`,style:{paddingLeft:`${o*14+8}px`},type:`button`,onClick:()=>{n({type:`dir`,path:e.path}),i(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n})},children:[s?(0,Z.jsx)(O,{className:`shrink-0 text-[#6a6f78]`,size:12}):(0,Z.jsx)(ne,{className:`shrink-0 text-[#6a6f78]`,size:12}),s?(0,Z.jsx)(P,{className:`shrink-0 text-[#8a8f98]`,size:14}):(0,Z.jsx)(C,{className:`shrink-0 text-[#8a8f98]`,size:14}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name})]}),(e.path===``||s)&&(0,Z.jsx)(`div`,{children:l.map(t=>d(t,e.path?o+1:o))})]},e.path||`root`)};return(0,Z.jsxs)(`aside`,{className:`flex w-[280px] shrink-0 flex-col border-r border-[#23262c] bg-[#16181c]`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-[#23262c] px-3 py-2`,children:[(0,Z.jsxs)(`div`,{className:`text-[12px] font-medium text-[#c8ccd3]`,children:[Object.keys(e).length,` files`]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`button`,{"aria-label":`New file`,className:yn,type:`button`,onClick:s,children:(0,Z.jsx)(A,{size:13})}),(0,Z.jsx)(`button`,{"aria-label":`Rename selected item`,className:yn,disabled:!t,type:`button`,onClick:c,children:(0,Z.jsx)(F,{size:13})}),(0,Z.jsx)(`button`,{"aria-label":`Delete selected item`,className:yn,disabled:!t,type:`button`,onClick:l,children:(0,Z.jsx)(w,{size:13})})]})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2`,children:o?(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-center text-[13px] text-[#8a8f98]`,children:[(0,Z.jsx)(`div`,{className:`size-5 animate-spin rounded-full border-2 border-[#2f333b] border-t-[#14b886]`}),(0,Z.jsx)(`span`,{children:`Loading theme files…`})]}):Object.keys(e).length===0?(0,Z.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[#8a8f98]`,children:`This theme archive does not contain any files.`}):d(_n(e))})]})},xn=e(Et(),1),Sn=e=>{if(!e.startsWith(`theme/edit/`))return{themeName:null,isInvalid:!1};let t=e.slice(11).split(`?`)[0];if(!t||t.includes(`/`))return{themeName:null,isInvalid:!0};try{let e=decodeURIComponent(t);return!e||e.includes(`/`)?{themeName:null,isInvalid:!0}:{themeName:e,isInvalid:!1}}catch{return{themeName:null,isInvalid:!0}}},Cn={maxFiles:1e3,maxExtractedBytes:32*1024*1024},wn=class extends Error{reason;constructor(e,t){super(t),this.name=`ThemeArchiveExtractionError`,this.reason=e}},Tn=new Set([`css`,`cjs`,`hbs`,`handlebars`,`htm`,`html`,`js`,`json`,`less`,`md`,`markdown`,`mjs`,`sass`,`scss`,`svg`,`txt`,`xml`,`yaml`,`yml`]),En=new Set([`.editorconfig`,`.eslintignore`,`.eslintrc`,`.gitattributes`,`.gitignore`,`.npmignore`,`.prettierignore`,`.prettierrc`,`CODEOWNERS`,`LICENSE`,`LICENCE`,`NOTICE`,`Procfile`]),Dn=e=>{if(Tn.has(On(e)))return!0;let t=e.split(`/`).at(-1)||e;return En.has(t)},On=e=>{let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()},kn=e=>{let t=e.trim().replace(/^\/+/,``).replace(/\/+/g,`/`);if(!t)return null;let n=t.split(`/`).filter(Boolean);return n.length===0||n.some(e=>e===`.`||e===`..`)?null:n.join(`/`)},An=e=>[`casper`,`source`].includes(e.toLowerCase()),jn=e=>{if(e.length===0)return``;let t=e[0].indexOf(`/`);if(t<=0)return``;let n=e[0].slice(0,t+1);return e.every(e=>e.startsWith(n))?n:``},Mn=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{...t,date:new Date(t.date),binary:t.binary?new Uint8Array(t.binary):null}])),Nn=`Failed to open the theme archive. Download the theme again and retry.`,Pn=e=>{let t=e/(1024*1024);return Number.isInteger(t)?`${t} MB`:`${t.toFixed(1)} MB`},Fn=e=>{let t=[];return e.forEach((e,n)=>{n.dir||t.push([e,n])}),t},In=e=>{if(e.length>Cn.maxFiles)throw new wn(`too_many_files`,`This theme archive contains too many files for the browser editor (${e.length}/${Cn.maxFiles}).`)},Ln=async e=>{try{return await xn.default.loadAsync(e)}catch{throw new wn(`invalid_archive`,Nn)}},Rn=async e=>{try{return await e.async(`uint8array`)}catch{throw new wn(`invalid_archive`,Nn)}},zn=async e=>{try{return await e.async(`string`)}catch{throw new wn(`invalid_archive`,Nn)}},Bn=e=>{let t=kn(e);if(!t||t!==e)throw new wn(`invalid_archive`,Nn);return t},Vn=(e,t)=>{let n=e+t;if(n>Cn.maxExtractedBytes)throw new wn(`too_large`,`This theme archive is too large to open in the browser editor. Extracted files must stay under ${Pn(Cn.maxExtractedBytes)}.`);return n},Hn=async e=>{let t=Fn(await Ln(e));In(t);let n=jn(t.map(([e])=>e)),r={},i=new TextEncoder,a=0;for(let[e,o]of t){let t=n?e.slice(n.length):e;if(!t)continue;let s=Bn(t);if(Dn(s))try{let e=await zn(o);a=Vn(a,i.encode(e).byteLength),r[s]={path:s,editable:!0,content:e,binary:null,date:o.date||new Date,unixPermissions:typeof o.unixPermissions==`number`?o.unixPermissions:null,dosPermissions:typeof o.dosPermissions==`number`?o.dosPermissions:null};continue}catch{}let c=await Rn(o);a=Vn(a,c.byteLength),r[s]={path:s,editable:!1,content:null,binary:c,date:o.date||new Date,unixPermissions:typeof o.unixPermissions==`number`?o.unixPermissions:null,dosPermissions:typeof o.dosPermissions==`number`?o.dosPermissions:null}}return{files:r,rootPrefix:n}},Un=async({files:e,rootPrefix:t})=>{let n=new xn.default;for(let[r,i]of Object.entries(e)){let e=`${t}${r}`,a={date:i.date,createFolders:!0,unixPermissions:i.unixPermissions??void 0,dosPermissions:i.dosPermissions??void 0};i.editable?n.file(e,i.content??``,a):n.file(e,i.binary,{...a,binary:!0})}return n.generateAsync({type:`blob`,mimeType:`application/zip`,compression:`DEFLATE`,compressionOptions:{level:6}})},Wn=({baseFiles:e,currentFiles:t})=>{let n=new Set([...Object.keys(e),...Object.keys(t)]),r=[];for(let i of Array.from(n).sort()){let n=e[i],a=t[i];if(!n&&a){r.push({path:i,editable:a.editable,status:`added`});continue}if(n&&!a){r.push({path:i,editable:n.editable,status:`deleted`});continue}!n||!a||n.editable&&a.editable&&n.content!==a.content&&r.push({path:i,editable:!0,status:`modified`})}return r},Gn=({files:e,oldPrefix:t,newPrefix:n})=>{let r={};for(let[i,a]of Object.entries(e)){if(!i.startsWith(t)){r[i]=a;continue}let e=`${n}${i.slice(t.length)}`;r[e]={...a,path:e}}return r},Kn=e=>{switch(On(e)){case`css`:case`scss`:case`sass`:case`less`:return h(()=>import(`./dist-5Ol0DC_t.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([0,1,2,3]),import.meta.url);case`js`:case`cjs`:case`mjs`:return h(()=>import(`./dist-CcN1a5SB.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([4,1,2,3]),import.meta.url);case`json`:return h(()=>import(`./dist-BcfsaiCV.js`).then(e=>e.json()),__vite__mapDeps([5,2,3]),import.meta.url);case`md`:case`markdown`:return h(()=>import(`./dist-kjTYGivb.js`).then(e=>e.markdown()),__vite__mapDeps([6,2,7,3,0,1,4]),import.meta.url);case`yaml`:case`yml`:return h(()=>import(`./dist-IMek6Acg.js`).then(e=>e.yaml()),__vite__mapDeps([8,2,3]),import.meta.url);case`hbs`:case`handlebars`:case`html`:case`htm`:case`svg`:case`xml`:return h(()=>import(`./dist-p52UDdoR.js`).then(e=>e.html()),__vite__mapDeps([7,2,3,0,1,4]),import.meta.url);default:return h(()=>import(`./dist-p52UDdoR.js`).then(e=>e.html()),__vite__mapDeps([7,2,3,0,1,4]),import.meta.url)}},qn=e=>{let t=On(e);if(!t)return`text`;switch(t){case`hbs`:return`handlebars`;case`htm`:return`html`;case`yml`:return`yaml`;default:return t}},Jn=e=>{if(e[`package.json`]?.editable)return{type:`file`,path:`package.json`};let t=Object.keys(e).sort().find(t=>e[t].editable);if(t)return{type:`file`,path:t};let n=Object.keys(e).sort()[0];return n?{type:`file`,path:n}:null},Yn=e=>{let t=e.split(`/`),n=[``];for(let e=0;e<t.length-1;e+=1)n.push(`${t.slice(0,e+1).join(`/`)}/`);return n},Xn=[`theme`,`design`],Zn=e=>Xn.some(t=>e===t||e.startsWith(`${t}/`)),Qn=()=>{let e=window.location.hash.substring(1),t=`${window.location.protocol}//${window.location.hostname}`,n;try{n=new URL(e||`/`,t)}catch{return null}let r=n.searchParams.get(`from`);return r===null?null:r===``||Zn(r)?r:null},$n=(e,t)=>{let n=`theme/edit/${encodeURIComponent(e)}`;return t===null?n:`${n}?from=${encodeURIComponent(t)}`},er=(e,t)=>!e.editable&&Dn(t),tr=/^[a-z0-9][\w-]{0,63}$/,nr=[`COMPRESSED_TOO_LARGE`,`ENTRY_TOO_LARGE`,`TOTAL_TOO_LARGE`],rr={COMPRESSED_TOO_LARGE:`Theme too large to upload`,ENTRY_TOO_LARGE:`File too large`,TOTAL_TOO_LARGE:`Theme contents too large`},ir=Ne({errors:Ae(Ne({message:Me().optional(),code:Pe(nr),errorDetails:Ne({entryName:Me().optional(),limitBytes:je().positive().finite().optional()}).optional()})).min(1)}),ar=e=>{if(!e||e<=0)return`the allowed size`;let t=e/(1024*1024);return t>=1?`${t.toFixed(1)} MB`:`${Math.round(e/1024)} KB`},or=e=>{if(!(e instanceof i))return null;let t=e.data;if(typeof t==`string`)try{t=JSON.parse(t)}catch{return null}let n=ir.safeParse(t);return n.success?n.data.errors[0]??null:null},sr=e=>{let{entryName:t,limitBytes:n}=e.errorDetails??{},r=ar(n);switch(e.code){case`COMPRESSED_TOO_LARGE`:return`The theme archive is too large to upload (max ${r}).`;case`ENTRY_TOO_LARGE`:return t?`The file "${t}" is too large (max ${r} per file).`:`One of the files is too large (max ${r} per file).`;case`TOTAL_TOO_LARGE`:return`The theme contents exceed the maximum allowed size of ${r}.`;default:return e.message||`Theme upload failed.`}},cr=e=>`inline-flex h-5 w-5 items-center justify-center rounded-sm text-[#c8ccd3] transition-opacity hover:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#4a9eff] ${e?`opacity-100`:`opacity-60`}`,lr=`flex h-full items-center justify-center p-8 text-center text-[13px] text-[#6a6f78]`,ur=yt.theme({"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:`#355070`},".cm-content ::selection":{color:`#ffffff`}},{dark:!0}),dr=({themeName:e})=>{let{updateRoute:t}=Y(),n=u(),r=c(),{data:i}=Ve(),{mutateAsync:l}=ze(),[d,p]=(0,X.useState)(e),[m,h]=(0,X.useState)({}),[g,v]=(0,X.useState)({}),[y,b]=(0,X.useState)(``),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(new Set([``])),[T,E]=(0,X.useState)(!0),[D,O]=(0,X.useState)(!1),[ee,A]=(0,X.useState)(null),[j,ne]=(0,X.useState)(!1),[M,N]=(0,X.useState)(null),P=(0,X.useRef)(null),[F,re]=(0,X.useState)(null),[ie,ae]=(0,X.useState)(null),[oe,ue]=(0,X.useState)([]);(0,X.useEffect)(()=>{let t=!0,r=()=>{p(e),h({}),v({}),b(``),S(null),w(new Set([``]))};return(async()=>{E(!0),A(null),r();try{let r=await Hn(await n(s(`/themes/${encodeURIComponent(e)}/download/`),{responseType:`arraybuffer`})),i=Mn(r.files),a=Jn(i);if(!t)return;p(e),h(Mn(r.files)),v(i),b(r.rootPrefix),S(a),w(new Set(a?.type===`file`?Yn(a.path):[``]))}catch(n){if(!t)return;n instanceof a&&n.response?A(`Failed to load theme "${e}" (${n.response.status})`):A(n instanceof Error?n.message:`Failed to load theme`)}finally{t&&E(!1)}})(),()=>{t=!1}},[e,n]),(0,X.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]);let I=(0,X.useMemo)(()=>Wn({baseFiles:m,currentFiles:g}),[m,g]),de=(0,X.useMemo)(()=>new Map(I.map(e=>[e.path,e.status])),[I]),L=x?.type===`file`?g[x.path]:null;(0,X.useEffect)(()=>{let e=!0;return L?.editable?(Kn(L.path).then(t=>{e&&ue([se({top:!0}),ce,t,...j?[yt.lineWrapping]:[],ur])}).catch(()=>{e&&ue([se({top:!0}),ce,...j?[yt.lineWrapping]:[],ur])}),()=>{e=!1}):(ue([]),()=>{e=!1})},[j,L]);let R=(0,X.useCallback)(()=>{let e=P.current;e&&(P.current=null,e.type===`confirmation`?e.resolve(!1):e.resolve(null))},[]),z=e=>(R(),new Promise(t=>{let n={type:`confirmation`,props:e,resolve:t};P.current=n,N(n)})),fe=e=>(R(),new Promise(t=>{let n={type:`input`,props:e,resolve:t};P.current=n,N(n)}));(0,X.useEffect)(()=>()=>R(),[R]);let B=async()=>{I.length>0&&!await z({title:`Discard changes?`,prompt:`You have unsaved theme changes. Close the editor and discard them?`,okLabel:`Discard changes`,okVariant:`destructive`})||t(Qn()??`design/change-theme`)},V=(0,X.useRef)(async()=>{}),H=!!(M||F||ie);(0,X.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`){if(e.preventDefault(),H){e.stopPropagation(),e.stopImmediatePropagation();return}V.current();return}e.key===`Escape`&&(H||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()))};return window.addEventListener(`keydown`,e,!0),()=>{window.removeEventListener(`keydown`,e,!0)}},[H]);let U=e=>{w(t=>{let n=new Set(t);for(let t of Yn(e))n.add(t);return n})},W=(e,t)=>{if(v(e),t){S(t),t.type===`file`&&U(t.path);return}x?.type===`file`&&e[x.path]||S(Jn(e))},pe=async()=>{let e=await fe({title:`Create file`,fieldTitle:`File path`,initialValue:`partials/new-file.hbs`,okLabel:`Create file`,prompt:`Add a new editable file to this theme.`}),t=e?kn(e):null;if(!t)return;if(!Dn(t)){f.error(`Only text files can be created here`,{description:`Use a text-based theme file extension such as .hbs, .css, .js, or .json.`});return}if(g[t]){f.error(`File already exists`);return}let n={...g,[t]:{path:t,editable:!0,content:``,binary:null,date:new Date,unixPermissions:null,dosPermissions:null}};W(n,{type:`file`,path:t})},me=async()=>{if(!x)return;let e=x.type===`dir`?x.path.replace(/\/$/,``):x.path,t=x.type===`dir`?`Rename folder to`:`Rename file to`,n=await fe({title:x.type===`dir`?`Rename folder`:`Rename file`,fieldTitle:`Path`,initialValue:e,okLabel:`Rename`,prompt:t}),r=n?kn(n):null;if(!r||r===e)return;if(x.type===`file`){let e=g[x.path];if(!Dn(r)&&e.editable){f.error(`Text files must keep a text file extension`);return}if(er(e,r)){f.error(`Binary files cannot be renamed to a text file`,{description:`Rename this file with a non-text extension to keep its contents intact.`});return}if(g[r]){f.error(`A file with that name already exists`);return}let t={...g},n=t[x.path];delete t[x.path],t[r]={...n,path:r,editable:Dn(r)},W(t,{type:`file`,path:r});return}let i=`${r}/`;if(i.startsWith(x.path)){f.error(`A folder cannot be renamed inside itself`);return}if(Object.keys(g).find(e=>e.startsWith(i))){f.error(`A folder with that path already exists`);return}let a=Gn({files:g,oldPrefix:x.path,newPrefix:i});W(a,{type:`dir`,path:i}),w(e=>{let t=new Set;for(let n of e){if(!n.startsWith(x.path)){t.add(n);continue}t.add(`${i}${n.slice(x.path.length)}`)}return t})},he=async()=>{if(!x)return;if(x.type===`file`){if(!await z({title:`Delete file`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[`Delete `,(0,Z.jsx)(`strong`,{children:x.path}),` from this theme?`]}),okLabel:`Delete`,okVariant:`destructive`}))return;let e={...g};delete e[x.path],W(e);return}let e=Object.keys(g).filter(e=>e.startsWith(x.path));if(!e.length||!await z({title:`Delete folder`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[`Delete `,_(e.length),` file`,e.length===1?``:`s`,` `,`from `,(0,Z.jsx)(`strong`,{children:x.path}),`?`]}),okLabel:`Delete`,okVariant:`destructive`}))return;let t={...g};for(let n of e)delete t[n];W(t)},ge=e=>{let t=m[e],n=g[e],r={...g};!t&&n?delete r[e]:t&&(r[e]={...t,binary:t.binary?new Uint8Array(t.binary):null}),W(r)},_e=async()=>{let e=(await fe({title:`Save as new theme`,fieldTitle:`Theme name`,initialValue:`${d}-edited`,okLabel:`Continue`,prompt:`Default themes cannot be overwritten. Save your edits as a new theme instead.`}))?.trim().toLowerCase();return e?tr.test(e)?An(e)?(f.error(`Built-in themes cannot be overwritten`),null):e:(f.error(`Invalid theme name`,{description:`Use 1-64 characters, starting with a letter or number. Allowed: letters, numbers, dashes, and underscores.`}),null):null},ve=async()=>{if(D)return;if(I.length===0){f.info(`No changes to save`);return}let e=d,n=An(e)?await _e():e;if(!n)return;let a=n!==e,s=i?.themes.some(e=>e.name===n)||!1,c=a?`Save your edits as "${n}"?`:`Upload ${_(I.length)} changed file${I.length===1?``:`s`} and replace "${e}"?`;if(await z({title:a?`Save theme as new copy`:`Update theme`,prompt:c,okLabel:a?`Save theme`:`Replace theme`})&&!(a&&s&&!await z({title:`Overwrite theme`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`strong`,{children:n}),` already exists. Do you want to overwrite it?`]}),okLabel:`Overwrite`,okVariant:`destructive`}))){O(!0);try{let r=await Un({files:g,rootPrefix:y}),i=(await l({file:new File([r],`${n}.zip`,{type:`application/zip`}),copySettingsFrom:a?e:void 0})).themes[0],o=Qn();h(Mn(g)),a&&(p(n),b(y?`${n}/`:``),t($n(n,o)));let s=Ye(i);a||s.length?ae({title:a?`Theme saved`:`Theme updated`,action:`saved`,installedTheme:i}):f.success(`Theme saved`,{description:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:i.name}),` has been updated.`]})})}catch(e){if(e instanceof o&&e.response?.status===422){let t=Qe(e.data?.errors);if(t){re(t);return}}let t=or(e);if(t){f.error(rr[t.code],{description:sr(t)});return}r(e)}finally{O(!1)}}};(0,X.useEffect)(()=>{V.current=ve});let G=e=>{S({type:`file`,path:e}),U(e)},K=L?de.get(L.path):null;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"aria-label":`Edit theme ${e}`,"aria-modal":`true`,className:`dark fixed inset-0 z-[140] bg-[rgba(10,11,13,0.72)] text-[#e6e7ea] backdrop-blur-[4px]`,"data-testid":`theme-code-editor-modal`,role:`dialog`,onClick:e=>{e.target===e.currentTarget&&B()},children:(0,Z.jsxs)(`div`,{className:`relative flex size-full flex-col overflow-hidden bg-[#15171a]`,children:[(0,Z.jsx)(gn,{changes:I,currentThemeName:d,isSaving:D,onClose:()=>void B(),onSave:()=>void ve()}),ee&&(0,Z.jsx)(`div`,{className:`border-b border-[#512828] bg-[#3a1d1d] px-4 py-2 text-[12px] text-[#ffbdbd]`,children:ee}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,Z.jsx)(bn,{changesMap:de,currentFiles:g,expandedDirectories:C,isLoading:T,selectedNode:x,setExpandedDirectories:w,setSelectedNode:S,onCreateFile:()=>void pe(),onDeleteSelected:()=>void he(),onOpenFile:G,onRenameSelected:()=>void me()}),(0,Z.jsxs)(`section`,{className:`flex min-w-0 flex-1 flex-col bg-[#16181c]`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2 border-b border-[#23262c] bg-[#17191d] px-4 py-2 text-[12px] text-[#8a8f98]`,children:L?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-medium text-[#e6e7ea]`,children:L.path}),(0,Z.jsx)(`span`,{className:`rounded bg-[#2a2d33] px-2 py-0.5 text-[10px] tracking-[0.04em] text-[#c8ccd3] uppercase`,children:qn(L.path)}),K&&(0,Z.jsxs)(`button`,{className:`inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] tracking-[0.04em] uppercase ${K===`deleted`?`bg-[#4a2222] text-[#ffbdbd]`:K===`added`?`bg-[#17342a] text-[#a5e8c8]`:`bg-[#3b2a16] text-[#f5a623]`}`,type:`button`,onClick:()=>ge(L.path),children:[(0,Z.jsx)(k,{size:11}),`Revert`]}),(0,Z.jsx)(`div`,{className:`grow`}),L.editable&&(0,Z.jsx)(`button`,{"aria-label":j?`Disable text wrap`:`Enable text wrap`,"aria-pressed":j,className:cr(j),title:j?`Disable text wrap`:`Enable text wrap`,type:`button`,onClick:()=>ne(e=>!e),children:(0,Z.jsx)(te,{className:`shrink-0`,size:14,strokeWidth:2})})]}):(0,Z.jsx)(`span`,{children:`No file selected`})}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1`,children:[!x&&!T&&(0,Z.jsx)(`div`,{className:lr,children:`Select a file from the tree to start editing.`}),x?.type===`dir`&&(0,Z.jsx)(`div`,{className:lr,children:`Folder selected. Choose a file to edit, or rename or delete the folder from the file pane.`}),L&&!L.editable&&(0,Z.jsx)(`div`,{className:lr,children:`This file cannot be edited in the browser.`}),L?.editable&&(0,Z.jsx)(le,{basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},className:`h-full [&_.cm-button]:h-8 [&_.cm-button]:rounded-md [&_.cm-button]:border [&_.cm-button]:border-[#2f333b] [&_.cm-button]:bg-[#1f2228] [&_.cm-button]:bg-none [&_.cm-button]:px-3 [&_.cm-button]:text-[13px] [&_.cm-button]:text-[#c8ccd3] [&_.cm-button:hover]:bg-[#2a2d33] [&_.cm-content]:min-h-full [&_.cm-content]:py-3 [&_.cm-content_*::selection]:bg-[#355070] [&_.cm-cursor]:border-l-[#e6e7ea] [&_.cm-editor]:h-full [&_.cm-editor]:rounded-none [&_.cm-editor]:border-0 [&_.cm-editor]:bg-[#16181c] [&_.cm-gutters]:border-r-[#23262c] [&_.cm-gutters]:bg-[#17191d] [&_.cm-line::selection]:bg-[#355070] [&_.cm-panel]:bg-[#17191d] [&_.cm-panel]:shadow-none [&_.cm-panel.cm-search]:gap-2 [&_.cm-panel.cm-search]:px-3 [&_.cm-panel.cm-search]:py-2 [&_.cm-panel.cm-search]:text-[13px] [&_.cm-panels]:border-b [&_.cm-panels]:border-[#23262c] [&_.cm-panels]:bg-[#17191d] [&_.cm-panels]:text-[#c8ccd3] [&_.cm-scroller]:min-h-full [&_.cm-scroller]:overflow-auto [&_.cm-scroller]:bg-[#16181c] [&_.cm-search]:flex [&_.cm-search]:flex-wrap [&_.cm-search]:items-center [&_.cm-search]:gap-2 [&_.cm-search_label]:inline-flex [&_.cm-search_label]:items-center [&_.cm-search_label]:gap-1.5 [&_.cm-search_label]:text-[#a5abb4] [&_.cm-search_label_input]:size-4 [&_.cm-search_label_input]:accent-[#14b886] [&_.cm-searchMatch]:bg-[#243043] [&_.cm-searchMatch-selected]:bg-[#3b2a16] [&_.cm-searchMatch-selected]:outline-none [&_.cm-selectionBackground]:!bg-[#355070] [&_.cm-selectionLayer_.cm-selectionBackground]:!bg-[#355070] [&_.cm-textfield]:h-8 [&_.cm-textfield]:min-w-[220px] [&_.cm-textfield]:rounded-md [&_.cm-textfield]:border [&_.cm-textfield]:border-[#2f333b] [&_.cm-textfield]:bg-[#16181c] [&_.cm-textfield]:px-2.5 [&_.cm-textfield]:text-[#e6e7ea] [&_.cm-textfield]:outline-none [&_.cm-textfield]:placeholder:text-[#6a6f78]`,extensions:oe,height:`full`,theme:ce,value:L.content||``,autoFocus:!0,onChange:e=>{v(t=>({...t,[L.path]:{...t[L.path],content:e}}))}},`${L.path}:${oe.length}`)]})]})]})]})}),M?.type===`confirmation`&&(0,Z.jsx)(dn,{...M.props,onResolve:e=>{P.current===M&&(P.current=null,N(null),M.resolve(e))}}),M?.type===`input`&&(0,Z.jsx)(fn,{...M.props,onResolve:e=>{P.current===M&&(P.current=null,N(null),M.resolve(e))}}),F&&(0,Z.jsx)(Ot,{action:`saved`,cancelLabel:`Close`,fatalErrors:F,themeName:d,title:`Theme not saved`,onClose:()=>re(null)}),ie&&(0,Z.jsx)(Bt,{...ie,onClose:()=>ae(null)})]})},fr=()=>{let{route:e,updateRoute:t}=Y(),n=_t(),r=e,[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(!1),{checkThemeLimitError:m,isThemeLimitCheckReady:h,noThemeChangesAllowed:g,isThemeLimited:_}=Dt(),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(!1),{themeName:S,isInvalid:C}=Sn(r),{showLimit:w}=ht(),T=(0,X.useCallback)(e=>{w({prompt:e,onOk:()=>t({route:n,isExternal:!0})})},[w,t,n]);if((0,X.useEffect)(()=>{r===`design/change-theme`&&h?(async()=>{if(!g){s(!1),a(null);return}s(!0);let e=await m();a(e),s(!1),e&&(T(e),t(`theme`))})():(a(null),s(!1))},[m,r,h,g,T,t]),(0,X.useEffect)(()=>{r!==`theme/install`&&(x(!1),y(null),l(!1))},[r]),(0,X.useEffect)(()=>{C&&t(`theme`)},[C,t]),(0,X.useEffect)(()=>{let e=!1;return(async()=>{if(!S){d(null),p(!1);return}if(!h){p(!0);return}if(!_){d(null),p(!1);return}p(!0);let n=await m(`.`);e||(d(n),p(!1),n&&(T(n),t(`theme`)))})(),()=>{e=!0}},[m,S,h,_,T,t]),(0,X.useEffect)(()=>{let e=()=>{let e=window.location.href.split(`#`)[1]?.split(`?`)[1];return e?new URLSearchParams(e).get(`ref`):null},n=e=>{y(!1),T(e),t({route:`theme`,replace:!0})};(async()=>{if(r!==`theme/install`){l(!1);return}if(x(!0),!h){l(!0);return}if(!_){y(!0),l(!1);return}l(!0);let t=e();if(!t){y(!1),l(!1);return}let i=t.split(`/`)[1]?.toLowerCase(),a=await m(i);if(r!==`theme/install`){l(!1);return}if(a){y(!1),l(!1),n(a);return}y(!0),l(!1)})()},[m,r,h,g,_,T,t]),r===`design/edit`)return(0,Z.jsx)(un,{});if(r===`design/change-theme`)return o||i?null:(0,Z.jsx)(Jt,{});if(r===`theme/install`){if(!b||!h||c||v===null||!v)return null;let e=window.location.href.split(`#`)[1]?.split(`?`)[1],t=null,n=null;if(e){let r=new URLSearchParams(e);t=r.get(`ref`),n=r.get(`source`)}return(0,Z.jsx)(Jt,{source:n,themeRef:t})}else if(r.startsWith(`theme/edit/`))return C||!S||f||u?null:(0,Z.jsx)(dr,{themeName:S});else return null};export{fr as default};
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./dist-Bmo2j_KH.js","./react-C9lG_SsT.js","./dist-tI811Kyl.js","./dist-B4jqKAG5.js","./dist-CWHIoxYn.js","./dist-Cp2M5TzT.js","./dist-DQAAPbtg.js","./dist-C-_aTlvJ.js","./dist-DyO279y5.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
(function(){try{var e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`44366c7e-e488-4ab5-bb50-f6aef43c5bab`,e._sentryDebugIdIdentifier=`sentry-dbid-44366c7e-e488-4ab5-bb50-f6aef43c5bab`)}catch{}})();import{s as e,t}from"./react-C9lG_SsT.js";import{t as n}from"./react-dom-t7VxfrkA.js";import{r}from"./framework-provider-CIvHFnik.js";import{D as i,_ as a,b as o,c as s,g as c,p as l,u}from"./hooks-0r7qxGEo.js";import{t as d}from"./jsx-runtime-Bm2_KH-0.js";import{n as f}from"./dist-pogVoW2G.js";import{t as p}from"./use-form-ElCUnbKi.js";import{r as m}from"./posts-CftunZgV.js";import{t as h}from"./preload-helper-Ba4JejZL.js";import{a as g}from"./router-provider-Cf-bcYZr.js";import{H as _,Z as v,r as y}from"./shade-provider-DvrXKKQZ.js";import{t as b}from"./inline-Qoyy4r2g.js";import{t as x}from"./text-BnCSdzao.js";import{An as S,Cn as C,D as w,Pn as T,Y as E,a as D,ar as O,b as k,dn as ee,dt as A,in as j,j as te,rr as ne,rt as M,t as N,wn as P,yt as F}from"./button-CTHYSI-d.js";import{i as re,n as ie,r as ae,t as oe}from"./action-list-CGRkUA1s.js";import{i as se,r as ce,t as le}from"./esm-_iCUCvbN.js";import{t as ue}from"./dropzone-C0p6KEsa.js";import{a as I,c as de,n as L,o as R,r as z,s as fe,t as B}from"./field-DCPPrQDr.js";import{a as V,c as H,i as U,n as W,o as pe,r as me,s as he,t as ge}from"./images-DTZtaIAr.js";import{t as _e}from"./input-BHb2A_DU.js";import{n as ve}from"./loading-indicator-DaRyGrxv.js";import{t as G}from"./page-header-CxTb0je5.js";import{t as K}from"./preview-chrome-Dcu3p6mp.js";import{i as ye,n as be,o as xe,s as Se,t as Ce}from"./select-DeloOYCg.js";import{t as we}from"./switch-BppWscjz.js";import{i as q,n as Te,r as Ee,t as De}from"./tabs-fHs3A8WC.js";import{n as Oe,t as ke}from"./toggle-group-BFWCtH3p.js";import{a as Ae,f as je,g as Me,p as Ne,r as Pe}from"./schemas-21VB7GGY.js";import{t as Fe}from"./settings-modal-3x4v8abr.js";import{a as Ie,c as Le,d as Re,f as ze,i as Be,l as Ve,m as He,n as Ue,p as We,r as Ge,s as Ke,t as qe,u as Je}from"./themes-CPJSMo_W.js";import{C as Ye,Jt as Xe,S as Ze,T as Qe,Ut as $e,Wt as J,b as et,ct as tt,ft as nt,g as rt,h as it,ut as at,vt as ot,w as st,x as ct,y as lt}from"./index-RuRs_qGS.js";import{t as ut}from"./modal-page--y-_IuN6.js";import{t as dt}from"./index.es-rdb1skp_.js";import{t as ft}from"./brand-icon-BFOhZhQt.js";import{t as pt}from"./nql-Cjj71Bsg.js";import{t as Y}from"./use-settings-navigation-CO2nUqDW.js";import{i as mt,n as ht}from"./confirmation-context-By_jX_cA.js";import{n as gt}from"./global-data-context-ogIy0FUG.js";import{t as _t}from"./use-upgrade-route-C-V-Xfak.js";import{i as vt}from"./zapier-modal-DENbgTyE.js";import{rt as yt}from"./dist-tI811Kyl.js";import{t as bt}from"./color-picker-field-DGe9HH6W.js";import{t as xt}from"./preview-modal-BrZza3R_.js";import{t as St}from"./use-pintura-editor-D_4zhlGE.js";import{t as Ct}from"./iframe-buffering-cu-yK7NA.js";import{t as wt}from"./settings-breadcrumbs-Bq3nGk-N.js";import{t as Tt}from"./use-query-params-C_4J-y5d.js";import{n as Et,t as Dt}from"./use-check-theme-limit-error-DjprzKAN.js";var X=e(t(),1),Z=d(),Ot=({title:e,themeName:t,action:n=`uploaded`,cancelLabel:r=`Cancel`,okLabel:i,fatalErrors:a,onRetry:o,onClose:s})=>{let{blockingProblems:c,secondaryProblems:l,stringErrors:u}=Ze(a);return(0,Z.jsx)(mt,{cancelLabel:r,contentClassName:c.length+u.length+l.length>0?`max-w-[600px]`:void 0,okLabel:i??(o?`Try again`:``),okVariant:`default`,prompt:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsxs)(`p`,{className:`text-base text-foreground`,children:[t?(0,Z.jsx)(`strong`,{children:t}):`This theme`,` couldn't be `,n,`. Fix the errors below and try again.`]}),(0,Z.jsx)(et,{errorLabel:`Blocking`,messages:u,problems:c,expandedByDefault:!0}),(0,Z.jsx)(lt,{problems:l})]}),stickyFooter:!0,title:e,onOk:o,onRemove:s})},kt=()=>{let e=Le();return{supportsCustomFonts:!(e.data?.themes[0])?.warnings?.some(e=>e.code===`GS051-CUSTOM-FONTS`),refreshActiveThemeData:(0,X.useCallback)(()=>{e.refetch()},[e])}};function At(e){let t=e.package?.name||e.name,n=t;return Ge(e)?n=`${t} (default)`:Ie(e)?n=`${t} (legacy)`:e.package?.name!==e.name&&(n=(0,Z.jsxs)(`span`,{className:`md:text-base`,children:[n,` `,(0,Z.jsxs)(`span`,{className:`text-gray-600`,children:[`(`,e.name,`)`]})]})),qe(e)&&(n=(0,Z.jsxs)(`span`,{className:`font-bold md:text-base`,children:[n,` — `,(0,Z.jsx)(`span`,{className:`text-green`,children:` Active`})]})),n}function jt(e){return e.package?.version||`1.0`}var Mt=({theme:e})=>{let{mutateAsync:t}=Ke(),{mutateAsync:n}=Je(),{refreshActiveThemeData:r}=kt(),i=c(),{route:a,updateRoute:s}=Y(),u=_t(),{checkThemeLimitError:d}=Dt(),{confirm:p,showLimit:m}=ht(),[h,g]=(0,X.useState)(null),_=async()=>{try{await t(e.name),r(),f.success(`Theme activated`,{description:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),` is now your active theme`]})})}catch(e){let t=null;e instanceof o&&e.response?.status===422&&e.data?.errors?t=e.data.errors:i(e),t&&g(t)}},v=()=>{l(`/themes/${e.name}/download`)},y=()=>{p({title:`Are you sure you want to delete this?`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[`You are about to delete `,(0,Z.jsxs)(`strong`,{children:[`"`,e.name,`".`]}),` This is permanent! We warned you, k? Maybe download`,` `,(0,Z.jsx)(`span`,{className:`cursor-pointer text-green-500`,onClick:v,children:`your theme before continuing`})]}),okLabel:`Delete`,okRunningLabel:`Deleting`,okVariant:`destructive`,onOk:async t=>{try{await n(e.name),t?.remove()}catch(e){i(e)}}})},b=async()=>{let t=await d(`.`);if(t){m({prompt:t,onOk:()=>s({route:u,isExternal:!0})});return}s(`theme/edit/${encodeURIComponent(e.name)}?from=${encodeURIComponent(a??``)}`)},x=[];return qe(e)||x.push((0,Z.jsx)(N,{className:`ml-2`,size:`sm`,type:`button`,variant:`ghost`,onClick:()=>void _(),children:`Activate`},`activate`)),(0,Z.jsxs)(`div`,{className:`-mr-3 flex items-center gap-4`,children:[x,(0,Z.jsxs)(tt,{children:[(0,Z.jsx)(ot,{asChild:!0,children:(0,Z.jsx)(N,{"aria-label":`Menu`,size:`icon`,type:`button`,variant:`ghost`,children:(0,Z.jsx)(T,{})})}),(0,Z.jsxs)(at,{align:`end`,className:`z-[9999]`,children:[(0,Z.jsx)(nt,{onSelect:()=>void b(),children:`Edit code`}),(0,Z.jsx)(nt,{onSelect:v,children:`Download`}),Be(e)&&(0,Z.jsx)(nt,{onSelect:y,children:`Delete`})]})]}),h&&(0,Z.jsx)(Ot,{action:`activated`,fatalErrors:h,themeName:e.package?.name||e.name,title:`Theme not activated`,onClose:()=>g(null),onRetry:()=>{g(null),_()}})]})},Nt=({themes:e})=>(e.sort((e,t)=>e.active&&!t.active?-1:!e.active&&t.active?1:e.package?.name&&t.package?.name?e.package.name.localeCompare(t.package.name):e.name.localeCompare(t.name)),(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`h1`,{className:`mb-5 text-2xl font-bold`,children:`Installed themes`}),(0,Z.jsx)(oe,{className:`border-t border-border`,children:e.map(e=>{let t=At(e),n=jt(e);return(0,Z.jsxs)(ie,{"data-testid":`theme-list-item`,children:[(0,Z.jsxs)(re,{className:`py-3 pr-6`,id:`theme-${e.name}`,children:[(0,Z.jsx)(`div`,{children:t}),n&&(0,Z.jsx)(`div`,{className:`text-sm text-muted-foreground`,children:n})]}),(0,Z.jsx)(ae,{children:(0,Z.jsx)(Mt,{theme:e})})]},e.name)})})]})),Pt=({themes:e})=>(0,Z.jsx)(ut,{children:(0,Z.jsx)(Nt,{themes:e})}),Ft=``+new URL(`footer-marketplace-bg-cXGt4GLt.png`,import.meta.url).href,It=3e3,Lt=e=>e.variants&&e.variants.length>0,Rt=e=>{let t=[{category:e.category,previewUrl:e.previewUrl,image:e.image}];return e.variants&&e.variants.length>0&&t.push(...e.variants),t},zt=({onSelectTheme:e})=>{let t=vt(),[n,r]=(0,X.useState)(null),[i,a]=(0,X.useState)(0),o=e=>{r(e),a(e!==null&&Lt(e)&&Rt(e).length>1?1:0)};return(0,X.useEffect)(()=>{if(n===null)return;let e=setInterval(()=>{a((i+1)%(Rt(n).length||0))},It);return()=>clearInterval(e)},[n,i]),(0,Z.jsxs)(ut,{children:[(0,Z.jsx)(ut.Title,{children:`Themes`}),(0,Z.jsx)(`div`,{className:`mt-[6vmin] grid grid-cols-1 gap-[6vmin] sm:grid-cols-2 md:grid-cols-3 xl:grid-cols-4`,children:t.map(t=>{let r=Lt(t),a=Rt(t),s=n===t;return(0,Z.jsxs)(`button`,{className:`flex cursor-pointer flex-col gap-3 text-left`,type:`button`,onClick:()=>{e?.(t)},children:[(0,Z.jsx)(`div`,{className:`relative w-full bg-gray-100 shadow-md transition-all duration-500 hover:scale-[1.05]`,onMouseEnter:()=>o(t),onMouseLeave:()=>o(null),children:r?(0,Z.jsx)(Z.Fragment,{children:a.map((e,n)=>(0,Z.jsx)(`img`,{alt:`${t.name} Theme - ${e.category}`,className:v(`size-full object-contain opacity-0 transition-opacity duration-500`,{"opacity-100":n===i&&s||!s&&n===0,relative:n===i,absolute:n!==i,"left-0":n!==i,"top-0":n!==i}),src:e.image},`theme-variant-${e.category.toLowerCase()}`))}):(0,Z.jsx)(`img`,{alt:`${t.name} Theme`,className:`size-full object-contain`,src:t.image})}),(0,Z.jsxs)(`div`,{className:`relative mt-3`,children:[(0,Z.jsx)(x,{as:`h4`,className:`md:text-xl`,leading:`heading`,size:`lg`,weight:`bold`,children:t.name}),r?a.map((e,t)=>(0,Z.jsx)(`span`,{className:v(`absolute left-0 translate-y-px text-gray-700 opacity-0`,{"opacity-100":t===i&&s||!s&&t===0}),children:e.category},e.category)):(0,Z.jsx)(`span`,{className:`text-gray-700`,children:t.category})]})]},t.name)})}),(0,Z.jsxs)(`div`,{className:`mx-[-8vmin] mt-[8vmin] mb-[-8vmin] bg-black px-[8vmin] py-16 text-center text-lg text-white`,style:{background:`#15171a url(${Ft}) 100% 100% / 35vw no-repeat`},children:[`Find and buy third-party, premium themes from independent developers in the`,` `,(0,Z.jsx)(`a`,{className:`inline-block font-semibold text-lime`,href:`https://ghost.org/themes/`,rel:`noopener noreferrer`,target:`_blank`,children:`Ghost Marketplace →`})]})]})},Bt=({title:e,action:t=`uploaded`,statusMessage:n,installedTheme:r,onActivate:i,onClose:a})=>{let{mutateAsync:o}=Ke(),{refreshActiveThemeData:s}=kt(),l=c(),{data:u}=rt(),d=Ye(r),p=u?.site?it(u.site):void 0,m=r.active?`OK`:st(d)?`Activate with errors`:`Activate theme`,h=r.active?(0,Z.jsx)(`span`,{className:`text-green`,children:`It's live!`}):e,g;return g=r.active?(0,Z.jsxs)(Z.Fragment,{children:[`Your theme `,(0,Z.jsx)(`strong`,{children:r.name}),` was saved successfully and is now visible to your readers.`,p?(0,Z.jsxs)(Z.Fragment,{children:[` `,(0,Z.jsx)(`a`,{className:`font-semibold text-foreground hover:underline`,href:p,rel:`noreferrer`,target:`_blank`,children:`Take a look →`})]}):null]}):n||(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`strong`,{children:r.name}),` was `,ct(t,d),`. Do you want to activate it?`]}),(0,Z.jsx)(mt,{cancelLabel:`Close`,contentClassName:d.length>0?`max-w-[600px]`:void 0,okLabel:m,okRunningLabel:`Activating...`,okVariant:`default`,prompt:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Z.jsx)(`p`,{className:`text-base text-foreground`,children:g}),(0,Z.jsx)(lt,{problems:d})]}),stickyFooter:!0,title:h,onOk:async e=>{if(!r.active)try{let e=(await o(r.name)).themes[0];s(),f.success(`Theme activated`,{description:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:e.name}),` is now your active theme.`]})})}catch(e){l(e);return}i?.(),e?.remove()},onRemove:a})},Vt=e=>e.variants&&e.variants.length>0,Ht=e=>{let t=[{image:e.image,category:e.category,previewUrl:e.previewUrl}];return e.variants&&e.variants.length>0&&t.push(...e.variants),t},Ut=e=>e.category.toLowerCase(),Wt=({selectedTheme:e,isInstalling:t,installedTheme:n,onBack:r,onInstall:i})=>{let[a,o]=(0,X.useState)(`desktop`),[s,c]=(0,X.useState)(void 0);if(!e)return null;let l=e.previewUrl,u=Ht(e).map(e=>({label:e.category,value:Ut(e)}));Vt(e)&&(s===void 0&&c(u[0].value),l=Ht(e).find(e=>Ut(e)===s)?.previewUrl||l);let d=`Install ${e.name}`;t?d=`Installing...`:Ue(e)&&!n?.active?d=`Activate ${e.name}`:n&&(d=`Update ${e.name}`);let f=()=>{i?.()},p=(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(wt,{current:e.name,label:`Change theme`,onBack:r}),Vt(e)?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`hidden md:!visible md:!block`,children:`–`}),(0,Z.jsxs)(B,{className:`w-auto`,children:[(0,Z.jsx)(R,{className:`sr-only`,children:`Theme variant`}),(0,Z.jsxs)(Ce,{value:s,onValueChange:c,children:[(0,Z.jsx)(xe,{"aria-label":`Theme variant`,className:`w-auto border-0 bg-transparent shadow-none`,children:(0,Z.jsx)(Se,{})}),(0,Z.jsx)(be,{className:`min-w-max`,children:u.map(e=>(0,Z.jsx)(ye,{value:e.value,children:e.label},e.value))})]})]})]}):null]}),m=(0,Z.jsxs)(`div`,{className:`flex justify-end gap-8`,children:[(0,Z.jsxs)(b,{gap:`sm`,children:[(0,Z.jsx)(N,{"aria-label":`Desktop preview`,size:`icon`,type:`button`,variant:`ghost`,onClick:()=>o(`desktop`),children:(0,Z.jsx)(j,{className:a===`desktop`?`text-foreground`:`text-muted-foreground`})}),(0,Z.jsx)(N,{"aria-label":`Mobile preview`,size:`icon`,type:`button`,variant:`ghost`,onClick:()=>o(`mobile`),children:(0,Z.jsx)(E,{className:a===`mobile`?`text-foreground`:`text-muted-foreground`})})]}),(0,Z.jsx)(N,{disabled:t,type:`button`,onClick:f,children:t?`Installing...`:d})]});return(0,Z.jsxs)(`div`,{className:`absolute inset-0 z-[100]`,children:[(0,Z.jsxs)(G,{blurredBackground:!1,className:`z-[100] h-22 min-h-[92px] bg-background p-8`,sticky:!1,children:[(0,Z.jsx)(G.Left,{className:`flex-auto`,children:p}),(0,Z.jsx)(G.Actions,{className:`flex-auto justify-end`,children:m})]}),(0,Z.jsx)(`div`,{className:`flex h-[calc(100%-92px)] grow flex-col items-center justify-center bg-background`,children:a===`desktop`?(0,Z.jsx)(K,{device:`desktop`,children:(0,Z.jsx)(`iframe`,{className:`size-full`,src:l,title:`Theme preview`})}):(0,Z.jsx)(K,{device:`mobile`,children:(0,Z.jsx)(`iframe`,{className:`size-full`,src:l,title:`Theme preview`})})})]})},Gt=({onUpload:e})=>(0,Z.jsx)(ue,{accept:{"application/zip":[`.zip`]},inputId:`theme-upload`,onDropAccepted:([t])=>{e(t)},children:`Click to select or drag & drop zip file`}),Kt=({currentTab:e,setCurrentTab:t,themes:n})=>{let{updateRoute:r}=Y(),i=_t(),{mutateAsync:a}=ze(),{checkThemeLimitError:s,isThemeLimited:l}=Dt(),u=c(),{confirm:d,showLimit:f}=ht(),[p,m]=(0,X.useState)(),[h,g]=(0,X.useState)(!1),[_,v]=(0,X.useState)(null),[y,b]=(0,X.useState)(null);(0,X.useEffect)(()=>{(async()=>{if(l){let e=await s(`.`);m({enabled:!1,error:e||`Your current plan doesn't support uploading custom themes.`})}else m({enabled:!0})})()},[s,l]);let x=()=>{r(`/`)},S=e=>{let r=e?.name.replace(/\.zip$/,``),i=n.map(e=>e.name);Ue({name:r})?d({title:`Upload failed`,cancelLabel:`Cancel`,okLabel:``,prompt:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(`p`,{children:[`The default `,(0,Z.jsx)(`strong`,{children:r}),` theme cannot be overwritten.`]}),(0,Z.jsx)(`p`,{children:`Rename your zip file and try again.`})]}),onOk:e=>{e?.remove()}}):i.includes(r)?d({title:`Overwrite theme`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[`The theme `,(0,Z.jsx)(`strong`,{children:r}),` already exists. Do you want to overwrite it?`]}),okLabel:`Overwrite`,cancelLabel:`Cancel`,okRunningLabel:`Overwriting...`,okVariant:`destructive`,onOk:async a=>{g(!0);let o=i.indexOf(r);n.splice(o,1),await C({file:e,onActivate:x}),g(!1),t(`installed`),a?.remove()}}):(t(`installed`),C({file:e,onActivate:x}))},C=async({file:e,onActivate:t})=>{let n,r=null;try{g(!0),n=await a({file:e}),g(!1)}catch(e){g(!1),e instanceof o&&e.response?.status===422&&e.data?.errors?r=e.data.errors:u(e)}r&&!n&&v({themeName:e.name.replace(/\.zip$/,``),fatalErrors:r}),n&&b({title:`Upload successful`,action:`uploaded`,installedTheme:n.themes[0],onActivate:t})},w=(0,Z.jsx)(`div`,{className:`hidden md:!visible md:!block`,children:(0,Z.jsx)(De,{value:e,variant:`button`,onValueChange:t,children:(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(q,{value:`official`,children:`Official themes`}),(0,Z.jsx)(q,{value:`installed`,children:`Installed`})]})})}),T=()=>{if(p)if(p.enabled){let e={current:null};e.current=d({title:`Upload theme`,prompt:(0,Z.jsx)(Gt,{onUpload:t=>{e.current?.remove(),S(t)}}),okLabel:``,formSheet:!1})}else f({title:`Upgrade to enable custom themes`,prompt:p.error||(0,Z.jsxs)(Z.Fragment,{children:[`Your current plan only supports official themes. You can install them from the`,` `,(0,Z.jsx)(`a`,{href:`https://ghost.org/marketplace/`,children:`Ghost theme marketplace`}),`.`]}),onOk:()=>r({route:i,isExternal:!0})})},E=(0,Z.jsx)(`div`,{className:`flex items-center gap-14`,children:(0,Z.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Z.jsx)(G.Action,{label:`Close`,type:`button`,onClick:x,children:`Close`}),(0,Z.jsxs)(N,{disabled:h,type:`button`,onClick:T,children:[h&&(0,Z.jsx)(ve,{size:`sm`}),`Upload theme`]})]})});return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(G,{blurredBackground:!1,className:`sticky -top-px z-50 h-22 min-h-[92px] bg-background p-8`,sticky:!1,children:[(0,Z.jsx)(G.Left,{className:`flex-auto`,children:w}),(0,Z.jsx)(G.Actions,{className:`flex-auto justify-end`,children:E})]}),(0,Z.jsx)(`div`,{className:`px-[8vmin] md:hidden`,children:(0,Z.jsx)(De,{value:e,variant:`button`,onValueChange:t,children:(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(q,{value:`official`,children:`Official themes`}),(0,Z.jsx)(q,{value:`installed`,children:`Installed`})]})})}),_&&(0,Z.jsx)(Ot,{action:`uploaded`,fatalErrors:_.fatalErrors,okLabel:`Re-upload`,themeName:_.themeName,title:`Theme not uploaded`,onClose:()=>v(null),onRetry:()=>{v(null),T()}}),y&&(0,Z.jsx)(Bt,{...y,onClose:()=>b(null)})]})},qt=({currentTab:e,onSelectTheme:t,themes:n})=>{switch(e){case`official`:return(0,Z.jsx)(zt,{onSelectTheme:t});case`installed`:return(0,Z.jsx)(Pt,{themes:n})}return null},Jt=({source:e,themeRef:t})=>{let[n,r]=(0,X.useState)(`official`),[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(`desktop`),[l,u]=(0,X.useState)(!1),[d,p]=(0,X.useState)(!1),[m,h]=(0,X.useState)(!1),[g,_]=(0,X.useState)(null),{updateRoute:v}=Y(),y=_t(),{data:{themes:b}={}}=Ve(),{mutateAsync:x}=Re(),{mutateAsync:S}=Ke(),{checkThemeLimitError:C}=Dt(),w=c(),{confirm:T,showLimit:E}=ht(),D=e=>{a(e)};if((0,X.useEffect)(()=>{h(!0)},[]),(0,X.useEffect)(()=>{(async()=>{if(e&&t&&!d&&m){let e=t.split(`/`)[1];if(await C(e)){v(`theme`);return}let n=b?.map(e=>e.name)||[],r=n.includes(e.toLowerCase()),i=n.indexOf(e.toLowerCase()),a=b?.[i],o=(0,Z.jsxs)(Z.Fragment,{children:[`By clicking below, `,(0,Z.jsx)(`strong`,{children:e}),` will automatically be activated as the theme for your site.`,r&&(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`br`,{}),(0,Z.jsx)(`br`,{}),`This will overwrite your existing version of `,(0,Z.jsx)(`strong`,{children:e}),a?.active?` which is your active theme`:``,`. All custom changes will be lost.`]})]});T({title:`Install Theme`,prompt:o,okLabel:`Install`,cancelLabel:`Cancel`,okRunningLabel:`Installing...`,okVariant:`default`,onOk:async e=>{let n;p(!0);try{r&&b&&b.splice(i,1),n=await x(t),n?.themes[0]&&(await S(n.themes[0].name),f.success(`Theme activated`,{description:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:n.themes[0].name}),` is now your active theme`]})})),e?.remove(),v(``)}catch(e){w(e)}}})}})()},[t,e,x,w,S,v,b,d,C,T,m]),!b)return;let O,k;if(i){O=b.find(e=>e.name.toLowerCase()===i.name.toLowerCase()),k=async()=>{let t=await C(i.name);if(t){E({prompt:t,onOk:()=>v({route:y,isExternal:!0})});return}return O&&!Ue(i)?new Promise(t=>{T({title:`Overwrite theme`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[`This will overwrite your existing version of `,i.name,O?.active?`, which is your active theme`:``,`. All custom changes will be lost.`]}),okLabel:`Overwrite`,okRunningLabel:`Installing...`,cancelLabel:`Cancel`,okVariant:`destructive`,onOk:async n=>{n?.remove(),await e(),t()}})}):e()};let e=async()=>{let e=`Installed successfully`,t;if(Ue(i))e=`Activate theme`,t=(0,Z.jsxs)(Z.Fragment,{children:[`Do you want to activate `,(0,Z.jsx)(`strong`,{children:i.name}),` as the theme for your site?`]});else{u(!0);let e;try{e=await x(i.ref)}catch(e){w(e)}finally{u(!1)}if(!e)return;O=e.themes[0]}_({title:e,action:`installed`,statusMessage:t,installedTheme:O,onActivate:()=>{v(``)}})}}return(0,Z.jsxs)(Fe,{animate:!1,cancelLabel:``,footer:!1,padding:!1,size:`full`,testId:`theme-modal`,title:``,scrolling:!0,onCancel:()=>{v(``)},onClose:()=>{v(``)},children:[(0,Z.jsx)(`div`,{className:`flex h-full justify-between`,children:(0,Z.jsxs)(`div`,{className:`grow`,children:[i&&(0,Z.jsx)(Wt,{installedTheme:O,isInstalling:l,selectedTheme:i,onBack:()=>{a(null)},onClose:()=>{v(``)},onInstall:k}),(0,Z.jsx)(Kt,{currentTab:n,previewMode:o,selectedTheme:i,setCurrentTab:r,setPreviewMode:s,setSelectedTheme:a,themes:b}),!i&&(0,Z.jsx)(qt,{currentTab:n,themes:b,onSelectTheme:D})]})}),g&&(0,Z.jsx)(Bt,{...g,onClose:()=>_(null)})]})},Yt=e(n(),1),Xt=({children:e,to:t,classNames:n})=>{let r=t||document.body;return r?(0,Yt.createPortal)((0,Z.jsx)(`div`,{className:n,onMouseDown:e=>{e.stopPropagation()},children:(0,Z.jsx)(`div`,{children:e})}),r):(0,Z.jsx)(Z.Fragment,{children:e})},Zt=({unsplashProviderConfig:e,onClose:t,onImageInsert:n})=>(0,Z.jsx)(Xt,{classNames:`settings-app`,children:(0,Z.jsx)(dt,{unsplashProviderConfig:e,onClose:t,onImageInsert:n})}),Q={heading:[{name:`Cardo`,creator:`David Perry`},{name:`Chakra Petch`,creator:`Cadson Demak`},{name:`Fira Mono`,creator:`Carrois Apostrophe`},{name:`Fira Sans`,creator:`Carrois Apostrophe`},{name:`IBM Plex Serif`,creator:`Mike Abbink`},{name:`Inter`,creator:`Rasmus Andersson`},{name:`JetBrains Mono`,creator:`JetBrains`},{name:`Libre Baskerville`,creator:`Impallari Type`},{name:`Lora`,creator:`Cyreal`},{name:`Manrope`,creator:`Mikhail Sharanda`},{name:`Merriweather`,creator:`Sorkin Type`},{name:`Noto Sans`,creator:`Google`},{name:`Noto Serif`,creator:`Google`},{name:`Nunito`,creator:`Vernon Adams`},{name:`Old Standard TT`,creator:`Alexey Kryukov`},{name:`Poppins`,creator:`Indian Type Foundry`},{name:`Roboto`,creator:`Christian Robertson`},{name:`Rufina`,creator:`Martin Sommaruga`},{name:`Space Grotesk`,creator:`Florian Karsten`},{name:`Space Mono`,creator:`Colophon Foundry`},{name:`Tenor Sans`,creator:`Denis Masharov`}],body:[{name:`Fira Mono`,creator:`Carrois Apostrophe`},{name:`Fira Sans`,creator:`Carrois Apostrophe`},{name:`IBM Plex Serif`,creator:`Mike Abbink`},{name:`Inter`,creator:`Rasmus Andersson`},{name:`JetBrains Mono`,creator:`JetBrains`},{name:`Lora`,creator:`Cyreal`},{name:`Manrope`,creator:`Mikhail Sharanda`},{name:`Merriweather`,creator:`Sorkin Type`},{name:`Noto Sans`,creator:`Google`},{name:`Noto Serif`,creator:`Google`},{name:`Nunito`,creator:`Vernon Adams`},{name:`Poppins`,creator:`Indian Type Foundry`},{name:`Roboto`,creator:`Christian Robertson`},{name:`Space Mono`,creator:`Colophon Foundry`}]},$=`Theme default`,Qt=({option:e,selected:t})=>(0,Z.jsxs)(`span`,{className:`flex w-full items-center gap-4 ${e.className??``}`,"data-testid":t?`select-current-option`:`select-option`,"data-value":e.value,children:[(0,Z.jsx)(`span`,{className:`flex size-12 shrink-0 items-center justify-center rounded-md border border-border-default bg-surface-elevated text-2xl font-bold shadow-xs`,children:`Aa`}),(0,Z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,Z.jsx)(`span`,{className:`text-md`,children:e.label}),(0,Z.jsx)(`span`,{className:`truncate font-sans text-sm font-normal text-muted-foreground`,children:e.hint})]})]}),$t=e=>e.split(` `).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `),en=({values:e,updateSetting:t})=>{let{isAdmin7:n}=y(),i=n?N:U,{mutateAsync:a}=W(),{settings:o}=gt(),[s]=$e(o,[`unsplash`]),[l,u]=(0,X.useState)(!1),{unsplashConfig:d}=r(),f=c(),p=async(e,n)=>{try{t(e,ge(await a({file:n})))}catch(e){let t=e;t.response.status===415&&(t.message=`Unsupported file type`),f(t)}},m=St(),{data:h}=Ve(),g=h?.themes.find(e=>e.active),b=g?`${$t(g.name)} (v${g.package?.version||`1.0`})`:`Loading...`,[x,S]=(0,X.useState)(Q.heading.find(t=>t.name===e.headingFont)||{name:$,creator:b}),[C,T]=(0,X.useState)(Q.heading.find(t=>t.name===e.bodyFont)||{name:$,creator:b}),E=(e,t=!0)=>{let n=``;return e===`Cardo`?n=v(`font-cardo`,t&&`font-bold`):e===`Manrope`?n=v(`font-manrope`,t&&`font-bold`):e===`Merriweather`?n=v(`font-merriweather`,t&&`font-bold`):e===`Nunito`?n=v(`font-nunito`,t&&`font-semibold`):e===`Old Standard TT`?n=v(`font-old-standard-tt`,t&&`font-bold`):e===`Prata`?n=v(`font-prata`,t&&`font-normal`):e===`Roboto`?n=v(`font-roboto`,t&&`font-bold`):e===`Rufina`?n=v(`font-rufina`,t&&`font-bold`):e===`Tenor Sans`?n=v(`font-tenor-sans`,t&&`font-normal`):e===`Chakra Petch`?n=v(`font-chakra-petch`,t&&`font-normal`):e===`Fira Mono`?n=v(`font-fira-mono`,t&&`font-bold`):e===`Fira Sans`?n=v(`font-fira-sans`,t&&`font-bold`):e===`IBM Plex Serif`?n=v(`font-ibm-plex-serif`,t&&`font-bold`):e===`Inter`?n=v(`font-inter`,t&&`font-bold`):e===`JetBrains Mono`?n=v(`font-jetbrains-mono`,t&&`font-bold`):e===`Lora`?n=v(`font-lora`,t&&`font-bold`):e===`Noto Sans`?n=v(`font-noto-sans`,t&&`font-bold`):e===`Noto Serif`?n=v(`font-noto-serif`,t&&`font-bold`):e===`Poppins`?n=v(`font-poppins`,t&&`font-bold`):e===`Space Grotesk`?n=v(`font-space-grotesk`,t&&`font-bold`):e===`Space Mono`&&(n=v(`font-space-mono`,t&&`font-bold`)),n},D=Q.heading.map(e=>{let t=E(e.name,!0);return{label:e.name,value:e.name,hint:e.creator,className:t}});D.unshift({label:$,value:$,hint:b,className:`font-sans font-normal`});let O=Q.body.map(e=>{let t=E(e.name,!1);return{label:e.name,value:e.name,hint:e.creator,className:t}});O.unshift({label:$,value:$,hint:b,className:`font-sans font-normal`});let k=(e,t)=>e===$?``:E(e,t),A=D.find(e=>e.value===x.name)||D[0],j=O.find(e=>e.value===C.name)||O[0];return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsxs)(I,{className:`mt-6 mb-12 gap-6`,children:[(0,Z.jsx)(bt,{debounceMs:200,direction:`rtl`,testId:`accent-color-picker`,title:(0,Z.jsx)(`div`,{children:`Accent color`}),value:e.accentColor,onChange:e=>t(`accent_color`,e)}),(0,Z.jsxs)(`div`,{className:`flex items-start justify-between`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{children:`Publication icon`}),(0,Z.jsxs)(z,{className:`mr-5 max-w-[160px]`,children:[`A square, social icon, at least `,_(60),`×`,_(60),`px`]})]}),(0,Z.jsx)(`div`,{className:`flex gap-3`,children:(0,Z.jsx)(me,{className:e.icon?`size-16.5`:`h-9 w-40`,children:e.icon?(0,Z.jsxs)(H,{background:`checkerboard`,children:[(0,Z.jsx)(he,{id:`logo`,src:e.icon}),(0,Z.jsx)(V,{className:`top-1 right-1`,children:(0,Z.jsx)(U,{"aria-label":`Remove publication icon`,"data-testid":`image-delete-button`,onClick:()=>t(`icon`,null),children:(0,Z.jsx)(w,{})})})]}):(0,Z.jsx)(pe,{inputId:`logo`,onDropAccepted:([e])=>void p(`icon`,e),children:`Upload icon`})})})]}),(0,Z.jsxs)(`div`,{className:`flex items-start justify-between ${e.icon&&`mt-2`}`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{children:`Publication logo`}),(0,Z.jsx)(z,{className:`mr-5 max-w-[160px]`,children:`Appears usually in the main header of your theme`})]}),(0,Z.jsx)(`div`,{children:(0,Z.jsx)(me,{className:`h-15 w-40`,children:e.logo?(0,Z.jsxs)(H,{background:`checkerboard`,children:[(0,Z.jsx)(he,{className:`object-contain`,id:`site-logo`,src:e.logo}),(0,Z.jsx)(V,{className:`top-1 right-1`,children:(0,Z.jsx)(U,{"aria-label":`Remove publication logo`,"data-testid":`image-delete-button`,onClick:()=>t(`logo`,null),children:(0,Z.jsx)(w,{})})})]}):(0,Z.jsx)(pe,{inputId:`site-logo`,onDropAccepted:([e])=>void p(`logo`,e),children:`Upload logo`})})})]}),(0,Z.jsxs)(`div`,{className:`mt-2 flex items-start justify-between`,"data-testid":`publication-cover`,children:[(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`div`,{children:`Publication cover`}),(0,Z.jsx)(z,{className:`mr-5 max-w-[160px]`,children:`Usually as a large banner image on your index pages`})]}),(0,Z.jsx)(me,{className:`h-23.75 w-40`,children:e.coverImage?(0,Z.jsxs)(H,{children:[(0,Z.jsx)(he,{id:`cover`,src:e.coverImage}),(0,Z.jsxs)(V,{className:`top-1 right-1`,children:[m.isEnabled&&(0,Z.jsx)(U,{"aria-label":`Edit publication cover`,onClick:()=>m.openEditor({image:e.coverImage||``,handleSave:async e=>{try{t(`cover_image`,ge(await a({file:e})))}catch(e){f(e)}}}),children:(0,Z.jsx)(F,{})}),(0,Z.jsx)(U,{"aria-label":`Remove publication cover`,"data-testid":`image-delete-button`,onClick:()=>t(`cover_image`,null),children:(0,Z.jsx)(w,{})})]})]}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(pe,{inputId:`cover`,onDropAccepted:([e])=>void p(`cover_image`,e),children:`Upload cover`}),s&&(0,Z.jsx)(V,{className:`top-1 right-1 opacity-100`,children:(0,Z.jsx)(i,{"aria-label":`Select publication cover from Unsplash`,"data-testid":`toggle-unsplash-button`,size:`icon`,variant:`ghost`,onClick:()=>u(!0),children:n?(0,Z.jsx)(ft,{name:`unsplash`,size:16}):(0,Z.jsx)(ee,{})})})]})}),l&&d&&s&&(0,Z.jsx)(Zt,{unsplashProviderConfig:d,onClose:()=>{u(!1)},onImageInsert:e=>{e.src&&t(`cover_image`,e.src),u(!1)}})]})]}),(0,Z.jsxs)(de,{className:`-mt-4 gap-0`,children:[(0,Z.jsx)(fe,{className:`mb-4 text-md! leading-supertight font-bold md:text-lg!`,children:`Typography`}),(0,Z.jsxs)(I,{className:`mb-12 gap-6`,children:[(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{children:`Heading font`}),(0,Z.jsxs)(Ce,{value:A.value,onValueChange:e=>{e===$?(S({name:$,creator:b}),t(`heading_font`,``)):(S({name:e,creator:Q.heading.find(t=>t.name===e)?.creator||``}),t(`heading_font`,e))},children:[(0,Z.jsx)(xe,{"aria-label":`Heading font`,className:`h-16 pl-2 text-left ${k(A.label,!0)}`,"data-testid":`heading-font-select`,children:(0,Z.jsx)(Se,{children:(0,Z.jsx)(Qt,{option:A,selected:!0})})}),(0,Z.jsx)(be,{children:D.map(e=>(0,Z.jsx)(ye,{value:e.value,children:(0,Z.jsx)(Qt,{option:e})},e.value))})]})]}),(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{children:`Body font`}),(0,Z.jsxs)(Ce,{value:j.value,onValueChange:e=>{e===$?(T({name:$,creator:b}),t(`body_font`,``)):(T({name:e,creator:Q.body.find(t=>t.name===e)?.creator||``}),t(`body_font`,e))},children:[(0,Z.jsx)(xe,{"aria-label":`Body font`,className:`h-16 pl-2 text-left ${k(j.label,!1)}`,"data-testid":`body-font-select`,children:(0,Z.jsx)(Se,{children:(0,Z.jsx)(Qt,{option:j,selected:!0})})}),(0,Z.jsx)(be,{className:`max-h-52`,children:O.map(e=>(0,Z.jsx)(ye,{value:e.value,children:(0,Z.jsx)(Qt,{option:e})},e.value))})]})]})]})]})]})},tn=e(pt(),1);function nn(e,t){return e.visibility?(0,tn.default)(e.visibility).queryJSON(t):!0}function rn({description:e,accentColor:t,icon:n,logo:r,coverImage:i,themeSettings:a,bodyFont:o,headingFont:s}){if(!a)return;let c=a.reduce((e,{key:t,value:n})=>({...e,[t]:n}),{}),l=new URLSearchParams;l.append(`c`,t),l.append(`d`,e),l.append(`icon`,n),l.append(`logo`,r),l.append(`cover`,i),l.append(`bf`,o),l.append(`hf`,s);let u={};return a.forEach(e=>{u[e.key]=nn(e,c)?e.value:null}),l.append(`custom`,JSON.stringify(u)),l.toString()}var an=({settings:e,url:t,isVisible:n=!0})=>{let r=rn({...e});return(0,Z.jsx)(Ct,{addDelay:!1,className:`absolute -top-px -left-px size-[calc(110%_+_3px)] origin-top-left scale-[.90909] bg-white max-[1600px]:size-[calc(130%_+_3px)] max-[1600px]:scale-[.76923]`,generateContent:(0,X.useCallback)(e=>{if(!t||!r)return;let n=new URL(t);n.searchParams.set(`admin_toolbar`,`0`),fetch(n.toString(),{method:`POST`,headers:{"Content-Type":`text/html;charset=utf-8`,"x-ghost-preview":r,Accept:`text/html`},mode:`cors`,credentials:`include`}).then(e=>e.text()).then(t=>{let n=`html { pointer-events: none; }`,r=new DOMParser().parseFromString(t,`text/html`),i=r.querySelector(`style`),a=i?.innerHTML;a?i.innerHTML=`${a}\n\n${n}`:r.head.innerHTML+=`<style>${n}</style>`;let o=(r.doctype?new XMLSerializer().serializeToString(r.doctype):``)+r.documentElement.outerHTML;e.contentDocument?.open(),e.contentDocument?.write(o),e.contentDocument?.close()})},[r,t]),height:`100%`,parentClassName:`absolute inset-0 overflow-hidden ${n?`z-10 opacity-100`:`z-0 opacity-0 pointer-events-none`}`,testId:`theme-preview`,width:`100%`})},on=({setting:e,setSetting:t})=>{let[n,r]=(0,X.useState)({});(0,X.useEffect)(()=>{let t=e.value===null?``:String(e.value);r(n=>({...n,[e.key]:t}))},[e]);let i=e=>{n[e]!==void 0&&t(n[e])},a=(e,t)=>{r(n=>({...n,[e]:t}))},{mutateAsync:o}=W(),s=c(),l=async e=>{try{t(ge(await o({file:e})))}catch(e){s(e)}};switch(e.type){case`text`:return(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{htmlFor:`theme-setting-${e.key}`,children:J(e.key)}),(0,Z.jsx)(_e,{id:`theme-setting-${e.key}`,value:n[e.key]||``,onBlur:()=>i(e.key),onChange:t=>a(e.key,t.target.value)}),e.description&&(0,Z.jsx)(z,{children:e.description})]});case`boolean`:return(0,Z.jsxs)(B,{orientation:`horizontal`,children:[(0,Z.jsxs)(L,{children:[(0,Z.jsx)(R,{htmlFor:`theme-setting-${e.key}`,children:J(e.key)}),e.description&&(0,Z.jsx)(z,{children:e.description})]}),(0,Z.jsx)(we,{checked:!!e.value,id:`theme-setting-${e.key}`,onCheckedChange:t})]});case`select`:return(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{children:J(e.key)}),(0,Z.jsxs)(Ce,{value:e.value,onValueChange:t,children:[(0,Z.jsx)(xe,{"aria-label":J(e.key),"data-testid":`setting-select-${e.key}`,children:(0,Z.jsx)(Se,{})}),(0,Z.jsx)(be,{children:e.options.map(e=>(0,Z.jsx)(ye,{value:e,children:e},e))})]}),e.description&&(0,Z.jsx)(z,{children:e.description})]});case`color`:return(0,Z.jsx)(bt,{debounceMs:200,direction:`rtl`,hint:e.description,title:J(e.key),value:e.value||``,onChange:e=>t(e)});case`image`:return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(R,{children:J(e.key)}),(0,Z.jsx)(me,{className:e.value?`h-25`:`h-8`,children:e.value?(0,Z.jsxs)(H,{children:[(0,Z.jsx)(he,{id:`custom-${e.key}`,src:e.value}),(0,Z.jsx)(V,{children:(0,Z.jsx)(U,{"aria-label":`Remove image`,onClick:()=>t(null),children:(0,Z.jsx)(w,{})})})]}):(0,Z.jsx)(pe,{inputId:`custom-${e.key}`,onDropAccepted:e=>void l(e[0]),children:`Upload image`})}),e.description&&(0,Z.jsx)(z,{children:e.description})]})}},sn={source:[`title_font`,`body_font`],casper:[`title_font`,`body_font`],alto:[`title_font`,`body_font`],bulletin:[`title_font`,`body_font`],dawn:[`title_font`,`body_font`],digest:[`title_font`,`body_font`],dope:[`title_font`,`body_font`],ease:[`title_font`,`body_font`],edge:[`title_font`,`body_font`],edition:[`title_font`,`body_font`],episode:[`typography`],headline:[`title_font`,`body_font`],journal:[`title_font`,`body_font`],london:[`title_font`,`body_font`],ruby:[`title_font`,`body_font`],solo:[`typography`],taste:[`style`],wave:[`title_font`,`body_font`]},cn=({sections:e,updateSetting:t})=>{let{data:n}=Ve(),r=n?.themes.find(e=>e.active),i=r?.package.name?.toLowerCase()||``,a=r?.package.author?.name||``,{supportsCustomFonts:o}=kt();return(0,Z.jsx)(Z.Fragment,{children:e.map(e=>{let n=e.settings.filter(t=>nn(t,e.settings.reduce((e,{key:t,value:n})=>({...e,[t]:n}),{}))),r;return(0,Z.jsxs)(de,{className:`gap-0 first-of-type:mt-6`,children:[(0,Z.jsx)(fe,{className:`mb-4 text-md! leading-supertight font-bold md:text-lg!`,children:e.title}),(0,Z.jsx)(I,{className:`mb-12 gap-4`,children:n.map(e=>{let n=``;e.type===`boolean`&&r!==`boolean`&&r!==void 0&&(n=`mt-3`),(e.type===`text`||e.type===`select`)&&(r===`text`||r===`select`)&&(n=`mt-2`);let s=sn[i];return s&&s.includes(e.key)&&a===`Ghost Foundation`&&o&&(n+=` hidden`),r=e.type,(0,Z.jsx)(`div`,{className:n,children:(0,Z.jsx)(on,{setSetting:n=>t({...e,value:n}),setting:e},e.key)},e.key)})})]},e.id)})})},ln=({globalSettings:e,themeSettingSections:t,updateGlobalSetting:n,updateThemeSetting:r,onTabChange:i})=>{let[a,o]=(0,X.useState)(`global`);return(0,Z.jsx)(`div`,{className:`flex h-full flex-col justify-between`,children:(0,Z.jsx)(`div`,{className:`grow p-7 pt-0`,"data-testid":`design-setting-tabs`,children:t.length>0?(0,Z.jsxs)(De,{value:a,variant:`underline`,onValueChange:e=>{o(e),i(e)},children:[(0,Z.jsxs)(Ee,{className:`sticky top-0 z-50 bg-surface-elevated-2`,children:[(0,Z.jsx)(q,{value:`global`,children:`Brand`}),(0,Z.jsx)(q,{value:`theme-settings`,children:`Theme`})]}),(0,Z.jsx)(Te,{value:`global`,children:(0,Z.jsx)(en,{updateSetting:n,values:e})}),(0,Z.jsx)(Te,{value:`theme-settings`,children:(0,Z.jsx)(cn,{sections:t,updateSetting:r})})]}):(0,Z.jsx)(en,{updateSetting:n,values:e})})})},un=()=>{let{settings:e,siteData:t}=gt(),{mutateAsync:n}=Xe(),{data:{posts:[r]}={posts:[]}}=m({searchParams:{filter:`status:published`,order:`published_at DESC`,limit:`1`,fields:`id,url`}}),{data:i}=We(),{mutateAsync:a}=He(),o=c(),[s,l]=(0,X.useState)(`homepage`),[u,d]=(0,X.useState)(`desktop`),{updateRoute:f}=Y(),h=g(),_=Tt().getParam(`ref`),{formState:v,saveState:y,handleSave:b,updateForm:x,setFormState:S,okProps:C}=p({initialState:{settings:e,themeSettings:i?.custom_theme_settings},savingDelay:500,onSave:async()=>{if(v.themeSettings?.some(e=>e.dirty)){let e=await a(v.themeSettings);S(t=>({...t,themeSettings:e.custom_theme_settings}))}if(v.settings.some(e=>e.dirty)){let{settings:e}=await n(v.settings.filter(e=>e.dirty));S(t=>({...t,settings:e}))}},onSaveError:o});(0,X.useEffect)(()=>{i&&S(e=>({...e,themeSettings:i.custom_theme_settings}))},[S,i]);let w=(e,t)=>{x(n=>({...n,settings:n.settings.map(n=>n.key===e?{...n,value:t,dirty:!0}:n)}))},T=e=>{x(t=>({...t,themeSettings:t.themeSettings?.map(t=>t.key===e.key?{...e,dirty:!0}:t)}))},[D,O,k,ee,A,te,ne]=$e(v.settings,[`description`,`accent_color`,`icon`,`logo`,`cover_image`,`heading_font`,`body_font`]),M=(v.themeSettings||[]).reduce((e,t)=>{let n=t.group===`homepage`||t.group===`post`?t.group:`site-wide`;return{...e,[n]:(e[n]||[]).concat(t)}},{}),N=Object.entries(M).map(([e,t])=>({id:e,settings:t||[],title:e===`site-wide`?`Site wide`:e===`homepage`?`Homepage`:`Post`})),P=e=>{r&&l(e)},F=e=>{l(e===`post`&&r?`post`:`homepage`)},re=[{id:`homepage`,url:it(t)},...r?[{id:`post`,url:r.url}]:[]],ie={description:D,accentColor:O,icon:k,logo:ee,coverImage:A,themeSettings:v.themeSettings,headingFont:te,bodyFont:ne},ae=(0,Z.jsx)(`div`,{className:`relative size-full`,children:re.map(({id:e,url:t})=>(0,Z.jsx)(an,{isVisible:s===e,settings:ie,url:t},e))}),oe=u===`desktop`?(0,Z.jsx)(K,{"data-testid":`preview-desktop`,device:`desktop`,children:ae}):(0,Z.jsx)(K,{"data-testid":`preview-mobile`,device:`mobile`,children:ae}),se=r?(0,Z.jsx)(De,{value:s,variant:`button`,onValueChange:P,children:(0,Z.jsxs)(Ee,{children:[(0,Z.jsx)(q,{value:`homepage`,children:`Homepage`}),(0,Z.jsx)(q,{value:`post`,children:`Post`})]})}):void 0,ce=(0,Z.jsxs)(ke,{size:`default`,type:`single`,value:u,onValueChange:e=>{(e===`desktop`||e===`mobile`)&&d(e)},children:[(0,Z.jsx)(Oe,{"aria-label":`Desktop`,value:`desktop`,children:(0,Z.jsx)(j,{})}),(0,Z.jsx)(Oe,{"aria-label":`Mobile`,value:`mobile`,children:(0,Z.jsx)(E,{})})]}),le=(0,Z.jsx)(ln,{globalSettings:{description:D,accentColor:O,icon:k,logo:ee,coverImage:A,headingFont:te,bodyFont:ne},handleSave:b,themeSettingSections:N,updateGlobalSetting:w,updateThemeSetting:T,onTabChange:F});return(0,Z.jsx)(xt,{buttonsDisabled:C.disabled,cancelLabel:`Close`,deviceSelector:ce,dirty:y===`unsaved`,okLabel:C.label||`Save`,okVariant:C.variant,preview:oe,previewToolbarTabs:se,sidebar:le,sidebarPadding:!1,siteLink:it(t),size:`full`,testId:`design-modal`,title:`Design`,onClose:()=>{_===`setup`?h(`/analytics`):f(`design`)},onOk:async()=>{await b({fakeWhenUnchanged:!0})}})},dn=({title:e,prompt:t,cancelLabel:n=`Cancel`,okLabel:r=`OK`,okVariant:i=`default`,onResolve:a})=>(0,Z.jsx)(Fe,{backDropClick:!1,cancelLabel:n,okLabel:r,okVariant:i,testId:`theme-editor-confirm-modal`,title:e,width:540,onCancel:()=>a(!1),onClose:()=>a(!1),onOk:()=>a(!0),children:(0,Z.jsx)(`div`,{className:`py-4`,children:t})}),fn=({title:e,prompt:t,fieldTitle:n,initialValue:r,placeholder:i,cancelLabel:a=`Cancel`,okLabel:o=`Continue`,onResolve:s})=>{let[c,l]=(0,X.useState)(r);return(0,Z.jsx)(Fe,{backDropClick:!1,cancelLabel:a,okDisabled:!c.trim(),okLabel:o,testId:`theme-editor-input-modal`,title:e,width:540,onCancel:()=>s(null),onClose:()=>s(null),onOk:()=>s(c),children:(0,Z.jsxs)(`div`,{className:`flex flex-col gap-4 py-4`,children:[t,(0,Z.jsxs)(B,{children:[(0,Z.jsx)(R,{htmlFor:`theme-editor-input`,children:n}),(0,Z.jsx)(_e,{id:`theme-editor-input`,placeholder:i,value:c,autoFocus:!0,onChange:e=>l(e.target.value)})]})]})})},pn=`inline-flex items-center gap-2 rounded-md border px-3 py-1.5 text-[13px] font-medium transition-colors focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#4a9eff] disabled:cursor-not-allowed disabled:opacity-50`,mn=`${pn} border-[#2f333b] bg-transparent text-[#e6e7ea] hover:bg-[#1f2228]`,hn=`${pn} border-transparent bg-green text-black hover:bg-green-400`,gn=({currentThemeName:e,changes:t,isSaving:n,onClose:r,onSave:i})=>(0,Z.jsxs)(`div`,{className:`flex items-center gap-3 border-b border-[#23262c] bg-[#1a1d21] px-4 py-3`,children:[(0,Z.jsxs)(`div`,{className:`flex min-w-0 items-baseline gap-2`,children:[(0,Z.jsx)(`h2`,{className:`truncate text-[14px] font-semibold text-[#f4f5f7]`,children:`Edit theme`}),(0,Z.jsx)(`span`,{className:`truncate text-[12px] text-[#8a8f98]`,children:e})]}),t.length>0&&(0,Z.jsxs)(`span`,{className:`rounded-full border border-transparent bg-[#3b2a16] px-2.5 py-1 text-[11px] leading-none text-[#f5a623]`,children:[_(t.length),` `,t.length===1?`file modified`:`files modified`]}),(0,Z.jsx)(`div`,{className:`grow`}),(0,Z.jsxs)(`button`,{className:mn,type:`button`,onClick:r,children:[(0,Z.jsx)(D,{size:14}),`Close`]}),(0,Z.jsxs)(`button`,{className:hn,disabled:n,type:`button`,onClick:i,children:[(0,Z.jsx)(M,{size:14}),n?`Saving…`:`Save`]})]}),_n=e=>{let t={type:`dir`,name:``,path:``,children:new Map};for(let n of Object.keys(e).sort()){let r=n.split(`/`),i=t;for(let t=0;t<r.length;t+=1){let a=r[t];if(t===r.length-1){i.children.set(a,{type:`file`,name:a,path:n,editable:e[n].editable});continue}let o=`${r.slice(0,t+1).join(`/`)}/`,s=i.children.get(a);if(s?.type===`dir`){i=s;continue}let c={type:`dir`,name:a,path:o,children:new Map};i.children.set(a,c),i=c}}return t},vn=e=>e.sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`dir`?-1:1),yn=`inline-flex h-5 w-5 items-center justify-center rounded-sm text-[#c8ccd3] transition-opacity hover:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#4a9eff] disabled:cursor-not-allowed disabled:opacity-30`,bn=({currentFiles:e,selectedNode:t,setSelectedNode:n,expandedDirectories:r,setExpandedDirectories:i,changesMap:a,isLoading:o,onCreateFile:s,onRenameSelected:c,onDeleteSelected:l,onOpenFile:u})=>{let d=(e,o=0)=>{if(e.type===`file`){let n=t?.type===`file`&&t.path===e.path,r=a.get(e.path);return(0,Z.jsxs)(`button`,{className:`flex min-h-6 w-full items-center gap-1.5 rounded px-2 py-1 text-left text-[13px] leading-5 ${n?`bg-[#243043] text-white`:`text-[#c8ccd3] hover:bg-[#1f2228]`} ${e.editable?``:`opacity-70`}`,style:{paddingLeft:`${o*14+8}px`},type:`button`,onClick:()=>u(e.path),children:[(0,Z.jsx)(`span`,{className:`w-3 shrink-0`}),(0,Z.jsx)(S,{size:14}),(0,Z.jsx)(`span`,{className:`min-w-0 grow truncate`,children:e.name}),r&&(0,Z.jsx)(`span`,{className:`mr-1 size-1.5 shrink-0 rounded-full ${r===`deleted`?`bg-[#ff6b6b]`:r===`added`?`bg-[#14b886]`:`bg-[#f5a623]`}`})]},e.path)}let s=r.has(e.path),c=t?.type===`dir`&&t.path===e.path,l=vn(Array.from(e.children?.values()||[]));return(0,Z.jsxs)(`div`,{children:[e.path&&(0,Z.jsxs)(`button`,{className:`flex min-h-6 w-full items-center gap-1.5 rounded px-2 py-1 text-left text-[13px] leading-5 ${c?`bg-[#202630] text-white`:`text-[#c8ccd3] hover:bg-[#1f2228]`}`,style:{paddingLeft:`${o*14+8}px`},type:`button`,onClick:()=>{n({type:`dir`,path:e.path}),i(t=>{let n=new Set(t);return n.has(e.path)?n.delete(e.path):n.add(e.path),n})},children:[s?(0,Z.jsx)(O,{className:`shrink-0 text-[#6a6f78]`,size:12}):(0,Z.jsx)(ne,{className:`shrink-0 text-[#6a6f78]`,size:12}),s?(0,Z.jsx)(P,{className:`shrink-0 text-[#8a8f98]`,size:14}):(0,Z.jsx)(C,{className:`shrink-0 text-[#8a8f98]`,size:14}),(0,Z.jsx)(`span`,{className:`truncate`,children:e.name})]}),(e.path===``||s)&&(0,Z.jsx)(`div`,{children:l.map(t=>d(t,e.path?o+1:o))})]},e.path||`root`)};return(0,Z.jsxs)(`aside`,{className:`flex w-[280px] shrink-0 flex-col border-r border-[#23262c] bg-[#16181c]`,children:[(0,Z.jsxs)(`div`,{className:`flex items-center justify-between gap-2 border-b border-[#23262c] px-3 py-2`,children:[(0,Z.jsxs)(`div`,{className:`text-[12px] font-medium text-[#c8ccd3]`,children:[Object.keys(e).length,` files`]}),(0,Z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Z.jsx)(`button`,{"aria-label":`New file`,className:yn,type:`button`,onClick:s,children:(0,Z.jsx)(A,{size:13})}),(0,Z.jsx)(`button`,{"aria-label":`Rename selected item`,className:yn,disabled:!t,type:`button`,onClick:c,children:(0,Z.jsx)(F,{size:13})}),(0,Z.jsx)(`button`,{"aria-label":`Delete selected item`,className:yn,disabled:!t,type:`button`,onClick:l,children:(0,Z.jsx)(w,{size:13})})]})]}),(0,Z.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-2`,children:o?(0,Z.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center gap-3 text-center text-[13px] text-[#8a8f98]`,children:[(0,Z.jsx)(`div`,{className:`size-5 animate-spin rounded-full border-2 border-[#2f333b] border-t-[#14b886]`}),(0,Z.jsx)(`span`,{children:`Loading theme files…`})]}):Object.keys(e).length===0?(0,Z.jsx)(`div`,{className:`px-3 py-4 text-[12px] text-[#8a8f98]`,children:`This theme archive does not contain any files.`}):d(_n(e))})]})},xn=e(Et(),1),Sn=e=>{if(!e.startsWith(`theme/edit/`))return{themeName:null,isInvalid:!1};let t=e.slice(11).split(`?`)[0];if(!t||t.includes(`/`))return{themeName:null,isInvalid:!0};try{let e=decodeURIComponent(t);return!e||e.includes(`/`)?{themeName:null,isInvalid:!0}:{themeName:e,isInvalid:!1}}catch{return{themeName:null,isInvalid:!0}}},Cn={maxFiles:1e3,maxExtractedBytes:32*1024*1024},wn=class extends Error{reason;constructor(e,t){super(t),this.name=`ThemeArchiveExtractionError`,this.reason=e}},Tn=new Set([`css`,`cjs`,`hbs`,`handlebars`,`htm`,`html`,`js`,`json`,`less`,`md`,`markdown`,`mjs`,`sass`,`scss`,`svg`,`txt`,`xml`,`yaml`,`yml`]),En=new Set([`.editorconfig`,`.eslintignore`,`.eslintrc`,`.gitattributes`,`.gitignore`,`.npmignore`,`.prettierignore`,`.prettierrc`,`CODEOWNERS`,`LICENSE`,`LICENCE`,`NOTICE`,`Procfile`]),Dn=e=>{if(Tn.has(On(e)))return!0;let t=e.split(`/`).at(-1)||e;return En.has(t)},On=e=>{let t=e.lastIndexOf(`.`);return t===-1?``:e.slice(t+1).toLowerCase()},kn=e=>{let t=e.trim().replace(/^\/+/,``).replace(/\/+/g,`/`);if(!t)return null;let n=t.split(`/`).filter(Boolean);return n.length===0||n.some(e=>e===`.`||e===`..`)?null:n.join(`/`)},An=e=>[`casper`,`source`].includes(e.toLowerCase()),jn=e=>{if(e.length===0)return``;let t=e[0].indexOf(`/`);if(t<=0)return``;let n=e[0].slice(0,t+1);return e.every(e=>e.startsWith(n))?n:``},Mn=e=>Object.fromEntries(Object.entries(e).map(([e,t])=>[e,{...t,date:new Date(t.date),binary:t.binary?new Uint8Array(t.binary):null}])),Nn=`Failed to open the theme archive. Download the theme again and retry.`,Pn=e=>{let t=e/(1024*1024);return Number.isInteger(t)?`${t} MB`:`${t.toFixed(1)} MB`},Fn=e=>{let t=[];return e.forEach((e,n)=>{n.dir||t.push([e,n])}),t},In=e=>{if(e.length>Cn.maxFiles)throw new wn(`too_many_files`,`This theme archive contains too many files for the browser editor (${e.length}/${Cn.maxFiles}).`)},Ln=async e=>{try{return await xn.default.loadAsync(e)}catch{throw new wn(`invalid_archive`,Nn)}},Rn=async e=>{try{return await e.async(`uint8array`)}catch{throw new wn(`invalid_archive`,Nn)}},zn=async e=>{try{return await e.async(`string`)}catch{throw new wn(`invalid_archive`,Nn)}},Bn=e=>{let t=kn(e);if(!t||t!==e)throw new wn(`invalid_archive`,Nn);return t},Vn=(e,t)=>{let n=e+t;if(n>Cn.maxExtractedBytes)throw new wn(`too_large`,`This theme archive is too large to open in the browser editor. Extracted files must stay under ${Pn(Cn.maxExtractedBytes)}.`);return n},Hn=async e=>{let t=Fn(await Ln(e));In(t);let n=jn(t.map(([e])=>e)),r={},i=new TextEncoder,a=0;for(let[e,o]of t){let t=n?e.slice(n.length):e;if(!t)continue;let s=Bn(t);if(Dn(s))try{let e=await zn(o);a=Vn(a,i.encode(e).byteLength),r[s]={path:s,editable:!0,content:e,binary:null,date:o.date||new Date,unixPermissions:typeof o.unixPermissions==`number`?o.unixPermissions:null,dosPermissions:typeof o.dosPermissions==`number`?o.dosPermissions:null};continue}catch{}let c=await Rn(o);a=Vn(a,c.byteLength),r[s]={path:s,editable:!1,content:null,binary:c,date:o.date||new Date,unixPermissions:typeof o.unixPermissions==`number`?o.unixPermissions:null,dosPermissions:typeof o.dosPermissions==`number`?o.dosPermissions:null}}return{files:r,rootPrefix:n}},Un=async({files:e,rootPrefix:t})=>{let n=new xn.default;for(let[r,i]of Object.entries(e)){let e=`${t}${r}`,a={date:i.date,createFolders:!0,unixPermissions:i.unixPermissions??void 0,dosPermissions:i.dosPermissions??void 0};i.editable?n.file(e,i.content??``,a):n.file(e,i.binary,{...a,binary:!0})}return n.generateAsync({type:`blob`,mimeType:`application/zip`,compression:`DEFLATE`,compressionOptions:{level:6}})},Wn=({baseFiles:e,currentFiles:t})=>{let n=new Set([...Object.keys(e),...Object.keys(t)]),r=[];for(let i of Array.from(n).sort()){let n=e[i],a=t[i];if(!n&&a){r.push({path:i,editable:a.editable,status:`added`});continue}if(n&&!a){r.push({path:i,editable:n.editable,status:`deleted`});continue}!n||!a||n.editable&&a.editable&&n.content!==a.content&&r.push({path:i,editable:!0,status:`modified`})}return r},Gn=({files:e,oldPrefix:t,newPrefix:n})=>{let r={};for(let[i,a]of Object.entries(e)){if(!i.startsWith(t)){r[i]=a;continue}let e=`${n}${i.slice(t.length)}`;r[e]={...a,path:e}}return r},Kn=e=>{switch(On(e)){case`css`:case`scss`:case`sass`:case`less`:return h(()=>import(`./dist-Bmo2j_KH.js`).then(e=>e.r).then(e=>e.css()),__vite__mapDeps([0,1,2,3]),import.meta.url);case`js`:case`cjs`:case`mjs`:return h(()=>import(`./dist-CWHIoxYn.js`).then(e=>e.t).then(e=>e.javascript()),__vite__mapDeps([4,1,2,3]),import.meta.url);case`json`:return h(()=>import(`./dist-Cp2M5TzT.js`).then(e=>e.json()),__vite__mapDeps([5,2,3]),import.meta.url);case`md`:case`markdown`:return h(()=>import(`./dist-DQAAPbtg.js`).then(e=>e.markdown()),__vite__mapDeps([6,2,7,3,0,1,4]),import.meta.url);case`yaml`:case`yml`:return h(()=>import(`./dist-DyO279y5.js`).then(e=>e.yaml()),__vite__mapDeps([8,2,3]),import.meta.url);case`hbs`:case`handlebars`:case`html`:case`htm`:case`svg`:case`xml`:return h(()=>import(`./dist-C-_aTlvJ.js`).then(e=>e.html()),__vite__mapDeps([7,2,3,0,1,4]),import.meta.url);default:return h(()=>import(`./dist-C-_aTlvJ.js`).then(e=>e.html()),__vite__mapDeps([7,2,3,0,1,4]),import.meta.url)}},qn=e=>{let t=On(e);if(!t)return`text`;switch(t){case`hbs`:return`handlebars`;case`htm`:return`html`;case`yml`:return`yaml`;default:return t}},Jn=e=>{if(e[`package.json`]?.editable)return{type:`file`,path:`package.json`};let t=Object.keys(e).sort().find(t=>e[t].editable);if(t)return{type:`file`,path:t};let n=Object.keys(e).sort()[0];return n?{type:`file`,path:n}:null},Yn=e=>{let t=e.split(`/`),n=[``];for(let e=0;e<t.length-1;e+=1)n.push(`${t.slice(0,e+1).join(`/`)}/`);return n},Xn=[`theme`,`design`],Zn=e=>Xn.some(t=>e===t||e.startsWith(`${t}/`)),Qn=()=>{let e=window.location.hash.substring(1),t=`${window.location.protocol}//${window.location.hostname}`,n;try{n=new URL(e||`/`,t)}catch{return null}let r=n.searchParams.get(`from`);return r===null?null:r===``||Zn(r)?r:null},$n=(e,t)=>{let n=`theme/edit/${encodeURIComponent(e)}`;return t===null?n:`${n}?from=${encodeURIComponent(t)}`},er=(e,t)=>!e.editable&&Dn(t),tr=/^[a-z0-9][\w-]{0,63}$/,nr=[`COMPRESSED_TOO_LARGE`,`ENTRY_TOO_LARGE`,`TOTAL_TOO_LARGE`],rr={COMPRESSED_TOO_LARGE:`Theme too large to upload`,ENTRY_TOO_LARGE:`File too large`,TOTAL_TOO_LARGE:`Theme contents too large`},ir=Ne({errors:Ae(Ne({message:Me().optional(),code:Pe(nr),errorDetails:Ne({entryName:Me().optional(),limitBytes:je().positive().finite().optional()}).optional()})).min(1)}),ar=e=>{if(!e||e<=0)return`the allowed size`;let t=e/(1024*1024);return t>=1?`${t.toFixed(1)} MB`:`${Math.round(e/1024)} KB`},or=e=>{if(!(e instanceof i))return null;let t=e.data;if(typeof t==`string`)try{t=JSON.parse(t)}catch{return null}let n=ir.safeParse(t);return n.success?n.data.errors[0]??null:null},sr=e=>{let{entryName:t,limitBytes:n}=e.errorDetails??{},r=ar(n);switch(e.code){case`COMPRESSED_TOO_LARGE`:return`The theme archive is too large to upload (max ${r}).`;case`ENTRY_TOO_LARGE`:return t?`The file "${t}" is too large (max ${r} per file).`:`One of the files is too large (max ${r} per file).`;case`TOTAL_TOO_LARGE`:return`The theme contents exceed the maximum allowed size of ${r}.`;default:return e.message||`Theme upload failed.`}},cr=e=>`inline-flex h-5 w-5 items-center justify-center rounded-sm text-[#c8ccd3] transition-opacity hover:opacity-100 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[#4a9eff] ${e?`opacity-100`:`opacity-60`}`,lr=`flex h-full items-center justify-center p-8 text-center text-[13px] text-[#6a6f78]`,ur=yt.theme({"&.cm-focused > .cm-scroller > .cm-selectionLayer .cm-selectionBackground, .cm-selectionBackground, .cm-content ::selection":{backgroundColor:`#355070`},".cm-content ::selection":{color:`#ffffff`}},{dark:!0}),dr=({themeName:e})=>{let{updateRoute:t}=Y(),n=u(),r=c(),{data:i}=Ve(),{mutateAsync:l}=ze(),[d,p]=(0,X.useState)(e),[m,h]=(0,X.useState)({}),[g,v]=(0,X.useState)({}),[y,b]=(0,X.useState)(``),[x,S]=(0,X.useState)(null),[C,w]=(0,X.useState)(new Set([``])),[T,E]=(0,X.useState)(!0),[D,O]=(0,X.useState)(!1),[ee,A]=(0,X.useState)(null),[j,ne]=(0,X.useState)(!1),[M,N]=(0,X.useState)(null),P=(0,X.useRef)(null),[F,re]=(0,X.useState)(null),[ie,ae]=(0,X.useState)(null),[oe,ue]=(0,X.useState)([]);(0,X.useEffect)(()=>{let t=!0,r=()=>{p(e),h({}),v({}),b(``),S(null),w(new Set([``]))};return(async()=>{E(!0),A(null),r();try{let r=await Hn(await n(s(`/themes/${encodeURIComponent(e)}/download/`),{responseType:`arraybuffer`})),i=Mn(r.files),a=Jn(i);if(!t)return;p(e),h(Mn(r.files)),v(i),b(r.rootPrefix),S(a),w(new Set(a?.type===`file`?Yn(a.path):[``]))}catch(n){if(!t)return;n instanceof a&&n.response?A(`Failed to load theme "${e}" (${n.response.status})`):A(n instanceof Error?n.message:`Failed to load theme`)}finally{t&&E(!1)}})(),()=>{t=!1}},[e,n]),(0,X.useEffect)(()=>{let e=document.body.style.overflow;return document.body.style.overflow=`hidden`,()=>{document.body.style.overflow=e}},[]);let I=(0,X.useMemo)(()=>Wn({baseFiles:m,currentFiles:g}),[m,g]),de=(0,X.useMemo)(()=>new Map(I.map(e=>[e.path,e.status])),[I]),L=x?.type===`file`?g[x.path]:null;(0,X.useEffect)(()=>{let e=!0;return L?.editable?(Kn(L.path).then(t=>{e&&ue([se({top:!0}),ce,t,...j?[yt.lineWrapping]:[],ur])}).catch(()=>{e&&ue([se({top:!0}),ce,...j?[yt.lineWrapping]:[],ur])}),()=>{e=!1}):(ue([]),()=>{e=!1})},[j,L]);let R=(0,X.useCallback)(()=>{let e=P.current;e&&(P.current=null,e.type===`confirmation`?e.resolve(!1):e.resolve(null))},[]),z=e=>(R(),new Promise(t=>{let n={type:`confirmation`,props:e,resolve:t};P.current=n,N(n)})),fe=e=>(R(),new Promise(t=>{let n={type:`input`,props:e,resolve:t};P.current=n,N(n)}));(0,X.useEffect)(()=>()=>R(),[R]);let B=async()=>{I.length>0&&!await z({title:`Discard changes?`,prompt:`You have unsaved theme changes. Close the editor and discard them?`,okLabel:`Discard changes`,okVariant:`destructive`})||t(Qn()??`design/change-theme`)},V=(0,X.useRef)(async()=>{}),H=!!(M||F||ie);(0,X.useEffect)(()=>{let e=e=>{if((e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`){if(e.preventDefault(),H){e.stopPropagation(),e.stopImmediatePropagation();return}V.current();return}e.key===`Escape`&&(H||(e.preventDefault(),e.stopPropagation(),e.stopImmediatePropagation()))};return window.addEventListener(`keydown`,e,!0),()=>{window.removeEventListener(`keydown`,e,!0)}},[H]);let U=e=>{w(t=>{let n=new Set(t);for(let t of Yn(e))n.add(t);return n})},W=(e,t)=>{if(v(e),t){S(t),t.type===`file`&&U(t.path);return}x?.type===`file`&&e[x.path]||S(Jn(e))},pe=async()=>{let e=await fe({title:`Create file`,fieldTitle:`File path`,initialValue:`partials/new-file.hbs`,okLabel:`Create file`,prompt:`Add a new editable file to this theme.`}),t=e?kn(e):null;if(!t)return;if(!Dn(t)){f.error(`Only text files can be created here`,{description:`Use a text-based theme file extension such as .hbs, .css, .js, or .json.`});return}if(g[t]){f.error(`File already exists`);return}let n={...g,[t]:{path:t,editable:!0,content:``,binary:null,date:new Date,unixPermissions:null,dosPermissions:null}};W(n,{type:`file`,path:t})},me=async()=>{if(!x)return;let e=x.type===`dir`?x.path.replace(/\/$/,``):x.path,t=x.type===`dir`?`Rename folder to`:`Rename file to`,n=await fe({title:x.type===`dir`?`Rename folder`:`Rename file`,fieldTitle:`Path`,initialValue:e,okLabel:`Rename`,prompt:t}),r=n?kn(n):null;if(!r||r===e)return;if(x.type===`file`){let e=g[x.path];if(!Dn(r)&&e.editable){f.error(`Text files must keep a text file extension`);return}if(er(e,r)){f.error(`Binary files cannot be renamed to a text file`,{description:`Rename this file with a non-text extension to keep its contents intact.`});return}if(g[r]){f.error(`A file with that name already exists`);return}let t={...g},n=t[x.path];delete t[x.path],t[r]={...n,path:r,editable:Dn(r)},W(t,{type:`file`,path:r});return}let i=`${r}/`;if(i.startsWith(x.path)){f.error(`A folder cannot be renamed inside itself`);return}if(Object.keys(g).find(e=>e.startsWith(i))){f.error(`A folder with that path already exists`);return}let a=Gn({files:g,oldPrefix:x.path,newPrefix:i});W(a,{type:`dir`,path:i}),w(e=>{let t=new Set;for(let n of e){if(!n.startsWith(x.path)){t.add(n);continue}t.add(`${i}${n.slice(x.path.length)}`)}return t})},he=async()=>{if(!x)return;if(x.type===`file`){if(!await z({title:`Delete file`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[`Delete `,(0,Z.jsx)(`strong`,{children:x.path}),` from this theme?`]}),okLabel:`Delete`,okVariant:`destructive`}))return;let e={...g};delete e[x.path],W(e);return}let e=Object.keys(g).filter(e=>e.startsWith(x.path));if(!e.length||!await z({title:`Delete folder`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[`Delete `,_(e.length),` file`,e.length===1?``:`s`,` `,`from `,(0,Z.jsx)(`strong`,{children:x.path}),`?`]}),okLabel:`Delete`,okVariant:`destructive`}))return;let t={...g};for(let n of e)delete t[n];W(t)},ge=e=>{let t=m[e],n=g[e],r={...g};!t&&n?delete r[e]:t&&(r[e]={...t,binary:t.binary?new Uint8Array(t.binary):null}),W(r)},_e=async()=>{let e=(await fe({title:`Save as new theme`,fieldTitle:`Theme name`,initialValue:`${d}-edited`,okLabel:`Continue`,prompt:`Default themes cannot be overwritten. Save your edits as a new theme instead.`}))?.trim().toLowerCase();return e?tr.test(e)?An(e)?(f.error(`Built-in themes cannot be overwritten`),null):e:(f.error(`Invalid theme name`,{description:`Use 1-64 characters, starting with a letter or number. Allowed: letters, numbers, dashes, and underscores.`}),null):null},ve=async()=>{if(D)return;if(I.length===0){f.info(`No changes to save`);return}let e=d,n=An(e)?await _e():e;if(!n)return;let a=n!==e,s=i?.themes.some(e=>e.name===n)||!1,c=a?`Save your edits as "${n}"?`:`Upload ${_(I.length)} changed file${I.length===1?``:`s`} and replace "${e}"?`;if(await z({title:a?`Save theme as new copy`:`Update theme`,prompt:c,okLabel:a?`Save theme`:`Replace theme`})&&!(a&&s&&!await z({title:`Overwrite theme`,prompt:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`strong`,{children:n}),` already exists. Do you want to overwrite it?`]}),okLabel:`Overwrite`,okVariant:`destructive`}))){O(!0);try{let r=await Un({files:g,rootPrefix:y}),i=(await l({file:new File([r],`${n}.zip`,{type:`application/zip`}),copySettingsFrom:a?e:void 0})).themes[0],o=Qn();h(Mn(g)),a&&(p(n),b(y?`${n}/`:``),t($n(n,o)));let s=Ye(i);a||s.length?ae({title:a?`Theme saved`:`Theme updated`,action:`saved`,installedTheme:i}):f.success(`Theme saved`,{description:(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`span`,{className:`capitalize`,children:i.name}),` has been updated.`]})})}catch(e){if(e instanceof o&&e.response?.status===422){let t=Qe(e.data?.errors);if(t){re(t);return}}let t=or(e);if(t){f.error(rr[t.code],{description:sr(t)});return}r(e)}finally{O(!1)}}};(0,X.useEffect)(()=>{V.current=ve});let G=e=>{S({type:`file`,path:e}),U(e)},K=L?de.get(L.path):null;return(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`div`,{"aria-label":`Edit theme ${e}`,"aria-modal":`true`,className:`dark fixed inset-0 z-[140] bg-[rgba(10,11,13,0.72)] text-[#e6e7ea] backdrop-blur-[4px]`,"data-testid":`theme-code-editor-modal`,role:`dialog`,onClick:e=>{e.target===e.currentTarget&&B()},children:(0,Z.jsxs)(`div`,{className:`relative flex size-full flex-col overflow-hidden bg-[#15171a]`,children:[(0,Z.jsx)(gn,{changes:I,currentThemeName:d,isSaving:D,onClose:()=>void B(),onSave:()=>void ve()}),ee&&(0,Z.jsx)(`div`,{className:`border-b border-[#512828] bg-[#3a1d1d] px-4 py-2 text-[12px] text-[#ffbdbd]`,children:ee}),(0,Z.jsxs)(`div`,{className:`flex min-h-0 flex-1`,children:[(0,Z.jsx)(bn,{changesMap:de,currentFiles:g,expandedDirectories:C,isLoading:T,selectedNode:x,setExpandedDirectories:w,setSelectedNode:S,onCreateFile:()=>void pe(),onDeleteSelected:()=>void he(),onOpenFile:G,onRenameSelected:()=>void me()}),(0,Z.jsxs)(`section`,{className:`flex min-w-0 flex-1 flex-col bg-[#16181c]`,children:[(0,Z.jsx)(`div`,{className:`flex items-center gap-2 border-b border-[#23262c] bg-[#17191d] px-4 py-2 text-[12px] text-[#8a8f98]`,children:L?(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`span`,{className:`min-w-0 truncate font-medium text-[#e6e7ea]`,children:L.path}),(0,Z.jsx)(`span`,{className:`rounded bg-[#2a2d33] px-2 py-0.5 text-[10px] tracking-[0.04em] text-[#c8ccd3] uppercase`,children:qn(L.path)}),K&&(0,Z.jsxs)(`button`,{className:`inline-flex items-center gap-1 rounded px-2 py-0.5 text-[10px] tracking-[0.04em] uppercase ${K===`deleted`?`bg-[#4a2222] text-[#ffbdbd]`:K===`added`?`bg-[#17342a] text-[#a5e8c8]`:`bg-[#3b2a16] text-[#f5a623]`}`,type:`button`,onClick:()=>ge(L.path),children:[(0,Z.jsx)(k,{size:11}),`Revert`]}),(0,Z.jsx)(`div`,{className:`grow`}),L.editable&&(0,Z.jsx)(`button`,{"aria-label":j?`Disable text wrap`:`Enable text wrap`,"aria-pressed":j,className:cr(j),title:j?`Disable text wrap`:`Enable text wrap`,type:`button`,onClick:()=>ne(e=>!e),children:(0,Z.jsx)(te,{className:`shrink-0`,size:14,strokeWidth:2})})]}):(0,Z.jsx)(`span`,{children:`No file selected`})}),(0,Z.jsxs)(`div`,{className:`min-h-0 flex-1`,children:[!x&&!T&&(0,Z.jsx)(`div`,{className:lr,children:`Select a file from the tree to start editing.`}),x?.type===`dir`&&(0,Z.jsx)(`div`,{className:lr,children:`Folder selected. Choose a file to edit, or rename or delete the folder from the file pane.`}),L&&!L.editable&&(0,Z.jsx)(`div`,{className:lr,children:`This file cannot be edited in the browser.`}),L?.editable&&(0,Z.jsx)(le,{basicSetup:{highlightActiveLine:!1,highlightActiveLineGutter:!1},className:`h-full [&_.cm-button]:h-8 [&_.cm-button]:rounded-md [&_.cm-button]:border [&_.cm-button]:border-[#2f333b] [&_.cm-button]:bg-[#1f2228] [&_.cm-button]:bg-none [&_.cm-button]:px-3 [&_.cm-button]:text-[13px] [&_.cm-button]:text-[#c8ccd3] [&_.cm-button:hover]:bg-[#2a2d33] [&_.cm-content]:min-h-full [&_.cm-content]:py-3 [&_.cm-content_*::selection]:bg-[#355070] [&_.cm-cursor]:border-l-[#e6e7ea] [&_.cm-editor]:h-full [&_.cm-editor]:rounded-none [&_.cm-editor]:border-0 [&_.cm-editor]:bg-[#16181c] [&_.cm-gutters]:border-r-[#23262c] [&_.cm-gutters]:bg-[#17191d] [&_.cm-line::selection]:bg-[#355070] [&_.cm-panel]:bg-[#17191d] [&_.cm-panel]:shadow-none [&_.cm-panel.cm-search]:gap-2 [&_.cm-panel.cm-search]:px-3 [&_.cm-panel.cm-search]:py-2 [&_.cm-panel.cm-search]:text-[13px] [&_.cm-panels]:border-b [&_.cm-panels]:border-[#23262c] [&_.cm-panels]:bg-[#17191d] [&_.cm-panels]:text-[#c8ccd3] [&_.cm-scroller]:min-h-full [&_.cm-scroller]:overflow-auto [&_.cm-scroller]:bg-[#16181c] [&_.cm-search]:flex [&_.cm-search]:flex-wrap [&_.cm-search]:items-center [&_.cm-search]:gap-2 [&_.cm-search_label]:inline-flex [&_.cm-search_label]:items-center [&_.cm-search_label]:gap-1.5 [&_.cm-search_label]:text-[#a5abb4] [&_.cm-search_label_input]:size-4 [&_.cm-search_label_input]:accent-[#14b886] [&_.cm-searchMatch]:bg-[#243043] [&_.cm-searchMatch-selected]:bg-[#3b2a16] [&_.cm-searchMatch-selected]:outline-none [&_.cm-selectionBackground]:!bg-[#355070] [&_.cm-selectionLayer_.cm-selectionBackground]:!bg-[#355070] [&_.cm-textfield]:h-8 [&_.cm-textfield]:min-w-[220px] [&_.cm-textfield]:rounded-md [&_.cm-textfield]:border [&_.cm-textfield]:border-[#2f333b] [&_.cm-textfield]:bg-[#16181c] [&_.cm-textfield]:px-2.5 [&_.cm-textfield]:text-[#e6e7ea] [&_.cm-textfield]:outline-none [&_.cm-textfield]:placeholder:text-[#6a6f78]`,extensions:oe,height:`full`,theme:ce,value:L.content||``,autoFocus:!0,onChange:e=>{v(t=>({...t,[L.path]:{...t[L.path],content:e}}))}},`${L.path}:${oe.length}`)]})]})]})]})}),M?.type===`confirmation`&&(0,Z.jsx)(dn,{...M.props,onResolve:e=>{P.current===M&&(P.current=null,N(null),M.resolve(e))}}),M?.type===`input`&&(0,Z.jsx)(fn,{...M.props,onResolve:e=>{P.current===M&&(P.current=null,N(null),M.resolve(e))}}),F&&(0,Z.jsx)(Ot,{action:`saved`,cancelLabel:`Close`,fatalErrors:F,themeName:d,title:`Theme not saved`,onClose:()=>re(null)}),ie&&(0,Z.jsx)(Bt,{...ie,onClose:()=>ae(null)})]})},fr=()=>{let{route:e,updateRoute:t}=Y(),n=_t(),r=e,[i,a]=(0,X.useState)(null),[o,s]=(0,X.useState)(!1),[c,l]=(0,X.useState)(!1),[u,d]=(0,X.useState)(null),[f,p]=(0,X.useState)(!1),{checkThemeLimitError:m,isThemeLimitCheckReady:h,noThemeChangesAllowed:g,isThemeLimited:_}=Dt(),[v,y]=(0,X.useState)(null),[b,x]=(0,X.useState)(!1),{themeName:S,isInvalid:C}=Sn(r),{showLimit:w}=ht(),T=(0,X.useCallback)(e=>{w({prompt:e,onOk:()=>t({route:n,isExternal:!0})})},[w,t,n]);if((0,X.useEffect)(()=>{r===`design/change-theme`&&h?(async()=>{if(!g){s(!1),a(null);return}s(!0);let e=await m();a(e),s(!1),e&&(T(e),t(`theme`))})():(a(null),s(!1))},[m,r,h,g,T,t]),(0,X.useEffect)(()=>{r!==`theme/install`&&(x(!1),y(null),l(!1))},[r]),(0,X.useEffect)(()=>{C&&t(`theme`)},[C,t]),(0,X.useEffect)(()=>{let e=!1;return(async()=>{if(!S){d(null),p(!1);return}if(!h){p(!0);return}if(!_){d(null),p(!1);return}p(!0);let n=await m(`.`);e||(d(n),p(!1),n&&(T(n),t(`theme`)))})(),()=>{e=!0}},[m,S,h,_,T,t]),(0,X.useEffect)(()=>{let e=()=>{let e=window.location.href.split(`#`)[1]?.split(`?`)[1];return e?new URLSearchParams(e).get(`ref`):null},n=e=>{y(!1),T(e),t({route:`theme`,replace:!0})};(async()=>{if(r!==`theme/install`){l(!1);return}if(x(!0),!h){l(!0);return}if(!_){y(!0),l(!1);return}l(!0);let t=e();if(!t){y(!1),l(!1);return}let i=t.split(`/`)[1]?.toLowerCase(),a=await m(i);if(r!==`theme/install`){l(!1);return}if(a){y(!1),l(!1),n(a);return}y(!0),l(!1)})()},[m,r,h,g,_,T,t]),r===`design/edit`)return(0,Z.jsx)(un,{});if(r===`design/change-theme`)return o||i?null:(0,Z.jsx)(Jt,{});if(r===`theme/install`){if(!b||!h||c||v===null||!v)return null;let e=window.location.href.split(`#`)[1]?.split(`?`)[1],t=null,n=null;if(e){let r=new URLSearchParams(e);t=r.get(`ref`),n=r.get(`source`)}return(0,Z.jsx)(Jt,{source:n,themeRef:t})}else if(r.startsWith(`theme/edit/`))return C||!S||f||u?null:(0,Z.jsx)(dr,{themeName:S});else return null};export{fr as default};
|