ghost 6.17.2 → 6.18.1
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/{tryghost-i18n-6.17.2.tgz → tryghost-i18n-6.18.1.tgz} +0 -0
- package/components/{tryghost-parse-email-address-6.17.2.tgz → tryghost-parse-email-address-6.18.1.tgz} +0 -0
- package/core/built/admin/assets/{PolarAngleAxis-B8JrAxf_.js → PolarAngleAxis-Dod0DwfL.js} +1 -1
- package/core/built/admin/assets/{_baseAssignValue-Bbalamaq.js → _baseAssignValue-DnkbkowM.js} +1 -1
- package/core/built/admin/assets/{a-large-small-CgWPeKpi.js → a-large-small-C5mgFBRg.js} +1 -1
- package/core/built/admin/assets/activitypub/activitypub.js +1 -1
- package/core/built/admin/assets/activitypub/{at-sign-Fsk3x72r.mjs → at-sign-BR2C2gdz.mjs} +2 -2
- package/core/built/admin/assets/activitypub/{avatar-flipboard-C10JfFS_.mjs → avatar-flipboard-CJV3KhLU.mjs} +2 -2
- package/core/built/admin/assets/activitypub/{bluesky-sharing-C1xeGSL6.mjs → bluesky-sharing-DY4KCGPZ.mjs} +4 -4
- package/core/built/admin/assets/activitypub/{copy-C1fElSkQ.mjs → copy-CBFwbAdE.mjs} +2 -2
- package/core/built/admin/assets/activitypub/{deleted-feed-item-Bun4tY2_.mjs → deleted-feed-item-DOm9GxTQ.mjs} +2 -2
- package/core/built/admin/assets/activitypub/{edit-profile-CYh00FZ7.mjs → edit-profile-CcbnZWkM.mjs} +3 -3
- package/core/built/admin/assets/activitypub/{feed-BxUqmcN9.mjs → feed-BHiZU0Q_.mjs} +4 -4
- package/core/built/admin/assets/activitypub/{hash-CNgwAx-U.mjs → hash-Csjloy5t.mjs} +2 -2
- package/core/built/admin/assets/activitypub/{inbox-DqNqII4a.mjs → inbox-DGKbBux9.mjs} +2 -2
- package/core/built/admin/assets/activitypub/{index-CONoLlDU.mjs → index-Bt_qFJNY.mjs} +2 -2
- package/core/built/admin/assets/activitypub/{index--Q6orQkb.mjs → index-CCYuVHjm.mjs} +21 -21
- package/core/built/admin/assets/activitypub/{index-jhjmoHwu.mjs → index-CTV39jCH.mjs} +2 -2
- package/core/built/admin/assets/activitypub/{index-Dvh9q3jy.mjs → index-ClNx7qzi.mjs} +4 -4
- package/core/built/admin/assets/activitypub/{index-C9pnotJK.mjs → index-D6Y6ywyl.mjs} +6 -6
- package/core/built/admin/assets/activitypub/{index-BueIufRq.mjs → index-YLvIz6pJ.mjs} +5 -5
- package/core/built/admin/assets/activitypub/{index-C3KJXzZE.mjs → index-tWANcGjH.mjs} +7 -7
- package/core/built/admin/assets/activitypub/{index-CJJXnqq1.mjs → index-vVqFEPIX.mjs} +3 -3
- package/core/built/admin/assets/activitypub/{moderation-CYhwUFi2.mjs → moderation-CUGqRfT1.mjs} +3 -3
- package/core/built/admin/assets/activitypub/{note-COVa8CMw.mjs → note-DMy39JHG.mjs} +4 -4
- package/core/built/admin/assets/activitypub/{reply-BHpKVBxx.mjs → reply-BboFcDsv.mjs} +2 -2
- package/core/built/admin/assets/activitypub/{separator-DP7q5sFH.mjs → separator-DBvIXQnV.mjs} +2 -2
- package/core/built/admin/assets/activitypub/{settings-3n7zo_3K.mjs → settings-D4qRhs9E.mjs} +3 -3
- package/core/built/admin/assets/activitypub/{step-1-BmUukywZ.mjs → step-1-C-ubwwIT.mjs} +3 -3
- package/core/built/admin/assets/activitypub/{step-2-C--I3xxp.mjs → step-2-Dsd2XY1_.mjs} +5 -5
- package/core/built/admin/assets/activitypub/{step-3-0Deh5N9c.mjs → step-3-BHz3ow0t.mjs} +7 -7
- package/core/built/admin/assets/activitypub/{tabs-D_vmoLBo.mjs → tabs-s_P4XeyF.mjs} +3 -3
- package/core/built/admin/assets/activitypub/{topic-filter-DJMrhH-c.mjs → topic-filter-CCf15CR-.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +1 -1
- package/core/built/admin/assets/admin-x-settings/{code-editor-view-BzvYs1fs.mjs → code-editor-view-BWi3-ftq.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-DdMo_pvD.mjs → index-B3PtvbUw.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-DYEF3NiM.mjs → index-Did70N9h.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-BXChUyr6.mjs → index-JaMlaX9G.mjs} +30 -19
- package/core/built/admin/assets/admin-x-settings/{modals-Ck3AHDx3.mjs → modals-Bwrf9ptQ.mjs} +8060 -8067
- package/core/built/admin/assets/{at-sign-BottTo2X.js → at-sign-Bz-SU-S_.js} +1 -1
- package/core/built/admin/assets/{audience-CcGOt5Fb.js → audience-DmVdEmIe.js} +1 -1
- package/core/built/admin/assets/{avatar-flipboard-MxW2k124.js → avatar-flipboard-C7sxDVEM.js} +1 -1
- package/core/built/admin/assets/{bluesky-sharing-BBmDBlxr.js → bluesky-sharing-DJniSF6N.js} +1 -1
- package/core/built/admin/assets/{chart-pimL5Chk.js → chart-mYz3IJwm.js} +1 -1
- package/core/built/admin/assets/{chunk.524.9a8f5123fd3ecf3e4451.js → chunk.524.9d300778a63b42b0de62.js} +7 -7
- package/core/built/admin/assets/{chunk.582.41886d06af2895d571bd.js → chunk.582.2e363cd976d9bba998b9.js} +10 -10
- package/core/built/admin/assets/{code-editor-view-tCZOpc_h.js → code-editor-view-BIQWFJ01.js} +1 -1
- package/core/built/admin/assets/comments-B_-hdjc6.js +1 -0
- package/core/built/admin/assets/{copy-aC0WUVtq.js → copy-Bpq3uhnh.js} +1 -1
- package/core/built/admin/assets/{data-list-BOdyZGWI.js → data-list-BYNMbRIq.js} +1 -1
- package/core/built/admin/assets/{deleted-feed-item-BnUJ8bWP.js → deleted-feed-item-B_AwUKZy.js} +1 -1
- package/core/built/admin/assets/{edit-profile-CEgPhWMJ.js → edit-profile-DZo2ZcOu.js} +1 -1
- package/core/built/admin/assets/{empty-indicator-CR_9BHAH.js → empty-indicator-Bn5wG9-T.js} +1 -1
- package/core/built/admin/assets/{en-ajofhc7o.js → en-D4zIrMLN.js} +1 -1
- package/core/built/admin/assets/{feed-Ci-ODCHE.js → feed-Bgq4RarU.js} +1 -1
- package/core/built/admin/assets/{filters-CmJJOv3I.js → filters-CpVwu1Gk.js} +1 -1
- package/core/built/admin/assets/{gh-chart-hn7wEnik.js → gh-chart-Br7NXn_b.js} +1 -1
- package/core/built/admin/assets/{ghost-78b420974adc056bf1c9570275a46535.css → ghost-3c48d37b32f4fcd7eb15cfd739905a03.css} +1 -1
- package/core/built/admin/assets/{ghost-a9268074d0a9b02198594a05ecd7a626.js → ghost-98a3c5fd6235ebd344594f491cb6d17b.js} +241 -246
- package/core/built/admin/assets/{ghost-dark-12abca67e79c76fe6bfed6cb81ba2a53.css → ghost-dark-0100fe3ec7b4c3f6d8d043c904254a63.css} +1 -1
- package/core/built/admin/assets/{growth-CQceZQ1g.js → growth-CiPDnWxJ.js} +1 -1
- package/core/built/admin/assets/{hash-BcaWmkw5.js → hash-Bc1e38oH.js} +1 -1
- package/core/built/admin/assets/{inbox-D9hID-rO.js → inbox-BcZNBNhk.js} +1 -1
- package/core/built/admin/assets/{index-d_UH71zm.js → index-BFEx_ouC.js} +1 -1
- package/core/built/admin/assets/{index-kXF42nga.js → index-B_7QsC5T.js} +1 -1
- package/core/built/admin/assets/{index-CZ3lARQ2.js → index-Bm5ZeLtt.js} +1 -1
- package/core/built/admin/assets/{index-DJDgMk-T.js → index-BpcL7RmI.js} +2 -2
- package/core/built/admin/assets/{index-g4BWcHhl.js → index-Brg4tecQ.js} +1 -1
- package/core/built/admin/assets/{index-f5Lv9kLb.js → index-CMTzNTew.js} +29 -29
- package/core/built/admin/assets/{index-Cl2eSBwg.js → index-CTfJflJ2.js} +1 -1
- package/core/built/admin/assets/{index-BJS8H75W.js → index-Cn32t_gv.js} +1 -1
- package/core/built/admin/assets/{index-D8syEvSm.js → index-CsidX7Si.js} +1 -1
- package/core/built/admin/assets/{index-DO76vL0R.js → index-D212VvOz.js} +1 -1
- package/core/built/admin/assets/{index-B1rKIiOr.js → index-D67LJ_H4.js} +1 -1
- package/core/built/admin/assets/{index-BmK6ThYl.js → index-DU3bv9jz.js} +1 -1
- package/core/built/admin/assets/{index-DYM1MbXR.js → index-Dv13wKfX.js} +1 -1
- package/core/built/admin/assets/{index-Do091GLu.js → index-ETsoQLbU.js} +1 -1
- package/core/built/admin/assets/{index-rluYcfd-.js → index-ZYDRMgcT.js} +1 -1
- package/core/built/admin/assets/{koenig-lexical-D2XHvS2J.js → koenig-lexical-DZUWzN0P.js} +1 -1
- package/core/built/admin/assets/{kpi-card-Dga9rFZ5.js → kpi-card-DENsK2xK.js} +1 -1
- package/core/built/admin/assets/{kpis-BbnqD1za.js → kpis-CDrs2iS1.js} +1 -1
- package/core/built/admin/assets/{label-D8WHEOe0.js → label-BznQtEEo.js} +1 -1
- package/core/built/admin/assets/{links-dgwx7ko1.js → links-lpAC3T1p.js} +1 -1
- package/core/built/admin/assets/{lucide-react-BARFK2PZ.js → lucide-react-CBigk-fq.js} +1 -1
- package/core/built/admin/assets/{main-layout-CcjtCuF_.js → main-layout-_SYQRjIl.js} +1 -1
- package/core/built/admin/assets/{message-square-text-BxquqPhA.js → message-square-text-cV8O_qKq.js} +1 -1
- package/core/built/admin/assets/{minus-Ziy4LSYD.js → minus-NvnQTlW7.js} +1 -1
- package/core/built/admin/assets/{modals-fMQzR7L6.js → modals-XRSkribf.js} +3 -3
- package/core/built/admin/assets/{moderation-Ci9UNwiZ.js → moderation-BQp1GEWG.js} +1 -1
- package/core/built/admin/assets/{newsletter-DnrS7Fvi.js → newsletter-foM6KNNV.js} +1 -1
- package/core/built/admin/assets/{newsletters-D78pgnas.js → newsletters-BexdXUhn.js} +1 -1
- package/core/built/admin/assets/{note-BAfNweZN.js → note-DuaUGOeZ.js} +1 -1
- package/core/built/admin/assets/{overview-CWQPNOF0.js → overview-DgKBNqyc.js} +1 -1
- package/core/built/admin/assets/{pagemenu-DjSqq3Wu.js → pagemenu-CZyroidv.js} +1 -1
- package/core/built/admin/assets/{post-analytics-c8kRV0YB.js → post-analytics-DLK2SOSQ.js} +1 -1
- package/core/built/admin/assets/{post-analytics-context-CEqWyqgm.js → post-analytics-context-CF7C67-0.js} +1 -1
- package/core/built/admin/assets/{post-analytics-header-CpPPBAz4.js → post-analytics-header-7GtJCx0W.js} +1 -1
- package/core/built/admin/assets/{post-share-modal-Dln0kZhn.js → post-share-modal-D8R7DUZP.js} +1 -1
- package/core/built/admin/assets/posts/{comments-CHEqbZPq.mjs → comments-Bn_vn_sb.mjs} +434 -407
- package/core/built/admin/assets/posts/{dialog-VFomJYla.mjs → dialog-CKPcMrj7.mjs} +3 -3
- package/core/built/admin/assets/posts/{empty-indicator-CT9qQsMO.mjs → empty-indicator-kkrhP6K_.mjs} +2 -2
- package/core/built/admin/assets/posts/{filters-BXCfSKKS.mjs → filters-DHsxxy0F.mjs} +6 -6
- package/core/built/admin/assets/posts/{growth-xMitvyvt.mjs → growth-D7ACh-oR.mjs} +12 -12
- package/core/built/admin/assets/posts/{heading-DIulQwgD.mjs → heading-BrKVbOxA.mjs} +2 -2
- package/core/built/admin/assets/posts/{hooks-BiBMDYOA.mjs → hooks-BBEMuLiW.mjs} +3 -3
- package/core/built/admin/assets/posts/{index-uYyMBANY.mjs → index-C0rRguZx.mjs} +9 -9
- package/core/built/admin/assets/posts/{kpis-DK6j0CJA.mjs → kpis-1o524OIK.mjs} +10 -10
- package/core/built/admin/assets/posts/{links-CBiYZsyk.mjs → links-JpeATx1f.mjs} +4 -4
- package/core/built/admin/assets/posts/{loading-indicator-BPPeKpVb.mjs → loading-indicator-BHAmSf8j.mjs} +3 -3
- package/core/built/admin/assets/posts/{main-layout-f-PcNn-6.mjs → main-layout-BTItAOQE.mjs} +2 -2
- package/core/built/admin/assets/posts/{newsletter-CSOyAfvO.mjs → newsletter-CQdsCEHv.mjs} +13 -13
- package/core/built/admin/assets/posts/{overview-Dve3Uxt4.mjs → overview-sYh4JN1D.mjs} +15 -15
- package/core/built/admin/assets/posts/{post-analytics-CPKxH7yg.mjs → post-analytics-DtLt2SWx.mjs} +6 -6
- package/core/built/admin/assets/posts/{post-analytics-context-B5zQoflZ.mjs → post-analytics-context-CB1yM9fk.mjs} +4 -4
- package/core/built/admin/assets/posts/{post-analytics-header-BBxuaptK.mjs → post-analytics-header-BYaWuL9W.mjs} +9 -9
- package/core/built/admin/assets/posts/{post-share-modal-D_iMXvnI.mjs → post-share-modal-V0HTOBaf.mjs} +4 -4
- package/core/built/admin/assets/posts/{posts-DW6ne0od.mjs → posts-DeQT3knv.mjs} +2 -2
- package/core/built/admin/assets/posts/posts.js +1 -1
- package/core/built/admin/assets/posts/{search-CVlPqGMA.mjs → search-CLjC37AT.mjs} +2 -2
- package/core/built/admin/assets/posts/{separator-YrJkDGVP.mjs → separator-KNoTIaJx.mjs} +5 -5
- package/core/built/admin/assets/posts/{sheet-T5GWxxrn.mjs → sheet-DBg_SCDt.mjs} +3 -3
- package/core/built/admin/assets/posts/{skeleton-qnvlkDy-.mjs → skeleton-DvsoolWu.mjs} +3 -3
- package/core/built/admin/assets/posts/{source-icon-DBU0eZwS.mjs → source-icon-OmRaTU2G.mjs} +3 -3
- package/core/built/admin/assets/posts/{stats-udwJVZP8.mjs → stats-BC2DzntY.mjs} +4 -4
- package/core/built/admin/assets/posts/{table-Cu0BZfBU.mjs → table-CxX9OKAj.mjs} +2 -2
- package/core/built/admin/assets/posts/{tabs-B-RaoD3I.mjs → tabs-B1jw7cBi.mjs} +10 -10
- package/core/built/admin/assets/posts/{tags-DSDGzArh.mjs → tags-BBilTo1a.mjs} +11 -11
- package/core/built/admin/assets/posts/{tags-DByfrDKO.mjs → tags-BitrLT_j.mjs} +2 -2
- package/core/built/admin/assets/posts/{use-infinite-virtual-scroll-B7dD2nWW.mjs → use-infinite-virtual-scroll-DaijA1ao.mjs} +3 -3
- package/core/built/admin/assets/posts/{web-B9wvEtJ_.mjs → web-CKmyC4Xj.mjs} +15 -15
- package/core/built/admin/assets/{posts-C1Eh5Ypq.js → posts-CL9UDYoW.js} +1 -1
- package/core/built/admin/assets/{repeat-CN4fiG5H.js → repeat-DgH39UKE.js} +1 -1
- package/core/built/admin/assets/{reply-BfWgvH7y.js → reply-DAaNxiy8.js} +1 -1
- package/core/built/admin/assets/{select-B_0NBkLz.js → select-Cor2wFXT.js} +1 -1
- package/core/built/admin/assets/{settings-BqaVcJee.js → settings-BeumESEN.js} +5 -5
- package/core/built/admin/assets/{settings-Dk9E7Fqv.js → settings-xRx917Gj.js} +1 -1
- package/core/built/admin/assets/{sort-button-C2M35dLh.js → sort-button-BNW3i4Lb.js} +1 -1
- package/core/built/admin/assets/{source-icon-DkGi13e_.js → source-icon-DvDuzw73.js} +1 -1
- package/core/built/admin/assets/{sprout-BKiwQsGn.js → sprout-C3cc0c-K.js} +1 -1
- package/core/built/admin/assets/{square-BEpRc_fY.js → square-tZp0_n7e.js} +1 -1
- package/core/built/admin/assets/stats/{audience-Dfo7BmNu.mjs → audience-BWqU7WWT.mjs} +3 -3
- package/core/built/admin/assets/stats/{index-DUWoiDE_.mjs → index-CUuQaROI.mjs} +5 -5
- package/core/built/admin/assets/stats/{index-Yo58temM.mjs → index-CcCyLMxL.mjs} +7 -7
- package/core/built/admin/assets/stats/{index-h0rsyxDz.mjs → index-D5mlMG4l.mjs} +8 -8
- package/core/built/admin/assets/stats/{index-_vL3Zubi.mjs → index-DXU2rE9t.mjs} +5 -5
- package/core/built/admin/assets/stats/{index-Banm1wtA.mjs → index-K7ASx7EG.mjs} +6 -6
- package/core/built/admin/assets/stats/{sort-button-i6PS-TUn.mjs → sort-button-CELUx6Zp.mjs} +3 -3
- package/core/built/admin/assets/stats/{stats-CjepXEWS.mjs → stats-d_u_in4l.mjs} +2 -2
- package/core/built/admin/assets/stats/stats.js +2 -2
- package/core/built/admin/assets/stats/{tabs-Q20S1oup.mjs → tabs-3wLZsy0v.mjs} +3 -3
- package/core/built/admin/assets/stats/{url-helpers-DrGoeEH1.mjs → url-helpers-Drq3xg0l.mjs} +4 -4
- package/core/built/admin/assets/stats/{use-growth-stats-BnffY2W3.mjs → use-growth-stats-28Sr42va.mjs} +3 -3
- package/core/built/admin/assets/{stats-CRgy_cWm.js → stats-2Jelnn-Q.js} +1 -1
- package/core/built/admin/assets/{stats-view-CTQ4qO3S.js → stats-view-CESy8ELH.js} +1 -1
- package/core/built/admin/assets/{step-1-CNbdmB8C.js → step-1-DrqdolAh.js} +1 -1
- package/core/built/admin/assets/{step-2-Ddrl2uae.js → step-2-DmEpKck5.js} +1 -1
- package/core/built/admin/assets/{step-3-CbqkEtwh.js → step-3-Bus-0o0n.js} +1 -1
- package/core/built/admin/assets/{table-Dw9xFlFd.js → table-BQUcKHfm.js} +1 -1
- package/core/built/admin/assets/{tabs-DCHagOip.js → tabs-BmdL0X4U.js} +1 -1
- package/core/built/admin/assets/{tags-DV2SSdMK.js → tags-CLxXZlOO.js} +1 -1
- package/core/built/admin/assets/{tags-BsDlfsPN.js → tags-EchqlZUJ.js} +1 -1
- package/core/built/admin/assets/{tiers-tc5tafWV.js → tiers-nCGyTly9.js} +1 -1
- package/core/built/admin/assets/{toggle-group-DS-ZVhCr.js → toggle-group-CM5uf7J1.js} +1 -1
- package/core/built/admin/assets/{topic-filter-BfoEqHRD.js → topic-filter-LTRvZ8aU.js} +1 -1
- package/core/built/admin/assets/{trash-CpnxYen-.js → trash-u5BxolyH.js} +1 -1
- package/core/built/admin/assets/{url-helpers-wKPPeCtD.js → url-helpers-D41fEt51.js} +1 -1
- package/core/built/admin/assets/{use-growth-stats-CbHIETF_.js → use-growth-stats-BJ0O9ewi.js} +1 -1
- package/core/built/admin/assets/{use-infinite-virtual-scroll-DU1EUhyj.js → use-infinite-virtual-scroll-APZWciOk.js} +1 -1
- package/core/built/admin/assets/{use-simple-pagination-X6kmRz2u.js → use-simple-pagination-DVRHeaAR.js} +1 -1
- package/core/built/admin/assets/{user-round-check-DYkrjHxF.js → user-round-check-B6j98D6d.js} +1 -1
- package/core/built/admin/assets/{wallet-cards-CSdWOmJE.js → wallet-cards-KmOh29LP.js} +1 -1
- package/core/built/admin/assets/{web-C39IKnvl.js → web-Cclotbnz.js} +1 -1
- package/core/built/admin/index.html +5 -5
- package/core/frontend/meta/asset-url.js +126 -15
- package/core/frontend/services/asset-hash/index.js +73 -0
- package/core/frontend/services/theme-engine/active.js +4 -2
- package/core/server/api/endpoints/utils/serializers/output/utils/post-gating.js +6 -0
- package/core/server/data/migrations/versions/6.17/2026-02-04-10-42-20-offers-nullable-product-id.js +11 -0
- package/core/server/data/migrations/versions/6.18/2026-02-04-10-42-20-offers-nullable-product-id.js +4 -0
- package/core/server/data/schema/schema.js +1 -1
- package/core/server/data/tinybird/datasources/_mv_daily_pages.datasource +13 -0
- package/core/server/data/tinybird/endpoints/api_top_pages_v3.pipe +113 -0
- package/core/server/data/tinybird/pipes/mv_daily_pages.pipe +23 -0
- package/core/server/data/tinybird/scripts/benchmark-top-pages.sh +186 -0
- package/core/server/data/tinybird/scripts/compare-top-pages.sh +262 -0
- package/core/server/data/tinybird/tests/api_top_pages_v3.yaml +112 -0
- package/core/server/models/automated-email.js +34 -0
- package/core/server/services/koenig/node-renderers/transistor-renderer.js +3 -8
- package/core/server/services/lib/member-signup-contexts.js +23 -0
- package/core/server/services/lib/member-signup-contexts.ts +22 -0
- package/core/server/services/member-welcome-emails/member-welcome-email-renderer.js +13 -7
- package/core/server/services/member-welcome-emails/service.js +84 -15
- package/core/server/services/members/members-api/controllers/router-controller.js +14 -0
- package/core/server/services/members/members-api/repositories/member-repository.js +1 -1
- package/core/server/services/members/members-api/services/payments-service.js +5 -0
- package/core/server/services/oembed/oembed-service.js +1 -1
- package/core/server/services/offers/application/offer-mapper.js +6 -7
- package/core/server/services/offers/application/offers-api.js +3 -3
- package/core/server/services/offers/domain/errors/index.js +2 -0
- package/core/server/services/offers/domain/models/offer.js +15 -3
- package/core/server/services/offers/offer-bookshelf-repository.js +4 -5
- package/core/server/services/stats/utils/tinybird.js +5 -3
- package/core/server/services/stripe/services/webhook/checkout-session-event-service.js +17 -1
- package/core/server/services/stripe/stripe-service.js +8 -0
- package/core/shared/config/defaults.json +6 -0
- package/core/shared/labs.js +3 -3
- package/core/shared/url-utils.js +2 -1
- package/package.json +6 -6
- package/tsconfig.tsbuildinfo +1 -1
- package/yarn.lock +23 -2
- package/core/built/admin/assets/comments-OXqhcC0t.js +0 -1
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{e as I,aH as ye,r as P,aP as De,j as e,B as Ce,bV as Te,bW as je,bG as Ke,aj as T,cA as J,aQ as rt,cB as $,bH as nt,ap as it,bI as ot,bJ as de,cU as z,aR as lt,af as se,aX as ct,ag as W,S as Ge,cz as dt,by as ut,bz as mt,bA as pt,bB as ht,bC as ft,bD as xt,ah as B,bR as Oe}from"./index-f5Lv9kLb.js";import{s as oe,g as U,d as bt,S as gt,a as vt,D as jt,b as yt}from"./stats-view-CTQ4qO3S.js";import{E as ce}from"./empty-indicator-CR_9BHAH.js";import{A as St,a as At}from"./wallet-cards-CSdWOmJE.js";import{G as wt,C as Nt,X as Dt,Y as Ct}from"./gh-chart-hn7wEnik.js";import{T as Ve,a as $e,K as ue,d as Y,e as Tt,b as me}from"./tabs-DCHagOip.js";import{g as _t}from"./audience-CcGOt5Fb.js";import{S as te,B as kt}from"./sort-button-C2M35dLh.js";import{S as Pt,C as Q,g as Ot,c as Mt,b as Rt}from"./url-helpers-wKPPeCtD.js";import{e as le,c as K,f as F,g as Et,a as Ye,b as ze,d as H}from"./table-Dw9xFlFd.js";import{g as Se}from"./currency-fEUUCkj0.js";import{g as Bt}from"./source-utils-B1S3ZHA2.js";import{a as It,b as Ft,u as Lt,k as Kt}from"./stats-CRgy_cWm.js";import{u as Gt,a as Vt}from"./tiers-tc5tafWV.js";import{C as be,a as _e,b as ke,f as Pe,c as ge,j as $t}from"./pagemenu-DjSqq3Wu.js";import{h as ne,F as Yt,T as zt,b as he,r as Ae,H as ae,L as ie,o as X,c as Ht,S as Ut,A as Wt,I as qt,i as Me,d as Qt,J as Z,u as He,e as Xt,K as Jt,G as Zt,m as fe,l as ea,n as ta,M as aa,N as pe,O as Re,g as sa,s as ra,C as Ue,a as We,v as na,B as Ee}from"./chart-pimL5Chk.js";import{S as qe,a as Qe,b as Xe,c as Je,f as we}from"./select-B_0NBkLz.js";import{P as ia,a as oa}from"./PolarAngleAxis-B8JrAxf_.js";import{n as la,o as ca,l as da}from"./lucide-react-BARFK2PZ.js";import{u as ua}from"./use-growth-stats-CbHIETF_.js";import"./message-square-text-BxquqPhA.js";import"./sprout-BKiwQsGn.js";import"./index-DO76vL0R.js";import"./_baseAssignValue-Bbalamaq.js";import"./a-large-small-CgWPeKpi.js";import"./at-sign-BottTo2X.js";import"./copy-aC0WUVtq.js";import"./hash-BcaWmkw5.js";import"./inbox-D9hID-rO.js";import"./minus-Ziy4LSYD.js";import"./tags-DV2SSdMK.js";import"./square-BEpRc_fY.js";import"./user-round-check-DYkrjHxF.js";import"./repeat-CN4fiG5H.js";import"./reply-BfWgvH7y.js";import"./trash-CpnxYen-.js";var xe;function re(s){"@babel/helpers - typeof";return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},re(s)}function ee(){return ee=Object.assign?Object.assign.bind():function(s){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(s[t]=n[t])}return s},ee.apply(this,arguments)}function Be(s,a){var n=Object.keys(s);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(s);a&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(s,r).enumerable})),n.push.apply(n,t)}return n}function R(s){for(var a=1;a<arguments.length;a++){var n=arguments[a]!=null?arguments[a]:{};a%2?Be(Object(n),!0).forEach(function(t){L(s,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach(function(t){Object.defineProperty(s,t,Object.getOwnPropertyDescriptor(n,t))})}return s}function ma(s,a){if(!(s instanceof a))throw new TypeError("Cannot call a class as a function")}function Ie(s,a){for(var n=0;n<a.length;n++){var t=a[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(s,et(t.key),t)}}function pa(s,a,n){return a&&Ie(s.prototype,a),n&&Ie(s,n),Object.defineProperty(s,"prototype",{writable:!1}),s}function ha(s,a,n){return a=ve(a),fa(s,Ze()?Reflect.construct(a,n||[],ve(s).constructor):a.apply(s,n))}function fa(s,a){if(a&&(re(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xa(s)}function xa(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function Ze(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ze=function(){return!!s})()}function ve(s){return ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ve(s)}function ba(s,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(a&&a.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),a&&Ne(s,a)}function Ne(s,a){return Ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},Ne(s,a)}function L(s,a,n){return a=et(a),a in s?Object.defineProperty(s,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):s[a]=n,s}function et(s){var a=ga(s,"string");return re(a)=="symbol"?a:a+""}function ga(s,a){if(re(s)!="object"||!s)return s;var n=s[Symbol.toPrimitive];if(n!==void 0){var t=n.call(s,a);if(re(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}var G=(function(s){function a(n){var t;return ma(this,a),t=ha(this,a,[n]),L(t,"pieRef",null),L(t,"sectorRefs",[]),L(t,"id",Jt("recharts-pie-")),L(t,"handleAnimationEnd",function(){var r=t.props.onAnimationEnd;t.setState({isAnimationFinished:!0}),ne(r)&&r()}),L(t,"handleAnimationStart",function(){var r=t.props.onAnimationStart;t.setState({isAnimationFinished:!1}),ne(r)&&r()}),t.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},t}return ba(a,s),pa(a,[{key:"isActiveIndex",value:function(t){var r=this.props.activeIndex;return Array.isArray(r)?r.indexOf(t)!==-1:t===r}},{key:"hasActiveIndex",value:function(){var t=this.props.activeIndex;return Array.isArray(t)?t.length!==0:t||t===0}},{key:"renderLabels",value:function(t){var r=this.props.isAnimationActive;if(r&&!this.state.isAnimationFinished)return null;var l=this.props,i=l.label,f=l.labelLine,g=l.dataKey,c=l.valueKey,o=he(this.props,!1),j=he(i,!1),A=he(f,!1),x=i&&i.offsetRadius||20,w=t.map(function(m,b){var N=(m.startAngle+m.endAngle)/2,p=Ae(m.cx,m.cy,m.outerRadius+x,N),h=R(R(R(R({},o),m),{},{stroke:"none"},j),{},{index:b,textAnchor:a.getTextAnchor(p.x,m.cx)},p),u=R(R(R(R({},o),m),{},{fill:"none",stroke:m.fill},A),{},{index:b,points:[Ae(m.cx,m.cy,m.outerRadius,N),p]}),v=g;return ae(g)&&ae(c)?v="value":ae(g)&&(v=c),I.createElement(ie,{key:"label-".concat(m.startAngle,"-").concat(m.endAngle,"-").concat(m.midAngle,"-").concat(b)},f&&a.renderLabelLineItem(f,u,"line"),a.renderLabelItem(i,h,X(m,v)))});return I.createElement(ie,{className:"recharts-pie-labels"},w)}},{key:"renderSectorsStatically",value:function(t){var r=this,l=this.props,i=l.activeShape,f=l.blendStroke,g=l.inactiveShape;return t.map(function(c,o){if(c?.startAngle===0&&c?.endAngle===0&&t.length!==1)return null;var j=r.isActiveIndex(o),A=g&&r.hasActiveIndex()?g:null,x=j?i:A,w=R(R({},c),{},{stroke:f?c.fill:c.stroke,tabIndex:-1});return I.createElement(ie,ee({ref:function(b){b&&!r.sectorRefs.includes(b)&&r.sectorRefs.push(b)},tabIndex:-1,className:"recharts-pie-sector"},Ht(r.props,c,o),{key:"sector-".concat(c?.startAngle,"-").concat(c?.endAngle,"-").concat(c.midAngle,"-").concat(o)}),I.createElement(Ut,ee({option:x,isActive:j,shapeType:"sector"},w)))})}},{key:"renderSectorsWithAnimation",value:function(){var t=this,r=this.props,l=r.sectors,i=r.isAnimationActive,f=r.animationBegin,g=r.animationDuration,c=r.animationEasing,o=r.animationId,j=this.state,A=j.prevSectors,x=j.prevIsAnimationActive;return I.createElement(Wt,{begin:f,duration:g,isActive:i,easing:c,from:{t:0},to:{t:1},key:"pie-".concat(o,"-").concat(x),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(w){var m=w.t,b=[],N=l&&l[0],p=N.startAngle;return l.forEach(function(h,u){var v=A&&A[u],C=u>0?qt(h,"paddingAngle",0):0;if(v){var S=Me(v.endAngle-v.startAngle,h.endAngle-h.startAngle),d=R(R({},h),{},{startAngle:p+C,endAngle:p+S(m)+C});b.push(d),p=d.endAngle}else{var k=h.endAngle,y=h.startAngle,D=Me(0,k-y),O=D(m),M=R(R({},h),{},{startAngle:p+C,endAngle:p+O+C});b.push(M),p=M.endAngle}}),I.createElement(ie,null,t.renderSectorsStatically(b))})}},{key:"attachKeyboardHandlers",value:function(t){var r=this;t.onkeydown=function(l){if(!l.altKey)switch(l.key){case"ArrowLeft":{var i=++r.state.sectorToFocus%r.sectorRefs.length;r.sectorRefs[i].focus(),r.setState({sectorToFocus:i});break}case"ArrowRight":{var f=--r.state.sectorToFocus<0?r.sectorRefs.length-1:r.state.sectorToFocus%r.sectorRefs.length;r.sectorRefs[f].focus(),r.setState({sectorToFocus:f});break}case"Escape":{r.sectorRefs[r.state.sectorToFocus].blur(),r.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var t=this.props,r=t.sectors,l=t.isAnimationActive,i=this.state.prevSectors;return l&&r&&r.length&&(!i||!Qt(i,r))?this.renderSectorsWithAnimation():this.renderSectorsStatically(r)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var t=this,r=this.props,l=r.hide,i=r.sectors,f=r.className,g=r.label,c=r.cx,o=r.cy,j=r.innerRadius,A=r.outerRadius,x=r.isAnimationActive,w=this.state.isAnimationFinished;if(l||!i||!i.length||!Z(c)||!Z(o)||!Z(j)||!Z(A))return null;var m=ye("recharts-pie",f);return I.createElement(ie,{tabIndex:this.props.rootTabIndex,className:m,ref:function(N){t.pieRef=N}},this.renderSectors(),g&&this.renderLabels(i),He.renderCallByParent(this.props,null,!1),(!x||w)&&Xt.renderCallByParent(this.props,i,!1))}}],[{key:"getDerivedStateFromProps",value:function(t,r){return r.prevIsAnimationActive!==t.isAnimationActive?{prevIsAnimationActive:t.isAnimationActive,prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:[],isAnimationFinished:!0}:t.isAnimationActive&&t.animationId!==r.prevAnimationId?{prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:r.curSectors,isAnimationFinished:!0}:t.sectors!==r.curSectors?{curSectors:t.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(t,r){return t>r?"start":t<r?"end":"middle"}},{key:"renderLabelLineItem",value:function(t,r,l){if(I.isValidElement(t))return I.cloneElement(t,r);if(ne(t))return t(r);var i=ye("recharts-pie-label-line",typeof t!="boolean"?t.className:"");return I.createElement(Yt,ee({},r,{key:l,type:"linear",className:i}))}},{key:"renderLabelItem",value:function(t,r,l){if(I.isValidElement(t))return I.cloneElement(t,r);var i=l;if(ne(t)&&(i=t(r),I.isValidElement(i)))return i;var f=ye("recharts-pie-label-text",typeof t!="boolean"&&!ne(t)?t.className:"");return I.createElement(zt,ee({},r,{alignmentBaseline:"middle",className:f}),i)}}])})(P.PureComponent);xe=G;L(G,"displayName","Pie");L(G,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!Zt.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});L(G,"parseDeltaAngle",function(s,a){var n=fe(a-s),t=Math.min(Math.abs(a-s),360);return n*t});L(G,"getRealPieData",function(s){var a=s.data,n=s.children,t=he(s,!1),r=ea(n,ta);return a&&a.length?a.map(function(l,i){return R(R(R({payload:l},t),l),r&&r[i]&&r[i].props)}):r&&r.length?r.map(function(l){return R(R({},t),l.props)}):[]});L(G,"parseCoordinateOfPie",function(s,a){var n=a.top,t=a.left,r=a.width,l=a.height,i=aa(r,l),f=t+pe(s.cx,r,r/2),g=n+pe(s.cy,l,l/2),c=pe(s.innerRadius,i,0),o=pe(s.outerRadius,i,i*.8),j=s.maxRadius||Math.sqrt(r*r+l*l)/2;return{cx:f,cy:g,innerRadius:c,outerRadius:o,maxRadius:j}});L(G,"getComposedData",function(s){var a=s.item,n=s.offset,t=a.type.defaultProps!==void 0?R(R({},a.type.defaultProps),a.props):a.props,r=xe.getRealPieData(t);if(!r||!r.length)return null;var l=t.cornerRadius,i=t.startAngle,f=t.endAngle,g=t.paddingAngle,c=t.dataKey,o=t.nameKey,j=t.valueKey,A=t.tooltipType,x=Math.abs(t.minAngle),w=xe.parseCoordinateOfPie(t,n),m=xe.parseDeltaAngle(i,f),b=Math.abs(m),N=c;ae(c)&&ae(j)?(Re(!1,`Use "dataKey" to specify the value of pie,
|
|
1
|
+
import{e as I,aH as ye,r as P,aP as De,j as e,B as Ce,bV as Te,bW as je,bG as Ke,aj as T,cA as J,aQ as rt,cB as $,bH as nt,ap as it,bI as ot,bJ as de,cU as z,aR as lt,af as se,aX as ct,ag as W,S as Ge,cz as dt,by as ut,bz as mt,bA as pt,bB as ht,bC as ft,bD as xt,ah as B,bR as Oe}from"./index-CMTzNTew.js";import{s as oe,g as U,d as bt,S as gt,a as vt,D as jt,b as yt}from"./stats-view-CESy8ELH.js";import{E as ce}from"./empty-indicator-Bn5wG9-T.js";import{A as St,a as At}from"./wallet-cards-KmOh29LP.js";import{G as wt,C as Nt,X as Dt,Y as Ct}from"./gh-chart-Br7NXn_b.js";import{T as Ve,a as $e,K as ue,d as Y,e as Tt,b as me}from"./tabs-BmdL0X4U.js";import{g as _t}from"./audience-DmVdEmIe.js";import{S as te,B as kt}from"./sort-button-BNW3i4Lb.js";import{S as Pt,C as Q,g as Ot,c as Mt,b as Rt}from"./url-helpers-D41fEt51.js";import{e as le,c as K,f as F,g as Et,a as Ye,b as ze,d as H}from"./table-BQUcKHfm.js";import{g as Se}from"./currency-fEUUCkj0.js";import{g as Bt}from"./source-utils-B1S3ZHA2.js";import{a as It,b as Ft,u as Lt,k as Kt}from"./stats-2Jelnn-Q.js";import{u as Gt,a as Vt}from"./tiers-nCGyTly9.js";import{C as be,a as _e,b as ke,f as Pe,c as ge,j as $t}from"./pagemenu-CZyroidv.js";import{h as ne,F as Yt,T as zt,b as he,r as Ae,H as ae,L as ie,o as X,c as Ht,S as Ut,A as Wt,I as qt,i as Me,d as Qt,J as Z,u as He,e as Xt,K as Jt,G as Zt,m as fe,l as ea,n as ta,M as aa,N as pe,O as Re,g as sa,s as ra,C as Ue,a as We,v as na,B as Ee}from"./chart-mYz3IJwm.js";import{S as qe,a as Qe,b as Xe,c as Je,f as we}from"./select-Cor2wFXT.js";import{P as ia,a as oa}from"./PolarAngleAxis-Dod0DwfL.js";import{n as la,o as ca,l as da}from"./lucide-react-CBigk-fq.js";import{u as ua}from"./use-growth-stats-BJ0O9ewi.js";import"./message-square-text-cV8O_qKq.js";import"./sprout-C3cc0c-K.js";import"./index-D212VvOz.js";import"./_baseAssignValue-DnkbkowM.js";import"./a-large-small-C5mgFBRg.js";import"./at-sign-Bz-SU-S_.js";import"./copy-Bpq3uhnh.js";import"./hash-Bc1e38oH.js";import"./inbox-BcZNBNhk.js";import"./minus-NvnQTlW7.js";import"./tags-CLxXZlOO.js";import"./square-tZp0_n7e.js";import"./user-round-check-B6j98D6d.js";import"./repeat-DgH39UKE.js";import"./reply-DAaNxiy8.js";import"./trash-u5BxolyH.js";var xe;function re(s){"@babel/helpers - typeof";return re=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(a){return typeof a}:function(a){return a&&typeof Symbol=="function"&&a.constructor===Symbol&&a!==Symbol.prototype?"symbol":typeof a},re(s)}function ee(){return ee=Object.assign?Object.assign.bind():function(s){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(s[t]=n[t])}return s},ee.apply(this,arguments)}function Be(s,a){var n=Object.keys(s);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(s);a&&(t=t.filter(function(r){return Object.getOwnPropertyDescriptor(s,r).enumerable})),n.push.apply(n,t)}return n}function R(s){for(var a=1;a<arguments.length;a++){var n=arguments[a]!=null?arguments[a]:{};a%2?Be(Object(n),!0).forEach(function(t){L(s,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(s,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach(function(t){Object.defineProperty(s,t,Object.getOwnPropertyDescriptor(n,t))})}return s}function ma(s,a){if(!(s instanceof a))throw new TypeError("Cannot call a class as a function")}function Ie(s,a){for(var n=0;n<a.length;n++){var t=a[n];t.enumerable=t.enumerable||!1,t.configurable=!0,"value"in t&&(t.writable=!0),Object.defineProperty(s,et(t.key),t)}}function pa(s,a,n){return a&&Ie(s.prototype,a),n&&Ie(s,n),Object.defineProperty(s,"prototype",{writable:!1}),s}function ha(s,a,n){return a=ve(a),fa(s,Ze()?Reflect.construct(a,n||[],ve(s).constructor):a.apply(s,n))}function fa(s,a){if(a&&(re(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xa(s)}function xa(s){if(s===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return s}function Ze(){try{var s=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ze=function(){return!!s})()}function ve(s){return ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ve(s)}function ba(s,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");s.prototype=Object.create(a&&a.prototype,{constructor:{value:s,writable:!0,configurable:!0}}),Object.defineProperty(s,"prototype",{writable:!1}),a&&Ne(s,a)}function Ne(s,a){return Ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,r){return t.__proto__=r,t},Ne(s,a)}function L(s,a,n){return a=et(a),a in s?Object.defineProperty(s,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):s[a]=n,s}function et(s){var a=ga(s,"string");return re(a)=="symbol"?a:a+""}function ga(s,a){if(re(s)!="object"||!s)return s;var n=s[Symbol.toPrimitive];if(n!==void 0){var t=n.call(s,a);if(re(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(s)}var G=(function(s){function a(n){var t;return ma(this,a),t=ha(this,a,[n]),L(t,"pieRef",null),L(t,"sectorRefs",[]),L(t,"id",Jt("recharts-pie-")),L(t,"handleAnimationEnd",function(){var r=t.props.onAnimationEnd;t.setState({isAnimationFinished:!0}),ne(r)&&r()}),L(t,"handleAnimationStart",function(){var r=t.props.onAnimationStart;t.setState({isAnimationFinished:!1}),ne(r)&&r()}),t.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},t}return ba(a,s),pa(a,[{key:"isActiveIndex",value:function(t){var r=this.props.activeIndex;return Array.isArray(r)?r.indexOf(t)!==-1:t===r}},{key:"hasActiveIndex",value:function(){var t=this.props.activeIndex;return Array.isArray(t)?t.length!==0:t||t===0}},{key:"renderLabels",value:function(t){var r=this.props.isAnimationActive;if(r&&!this.state.isAnimationFinished)return null;var l=this.props,i=l.label,f=l.labelLine,g=l.dataKey,c=l.valueKey,o=he(this.props,!1),j=he(i,!1),A=he(f,!1),x=i&&i.offsetRadius||20,w=t.map(function(m,b){var N=(m.startAngle+m.endAngle)/2,p=Ae(m.cx,m.cy,m.outerRadius+x,N),h=R(R(R(R({},o),m),{},{stroke:"none"},j),{},{index:b,textAnchor:a.getTextAnchor(p.x,m.cx)},p),u=R(R(R(R({},o),m),{},{fill:"none",stroke:m.fill},A),{},{index:b,points:[Ae(m.cx,m.cy,m.outerRadius,N),p]}),v=g;return ae(g)&&ae(c)?v="value":ae(g)&&(v=c),I.createElement(ie,{key:"label-".concat(m.startAngle,"-").concat(m.endAngle,"-").concat(m.midAngle,"-").concat(b)},f&&a.renderLabelLineItem(f,u,"line"),a.renderLabelItem(i,h,X(m,v)))});return I.createElement(ie,{className:"recharts-pie-labels"},w)}},{key:"renderSectorsStatically",value:function(t){var r=this,l=this.props,i=l.activeShape,f=l.blendStroke,g=l.inactiveShape;return t.map(function(c,o){if(c?.startAngle===0&&c?.endAngle===0&&t.length!==1)return null;var j=r.isActiveIndex(o),A=g&&r.hasActiveIndex()?g:null,x=j?i:A,w=R(R({},c),{},{stroke:f?c.fill:c.stroke,tabIndex:-1});return I.createElement(ie,ee({ref:function(b){b&&!r.sectorRefs.includes(b)&&r.sectorRefs.push(b)},tabIndex:-1,className:"recharts-pie-sector"},Ht(r.props,c,o),{key:"sector-".concat(c?.startAngle,"-").concat(c?.endAngle,"-").concat(c.midAngle,"-").concat(o)}),I.createElement(Ut,ee({option:x,isActive:j,shapeType:"sector"},w)))})}},{key:"renderSectorsWithAnimation",value:function(){var t=this,r=this.props,l=r.sectors,i=r.isAnimationActive,f=r.animationBegin,g=r.animationDuration,c=r.animationEasing,o=r.animationId,j=this.state,A=j.prevSectors,x=j.prevIsAnimationActive;return I.createElement(Wt,{begin:f,duration:g,isActive:i,easing:c,from:{t:0},to:{t:1},key:"pie-".concat(o,"-").concat(x),onAnimationStart:this.handleAnimationStart,onAnimationEnd:this.handleAnimationEnd},function(w){var m=w.t,b=[],N=l&&l[0],p=N.startAngle;return l.forEach(function(h,u){var v=A&&A[u],C=u>0?qt(h,"paddingAngle",0):0;if(v){var S=Me(v.endAngle-v.startAngle,h.endAngle-h.startAngle),d=R(R({},h),{},{startAngle:p+C,endAngle:p+S(m)+C});b.push(d),p=d.endAngle}else{var k=h.endAngle,y=h.startAngle,D=Me(0,k-y),O=D(m),M=R(R({},h),{},{startAngle:p+C,endAngle:p+O+C});b.push(M),p=M.endAngle}}),I.createElement(ie,null,t.renderSectorsStatically(b))})}},{key:"attachKeyboardHandlers",value:function(t){var r=this;t.onkeydown=function(l){if(!l.altKey)switch(l.key){case"ArrowLeft":{var i=++r.state.sectorToFocus%r.sectorRefs.length;r.sectorRefs[i].focus(),r.setState({sectorToFocus:i});break}case"ArrowRight":{var f=--r.state.sectorToFocus<0?r.sectorRefs.length-1:r.state.sectorToFocus%r.sectorRefs.length;r.sectorRefs[f].focus(),r.setState({sectorToFocus:f});break}case"Escape":{r.sectorRefs[r.state.sectorToFocus].blur(),r.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var t=this.props,r=t.sectors,l=t.isAnimationActive,i=this.state.prevSectors;return l&&r&&r.length&&(!i||!Qt(i,r))?this.renderSectorsWithAnimation():this.renderSectorsStatically(r)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var t=this,r=this.props,l=r.hide,i=r.sectors,f=r.className,g=r.label,c=r.cx,o=r.cy,j=r.innerRadius,A=r.outerRadius,x=r.isAnimationActive,w=this.state.isAnimationFinished;if(l||!i||!i.length||!Z(c)||!Z(o)||!Z(j)||!Z(A))return null;var m=ye("recharts-pie",f);return I.createElement(ie,{tabIndex:this.props.rootTabIndex,className:m,ref:function(N){t.pieRef=N}},this.renderSectors(),g&&this.renderLabels(i),He.renderCallByParent(this.props,null,!1),(!x||w)&&Xt.renderCallByParent(this.props,i,!1))}}],[{key:"getDerivedStateFromProps",value:function(t,r){return r.prevIsAnimationActive!==t.isAnimationActive?{prevIsAnimationActive:t.isAnimationActive,prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:[],isAnimationFinished:!0}:t.isAnimationActive&&t.animationId!==r.prevAnimationId?{prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:r.curSectors,isAnimationFinished:!0}:t.sectors!==r.curSectors?{curSectors:t.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(t,r){return t>r?"start":t<r?"end":"middle"}},{key:"renderLabelLineItem",value:function(t,r,l){if(I.isValidElement(t))return I.cloneElement(t,r);if(ne(t))return t(r);var i=ye("recharts-pie-label-line",typeof t!="boolean"?t.className:"");return I.createElement(Yt,ee({},r,{key:l,type:"linear",className:i}))}},{key:"renderLabelItem",value:function(t,r,l){if(I.isValidElement(t))return I.cloneElement(t,r);var i=l;if(ne(t)&&(i=t(r),I.isValidElement(i)))return i;var f=ye("recharts-pie-label-text",typeof t!="boolean"&&!ne(t)?t.className:"");return I.createElement(zt,ee({},r,{alignmentBaseline:"middle",className:f}),i)}}])})(P.PureComponent);xe=G;L(G,"displayName","Pie");L(G,"defaultProps",{stroke:"#fff",fill:"#808080",legendType:"rect",cx:"50%",cy:"50%",startAngle:0,endAngle:360,innerRadius:0,outerRadius:"80%",paddingAngle:0,labelLine:!0,hide:!1,minAngle:0,isAnimationActive:!Zt.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});L(G,"parseDeltaAngle",function(s,a){var n=fe(a-s),t=Math.min(Math.abs(a-s),360);return n*t});L(G,"getRealPieData",function(s){var a=s.data,n=s.children,t=he(s,!1),r=ea(n,ta);return a&&a.length?a.map(function(l,i){return R(R(R({payload:l},t),l),r&&r[i]&&r[i].props)}):r&&r.length?r.map(function(l){return R(R({},t),l.props)}):[]});L(G,"parseCoordinateOfPie",function(s,a){var n=a.top,t=a.left,r=a.width,l=a.height,i=aa(r,l),f=t+pe(s.cx,r,r/2),g=n+pe(s.cy,l,l/2),c=pe(s.innerRadius,i,0),o=pe(s.outerRadius,i,i*.8),j=s.maxRadius||Math.sqrt(r*r+l*l)/2;return{cx:f,cy:g,innerRadius:c,outerRadius:o,maxRadius:j}});L(G,"getComposedData",function(s){var a=s.item,n=s.offset,t=a.type.defaultProps!==void 0?R(R({},a.type.defaultProps),a.props):a.props,r=xe.getRealPieData(t);if(!r||!r.length)return null;var l=t.cornerRadius,i=t.startAngle,f=t.endAngle,g=t.paddingAngle,c=t.dataKey,o=t.nameKey,j=t.valueKey,A=t.tooltipType,x=Math.abs(t.minAngle),w=xe.parseCoordinateOfPie(t,n),m=xe.parseDeltaAngle(i,f),b=Math.abs(m),N=c;ae(c)&&ae(j)?(Re(!1,`Use "dataKey" to specify the value of pie,
|
|
2
2
|
the props "valueKey" will be deprecated in 1.1.0`),N="value"):ae(c)&&(Re(!1,`Use "dataKey" to specify the value of pie,
|
|
3
3
|
the props "valueKey" will be deprecated in 1.1.0`),N=j);var p=r.filter(function(d){return X(d,N,0)!==0}).length,h=(b>=360?p:p-1)*g,u=b-p*x-h,v=r.reduce(function(d,k){var y=X(k,N,0);return d+(Z(y)?y:0)},0),C;if(v>0){var S;C=r.map(function(d,k){var y=X(d,N,0),D=X(d,o,k),O=(Z(y)?y:0)/v,M;k?M=S.endAngle+fe(m)*g*(y!==0?1:0):M=i;var _=M+fe(m)*((y!==0?x:0)+O*u),E=(M+_)/2,V=(w.innerRadius+w.outerRadius)/2,q=[{name:D,value:y,payload:d,dataKey:N,type:A}],st=Ae(w.cx,w.cy,V,E);return S=R(R(R({percent:O,cornerRadius:l,name:D,tooltipPayload:q,midAngle:E,middleRadius:V,tooltipPosition:st},d),w),{},{value:X(d,N),startAngle:M,endAngle:_,payload:d,paddingAngle:fe(m)*g}),S})}return R(R({},w),{},{sectors:C,data:r})});var va=sa({chartName:"PieChart",GraphicalChild:G,validateTooltipEventTypes:["item"],defaultTooltipEventType:"item",legendContent:"children",axisComponents:[{axisType:"angleAxis",AxisComp:ia},{axisType:"radiusAxis",AxisComp:oa}],formatAxisMap:ra,defaultProps:{layout:"centric",startAngle:0,endAngle:360,cx:"50%",cy:"50%",innerRadius:0,outerRadius:"80%"}});const tt=({className:s})=>{const a=De();return e.jsx(ce,{actions:e.jsx(Ce,{variant:"outline",onClick:()=>a("/settings/analytics",{crossApp:!0}),children:"Open settings"}),className:s,description:"Enable member source tracking in settings to see which content drives member growth.",title:"Member sources have been disabled",children:e.jsx(St,{})})},ja=s=>s==="total-members"||s==="free-members"||s==="paid-members"||s==="mrr",ya=({active:s,payload:a,range:n,color:t,showBreakdown:r})=>{if(!s||!a?.length)return null;const l=a[0].payload,{date:i,formattedValue:f,label:g,comped:c}=l,o=l.value-(c||0);return e.jsxs("div",{className:"min-w-[200px] rounded-lg border bg-background px-3 py-2 shadow-lg",children:[i&&e.jsx("div",{className:"mb-1 text-sm text-foreground",children:z(i,n||0)}),e.jsxs("div",{className:"flex flex-col gap-1",children:[r&&e.jsxs(e.Fragment,{children:[e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"flex grow items-center justify-between gap-5",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Paid subscriptions"}),e.jsx("div",{className:"font-mono text-xs",children:T(o)})]})}),e.jsx("div",{className:"flex items-center gap-2",children:e.jsxs("div",{className:"flex grow items-center justify-between gap-5",children:[e.jsx("div",{className:"text-sm text-muted-foreground",children:"Complimentary"}),e.jsx("div",{className:"font-mono text-xs",children:c!==void 0&&c>0?T(c):"0"})]})}),e.jsx(lt,{})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"inline-block size-2 rounded-full opacity-50",style:{backgroundColor:t||"hsl(var(--chart-purple))"}}),e.jsxs("div",{className:"flex grow items-center justify-between gap-5",children:[g&&e.jsx("div",{className:"text-sm text-muted-foreground",children:g}),e.jsx("div",{className:"font-mono font-medium",children:f})]})]})]})]})},Sa=({chartData:s,totals:a,initialTab:n,currencySymbol:t,isLoading:r,onTabChange:l})=>{const i=ja(n)?n:"total-members",[f,g]=P.useState(i),{range:c}=Te(),{appSettings:o}=je(),j=De(),[A]=Ke();P.useEffect(()=>{g(i)},[i]);const x=S=>{g(S);const d=new URLSearchParams(A);d.set("tab",S),j(`?${d.toString()}`,{replace:!0}),l&&l(S)},{totalMembers:w,freeMembers:m,paidMembers:b,mrr:N,percentChanges:p,directions:h}=a,u=P.useMemo(()=>{if(!s||s.length===0)return[];let S=[],d="value";switch(f){case"free-members":d="free";break;case"paid-members":d="paid";break;case"mrr":{d="mrr";break}default:d="value"}S=oe(s,c,d,"exact");let k=[];switch(f){case"free-members":k=S.map(y=>({...y,value:y.free,formattedValue:T(y.free),label:"Free members"}));break;case"paid-members":k=S.map(y=>({...y,value:y.paid,formattedValue:T(y.paid),label:"Paid members",comped:y.comped,paid_subscribed:y.paid_subscribed}));break;case"mrr":k=S.map(y=>({...y,value:J(y.mrr),formattedValue:`${t}${T(J(y.mrr))}`,label:"MRR"}));break;default:k=S.map(y=>{const D=y.free+y.paid;return{...y,value:D,formattedValue:T(D),label:"Total members"}})}return k},[f,s,c,t]),v={"total-members":{color:"hsl(var(--chart-darkblue))"},"free-members":{color:"hsl(var(--chart-blue))"},"paid-members":{color:"hsl(var(--chart-purple))"},mrr:{color:"hsl(var(--chart-teal))"}};return r?e.jsx("div",{className:"-mb-6 flex h-[calc(16vw+132px)] w-full items-start justify-center",children:e.jsx(rt,{})}):e.jsxs(Ve,{defaultValue:i,variant:"kpis",children:[e.jsxs($e,{className:`-mx-6 ${o?.paidMembersEnabled?"hidden grid-cols-4 lg:!visible lg:!grid":"grid grid-cols-4"}`,children:[e.jsx(ue,{className:o?.paidMembersEnabled?"":"cursor-auto after:hidden",value:"total-members",onClick:()=>{o?.paidMembersEnabled&&x("total-members")},children:e.jsx(Y,{color:"hsl(var(--chart-darkblue))",diffDirection:c===$.allTime.value?"hidden":h.total,diffValue:p.total,label:"Total members",value:T(w)})}),o?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsx(ue,{value:"free-members",onClick:()=>{x("free-members")},children:e.jsx(Y,{color:"hsl(var(--chart-blue))",diffDirection:c===$.allTime.value?"hidden":h.free,diffValue:p.free,label:"Free members",value:T(m)})}),e.jsx(ue,{value:"paid-members",onClick:()=>{x("paid-members")},children:e.jsx(Y,{color:"hsl(var(--chart-purple))",diffDirection:c===$.allTime.value?"hidden":h.paid,diffValue:p.paid,label:"Paid members",value:T(b)})}),e.jsx(ue,{value:"mrr",onClick:()=>{x("mrr")},children:e.jsx(Y,{color:"hsl(var(--chart-teal))",diffDirection:c===$.allTime.value?"hidden":h.mrr,diffValue:p.mrr,label:"MRR",value:`${t}${T(J(N))}`})})]})]}),o?.paidMembersEnabled&&e.jsxs(nt,{children:[e.jsx(it,{className:"lg:hidden",asChild:!0,children:e.jsxs(Tt,{children:[f==="total-members"&&e.jsx(Y,{color:"hsl(var(--chart-darkblue))",diffDirection:c===$.allTime.value?"hidden":h.total,diffValue:p.total,label:"Total members",value:T(w)}),f==="free-members"&&e.jsx(Y,{color:"hsl(var(--chart-blue))",diffDirection:c===$.allTime.value?"hidden":h.free,diffValue:p.free,label:"Free members",value:T(m)}),f==="paid-members"&&e.jsx(Y,{color:"hsl(var(--chart-purple))",diffDirection:c===$.allTime.value?"hidden":h.paid,diffValue:p.paid,label:"Paid members",value:T(b)}),f==="mrr"&&e.jsx(Y,{color:"hsl(var(--chart-teal))",diffDirection:c===$.allTime.value?"hidden":h.mrr,diffValue:p.mrr,label:"MRR",value:`${t}${T(J(N))}`})]})}),e.jsxs(ot,{align:"end",className:"w-56",children:[e.jsx(de,{onClick:()=>x("total-members"),children:"Total members"}),e.jsx(de,{onClick:()=>x("free-members"),children:"Free members"}),e.jsx(de,{onClick:()=>x("paid-members"),children:"Paid members"}),e.jsx(de,{onClick:()=>x("mrr"),children:"MRR"})]})]}),e.jsx("div",{className:"my-4 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500",children:e.jsx(wt,{className:"-mb-3 h-[16vw] max-h-[320px] w-full min-h-[180px]",color:v[f].color,data:u,dataFormatter:f==="mrr"?S=>`${t}${T(S)}`:T,id:f,range:c,tooltipContent:f==="paid-members"?e.jsx(ya,{color:v["paid-members"].color,range:c,showBreakdown:!0}):void 0})})]})},Aa=(s,a="signups desc",n=50)=>{const{startDate:t,endDate:r,timezone:l}=se(s),i={date_from:W(t),date_to:W(r),member_status:_t(ct),order:a,limit:n.toString()};return l&&(i.timezone=l),Gt({searchParams:i})},Fe=({data:s,currencySymbol:a,limit:n,defaultSourceIconUrl:t})=>{const r=n?s.slice(0,n):s,{appSettings:l}=je();return e.jsx(le,{children:r.map(i=>e.jsxs(K,{className:"last:border-none",children:[e.jsx(F,{className:"font-medium",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Pt,{defaultSourceIconUrl:t,displayName:i.displayName,iconSrc:i.iconSrc}),i.linkUrl?e.jsx("a",{className:"hover:underline",href:i.linkUrl,rel:"noreferrer",target:"_blank",children:i.displayName}):e.jsx("span",{children:i.displayName})]})}),e.jsxs(F,{className:"text-right font-mono text-sm",children:["+",T(i.free_members)]}),l?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs(F,{className:"text-right font-mono text-sm",children:["+",T(i.paid_members)]}),e.jsxs(F,{className:"text-right font-mono text-sm",children:["+",a,T(J(i.mrr))]})]})]},i.source))})},wa=({range:s,limit:a=20,showViewAll:n=!1,sortBy:t,setSortBy:r})=>{const{data:l}=Te(),{data:i}=It(),{appSettings:f}=je(),[g,c]=P.useState("free_members desc"),o=t||g,j=r||c,A=o.replace("free_members","signups").replace("paid_members","paid_conversions"),{data:x,isLoading:w}=Aa(s,A,a),m=l?.url,b="https://www.google.com/s2/favicons?domain=ghost.org&sz=64",N=I.useMemo(()=>{if(i?.stats&&i?.meta?.totals){const v=i.meta.totals;let C=v[0];if(!C)return Se("usd");for(const S of v)S.mrr>C.mrr&&(C=S);return Se(C.currency)}return Se("usd")},[i]),p=I.useMemo(()=>x?.stats?x.stats.map(v=>{const C=v.source||"Direct",{domain:S}=Bt(C,m),d=S?`https://www.faviconextractor.com/favicon/${S}?larger=true`:b,k=S&&C!=="Direct"?`https://${S}`:void 0;return{source:C,free_members:v.signups,paid_members:v.paid_conversions,mrr:v.mrr,iconSrc:d,displayName:C,linkUrl:k}}):[],[x,m]),h="Top sources",u=`Where did your growth come from ${U(s)}`;return f?.analytics.membersTrackSources?w?e.jsx(le,{children:e.jsx(K,{className:"last:border-none",children:e.jsx(F,{className:"border-none py-2",colSpan:1,children:e.jsx(Ge,{containerClassName:"space-y-2",count:5,maxWidth:75,randomize:!0})})})}):e.jsxs(e.Fragment,{children:[p.length>0?e.jsx(Fe,{currencySymbol:N,data:p,defaultSourceIconUrl:b,limit:a}):e.jsx(le,{children:e.jsx(K,{className:"last:border-none",children:e.jsx(F,{className:"border-none py-12 group-hover:!bg-transparent",colSpan:f?.paidMembersEnabled?4:2,children:e.jsx(ce,{description:"Try adjusting your date range to see more data.",title:`No conversions ${U(s)}`,children:e.jsx(dt,{strokeWidth:1.5})})})})}),n&&p.length>a&&e.jsx(Et,{className:"border-none bg-transparent hover:!bg-transparent",children:e.jsx(K,{children:e.jsx(F,{className:"border-none bg-transparent px-0 pb-0 hover:!bg-transparent",colSpan:4,children:e.jsxs(ut,{children:[e.jsx(mt,{asChild:!0,children:e.jsxs(Ce,{variant:"outline",children:["View all ",e.jsx(At,{})]})}),e.jsxs(pt,{className:"overflow-y-auto pt-0 sm:max-w-[600px]",children:[e.jsxs(ht,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[e.jsx(ft,{children:h}),e.jsx(xt,{children:u})]}),e.jsx("div",{className:"group/datalist",children:e.jsxs(Ye,{children:[e.jsx(ze,{children:e.jsxs(K,{children:[e.jsx(H,{children:"Source"}),e.jsx(H,{className:"w-[110px] text-right",children:e.jsx(te,{activeSortBy:o,setSortBy:j,sortBy:"free_members desc",children:"Free members"})}),f?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"w-[110px] text-right",children:e.jsx(te,{activeSortBy:o,setSortBy:j,sortBy:"paid_members desc",children:"Paid members"})}),e.jsx(H,{className:"w-[110px] text-right",children:e.jsx(te,{activeSortBy:o,setSortBy:j,sortBy:"mrr desc",children:"MRR impact"})})]})]})}),e.jsx(Fe,{currencySymbol:N,data:p,defaultSourceIconUrl:b})]})})]})]})})})})]}):e.jsx(le,{children:e.jsx(K,{className:"last:border-none",children:e.jsx(F,{className:"border-none py-12 group-hover:!bg-transparent",colSpan:f?.paidMembersEnabled?4:2,children:e.jsx(tt,{})})})})},Na=({active:s,payload:a})=>{if(s&&a&&a.length){const n=a[0];return e.jsx("div",{className:"rounded-lg border bg-background p-2 shadow-sm",children:e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("div",{className:"size-2 rounded-full opacity-50",style:{backgroundColor:n.payload.color}}),e.jsx("span",{className:"font-medium",children:n.name}),e.jsx("span",{className:"font-mono",children:T(n.value)})]})})}return null},Da=({isLoading:s,range:a})=>{const{data:n}=Ft(),{data:t}=Lt({searchParams:{date_from:W(se(a).startDate)}}),{data:{tiers:r=[]}={}}=Vt(),[l,i]=P.useState("billing-period"),{startDate:f,endDate:g}=P.useMemo(()=>se(a),[a]),c=P.useMemo(()=>W(f),[f]),o=P.useMemo(()=>W(g),[g]),j=P.useMemo(()=>r.filter(u=>u.type==="paid"&&u.active).map(u=>({id:u.id,name:u.name})),[r]),A=P.useMemo(()=>{if(!t?.stats||t.stats.length===0)return 0;const u=t.stats,v=B(c),C=B(o),S=u.filter(O=>{const M=B(O.date);return M.isSameOrAfter(v)&&M.isSameOrBefore(C)});if(S.length===0)return 0;const d=[...S].sort((O,M)=>new Date(O.date).getTime()-new Date(M.date).getTime()),k=d[0].comped,D=d[d.length-1].comped-k;return D>0?D:0},[t,c,o]),x=P.useMemo(()=>{if(!n?.stats)return[];const u=B(c),v=B(o),C=n.stats.filter(d=>{const k=B(d.date);return k.isSameOrAfter(u)&&k.isSameOrBefore(v)}).reduce((d,k)=>{const y=k.cadence;return d[y]||(d[y]=0),d[y]+=k.signups,d},{});return A>0&&(C.complimentary=A),Object.entries(C).map(([d,k],y)=>{let D=d,O="url(#gradientPurple)",M="hsl(var(--chart-purple))";return d==="month"?(D="Monthly",O="url(#gradientPurple)",M="hsl(var(--chart-purple))"):d==="year"?(D="Annual",O="url(#gradientTeal)",M="hsl(var(--chart-teal))"):d==="complimentary"&&(D="Complimentary",O="url(#gradientBlue)",M="hsl(var(--chart-blue))"),{id:`cadence-${y}`,name:D,count:k,fill:O,color:M}})},[n,c,o,A]),w=P.useMemo(()=>{if(!n?.stats||j.length===0)return[];const u=B(c),v=B(o),C=n.stats.filter(D=>{const O=B(D.date);return O.isSameOrAfter(u)&&O.isSameOrBefore(v)}).reduce((D,O)=>{const M=O.tier;return D[M]||(D[M]=0),D[M]+=O.signups,D},{}),S=[{gradient:"url(#gradientPurple)",solid:"hsl(var(--chart-purple))"},{gradient:"url(#gradientTeal)",solid:"hsl(var(--chart-teal))"},{gradient:"url(#gradientBlue)",solid:"hsl(var(--chart-blue))"},{gradient:"url(#gradientRose)",solid:"hsl(var(--chart-rose))"},{gradient:"url(#gradientOrange)",solid:"hsl(var(--chart-orange))"},{gradient:"url(#gradientGreen)",solid:"hsl(var(--chart-green))"},{gradient:"url(#gradientAmber)",solid:"hsl(var(--chart-amber))"},{gradient:"url(#gradientYellow)",solid:"hsl(var(--chart-yellow))"},{gradient:"url(#gradientDarkblue)",solid:"hsl(var(--chart-darkblue))"},{gradient:"url(#gradientGray)",solid:"hsl(var(--chart-darkgray))"}];return[...j.map(D=>{const O=C[D.id]||0;return{id:D.id,name:D.name,count:O}})].sort((D,O)=>O.count-D.count).map((D,O)=>{const M=O%S.length;return{...D,fill:S[M].gradient,color:S[M].solid}})},[n,j,c,o]),m=l==="billing-period"?x:w,b=P.useMemo(()=>m.reduce((u,v)=>u+v.count,0),[m]),N=P.useMemo(()=>{const u={count:{label:"Subscriptions"}};return m.forEach(v=>{u[v.id]={label:v.name,color:v.color}}),u},[m]),p=P.useMemo(()=>b===0?[]:m.map(u=>({label:u.name,count:u.count,percentage:u.count/b*100,color:u.color})),[m,b]);if(s||!n?.stats)return null;const h=m.length>0&&b>0;return e.jsxs(be,{children:[e.jsx(_e,{children:e.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(ke,{children:"Paid subscription breakdown"}),e.jsxs(Pe,{children:["New paid subscriptions ",U(a)]})]}),j.length>1&&e.jsx("div",{children:e.jsxs(qe,{value:l,onValueChange:u=>i(u),children:[e.jsx(Qe,{className:"w-full",children:e.jsx(Xe,{})}),e.jsxs(Je,{align:"end",children:[e.jsx(we,{value:"billing-period",children:"Billing period"}),e.jsx(we,{value:"tiers",children:"Tiers"})]})]})})]})}),e.jsx(ge,{children:h?e.jsxs(e.Fragment,{children:[e.jsx(Ue,{className:"mx-auto aspect-square h-[250px] min-h-[250px] w-full",config:N,children:e.jsxs(va,{children:[e.jsxs("defs",{children:[e.jsxs("linearGradient",{id:"gradientPurple",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-purple))",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-purple))",stopOpacity:.6})]}),e.jsxs("linearGradient",{id:"gradientTeal",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-teal))",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-teal))",stopOpacity:.6})]}),e.jsxs("linearGradient",{id:"gradientRose",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-rose))",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-rose))",stopOpacity:.6})]}),e.jsxs("linearGradient",{id:"gradientBlue",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-blue))",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-blue))",stopOpacity:.6})]}),e.jsxs("linearGradient",{id:"gradientOrange",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-orange))",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-orange))",stopOpacity:.6})]}),e.jsxs("linearGradient",{id:"gradientGreen",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-green))",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-green))",stopOpacity:.6})]}),e.jsxs("linearGradient",{id:"gradientAmber",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-amber))",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-amber))",stopOpacity:.6})]}),e.jsxs("linearGradient",{id:"gradientYellow",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-yellow))",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-yellow))",stopOpacity:.6})]}),e.jsxs("linearGradient",{id:"gradientDarkblue",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-darkblue))",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-darkblue))",stopOpacity:.6})]}),e.jsxs("linearGradient",{id:"gradientGray",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"hsl(var(--chart-darkgray))",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"hsl(var(--chart-darkgray))",stopOpacity:.6})]})]}),e.jsx(We,{content:e.jsx(Na,{}),cursor:!1}),e.jsx(G,{animationBegin:0,animationDuration:1e3,data:m,dataKey:"count",innerRadius:70,nameKey:"name",strokeWidth:5,children:e.jsx(He,{content:({viewBox:u})=>{if(u&&"cx"in u&&"cy"in u)return e.jsxs("text",{dominantBaseline:"middle",textAnchor:"middle",x:u.cx,y:u.cy,children:[e.jsx("tspan",{className:"fill-foreground text-2xl font-semibold tracking-tight",x:u.cx,y:u.cy,children:T(b)}),e.jsx("tspan",{className:"fill-muted-foreground",x:u.cx,y:(u.cy||0)+20,children:"Total"})]})}})})]})}),p.length>0&&e.jsx("div",{className:"mt-4 flex flex-wrap items-center justify-center gap-x-6 gap-y-1 text-sm text-muted-foreground",children:p.map(u=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"size-2 rounded-full opacity-50",style:{backgroundColor:u.color}}),e.jsx("span",{className:"max-w-[150px] truncate whitespace-nowrap",title:u.label,children:u.label}),e.jsxs("span",{className:"font-medium text-foreground",children:[Math.round(Number(u.percentage)||0),"%"]})]},u.label))})]}):e.jsx("div",{className:"py-12",children:e.jsx(ce,{description:`No new paid subscriptions ${U(a)}.`,title:"No new subscribers",children:e.jsx(la,{strokeWidth:1.5})})})})]})},Ca=(s,a,n)=>{if(a===1){const o=B().format("YYYY-MM-DD"),j=s.find(A=>A.date===o);return[{date:o,signups:j?.signups||0,cancellations:j?.cancellations||0}]}const{startDate:t,endDate:r}=se(a),l=B(r).diff(B(t),"days"),i=bt(a,l,"sum",n),f=new Map(s.map(o=>[o.date,o])),g=[],c=new Set;if(i==="monthly"){const o=B(t).startOf("month"),j=B(r).startOf("month");for(;o.isSameOrBefore(j);){const A=o.format("YYYY-MM-DD");if(!c.has(A)){c.add(A);const x=f.get(A);x?g.push(x):g.push({date:A,signups:0,cancellations:0})}o.add(1,"month")}}else if(i==="weekly"){const o=B(t).startOf("week"),j=B(r).startOf("week");for(;o.isSameOrBefore(j);){const A=o.format("YYYY-MM-DD");if(!c.has(A)){c.add(A);const x=f.get(A);x?g.push(x):g.push({date:A,signups:0,cancellations:0})}o.add(1,"week")}}else{const o=B(t),j=B(r);for(;o.isSameOrBefore(j);){const A=o.format("YYYY-MM-DD"),x=f.get(A);x?g.push(x):g.push({date:A,signups:0,cancellations:0}),o.add(1,"day")}}return g},at=s=>{if(s===-1){const{startDate:a,endDate:n}=se(s);return B(n).diff(B(a),"days")}return s},Ta=s=>{const a=at(s);return a<30?["daily"]:a>=91?["weekly","monthly"]:["daily","weekly"]},Le=s=>{const a=at(s);return a<30?"daily":a>=91?"monthly":"weekly"},_a=({subscriptionData:s,memberData:a,range:n,isLoading:t})=>{const[r,l]=P.useState(()=>Le(n));P.useEffect(()=>{l(Le(n))},[n]);const i=P.useMemo(()=>Ta(n),[n]),f=P.useMemo(()=>{switch(r){case"daily":return"none";case"weekly":return"weekly";case"monthly":return"monthly"}},[r]),g=P.useMemo(()=>{if(s&&s.length>0){if(n===1){const h=B().format("YYYY-MM-DD"),u=s.find(v=>v.date===h);return[{date:z(h,n),rawDate:h,new:u?.signups||0,cancelled:-(u?.cancellations||0)}]}const x=oe(s,n,"signups","sum",f),w=oe(s,n,"cancellations","sum",f),m=new Map(w.map(h=>[h.date,h])),b=x.map(h=>({date:h.date,signups:h.signups||0,cancellations:m.get(h.date)?.cancellations||0})),N=new Set(b.map(h=>h.date));return w.forEach(h=>{N.has(h.date)||b.push({date:h.date,signups:0,cancellations:h.cancellations||0})}),b.sort((h,u)=>new Date(h.date).getTime()-new Date(u.date).getTime()),Ca(b,n,f).map(h=>{let u=n;return r==="weekly"&&n<91?u=91:r==="monthly"&&n<365&&(u=365),{date:z(h.date,u),rawDate:h.date,new:h.signups||0,cancelled:-(h.cancellations||0)}})}else{if(!a||a.length===0)return[];if(n===1){const p=B().format("YYYY-MM-DD"),h=a.find(u=>u.date===p);return[{date:z(p,n),rawDate:p,new:h?.paid_subscribed||0,cancelled:-(h?.paid_canceled||0)}]}const x=oe(a,n,"paid_subscribed","sum",f),w=oe(a,n,"paid_canceled","sum",f),m=new Map(w.map(p=>[p.date,p])),b=x.map(p=>({date:p.date,paid_subscribed:p.paid_subscribed||0,paid_canceled:m.get(p.date)?.paid_canceled||0})),N=new Set(b.map(p=>p.date));return w.forEach(p=>{N.has(p.date)||b.push({date:p.date,paid_subscribed:0,paid_canceled:p.paid_canceled||0})}),b.sort((p,h)=>new Date(p.date).getTime()-new Date(h.date).getTime()),b.map(p=>{let h=n;return r==="weekly"&&n<91?h=91:r==="monthly"&&n<365&&(h=365),{date:z(p.date,h),rawDate:p.date,new:p.paid_subscribed||0,cancelled:-(p.paid_canceled||0)}})}},[a,s,n,f,r]),c={new:{label:"New",color:"hsl(var(--chart-teal))"},cancelled:{label:"Cancelled",color:"hsl(var(--chart-rose))"}},o=P.useMemo(()=>{const x=g.reduce((m,b)=>m+b.new,0),w=g.reduce((m,b)=>m+Math.abs(b.cancelled),0);return{new:x,cancelled:w}},[g]);if(t)return null;const j=g.length>0&&(o.new>0||o.cancelled>0),A=x=>x.charAt(0).toUpperCase()+x.slice(1);return e.jsxs(be,{"data-testid":"paid-members-change-card",children:[e.jsx(_e,{children:e.jsxs("div",{className:"flex items-start justify-between gap-1.5",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(ke,{children:"Paid subscriptions"}),e.jsxs(Pe,{children:["New and cancelled paid subscriptions ",U(n)]})]}),i.length>1&&e.jsx("div",{children:e.jsxs(qe,{value:r,onValueChange:x=>l(x),children:[e.jsx(Qe,{className:"w-[110px]",children:e.jsx(Xe,{})}),e.jsx(Je,{align:"end",children:i.map(x=>e.jsx(we,{value:x,children:A(x)},x))})]})})]})}),e.jsx(ge,{children:j?e.jsxs("div",{children:[e.jsx(Ue,{className:"aspect-auto h-[200px] w-full md:h-[220px] xl:h-[260px]",config:c,children:e.jsxs(kt,{data:g,stackOffset:"sign",children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"tealGradient",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--color-new)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"var(--color-new)",stopOpacity:.6})]})}),e.jsx("defs",{children:e.jsxs("linearGradient",{id:"roseGradient",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:"var(--color-cancelled)",stopOpacity:.6}),e.jsx("stop",{offset:"100%",stopColor:"var(--color-cancelled)",stopOpacity:.8})]})}),e.jsx(Nt,{stroke:"hsl(var(--border))",vertical:!1}),e.jsx(Dt,{axisLine:!1,dataKey:"date",tickFormatter:()=>"",tickLine:!1,tickMargin:10}),e.jsx(Ct,{axisLine:!1,tickFormatter:x=>x<0?T(x*-1):T(x),tickLine:!1}),e.jsx(We,{content:e.jsx(na,{className:"!min-w-[120px] px-3 py-2",formatter:(x,w,m,b)=>{const N=Number(x);let p="0";N===0?p="0":p=N<0?T(N*-1):T(N);const h=Number(m?.payload?.new||0),u=Number(m?.payload?.cancelled||0),v=h+u,C=v===0?"0":v>0?`+${T(v)}`:T(v);let S=m?.payload?.date;return m?.payload?.rawDate&&(r==="monthly"?S=z(m.payload.rawDate,366):r==="weekly"?S=z(m.payload.rawDate,91):S=z(m.payload.rawDate,30)),e.jsxs("div",{className:"flex w-full flex-col",children:[b===0&&e.jsx("div",{className:"mb-1 text-sm font-medium text-foreground",children:S}),e.jsxs("div",{className:"flex w-full items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-1",children:[e.jsx("div",{className:"size-2 shrink-0 rounded-full bg-[var(--color-bg)] opacity-50",style:{"--color-bg":`var(--color-${w})`}}),e.jsx("span",{className:"text-sm text-muted-foreground",children:c[w]?.label||w})]}),e.jsx("div",{className:"ml-auto flex items-baseline gap-0.5 font-mono font-medium tabular-nums text-foreground",children:p})]}),b===1&&e.jsxs("div",{className:"mt-1 flex w-full items-center justify-between gap-4 border-t pt-1",children:[e.jsx("span",{className:"text-sm text-muted-foreground",children:"Net change"}),e.jsx("div",{className:"ml-auto flex items-baseline gap-0.5 font-mono font-medium tabular-nums text-foreground",children:C})]})]})},hideLabel:!0}),cursor:!1,isAnimationActive:!1,position:{y:10}}),e.jsx(Ee,{activeBar:{fillOpacity:1},dataKey:"new",fill:"url(#tealGradient)",fillOpacity:.75,maxBarSize:32,minPointSize:3,radius:[4,4,0,0],stackId:"a"}),e.jsx(Ee,{activeBar:{fillOpacity:1},dataKey:"cancelled",fill:"url(#roseGradient)",fillOpacity:.75,maxBarSize:32,radius:[4,4,0,0],stackId:"a"})]})}),e.jsxs("div",{className:"mt-3 flex items-center justify-center gap-6 text-sm text-muted-foreground",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"size-2 rounded-full opacity-50",style:{backgroundColor:c.new.color}}),e.jsx("span",{children:"New"}),e.jsx("span",{className:"font-medium text-foreground",children:T(o.new)})]}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"size-2 rounded-full opacity-50",style:{backgroundColor:c.cancelled.color}}),e.jsx("span",{children:"Cancelled"}),e.jsx("span",{className:"font-medium text-foreground",children:T(o.cancelled)})]})]})]}):e.jsx("div",{className:"py-12",children:e.jsx(ce,{description:`No paid subscription changes ${U(n)}.`,title:"No paid member changes",children:e.jsx(ca,{strokeWidth:1.5})})})})]})},ka=(s,a,n)=>{const t=s??30,r=a??"mrr desc",{startDate:l,endDate:i}=P.useMemo(()=>se(t),[t]),f=P.useMemo(()=>{const o={date_from:W(l),date_to:W(i),order:r};return n==="posts"?o.post_type="post":n==="pages"&&(o.post_type="page"),o},[l,i,r,n]),g=Object.fromEntries(Object.entries(f).filter(([,o])=>o!==void 0));return Kt({searchParams:g})},ps=()=>{const{range:s,site:a,settings:n}=Te(),t=String(n.find(d=>d.key==="timezone")?.value||"Etc/UTC"),r=De(),[l,i]=P.useState("free_members desc"),[f,g]=P.useState(Q.POSTS_AND_PAGES),[c]=Ke(),{appSettings:o}=je(),j=c.get("tab")||"total-members",[A,x]=P.useState(j);P.useEffect(()=>{j!==A&&x(j)},[j]);const{isLoading:w,chartData:m,totals:b,currencySymbol:N,subscriptionData:p}=ua(s),{data:h,isLoading:u}=ka(s,l,f),v=P.useMemo(()=>{const k=(h?.stats||[]).reduce((_,E)=>{const V=E.post_id||(E.title&&E.title.trim()!==""?E.title:E.attribution_url);if(!V)return _;if(!_.has(V))_.set(V,E);else{const q=_.get(V);q.free_members+=E.free_members,q.paid_members+=E.paid_members,q.mrr+=E.mrr,_.set(V,q)}return _},new Map),y=Array.from(k.values()),D=y.reduce((_,E)=>_+E.free_members,0),O=y.reduce((_,E)=>_+E.paid_members,0),M=y.reduce((_,E)=>_+E.mrr,0);return y.map(_=>{let E=0;return l.includes("free_members")&&D>0?E=_.free_members/D:l.includes("paid_members")&&O>0?E=_.paid_members/O:l.includes("mrr")&&M>0&&(E=_.mrr/M),{title:_.title||_.attribution_url,post_id:_.post_id,attribution_url:_.attribution_url,attribution_type:_.attribution_type,attribution_id:_.attribution_id,free_members:_.free_members,paid_members:_.paid_members,mrr:_.mrr,percentage:E,published_at:_.published_at,url_exists:_.url_exists??!0}})},[h,l]),C=w,S=w||u;return e.jsxs(gt,{children:[e.jsx(vt,{children:e.jsx($t,{children:e.jsx(jt,{})})}),e.jsxs(yt,{data:C?void 0:m,isLoading:!1,loadingComponent:e.jsx(e.Fragment,{}),children:[e.jsx(be,{"data-testid":"total-members-card",children:e.jsx(ge,{children:e.jsx(Sa,{chartData:m,currencySymbol:N,initialTab:j,isLoading:C,totals:b,onTabChange:x})})}),o?.paidMembersEnabled&&A==="paid-members"&&e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2 xl:grid-cols-[2fr_minmax(460px,1fr)]",children:[e.jsx(_a,{isLoading:C,memberData:m,range:s,subscriptionData:p}),e.jsx(Da,{isLoading:C,range:s})]}),e.jsxs(be,{className:"w-full overflow-x-auto","data-testid":"top-content-card",children:[e.jsxs(_e,{children:[e.jsx(ke,{children:Ot(f)}),e.jsx(Pe,{children:Mt(f,s,U)})]}),e.jsx(ge,{children:e.jsxs(Ye,{children:[e.jsx(ze,{children:e.jsxs(K,{className:"[&>th]:h-auto [&>th]:pb-2 [&>th]:pt-0",children:[e.jsx(H,{className:"min-w-[320px] pl-0",children:e.jsx(Ve,{defaultValue:f,variant:"button-sm",onValueChange:d=>{g(d)},children:e.jsxs($e,{children:[e.jsx(me,{value:Q.POSTS_AND_PAGES,children:"Posts & pages"}),e.jsx(me,{value:Q.POSTS,children:"Posts"}),e.jsx(me,{value:Q.PAGES,children:"Pages"}),e.jsx(me,{value:Q.SOURCES,children:"Sources"})]})})}),e.jsx(H,{className:"w-[140px] text-right",children:o?.paidMembersEnabled?e.jsx(te,{activeSortBy:l,setSortBy:i,sortBy:"free_members desc",children:"Free members"}):e.jsx(e.Fragment,{children:"Free members"})}),o?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsx(H,{className:"w-[140px] text-right",children:e.jsx(te,{activeSortBy:l,setSortBy:i,sortBy:"paid_members desc",children:"Paid members"})}),e.jsx(H,{className:"w-[140px] text-right",children:e.jsx(te,{activeSortBy:l,setSortBy:i,sortBy:"mrr desc",children:"MRR impact"})})]})]})}),f===Q.SOURCES?e.jsx(wa,{limit:20,range:s,setSortBy:d=>i(d),showViewAll:!0,sortBy:l}):e.jsx(le,{children:S?e.jsx(K,{className:"last:border-none",children:e.jsx(F,{className:"border-none py-2",colSpan:1,children:e.jsx(Ge,{containerClassName:"space-y-2",count:5,maxWidth:75,randomize:!0})})}):o?.analytics.membersTrackSources?v.length>0?v.map((d,k)=>e.jsxs(K,{className:"last:border-none",children:[e.jsx(F,{children:e.jsxs("div",{className:"group/link inline-flex flex-col items-start gap-px",children:[d.post_id&&d.attribution_type==="post"?e.jsx(Ce,{className:"h-auto whitespace-normal p-0 text-left font-medium leading-tight hover:!underline",title:"View post analytics",variant:"link",onClick:Rt(d.attribution_url,d.post_id,a.url||"",r,d.attribution_type),children:d.title}):e.jsx("span",{className:"font-medium",children:d.title}),d.published_at&&Oe&&new Date(d.published_at).getTime()>0&&e.jsxs("span",{className:"text-muted-foreground",children:["Published on ",Oe(d.published_at,t)]})]})}),e.jsxs(F,{className:"text-right font-mono text-sm",children:[d.free_members>0&&"+",T(d.free_members)]}),o?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs(F,{className:"text-right font-mono text-sm",children:[d.paid_members>0&&"+",T(d.paid_members)]}),e.jsxs(F,{className:"text-right font-mono text-sm",children:[d.mrr>0&&"+",N,T(J(d.mrr))]})]})]},`${f}-${d.post_id||`${d.title}-${k}`}`)):e.jsx(K,{className:"border-none",children:e.jsx(F,{className:"py-12 group-hover:!bg-transparent",colSpan:o?.paidMembersEnabled?4:2,children:e.jsx(ce,{description:"Try adjusting your date range to see more data.",title:`No conversions ${U(s)}`,children:e.jsx(da,{strokeWidth:1.5})})})}):e.jsx(K,{className:"last:border-none",children:e.jsx(F,{className:"border-none py-12 group-hover:!bg-transparent",colSpan:o?.paidMembersEnabled?4:2,children:e.jsx(tt,{})})})})]})})]})]})]})};export{ps as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as v,aq as N,ar as P,j as u,as as S,at as w,au as p,av as x,aw as F,ax as D,ay as T,az as V}from"./index-
|
|
1
|
+
import{r as v,aq as N,ar as P,j as u,as as S,at as w,au as p,av as x,aw as F,ax as D,ay as T,az as V}from"./index-CMTzNTew.js";var g="Tabs",[G]=S(g,[x]),C=x(),[L,m]=G(g),h=v.forwardRef((e,n)=>{const{__scopeTabs:i,value:a,onValueChange:r,defaultValue:c,orientation:t="horizontal",dir:d,activationMode:b="automatic",...f}=e,s=N(d),[o,l]=P({prop:a,onChange:r,defaultProp:c??"",caller:g});return u.jsx(L,{scope:i,baseId:w(),value:o,onValueChange:l,orientation:t,dir:s,activationMode:b,children:u.jsx(p.div,{dir:s,"data-orientation":t,...f,ref:n})})});h.displayName=g;var I="TabsList",R=v.forwardRef((e,n)=>{const{__scopeTabs:i,loop:a=!0,...r}=e,c=m(I,i),t=C(i);return u.jsx(F,{asChild:!0,...t,orientation:c.orientation,dir:c.dir,loop:a,children:u.jsx(p.div,{role:"tablist","aria-orientation":c.orientation,...r,ref:n})})});R.displayName=I;var y="TabsTrigger",_=v.forwardRef((e,n)=>{const{__scopeTabs:i,value:a,disabled:r=!1,...c}=e,t=m(y,i),d=C(i),b=j(t.baseId,a),f=M(t.baseId,a),s=a===t.value;return u.jsx(D,{asChild:!0,...d,focusable:!r,active:s,children:u.jsx(p.button,{type:"button",role:"tab","aria-selected":s,"aria-controls":f,"data-state":s?"active":"inactive","data-disabled":r?"":void 0,disabled:r,id:b,...c,ref:n,onMouseDown:T(e.onMouseDown,o=>{!r&&o.button===0&&o.ctrlKey===!1?t.onValueChange(a):o.preventDefault()}),onKeyDown:T(e.onKeyDown,o=>{[" ","Enter"].includes(o.key)&&t.onValueChange(a)}),onFocus:T(e.onFocus,()=>{const o=t.activationMode!=="manual";!s&&!r&&o&&t.onValueChange(a)})})})});_.displayName=y;var A="TabsContent",E=v.forwardRef((e,n)=>{const{__scopeTabs:i,value:a,forceMount:r,children:c,...t}=e,d=m(A,i),b=j(d.baseId,a),f=M(d.baseId,a),s=a===d.value,o=v.useRef(s);return v.useEffect(()=>{const l=requestAnimationFrame(()=>o.current=!1);return()=>cancelAnimationFrame(l)},[]),u.jsx(V,{present:r||s,children:({present:l})=>u.jsx(p.div,{"data-state":s?"active":"inactive","data-orientation":d.orientation,role:"tabpanel","aria-labelledby":b,hidden:!l,id:f,tabIndex:0,...t,ref:n,style:{...e.style,animationDuration:o.current?"0s":void 0},children:l&&c})})});E.displayName=A;function j(e,n){return`${e}-trigger-${n}`}function M(e,n){return`${e}-content-${n}`}var k=h,K=R,q=_,z=E;export{z as C,K as L,k as R,q as T};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,bV as G,aP as te,bG as se,bW as K,aj as D,j as e,aQ as ee,ai as y,bH as pe,ap as he,bI as xe,bJ as Y,bX as fe,bR as ae,af as Q,ag as $,bY as ge,e as U,bE as be,B as je}from"./index-f5Lv9kLb.js";import{s as ve,g as J,S as ke,a as we,D as Ne,b as Se}from"./stats-view-CTQ4qO3S.js";import{C as ye,a as _e,R as Ce,B as Te}from"./chart-pimL5Chk.js";import{E as re}from"./empty-indicator-CR_9BHAH.js";import{G as De,C as Me,X as Le,Y as Re}from"./gh-chart-hn7wEnik.js";import{T as Ee,a as Be,K as X,d as B,e as Pe}from"./tabs-DCHagOip.js";import{B as Oe,S as H}from"./sort-button-C2M35dLh.js";import{M as ne}from"./wallet-cards-CSdWOmJE.js";import{S as Ae,a as Ve,b as ze,c as He,d as We,e as $e,f as Ge}from"./select-B_0NBkLz.js";import{M as Ke}from"./lucide-react-BARFK2PZ.js";import{j as Fe,C as le,c as ie,a as Ie,b as Ye,f as Xe}from"./pagemenu-DjSqq3Wu.js";import{a as Qe,e as Ue,b as Je,c as W,d as O,f as L}from"./table-Dw9xFlFd.js";import{u as qe}from"./newsletters-D78pgnas.js";import{e as Ze,f as et,g as tt}from"./stats-CRgy_cWm.js";import"./message-square-text-BxquqPhA.js";import"./sprout-BKiwQsGn.js";import"./_baseAssignValue-Bbalamaq.js";import"./index-DO76vL0R.js";import"./a-large-small-CgWPeKpi.js";import"./at-sign-BottTo2X.js";import"./copy-aC0WUVtq.js";import"./hash-BcaWmkw5.js";import"./inbox-D9hID-rO.js";import"./minus-Ziy4LSYD.js";import"./tags-DV2SSdMK.js";import"./square-BEpRc_fY.js";import"./user-round-check-DYkrjHxF.js";import"./repeat-CN4fiG5H.js";import"./reply-BfWgvH7y.js";import"./trash-CpnxYen-.js";const st=({active:a,payload:s})=>{if(!a||!s?.length)return null;const r=s[0].payload,l=r.send_date;return e.jsxs("div",{className:"min-w-[220px] max-w-[240px] rounded-lg border bg-background px-3 py-2 shadow-lg",children:[e.jsxs("div",{className:"mb-2 flex w-full flex-col border-b pb-2",children:[e.jsx("span",{className:"text-sm font-semibold leading-tight",children:r.post_title}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Sent on ",ae(l)]})]}),e.jsxs("div",{className:"mb-1 flex w-full justify-between",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Sent"}),e.jsx("div",{className:"ml-2 w-full text-right font-mono",children:D(r.sent_to)})]}),e.jsxs("div",{className:"mb-1 flex w-full justify-between",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Opens"}),e.jsxs("div",{className:"ml-2 w-full text-right font-mono",children:[e.jsxs("span",{className:"text-muted-foreground",children:[D(r.total_opens)," / "]}),y(r.open_rate)]})]}),e.jsxs("div",{className:"mb-1 flex w-full justify-between",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Clicks"}),e.jsxs("div",{className:"ml-2 w-full text-right font-mono",children:[e.jsxs("span",{className:"text-muted-foreground",children:[D(r.total_clicks)," / "]}),y(r.click_rate)]})]})]})},at=({subscribersData:a,avgsData:s,totals:r,isLoading:l,isAvgsLoading:t,initialTab:i="total-subscribers"})=>{const[n,h]=c.useState(i),[p,j]=c.useState(!1),{range:u}=G(),w=te(),[g]=se(),{appSettings:N}=K(),{emailTrackClicks:v,emailTrackOpens:S}=N?.analytics||{},{totalSubscribers:R,avgOpenRate:m,avgClickRate:d}=r,f=c.useMemo(()=>{if(!a||a.length===0)return[];let o=[];return o=ve(a,u,"value","exact"),o.map(M=>({...M,formattedValue:D(M.value),label:"Total Subscribers"}))},[a,u]),_=c.useMemo(()=>{if(!f||f.length<=1)return{direction:"same",value:"0%"};const o=f[0]?.value??0,k=f[f.length-1]?.value??0;let M="same";k>o?M="up":k<o&&(M="down");let P;if(o===0)P=k===0?"0%":"+100%";else{const A=(k-o)/o*100,V=Math.round(A*10)/10;P=`${A>=0?"+":""}${V}%`}return{direction:M,value:P}},[f]);c.useEffect(()=>{h(i)},[i]);const x=o=>{h(o);const k=new URLSearchParams(g);k.set("tab",o),w(`?${k.toString()}`,{replace:!0})},C={open_rate:{label:"Open rate"}},b=c.useMemo(()=>({"total-subscribers":{color:"hsl(var(--chart-darkblue))",datakey:"value"},"avg-open-rate":{color:"hsl(var(--chart-blue))",datakey:"open_rate"},"avg-click-rate":{color:"hsl(var(--chart-teal))",datakey:"click_rate"}}),[]),{barDomain:T,barTicks:E}=c.useMemo(()=>{if(!s||s.length===0||n==="total-subscribers")return{barDomain:[0,1],barTicks:[0,1]};const o=b[n]?.datakey;if(!o)return{barDomain:[0,1],barTicks:[0,1]};const k=s.map(I=>I[o]).filter(I=>typeof I=="number");if(k.length===0)return{barDomain:[0,1],barTicks:[0,1]};const M=Math.min(...k),P=Math.max(...k),A=Math.floor(M*10)/10,V=Math.ceil(P*10)/10,z=Math.max(0,A),Z=V===z?z+.1:V;return{barDomain:[z,Z],barTicks:[z,Z]}},[s,n,b]);if(l)return e.jsx("div",{className:"-mb-6 flex h-[calc(16vw+132px)] w-full items-start justify-center",children:e.jsx(ee,{})});let F="grid-cols-3";(!v||!S)&&(F="grid-cols-2"),!v&&!S&&(F="grid-cols-1");const ue=n==="avg-open-rate"&&m>T[0]&&m<T[1]||n==="avg-click-rate"&&d>T[0]&&d<T[1],q=n==="avg-open-rate"?m:d;return e.jsxs(Ee,{defaultValue:i,variant:"kpis",children:[e.jsxs(Be,{className:`-mx-6 hidden grid-cols-3 md:!visible md:!grid ${F}`,children:[e.jsx(X,{className:`${!S&&!v&&"cursor-auto after:hidden"}`,value:"total-subscribers",onClick:()=>{x("total-subscribers")},children:e.jsx(B,{color:b["total-subscribers"].color,"data-testid":"total-subscribers-value",diffDirection:_.direction,diffValue:_.value,label:"Total subscribers",value:D(R)})}),S&&e.jsx(X,{value:"avg-open-rate",onClick:()=>{x("avg-open-rate")},children:e.jsx(B,{className:t?"opacity-50":"",color:b["avg-open-rate"].color,label:"Avg. open rate",value:y(m)})}),v&&e.jsx(X,{value:"avg-click-rate",onClick:()=>{x("avg-click-rate")},children:e.jsx(B,{className:t?"opacity-50":"",color:b["avg-click-rate"].color,label:"Avg. click rate",value:y(d)})})]}),e.jsxs(pe,{children:[e.jsx(he,{className:"md:hidden",asChild:!0,children:e.jsxs(Pe,{children:[n==="total-subscribers"&&e.jsx(B,{color:b["total-subscribers"].color,label:"Total subscribers",value:D(R)}),n==="avg-open-rate"&&S&&e.jsx(B,{className:t?"opacity-50":"",color:b["avg-open-rate"].color,label:"Avg. open rate",value:y(m)}),n==="avg-click-rate"&&v&&e.jsx(B,{className:t?"opacity-50":"",color:b["avg-click-rate"].color,label:"Avg. click rate",value:y(d)})]})}),e.jsxs(xe,{align:"end",className:"w-56",children:[e.jsx(Y,{onClick:()=>x("total-subscribers"),children:"Total subscribers"}),S&&e.jsx(Y,{onClick:()=>x("avg-open-rate"),children:"Avg. open rate"}),v&&e.jsx(Y,{onClick:()=>x("avg-click-rate"),children:"Avg. click rate"})]})]}),e.jsxs("div",{className:"my-4 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500",children:[n==="total-subscribers"&&e.jsx(De,{className:"-mb-3 h-[16vw] max-h-[320px] min-h-[180px] w-full",color:b["total-subscribers"].color,data:f,id:"mrr",range:u}),(n==="avg-open-rate"&&S||n==="avg-click-rate"&&v)&&e.jsx(e.Fragment,{children:t?e.jsx("div",{className:"h-[320px] w-full items-center justify-center",children:e.jsx(ee,{})}):s&&s.length>0?e.jsxs(e.Fragment,{children:[e.jsx(ye,{className:"aspect-auto h-[200px] w-full md:h-[220px] xl:h-[320px]",config:C,children:e.jsxs(Oe,{className:p?"!cursor-pointer":"",data:s,margin:{top:20},onClick:o=>{o.activePayload&&o.activePayload[0].payload.post_id&&w(`/posts/analytics/${o.activePayload[0].payload.post_id}`,{crossApp:!0})},onMouseLeave:()=>j(!1),onMouseMove:o=>{j(!!(o.activePayload&&o.activePayload[0].payload.post_id))},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"barGradient",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:b[n].color,stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:b[n].color,stopOpacity:.6})]})}),e.jsx(Me,{horizontal:!0,stroke:"hsl(var(--border))",vertical:!1}),e.jsx(Le,{axisLine:{stroke:"hsl(var(--border))",strokeWidth:1},dataKey:"post_id",interval:0,stroke:"hsl(var(--border))",tickFormatter:()=>"",tickLine:!1,tickMargin:10}),e.jsx(Re,{axisLine:!1,domain:T,tickFormatter:o=>y(o),tickLine:!1,ticks:E,width:fe(E,o=>y(o))}),e.jsx(_e,{content:e.jsx(st,{}),cursor:!1,isAnimationActive:!1,position:{y:10}}),ue&&e.jsx(Ce,{label:{value:`${y(q)}`,position:"left",offset:8,fill:"hsl(var(--muted-foreground))"},opacity:.5,stroke:"hsl(var(--muted-foreground))",strokeDasharray:"4 4",y:q}),e.jsx(Te,{activeBar:{fillOpacity:1},dataKey:b[n].datakey,fill:"url(#barGradient)",fillOpacity:.6,isAnimationActive:!1,maxBarSize:32,minPointSize:3,radius:4})]})}),e.jsxs("div",{className:"-mt-4 text-center text-sm text-muted-foreground",children:["Newsletters ",n==="avg-open-rate"?"opens":"clicks"," in this period"]})]}):e.jsx(re,{className:"size-full py-20",title:`No newsletters ${J(u)}`,children:e.jsx(ne,{strokeWidth:1.5})})})]})]})},rt=({newsletters:a})=>{const{selectedNewsletterId:s,setSelectedNewsletterId:r}=G(),l=c.useMemo(()=>a?.filter(t=>t.status==="active")||[],[a]);return c.useEffect(()=>{if(l.length>0&&!s){const t=l.find(i=>i.sort_order===0);r(t?t.id:l[0].id)}},[l,s,r]),l.length<=1?null:e.jsxs(Ae,{value:s||"",onValueChange:t=>{r(t)},children:[e.jsxs(Ve,{className:"w-auto",children:[e.jsx(Ke,{className:"mr-2",size:16,strokeWidth:1.5}),e.jsx(ze,{placeholder:"Select a newsletter"})]}),e.jsx(He,{align:"end",children:e.jsxs(We,{children:[e.jsx($e,{children:"Newsletters"}),l.map(t=>e.jsx(Ge,{value:t.id,children:t.name},t.id))]})})]})},nt=(a,s,r=!0)=>{const l=a??30,{startDate:t,endDate:i}=c.useMemo(()=>Q(l),[l]),n=c.useMemo(()=>{const p={date_from:$(t),date_to:$(i)};return s&&(p.newsletter_id=s),p},[t,i,s]),h=Ze({searchParams:n,enabled:r});return r?h:{data:void 0,isLoading:!1,error:null,isError:!1,refetch:h.refetch}},lt=(a,s,r,l=!0)=>{const t=a??30,i=s??"date desc",{startDate:n,endDate:h}=c.useMemo(()=>Q(t),[t]),p=c.useMemo(()=>{const u={date_from:$(n),date_to:$(h),order:i};return r&&(u.newsletter_id=r),u},[n,h,i,r]),j=et({searchParams:p,enabled:l});return l?j:{data:void 0,isLoading:!1,error:null,isError:!1,refetch:j.refetch}},it=(a,s=[],r=!0)=>{const l=c.useMemo(()=>{const i={};return a&&(i.newsletter_id=a),s.length>0&&(i.post_ids=s.join(",")),i},[a,s]),t=tt({searchParams:l,enabled:r});return r?t:{data:void 0,isLoading:!1,error:null,isError:!1,refetch:t.refetch}},oe=(a,s,r,l=!0)=>{const t=lt(a,s,r,l),i=c.useMemo(()=>t.data?.stats?t.data.stats.map(p=>p.post_id):[],[t.data]),n=it(r,i,l&&i.length>0);return{data:c.useMemo(()=>{if(!t.data?.stats)return;const p=t.data.stats,j=n.data?.stats||[],u=new Map;j.forEach(g=>{u.set(g.post_id,g)});const w=p.map(g=>{const N=u.get(g.post_id);return{...g,total_clicks:N?.total_clicks||0,click_rate:N?.click_rate||0}});return{...t.data,stats:w}},[t.data,n.data]),isLoading:t.isLoading,isClicksLoading:n.isLoading,error:t.error||n.error,isError:t.isError||n.isError,refetch:()=>{t.refetch(),n.refetch()}}},ce=U.memo(({range:a,selectedNewsletterId:s,shouldFetchStats:r,sortBy:l})=>{const t=te(),{settings:i}=G(),n=String(i.find(m=>m.key==="timezone")?.value||"Etc/UTC"),{data:h,isLoading:p,isClicksLoading:j}=oe(a,l,s||void 0,!!r),{appSettings:u}=K(),{emailTrackClicks:w,emailTrackOpens:g}=u?.analytics||{},N=c.useMemo(()=>h?.stats||[],[h]),v=g&&w?5:g||w?4:3,S=c.useMemo(()=>e.jsx(e.Fragment,{children:e.jsx(W,{className:"last:border-none [&>td]:py-2.5",children:e.jsx(L,{className:"font-medium",colSpan:v,children:e.jsx(be,{className:"mt-5"})})})}),[v]),R=c.useMemo(()=>N.length>0?e.jsx(e.Fragment,{children:N.map(m=>e.jsxs(W,{className:"last:border-none [&>td]:py-2.5",children:[e.jsx(L,{className:"font-medium",children:e.jsx("div",{className:"group/link inline-flex items-center gap-2",children:m.post_id?e.jsx(je,{className:"h-auto whitespace-normal p-0 text-left hover:!underline",title:"View post analytics",variant:"link",onClick:()=>{t(`/posts/analytics/${m.post_id}/`,{crossApp:!0})},children:m.post_title}):e.jsx(e.Fragment,{children:m.post_title})})}),e.jsx(L,{className:"whitespace-nowrap text-sm",children:ae(m.send_date,n)}),e.jsx(L,{className:"text-right font-mono text-sm",children:D(m.sent_to)}),g&&e.jsxs(L,{className:"text-right font-mono text-sm",children:[e.jsx("span",{className:"group-hover:hidden",children:y(m.open_rate)}),e.jsx("span",{className:"hidden group-hover:!visible group-hover:!block",children:D(m.total_opens)})]}),w&&e.jsx(L,{className:"text-right font-mono text-sm",children:j?e.jsx("span",{className:"inline-block h-4 w-8 animate-pulse rounded bg-gray-200"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"group-hover:hidden",children:y(m.click_rate)}),e.jsx("span",{className:"hidden group-hover:!visible group-hover:!block",children:D(m.total_clicks)})]})})]},m.post_id))}):e.jsx(W,{className:"border-none hover:bg-transparent",children:e.jsx(L,{className:"text-center group-hover:!bg-transparent",colSpan:5,children:e.jsx(re,{className:"size-full py-20",title:`No newsletters ${J(a)}`,children:e.jsx(ne,{strokeWidth:1.5})})})}),[N,j,t,w,g,a]);return p||!h?S:R});ce.displayName="NewsletterTableRows";const de=U.memo(({sortBy:a,setSortBy:s,range:r})=>{const l=c.useMemo(()=>e.jsxs(Ie,{children:[e.jsx(Ye,{children:"Top newsletters"}),e.jsxs(Xe,{children:[" Your best performing newsletters ",J(r)]})]}),[r]),{appSettings:t}=K(),{emailTrackClicks:i,emailTrackOpens:n}=t?.analytics||{};return e.jsx(Je,{children:e.jsxs(W,{children:[e.jsx(O,{className:"min-w-[320px]",variant:"cardhead",children:l}),e.jsx(O,{className:"w-[65px]",children:e.jsx(H,{activeSortBy:a,setSortBy:s,sortBy:"date desc",children:"Date"})}),e.jsx(O,{className:"w-[90px] text-right",children:e.jsx(H,{activeSortBy:a,setSortBy:s,sortBy:"sent_to desc",children:"Sent"})}),n&&e.jsx(O,{className:"w-[90px] text-right",children:e.jsx(H,{activeSortBy:a,setSortBy:s,sortBy:"open_rate desc",children:"Opens"})}),i&&e.jsx(O,{className:"w-[90px] text-right",children:e.jsx(H,{activeSortBy:a,setSortBy:s,sortBy:"click_rate desc",children:"Clicks"})})]})})});de.displayName="NewsletterTableHeader";const me=U.memo(({range:a,selectedNewsletterId:s,shouldFetchStats:r})=>{const[l,t]=c.useState("open_rate desc");return e.jsx(le,{className:"w-full max-w-[calc(100vw-64px)] overflow-x-auto sidebar:max-w-[calc(100vw-64px-280px)]","data-testid":"top-newsletters-card",children:e.jsx(ie,{children:e.jsxs(Qe,{children:[e.jsx(de,{range:a,setSortBy:t,sortBy:l}),e.jsx(Ue,{children:e.jsx(ce,{range:a,selectedNewsletterId:s,shouldFetchStats:r,sortBy:l})})]})})})});me.displayName="TopNewslettersTable";const Vt=()=>{const{range:a,selectedNewsletterId:s}=G(),[r]=se(),{appSettings:l}=K(),t=r.get("tab")||"total-subscribers",{data:i,isLoading:n}=qe({searchParams:{limit:"50"}}),h=!n&&i&&i.newsletters.length>0&&!!s,{data:p,isLoading:j}=nt(a,s||void 0,h||!1),{data:u,isLoading:w,isClicksLoading:g}=oe(a,"date asc",s||void 0,h||!1),N=c.useMemo(()=>!i?.newsletters||!s?null:i.newsletters.find(d=>d.id===s)||null,[i,s]),v=c.useMemo(()=>{const d=N?.count?.active_members||p?.stats?.[0]?.total||0;let f=0,_=0;if(u?.stats&&u.stats.length>0){const x=u.stats,C=x.reduce((T,E)=>T+(E.open_rate||0),0),b=x.reduce((T,E)=>T+(E.click_rate||0),0);f=C/x.length,_=b/x.length}return{totalSubscribers:d,avgOpenRate:f,avgClickRate:_}},[N,p,u]),S=c.useMemo(()=>{if(!p?.stats?.[0]?.values||p.stats[0].values.length===0){const{startDate:f,endDate:_}=Q(a),x=[],C=new Date(f);for(;C<=_;)x.push({date:C.toISOString().split("T")[0],value:0}),C.setDate(C.getDate()+1);return x}const d=p.stats[0].values;if(d.length===1){const f=d[0],_=new Date,x=a,C=new Date(_.getTime()-x*24*60*60*1e3);return[{...f,date:C.toISOString().split("T")[0]},{...f,date:_.toISOString().split("T")[0]}]}return d},[p,a]),R=c.useMemo(()=>u?.stats?u.stats.map(d=>({post_id:d.post_id,post_title:d.post_title,send_date:d.send_date,sent_to:d.sent_to,total_opens:d.total_opens,open_rate:d.open_rate,total_clicks:d.total_clicks||0,click_rate:d.click_rate||0})):[],[u]),m=j||g||w;return l&&!l.newslettersEnabled?e.jsx(ge,{to:"/analytics"}):e.jsxs(ke,{children:[e.jsx(we,{children:e.jsxs(Fe,{children:[e.jsx(rt,{newsletters:i?.newsletters}),e.jsx(Ne,{})]})}),e.jsx(Se,{isLoading:!1,loadingComponent:e.jsx(e.Fragment,{}),children:e.jsxs(e.Fragment,{children:[e.jsx(le,{"data-testid":"newsletters-card",children:e.jsx(ie,{children:e.jsx(at,{avgsData:R,initialTab:t,isAvgsLoading:!1,isLoading:m,subscribersData:S,totals:v})})}),e.jsx(me,{range:a,selectedNewsletterId:s,shouldFetchStats:!!h})]})})]})};export{Vt as default};
|
|
1
|
+
import{r as c,bV as G,aP as te,bG as se,bW as K,aj as D,j as e,aQ as ee,ai as y,bH as pe,ap as he,bI as xe,bJ as Y,bX as fe,bR as ae,af as Q,ag as $,bY as ge,e as U,bE as be,B as je}from"./index-CMTzNTew.js";import{s as ve,g as J,S as ke,a as we,D as Ne,b as Se}from"./stats-view-CESy8ELH.js";import{C as ye,a as _e,R as Ce,B as Te}from"./chart-mYz3IJwm.js";import{E as re}from"./empty-indicator-Bn5wG9-T.js";import{G as De,C as Me,X as Le,Y as Re}from"./gh-chart-Br7NXn_b.js";import{T as Ee,a as Be,K as X,d as B,e as Pe}from"./tabs-BmdL0X4U.js";import{B as Oe,S as H}from"./sort-button-BNW3i4Lb.js";import{M as ne}from"./wallet-cards-KmOh29LP.js";import{S as Ae,a as Ve,b as ze,c as He,d as We,e as $e,f as Ge}from"./select-Cor2wFXT.js";import{M as Ke}from"./lucide-react-CBigk-fq.js";import{j as Fe,C as le,c as ie,a as Ie,b as Ye,f as Xe}from"./pagemenu-CZyroidv.js";import{a as Qe,e as Ue,b as Je,c as W,d as O,f as L}from"./table-BQUcKHfm.js";import{u as qe}from"./newsletters-BexdXUhn.js";import{e as Ze,f as et,g as tt}from"./stats-2Jelnn-Q.js";import"./message-square-text-cV8O_qKq.js";import"./sprout-C3cc0c-K.js";import"./_baseAssignValue-DnkbkowM.js";import"./index-D212VvOz.js";import"./a-large-small-C5mgFBRg.js";import"./at-sign-Bz-SU-S_.js";import"./copy-Bpq3uhnh.js";import"./hash-Bc1e38oH.js";import"./inbox-BcZNBNhk.js";import"./minus-NvnQTlW7.js";import"./tags-CLxXZlOO.js";import"./square-tZp0_n7e.js";import"./user-round-check-B6j98D6d.js";import"./repeat-DgH39UKE.js";import"./reply-DAaNxiy8.js";import"./trash-u5BxolyH.js";const st=({active:a,payload:s})=>{if(!a||!s?.length)return null;const r=s[0].payload,l=r.send_date;return e.jsxs("div",{className:"min-w-[220px] max-w-[240px] rounded-lg border bg-background px-3 py-2 shadow-lg",children:[e.jsxs("div",{className:"mb-2 flex w-full flex-col border-b pb-2",children:[e.jsx("span",{className:"text-sm font-semibold leading-tight",children:r.post_title}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["Sent on ",ae(l)]})]}),e.jsxs("div",{className:"mb-1 flex w-full justify-between",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Sent"}),e.jsx("div",{className:"ml-2 w-full text-right font-mono",children:D(r.sent_to)})]}),e.jsxs("div",{className:"mb-1 flex w-full justify-between",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Opens"}),e.jsxs("div",{className:"ml-2 w-full text-right font-mono",children:[e.jsxs("span",{className:"text-muted-foreground",children:[D(r.total_opens)," / "]}),y(r.open_rate)]})]}),e.jsxs("div",{className:"mb-1 flex w-full justify-between",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Clicks"}),e.jsxs("div",{className:"ml-2 w-full text-right font-mono",children:[e.jsxs("span",{className:"text-muted-foreground",children:[D(r.total_clicks)," / "]}),y(r.click_rate)]})]})]})},at=({subscribersData:a,avgsData:s,totals:r,isLoading:l,isAvgsLoading:t,initialTab:i="total-subscribers"})=>{const[n,h]=c.useState(i),[p,j]=c.useState(!1),{range:u}=G(),w=te(),[g]=se(),{appSettings:N}=K(),{emailTrackClicks:v,emailTrackOpens:S}=N?.analytics||{},{totalSubscribers:R,avgOpenRate:m,avgClickRate:d}=r,f=c.useMemo(()=>{if(!a||a.length===0)return[];let o=[];return o=ve(a,u,"value","exact"),o.map(M=>({...M,formattedValue:D(M.value),label:"Total Subscribers"}))},[a,u]),_=c.useMemo(()=>{if(!f||f.length<=1)return{direction:"same",value:"0%"};const o=f[0]?.value??0,k=f[f.length-1]?.value??0;let M="same";k>o?M="up":k<o&&(M="down");let P;if(o===0)P=k===0?"0%":"+100%";else{const A=(k-o)/o*100,V=Math.round(A*10)/10;P=`${A>=0?"+":""}${V}%`}return{direction:M,value:P}},[f]);c.useEffect(()=>{h(i)},[i]);const x=o=>{h(o);const k=new URLSearchParams(g);k.set("tab",o),w(`?${k.toString()}`,{replace:!0})},C={open_rate:{label:"Open rate"}},b=c.useMemo(()=>({"total-subscribers":{color:"hsl(var(--chart-darkblue))",datakey:"value"},"avg-open-rate":{color:"hsl(var(--chart-blue))",datakey:"open_rate"},"avg-click-rate":{color:"hsl(var(--chart-teal))",datakey:"click_rate"}}),[]),{barDomain:T,barTicks:E}=c.useMemo(()=>{if(!s||s.length===0||n==="total-subscribers")return{barDomain:[0,1],barTicks:[0,1]};const o=b[n]?.datakey;if(!o)return{barDomain:[0,1],barTicks:[0,1]};const k=s.map(I=>I[o]).filter(I=>typeof I=="number");if(k.length===0)return{barDomain:[0,1],barTicks:[0,1]};const M=Math.min(...k),P=Math.max(...k),A=Math.floor(M*10)/10,V=Math.ceil(P*10)/10,z=Math.max(0,A),Z=V===z?z+.1:V;return{barDomain:[z,Z],barTicks:[z,Z]}},[s,n,b]);if(l)return e.jsx("div",{className:"-mb-6 flex h-[calc(16vw+132px)] w-full items-start justify-center",children:e.jsx(ee,{})});let F="grid-cols-3";(!v||!S)&&(F="grid-cols-2"),!v&&!S&&(F="grid-cols-1");const ue=n==="avg-open-rate"&&m>T[0]&&m<T[1]||n==="avg-click-rate"&&d>T[0]&&d<T[1],q=n==="avg-open-rate"?m:d;return e.jsxs(Ee,{defaultValue:i,variant:"kpis",children:[e.jsxs(Be,{className:`-mx-6 hidden grid-cols-3 md:!visible md:!grid ${F}`,children:[e.jsx(X,{className:`${!S&&!v&&"cursor-auto after:hidden"}`,value:"total-subscribers",onClick:()=>{x("total-subscribers")},children:e.jsx(B,{color:b["total-subscribers"].color,"data-testid":"total-subscribers-value",diffDirection:_.direction,diffValue:_.value,label:"Total subscribers",value:D(R)})}),S&&e.jsx(X,{value:"avg-open-rate",onClick:()=>{x("avg-open-rate")},children:e.jsx(B,{className:t?"opacity-50":"",color:b["avg-open-rate"].color,label:"Avg. open rate",value:y(m)})}),v&&e.jsx(X,{value:"avg-click-rate",onClick:()=>{x("avg-click-rate")},children:e.jsx(B,{className:t?"opacity-50":"",color:b["avg-click-rate"].color,label:"Avg. click rate",value:y(d)})})]}),e.jsxs(pe,{children:[e.jsx(he,{className:"md:hidden",asChild:!0,children:e.jsxs(Pe,{children:[n==="total-subscribers"&&e.jsx(B,{color:b["total-subscribers"].color,label:"Total subscribers",value:D(R)}),n==="avg-open-rate"&&S&&e.jsx(B,{className:t?"opacity-50":"",color:b["avg-open-rate"].color,label:"Avg. open rate",value:y(m)}),n==="avg-click-rate"&&v&&e.jsx(B,{className:t?"opacity-50":"",color:b["avg-click-rate"].color,label:"Avg. click rate",value:y(d)})]})}),e.jsxs(xe,{align:"end",className:"w-56",children:[e.jsx(Y,{onClick:()=>x("total-subscribers"),children:"Total subscribers"}),S&&e.jsx(Y,{onClick:()=>x("avg-open-rate"),children:"Avg. open rate"}),v&&e.jsx(Y,{onClick:()=>x("avg-click-rate"),children:"Avg. click rate"})]})]}),e.jsxs("div",{className:"my-4 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500",children:[n==="total-subscribers"&&e.jsx(De,{className:"-mb-3 h-[16vw] max-h-[320px] min-h-[180px] w-full",color:b["total-subscribers"].color,data:f,id:"mrr",range:u}),(n==="avg-open-rate"&&S||n==="avg-click-rate"&&v)&&e.jsx(e.Fragment,{children:t?e.jsx("div",{className:"h-[320px] w-full items-center justify-center",children:e.jsx(ee,{})}):s&&s.length>0?e.jsxs(e.Fragment,{children:[e.jsx(ye,{className:"aspect-auto h-[200px] w-full md:h-[220px] xl:h-[320px]",config:C,children:e.jsxs(Oe,{className:p?"!cursor-pointer":"",data:s,margin:{top:20},onClick:o=>{o.activePayload&&o.activePayload[0].payload.post_id&&w(`/posts/analytics/${o.activePayload[0].payload.post_id}`,{crossApp:!0})},onMouseLeave:()=>j(!1),onMouseMove:o=>{j(!!(o.activePayload&&o.activePayload[0].payload.post_id))},children:[e.jsx("defs",{children:e.jsxs("linearGradient",{id:"barGradient",x1:"0",x2:"0",y1:"0",y2:"1",children:[e.jsx("stop",{offset:"0%",stopColor:b[n].color,stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:b[n].color,stopOpacity:.6})]})}),e.jsx(Me,{horizontal:!0,stroke:"hsl(var(--border))",vertical:!1}),e.jsx(Le,{axisLine:{stroke:"hsl(var(--border))",strokeWidth:1},dataKey:"post_id",interval:0,stroke:"hsl(var(--border))",tickFormatter:()=>"",tickLine:!1,tickMargin:10}),e.jsx(Re,{axisLine:!1,domain:T,tickFormatter:o=>y(o),tickLine:!1,ticks:E,width:fe(E,o=>y(o))}),e.jsx(_e,{content:e.jsx(st,{}),cursor:!1,isAnimationActive:!1,position:{y:10}}),ue&&e.jsx(Ce,{label:{value:`${y(q)}`,position:"left",offset:8,fill:"hsl(var(--muted-foreground))"},opacity:.5,stroke:"hsl(var(--muted-foreground))",strokeDasharray:"4 4",y:q}),e.jsx(Te,{activeBar:{fillOpacity:1},dataKey:b[n].datakey,fill:"url(#barGradient)",fillOpacity:.6,isAnimationActive:!1,maxBarSize:32,minPointSize:3,radius:4})]})}),e.jsxs("div",{className:"-mt-4 text-center text-sm text-muted-foreground",children:["Newsletters ",n==="avg-open-rate"?"opens":"clicks"," in this period"]})]}):e.jsx(re,{className:"size-full py-20",title:`No newsletters ${J(u)}`,children:e.jsx(ne,{strokeWidth:1.5})})})]})]})},rt=({newsletters:a})=>{const{selectedNewsletterId:s,setSelectedNewsletterId:r}=G(),l=c.useMemo(()=>a?.filter(t=>t.status==="active")||[],[a]);return c.useEffect(()=>{if(l.length>0&&!s){const t=l.find(i=>i.sort_order===0);r(t?t.id:l[0].id)}},[l,s,r]),l.length<=1?null:e.jsxs(Ae,{value:s||"",onValueChange:t=>{r(t)},children:[e.jsxs(Ve,{className:"w-auto",children:[e.jsx(Ke,{className:"mr-2",size:16,strokeWidth:1.5}),e.jsx(ze,{placeholder:"Select a newsletter"})]}),e.jsx(He,{align:"end",children:e.jsxs(We,{children:[e.jsx($e,{children:"Newsletters"}),l.map(t=>e.jsx(Ge,{value:t.id,children:t.name},t.id))]})})]})},nt=(a,s,r=!0)=>{const l=a??30,{startDate:t,endDate:i}=c.useMemo(()=>Q(l),[l]),n=c.useMemo(()=>{const p={date_from:$(t),date_to:$(i)};return s&&(p.newsletter_id=s),p},[t,i,s]),h=Ze({searchParams:n,enabled:r});return r?h:{data:void 0,isLoading:!1,error:null,isError:!1,refetch:h.refetch}},lt=(a,s,r,l=!0)=>{const t=a??30,i=s??"date desc",{startDate:n,endDate:h}=c.useMemo(()=>Q(t),[t]),p=c.useMemo(()=>{const u={date_from:$(n),date_to:$(h),order:i};return r&&(u.newsletter_id=r),u},[n,h,i,r]),j=et({searchParams:p,enabled:l});return l?j:{data:void 0,isLoading:!1,error:null,isError:!1,refetch:j.refetch}},it=(a,s=[],r=!0)=>{const l=c.useMemo(()=>{const i={};return a&&(i.newsletter_id=a),s.length>0&&(i.post_ids=s.join(",")),i},[a,s]),t=tt({searchParams:l,enabled:r});return r?t:{data:void 0,isLoading:!1,error:null,isError:!1,refetch:t.refetch}},oe=(a,s,r,l=!0)=>{const t=lt(a,s,r,l),i=c.useMemo(()=>t.data?.stats?t.data.stats.map(p=>p.post_id):[],[t.data]),n=it(r,i,l&&i.length>0);return{data:c.useMemo(()=>{if(!t.data?.stats)return;const p=t.data.stats,j=n.data?.stats||[],u=new Map;j.forEach(g=>{u.set(g.post_id,g)});const w=p.map(g=>{const N=u.get(g.post_id);return{...g,total_clicks:N?.total_clicks||0,click_rate:N?.click_rate||0}});return{...t.data,stats:w}},[t.data,n.data]),isLoading:t.isLoading,isClicksLoading:n.isLoading,error:t.error||n.error,isError:t.isError||n.isError,refetch:()=>{t.refetch(),n.refetch()}}},ce=U.memo(({range:a,selectedNewsletterId:s,shouldFetchStats:r,sortBy:l})=>{const t=te(),{settings:i}=G(),n=String(i.find(m=>m.key==="timezone")?.value||"Etc/UTC"),{data:h,isLoading:p,isClicksLoading:j}=oe(a,l,s||void 0,!!r),{appSettings:u}=K(),{emailTrackClicks:w,emailTrackOpens:g}=u?.analytics||{},N=c.useMemo(()=>h?.stats||[],[h]),v=g&&w?5:g||w?4:3,S=c.useMemo(()=>e.jsx(e.Fragment,{children:e.jsx(W,{className:"last:border-none [&>td]:py-2.5",children:e.jsx(L,{className:"font-medium",colSpan:v,children:e.jsx(be,{className:"mt-5"})})})}),[v]),R=c.useMemo(()=>N.length>0?e.jsx(e.Fragment,{children:N.map(m=>e.jsxs(W,{className:"last:border-none [&>td]:py-2.5",children:[e.jsx(L,{className:"font-medium",children:e.jsx("div",{className:"group/link inline-flex items-center gap-2",children:m.post_id?e.jsx(je,{className:"h-auto whitespace-normal p-0 text-left hover:!underline",title:"View post analytics",variant:"link",onClick:()=>{t(`/posts/analytics/${m.post_id}/`,{crossApp:!0})},children:m.post_title}):e.jsx(e.Fragment,{children:m.post_title})})}),e.jsx(L,{className:"whitespace-nowrap text-sm",children:ae(m.send_date,n)}),e.jsx(L,{className:"text-right font-mono text-sm",children:D(m.sent_to)}),g&&e.jsxs(L,{className:"text-right font-mono text-sm",children:[e.jsx("span",{className:"group-hover:hidden",children:y(m.open_rate)}),e.jsx("span",{className:"hidden group-hover:!visible group-hover:!block",children:D(m.total_opens)})]}),w&&e.jsx(L,{className:"text-right font-mono text-sm",children:j?e.jsx("span",{className:"inline-block h-4 w-8 animate-pulse rounded bg-gray-200"}):e.jsxs(e.Fragment,{children:[e.jsx("span",{className:"group-hover:hidden",children:y(m.click_rate)}),e.jsx("span",{className:"hidden group-hover:!visible group-hover:!block",children:D(m.total_clicks)})]})})]},m.post_id))}):e.jsx(W,{className:"border-none hover:bg-transparent",children:e.jsx(L,{className:"text-center group-hover:!bg-transparent",colSpan:5,children:e.jsx(re,{className:"size-full py-20",title:`No newsletters ${J(a)}`,children:e.jsx(ne,{strokeWidth:1.5})})})}),[N,j,t,w,g,a]);return p||!h?S:R});ce.displayName="NewsletterTableRows";const de=U.memo(({sortBy:a,setSortBy:s,range:r})=>{const l=c.useMemo(()=>e.jsxs(Ie,{children:[e.jsx(Ye,{children:"Top newsletters"}),e.jsxs(Xe,{children:[" Your best performing newsletters ",J(r)]})]}),[r]),{appSettings:t}=K(),{emailTrackClicks:i,emailTrackOpens:n}=t?.analytics||{};return e.jsx(Je,{children:e.jsxs(W,{children:[e.jsx(O,{className:"min-w-[320px]",variant:"cardhead",children:l}),e.jsx(O,{className:"w-[65px]",children:e.jsx(H,{activeSortBy:a,setSortBy:s,sortBy:"date desc",children:"Date"})}),e.jsx(O,{className:"w-[90px] text-right",children:e.jsx(H,{activeSortBy:a,setSortBy:s,sortBy:"sent_to desc",children:"Sent"})}),n&&e.jsx(O,{className:"w-[90px] text-right",children:e.jsx(H,{activeSortBy:a,setSortBy:s,sortBy:"open_rate desc",children:"Opens"})}),i&&e.jsx(O,{className:"w-[90px] text-right",children:e.jsx(H,{activeSortBy:a,setSortBy:s,sortBy:"click_rate desc",children:"Clicks"})})]})})});de.displayName="NewsletterTableHeader";const me=U.memo(({range:a,selectedNewsletterId:s,shouldFetchStats:r})=>{const[l,t]=c.useState("open_rate desc");return e.jsx(le,{className:"w-full max-w-[calc(100vw-64px)] overflow-x-auto sidebar:max-w-[calc(100vw-64px-280px)]","data-testid":"top-newsletters-card",children:e.jsx(ie,{children:e.jsxs(Qe,{children:[e.jsx(de,{range:a,setSortBy:t,sortBy:l}),e.jsx(Ue,{children:e.jsx(ce,{range:a,selectedNewsletterId:s,shouldFetchStats:r,sortBy:l})})]})})})});me.displayName="TopNewslettersTable";const Vt=()=>{const{range:a,selectedNewsletterId:s}=G(),[r]=se(),{appSettings:l}=K(),t=r.get("tab")||"total-subscribers",{data:i,isLoading:n}=qe({searchParams:{limit:"50"}}),h=!n&&i&&i.newsletters.length>0&&!!s,{data:p,isLoading:j}=nt(a,s||void 0,h||!1),{data:u,isLoading:w,isClicksLoading:g}=oe(a,"date asc",s||void 0,h||!1),N=c.useMemo(()=>!i?.newsletters||!s?null:i.newsletters.find(d=>d.id===s)||null,[i,s]),v=c.useMemo(()=>{const d=N?.count?.active_members||p?.stats?.[0]?.total||0;let f=0,_=0;if(u?.stats&&u.stats.length>0){const x=u.stats,C=x.reduce((T,E)=>T+(E.open_rate||0),0),b=x.reduce((T,E)=>T+(E.click_rate||0),0);f=C/x.length,_=b/x.length}return{totalSubscribers:d,avgOpenRate:f,avgClickRate:_}},[N,p,u]),S=c.useMemo(()=>{if(!p?.stats?.[0]?.values||p.stats[0].values.length===0){const{startDate:f,endDate:_}=Q(a),x=[],C=new Date(f);for(;C<=_;)x.push({date:C.toISOString().split("T")[0],value:0}),C.setDate(C.getDate()+1);return x}const d=p.stats[0].values;if(d.length===1){const f=d[0],_=new Date,x=a,C=new Date(_.getTime()-x*24*60*60*1e3);return[{...f,date:C.toISOString().split("T")[0]},{...f,date:_.toISOString().split("T")[0]}]}return d},[p,a]),R=c.useMemo(()=>u?.stats?u.stats.map(d=>({post_id:d.post_id,post_title:d.post_title,send_date:d.send_date,sent_to:d.sent_to,total_opens:d.total_opens,open_rate:d.open_rate,total_clicks:d.total_clicks||0,click_rate:d.click_rate||0})):[],[u]),m=j||g||w;return l&&!l.newslettersEnabled?e.jsx(ge,{to:"/analytics"}):e.jsxs(ke,{children:[e.jsx(we,{children:e.jsxs(Fe,{children:[e.jsx(rt,{newsletters:i?.newsletters}),e.jsx(Ne,{})]})}),e.jsx(Se,{isLoading:!1,loadingComponent:e.jsx(e.Fragment,{}),children:e.jsxs(e.Fragment,{children:[e.jsx(le,{"data-testid":"newsletters-card",children:e.jsx(ie,{children:e.jsx(at,{avgsData:R,initialTab:t,isAvgsLoading:!1,isLoading:m,subscribersData:S,totals:v})})}),e.jsx(me,{range:a,selectedNewsletterId:s,shouldFetchStats:!!h})]})})]})};export{Vt as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{cF as wv,d6 as x0}from"./index-
|
|
1
|
+
import{cF as wv,d6 as x0}from"./index-CMTzNTew.js";import{r as qv,a as Ev,b as R0,c as _0,d as A0,e as M0,f as Ae,g as L0,h as N0,i as $v,j as Sv,k as k0,l as F0,m as C0,n as D0,o as P0,p as U0}from"./_baseAssignValue-DnkbkowM.js";function B0(e,i){for(var c=0;c<i.length;c++){const l=i[c];if(typeof l!="string"&&!Array.isArray(l)){for(const v in l)if(v!=="default"&&!(v in e)){const g=Object.getOwnPropertyDescriptor(l,v);g&&Object.defineProperty(e,v,g.get?g:{enumerable:!0,get:()=>l[v]})}}}return Object.freeze(Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}))}var ht,Ys;function j0(){if(Ys)return ht;Ys=1;var e=qv(),i=Ev(),c=Object.prototype,l=c.hasOwnProperty;function v(g,b,m){var T=g[b];(!(l.call(g,b)&&i(T,m))||m===void 0&&!(b in g))&&e(g,b,m)}return ht=v,ht}var vt,Js;function V0(){if(Js)return vt;Js=1;var e=j0(),i=qv();function c(l,v,g,b){var m=!g;g||(g={});for(var T=-1,C=v.length;++T<C;){var A=v[T],S=b?b(g[A],l[A],A,g,l):void 0;S===void 0&&(S=l[A]),m?i(g,A,S):e(g,A,S)}return g}return vt=c,vt}var mt,Xs;function H0(){if(Xs)return mt;Xs=1;function e(i){var c=[];if(i!=null)for(var l in Object(i))c.push(l);return c}return mt=e,mt}var yt,Qs;function Z0(){if(Qs)return yt;Qs=1;var e=R0(),i=_0(),c=H0(),l=Object.prototype,v=l.hasOwnProperty;function g(b){if(!e(b))return c(b);var m=i(b),T=[];for(var C in b)C=="constructor"&&(m||!v.call(b,C))||T.push(C);return T}return yt=g,yt}var pt,Ks;function W0(){if(Ks)return pt;Ks=1;var e=A0(),i=Z0(),c=M0();function l(v){return c(v)?e(v,!0):i(v)}return pt=l,pt}var gt,rf;function z0(){if(rf)return gt;rf=1;var e=Ae(),i=L0();function c(l){return i(e(l).toLowerCase())}return gt=c,gt}var bt,ef;function G0(){if(ef)return bt;ef=1;function e(i,c,l,v){var g=-1,b=i==null?0:i.length;for(v&&b&&(l=i[++g]);++g<b;)l=c(l,i[g],g,i);return l}return bt=e,bt}var wt,tf;function Iv(){if(tf)return wt;tf=1;function e(i){return function(c){return i?.[c]}}return wt=e,wt}var qt,nf;function Y0(){if(nf)return qt;nf=1;var e=Iv(),i={À:"A",Á:"A",Â:"A",Ã:"A",Ä:"A",Å:"A",à:"a",á:"a",â:"a",ã:"a",ä:"a",å:"a",Ç:"C",ç:"c",Ð:"D",ð:"d",È:"E",É:"E",Ê:"E",Ë:"E",è:"e",é:"e",ê:"e",ë:"e",Ì:"I",Í:"I",Î:"I",Ï:"I",ì:"i",í:"i",î:"i",ï:"i",Ñ:"N",ñ:"n",Ò:"O",Ó:"O",Ô:"O",Õ:"O",Ö:"O",Ø:"O",ò:"o",ó:"o",ô:"o",õ:"o",ö:"o",ø:"o",Ù:"U",Ú:"U",Û:"U",Ü:"U",ù:"u",ú:"u",û:"u",ü:"u",Ý:"Y",ý:"y",ÿ:"y",Æ:"Ae",æ:"ae",Þ:"Th",þ:"th",ß:"ss",Ā:"A",Ă:"A",Ą:"A",ā:"a",ă:"a",ą:"a",Ć:"C",Ĉ:"C",Ċ:"C",Č:"C",ć:"c",ĉ:"c",ċ:"c",č:"c",Ď:"D",Đ:"D",ď:"d",đ:"d",Ē:"E",Ĕ:"E",Ė:"E",Ę:"E",Ě:"E",ē:"e",ĕ:"e",ė:"e",ę:"e",ě:"e",Ĝ:"G",Ğ:"G",Ġ:"G",Ģ:"G",ĝ:"g",ğ:"g",ġ:"g",ģ:"g",Ĥ:"H",Ħ:"H",ĥ:"h",ħ:"h",Ĩ:"I",Ī:"I",Ĭ:"I",Į:"I",İ:"I",ĩ:"i",ī:"i",ĭ:"i",į:"i",ı:"i",Ĵ:"J",ĵ:"j",Ķ:"K",ķ:"k",ĸ:"k",Ĺ:"L",Ļ:"L",Ľ:"L",Ŀ:"L",Ł:"L",ĺ:"l",ļ:"l",ľ:"l",ŀ:"l",ł:"l",Ń:"N",Ņ:"N",Ň:"N",Ŋ:"N",ń:"n",ņ:"n",ň:"n",ŋ:"n",Ō:"O",Ŏ:"O",Ő:"O",ō:"o",ŏ:"o",ő:"o",Ŕ:"R",Ŗ:"R",Ř:"R",ŕ:"r",ŗ:"r",ř:"r",Ś:"S",Ŝ:"S",Ş:"S",Š:"S",ś:"s",ŝ:"s",ş:"s",š:"s",Ţ:"T",Ť:"T",Ŧ:"T",ţ:"t",ť:"t",ŧ:"t",Ũ:"U",Ū:"U",Ŭ:"U",Ů:"U",Ű:"U",Ų:"U",ũ:"u",ū:"u",ŭ:"u",ů:"u",ű:"u",ų:"u",Ŵ:"W",ŵ:"w",Ŷ:"Y",ŷ:"y",Ÿ:"Y",Ź:"Z",Ż:"Z",Ž:"Z",ź:"z",ż:"z",ž:"z",IJ:"IJ",ij:"ij",Œ:"Oe",œ:"oe",ʼn:"'n",ſ:"s"},c=e(i);return qt=c,qt}var Et,af;function J0(){if(af)return Et;af=1;var e=Y0(),i=Ae(),c=/[\xc0-\xd6\xd8-\xf6\xf8-\xff\u0100-\u017f]/g,l="\\u0300-\\u036f",v="\\ufe20-\\ufe2f",g="\\u20d0-\\u20ff",b=l+v+g,m="["+b+"]",T=RegExp(m,"g");function C(A){return A=i(A),A&&A.replace(c,e).replace(T,"")}return Et=C,Et}var $t,uf;function X0(){if(uf)return $t;uf=1;var e=/[^\x00-\x2f\x3a-\x40\x5b-\x60\x7b-\x7f]+/g;function i(c){return c.match(e)||[]}return $t=i,$t}var St,of;function Q0(){if(of)return St;of=1;var e=/[a-z][A-Z]|[A-Z]{2}[a-z]|[0-9][a-zA-Z]|[a-zA-Z][0-9]|[^a-zA-Z0-9 ]/;function i(c){return e.test(c)}return St=i,St}var It,sf;function K0(){if(sf)return It;sf=1;var e="\\ud800-\\udfff",i="\\u0300-\\u036f",c="\\ufe20-\\ufe2f",l="\\u20d0-\\u20ff",v=i+c+l,g="\\u2700-\\u27bf",b="a-z\\xdf-\\xf6\\xf8-\\xff",m="\\xac\\xb1\\xd7\\xf7",T="\\x00-\\x2f\\x3a-\\x40\\x5b-\\x60\\x7b-\\xbf",C="\\u2000-\\u206f",A=" \\t\\x0b\\f\\xa0\\ufeff\\n\\r\\u2028\\u2029\\u1680\\u180e\\u2000\\u2001\\u2002\\u2003\\u2004\\u2005\\u2006\\u2007\\u2008\\u2009\\u200a\\u202f\\u205f\\u3000",S="A-Z\\xc0-\\xd6\\xd8-\\xde",O="\\ufe0e\\ufe0f",w=m+T+C+A,F="['’]",_="["+w+"]",D="["+v+"]",M="\\d+",B="["+g+"]",j="["+b+"]",U="[^"+e+w+M+g+b+S+"]",R="\\ud83c[\\udffb-\\udfff]",X="(?:"+D+"|"+R+")",H="[^"+e+"]",Z="(?:\\ud83c[\\udde6-\\uddff]){2}",Q="[\\ud800-\\udbff][\\udc00-\\udfff]",pr="["+S+"]",or="\\u200d",Er="(?:"+j+"|"+U+")",fr="(?:"+pr+"|"+U+")",br="(?:"+F+"(?:d|ll|m|re|s|t|ve))?",sr="(?:"+F+"(?:D|LL|M|RE|S|T|VE))?",Mr=X+"?",cr="["+O+"]?",Vr="(?:"+or+"(?:"+[H,Z,Q].join("|")+")"+cr+Mr+")*",Hr="\\d*(?:1st|2nd|3rd|(?![123])\\dth)(?=\\b|[A-Z_])",xr="\\d*(?:1ST|2ND|3RD|(?![123])\\dTH)(?=\\b|[a-z_])",tr=cr+Mr+Vr,dr="(?:"+[B,Z,Q].join("|")+")"+tr,Lr=RegExp([pr+"?"+j+"+"+br+"(?="+[_,pr,"$"].join("|")+")",fr+"+"+sr+"(?="+[_,pr+Er,"$"].join("|")+")",pr+"?"+Er+"+"+br,pr+"+"+sr,xr,Hr,M,dr].join("|"),"g");function Or(Zr){return Zr.match(Lr)||[]}return It=Or,It}var Ot,ff;function rp(){if(ff)return Ot;ff=1;var e=X0(),i=Q0(),c=Ae(),l=K0();function v(g,b,m){return g=c(g),b=m?void 0:b,b===void 0?i(g)?l(g):e(g):g.match(b)||[]}return Ot=v,Ot}var Tt,lf;function Ov(){if(lf)return Tt;lf=1;var e=G0(),i=J0(),c=rp(),l="['’]",v=RegExp(l,"g");function g(b){return function(m){return e(c(i(m).replace(v,"")),b,"")}}return Tt=g,Tt}var xt,cf;function ep(){if(cf)return xt;cf=1;var e=z0(),i=Ov(),c=i(function(l,v,g){return v=v.toLowerCase(),l+(g?e(v):v)});return xt=c,xt}var Rt,df;function tp(){if(df)return Rt;df=1;var e=Object.prototype,i=e.hasOwnProperty;function c(l,v){return l!=null&&i.call(l,v)}return Rt=c,Rt}var _t,hf;function np(){if(hf)return _t;hf=1;var e=tp(),i=N0();function c(l,v){return l!=null&&i(l,v,e)}return _t=c,_t}let Be;const ip=new Uint8Array(16);function ap(){if(!Be&&(Be=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Be))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return Be(ip)}const wr=[];for(let e=0;e<256;++e)wr.push((e+256).toString(16).slice(1));function up(e,i=0){return wr[e[i+0]]+wr[e[i+1]]+wr[e[i+2]]+wr[e[i+3]]+"-"+wr[e[i+4]]+wr[e[i+5]]+"-"+wr[e[i+6]]+wr[e[i+7]]+"-"+wr[e[i+8]]+wr[e[i+9]]+"-"+wr[e[i+10]]+wr[e[i+11]]+wr[e[i+12]]+wr[e[i+13]]+wr[e[i+14]]+wr[e[i+15]]}let vf,At,Mt=0,Lt=0;function op(e,i,c){let l=0;const v=new Array(16);e=e||{};let g=e.node||vf,b=e.clockseq!==void 0?e.clockseq:At;if(g==null||b==null){const O=e.random||(e.rng||ap)();g==null&&(g=vf=[O[0]|1,O[1],O[2],O[3],O[4],O[5]]),b==null&&(b=At=(O[6]<<8|O[7])&16383)}let m=e.msecs!==void 0?e.msecs:Date.now(),T=e.nsecs!==void 0?e.nsecs:Lt+1;const C=m-Mt+(T-Lt)/1e4;if(C<0&&e.clockseq===void 0&&(b=b+1&16383),(C<0||m>Mt)&&e.nsecs===void 0&&(T=0),T>=1e4)throw new Error("uuid.v1(): Can't create more than 10M uuids/sec");Mt=m,Lt=T,At=b,m+=122192928e5;const A=((m&268435455)*1e4+T)%4294967296;v[l++]=A>>>24&255,v[l++]=A>>>16&255,v[l++]=A>>>8&255,v[l++]=A&255;const S=m/4294967296*1e4&268435455;v[l++]=S>>>8&255,v[l++]=S&255,v[l++]=S>>>24&15|16,v[l++]=S>>>16&255,v[l++]=b>>>8|128,v[l++]=b&255;for(let O=0;O<6;++O)v[l+O]=g[O];return i||up(v)}function sp(e,i){const c=(e.stack?.split(/\n/g)||[])[1],[l,...v]=i.stack?.split(/\n/g)||[];return[l,c,...v].join(`
|
|
2
2
|
`)}var fp=Object.defineProperty,lp=(e,i,c)=>i in e?fp(e,i,{enumerable:!0,configurable:!0,writable:!0,value:c}):e[i]=c,Dr=(e,i,c)=>(lp(e,typeof i!="symbol"?i+"":i,c),c);class rr extends Error{constructor(i={}){super(),Dr(this,"statusCode"),Dr(this,"errorType"),Dr(this,"level"),Dr(this,"id"),Dr(this,"context"),Dr(this,"help"),Dr(this,"errorDetails"),Dr(this,"code"),Dr(this,"property"),Dr(this,"redirect"),Dr(this,"hideStack"),this.statusCode=500,this.errorType="InternalServerError",this.level="normal",this.message="The server has encountered an error.",this.id=op(),this.id=i.id||this.id,this.statusCode=i.statusCode||this.statusCode,this.level=i.level||this.level,this.context=i.context,this.help=i.help,this.errorType=this.name=i.errorType||this.errorType,this.errorDetails=i.errorDetails,this.code=i.code||null,this.property=i.property||null,this.redirect=i.redirect||null,this.message=i.message||this.message,this.hideStack=i.hideStack||!1,i.err&&(typeof i.err=="string"&&(i.err=new Error(i.err)),Object.getOwnPropertyNames(i.err).forEach(c=>{if(["errorType","name","statusCode","message","level"].indexOf(c)===-1){if(c==="code"){this[c]=this[c]||i.err[c];return}if(c==="stack"&&!this.hideStack){this[c]=sp(this,i.err);return}this[c]=i.err[c]||this[c]}}))}}const nr=(e,i)=>{const c={...i};return Object.keys(e).forEach(l=>{e[l]!==void 0&&(c[l]=e[l])}),c};class ge extends rr{constructor(i={}){super(nr(i,{statusCode:500,level:"critical",errorType:"InternalServerError",message:"The server has encountered an error."}))}}class Tv extends rr{constructor(i={}){super(nr(i,{statusCode:400,level:"critical",errorType:"IncorrectUsageError",message:"We detected a misuse. Please read the stack trace."}))}}class xv extends rr{constructor(i={}){super(nr(i,{statusCode:404,errorType:"NotFoundError",message:"Resource could not be found.",hideStack:!0}))}}class Co extends rr{constructor(i={}){super(nr(i,{statusCode:400,errorType:"BadRequestError",message:"The request could not be understood."}))}}class Rv extends rr{constructor(i={}){super(nr(i,{statusCode:401,errorType:"UnauthorizedError",message:"You are not authorised to make this request."}))}}class Do extends rr{constructor(i={}){super(nr(i,{statusCode:403,errorType:"NoPermissionError",message:"You do not have permission to perform this request."}))}}class Po extends rr{constructor(i={}){super(nr(i,{statusCode:422,errorType:"ValidationError",message:"The request failed validation."}))}}class _v extends rr{constructor(i={}){super(nr(i,{statusCode:415,errorType:"UnsupportedMediaTypeError",message:"The media in the request is not supported by the server."}))}}class Av extends rr{constructor(i={}){super(nr(i,{statusCode:429,errorType:"TooManyRequestsError",message:"Server has received too many similar requests in a short space of time."}))}}class Uo extends rr{constructor(i={}){super(nr(i,{statusCode:503,errorType:"MaintenanceError",message:"The server is temporarily down for maintenance."}))}}class Mv extends rr{constructor(i={}){super(nr(i,{statusCode:405,errorType:"MethodNotAllowedError",message:"Method not allowed for resource."}))}}class Lv extends rr{constructor(i={}){super(nr(i,{statusCode:406,errorType:"RequestNotAcceptableError",message:"Request not acceptable for provided Accept-Version header.",hideStack:!0}))}}class Nv extends rr{constructor(i={}){super(nr(i,{statusCode:416,errorType:"RangeNotSatisfiableError",message:"Range not satisfiable for provided Range header.",hideStack:!0}))}}class kv extends rr{constructor(i={}){super(nr(i,{statusCode:413,errorType:"RequestEntityTooLargeError",message:"Request was too big for the server to handle."}))}}class Fv extends rr{constructor(i={}){super(nr(i,{statusCode:503,errorType:"TokenRevocationError",message:"Token is no longer available."}))}}class Cv extends rr{constructor(i={}){super(nr(i,{statusCode:400,errorType:"VersionMismatchError",message:"Requested version does not match server version."}))}}class Dv extends rr{constructor(i={}){super(nr(i,{statusCode:500,errorType:"DataExportError",message:"The server encountered an error whilst exporting data."}))}}class Pv extends rr{constructor(i={}){super(nr(i,{statusCode:500,errorType:"DataImportError",message:"The server encountered an error whilst importing data."}))}}class Uv extends rr{constructor(i={}){super(nr(i,{statusCode:500,errorType:"EmailError",message:"The server encountered an error whilst sending email."}))}}class Bv extends rr{constructor(i={}){super(nr(i,{statusCode:422,errorType:"ThemeValidationError",message:"The theme has a validation error.",errorDetails:{}}))}}class jv extends rr{constructor(i={}){super(nr(i,{statusCode:409,errorType:"DisabledFeatureError",message:"Unable to complete the request, this feature is disabled."}))}}class Vv extends rr{constructor(i={}){super(nr(i,{statusCode:409,errorType:"UpdateCollisionError",message:"Unable to complete the request, there was a conflict."}))}}class Hv extends rr{constructor(i={}){super(nr(i,{errorType:"HostLimitError",hideStack:!0,statusCode:403,message:"Unable to complete the request, this resource is limited."}))}}class Zv extends rr{constructor(i={}){super(nr(i,{errorType:"HelperWarning",hideStack:!0,statusCode:400,message:"A theme helper has done something unexpected."}))}}class Wv extends rr{constructor(i={}){super(nr(i,{errorType:"PasswordResetRequiredError",statusCode:401,message:"For security, you need to create a new password. An email has been sent to you with instructions!"}))}}class zv extends rr{constructor(i={}){super(nr(i,{errorType:"UnhandledJobError",message:"Processed job threw an unhandled error",level:"critical"}))}}class Gv extends rr{constructor(i={}){super(nr(i,{errorType:"NoContentError",statusCode:204,hideStack:!0}))}}class Yv extends rr{constructor(i={}){super(nr(i,{errorType:"ConflictError",statusCode:409,message:"The server has encountered an conflict."}))}}class Jv extends rr{constructor(i={}){super(nr(i,{errorType:"MigrationError",message:"An error has occurred applying a database migration.",level:"critical"}))}}const Xv=Object.freeze(Object.defineProperty({__proto__:null,BadRequestError:Co,ConflictError:Yv,DataExportError:Dv,DataImportError:Pv,DisabledFeatureError:jv,EmailError:Uv,HelperWarning:Zv,HostLimitError:Hv,IncorrectUsageError:Tv,InternalServerError:ge,MaintenanceError:Uo,MethodNotAllowedError:Mv,MigrationError:Jv,NoContentError:Gv,NoPermissionError:Do,NotFoundError:xv,PasswordResetRequiredError:Wv,RangeNotSatisfiableError:Nv,RequestEntityTooLargeError:kv,RequestNotAcceptableError:Lv,ThemeValidationError:Bv,TokenRevocationError:Fv,TooManyRequestsError:Av,UnauthorizedError:Rv,UnhandledJobError:zv,UnsupportedMediaTypeError:_v,UpdateCollisionError:Vv,ValidationError:Po,VersionMismatchError:Cv},Symbol.toStringTag,{value:"Module"}));/**
|
|
3
3
|
* @license Apache-2.0
|
|
4
4
|
*
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c}from"./index-f5Lv9kLb.js";const z=(n,t)=>n==null?t:t==null?n:Math.max(n,t),C=new WeakMap,ut={onUpdate(n,t,e){if(C.set(e,void 0),!e.computedTrend)return;const i=t.integer.concat(t.fraction).filter(o=>o.type==="integer"||o.type==="fraction"),s=n.integer.concat(n.fraction).filter(o=>o.type==="integer"||o.type==="fraction"),r=i.find(o=>!s.find(l=>l.pos===o.pos&&l.value===o.value)),a=s.find(o=>!i.find(l=>o.pos===l.pos&&o.value===l.value));C.set(e,z(r?.pos,a?.pos))},getDelta(n,t,e){const i=n-t,s=C.get(e.flow);if(!i&&s!=null&&s>=e.pos)return e.length*e.flow.computedTrend}},y=(n,t,e)=>{const i=document.createElement(n),[s,r]=Array.isArray(t)?[void 0,t]:[t,e];return s&&Object.assign(i,s),r?.forEach(a=>i.appendChild(a)),i},J=(n,t)=>{var e;return t==="left"?n.offsetLeft:(((e=n.offsetParent instanceof HTMLElement?n.offsetParent:null)==null?void 0:e.offsetWidth)??0)-n.offsetWidth-n.offsetLeft},G=n=>n.offsetWidth>0&&n.offsetHeight>0,Y=(n,t)=>{!customElements.get(n)&&customElements.define(n,t)};function Z(n,t,{reverse:e=!1}={}){const i=n.length;for(let s=e?i-1:0;e?s>=0:s<i;e?s--:s++)t(n[s],s)}function q(n,t,e,i){const s=t.formatToParts(n);e&&s.unshift({type:"prefix",value:e}),i&&s.push({type:"suffix",value:i});const r=[],a=[],o=[],l=[],u={},p=d=>`${d}:${u[d]=(u[d]??-1)+1}`;let f="",m=!1,g=!1;for(const d of s){f+=d.value;const h=d.type==="minusSign"||d.type==="plusSign"?"sign":d.type;h==="integer"?(m=!0,a.push(...d.value.split("").map(A=>({type:h,value:parseInt(A)})))):h==="group"?a.push({type:h,value:d.value}):h==="decimal"?(g=!0,o.push({type:h,value:d.value,key:p(h)})):h==="fraction"?o.push(...d.value.split("").map(A=>({type:h,value:parseInt(A),key:p(h),pos:-1-u[h]}))):(m||g?l:r).push({type:h,value:d.value,key:p(h)})}const M=[];for(let d=a.length-1;d>=0;d--){const h=a[d];M.unshift(h.type==="integer"?{...h,key:p(h.type),pos:u[h.type]}:{...h,key:p(h.type)})}return{pre:r,integer:M,fraction:o,post:l,valueAsString:f,value:typeof n=="string"?parseFloat(n):n}}const Q=String.raw,K=(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0})(),tt=typeof CSS<"u"&&CSS.supports&&CSS.supports("line-height","mod(1,1)"),w=typeof matchMedia<"u"?matchMedia("(prefers-reduced-motion: reduce)"):null,E="--_number-flow-d-opacity",U="--_number-flow-d-width",R="--_number-flow-dx",k="--_number-flow-d",et=(()=>{try{return CSS.registerProperty({name:E,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:R,syntax:"<length>",inherits:!0,initialValue:"0px"}),CSS.registerProperty({name:U,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:k,syntax:"<number>",inherits:!0,initialValue:"0"}),!0}catch{return!1}})(),it="var(--number-flow-char-height, 1em)",v="var(--number-flow-mask-height, 0.25em)",N=`calc(${v} / 2)`,$="var(--number-flow-mask-width, 0.5em)",_=`calc(${$} / var(--scale-x))`,b="#000 0, transparent 71%",P=Q`:host{display:inline-block;direction:ltr;white-space:nowrap;isolation:isolate;line-height:${it} !important}.number,.number__inner{display:inline-block;transform-origin:left top}:host([data-will-change]) :is(.number,.number__inner,.section,.digit,.digit__num,.symbol){will-change:transform}.number{--scale-x:calc(1 + var(${U}) / var(--width));transform:translateX(var(${R})) scaleX(var(--scale-x));margin:0 calc(-1 * ${$});position:relative;-webkit-mask-image:linear-gradient(to right,transparent 0,#000 ${_},#000 calc(100% - ${_}),transparent ),linear-gradient(to bottom,transparent 0,#000 ${v},#000 calc(100% - ${v}),transparent 100% ),radial-gradient(at bottom right,${b}),radial-gradient(at bottom left,${b}),radial-gradient(at top left,${b}),radial-gradient(at top right,${b});-webkit-mask-size:100% calc(100% - ${v} * 2),calc(100% - ${_} * 2) 100%,${_} ${v},${_} ${v},${_} ${v},${_} ${v};-webkit-mask-position:center,center,top left,top right,bottom right,bottom left;-webkit-mask-repeat:no-repeat}.number__inner{padding:${N} ${$};transform:scaleX(calc(1 / var(--scale-x))) translateX(calc(-1 * var(${R})))}:host > :not(.number){z-index:5}.section,.symbol{display:inline-block;position:relative;isolation:isolate}.section::after{content:'\200b';display:inline-block}.section--justify-left{transform-origin:center left}.section--justify-right{transform-origin:center right}.section > [inert],.symbol > [inert]{margin:0 !important;position:absolute !important;z-index:-1}.digit{display:inline-block;position:relative;--c:var(--current) + var(${k})}.digit__num,.number .section::after{padding:${N} 0}.digit__num{display:inline-block;--offset-raw:mod(var(--length) + var(--n) - mod(var(--c),var(--length)),var(--length));--offset:calc( var(--offset-raw) - var(--length) * round(down,var(--offset-raw) / (var(--length) / 2),1) );--y:clamp(-100%,var(--offset) * 100%,100%);transform:translateY(var(--y))}.digit__num[inert]{position:absolute;top:0;left:50%;transform:translateX(-50%) translateY(var(--y))}.digit:not(.is-spinning) .digit__num[inert]{display:none}.symbol__value{display:inline-block;mix-blend-mode:plus-lighter;white-space:pre}.section--justify-left .symbol > [inert]{left:0}.section--justify-right .symbol > [inert]{right:0}.animate-presence{opacity:calc(1 + var(${E}))}`,st=HTMLElement,B=tt&&K&&et;let S;class I extends st{constructor(){super(),this.created=!1,this.batched=!1;const{animated:t,...e}=this.constructor.defaultProps;this._animated=this.computedAnimated=t,Object.assign(this,e)}get animated(){return this._animated}set animated(t){var e;this.animated!==t&&(this._animated=t,(e=this.shadowRoot)==null||e.getAnimations().forEach(i=>i.finish()))}set data(t){var e;if(t==null)return;const{pre:i,integer:s,fraction:r,post:a,value:o}=t;if(this.created){const l=this._data;this._data=t,this.computedTrend=typeof this.trend=="function"?this.trend(l.value,o):this.trend,this.computedAnimated=B&&this._animated&&(!this.respectMotionPreference||!(w!=null&&w.matches))&&G(this),(e=this.plugins)==null||e.forEach(u=>{var p;return(p=u.onUpdate)==null?void 0:p.call(u,t,l,this)}),this.batched||this.willUpdate(),this._pre.update(i),this._num.update({integer:s,fraction:r}),this._post.update(a),this.batched||this.didUpdate()}else{this._data=t,this.attachShadow({mode:"open"});try{this._internals??(this._internals=this.attachInternals()),this._internals.role="img"}catch{}if(typeof CSSStyleSheet<"u"&&this.shadowRoot.adoptedStyleSheets)S||(S=new CSSStyleSheet,S.replaceSync(P)),this.shadowRoot.adoptedStyleSheets=[S];else{const l=document.createElement("style");l.textContent=P,this.shadowRoot.appendChild(l)}this._pre=new F(this,i,{justify:"right",part:"left"}),this.shadowRoot.appendChild(this._pre.el),this._num=new nt(this,s,r),this.shadowRoot.appendChild(this._num.el),this._post=new F(this,a,{justify:"left",part:"right"}),this.shadowRoot.appendChild(this._post.el),this.created=!0}try{this._internals.ariaLabel=t.valueAsString}catch{}}willUpdate(){this._pre.willUpdate(),this._num.willUpdate(),this._post.willUpdate()}didUpdate(){if(!this.computedAnimated)return;this._abortAnimationsFinish?this._abortAnimationsFinish.abort():this.dispatchEvent(new Event("animationsstart")),this._pre.didUpdate(),this._num.didUpdate(),this._post.didUpdate();const t=new AbortController;Promise.all(this.shadowRoot.getAnimations().map(e=>e.finished)).then(()=>{t.signal.aborted||(this.dispatchEvent(new Event("animationsfinish")),this._abortAnimationsFinish=void 0)}),this._abortAnimationsFinish=t}}I.defaultProps={transformTiming:{duration:900,easing:"linear(0,.005,.019,.039,.066,.096,.129,.165,.202,.24,.278,.316,.354,.39,.426,.461,.494,.526,.557,.586,.614,.64,.665,.689,.711,.731,.751,.769,.786,.802,.817,.831,.844,.856,.867,.877,.887,.896,.904,.912,.919,.925,.931,.937,.942,.947,.951,.955,.959,.962,.965,.968,.971,.973,.976,.978,.98,.981,.983,.984,.986,.987,.988,.989,.99,.991,.992,.992,.993,.994,.994,.995,.995,.996,.996,.9963,.9967,.9969,.9972,.9975,.9977,.9979,.9981,.9982,.9984,.9985,.9987,.9988,.9989,1)"},spinTiming:void 0,opacityTiming:{duration:450,easing:"ease-out"},animated:!0,trend:(n,t)=>Math.sign(t-n),respectMotionPreference:!0,plugins:void 0,digits:void 0};class nt{constructor(t,e,i,{className:s,...r}={}){this.flow=t,this._integer=new L(t,e,{justify:"right",part:"integer"}),this._fraction=new L(t,i,{justify:"left",part:"fraction"}),this._inner=y("span",{className:"number__inner"},[this._integer.el,this._fraction.el]),this.el=y("span",{...r,part:"number",className:`number ${s??""}`},[this._inner])}willUpdate(){this._prevWidth=this.el.offsetWidth,this._prevLeft=this.el.getBoundingClientRect().left,this._integer.willUpdate(),this._fraction.willUpdate()}update({integer:t,fraction:e}){this._integer.update(t),this._fraction.update(e)}didUpdate(){const t=this.el.getBoundingClientRect();this._integer.didUpdate(),this._fraction.didUpdate();const e=this._prevLeft-t.left,i=this.el.offsetWidth,s=this._prevWidth-i;this.el.style.setProperty("--width",String(i)),this.el.animate({[R]:[`${e}px`,"0px"],[U]:[s,0]},{...this.flow.transformTiming,composite:"accumulate"})}}class D{constructor(t,e,{justify:i,className:s,...r},a){this.flow=t,this.children=new Map,this.onCharRemove=l=>()=>{this.children.delete(l)},this.justify=i;const o=e.map(l=>this.addChar(l).el);this.el=y("span",{...r,className:`section section--justify-${i} ${s??""}`},a?a(o):o)}addChar(t,{startDigitsAtZero:e=!1,...i}={}){const s=t.type==="integer"||t.type==="fraction"?new X(this,t.type,e?0:t.value,t.pos,{...i,onRemove:this.onCharRemove(t.key)}):new at(this,t.type,t.value,{...i,onRemove:this.onCharRemove(t.key)});return this.children.set(t.key,s),s}unpop(t){t.el.removeAttribute("inert"),t.el.style.top="",t.el.style[this.justify]=""}pop(t){t.forEach(e=>{e.el.style.top=`${e.el.offsetTop}px`,e.el.style[this.justify]=`${J(e.el,this.justify)}px`}),t.forEach(e=>{e.el.setAttribute("inert",""),e.present=!1})}addNewAndUpdateExisting(t){const e=new Map,i=new Map,s=this.justify==="left",r=s?"prepend":"append";if(Z(t,a=>{let o;this.children.has(a.key)?(o=this.children.get(a.key),i.set(a,o),this.unpop(o),o.present=!0):(o=this.addChar(a,{startDigitsAtZero:!0,animateIn:!0}),e.set(a,o)),this.el[r](o.el)},{reverse:s}),this.flow.computedAnimated){const a=this.el.getBoundingClientRect();e.forEach(o=>{o.willUpdate(a)})}e.forEach((a,o)=>{a.update(o.value)}),i.forEach((a,o)=>{a.update(o.value)})}willUpdate(){const t=this.el.getBoundingClientRect();this._prevOffset=t[this.justify],this.children.forEach(e=>e.willUpdate(t))}didUpdate(){const t=this.el.getBoundingClientRect();this.children.forEach(s=>s.didUpdate(t));const e=t[this.justify],i=this._prevOffset-e;i&&this.children.size&&this.el.animate({transform:[`translateX(${i}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}class L extends D{update(t){const e=new Map;this.children.forEach((i,s)=>{t.find(r=>r.key===s)||e.set(s,i),this.unpop(i)}),this.addNewAndUpdateExisting(t),e.forEach(i=>{i instanceof X&&i.update(0)}),this.pop(e)}}class F extends D{update(t){const e=new Map;this.children.forEach((i,s)=>{t.find(r=>r.key===s)||e.set(s,i)}),this.pop(e),this.addNewAndUpdateExisting(t)}}class x{constructor(t,e,{onRemove:i,animateIn:s=!1}={}){this.flow=t,this.el=e,this._present=!0,this._remove=()=>{var r;this.el.remove(),(r=this._onRemove)==null||r.call(this)},this.el.classList.add("animate-presence"),this.flow.computedAnimated&&s&&this.el.animate({[E]:[-.9999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),this._onRemove=i}get present(){return this._present}set present(t){if(this._present!==t){if(this._present=t,t?this.el.removeAttribute("inert"):this.el.setAttribute("inert",""),!this.flow.computedAnimated){t||this._remove();return}this.el.style.setProperty("--_number-flow-d-opacity",t?"0":"-.999"),this.el.animate({[E]:t?[-.9999,0]:[.999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),t?this.flow.removeEventListener("animationsfinish",this._remove):this.flow.addEventListener("animationsfinish",this._remove,{once:!0})}}}class W extends x{constructor(t,e,i,s){super(t.flow,i,s),this.section=t,this.value=e,this.el=i}}class X extends W{constructor(t,e,i,s,r){var a,o;const l=(((o=(a=t.flow.digits)==null?void 0:a[s])==null?void 0:o.max)??9)+1,u=Array.from({length:l}).map((f,m)=>{const g=y("span",{className:"digit__num"},[document.createTextNode(String(m))]);return m!==i&&g.setAttribute("inert",""),g.style.setProperty("--n",String(m)),g}),p=y("span",{part:`digit ${e}-digit`,className:"digit"},u);p.style.setProperty("--current",String(i)),p.style.setProperty("--length",String(l)),super(t,i,p,r),this.pos=s,this._onAnimationsFinish=()=>{this.el.classList.remove("is-spinning")},this._numbers=u,this.length=l}willUpdate(t){const e=this.el.getBoundingClientRect();this._prevValue=this.value;const i=e[this.section.justify]-t[this.section.justify],s=e.width/2;this._prevCenter=this.section.justify==="left"?i+s:i-s}update(t){this.el.style.setProperty("--current",String(t)),this._numbers.forEach((e,i)=>i===t?e.removeAttribute("inert"):e.setAttribute("inert","")),this.value=t}didUpdate(t){const e=this.el.getBoundingClientRect(),i=e[this.section.justify]-t[this.section.justify],s=e.width/2,r=this.section.justify==="left"?i+s:i-s,a=this._prevCenter-r;a&&this.el.animate({transform:[`translateX(${a}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"});const o=this.getDelta();o&&(this.el.classList.add("is-spinning"),this.el.animate({[k]:[-o,0]},{...this.flow.spinTiming??this.flow.transformTiming,composite:"accumulate"}),this.flow.addEventListener("animationsfinish",this._onAnimationsFinish,{once:!0}))}getDelta(){var t;if(this.flow.plugins)for(const s of this.flow.plugins){const r=(t=s.getDelta)==null?void 0:t.call(s,this.value,this._prevValue,this);if(r!=null)return r}const e=this.value-this._prevValue,i=this.flow.computedTrend||Math.sign(e);return i<0&&this.value>this._prevValue?this.value-this.length-this._prevValue:i>0&&this.value<this._prevValue?this.length-this._prevValue+this.value:e}}class at extends W{constructor(t,e,i,s){const r=y("span",{className:"symbol__value",textContent:i});super(t,i,y("span",{part:`symbol ${e}`,className:"symbol"},[r]),s),this.type=e,this._children=new Map,this._onChildRemove=a=>()=>{this._children.delete(a)},this._children.set(i,new x(this.flow,r,{onRemove:this._onChildRemove(i)}))}willUpdate(t){if(this.type==="decimal")return;const e=this.el.getBoundingClientRect();this._prevOffset=e[this.section.justify]-t[this.section.justify]}update(t){if(this.value!==t){const e=this._children.get(this.value);e&&(e.present=!1);const i=this._children.get(t);if(i)i.present=!0;else{const s=y("span",{className:"symbol__value",textContent:t});this.el.appendChild(s),this._children.set(t,new x(this.flow,s,{animateIn:!0,onRemove:this._onChildRemove(t)}))}}this.value=t}didUpdate(t){if(this.type==="decimal")return;const e=this.el.getBoundingClientRect()[this.section.justify]-t[this.section.justify],i=this._prevOffset-e;i&&this.el.animate({transform:[`translateX(${i}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}const rt=parseInt(c.version.match(/^(\d+)\./)?.[1]),j=rt>=19,ot=["data","digits"];class T extends I{attributeChangedCallback(t,e,i){this[t]=JSON.parse(i)}}T.observedAttributes=j?[]:ot;Y("number-flow-react",T);const lt={},O=j?n=>n:JSON.stringify;function V(n){const{transformTiming:t,spinTiming:e,opacityTiming:i,animated:s,respectMotionPreference:r,trend:a,plugins:o,...l}=n;return[{transformTiming:t,spinTiming:e,opacityTiming:i,animated:s,respectMotionPreference:r,trend:a,plugins:o},l]}class ht extends c.Component{updateProperties(t){if(!this.el)return;this.el.batched=!this.props.isolate;const[e]=V(this.props);Object.entries(e).forEach(([i,s])=>{this.el[i]=s??T.defaultProps[i]}),t?.onAnimationsStart&&this.el.removeEventListener("animationsstart",t.onAnimationsStart),this.props.onAnimationsStart&&this.el.addEventListener("animationsstart",this.props.onAnimationsStart),t?.onAnimationsFinish&&this.el.removeEventListener("animationsfinish",t.onAnimationsFinish),this.props.onAnimationsFinish&&this.el.addEventListener("animationsfinish",this.props.onAnimationsFinish)}componentDidMount(){this.updateProperties(),j&&this.el&&(this.el.digits=this.props.digits,this.el.data=this.props.data)}getSnapshotBeforeUpdate(t){if(this.updateProperties(t),t.data!==this.props.data){if(this.props.group)return this.props.group.willUpdate(),()=>this.props.group?.didUpdate();if(!this.props.isolate)return this.el?.willUpdate(),()=>this.el?.didUpdate()}return null}componentDidUpdate(t,e,i){i?.()}handleRef(t){this.props.innerRef&&(this.props.innerRef.current=t),this.el=t}render(){const[t,{innerRef:e,className:i,data:s,willChange:r,isolate:a,group:o,digits:l,onAnimationsStart:u,onAnimationsFinish:p,...f}]=V(this.props);return c.createElement("number-flow-react",{ref:this.handleRef,"data-will-change":r?"":void 0,class:i,...f,dangerouslySetInnerHTML:{__html:""},suppressHydrationWarning:!0,digits:O(l),data:O(s)})}constructor(t){super(t),this.handleRef=this.handleRef.bind(this)}}const ft=c.forwardRef(function({value:t,locales:e,format:i,prefix:s,suffix:r,...a},o){c.useImperativeHandle(o,()=>l.current,[]);const l=c.useRef(),u=c.useContext(H);u?.useRegister(l);const p=c.useMemo(()=>e?JSON.stringify(e):"",[e]),f=c.useMemo(()=>i?JSON.stringify(i):"",[i]),m=c.useMemo(()=>{const g=lt[`${p}:${f}`]??=new Intl.NumberFormat(e,i);return q(t,g,s,r)},[t,p,f,s,r]);return c.createElement(ht,{...a,group:u,data:m,innerRef:l})}),H=c.createContext(void 0);function mt({children:n}){const t=c.useRef(new Set),e=c.useRef(!1),i=c.useRef(new WeakMap),s=c.useMemo(()=>({useRegister(r){c.useEffect(()=>(t.current.add(r),()=>{t.current.delete(r)}),[])},willUpdate(){e.current||(e.current=!0,t.current.forEach(r=>{const a=r.current;!a||!a.created||(a.willUpdate(),i.current.set(a,!0))}))},didUpdate(){t.current.forEach(r=>{const a=r.current;!a||!i.current.get(a)||(a.didUpdate(),i.current.delete(a))}),e.current=!1}}),[]);return c.createElement(H.Provider,{value:s},n)}const ct=()=>c.useSyncExternalStore(()=>()=>{},()=>B,()=>!1),dt=()=>c.useSyncExternalStore(n=>(w?.addEventListener("change",n),()=>w?.removeEventListener("change",n)),()=>w.matches,()=>!1);function gt({respectMotionPreference:n=!0}={}){const t=ct(),e=dt();return t&&(!n||!e)}export{T as NumberFlowElement,mt as NumberFlowGroup,ut as continuous,ft as default,gt as useCanAnimate,ct as useIsSupported,dt as usePrefersReducedMotion};
|
|
1
|
+
import{r as c}from"./index-CMTzNTew.js";const z=(n,t)=>n==null?t:t==null?n:Math.max(n,t),C=new WeakMap,ut={onUpdate(n,t,e){if(C.set(e,void 0),!e.computedTrend)return;const i=t.integer.concat(t.fraction).filter(o=>o.type==="integer"||o.type==="fraction"),s=n.integer.concat(n.fraction).filter(o=>o.type==="integer"||o.type==="fraction"),r=i.find(o=>!s.find(l=>l.pos===o.pos&&l.value===o.value)),a=s.find(o=>!i.find(l=>o.pos===l.pos&&o.value===l.value));C.set(e,z(r?.pos,a?.pos))},getDelta(n,t,e){const i=n-t,s=C.get(e.flow);if(!i&&s!=null&&s>=e.pos)return e.length*e.flow.computedTrend}},y=(n,t,e)=>{const i=document.createElement(n),[s,r]=Array.isArray(t)?[void 0,t]:[t,e];return s&&Object.assign(i,s),r?.forEach(a=>i.appendChild(a)),i},J=(n,t)=>{var e;return t==="left"?n.offsetLeft:(((e=n.offsetParent instanceof HTMLElement?n.offsetParent:null)==null?void 0:e.offsetWidth)??0)-n.offsetWidth-n.offsetLeft},G=n=>n.offsetWidth>0&&n.offsetHeight>0,Y=(n,t)=>{!customElements.get(n)&&customElements.define(n,t)};function Z(n,t,{reverse:e=!1}={}){const i=n.length;for(let s=e?i-1:0;e?s>=0:s<i;e?s--:s++)t(n[s],s)}function q(n,t,e,i){const s=t.formatToParts(n);e&&s.unshift({type:"prefix",value:e}),i&&s.push({type:"suffix",value:i});const r=[],a=[],o=[],l=[],u={},p=d=>`${d}:${u[d]=(u[d]??-1)+1}`;let f="",m=!1,g=!1;for(const d of s){f+=d.value;const h=d.type==="minusSign"||d.type==="plusSign"?"sign":d.type;h==="integer"?(m=!0,a.push(...d.value.split("").map(A=>({type:h,value:parseInt(A)})))):h==="group"?a.push({type:h,value:d.value}):h==="decimal"?(g=!0,o.push({type:h,value:d.value,key:p(h)})):h==="fraction"?o.push(...d.value.split("").map(A=>({type:h,value:parseInt(A),key:p(h),pos:-1-u[h]}))):(m||g?l:r).push({type:h,value:d.value,key:p(h)})}const M=[];for(let d=a.length-1;d>=0;d--){const h=a[d];M.unshift(h.type==="integer"?{...h,key:p(h.type),pos:u[h.type]}:{...h,key:p(h.type)})}return{pre:r,integer:M,fraction:o,post:l,valueAsString:f,value:typeof n=="string"?parseFloat(n):n}}const Q=String.raw,K=(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0})(),tt=typeof CSS<"u"&&CSS.supports&&CSS.supports("line-height","mod(1,1)"),w=typeof matchMedia<"u"?matchMedia("(prefers-reduced-motion: reduce)"):null,E="--_number-flow-d-opacity",U="--_number-flow-d-width",R="--_number-flow-dx",k="--_number-flow-d",et=(()=>{try{return CSS.registerProperty({name:E,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:R,syntax:"<length>",inherits:!0,initialValue:"0px"}),CSS.registerProperty({name:U,syntax:"<number>",inherits:!1,initialValue:"0"}),CSS.registerProperty({name:k,syntax:"<number>",inherits:!0,initialValue:"0"}),!0}catch{return!1}})(),it="var(--number-flow-char-height, 1em)",v="var(--number-flow-mask-height, 0.25em)",N=`calc(${v} / 2)`,$="var(--number-flow-mask-width, 0.5em)",_=`calc(${$} / var(--scale-x))`,b="#000 0, transparent 71%",P=Q`:host{display:inline-block;direction:ltr;white-space:nowrap;isolation:isolate;line-height:${it} !important}.number,.number__inner{display:inline-block;transform-origin:left top}:host([data-will-change]) :is(.number,.number__inner,.section,.digit,.digit__num,.symbol){will-change:transform}.number{--scale-x:calc(1 + var(${U}) / var(--width));transform:translateX(var(${R})) scaleX(var(--scale-x));margin:0 calc(-1 * ${$});position:relative;-webkit-mask-image:linear-gradient(to right,transparent 0,#000 ${_},#000 calc(100% - ${_}),transparent ),linear-gradient(to bottom,transparent 0,#000 ${v},#000 calc(100% - ${v}),transparent 100% ),radial-gradient(at bottom right,${b}),radial-gradient(at bottom left,${b}),radial-gradient(at top left,${b}),radial-gradient(at top right,${b});-webkit-mask-size:100% calc(100% - ${v} * 2),calc(100% - ${_} * 2) 100%,${_} ${v},${_} ${v},${_} ${v},${_} ${v};-webkit-mask-position:center,center,top left,top right,bottom right,bottom left;-webkit-mask-repeat:no-repeat}.number__inner{padding:${N} ${$};transform:scaleX(calc(1 / var(--scale-x))) translateX(calc(-1 * var(${R})))}:host > :not(.number){z-index:5}.section,.symbol{display:inline-block;position:relative;isolation:isolate}.section::after{content:'\200b';display:inline-block}.section--justify-left{transform-origin:center left}.section--justify-right{transform-origin:center right}.section > [inert],.symbol > [inert]{margin:0 !important;position:absolute !important;z-index:-1}.digit{display:inline-block;position:relative;--c:var(--current) + var(${k})}.digit__num,.number .section::after{padding:${N} 0}.digit__num{display:inline-block;--offset-raw:mod(var(--length) + var(--n) - mod(var(--c),var(--length)),var(--length));--offset:calc( var(--offset-raw) - var(--length) * round(down,var(--offset-raw) / (var(--length) / 2),1) );--y:clamp(-100%,var(--offset) * 100%,100%);transform:translateY(var(--y))}.digit__num[inert]{position:absolute;top:0;left:50%;transform:translateX(-50%) translateY(var(--y))}.digit:not(.is-spinning) .digit__num[inert]{display:none}.symbol__value{display:inline-block;mix-blend-mode:plus-lighter;white-space:pre}.section--justify-left .symbol > [inert]{left:0}.section--justify-right .symbol > [inert]{right:0}.animate-presence{opacity:calc(1 + var(${E}))}`,st=HTMLElement,B=tt&&K&&et;let S;class I extends st{constructor(){super(),this.created=!1,this.batched=!1;const{animated:t,...e}=this.constructor.defaultProps;this._animated=this.computedAnimated=t,Object.assign(this,e)}get animated(){return this._animated}set animated(t){var e;this.animated!==t&&(this._animated=t,(e=this.shadowRoot)==null||e.getAnimations().forEach(i=>i.finish()))}set data(t){var e;if(t==null)return;const{pre:i,integer:s,fraction:r,post:a,value:o}=t;if(this.created){const l=this._data;this._data=t,this.computedTrend=typeof this.trend=="function"?this.trend(l.value,o):this.trend,this.computedAnimated=B&&this._animated&&(!this.respectMotionPreference||!(w!=null&&w.matches))&&G(this),(e=this.plugins)==null||e.forEach(u=>{var p;return(p=u.onUpdate)==null?void 0:p.call(u,t,l,this)}),this.batched||this.willUpdate(),this._pre.update(i),this._num.update({integer:s,fraction:r}),this._post.update(a),this.batched||this.didUpdate()}else{this._data=t,this.attachShadow({mode:"open"});try{this._internals??(this._internals=this.attachInternals()),this._internals.role="img"}catch{}if(typeof CSSStyleSheet<"u"&&this.shadowRoot.adoptedStyleSheets)S||(S=new CSSStyleSheet,S.replaceSync(P)),this.shadowRoot.adoptedStyleSheets=[S];else{const l=document.createElement("style");l.textContent=P,this.shadowRoot.appendChild(l)}this._pre=new F(this,i,{justify:"right",part:"left"}),this.shadowRoot.appendChild(this._pre.el),this._num=new nt(this,s,r),this.shadowRoot.appendChild(this._num.el),this._post=new F(this,a,{justify:"left",part:"right"}),this.shadowRoot.appendChild(this._post.el),this.created=!0}try{this._internals.ariaLabel=t.valueAsString}catch{}}willUpdate(){this._pre.willUpdate(),this._num.willUpdate(),this._post.willUpdate()}didUpdate(){if(!this.computedAnimated)return;this._abortAnimationsFinish?this._abortAnimationsFinish.abort():this.dispatchEvent(new Event("animationsstart")),this._pre.didUpdate(),this._num.didUpdate(),this._post.didUpdate();const t=new AbortController;Promise.all(this.shadowRoot.getAnimations().map(e=>e.finished)).then(()=>{t.signal.aborted||(this.dispatchEvent(new Event("animationsfinish")),this._abortAnimationsFinish=void 0)}),this._abortAnimationsFinish=t}}I.defaultProps={transformTiming:{duration:900,easing:"linear(0,.005,.019,.039,.066,.096,.129,.165,.202,.24,.278,.316,.354,.39,.426,.461,.494,.526,.557,.586,.614,.64,.665,.689,.711,.731,.751,.769,.786,.802,.817,.831,.844,.856,.867,.877,.887,.896,.904,.912,.919,.925,.931,.937,.942,.947,.951,.955,.959,.962,.965,.968,.971,.973,.976,.978,.98,.981,.983,.984,.986,.987,.988,.989,.99,.991,.992,.992,.993,.994,.994,.995,.995,.996,.996,.9963,.9967,.9969,.9972,.9975,.9977,.9979,.9981,.9982,.9984,.9985,.9987,.9988,.9989,1)"},spinTiming:void 0,opacityTiming:{duration:450,easing:"ease-out"},animated:!0,trend:(n,t)=>Math.sign(t-n),respectMotionPreference:!0,plugins:void 0,digits:void 0};class nt{constructor(t,e,i,{className:s,...r}={}){this.flow=t,this._integer=new L(t,e,{justify:"right",part:"integer"}),this._fraction=new L(t,i,{justify:"left",part:"fraction"}),this._inner=y("span",{className:"number__inner"},[this._integer.el,this._fraction.el]),this.el=y("span",{...r,part:"number",className:`number ${s??""}`},[this._inner])}willUpdate(){this._prevWidth=this.el.offsetWidth,this._prevLeft=this.el.getBoundingClientRect().left,this._integer.willUpdate(),this._fraction.willUpdate()}update({integer:t,fraction:e}){this._integer.update(t),this._fraction.update(e)}didUpdate(){const t=this.el.getBoundingClientRect();this._integer.didUpdate(),this._fraction.didUpdate();const e=this._prevLeft-t.left,i=this.el.offsetWidth,s=this._prevWidth-i;this.el.style.setProperty("--width",String(i)),this.el.animate({[R]:[`${e}px`,"0px"],[U]:[s,0]},{...this.flow.transformTiming,composite:"accumulate"})}}class D{constructor(t,e,{justify:i,className:s,...r},a){this.flow=t,this.children=new Map,this.onCharRemove=l=>()=>{this.children.delete(l)},this.justify=i;const o=e.map(l=>this.addChar(l).el);this.el=y("span",{...r,className:`section section--justify-${i} ${s??""}`},a?a(o):o)}addChar(t,{startDigitsAtZero:e=!1,...i}={}){const s=t.type==="integer"||t.type==="fraction"?new X(this,t.type,e?0:t.value,t.pos,{...i,onRemove:this.onCharRemove(t.key)}):new at(this,t.type,t.value,{...i,onRemove:this.onCharRemove(t.key)});return this.children.set(t.key,s),s}unpop(t){t.el.removeAttribute("inert"),t.el.style.top="",t.el.style[this.justify]=""}pop(t){t.forEach(e=>{e.el.style.top=`${e.el.offsetTop}px`,e.el.style[this.justify]=`${J(e.el,this.justify)}px`}),t.forEach(e=>{e.el.setAttribute("inert",""),e.present=!1})}addNewAndUpdateExisting(t){const e=new Map,i=new Map,s=this.justify==="left",r=s?"prepend":"append";if(Z(t,a=>{let o;this.children.has(a.key)?(o=this.children.get(a.key),i.set(a,o),this.unpop(o),o.present=!0):(o=this.addChar(a,{startDigitsAtZero:!0,animateIn:!0}),e.set(a,o)),this.el[r](o.el)},{reverse:s}),this.flow.computedAnimated){const a=this.el.getBoundingClientRect();e.forEach(o=>{o.willUpdate(a)})}e.forEach((a,o)=>{a.update(o.value)}),i.forEach((a,o)=>{a.update(o.value)})}willUpdate(){const t=this.el.getBoundingClientRect();this._prevOffset=t[this.justify],this.children.forEach(e=>e.willUpdate(t))}didUpdate(){const t=this.el.getBoundingClientRect();this.children.forEach(s=>s.didUpdate(t));const e=t[this.justify],i=this._prevOffset-e;i&&this.children.size&&this.el.animate({transform:[`translateX(${i}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}class L extends D{update(t){const e=new Map;this.children.forEach((i,s)=>{t.find(r=>r.key===s)||e.set(s,i),this.unpop(i)}),this.addNewAndUpdateExisting(t),e.forEach(i=>{i instanceof X&&i.update(0)}),this.pop(e)}}class F extends D{update(t){const e=new Map;this.children.forEach((i,s)=>{t.find(r=>r.key===s)||e.set(s,i)}),this.pop(e),this.addNewAndUpdateExisting(t)}}class x{constructor(t,e,{onRemove:i,animateIn:s=!1}={}){this.flow=t,this.el=e,this._present=!0,this._remove=()=>{var r;this.el.remove(),(r=this._onRemove)==null||r.call(this)},this.el.classList.add("animate-presence"),this.flow.computedAnimated&&s&&this.el.animate({[E]:[-.9999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),this._onRemove=i}get present(){return this._present}set present(t){if(this._present!==t){if(this._present=t,t?this.el.removeAttribute("inert"):this.el.setAttribute("inert",""),!this.flow.computedAnimated){t||this._remove();return}this.el.style.setProperty("--_number-flow-d-opacity",t?"0":"-.999"),this.el.animate({[E]:t?[-.9999,0]:[.999,0]},{...this.flow.opacityTiming,composite:"accumulate"}),t?this.flow.removeEventListener("animationsfinish",this._remove):this.flow.addEventListener("animationsfinish",this._remove,{once:!0})}}}class W extends x{constructor(t,e,i,s){super(t.flow,i,s),this.section=t,this.value=e,this.el=i}}class X extends W{constructor(t,e,i,s,r){var a,o;const l=(((o=(a=t.flow.digits)==null?void 0:a[s])==null?void 0:o.max)??9)+1,u=Array.from({length:l}).map((f,m)=>{const g=y("span",{className:"digit__num"},[document.createTextNode(String(m))]);return m!==i&&g.setAttribute("inert",""),g.style.setProperty("--n",String(m)),g}),p=y("span",{part:`digit ${e}-digit`,className:"digit"},u);p.style.setProperty("--current",String(i)),p.style.setProperty("--length",String(l)),super(t,i,p,r),this.pos=s,this._onAnimationsFinish=()=>{this.el.classList.remove("is-spinning")},this._numbers=u,this.length=l}willUpdate(t){const e=this.el.getBoundingClientRect();this._prevValue=this.value;const i=e[this.section.justify]-t[this.section.justify],s=e.width/2;this._prevCenter=this.section.justify==="left"?i+s:i-s}update(t){this.el.style.setProperty("--current",String(t)),this._numbers.forEach((e,i)=>i===t?e.removeAttribute("inert"):e.setAttribute("inert","")),this.value=t}didUpdate(t){const e=this.el.getBoundingClientRect(),i=e[this.section.justify]-t[this.section.justify],s=e.width/2,r=this.section.justify==="left"?i+s:i-s,a=this._prevCenter-r;a&&this.el.animate({transform:[`translateX(${a}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"});const o=this.getDelta();o&&(this.el.classList.add("is-spinning"),this.el.animate({[k]:[-o,0]},{...this.flow.spinTiming??this.flow.transformTiming,composite:"accumulate"}),this.flow.addEventListener("animationsfinish",this._onAnimationsFinish,{once:!0}))}getDelta(){var t;if(this.flow.plugins)for(const s of this.flow.plugins){const r=(t=s.getDelta)==null?void 0:t.call(s,this.value,this._prevValue,this);if(r!=null)return r}const e=this.value-this._prevValue,i=this.flow.computedTrend||Math.sign(e);return i<0&&this.value>this._prevValue?this.value-this.length-this._prevValue:i>0&&this.value<this._prevValue?this.length-this._prevValue+this.value:e}}class at extends W{constructor(t,e,i,s){const r=y("span",{className:"symbol__value",textContent:i});super(t,i,y("span",{part:`symbol ${e}`,className:"symbol"},[r]),s),this.type=e,this._children=new Map,this._onChildRemove=a=>()=>{this._children.delete(a)},this._children.set(i,new x(this.flow,r,{onRemove:this._onChildRemove(i)}))}willUpdate(t){if(this.type==="decimal")return;const e=this.el.getBoundingClientRect();this._prevOffset=e[this.section.justify]-t[this.section.justify]}update(t){if(this.value!==t){const e=this._children.get(this.value);e&&(e.present=!1);const i=this._children.get(t);if(i)i.present=!0;else{const s=y("span",{className:"symbol__value",textContent:t});this.el.appendChild(s),this._children.set(t,new x(this.flow,s,{animateIn:!0,onRemove:this._onChildRemove(t)}))}}this.value=t}didUpdate(t){if(this.type==="decimal")return;const e=this.el.getBoundingClientRect()[this.section.justify]-t[this.section.justify],i=this._prevOffset-e;i&&this.el.animate({transform:[`translateX(${i}px)`,"none"]},{...this.flow.transformTiming,composite:"accumulate"})}}const rt=parseInt(c.version.match(/^(\d+)\./)?.[1]),j=rt>=19,ot=["data","digits"];class T extends I{attributeChangedCallback(t,e,i){this[t]=JSON.parse(i)}}T.observedAttributes=j?[]:ot;Y("number-flow-react",T);const lt={},O=j?n=>n:JSON.stringify;function V(n){const{transformTiming:t,spinTiming:e,opacityTiming:i,animated:s,respectMotionPreference:r,trend:a,plugins:o,...l}=n;return[{transformTiming:t,spinTiming:e,opacityTiming:i,animated:s,respectMotionPreference:r,trend:a,plugins:o},l]}class ht extends c.Component{updateProperties(t){if(!this.el)return;this.el.batched=!this.props.isolate;const[e]=V(this.props);Object.entries(e).forEach(([i,s])=>{this.el[i]=s??T.defaultProps[i]}),t?.onAnimationsStart&&this.el.removeEventListener("animationsstart",t.onAnimationsStart),this.props.onAnimationsStart&&this.el.addEventListener("animationsstart",this.props.onAnimationsStart),t?.onAnimationsFinish&&this.el.removeEventListener("animationsfinish",t.onAnimationsFinish),this.props.onAnimationsFinish&&this.el.addEventListener("animationsfinish",this.props.onAnimationsFinish)}componentDidMount(){this.updateProperties(),j&&this.el&&(this.el.digits=this.props.digits,this.el.data=this.props.data)}getSnapshotBeforeUpdate(t){if(this.updateProperties(t),t.data!==this.props.data){if(this.props.group)return this.props.group.willUpdate(),()=>this.props.group?.didUpdate();if(!this.props.isolate)return this.el?.willUpdate(),()=>this.el?.didUpdate()}return null}componentDidUpdate(t,e,i){i?.()}handleRef(t){this.props.innerRef&&(this.props.innerRef.current=t),this.el=t}render(){const[t,{innerRef:e,className:i,data:s,willChange:r,isolate:a,group:o,digits:l,onAnimationsStart:u,onAnimationsFinish:p,...f}]=V(this.props);return c.createElement("number-flow-react",{ref:this.handleRef,"data-will-change":r?"":void 0,class:i,...f,dangerouslySetInnerHTML:{__html:""},suppressHydrationWarning:!0,digits:O(l),data:O(s)})}constructor(t){super(t),this.handleRef=this.handleRef.bind(this)}}const ft=c.forwardRef(function({value:t,locales:e,format:i,prefix:s,suffix:r,...a},o){c.useImperativeHandle(o,()=>l.current,[]);const l=c.useRef(),u=c.useContext(H);u?.useRegister(l);const p=c.useMemo(()=>e?JSON.stringify(e):"",[e]),f=c.useMemo(()=>i?JSON.stringify(i):"",[i]),m=c.useMemo(()=>{const g=lt[`${p}:${f}`]??=new Intl.NumberFormat(e,i);return q(t,g,s,r)},[t,p,f,s,r]);return c.createElement(ht,{...a,group:u,data:m,innerRef:l})}),H=c.createContext(void 0);function mt({children:n}){const t=c.useRef(new Set),e=c.useRef(!1),i=c.useRef(new WeakMap),s=c.useMemo(()=>({useRegister(r){c.useEffect(()=>(t.current.add(r),()=>{t.current.delete(r)}),[])},willUpdate(){e.current||(e.current=!0,t.current.forEach(r=>{const a=r.current;!a||!a.created||(a.willUpdate(),i.current.set(a,!0))}))},didUpdate(){t.current.forEach(r=>{const a=r.current;!a||!i.current.get(a)||(a.didUpdate(),i.current.delete(a))}),e.current=!1}}),[]);return c.createElement(H.Provider,{value:s},n)}const ct=()=>c.useSyncExternalStore(()=>()=>{},()=>B,()=>!1),dt=()=>c.useSyncExternalStore(n=>(w?.addEventListener("change",n),()=>w?.removeEventListener("change",n)),()=>w.matches,()=>!1);function gt({respectMotionPreference:n=!0}={}){const t=ct(),e=dt();return t&&(!n||!e)}export{T as NumberFlowElement,mt as NumberFlowGroup,ut as continuous,ft as default,gt as useCanAnimate,ct as useIsSupported,dt as usePrefersReducedMotion};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{k as v,u as b,b as j,l as y,r as k,j as e,L as F,H as P,B,X as E,e as C,f as T,m as S,P as U,A,S as x,n as H,o as L,s as M}from"./index-
|
|
1
|
+
import{k as v,u as b,b as j,l as y,r as k,j as e,L as F,H as P,B,X as E,e as C,f as T,m as S,P as U,A,S as x,n as H,o as L,s as M}from"./index-CMTzNTew.js";import{T as I}from"./topic-filter-LTRvZ8aU.js";import{S as z}from"./sprout-C3cc0c-K.js";const f=({profile:s,update:l,isLoading:t,onOpenChange:r})=>{const o=S("index","me"),{data:m}=o,n=s.handle===m?.handle,p=()=>{l(s.id,{followedByMe:!0})},i=()=>{l(s.id,{followedByMe:!1})},c=j();return e.jsx("div",{className:"flex w-full cursor-pointer items-start gap-3 pt-4 [&:last-of-type>:nth-child(2)]:border-none",onClick:()=>{c(`/profile/${s.handle}`)},children:e.jsxs("div",{className:"flex w-full flex-col gap-1 border-b border-gray-200 pb-4 dark:border-gray-950",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(U,{actor:s,isCurrentUser:n,children:e.jsxs("div",{className:"flex gap-3",children:[e.jsx(A,{author:{icon:{url:s.avatarUrl},name:s.name,handle:s.handle},onClick:()=>r?.(!1)}),e.jsxs("div",{className:"-mt-0.5 flex grow flex-col break-anywhere",children:[e.jsx("span",{className:"line-clamp-1 font-semibold text-black dark:text-white",children:t?e.jsx(x,{className:"w-full max-w-48"}):s.name}),e.jsx("span",{className:"line-clamp-1 text-md text-gray-700 dark:text-gray-600",children:t?e.jsx(x,{className:"w-32"}):s.handle})]})]})}),t?e.jsx("div",{className:"inline-flex items-center",children:e.jsx(x,{className:"w-24"})}):n?null:e.jsx(H,{className:"ml-auto",following:s.followedByMe,handle:s.handle,type:"primary",onFollow:p,onUnfollow:i})]}),e.jsx("div",{className:"pl-[52px]",children:t?e.jsx(x,{className:"w-full max-w-96"}):s.bio&&e.jsx("div",{dangerouslySetInnerHTML:{__html:L(M(s.bio,["a","br"]))},className:"ap-profile-content pointer-events-none mt-0 line-clamp-2 max-w-[460px] break-anywhere"})})]})})},Q=()=>{const{isExplainerClosed:s,setExplainerClosed:l}=v(),t=b(),r=j(),o=t.topic||"top",{exploreProfilesQuery:m,updateExploreProfile:n}=y("index",o),{data:p,isLoading:i,fetchNextPage:c,hasNextPage:h,isFetchingNextPage:u}=m,g=Array(10).fill(null).map((a,d)=>({id:`skeleton-${d}`,name:"",handle:"",avatarUrl:"",bio:"",url:"",followedByMe:!1})),w=p?.pages.flatMap(a=>a.accounts)||[];return k.useEffect(()=>{const a=document.querySelector(".load-more-trigger");if(!a)return;const d=new IntersectionObserver(N=>{N[0].isIntersecting&&h&&!u&&c()},{threshold:.1});return d.observe(a),()=>d.disconnect()},[h,u,c]),e.jsxs(F,{children:[!s&&e.jsxs("div",{className:"relative mb-6 flex items-start gap-1 rounded-md bg-gradient-to-r from-[#CFB0FF66] to-[#B6E8FF66] p-4 pr-10 dark:from-[#CFB0FF20] dark:to-[#B6E8FF20]",children:[e.jsx("div",{className:"min-w-[46px]",children:e.jsx(z,{className:"text-purple",size:46,strokeWidth:.75})}),e.jsxs("div",{className:"mt-1 flex flex-col gap-[2px]",children:[e.jsx(P,{className:"text-pretty",children:"The fastest way to grow your followers, is to follow others!"}),e.jsx("p",{className:"2xl:text-pretty text-balance text-sm text-black/60 dark:text-white/60",children:"Here are some recommendations to get you started, from Ghost publishers and other great accounts from around the social web."})]}),e.jsx(B,{className:"absolute right-4 top-[17px] size-6 opacity-40",variant:"link",onClick:()=>l(!0),children:e.jsx(E,{size:20})})]}),e.jsx(I,{currentTopic:o,excludeTopics:["following"],onTopicChange:a=>{a==="top"?r("/explore",{replace:!0}):r(`/explore/${a}`,{replace:!0})}}),e.jsx("div",{className:"mt-12 flex flex-col gap-12 pb-20 max-md:mt-5",children:i?e.jsx("div",{children:g.map(a=>e.jsx("div",{className:"mx-auto w-full max-w-[640px]",children:e.jsx(f,{isLoading:i,profile:a,update:()=>{}})},a.id))}):e.jsxs("div",{className:"mx-auto flex w-full max-w-[640px] flex-col items-center",children:[e.jsx("div",{className:"w-full",children:w.map(a=>e.jsx(C.Fragment,{children:e.jsx(f,{isLoading:!1,profile:a,update:n})},a.id))}),e.jsx("div",{className:"load-more-trigger h-4 w-full"}),u&&e.jsx("div",{className:"mt-2 flex w-full justify-center",children:e.jsx(T,{size:"sm"})})]})})]})};export{Q as default};
|