ghost 6.25.0 → 6.25.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.25.1.tgz +0 -0
- package/components/{tryghost-parse-email-address-6.25.0.tgz → tryghost-parse-email-address-6.25.1.tgz} +0 -0
- package/core/built/admin/assets/{PolarAngleAxis-BNo3yZOE.js → PolarAngleAxis-C6ZeSpZB.js} +1 -1
- package/core/built/admin/assets/{_baseAssignValue-DwWJd_kU.js → _baseAssignValue-BKAl5FrV.js} +1 -1
- package/core/built/admin/assets/{a-large-small-DzN0AB7t.js → a-large-small-B_ulQCIs.js} +1 -1
- 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-De3K_osj.mjs → code-editor-view-CBYT1gA1.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-bGxDzD13.mjs → index-CN5CixaU.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-5D8KqsFU.mjs → index-CPQODntW.mjs} +2 -2
- package/core/built/admin/assets/admin-x-settings/{index-BIUDn7ot.mjs → index-CgTfOd7g.mjs} +9 -9
- package/core/built/admin/assets/admin-x-settings/{modals-DuokUyAH.mjs → modals-_y-6HROx.mjs} +2 -2
- package/core/built/admin/assets/{at-sign-vqoOA4VZ.js → at-sign-B8xWKM0y.js} +1 -1
- package/core/built/admin/assets/{audience-CFjVlFTu.js → audience-CBOR--z9.js} +1 -1
- package/core/built/admin/assets/{avatar-flipboard-DuTJ0ty5.js → avatar-flipboard-IipGb_wZ.js} +1 -1
- package/core/built/admin/assets/{bluesky-sharing-C1WkXrRJ.js → bluesky-sharing-CkI1QuAm.js} +1 -1
- package/core/built/admin/assets/{chart-Bs2L1q8g.js → chart-_slUcr-K.js} +1 -1
- package/core/built/admin/assets/{chunk.524.ed5714f505e821e549f3.js → chunk.524.5b9b463506a16221fc91.js} +6 -6
- package/core/built/admin/assets/{chunk.582.639cecaca9e77bd7dd4f.js → chunk.582.d8eae1661d753befaefd.js} +7 -7
- package/core/built/admin/assets/{chunk.603.5cb992da88800a9388f3.js → chunk.630.3dbb0231a2d871126a80.js} +4 -4
- package/core/built/admin/assets/{code-editor-view-DIH4grxv.js → code-editor-view-BWMqr2JV.js} +1 -1
- package/core/built/admin/assets/comments-BeoA0nfK.js +1 -0
- package/core/built/admin/assets/{content-helpers-Cr_DHEOl.js → content-helpers-CmTGdEmL.js} +1 -1
- package/core/built/admin/assets/{copy-w3c9zkaZ.js → copy-CDHcAPJw.js} +1 -1
- package/core/built/admin/assets/{data-list-D-K_XfF3.js → data-list-Crb1ffbp.js} +1 -1
- package/core/built/admin/assets/{deleted-feed-item-DK47iaMV.js → deleted-feed-item-DBW0zJQg.js} +1 -1
- package/core/built/admin/assets/{dropzone-BHWXAN0m.js → dropzone-B9JUsQlW.js} +3 -3
- package/core/built/admin/assets/{edit-profile-DCyHhZgx.js → edit-profile-Dz-IhetN.js} +1 -1
- package/core/built/admin/assets/{empty-indicator-DjmACVr2.js → empty-indicator-2QGnEbtY.js} +1 -1
- package/core/built/admin/assets/{en-Cl0b7CNW.js → en-BRQS1Z8j.js} +1 -1
- package/core/built/admin/assets/{feed-C5AauoXf.js → feed-T3kW9UJA.js} +1 -1
- package/core/built/admin/assets/filters-ChOMQQZW.js +1 -0
- package/core/built/admin/assets/{gh-chart-xjwu2HZo.js → gh-chart-fuWw60Ka.js} +1 -1
- package/core/built/admin/assets/{growth-DDyypj0q.js → growth-D9sCnmon.js} +1 -1
- package/core/built/admin/assets/{hash-Bowe71Lt.js → hash-CI1pQ1UC.js} +1 -1
- package/core/built/admin/assets/header-OevT95FI.js +1 -0
- package/core/built/admin/assets/{inbox-DS4qMjUb.js → inbox-DYY8-M1K.js} +1 -1
- package/core/built/admin/assets/{index-A6WmqYr6.js → index-8CZdLQzu.js} +1 -1
- package/core/built/admin/assets/{index-6Ag8SK_E.js → index-BDAOs7pI.js} +1 -1
- package/core/built/admin/assets/{index-B_XhekWb.js → index-BEEgMX-_.js} +1 -1
- package/core/built/admin/assets/index-BbveDn8H.css +1 -0
- package/core/built/admin/assets/{index-CfpTfwls.js → index-C-Cpbee5.js} +1 -1
- package/core/built/admin/assets/{index-4xuWCs9h.js → index-CCF2RKxR.js} +12 -12
- package/core/built/admin/assets/{index-JMWMnGGt.js → index-CEnfjH5h.js} +3 -3
- package/core/built/admin/assets/{index-N61Xkr32.js → index-CcFVbffG.js} +1 -1
- package/core/built/admin/assets/{index-CZK1A375.js → index-CyMlhfZJ.js} +1 -1
- package/core/built/admin/assets/{index-CFY2MOp4.js → index-DBZYUfjO.js} +1 -1
- package/core/built/admin/assets/{index-C8ssgmjI.js → index-DJa3pLmx.js} +1 -1
- package/core/built/admin/assets/{index-SDMWxO5r.js → index-DVqmhe-L.js} +1 -1
- package/core/built/admin/assets/{index-BCvRITTU.js → index-DW5aEj6O.js} +2 -2
- package/core/built/admin/assets/{index-CVvW6Q-y.js → index-DcFgRUSN.js} +1 -1
- package/core/built/admin/assets/{index-DX6vaEVx.js → index-DjgsxHeB.js} +1 -1
- package/core/built/admin/assets/{index-B8XuCPIT.js → index-mqQc8MVd.js} +1 -1
- package/core/built/admin/assets/{index-DqlHFtZD.js → index-qQZsxgFE.js} +1 -1
- package/core/built/admin/assets/{koenig-lexical-DL3I-AcK.js → koenig-lexical-CsbE6fpi.js} +1 -1
- package/core/built/admin/assets/kpis-Dw04ruBN.js +1 -0
- package/core/built/admin/assets/{label-DBwnwMrX.js → label-tBvn89sm.js} +1 -1
- package/core/built/admin/assets/{links-CnjcW0lg.js → links-Do4jcjIh.js} +1 -1
- package/core/built/admin/assets/{loader-circle-CGDGFypO.js → loader-circle-C8exRUku.js} +4 -4
- package/core/built/admin/assets/{lucide-react-BfVLf4Hw.js → lucide-react-4VO5Dwow.js} +1 -1
- package/core/built/admin/assets/{main-layout-C_UH037j.js → main-layout-BAqXRgAx.js} +1 -1
- package/core/built/admin/assets/{member-route-CKuE9uDU.js → member-route-D4n-RbQd.js} +1 -1
- package/core/built/admin/assets/members-DRLgwCgJ.js +15 -0
- package/core/built/admin/assets/{message-square-text-BDJyLbG2.js → message-square-text-CC_1bY-Q.js} +5 -5
- package/core/built/admin/assets/{minus-BM0xhFIQ.js → minus-DSyx9DCe.js} +1 -1
- package/core/built/admin/assets/{modals-B6ZySU0x.js → modals-AryZr_DA.js} +1 -1
- package/core/built/admin/assets/{moderation-CQMIGpv1.js → moderation-DwKm9LO-.js} +1 -1
- package/core/built/admin/assets/{newsletter-Dexg7vU8.js → newsletter-C0rydPGS.js} +1 -1
- package/core/built/admin/assets/{newsletters-CT4k07rm.js → newsletters-DKdmxfDG.js} +1 -1
- package/core/built/admin/assets/{note-CiemurXq.js → note-996Zos9G.js} +1 -1
- package/core/built/admin/assets/{overview-9TwqfzGq.js → overview-r17hlWAB.js} +1 -1
- package/core/built/admin/assets/{pagemenu-Dq744OgH.js → pagemenu-DzpB1AkZ.js} +17 -17
- package/core/built/admin/assets/{post-analytics-CcRhLDKA.js → post-analytics-AwufPVFE.js} +1 -1
- package/core/built/admin/assets/{post-analytics-context-COgn3d86.js → post-analytics-context-GFe0lMc-.js} +1 -1
- package/core/built/admin/assets/{post-analytics-header-DtBp2QSX.js → post-analytics-header-DmGyNvP9.js} +1 -1
- package/core/built/admin/assets/{post-share-modal-BlOEKX3-.js → post-share-modal-CTpdCS2X.js} +1 -1
- package/core/built/admin/assets/posts/{comments-C4rwkXWy.mjs → comments-Cvt31uBs.mjs} +32 -31
- package/core/built/admin/assets/posts/{dialog-Chkt119L.mjs → dialog-DaViJlnd.mjs} +3 -3
- package/core/built/admin/assets/posts/{dropdown-menu-CvSs_ay2.mjs → dropdown-menu-B4KGMiRI.mjs} +5 -5
- package/core/built/admin/assets/posts/{empty-indicator-GyeO28CG.mjs → empty-indicator-BaD6pCXM.mjs} +2 -2
- package/core/built/admin/assets/posts/{filters-BD3A2GlB.mjs → filters-BsCI4RJg.mjs} +11 -7
- package/core/built/admin/assets/posts/{get-site-timezone-Baeue4hE.mjs → get-site-timezone-Bo-iI2bI.mjs} +2 -2
- package/core/built/admin/assets/posts/{growth-kmVbKjBt.mjs → growth-BJxIDp2o.mjs} +14 -14
- package/core/built/admin/assets/posts/header-7zhnErbb.mjs +100 -0
- package/core/built/admin/assets/posts/{heading-DV_WQJh4.mjs → heading-BCDx_eVF.mjs} +2 -2
- package/core/built/admin/assets/posts/{hooks-DQhsid0U.mjs → hooks-DQL2O_El.mjs} +2 -2
- package/core/built/admin/assets/posts/{index-CVum5OE6.mjs → index-0mEgtljt.mjs} +3 -3
- package/core/built/admin/assets/posts/{index-Bl1ReYmV.mjs → index-BTzJVQ6S.mjs} +10 -10
- package/core/built/admin/assets/posts/{input-C7qFEkmt.mjs → input-DaHXv92f.mjs} +2 -2
- package/core/built/admin/assets/posts/{kpis-DteuJY-D.mjs → kpis-GRsx6fPV.mjs} +10 -10
- package/core/built/admin/assets/posts/{links-eoZr0T0x.mjs → links-B1q_pqE9.mjs} +4 -4
- package/core/built/admin/assets/posts/{loading-indicator-Dj1SCL40.mjs → loading-indicator-DiYqXomj.mjs} +3 -3
- package/core/built/admin/assets/posts/{main-layout-Ct-TA0TH.mjs → main-layout-DeqPTJTe.mjs} +2 -2
- package/core/built/admin/assets/posts/{members-BY9oPKo4.mjs → members-LABk5yI5.mjs} +3055 -2831
- package/core/built/admin/assets/posts/{newsletter-BR1tln6E.mjs → newsletter-C_nbHBaP.mjs} +15 -15
- package/core/built/admin/assets/posts/{overview-j1ANMAQ2.mjs → overview-AJnKv4Ze.mjs} +16 -16
- package/core/built/admin/assets/posts/{post-analytics-DnG-Rolr.mjs → post-analytics-b_CKsePp.mjs} +6 -6
- package/core/built/admin/assets/posts/{post-analytics-context-hiKFF4yE.mjs → post-analytics-context-D6jtpxxm.mjs} +5 -5
- package/core/built/admin/assets/posts/{post-analytics-header-OqAJ8SUL.mjs → post-analytics-header-R5UF_tF0.mjs} +11 -11
- package/core/built/admin/assets/posts/{post-share-modal-BWfujDu2.mjs → post-share-modal-y4BEOajk.mjs} +4 -4
- package/core/built/admin/assets/posts/{posts-CS9tqSJC.mjs → posts-C2hNrf1c.mjs} +2 -2
- package/core/built/admin/assets/posts/posts.js +1 -1
- package/core/built/admin/assets/posts/{reply-CX_EQh9X.mjs → reply-2Uvi3Kxb.mjs} +2 -2
- package/core/built/admin/assets/posts/{search-BqzdnPQb.mjs → search-se7meOnL.mjs} +2 -2
- package/core/built/admin/assets/posts/{select-CD5WLIrZ.mjs → select-DpUpauFg.mjs} +8 -8
- package/core/built/admin/assets/posts/{separator-DFPLsWCc.mjs → separator-CdBM46dw.mjs} +3 -3
- package/core/built/admin/assets/posts/{settings-lnEt3Kb-.mjs → settings-Chhj9xKP.mjs} +2 -2
- package/core/built/admin/assets/posts/{sheet-CkLfUqdH.mjs → sheet--k3SiDko.mjs} +3 -3
- package/core/built/admin/assets/posts/{skeleton-BZCi-IYy.mjs → skeleton-CUSLSLoY.mjs} +3 -3
- package/core/built/admin/assets/posts/{source-icon-C0k2hDC_.mjs → source-icon-BjYUIoXN.mjs} +3 -3
- package/core/built/admin/assets/posts/{stats-AHbSTqzG.mjs → stats-BRdXKaxM.mjs} +4 -4
- package/core/built/admin/assets/posts/{table-DMrf6wp5.mjs → table-Bgi_UcfL.mjs} +2 -2
- package/core/built/admin/assets/posts/{tabs-BH8GNJCe.mjs → tabs-DT8Bh72E.mjs} +14 -14
- package/core/built/admin/assets/posts/{tags-C5VV8Gd0.mjs → tags-BCFLnZYl.mjs} +61 -60
- package/core/built/admin/assets/posts/{tags-DucujdYI.mjs → tags-Kv2q0o3p.mjs} +2 -2
- package/core/built/admin/assets/posts/{use-scroll-restoration-C7A3TpAz.mjs → use-scroll-restoration-CLAUAal3.mjs} +6 -6
- package/core/built/admin/assets/posts/{virtual-list-window-BIGoc0th.mjs → virtual-list-window-CQDEqNBL.mjs} +180 -274
- package/core/built/admin/assets/posts/{web-DczNailO.mjs → web-CqN0MQU6.mjs} +18 -18
- package/core/built/admin/assets/{posts-Dr3u9yOp.js → posts-GvXDuhVG.js} +1 -1
- package/core/built/admin/assets/{referrers-6As_USul.js → referrers-Bd9pW-WX.js} +1 -1
- package/core/built/admin/assets/{repeat-D-Ki-Cg5.js → repeat-y6HlMgGO.js} +2 -2
- package/core/built/admin/assets/{reply-C4V0xZ2U.js → reply-Cc8ryI5v.js} +2 -2
- package/core/built/admin/assets/{select-Dt579MbD.js → select-CGr_5qad.js} +1 -1
- package/core/built/admin/assets/{settings-BMsoTszq.js → settings-BPsfSgg3.js} +1 -1
- package/core/built/admin/assets/{settings-Ck1Hqs1x.js → settings-BTd0Adha.js} +4 -4
- package/core/built/admin/assets/{sort-button-Bn325H3y.js → sort-button-k76_5HR2.js} +1 -1
- package/core/built/admin/assets/{source-icon-CNqsYZeA.js → source-icon-DMt0UskC.js} +1 -1
- package/core/built/admin/assets/{sprout-C9DbfYGe.js → sprout-Td9eaOoY.js} +2 -2
- package/core/built/admin/assets/{square-CWrI0H4v.js → square-Df8vEYlG.js} +1 -1
- package/core/built/admin/assets/stats/{audience-DBW5Xu1c.mjs → audience-DMTObpL8.mjs} +3 -3
- package/core/built/admin/assets/stats/{content-helpers-BR6DcWwH.mjs → content-helpers-ReMp9KJN.mjs} +4 -4
- package/core/built/admin/assets/stats/{index-CFvGHbAV.mjs → index-6L-yLKFX.mjs} +8 -8
- package/core/built/admin/assets/stats/{index-BuS4r1cs.mjs → index-CIUyjeP-.mjs} +5 -5
- package/core/built/admin/assets/stats/{index-DKS4mzS-.mjs → index-CMSDpQm3.mjs} +11 -7
- package/core/built/admin/assets/stats/{index-ZjicrvMA.mjs → index-Ca-_KJzy.mjs} +5 -5
- package/core/built/admin/assets/stats/{index-TeAxlGlY.mjs → index-CfO5yPSP.mjs} +5 -5
- package/core/built/admin/assets/stats/{sort-button-DbwzvVKL.mjs → sort-button-BB_M2CdZ.mjs} +3 -3
- package/core/built/admin/assets/stats/{stats-BatzfgdA.mjs → stats-B2nnuLeU.mjs} +2 -2
- package/core/built/admin/assets/stats/stats.js +1 -1
- package/core/built/admin/assets/stats/{tabs-B32ptD5t.mjs → tabs-DjJG-d3O.mjs} +3 -3
- package/core/built/admin/assets/stats/{use-growth-stats-DmTT2gKd.mjs → use-growth-stats-BMT5M7l6.mjs} +3 -3
- package/core/built/admin/assets/{stats-G4Ge9ETb.js → stats-Bs9ZbmXX.js} +1 -1
- package/core/built/admin/assets/{stats-view-Bx3oDAIW.js → stats-view-BWoPuaLz.js} +1 -1
- package/core/built/admin/assets/{step-1-y3anLU0g.js → step-1-BUvsuCs0.js} +1 -1
- package/core/built/admin/assets/{step-2-Dr1lGnHU.js → step-2-DI9ekXls.js} +1 -1
- package/core/built/admin/assets/{step-3-C_d2hvMs.js → step-3-DzT_XhaS.js} +2 -2
- package/core/built/admin/assets/{table-CbN_vbUx.js → table-BKqaEGAm.js} +1 -1
- package/core/built/admin/assets/{tabs-DFJzY5np.js → tabs-G6Ql8vbf.js} +1 -1
- package/core/built/admin/assets/tags-BHm-dlBs.js +1 -0
- package/core/built/admin/assets/{tags-Ddg8oG2Y.js → tags-_taMP0sJ.js} +1 -1
- package/core/built/admin/assets/{textarea-DikWsYMt.js → textarea-DcVuGYYq.js} +1 -1
- package/core/built/admin/assets/{tiers-B7qV_8mO.js → tiers-kv-xBoqQ.js} +1 -1
- package/core/built/admin/assets/{toggle-group-tXaaTD7P.js → toggle-group-DsatLdt7.js} +1 -1
- package/core/built/admin/assets/{topic-filter-bQtscKE6.js → topic-filter-DkJyIuAf.js} +1 -1
- package/core/built/admin/assets/{trash--VS50LgS.js → trash-BeZZgbn-.js} +1 -1
- package/core/built/admin/assets/{upload-Dz-DI9rQ.js → upload-BG7KNIn7.js} +4 -4
- package/core/built/admin/assets/{use-growth-stats-DNVioFUq.js → use-growth-stats-CNGdl44N.js} +1 -1
- package/core/built/admin/assets/{use-scroll-restoration-CxWEiCuS.js → use-scroll-restoration-CQ3w0W98.js} +1 -1
- package/core/built/admin/assets/{use-simple-pagination-BA6xsVQO.js → use-simple-pagination-BeIJ_5Vv.js} +1 -1
- package/core/built/admin/assets/{user-plus-B0tpOnLM.js → user-plus-CMxR50-Y.js} +1 -1
- package/core/built/admin/assets/{user-round-check-caJYm0bB.js → user-round-check-2nhPmqP3.js} +1 -1
- package/core/built/admin/assets/virtual-list-window-Uq8oKYVG.js +4 -0
- package/core/built/admin/assets/{wallet-cards-DBM65lA_.js → wallet-cards-CJcVzH0D.js} +1 -1
- package/core/built/admin/assets/{web-CSXixG1S.js → web-BPwTFKrc.js} +1 -1
- package/core/built/admin/index.html +5 -5
- package/core/server/services/members/service.js +0 -22
- package/core/server/services/verification/verification-webhook-service.js +2 -2
- package/core/server/services/verification/verification-webhook-service.ts +2 -2
- package/core/server/services/verification-trigger.js +34 -69
- package/core/shared/labs.js +2 -2
- package/package.json +5 -5
- package/tsconfig.tsbuildinfo +1 -1
- package/components/tryghost-i18n-6.25.0.tgz +0 -0
- package/core/built/admin/assets/comments-gAnA10dK.js +0 -1
- package/core/built/admin/assets/filters-DzSJ1ez3.js +0 -1
- package/core/built/admin/assets/index-Chp0ODAU.css +0 -1
- package/core/built/admin/assets/kpis-Bm-hIEkf.js +0 -1
- package/core/built/admin/assets/members-CzztojNk.js +0 -15
- package/core/built/admin/assets/tags-D5g9tXZU.js +0 -1
- package/core/built/admin/assets/virtual-list-window-JdKgHS9L.js +0 -4
- package/core/shared/config/env/config.testing-browser.json +0 -98
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{ce as wv,dt as x0}from"./index-
|
|
1
|
+
import{ce as wv,dt as x0}from"./index-CEnfjH5h.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-BKAl5FrV.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);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,3 +1,3 @@
|
|
|
1
|
-
import{t as I,aD as ye,r as O,aS as De,j as e,B as Ce,bX as Te,bY as je,bR as Ke,am as T,cD as Q,aT as st,cE as $,b0 as nt,aP as it,b2 as ot,b4 as de,d0 as z,aU as lt,ai as re,bU as ct,aj as W,S as Ge,cC as dt,bJ as mt,bK as ut,bL as pt,bM as ft,bN as ht,bO as xt,ak as B,b7 as Pe}from"./index-JMWMnGGt.js";import{s as oe,g as H,d as bt,S as gt,a as vt,D as jt,b as yt}from"./stats-view-Bx3oDAIW.js";import{E as ce}from"./empty-indicator-DjmACVr2.js";import{A as St,a as At}from"./wallet-cards-DBM65lA_.js";import{G as wt,C as Nt,X as Dt,Y as Ct}from"./gh-chart-xjwu2HZo.js";import{T as Ve,a as $e,K as me,d as Y,e as Tt,b as ue}from"./tabs-DFJzY5np.js";import{a as _t,c as kt}from"./audience-CFjVlFTu.js";import{S as te,B as Ot}from"./sort-button-Bn325H3y.js";import{S as Pt,C as X,g as Mt,b as Rt}from"./content-helpers-Cr_DHEOl.js";import{e as le,c as K,f as F,g as Et,a as Ye,b as ze,d as U}from"./table-CbN_vbUx.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-G4Ge9ETb.js";import{u as Gt}from"./referrers-6As_USul.js";import{C as be,a as _e,b as ke,h as Oe,c as ge,j as Vt}from"./pagemenu-Dq744OgH.js";import{h as ne,F as $t,T as Yt,b as fe,r as Ae,H as ae,L as ie,o as J,c as zt,S as Ut,A as Ht,I as Wt,i as Me,d as qt,J as Z,u as Ue,e as Xt,K as Jt,G as Qt,m as he,l as Zt,n as ea,M as ta,N as pe,O as Re,g as aa,s as ra,C as He,a as We,v as sa,B as Ee}from"./chart-Bs2L1q8g.js";import{S as qe,a as Xe,b as Je,c as Qe,f as we}from"./select-Dt579MbD.js";import{u as na}from"./tiers-B7qV_8mO.js";import{P as ia,a as oa}from"./PolarAngleAxis-BNo3yZOE.js";import{k as la,l as ca,i as da}from"./lucide-react-BfVLf4Hw.js";import{u as ma}from"./use-growth-stats-DNVioFUq.js";import"./loader-circle-CGDGFypO.js";import"./user-plus-B0tpOnLM.js";import"./sprout-C9DbfYGe.js";import"./_baseAssignValue-DwWJd_kU.js";import"./index-6Ag8SK_E.js";import"./a-large-small-DzN0AB7t.js";import"./upload-Dz-DI9rQ.js";import"./at-sign-vqoOA4VZ.js";import"./copy-w3c9zkaZ.js";import"./message-square-text-BDJyLbG2.js";import"./hash-Bowe71Lt.js";import"./inbox-DS4qMjUb.js";import"./minus-BM0xhFIQ.js";import"./tags-Ddg8oG2Y.js";import"./square-CWrI0H4v.js";import"./user-round-check-caJYm0bB.js";import"./repeat-D-Ki-Cg5.js";import"./reply-C4V0xZ2U.js";import"./trash--VS50LgS.js";var xe;function se(r){"@babel/helpers - typeof";return se=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},se(r)}function ee(){return ee=Object.assign?Object.assign.bind():function(r){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},ee.apply(this,arguments)}function Be(r,a){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);a&&(t=t.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),n.push.apply(n,t)}return n}function R(r){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(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}function ua(r,a){if(!(r instanceof a))throw new TypeError("Cannot call a class as a function")}function Ie(r,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(r,et(t.key),t)}}function pa(r,a,n){return a&&Ie(r.prototype,a),n&&Ie(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function fa(r,a,n){return a=ve(a),ha(r,Ze()?Reflect.construct(a,n||[],ve(r).constructor):a.apply(r,n))}function ha(r,a){if(a&&(se(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xa(r)}function xa(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Ze(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ze=function(){return!!r})()}function ve(r){return ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ve(r)}function ba(r,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(a&&a.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),a&&Ne(r,a)}function Ne(r,a){return Ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,s){return t.__proto__=s,t},Ne(r,a)}function L(r,a,n){return a=et(a),a in r?Object.defineProperty(r,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[a]=n,r}function et(r){var a=ga(r,"string");return se(a)=="symbol"?a:a+""}function ga(r,a){if(se(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var t=n.call(r,a);if(se(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}var G=(function(r){function a(n){var t;return ua(this,a),t=fa(this,a,[n]),L(t,"pieRef",null),L(t,"sectorRefs",[]),L(t,"id",Jt("recharts-pie-")),L(t,"handleAnimationEnd",function(){var s=t.props.onAnimationEnd;t.setState({isAnimationFinished:!0}),ne(s)&&s()}),L(t,"handleAnimationStart",function(){var s=t.props.onAnimationStart;t.setState({isAnimationFinished:!1}),ne(s)&&s()}),t.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},t}return ba(a,r),pa(a,[{key:"isActiveIndex",value:function(t){var s=this.props.activeIndex;return Array.isArray(s)?s.indexOf(t)!==-1:t===s}},{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 s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var l=this.props,i=l.label,h=l.labelLine,g=l.dataKey,c=l.valueKey,o=fe(this.props,!1),j=fe(i,!1),A=fe(h,!1),x=i&&i.offsetRadius||20,w=t.map(function(u,b){var N=(u.startAngle+u.endAngle)/2,p=Ae(u.cx,u.cy,u.outerRadius+x,N),f=R(R(R(R({},o),u),{},{stroke:"none"},j),{},{index:b,textAnchor:a.getTextAnchor(p.x,u.cx)},p),m=R(R(R(R({},o),u),{},{fill:"none",stroke:u.fill},A),{},{index:b,points:[Ae(u.cx,u.cy,u.outerRadius,N),p]}),v=g;return ae(g)&&ae(c)?v="value":ae(g)&&(v=c),I.createElement(ie,{key:"label-".concat(u.startAngle,"-").concat(u.endAngle,"-").concat(u.midAngle,"-").concat(b)},h&&a.renderLabelLineItem(h,m,"line"),a.renderLabelItem(i,f,J(u,v)))});return I.createElement(ie,{className:"recharts-pie-labels"},w)}},{key:"renderSectorsStatically",value:function(t){var s=this,l=this.props,i=l.activeShape,h=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=s.isActiveIndex(o),A=g&&s.hasActiveIndex()?g:null,x=j?i:A,w=R(R({},c),{},{stroke:h?c.fill:c.stroke,tabIndex:-1});return I.createElement(ie,ee({ref:function(b){b&&!s.sectorRefs.includes(b)&&s.sectorRefs.push(b)},tabIndex:-1,className:"recharts-pie-sector"},zt(s.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,s=this.props,l=s.sectors,i=s.isAnimationActive,h=s.animationBegin,g=s.animationDuration,c=s.animationEasing,o=s.animationId,j=this.state,A=j.prevSectors,x=j.prevIsAnimationActive;return I.createElement(Ht,{begin:h,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 u=w.t,b=[],N=l&&l[0],p=N.startAngle;return l.forEach(function(f,m){var v=A&&A[m],C=m>0?Wt(f,"paddingAngle",0):0;if(v){var S=Me(v.endAngle-v.startAngle,f.endAngle-f.startAngle),d=R(R({},f),{},{startAngle:p+C,endAngle:p+S(u)+C});b.push(d),p=d.endAngle}else{var k=f.endAngle,y=f.startAngle,D=Me(0,k-y),P=D(u),M=R(R({},f),{},{startAngle:p+C,endAngle:p+P+C});b.push(M),p=M.endAngle}}),I.createElement(ie,null,t.renderSectorsStatically(b))})}},{key:"attachKeyboardHandlers",value:function(t){var s=this;t.onkeydown=function(l){if(!l.altKey)switch(l.key){case"ArrowLeft":{var i=++s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[i].focus(),s.setState({sectorToFocus:i});break}case"ArrowRight":{var h=--s.state.sectorToFocus<0?s.sectorRefs.length-1:s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[h].focus(),s.setState({sectorToFocus:h});break}case"Escape":{s.sectorRefs[s.state.sectorToFocus].blur(),s.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var t=this.props,s=t.sectors,l=t.isAnimationActive,i=this.state.prevSectors;return l&&s&&s.length&&(!i||!qt(i,s))?this.renderSectorsWithAnimation():this.renderSectorsStatically(s)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var t=this,s=this.props,l=s.hide,i=s.sectors,h=s.className,g=s.label,c=s.cx,o=s.cy,j=s.innerRadius,A=s.outerRadius,x=s.isAnimationActive,w=this.state.isAnimationFinished;if(l||!i||!i.length||!Z(c)||!Z(o)||!Z(j)||!Z(A))return null;var u=ye("recharts-pie",h);return I.createElement(ie,{tabIndex:this.props.rootTabIndex,className:u,ref:function(N){t.pieRef=N}},this.renderSectors(),g&&this.renderLabels(i),Ue.renderCallByParent(this.props,null,!1),(!x||w)&&Xt.renderCallByParent(this.props,i,!1))}}],[{key:"getDerivedStateFromProps",value:function(t,s){return s.prevIsAnimationActive!==t.isAnimationActive?{prevIsAnimationActive:t.isAnimationActive,prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:[],isAnimationFinished:!0}:t.isAnimationActive&&t.animationId!==s.prevAnimationId?{prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:s.curSectors,isAnimationFinished:!0}:t.sectors!==s.curSectors?{curSectors:t.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(t,s){return t>s?"start":t<s?"end":"middle"}},{key:"renderLabelLineItem",value:function(t,s,l){if(I.isValidElement(t))return I.cloneElement(t,s);if(ne(t))return t(s);var i=ye("recharts-pie-label-line",typeof t!="boolean"?t.className:"");return I.createElement($t,ee({},s,{key:l,type:"linear",className:i}))}},{key:"renderLabelItem",value:function(t,s,l){if(I.isValidElement(t))return I.cloneElement(t,s);var i=l;if(ne(t)&&(i=t(s),I.isValidElement(i)))return i;var h=ye("recharts-pie-label-text",typeof t!="boolean"&&!ne(t)?t.className:"");return I.createElement(Yt,ee({},s,{alignmentBaseline:"middle",className:h}),i)}}])})(O.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:!Qt.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});L(G,"parseDeltaAngle",function(r,a){var n=he(a-r),t=Math.min(Math.abs(a-r),360);return n*t});L(G,"getRealPieData",function(r){var a=r.data,n=r.children,t=fe(r,!1),s=Zt(n,ea);return a&&a.length?a.map(function(l,i){return R(R(R({payload:l},t),l),s&&s[i]&&s[i].props)}):s&&s.length?s.map(function(l){return R(R({},t),l.props)}):[]});L(G,"parseCoordinateOfPie",function(r,a){var n=a.top,t=a.left,s=a.width,l=a.height,i=ta(s,l),h=t+pe(r.cx,s,s/2),g=n+pe(r.cy,l,l/2),c=pe(r.innerRadius,i,0),o=pe(r.outerRadius,i,i*.8),j=r.maxRadius||Math.sqrt(s*s+l*l)/2;return{cx:h,cy:g,innerRadius:c,outerRadius:o,maxRadius:j}});L(G,"getComposedData",function(r){var a=r.item,n=r.offset,t=a.type.defaultProps!==void 0?R(R({},a.type.defaultProps),a.props):a.props,s=xe.getRealPieData(t);if(!s||!s.length)return null;var l=t.cornerRadius,i=t.startAngle,h=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),u=xe.parseDeltaAngle(i,h),b=Math.abs(u),N=c;ae(c)&&ae(j)?(Re(!1,`Use "dataKey" to specify the value of pie,
|
|
1
|
+
import{t as I,aE as je,r as O,aT as De,j as e,B as Ce,bX as Te,bY as ye,bR as Ke,ao as T,cD as J,aU as st,cE as $,b1 as nt,aQ as it,b3 as ot,b5 as de,d0 as z,aV as lt,ak as re,bU as ct,al as W,S as Ge,cC as dt,bJ as mt,bK as ut,bL as pt,bM as ft,bN as ht,bO as xt,am as B,b7 as Pe}from"./index-CEnfjH5h.js";import{s as oe,g as H,d as bt,S as gt,a as vt,D as yt,b as jt}from"./stats-view-BWoPuaLz.js";import{E as ce}from"./empty-indicator-2QGnEbtY.js";import{A as St,a as At}from"./wallet-cards-CJcVzH0D.js";import{G as wt,C as Nt,X as Dt,Y as Ct}from"./gh-chart-fuWw60Ka.js";import{T as Ve,a as $e,K as me,d as Y,e as Tt,b as ue}from"./tabs-G6Ql8vbf.js";import{a as _t,c as kt}from"./audience-CBOR--z9.js";import{S as te,B as Ot}from"./sort-button-k76_5HR2.js";import{S as Pt,C as Q,g as Mt,b as Rt}from"./content-helpers-CmTGdEmL.js";import{e as le,c as K,f as F,g as Et,a as Ye,b as ze,d as U}from"./table-BKqaEGAm.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-Bs9ZbmXX.js";import{u as Gt}from"./referrers-Bd9pW-WX.js";import{C as be,a as _e,b as ke,h as Oe,c as ge,j as Vt}from"./pagemenu-DzpB1AkZ.js";import{h as ne,F as $t,T as Yt,b as fe,r as Ae,H as ae,L as ie,o as X,c as zt,S as Ut,A as Ht,I as Wt,i as Me,d as qt,J as Z,u as Ue,e as Qt,K as Xt,G as Jt,m as he,l as Zt,n as ea,M as ta,N as pe,O as Re,g as aa,s as ra,C as He,a as We,v as sa,B as Ee}from"./chart-_slUcr-K.js";import{S as qe,a as Qe,b as Xe,c as Je,f as we}from"./select-CGr_5qad.js";import{u as na}from"./tiers-kv-xBoqQ.js";import{P as ia,a as oa}from"./PolarAngleAxis-C6ZeSpZB.js";import{k as la,l as ca,i as da}from"./lucide-react-4VO5Dwow.js";import{u as ma}from"./use-growth-stats-CNGdl44N.js";import"./loader-circle-C8exRUku.js";import"./user-plus-CMxR50-Y.js";import"./sprout-Td9eaOoY.js";import"./_baseAssignValue-BKAl5FrV.js";import"./index-BDAOs7pI.js";import"./a-large-small-B_ulQCIs.js";import"./upload-BG7KNIn7.js";import"./at-sign-B8xWKM0y.js";import"./copy-CDHcAPJw.js";import"./message-square-text-CC_1bY-Q.js";import"./hash-CI1pQ1UC.js";import"./inbox-DYY8-M1K.js";import"./minus-DSyx9DCe.js";import"./tags-_taMP0sJ.js";import"./square-Df8vEYlG.js";import"./user-round-check-2nhPmqP3.js";import"./repeat-y6HlMgGO.js";import"./reply-Cc8ryI5v.js";import"./trash-BeZZgbn-.js";var xe;function se(r){"@babel/helpers - typeof";return se=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},se(r)}function ee(){return ee=Object.assign?Object.assign.bind():function(r){for(var a=1;a<arguments.length;a++){var n=arguments[a];for(var t in n)Object.prototype.hasOwnProperty.call(n,t)&&(r[t]=n[t])}return r},ee.apply(this,arguments)}function Be(r,a){var n=Object.keys(r);if(Object.getOwnPropertySymbols){var t=Object.getOwnPropertySymbols(r);a&&(t=t.filter(function(s){return Object.getOwnPropertyDescriptor(r,s).enumerable})),n.push.apply(n,t)}return n}function R(r){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(r,t,n[t])}):Object.getOwnPropertyDescriptors?Object.defineProperties(r,Object.getOwnPropertyDescriptors(n)):Be(Object(n)).forEach(function(t){Object.defineProperty(r,t,Object.getOwnPropertyDescriptor(n,t))})}return r}function ua(r,a){if(!(r instanceof a))throw new TypeError("Cannot call a class as a function")}function Ie(r,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(r,et(t.key),t)}}function pa(r,a,n){return a&&Ie(r.prototype,a),n&&Ie(r,n),Object.defineProperty(r,"prototype",{writable:!1}),r}function fa(r,a,n){return a=ve(a),ha(r,Ze()?Reflect.construct(a,n||[],ve(r).constructor):a.apply(r,n))}function ha(r,a){if(a&&(se(a)==="object"||typeof a=="function"))return a;if(a!==void 0)throw new TypeError("Derived constructors may only return object or undefined");return xa(r)}function xa(r){if(r===void 0)throw new ReferenceError("this hasn't been initialised - super() hasn't been called");return r}function Ze(){try{var r=!Boolean.prototype.valueOf.call(Reflect.construct(Boolean,[],function(){}))}catch{}return(Ze=function(){return!!r})()}function ve(r){return ve=Object.setPrototypeOf?Object.getPrototypeOf.bind():function(n){return n.__proto__||Object.getPrototypeOf(n)},ve(r)}function ba(r,a){if(typeof a!="function"&&a!==null)throw new TypeError("Super expression must either be null or a function");r.prototype=Object.create(a&&a.prototype,{constructor:{value:r,writable:!0,configurable:!0}}),Object.defineProperty(r,"prototype",{writable:!1}),a&&Ne(r,a)}function Ne(r,a){return Ne=Object.setPrototypeOf?Object.setPrototypeOf.bind():function(t,s){return t.__proto__=s,t},Ne(r,a)}function L(r,a,n){return a=et(a),a in r?Object.defineProperty(r,a,{value:n,enumerable:!0,configurable:!0,writable:!0}):r[a]=n,r}function et(r){var a=ga(r,"string");return se(a)=="symbol"?a:a+""}function ga(r,a){if(se(r)!="object"||!r)return r;var n=r[Symbol.toPrimitive];if(n!==void 0){var t=n.call(r,a);if(se(t)!="object")return t;throw new TypeError("@@toPrimitive must return a primitive value.")}return String(r)}var G=(function(r){function a(n){var t;return ua(this,a),t=fa(this,a,[n]),L(t,"pieRef",null),L(t,"sectorRefs",[]),L(t,"id",Xt("recharts-pie-")),L(t,"handleAnimationEnd",function(){var s=t.props.onAnimationEnd;t.setState({isAnimationFinished:!0}),ne(s)&&s()}),L(t,"handleAnimationStart",function(){var s=t.props.onAnimationStart;t.setState({isAnimationFinished:!1}),ne(s)&&s()}),t.state={isAnimationFinished:!n.isAnimationActive,prevIsAnimationActive:n.isAnimationActive,prevAnimationId:n.animationId,sectorToFocus:0},t}return ba(a,r),pa(a,[{key:"isActiveIndex",value:function(t){var s=this.props.activeIndex;return Array.isArray(s)?s.indexOf(t)!==-1:t===s}},{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 s=this.props.isAnimationActive;if(s&&!this.state.isAnimationFinished)return null;var l=this.props,i=l.label,h=l.labelLine,g=l.dataKey,c=l.valueKey,o=fe(this.props,!1),y=fe(i,!1),A=fe(h,!1),x=i&&i.offsetRadius||20,w=t.map(function(u,b){var N=(u.startAngle+u.endAngle)/2,p=Ae(u.cx,u.cy,u.outerRadius+x,N),f=R(R(R(R({},o),u),{},{stroke:"none"},y),{},{index:b,textAnchor:a.getTextAnchor(p.x,u.cx)},p),m=R(R(R(R({},o),u),{},{fill:"none",stroke:u.fill},A),{},{index:b,points:[Ae(u.cx,u.cy,u.outerRadius,N),p]}),v=g;return ae(g)&&ae(c)?v="value":ae(g)&&(v=c),I.createElement(ie,{key:"label-".concat(u.startAngle,"-").concat(u.endAngle,"-").concat(u.midAngle,"-").concat(b)},h&&a.renderLabelLineItem(h,m,"line"),a.renderLabelItem(i,f,X(u,v)))});return I.createElement(ie,{className:"recharts-pie-labels"},w)}},{key:"renderSectorsStatically",value:function(t){var s=this,l=this.props,i=l.activeShape,h=l.blendStroke,g=l.inactiveShape;return t.map(function(c,o){if(c?.startAngle===0&&c?.endAngle===0&&t.length!==1)return null;var y=s.isActiveIndex(o),A=g&&s.hasActiveIndex()?g:null,x=y?i:A,w=R(R({},c),{},{stroke:h?c.fill:c.stroke,tabIndex:-1});return I.createElement(ie,ee({ref:function(b){b&&!s.sectorRefs.includes(b)&&s.sectorRefs.push(b)},tabIndex:-1,className:"recharts-pie-sector"},zt(s.props,c,o),{key:"sector-".concat(c?.startAngle,"-").concat(c?.endAngle,"-").concat(c.midAngle,"-").concat(o)}),I.createElement(Ut,ee({option:x,isActive:y,shapeType:"sector"},w)))})}},{key:"renderSectorsWithAnimation",value:function(){var t=this,s=this.props,l=s.sectors,i=s.isAnimationActive,h=s.animationBegin,g=s.animationDuration,c=s.animationEasing,o=s.animationId,y=this.state,A=y.prevSectors,x=y.prevIsAnimationActive;return I.createElement(Ht,{begin:h,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 u=w.t,b=[],N=l&&l[0],p=N.startAngle;return l.forEach(function(f,m){var v=A&&A[m],C=m>0?Wt(f,"paddingAngle",0):0;if(v){var S=Me(v.endAngle-v.startAngle,f.endAngle-f.startAngle),d=R(R({},f),{},{startAngle:p+C,endAngle:p+S(u)+C});b.push(d),p=d.endAngle}else{var k=f.endAngle,j=f.startAngle,D=Me(0,k-j),P=D(u),M=R(R({},f),{},{startAngle:p+C,endAngle:p+P+C});b.push(M),p=M.endAngle}}),I.createElement(ie,null,t.renderSectorsStatically(b))})}},{key:"attachKeyboardHandlers",value:function(t){var s=this;t.onkeydown=function(l){if(!l.altKey)switch(l.key){case"ArrowLeft":{var i=++s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[i].focus(),s.setState({sectorToFocus:i});break}case"ArrowRight":{var h=--s.state.sectorToFocus<0?s.sectorRefs.length-1:s.state.sectorToFocus%s.sectorRefs.length;s.sectorRefs[h].focus(),s.setState({sectorToFocus:h});break}case"Escape":{s.sectorRefs[s.state.sectorToFocus].blur(),s.setState({sectorToFocus:0});break}}}}},{key:"renderSectors",value:function(){var t=this.props,s=t.sectors,l=t.isAnimationActive,i=this.state.prevSectors;return l&&s&&s.length&&(!i||!qt(i,s))?this.renderSectorsWithAnimation():this.renderSectorsStatically(s)}},{key:"componentDidMount",value:function(){this.pieRef&&this.attachKeyboardHandlers(this.pieRef)}},{key:"render",value:function(){var t=this,s=this.props,l=s.hide,i=s.sectors,h=s.className,g=s.label,c=s.cx,o=s.cy,y=s.innerRadius,A=s.outerRadius,x=s.isAnimationActive,w=this.state.isAnimationFinished;if(l||!i||!i.length||!Z(c)||!Z(o)||!Z(y)||!Z(A))return null;var u=je("recharts-pie",h);return I.createElement(ie,{tabIndex:this.props.rootTabIndex,className:u,ref:function(N){t.pieRef=N}},this.renderSectors(),g&&this.renderLabels(i),Ue.renderCallByParent(this.props,null,!1),(!x||w)&&Qt.renderCallByParent(this.props,i,!1))}}],[{key:"getDerivedStateFromProps",value:function(t,s){return s.prevIsAnimationActive!==t.isAnimationActive?{prevIsAnimationActive:t.isAnimationActive,prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:[],isAnimationFinished:!0}:t.isAnimationActive&&t.animationId!==s.prevAnimationId?{prevAnimationId:t.animationId,curSectors:t.sectors,prevSectors:s.curSectors,isAnimationFinished:!0}:t.sectors!==s.curSectors?{curSectors:t.sectors,isAnimationFinished:!0}:null}},{key:"getTextAnchor",value:function(t,s){return t>s?"start":t<s?"end":"middle"}},{key:"renderLabelLineItem",value:function(t,s,l){if(I.isValidElement(t))return I.cloneElement(t,s);if(ne(t))return t(s);var i=je("recharts-pie-label-line",typeof t!="boolean"?t.className:"");return I.createElement($t,ee({},s,{key:l,type:"linear",className:i}))}},{key:"renderLabelItem",value:function(t,s,l){if(I.isValidElement(t))return I.cloneElement(t,s);var i=l;if(ne(t)&&(i=t(s),I.isValidElement(i)))return i;var h=je("recharts-pie-label-text",typeof t!="boolean"&&!ne(t)?t.className:"");return I.createElement(Yt,ee({},s,{alignmentBaseline:"middle",className:h}),i)}}])})(O.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:!Jt.isSsr,animationBegin:400,animationDuration:1500,animationEasing:"ease",nameKey:"name",blendStroke:!1,rootTabIndex:0});L(G,"parseDeltaAngle",function(r,a){var n=he(a-r),t=Math.min(Math.abs(a-r),360);return n*t});L(G,"getRealPieData",function(r){var a=r.data,n=r.children,t=fe(r,!1),s=Zt(n,ea);return a&&a.length?a.map(function(l,i){return R(R(R({payload:l},t),l),s&&s[i]&&s[i].props)}):s&&s.length?s.map(function(l){return R(R({},t),l.props)}):[]});L(G,"parseCoordinateOfPie",function(r,a){var n=a.top,t=a.left,s=a.width,l=a.height,i=ta(s,l),h=t+pe(r.cx,s,s/2),g=n+pe(r.cy,l,l/2),c=pe(r.innerRadius,i,0),o=pe(r.outerRadius,i,i*.8),y=r.maxRadius||Math.sqrt(s*s+l*l)/2;return{cx:h,cy:g,innerRadius:c,outerRadius:o,maxRadius:y}});L(G,"getComposedData",function(r){var a=r.item,n=r.offset,t=a.type.defaultProps!==void 0?R(R({},a.type.defaultProps),a.props):a.props,s=xe.getRealPieData(t);if(!s||!s.length)return null;var l=t.cornerRadius,i=t.startAngle,h=t.endAngle,g=t.paddingAngle,c=t.dataKey,o=t.nameKey,y=t.valueKey,A=t.tooltipType,x=Math.abs(t.minAngle),w=xe.parseCoordinateOfPie(t,n),u=xe.parseDeltaAngle(i,h),b=Math.abs(u),N=c;ae(c)&&ae(y)?(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
|
-
the props "valueKey" will be deprecated in 1.1.0`),N=j);var p=s.filter(function(d){return J(d,N,0)!==0}).length,f=(b>=360?p:p-1)*g,m=b-p*x-f,v=s.reduce(function(d,k){var y=J(k,N,0);return d+(Z(y)?y:0)},0),C;if(v>0){var S;C=s.map(function(d,k){var y=J(d,N,0),D=J(d,o,k),P=(Z(y)?y:0)/v,M;k?M=S.endAngle+he(u)*g*(y!==0?1:0):M=i;var _=M+he(u)*((y!==0?x:0)+P*m),E=(M+_)/2,V=(w.innerRadius+w.outerRadius)/2,q=[{name:D,value:y,payload:d,dataKey:N,type:A}],rt=Ae(w.cx,w.cy,V,E);return S=R(R(R({percent:P,cornerRadius:l,name:D,tooltipPayload:q,midAngle:E,middleRadius:V,tooltipPosition:rt},d),w),{},{value:J(d,N),startAngle:M,endAngle:_,payload:d,paddingAngle:he(u)*g}),S})}return R(R({},w),{},{sectors:C,data:s})});var va=aa({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:r})=>{const a=De();return e.jsx(ce,{actions:e.jsx(Ce,{variant:"outline",onClick:()=>a("/settings/analytics",{crossApp:!0}),children:"Open settings"}),className:r,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=r=>r==="total-members"||r==="free-members"||r==="paid-members"||r==="mrr",ya=({active:r,payload:a,range:n,color:t,showBreakdown:s})=>{if(!r||!a?.length)return null;const l=a[0].payload,{date:i,formattedValue:h,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:[s&&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||"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:h})]})]})]})]})},Sa=({chartData:r,totals:a,initialTab:n,currencySymbol:t,isLoading:s,onTabChange:l})=>{const i=ja(n)?n:"total-members",[h,g]=O.useState(i),{range:c}=Te(),{appSettings:o}=je(),j=De(),[A]=Ke();O.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:u,paidMembers:b,mrr:N,percentChanges:p,directions:f}=a,m=O.useMemo(()=>{if(!r||r.length===0)return[];let S=[],d="value";switch(h){case"free-members":d="free";break;case"paid-members":d="paid";break;case"mrr":{d="mrr";break}default:d="value"}S=oe(r,c,d,"exact");let k=[];switch(h){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:Q(y.mrr),formattedValue:`${t}${T(Q(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},[h,r,c,t]),v={"total-members":{color:"var(--chart-darkblue)"},"free-members":{color:"var(--chart-blue)"},"paid-members":{color:"var(--chart-purple)"},mrr:{color:"var(--chart-teal)"}};return s?e.jsx("div",{className:"-mb-6 flex h-[calc(16vw+132px)] w-full items-start justify-center",children:e.jsx(st,{})}):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(me,{className:o?.paidMembersEnabled?"":"cursor-auto after:hidden",value:"total-members",onClick:()=>{o?.paidMembersEnabled&&x("total-members")},children:e.jsx(Y,{color:"var(--chart-darkblue)",diffDirection:c===$.allTime.value?"hidden":f.total,diffValue:p.total,label:"Total members",value:T(w)})}),o?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsx(me,{value:"free-members",onClick:()=>{x("free-members")},children:e.jsx(Y,{color:"var(--chart-blue)",diffDirection:c===$.allTime.value?"hidden":f.free,diffValue:p.free,label:"Free members",value:T(u)})}),e.jsx(me,{value:"paid-members",onClick:()=>{x("paid-members")},children:e.jsx(Y,{color:"var(--chart-purple)",diffDirection:c===$.allTime.value?"hidden":f.paid,diffValue:p.paid,label:"Paid members",value:T(b)})}),e.jsx(me,{value:"mrr",onClick:()=>{x("mrr")},children:e.jsx(Y,{color:"var(--chart-teal)",diffDirection:c===$.allTime.value?"hidden":f.mrr,diffValue:p.mrr,label:"MRR",value:`${t}${T(Q(N))}`})})]})]}),o?.paidMembersEnabled&&e.jsxs(nt,{children:[e.jsx(it,{className:"lg:hidden",asChild:!0,children:e.jsxs(Tt,{children:[h==="total-members"&&e.jsx(Y,{color:"var(--chart-darkblue)",diffDirection:c===$.allTime.value?"hidden":f.total,diffValue:p.total,label:"Total members",value:T(w)}),h==="free-members"&&e.jsx(Y,{color:"var(--chart-blue)",diffDirection:c===$.allTime.value?"hidden":f.free,diffValue:p.free,label:"Free members",value:T(u)}),h==="paid-members"&&e.jsx(Y,{color:"var(--chart-purple)",diffDirection:c===$.allTime.value?"hidden":f.paid,diffValue:p.paid,label:"Paid members",value:T(b)}),h==="mrr"&&e.jsx(Y,{color:"var(--chart-teal)",diffDirection:c===$.allTime.value?"hidden":f.mrr,diffValue:p.mrr,label:"MRR",value:`${t}${T(Q(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[h].color,data:m,dataFormatter:h==="mrr"?S=>`${t}${T(S)}`:T,id:h,range:c,tooltipContent:h==="paid-members"?e.jsx(ya,{color:v["paid-members"].color,range:c,showBreakdown:!0}):void 0})})]})},Aa=(r,a="signups desc",n=50)=>{const{startDate:t,endDate:s,timezone:l}=re(r),i={date_from:W(t),date_to:W(s),member_status:_t(ct),order:a,limit:n.toString()};return l&&(i.timezone=l),Gt({searchParams:i})},Fe=({data:r,currencySymbol:a,limit:n,defaultSourceIconUrl:t})=>{const s=n?r.slice(0,n):r,{appSettings:l}=je();return e.jsx(le,{children:s.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(Q(i.mrr))]})]})]},i.source))})},wa=({range:r,limit:a=20,showViewAll:n=!1,sortBy:t,setSortBy:s})=>{const{data:l}=Te(),{data:i}=It(),{appSettings:h}=je(),[g,c]=O.useState("free_members desc"),o=t||g,j=s||c,A=o.replace("free_members","signups").replace("paid_members","paid_conversions"),{data:x,isLoading:w}=Aa(r,A,a),u=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,u),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,u]),f="Top sources",m=`Where did your growth come from ${H(r)}`;return h?.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:h?.paidMembersEnabled?4:2,children:e.jsx(ce,{description:"Try adjusting your date range to see more data.",title:`No conversions ${H(r)}`,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(mt,{children:[e.jsx(ut,{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(ft,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[e.jsx(ht,{children:f}),e.jsx(xt,{children:m})]}),e.jsx("div",{className:"group/datalist",children:e.jsxs(Ye,{children:[e.jsx(ze,{children:e.jsxs(K,{children:[e.jsx(U,{children:"Source"}),e.jsx(U,{className:"w-[110px] text-right",children:e.jsx(te,{activeSortBy:o,setSortBy:j,sortBy:"free_members desc",children:"Free members"})}),h?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"w-[110px] text-right",children:e.jsx(te,{activeSortBy:o,setSortBy:j,sortBy:"paid_members desc",children:"Paid members"})}),e.jsx(U,{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:h?.paidMembersEnabled?4:2,children:e.jsx(tt,{})})})})},Na=({active:r,payload:a})=>{if(r&&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:r,range:a})=>{const{data:n}=Ft(),{data:t}=Lt({searchParams:{date_from:W(re(a).startDate)}}),{data:{tiers:s=[]}={}}=na(),[l,i]=O.useState("billing-period"),{startDate:h,endDate:g}=O.useMemo(()=>re(a),[a]),c=O.useMemo(()=>W(h),[h]),o=O.useMemo(()=>W(g),[g]),j=O.useMemo(()=>s.filter(m=>m.type==="paid"&&m.active).map(m=>({id:m.id,name:m.name})),[s]),A=O.useMemo(()=>{if(!t?.stats||t.stats.length===0)return 0;const m=t.stats,v=B(c),C=B(o),S=m.filter(P=>{const M=B(P.date);return M.isSameOrAfter(v)&&M.isSameOrBefore(C)});if(S.length===0)return 0;const d=[...S].sort((P,M)=>new Date(P.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=O.useMemo(()=>{if(!n?.stats)return[];const m=B(c),v=B(o),C=n.stats.filter(d=>{const k=B(d.date);return k.isSameOrAfter(m)&&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,P="url(#gradientPurple)",M="var(--chart-purple)";return d==="month"?(D="Monthly",P="url(#gradientPurple)",M="var(--chart-purple)"):d==="year"?(D="Annual",P="url(#gradientTeal)",M="var(--chart-teal)"):d==="complimentary"&&(D="Complimentary",P="url(#gradientBlue)",M="var(--chart-blue)"),{id:`cadence-${y}`,name:D,count:k,fill:P,color:M}})},[n,c,o,A]),w=O.useMemo(()=>{if(!n?.stats||j.length===0)return[];const m=B(c),v=B(o),C=n.stats.filter(D=>{const P=B(D.date);return P.isSameOrAfter(m)&&P.isSameOrBefore(v)}).reduce((D,P)=>{const M=P.tier;return D[M]||(D[M]=0),D[M]+=P.signups,D},{}),S=[{gradient:"url(#gradientPurple)",solid:"var(--chart-purple)"},{gradient:"url(#gradientTeal)",solid:"var(--chart-teal)"},{gradient:"url(#gradientBlue)",solid:"var(--chart-blue)"},{gradient:"url(#gradientRose)",solid:"var(--chart-rose)"},{gradient:"url(#gradientOrange)",solid:"var(--chart-orange)"},{gradient:"url(#gradientGreen)",solid:"var(--chart-green)"},{gradient:"url(#gradientAmber)",solid:"var(--chart-amber)"},{gradient:"url(#gradientYellow)",solid:"var(--chart-yellow)"},{gradient:"url(#gradientDarkblue)",solid:"var(--chart-darkblue)"},{gradient:"url(#gradientGray)",solid:"var(--chart-darkgray)"}];return[...j.map(D=>{const P=C[D.id]||0;return{id:D.id,name:D.name,count:P}})].sort((D,P)=>P.count-D.count).map((D,P)=>{const M=P%S.length;return{...D,fill:S[M].gradient,color:S[M].solid}})},[n,j,c,o]),u=l==="billing-period"?x:w,b=O.useMemo(()=>u.reduce((m,v)=>m+v.count,0),[u]),N=O.useMemo(()=>{const m={count:{label:"Subscriptions"}};return u.forEach(v=>{m[v.id]={label:v.name,color:v.color}}),m},[u]),p=O.useMemo(()=>b===0?[]:u.map(m=>({label:m.name,count:m.count,percentage:m.count/b*100,color:m.color})),[u,b]);if(r||!n?.stats)return null;const f=u.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(Oe,{children:["New paid subscriptions ",H(a)]})]}),j.length>1&&e.jsx("div",{children:e.jsxs(qe,{value:l,onValueChange:m=>i(m),children:[e.jsx(Xe,{className:"w-full",children:e.jsx(Je,{})}),e.jsxs(Qe,{align:"end",children:[e.jsx(we,{value:"billing-period",children:"Billing period"}),e.jsx(we,{value:"tiers",children:"Tiers"})]})]})})]})}),e.jsx(ge,{children:f?e.jsxs(e.Fragment,{children:[e.jsx(He,{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:"var(--chart-purple)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-teal)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-rose)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-blue)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-orange)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-green)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-amber)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-yellow)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-darkblue)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-darkgray)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"var(--chart-darkgray)",stopOpacity:.6})]})]}),e.jsx(We,{content:e.jsx(Na,{}),cursor:!1}),e.jsx(G,{animationBegin:0,animationDuration:1e3,data:u,dataKey:"count",innerRadius:70,nameKey:"name",strokeWidth:5,children:e.jsx(Ue,{content:({viewBox:m})=>{if(m&&"cx"in m&&"cy"in m)return e.jsxs("text",{dominantBaseline:"middle",textAnchor:"middle",x:m.cx,y:m.cy,children:[e.jsx("tspan",{className:"fill-foreground text-2xl font-semibold tracking-tight",x:m.cx,y:m.cy,children:T(b)}),e.jsx("tspan",{className:"fill-muted-foreground",x:m.cx,y:(m.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(m=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"size-2 rounded-full opacity-50",style:{backgroundColor:m.color}}),e.jsx("span",{className:"max-w-[150px] truncate whitespace-nowrap",title:m.label,children:m.label}),e.jsxs("span",{className:"font-medium text-foreground",children:[Math.round(Number(m.percentage)||0),"%"]})]},m.label))})]}):e.jsx("div",{className:"py-12",children:e.jsx(ce,{description:`No new paid subscriptions ${H(a)}.`,title:"No new subscribers",children:e.jsx(la,{strokeWidth:1.5})})})})]})},Ca=(r,a,n)=>{if(a===1){const o=B().format("YYYY-MM-DD"),j=r.find(A=>A.date===o);return[{date:o,signups:j?.signups||0,cancellations:j?.cancellations||0}]}const{startDate:t,endDate:s}=re(a),l=B(s).diff(B(t),"days"),i=bt(a,l,"sum",n),h=new Map(r.map(o=>[o.date,o])),g=[],c=new Set;if(i==="monthly"){const o=B(t).startOf("month"),j=B(s).startOf("month");for(;o.isSameOrBefore(j);){const A=o.format("YYYY-MM-DD");if(!c.has(A)){c.add(A);const x=h.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(s).startOf("week");for(;o.isSameOrBefore(j);){const A=o.format("YYYY-MM-DD");if(!c.has(A)){c.add(A);const x=h.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(s);for(;o.isSameOrBefore(j);){const A=o.format("YYYY-MM-DD"),x=h.get(A);x?g.push(x):g.push({date:A,signups:0,cancellations:0}),o.add(1,"day")}}return g},at=r=>{if(r===-1){const{startDate:a,endDate:n}=re(r);return B(n).diff(B(a),"days")}return r},Ta=r=>{const a=at(r);return a<30?["daily"]:a>=91?["weekly","monthly"]:["daily","weekly"]},Le=r=>{const a=at(r);return a<30?"daily":a>=91?"monthly":"weekly"},_a=({subscriptionData:r,memberData:a,range:n,isLoading:t})=>{const[s,l]=O.useState(()=>Le(n));O.useEffect(()=>{l(Le(n))},[n]);const i=O.useMemo(()=>Ta(n),[n]),h=O.useMemo(()=>{switch(s){case"daily":return"none";case"weekly":return"weekly";case"monthly":return"monthly"}},[s]),g=O.useMemo(()=>{if(r&&r.length>0){if(n===1){const f=B().format("YYYY-MM-DD"),m=r.find(v=>v.date===f);return[{date:z(f,n),rawDate:f,new:m?.signups||0,cancelled:-(m?.cancellations||0)}]}const x=oe(r,n,"signups","sum",h),w=oe(r,n,"cancellations","sum",h),u=new Map(w.map(f=>[f.date,f])),b=x.map(f=>({date:f.date,signups:f.signups||0,cancellations:u.get(f.date)?.cancellations||0})),N=new Set(b.map(f=>f.date));return w.forEach(f=>{N.has(f.date)||b.push({date:f.date,signups:0,cancellations:f.cancellations||0})}),b.sort((f,m)=>new Date(f.date).getTime()-new Date(m.date).getTime()),Ca(b,n,h).map(f=>{let m=n;return s==="weekly"&&n<91?m=91:s==="monthly"&&n<365&&(m=365),{date:z(f.date,m),rawDate:f.date,new:f.signups||0,cancelled:-(f.cancellations||0)}})}else{if(!a||a.length===0)return[];if(n===1){const p=B().format("YYYY-MM-DD"),f=a.find(m=>m.date===p);return[{date:z(p,n),rawDate:p,new:f?.paid_subscribed||0,cancelled:-(f?.paid_canceled||0)}]}const x=oe(a,n,"paid_subscribed","sum",h),w=oe(a,n,"paid_canceled","sum",h),u=new Map(w.map(p=>[p.date,p])),b=x.map(p=>({date:p.date,paid_subscribed:p.paid_subscribed||0,paid_canceled:u.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,f)=>new Date(p.date).getTime()-new Date(f.date).getTime()),b.map(p=>{let f=n;return s==="weekly"&&n<91?f=91:s==="monthly"&&n<365&&(f=365),{date:z(p.date,f),rawDate:p.date,new:p.paid_subscribed||0,cancelled:-(p.paid_canceled||0)}})}},[a,r,n,h,s]),c={new:{label:"New",color:"var(--chart-teal)"},cancelled:{label:"Cancelled",color:"var(--chart-rose)"}},o=O.useMemo(()=>{const x=g.reduce((u,b)=>u+b.new,0),w=g.reduce((u,b)=>u+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(Oe,{children:["New and cancelled paid subscriptions ",H(n)]})]}),i.length>1&&e.jsx("div",{children:e.jsxs(qe,{value:s,onValueChange:x=>l(x),children:[e.jsx(Xe,{className:"w-[110px]",children:e.jsx(Je,{})}),e.jsx(Qe,{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(He,{className:"aspect-auto h-[200px] w-full md:h-[220px] xl:h-[260px]",config:c,children:e.jsxs(Ot,{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:"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(sa,{className:"min-w-[120px]! px-3 py-2",formatter:(x,w,u,b)=>{const N=Number(x);let p="0";N===0?p="0":p=N<0?T(N*-1):T(N);const f=Number(u?.payload?.new||0),m=Number(u?.payload?.cancelled||0),v=f+m,C=v===0?"0":v>0?`+${T(v)}`:T(v);let S=u?.payload?.date;return u?.payload?.rawDate&&(s==="monthly"?S=z(u.payload.rawDate,366):s==="weekly"?S=z(u.payload.rawDate,91):S=z(u.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 text-foreground tabular-nums",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 text-foreground tabular-nums",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 ${H(n)}.`,title:"No paid member changes",children:e.jsx(ca,{strokeWidth:1.5})})})})]})},ka=(r,a,n)=>{const t=r??30,s=a??"mrr desc",{startDate:l,endDate:i}=O.useMemo(()=>re(t),[t]),h=O.useMemo(()=>{const o={date_from:W(l),date_to:W(i),order:s};return n==="posts"?o.post_type="post":n==="pages"&&(o.post_type="page"),o},[l,i,s,n]),g=Object.fromEntries(Object.entries(h).filter(([,o])=>o!==void 0));return Kt({searchParams:g})},br=()=>{const{range:r,site:a,settings:n}=Te(),t=String(n.find(d=>d.key==="timezone")?.value||"Etc/UTC"),s=De(),[l,i]=O.useState("free_members desc"),[h,g]=O.useState(X.POSTS_AND_PAGES),[c]=Ke(),{appSettings:o}=je(),j=c.get("tab")||"total-members",[A,x]=O.useState(j);O.useEffect(()=>{j!==A&&x(j)},[j]);const{isLoading:w,chartData:u,totals:b,currencySymbol:N,subscriptionData:p}=ma(r),{data:f,isLoading:m}=ka(r,l,h),v=O.useMemo(()=>{const k=(f?.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),P=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")&&P>0?E=_.paid_members/P: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}})},[f,l]),C=w,S=w||m;return e.jsxs(gt,{children:[e.jsx(vt,{children:e.jsx(Vt,{children:e.jsx(jt,{})})}),e.jsxs(yt,{data:C?void 0:u,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:u,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:u,range:r,subscriptionData:p}),e.jsx(Da,{isLoading:C,range:r})]}),e.jsxs(be,{className:"w-full overflow-x-auto","data-testid":"top-content-card",children:[e.jsxs(_e,{children:[e.jsx(ke,{children:Mt(h)}),e.jsx(Oe,{children:Rt(h,r,H)})]}),e.jsx(ge,{children:e.jsxs(Ye,{children:[e.jsx(ze,{children:e.jsxs(K,{className:"[&>th]:h-auto [&>th]:pt-0 [&>th]:pb-2",children:[e.jsx(U,{className:"min-w-[320px] pl-0",children:e.jsx(Ve,{defaultValue:h,variant:"button-sm",onValueChange:d=>{g(d)},children:e.jsxs($e,{children:[e.jsx(ue,{value:X.POSTS_AND_PAGES,children:"Posts & pages"}),e.jsx(ue,{value:X.POSTS,children:"Posts"}),e.jsx(ue,{value:X.PAGES,children:"Pages"}),e.jsx(ue,{value:X.SOURCES,children:"Sources"})]})})}),e.jsx(U,{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(U,{className:"w-[140px] text-right",children:e.jsx(te,{activeSortBy:l,setSortBy:i,sortBy:"paid_members desc",children:"Paid members"})}),e.jsx(U,{className:"w-[140px] text-right",children:e.jsx(te,{activeSortBy:l,setSortBy:i,sortBy:"mrr desc",children:"MRR impact"})})]})]})}),h===X.SOURCES?e.jsx(wa,{limit:20,range:r,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 p-0 text-left leading-tight font-medium whitespace-normal hover:underline!",title:"View post analytics",variant:"link",onClick:kt(d.attribution_url,d.post_id,a.url||"",s,d.attribution_type),children:d.title}):e.jsx("span",{className:"font-medium",children:d.title}),d.published_at&&Pe&&new Date(d.published_at).getTime()>0&&e.jsxs("span",{className:"text-muted-foreground",children:["Published on ",Pe(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(Q(d.mrr))]})]})]},`${h}-${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 ${H(r)}`,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{br as default};
|
|
3
|
+
the props "valueKey" will be deprecated in 1.1.0`),N=y);var p=s.filter(function(d){return X(d,N,0)!==0}).length,f=(b>=360?p:p-1)*g,m=b-p*x-f,v=s.reduce(function(d,k){var j=X(k,N,0);return d+(Z(j)?j:0)},0),C;if(v>0){var S;C=s.map(function(d,k){var j=X(d,N,0),D=X(d,o,k),P=(Z(j)?j:0)/v,M;k?M=S.endAngle+he(u)*g*(j!==0?1:0):M=i;var _=M+he(u)*((j!==0?x:0)+P*m),E=(M+_)/2,V=(w.innerRadius+w.outerRadius)/2,q=[{name:D,value:j,payload:d,dataKey:N,type:A}],rt=Ae(w.cx,w.cy,V,E);return S=R(R(R({percent:P,cornerRadius:l,name:D,tooltipPayload:q,midAngle:E,middleRadius:V,tooltipPosition:rt},d),w),{},{value:X(d,N),startAngle:M,endAngle:_,payload:d,paddingAngle:he(u)*g}),S})}return R(R({},w),{},{sectors:C,data:s})});var va=aa({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:r})=>{const a=De();return e.jsx(ce,{actions:e.jsx(Ce,{variant:"outline",onClick:()=>a("/settings/analytics",{crossApp:!0}),children:"Open settings"}),className:r,description:"Enable member source tracking in settings to see which content drives member growth.",title:"Member sources have been disabled",children:e.jsx(St,{})})},ya=r=>r==="total-members"||r==="free-members"||r==="paid-members"||r==="mrr",ja=({active:r,payload:a,range:n,color:t,showBreakdown:s})=>{if(!r||!a?.length)return null;const l=a[0].payload,{date:i,formattedValue:h,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:[s&&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||"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:h})]})]})]})]})},Sa=({chartData:r,totals:a,initialTab:n,currencySymbol:t,isLoading:s,onTabChange:l})=>{const i=ya(n)?n:"total-members",[h,g]=O.useState(i),{range:c}=Te(),{appSettings:o}=ye(),y=De(),[A]=Ke();O.useEffect(()=>{g(i)},[i]);const x=S=>{g(S);const d=new URLSearchParams(A);d.set("tab",S),y(`?${d.toString()}`,{replace:!0}),l&&l(S)},{totalMembers:w,freeMembers:u,paidMembers:b,mrr:N,percentChanges:p,directions:f}=a,m=O.useMemo(()=>{if(!r||r.length===0)return[];let S=[],d="value";switch(h){case"free-members":d="free";break;case"paid-members":d="paid";break;case"mrr":{d="mrr";break}default:d="value"}S=oe(r,c,d,"exact");let k=[];switch(h){case"free-members":k=S.map(j=>({...j,value:j.free,formattedValue:T(j.free),label:"Free members"}));break;case"paid-members":k=S.map(j=>({...j,value:j.paid,formattedValue:T(j.paid),label:"Paid members",comped:j.comped,paid_subscribed:j.paid_subscribed}));break;case"mrr":k=S.map(j=>({...j,value:J(j.mrr),formattedValue:`${t}${T(J(j.mrr))}`,label:"MRR"}));break;default:k=S.map(j=>{const D=j.free+j.paid;return{...j,value:D,formattedValue:T(D),label:"Total members"}})}return k},[h,r,c,t]),v={"total-members":{color:"var(--chart-darkblue)"},"free-members":{color:"var(--chart-blue)"},"paid-members":{color:"var(--chart-purple)"},mrr:{color:"var(--chart-teal)"}};return s?e.jsx("div",{className:"-mb-6 flex h-[calc(16vw+132px)] w-full items-start justify-center",children:e.jsx(st,{})}):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(me,{className:o?.paidMembersEnabled?"":"cursor-auto after:hidden",value:"total-members",onClick:()=>{o?.paidMembersEnabled&&x("total-members")},children:e.jsx(Y,{color:"var(--chart-darkblue)",diffDirection:c===$.allTime.value?"hidden":f.total,diffValue:p.total,label:"Total members",value:T(w)})}),o?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsx(me,{value:"free-members",onClick:()=>{x("free-members")},children:e.jsx(Y,{color:"var(--chart-blue)",diffDirection:c===$.allTime.value?"hidden":f.free,diffValue:p.free,label:"Free members",value:T(u)})}),e.jsx(me,{value:"paid-members",onClick:()=>{x("paid-members")},children:e.jsx(Y,{color:"var(--chart-purple)",diffDirection:c===$.allTime.value?"hidden":f.paid,diffValue:p.paid,label:"Paid members",value:T(b)})}),e.jsx(me,{value:"mrr",onClick:()=>{x("mrr")},children:e.jsx(Y,{color:"var(--chart-teal)",diffDirection:c===$.allTime.value?"hidden":f.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:[h==="total-members"&&e.jsx(Y,{color:"var(--chart-darkblue)",diffDirection:c===$.allTime.value?"hidden":f.total,diffValue:p.total,label:"Total members",value:T(w)}),h==="free-members"&&e.jsx(Y,{color:"var(--chart-blue)",diffDirection:c===$.allTime.value?"hidden":f.free,diffValue:p.free,label:"Free members",value:T(u)}),h==="paid-members"&&e.jsx(Y,{color:"var(--chart-purple)",diffDirection:c===$.allTime.value?"hidden":f.paid,diffValue:p.paid,label:"Paid members",value:T(b)}),h==="mrr"&&e.jsx(Y,{color:"var(--chart-teal)",diffDirection:c===$.allTime.value?"hidden":f.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[h].color,data:m,dataFormatter:h==="mrr"?S=>`${t}${T(S)}`:T,id:h,range:c,tooltipContent:h==="paid-members"?e.jsx(ja,{color:v["paid-members"].color,range:c,showBreakdown:!0}):void 0})})]})},Aa=(r,a="signups desc",n=50)=>{const{startDate:t,endDate:s,timezone:l}=re(r),i={date_from:W(t),date_to:W(s),member_status:_t(ct),order:a,limit:n.toString()};return l&&(i.timezone=l),Gt({searchParams:i})},Fe=({data:r,currencySymbol:a,limit:n,defaultSourceIconUrl:t})=>{const s=n?r.slice(0,n):r,{appSettings:l}=ye();return e.jsx(le,{children:s.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:r,limit:a=20,showViewAll:n=!1,sortBy:t,setSortBy:s})=>{const{data:l}=Te(),{data:i}=It(),{appSettings:h}=ye(),[g,c]=O.useState("free_members desc"),o=t||g,y=s||c,A=o.replace("free_members","signups").replace("paid_members","paid_conversions"),{data:x,isLoading:w}=Aa(r,A,a),u=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,u),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,u]),f="Top sources",m=`Where did your growth come from ${H(r)}`;return h?.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:h?.paidMembersEnabled?4:2,children:e.jsx(ce,{description:"Try adjusting your date range to see more data.",title:`No conversions ${H(r)}`,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(mt,{children:[e.jsx(ut,{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(ft,{className:"sticky top-0 z-40 -mx-6 bg-background/60 p-6 backdrop-blur",children:[e.jsx(ht,{children:f}),e.jsx(xt,{children:m})]}),e.jsx("div",{className:"group/datalist",children:e.jsxs(Ye,{children:[e.jsx(ze,{children:e.jsxs(K,{children:[e.jsx(U,{children:"Source"}),e.jsx(U,{className:"w-[110px] text-right",children:e.jsx(te,{activeSortBy:o,setSortBy:y,sortBy:"free_members desc",children:"Free members"})}),h?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsx(U,{className:"w-[110px] text-right",children:e.jsx(te,{activeSortBy:o,setSortBy:y,sortBy:"paid_members desc",children:"Paid members"})}),e.jsx(U,{className:"w-[110px] text-right",children:e.jsx(te,{activeSortBy:o,setSortBy:y,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:h?.paidMembersEnabled?4:2,children:e.jsx(tt,{})})})})},Na=({active:r,payload:a})=>{if(r&&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:r,range:a})=>{const{data:n}=Ft(),{data:t}=Lt({searchParams:{date_from:W(re(a).startDate)}}),{data:{tiers:s=[]}={}}=na(),[l,i]=O.useState("billing-period"),{startDate:h,endDate:g}=O.useMemo(()=>re(a),[a]),c=O.useMemo(()=>W(h),[h]),o=O.useMemo(()=>W(g),[g]),y=O.useMemo(()=>s.filter(m=>m.type==="paid"&&m.active).map(m=>({id:m.id,name:m.name})),[s]),A=O.useMemo(()=>{if(!t?.stats||t.stats.length===0)return 0;const m=t.stats,v=B(c),C=B(o),S=m.filter(P=>{const M=B(P.date);return M.isSameOrAfter(v)&&M.isSameOrBefore(C)});if(S.length===0)return 0;const d=[...S].sort((P,M)=>new Date(P.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=O.useMemo(()=>{if(!n?.stats)return[];const m=B(c),v=B(o),C=n.stats.filter(d=>{const k=B(d.date);return k.isSameOrAfter(m)&&k.isSameOrBefore(v)}).reduce((d,k)=>{const j=k.cadence;return d[j]||(d[j]=0),d[j]+=k.signups,d},{});return A>0&&(C.complimentary=A),Object.entries(C).map(([d,k],j)=>{let D=d,P="url(#gradientPurple)",M="var(--chart-purple)";return d==="month"?(D="Monthly",P="url(#gradientPurple)",M="var(--chart-purple)"):d==="year"?(D="Annual",P="url(#gradientTeal)",M="var(--chart-teal)"):d==="complimentary"&&(D="Complimentary",P="url(#gradientBlue)",M="var(--chart-blue)"),{id:`cadence-${j}`,name:D,count:k,fill:P,color:M}})},[n,c,o,A]),w=O.useMemo(()=>{if(!n?.stats||y.length===0)return[];const m=B(c),v=B(o),C=n.stats.filter(D=>{const P=B(D.date);return P.isSameOrAfter(m)&&P.isSameOrBefore(v)}).reduce((D,P)=>{const M=P.tier;return D[M]||(D[M]=0),D[M]+=P.signups,D},{}),S=[{gradient:"url(#gradientPurple)",solid:"var(--chart-purple)"},{gradient:"url(#gradientTeal)",solid:"var(--chart-teal)"},{gradient:"url(#gradientBlue)",solid:"var(--chart-blue)"},{gradient:"url(#gradientRose)",solid:"var(--chart-rose)"},{gradient:"url(#gradientOrange)",solid:"var(--chart-orange)"},{gradient:"url(#gradientGreen)",solid:"var(--chart-green)"},{gradient:"url(#gradientAmber)",solid:"var(--chart-amber)"},{gradient:"url(#gradientYellow)",solid:"var(--chart-yellow)"},{gradient:"url(#gradientDarkblue)",solid:"var(--chart-darkblue)"},{gradient:"url(#gradientGray)",solid:"var(--chart-darkgray)"}];return[...y.map(D=>{const P=C[D.id]||0;return{id:D.id,name:D.name,count:P}})].sort((D,P)=>P.count-D.count).map((D,P)=>{const M=P%S.length;return{...D,fill:S[M].gradient,color:S[M].solid}})},[n,y,c,o]),u=l==="billing-period"?x:w,b=O.useMemo(()=>u.reduce((m,v)=>m+v.count,0),[u]),N=O.useMemo(()=>{const m={count:{label:"Subscriptions"}};return u.forEach(v=>{m[v.id]={label:v.name,color:v.color}}),m},[u]),p=O.useMemo(()=>b===0?[]:u.map(m=>({label:m.name,count:m.count,percentage:m.count/b*100,color:m.color})),[u,b]);if(r||!n?.stats)return null;const f=u.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(Oe,{children:["New paid subscriptions ",H(a)]})]}),y.length>1&&e.jsx("div",{children:e.jsxs(qe,{value:l,onValueChange:m=>i(m),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:f?e.jsxs(e.Fragment,{children:[e.jsx(He,{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:"var(--chart-purple)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-teal)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-rose)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-blue)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-orange)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-green)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-amber)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-yellow)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-darkblue)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"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:"var(--chart-darkgray)",stopOpacity:.8}),e.jsx("stop",{offset:"100%",stopColor:"var(--chart-darkgray)",stopOpacity:.6})]})]}),e.jsx(We,{content:e.jsx(Na,{}),cursor:!1}),e.jsx(G,{animationBegin:0,animationDuration:1e3,data:u,dataKey:"count",innerRadius:70,nameKey:"name",strokeWidth:5,children:e.jsx(Ue,{content:({viewBox:m})=>{if(m&&"cx"in m&&"cy"in m)return e.jsxs("text",{dominantBaseline:"middle",textAnchor:"middle",x:m.cx,y:m.cy,children:[e.jsx("tspan",{className:"fill-foreground text-2xl font-semibold tracking-tight",x:m.cx,y:m.cy,children:T(b)}),e.jsx("tspan",{className:"fill-muted-foreground",x:m.cx,y:(m.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(m=>e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("span",{className:"size-2 rounded-full opacity-50",style:{backgroundColor:m.color}}),e.jsx("span",{className:"max-w-[150px] truncate whitespace-nowrap",title:m.label,children:m.label}),e.jsxs("span",{className:"font-medium text-foreground",children:[Math.round(Number(m.percentage)||0),"%"]})]},m.label))})]}):e.jsx("div",{className:"py-12",children:e.jsx(ce,{description:`No new paid subscriptions ${H(a)}.`,title:"No new subscribers",children:e.jsx(la,{strokeWidth:1.5})})})})]})},Ca=(r,a,n)=>{if(a===1){const o=B().format("YYYY-MM-DD"),y=r.find(A=>A.date===o);return[{date:o,signups:y?.signups||0,cancellations:y?.cancellations||0}]}const{startDate:t,endDate:s}=re(a),l=B(s).diff(B(t),"days"),i=bt(a,l,"sum",n),h=new Map(r.map(o=>[o.date,o])),g=[],c=new Set;if(i==="monthly"){const o=B(t).startOf("month"),y=B(s).startOf("month");for(;o.isSameOrBefore(y);){const A=o.format("YYYY-MM-DD");if(!c.has(A)){c.add(A);const x=h.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"),y=B(s).startOf("week");for(;o.isSameOrBefore(y);){const A=o.format("YYYY-MM-DD");if(!c.has(A)){c.add(A);const x=h.get(A);x?g.push(x):g.push({date:A,signups:0,cancellations:0})}o.add(1,"week")}}else{const o=B(t),y=B(s);for(;o.isSameOrBefore(y);){const A=o.format("YYYY-MM-DD"),x=h.get(A);x?g.push(x):g.push({date:A,signups:0,cancellations:0}),o.add(1,"day")}}return g},at=r=>{if(r===-1){const{startDate:a,endDate:n}=re(r);return B(n).diff(B(a),"days")}return r},Ta=r=>{const a=at(r);return a<30?["daily"]:a>=91?["weekly","monthly"]:["daily","weekly"]},Le=r=>{const a=at(r);return a<30?"daily":a>=91?"monthly":"weekly"},_a=({subscriptionData:r,memberData:a,range:n,isLoading:t})=>{const[s,l]=O.useState(()=>Le(n));O.useEffect(()=>{l(Le(n))},[n]);const i=O.useMemo(()=>Ta(n),[n]),h=O.useMemo(()=>{switch(s){case"daily":return"none";case"weekly":return"weekly";case"monthly":return"monthly"}},[s]),g=O.useMemo(()=>{if(r&&r.length>0){if(n===1){const f=B().format("YYYY-MM-DD"),m=r.find(v=>v.date===f);return[{date:z(f,n),rawDate:f,new:m?.signups||0,cancelled:-(m?.cancellations||0)}]}const x=oe(r,n,"signups","sum",h),w=oe(r,n,"cancellations","sum",h),u=new Map(w.map(f=>[f.date,f])),b=x.map(f=>({date:f.date,signups:f.signups||0,cancellations:u.get(f.date)?.cancellations||0})),N=new Set(b.map(f=>f.date));return w.forEach(f=>{N.has(f.date)||b.push({date:f.date,signups:0,cancellations:f.cancellations||0})}),b.sort((f,m)=>new Date(f.date).getTime()-new Date(m.date).getTime()),Ca(b,n,h).map(f=>{let m=n;return s==="weekly"&&n<91?m=91:s==="monthly"&&n<365&&(m=365),{date:z(f.date,m),rawDate:f.date,new:f.signups||0,cancelled:-(f.cancellations||0)}})}else{if(!a||a.length===0)return[];if(n===1){const p=B().format("YYYY-MM-DD"),f=a.find(m=>m.date===p);return[{date:z(p,n),rawDate:p,new:f?.paid_subscribed||0,cancelled:-(f?.paid_canceled||0)}]}const x=oe(a,n,"paid_subscribed","sum",h),w=oe(a,n,"paid_canceled","sum",h),u=new Map(w.map(p=>[p.date,p])),b=x.map(p=>({date:p.date,paid_subscribed:p.paid_subscribed||0,paid_canceled:u.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,f)=>new Date(p.date).getTime()-new Date(f.date).getTime()),b.map(p=>{let f=n;return s==="weekly"&&n<91?f=91:s==="monthly"&&n<365&&(f=365),{date:z(p.date,f),rawDate:p.date,new:p.paid_subscribed||0,cancelled:-(p.paid_canceled||0)}})}},[a,r,n,h,s]),c={new:{label:"New",color:"var(--chart-teal)"},cancelled:{label:"Cancelled",color:"var(--chart-rose)"}},o=O.useMemo(()=>{const x=g.reduce((u,b)=>u+b.new,0),w=g.reduce((u,b)=>u+Math.abs(b.cancelled),0);return{new:x,cancelled:w}},[g]);if(t)return null;const y=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(Oe,{children:["New and cancelled paid subscriptions ",H(n)]})]}),i.length>1&&e.jsx("div",{children:e.jsxs(qe,{value:s,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:y?e.jsxs("div",{children:[e.jsx(He,{className:"aspect-auto h-[200px] w-full md:h-[220px] xl:h-[260px]",config:c,children:e.jsxs(Ot,{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:"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(sa,{className:"min-w-[120px]! px-3 py-2",formatter:(x,w,u,b)=>{const N=Number(x);let p="0";N===0?p="0":p=N<0?T(N*-1):T(N);const f=Number(u?.payload?.new||0),m=Number(u?.payload?.cancelled||0),v=f+m,C=v===0?"0":v>0?`+${T(v)}`:T(v);let S=u?.payload?.date;return u?.payload?.rawDate&&(s==="monthly"?S=z(u.payload.rawDate,366):s==="weekly"?S=z(u.payload.rawDate,91):S=z(u.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 text-foreground tabular-nums",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 text-foreground tabular-nums",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 ${H(n)}.`,title:"No paid member changes",children:e.jsx(ca,{strokeWidth:1.5})})})})]})},ka=(r,a,n)=>{const t=r??30,s=a??"mrr desc",{startDate:l,endDate:i}=O.useMemo(()=>re(t),[t]),h=O.useMemo(()=>{const o={date_from:W(l),date_to:W(i),order:s};return n==="posts"?o.post_type="post":n==="pages"&&(o.post_type="page"),o},[l,i,s,n]),g=Object.fromEntries(Object.entries(h).filter(([,o])=>o!==void 0));return Kt({searchParams:g})},br=()=>{const{range:r,site:a,settings:n}=Te(),t=String(n.find(d=>d.key==="timezone")?.value||"Etc/UTC"),s=De(),[l,i]=O.useState("free_members desc"),[h,g]=O.useState(Q.POSTS_AND_PAGES),[c]=Ke(),{appSettings:o}=ye(),y=c.get("tab")||"total-members",[A,x]=O.useState(y);O.useEffect(()=>{y!==A&&x(y)},[y]);const{isLoading:w,chartData:u,totals:b,currencySymbol:N,subscriptionData:p}=ma(r),{data:f,isLoading:m}=ka(r,l,h),v=O.useMemo(()=>{const k=(f?.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),j=Array.from(k.values()),D=j.reduce((_,E)=>_+E.free_members,0),P=j.reduce((_,E)=>_+E.paid_members,0),M=j.reduce((_,E)=>_+E.mrr,0);return j.map(_=>{let E=0;return l.includes("free_members")&&D>0?E=_.free_members/D:l.includes("paid_members")&&P>0?E=_.paid_members/P: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}})},[f,l]),C=w,S=w||m;return e.jsxs(gt,{children:[e.jsx(vt,{children:e.jsx(Vt,{children:e.jsx(yt,{})})}),e.jsxs(jt,{data:C?void 0:u,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:u,currencySymbol:N,initialTab:y,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:u,range:r,subscriptionData:p}),e.jsx(Da,{isLoading:C,range:r})]}),e.jsxs(be,{className:"w-full overflow-x-auto","data-testid":"top-content-card",children:[e.jsxs(_e,{children:[e.jsx(ke,{children:Mt(h)}),e.jsx(Oe,{children:Rt(h,r,H)})]}),e.jsx(ge,{children:e.jsxs(Ye,{children:[e.jsx(ze,{children:e.jsxs(K,{className:"[&>th]:h-auto [&>th]:pt-0 [&>th]:pb-2",children:[e.jsx(U,{className:"min-w-[320px] pl-0",children:e.jsx(Ve,{defaultValue:h,variant:"button-sm",onValueChange:d=>{g(d)},children:e.jsxs($e,{children:[e.jsx(ue,{value:Q.POSTS_AND_PAGES,children:"Posts & pages"}),e.jsx(ue,{value:Q.POSTS,children:"Posts"}),e.jsx(ue,{value:Q.PAGES,children:"Pages"}),e.jsx(ue,{value:Q.SOURCES,children:"Sources"})]})})}),e.jsx(U,{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(U,{className:"w-[140px] text-right",children:e.jsx(te,{activeSortBy:l,setSortBy:i,sortBy:"paid_members desc",children:"Paid members"})}),e.jsx(U,{className:"w-[140px] text-right",children:e.jsx(te,{activeSortBy:l,setSortBy:i,sortBy:"mrr desc",children:"MRR impact"})})]})]})}),h===Q.SOURCES?e.jsx(wa,{limit:20,range:r,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 p-0 text-left leading-tight font-medium whitespace-normal hover:underline!",title:"View post analytics",variant:"link",onClick:kt(d.attribution_url,d.post_id,a.url||"",s,d.attribution_type),children:d.title}):e.jsx("span",{className:"font-medium",children:d.title}),d.published_at&&Pe&&new Date(d.published_at).getTime()>0&&e.jsxs("span",{className:"text-muted-foreground",children:["Published on ",Pe(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))]})]})]},`${h}-${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 ${H(r)}`,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{br as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{aS as Y,r as A,bX as L,bY as W,j as e,S as N,b7 as se,B as T,aW as M,am as m,z as D,al as Q,cC as te,aT as le,cD as H,t as ce,cE as q,cF as de,bP as me,cG as X,bS as ue,cH as pe,ai as xe,aj as z,aZ as V,$ as he,bU as ge}from"./index-JMWMnGGt.js";import{g as O,S as fe,a as be,D as je,b as ve}from"./stats-view-Bx3oDAIW.js";import{C as $,a as E,b as F,h as I,c as R,E as Ne,K as we,d as ye,e as ke,u as _e,j as Ce}from"./pagemenu-Dq744OgH.js";import{E as K}from"./empty-indicator-DjmACVr2.js";import{P as Ae}from"./post-share-modal-BlOEKX3-.js";import{g as Le,c as Te}from"./post-helpers-gInwAwEv.js";import{g as ae,a as ze}from"./audience-CFjVlFTu.js";import{S as Me,P as We}from"./wallet-cards-DBM65lA_.js";import{C as De,g as $e,L as Ee,h as Z,i as Fe}from"./lucide-react-BfVLf4Hw.js";import{U as re}from"./user-plus-B0tpOnLM.js";import{a as P,M as Ie,S as J}from"./upload-Dz-DI9rQ.js";import{G}from"./gh-chart-xjwu2HZo.js";import{u as Re}from"./use-growth-stats-DNVioFUq.js";import{u as Ue}from"./posts-Dr3u9yOp.js";import{h as Ve,i as Ge}from"./stats-G4Ge9ETb.js";import"./select-Dt579MbD.js";import"./loader-circle-CGDGFypO.js";import"./sprout-C9DbfYGe.js";import"./a-large-small-DzN0AB7t.js";import"./at-sign-vqoOA4VZ.js";import"./copy-w3c9zkaZ.js";import"./message-square-text-BDJyLbG2.js";import"./hash-Bowe71Lt.js";import"./inbox-DS4qMjUb.js";import"./minus-BM0xhFIQ.js";import"./tags-Ddg8oG2Y.js";import"./square-CWrI0H4v.js";import"./user-round-check-caJYm0bB.js";import"./repeat-D-Ki-Cg5.js";import"./reply-C4V0xZ2U.js";import"./trash--VS50LgS.js";import"./chart-Bs2L1q8g.js";import"./_baseAssignValue-DwWJd_kU.js";import"./index-6Ag8SK_E.js";import"./currency-fEUUCkj0.js";const Se=s=>s.email_only?"Sent":s.email?"Published and sent":"Published",Be=({latestPostStats:s,isLoading:n})=>{const t=Y(),[r,i]=A.useState(!1),{site:c,settings:p}=L(),{appSettings:l}=W(),{emailTrackClicks:o,emailTrackOpens:h,webAnalytics:d=!1,membersTrackSources:v=!1}=l?.analytics||{},a=c.title||String(p.find(j=>j.key==="title")?.value||"Ghost Site"),x=String(p.find(j=>j.key==="timezone")?.value||"Etc/UTC"),f=s?Le(s,{membersTrackSources:v}):null,b="group mr-2 flex flex-col gap-1.5 hover:cursor-pointer",y=!!s?.email,_=ae({postId:s?.id,hasEmailData:y,analytics:{webAnalytics:d,membersTrackSources:v}}),w=_.startsWith("/editor/");return e.jsxs($,{className:"group/card bg-gradient-to-tr from-muted/40 to-muted/0 to-50%","data-testid":"latest-post",children:[e.jsxs(E,{children:[e.jsx(F,{className:"flex items-baseline justify-between leading-snug font-medium text-muted-foreground",children:"Latest post performance"}),e.jsx(I,{className:"hidden",children:"How your last post did"})]}),e.jsxs(R,{className:"flex flex-col gap-6 px-0 lg:flex-row xl:grid xl:grid-cols-3",children:[n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex w-full items-center gap-6 px-6 xl:col-span-2",children:[e.jsx("div",{className:"w-full max-w-[232px] grow",children:e.jsx(N,{className:"aspect-[16/10] rounded-md"})}),e.jsxs("div",{className:"w-full grow",children:[e.jsx(N,{className:"w-full max-w-[420px]"}),e.jsx(N,{className:"w-1/2"})]})]}),e.jsx("div",{className:"flex flex-col items-stretch gap-2 px-6 text-sm",children:e.jsxs("div",{className:"grid grid-cols-2 gap-5",children:[e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]})]})})]}),!n&&s&&f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-6 px-6 transition-all md:flex-row md:items-start xl:col-span-2",children:[s.feature_image&&e.jsx("div",{className:"aspect-[16/10] w-full min-w-[100px] rounded-sm bg-cover bg-center sm:max-w-[170px] lg:max-w-[170px] xl:max-w-[232px]",style:{backgroundImage:`url(${s.feature_image})`}}),e.jsxs("div",{className:"flex grow flex-col items-start justify-center self-stretch",children:[e.jsx("div",{className:"text-lg leading-tighter font-semibold tracking-tight hover:cursor-pointer hover:opacity-75",onClick:()=>{!n&&s&&t(_,{crossApp:!0})},children:s.title}),e.jsxs("div",{className:"mt-0.5 text-sm text-muted-foreground",children:[s.authors&&s.authors.length>0&&e.jsxs("div",{children:["By ",s.authors.map(j=>j.name).join(", ")," – ",se(s.published_at,x)]}),e.jsx("div",{className:"mt-0.5",children:Se(s)})]}),e.jsxs("div",{className:"mt-6 flex items-center gap-2",children:[!s.email_only&&e.jsx(Ae,{author:s.authors?.map(j=>j.name).join(", ")||"",description:"",faviconURL:c.icon||"",featureImageURL:s.feature_image||"",open:r,postExcerpt:s.excerpt||"",postTitle:s.title,postURL:s.url||"",siteTitle:a,onClose:()=>i(!1),onOpenChange:i,children:e.jsxs(T,{onClick:()=>i(!0),children:[e.jsx(Me,{})," Share post"]})}),e.jsx(T,{className:s.email_only?"w-full":"",variant:"outline",onClick:()=>{t(_,{crossApp:!0})},children:w?e.jsxs(e.Fragment,{children:[e.jsx(We,{}),e.jsx("span",{className:"hidden md:visible! md:block!",children:"Edit post"})]}):e.jsxs(e.Fragment,{children:[e.jsx(De,{}),e.jsx("span",{className:"hidden md:visible! md:block!",children:s.email_only?"Post analytics":"Analytics"})]})})]})]})]}),e.jsx("div",{className:"-ml-4 flex w-full flex-col items-stretch gap-2 pr-6 text-sm xl:h-full xl:max-w-none",children:e.jsxs("div",{className:"grid grid-cols-2 gap-6 pl-10 lg:border-l xl:h-full",children:[f.showWebMetrics&&d&&e.jsxs("div",{className:b,"data-testid":"latest-post-visitors",onClick:()=>{t(`/posts/analytics/${s.id}/web`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(M,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden md:visible! md:block!",children:"Visitors"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:m(s.visitors)})]}),f.showMemberGrowth&&e.jsxs("div",{className:D(b,f.showEmailMetrics&&(!f.showWebMetrics||!d)&&"row-[2/3] col-[1/2]"),"data-testid":"latest-post-members",onClick:()=>{t(`/posts/analytics/${s.id}/growth`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(re,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden md:visible! md:block!",children:"Members"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:s.member_delta?e.jsxs(e.Fragment,{children:["+",m(s.member_delta)]}):0})]}),f.showEmailMetrics&&s.email&&e.jsxs(e.Fragment,{children:[h&&e.jsxs("div",{className:b,onClick:()=>{t(`/posts/analytics/${s.id}/newsletter`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(P,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden whitespace-nowrap md:visible! md:block!",children:"Opens"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:s.email.email_count?Q((s.email.opened_count||0)/s.email.email_count):"0%"})]}),o&&e.jsxs("div",{className:b,onClick:()=>{t(`/posts/analytics/${s.id}/newsletter`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(Ie,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden whitespace-nowrap md:visible! md:block!",children:"Clicks"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:s.email.email_count&&s.count?.clicks?Q((s.count.clicks||0)/s.email.email_count):"0%"})]})]})]})})]}):!n&&e.jsx(K,{actions:e.jsx(T,{variant:"secondary",onClick:()=>{t("/editor/post",{crossApp:!0})},children:"New post"}),className:"w-full pb-10 xl:col-span-3",description:"Once it's live, you can track performance here",title:"Publish your first post",children:e.jsx(te,{strokeWidth:1.5})})]})]})},He=()=>{const{data:s}=L();return{isLimited:t=>{const r=s?.config;return r?.hostSettings?.limits&&t==="limitAnalytics"?r.hostSettings.limits.limitAnalytics?.disabled===!0:!1}}},S=({title:s,iconName:n,description:t,color:r,diffDirection:i,diffValue:c,formattedValue:p,trendingFromValue:l,children:o,onClick:h})=>{const{range:d}=L(),v=n&&Ee[n],a=ce.useMemo(()=>{if(!i||i==="empty"||d===q.allTime.value||!c)return"";const x=i==="up"?"up":i==="down"?"down":"at",b=O(d).replace("in the ","").replace(/^\(|\)$/g,"");return i==="same"?e.jsxs("span",{children:["You're trending at the same level as ",e.jsx("span",{className:"font-semibold",children:p})," compared to the ",e.jsx("span",{className:"font-semibold",children:b})]}):e.jsxs("span",{children:["You're trending ",e.jsxs("span",{className:"font-semibold",children:[x," ",c]})," from ",e.jsx("span",{className:"font-semibold",children:l})," compared to the ",b]})},[i,c,l,p,d]);return e.jsxs($,{className:"group","data-testid":s,children:[e.jsxs(E,{className:"hidden",children:[e.jsx(F,{children:s}),e.jsx(I,{children:t})]}),e.jsxs(we,{className:"relative flex grow flex-row items-start justify-between gap-5 border-none pb-2 xl:pb-4",children:[e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsxs(ye,{className:h&&"transition-all group-hover:text-foreground",children:[r&&e.jsx("span",{className:"inline-block size-2 rounded-full opacity-50",style:{backgroundColor:r}}),v&&e.jsx(v,{size:16,strokeWidth:1.5}),s]}),e.jsx(ke,{diffDirection:d===q.allTime.value?"hidden":i,diffTooltip:a,diffValue:c,value:p})]}),h&&e.jsx(T,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100",size:"sm",variant:"outline",onClick:h,children:"View more"})]}),e.jsx(R,{children:o})]})},Oe=({kpiValues:s,visitorsChartData:n,visitorsYRange:t,growthTotals:r,membersChartData:i,mrrChartData:c,currencySymbol:p,isLoading:l})=>{const o=Y(),{range:h}=L(),{appSettings:d}=W(),a=He().isLimited("limitAnalytics"),x="-mb-3 h-[10vw] max-h-[200px] min-h-[100px] hover:cursor-pointer!";if(l)return e.jsx(Ne,{className:"flex h-[calc(10vw+116px)] max-h-[416px] min-h-20 items-center justify-center hover:cursor-pointer!",children:e.jsx(le,{})});const f=d?.analytics.webAnalytics,b=a&&!f,y=!0,_=d?.paidMembersEnabled,w=[f,b,y,_].filter(Boolean).length;let j="lg:grid-cols-3";w===2?j="lg:grid-cols-2":w===1&&(j="lg:grid-cols-1");const U=`flex flex-col lg:grid ${j} gap-6`;return e.jsxs("div",{className:U,children:[f&&!b&&e.jsx(S,{description:"Number of individual people who visited your website",diffDirection:"empty",formattedValue:s.visits,iconName:"Globe",linkto:"/analytics/web/",title:"Unique visitors",onClick:()=>{o("/analytics/web/")},children:e.jsx(G,{className:x,color:"var(--chart-blue)",data:n,id:"visitors",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts",yAxisRange:t})}),b&&e.jsxs($,{children:[e.jsxs(E,{className:"hidden",children:[e.jsx(F,{children:"Unlock web analytics"}),e.jsx(I,{children:"Get the full picture of what's working with detailed, cookie-free traffic analytics."})]}),e.jsx(R,{className:"flex h-full items-center justify-center p-6",children:e.jsx(K,{actions:e.jsx(T,{variant:"outline",onClick:()=>o("/pro",{crossApp:!0}),children:"Upgrade now"}),className:"py-10",description:"Get the full picture of what's working with detailed, cookie-free traffic analytics.",title:"Unlock web analytics",children:e.jsx($e,{})})})]}),e.jsx(S,{description:"How number of members of your publication changed over time",diffDirection:r.directions.total,diffValue:r.percentChanges.total,formattedValue:m(r.totalMembers),iconName:"User",linkto:"/analytics/growth/",title:"Members",trendingFromValue:`${m(i[0].value)}`,onClick:()=>{o("/analytics/growth/?tab=total-members")},children:e.jsx(G,{className:x,color:"var(--chart-darkblue)",data:i,id:"members",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts"})}),_&&e.jsx(S,{description:"Monthly recurring revenue changes over time",diffDirection:r.directions.mrr,diffValue:r.percentChanges.mrr,formattedValue:`${p}${m(H(r.mrr))}`,iconName:"Coins",linkto:"/analytics/growth/",title:"MRR",trendingFromValue:`${p}${m(c[0].value)}`,onClick:()=>{o("/analytics/growth/?tab=mrr")},children:e.jsx(G,{className:x,color:"var(--chart-teal)",data:c,id:"mrr",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts"})})]})},Pe=({className:s})=>e.jsx("div",{className:D("rounded-sm bg-muted dark:bg-[#36373a] flex flex-col items-center justify-center gap-1 p-6",s),children:e.jsx(de,{className:"text-muted-foreground/50",size:18,strokeWidth:1.5})}),B=({className:s,metrics:n,title:t})=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:D("pointer-events-none absolute bottom-[calc(100%+2px)] left-1/2 z-50 min-w-[160px] -translate-x-1/2 rounded-md bg-background p-3 text-sm opacity-0 shadow-md transition-all group-hover/tooltip:bottom-[calc(100%+12px)] group-hover/tooltip:opacity-100",s),children:[e.jsx("div",{className:"mb-1.5 border-b pr-10 pb-1.5 font-medium whitespace-nowrap text-muted-foreground",children:t}),e.jsx("div",{className:"flex flex-col gap-1.5",children:n?.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[r.icon,r.label]}),e.jsx("span",{className:"font-mono",children:r.metric})]},r.label))})]})}),Ye=({topPostsData:s,isLoading:n})=>{const t=Y(),{range:r,settings:i}=L(),{appSettings:c}=W(),p=String(i.find(a=>a.key==="timezone")?.value||"Etc/UTC"),{webAnalytics:l=!1,membersTrackSources:o=!1,emailTrackClicks:h=!1,emailTrackOpens:d=!1}=c?.analytics||{},v="flex items-center justify-end gap-1 rounded-md px-2 py-1 font-mono text-gray-800 hover:bg-muted-foreground/10 group-hover:text-foreground";return e.jsxs($,{className:"group/card w-full lg:col-span-2","data-testid":"top-posts-card",children:[e.jsxs(E,{children:[e.jsxs(F,{className:"flex items-baseline justify-between leading-snug font-medium text-muted-foreground",children:["Top posts ",O(r)]}),e.jsx(I,{className:"hidden",children:"Most viewed posts in this period"})]}),e.jsx(R,{children:n?e.jsx(me,{className:"mt-6"}):e.jsxs(e.Fragment,{children:[s?.stats?.map(a=>e.jsxs("div",{className:'group relative flex w-full items-start justify-between gap-5 border-t border-border/50 py-4 before:absolute before:-inset-x-4 before:inset-y-0 before:z-0 before:hidden before:rounded-md before:bg-accent before:opacity-80 before:content-[""] first:border-border! hover:cursor-pointer hover:border-transparent hover:before:block md:items-center dark:before:bg-accent/50 [&+div]:hover:border-transparent',children:[e.jsxs("div",{className:"z-10 flex min-w-[160px] grow items-start gap-4 md:items-center lg:min-w-[320px]",onClick:()=>{t(ae({postId:a.post_id,hasEmailData:a.sent_count!==null,analytics:{webAnalytics:l,membersTrackSources:o}}),{crossApp:!0})},children:[a.feature_image?e.jsx("div",{className:"hidden aspect-[16/10] w-[80px] shrink-0 rounded-sm bg-cover bg-center sm:visible! sm:block! lg:w-[100px]",style:{backgroundImage:`url(${a.feature_image})`}}):e.jsx(Pe,{className:"hidden aspect-[16/10] w-[80px] shrink-0 group-hover:bg-muted-foreground/10 sm:visible! sm:flex! lg:w-[100px]"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"line-clamp-2 text-lg leading-[1.35em] font-semibold",children:a.title}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["By ",a.authors," – ",se(a.published_at,p)]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Te(a)})]})]}),e.jsxs("div",{className:"z-10 flex flex-col items-end justify-center gap-0.5 text-sm md:flex-row md:items-center md:justify-end md:gap-3",children:[l&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]","data-testid":"statistics-visitors",onClick:x=>{x.stopPropagation(),t(`/posts/analytics/${a.post_id}/web`,{crossApp:!0})},children:[e.jsx(B,{metrics:[{icon:e.jsx(M,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Unique visitors",metric:m(a.views)}],title:"Web traffic"}),e.jsxs("div",{className:v,children:[e.jsx(M,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),X(a.views)]})]}),a.sent_count!==null&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]",onClick:x=>{x.stopPropagation(),t(`/posts/analytics/${a.post_id}/newsletter`,{crossApp:!0})},children:[e.jsx(B,{className:`${o?"":"right-0 left-auto translate-x-0"}`,metrics:[{icon:e.jsx(J,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Sent",metric:m(a.sent_count||0)},...d?[{icon:e.jsx(P,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Opens",metric:m(a.opened_count||0)}]:[],...h?[{icon:e.jsx(Z,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Clicks",metric:m(a.clicked_count||0)}]:[]],title:"Newsletter performance"}),e.jsx("div",{className:v,children:d?e.jsxs(e.Fragment,{children:[e.jsx(P,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),a.open_rate?`${Math.round(a.open_rate)}%`:"0%"]}):h?e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),a.click_rate?`${Math.round(a.click_rate)}%`:"0%"]}):e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),X(a.sent_count||0)]})})]}),o&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]","data-testid":"statistics-members",onClick:x=>{x.stopPropagation(),t(`/posts/analytics/${a.post_id}/growth`,{crossApp:!0})},children:[e.jsx(B,{className:"right-0 left-auto translate-x-0",metrics:[{icon:e.jsx(ue,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Free",metric:a.free_members>0?`+${m(a.free_members)}`:"0"},...c?.paidMembersEnabled?[{icon:e.jsx(pe,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Paid",metric:a.paid_members>0?`+${m(a.paid_members)}`:"0"}]:[]],title:"New members"}),e.jsxs("div",{className:v,children:[e.jsx(re,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),a.members>0?`+${m(a.members)}`:"0"]})]})]})]},a.post_id)),(!s?.stats||s.stats.length===0)&&e.jsx(K,{className:"w-full pb-10",title:`No posts ${O(r)}`,children:e.jsx(te,{strokeWidth:1.5})})]})})]})},Ke=()=>{const{data:{posts:[s]}={posts:[]},isLoading:n}=Ue({searchParams:{filter:"status:[published,sent]",order:"published_at DESC",limit:"1",include:"authors,email,count.clicks"}}),t=s,r=Ve(t?.id||"",{enabled:!!t?.id}),{data:i,isLoading:c}=r;return{data:A.useMemo(()=>{if(!t)return null;const l=i?.stats?.[0]||{id:t.id,recipient_count:null,opened_count:null,open_rate:null,member_delta:0,free_members:0,paid_members:0,visitors:0};return{id:t.id,uuid:t.uuid,title:t.title||"",slug:t.slug||"",feature_image:t.feature_image||null,published_at:t.published_at||"",url:t.url||"",excerpt:t.excerpt||"",email_only:t.email_only||!1,status:t.status,email:t.email,count:t.count,authors:t.authors||[],recipient_count:l.recipient_count,opened_count:l.opened_count,open_rate:l.open_rate,member_delta:l.member_delta,free_members:l.free_members,paid_members:l.paid_members,visitors:l.visitors,click_rate:null}},[t,i]),isLoading:n||!!t?.id&&c}},ee=({className:s,title:n,description:t,url:r,children:i})=>e.jsx("a",{className:D("block rounded-xl border bg-card p-6 transition-all hover:shadow-xs hover:bg-accent/50 group/card",s),href:r,rel:"noreferrer",target:"_blank",children:e.jsxs("div",{className:"flex items-center gap-6",children:[i,e.jsxs("div",{className:"flex flex-col gap-0.5 leading-tight",children:[e.jsx("span",{className:"text-base font-semibold",children:n}),e.jsx("span",{className:"text-sm font-normal text-gray-700",children:t})]})]})}),zs=()=>{const{appSettings:s}=W(),{statsConfig:n,isLoading:t,range:r}=L(),{startDate:i,endDate:c,timezone:p}=xe(r),{isLoading:l,chartData:o,totals:h,currencySymbol:d}=Re(r),{data:v,isLoading:a}=Ke(),{data:x,isLoading:f}=Ge({searchParams:{date_from:z(i),date_to:z(c),limit:"5",timezone:p}}),b={site_uuid:n?.id||"",date_from:z(i),date_to:z(c),timezone:p,member_status:ze(ge)},{data:y,loading:_}=_e({endpoint:"api_kpis",statsConfig:n,params:b}),w=A.useMemo(()=>V(y||[],r,"visits","sum")?.map(g=>{const k=Number(g.visits),C=isNaN(k)?0:k;return{date:String(g.date),value:C,formattedValue:m(C),label:"Visitors"}}),[y,r]),j=A.useMemo(()=>{const g=[0,1];if(!w||w.length===0)return g;const k=w.map(u=>u.value).filter(u=>u>=0);return k.length===0?g:[0,Math.max(...k)||g[1]]},[w]),U=A.useMemo(()=>{if(!o||o.length===0)return[];let g=[];return g=V(o,r,"value","exact"),g.map(u=>({date:u.date,value:u.free+u.paid,formattedValue:m(u.free+u.paid),label:"Members"}))},[o,r]),ie=A.useMemo(()=>{if(!s?.paidMembersEnabled||!o||o.length===0)return[];let g=[];return g=V(o,r,"mrr","exact"),g.map(u=>({date:u.date,value:H(u.mrr),formattedValue:`${d}${m(H(u.mrr))}`,label:"MRR"}))},[o,r,d,s]),ne=A.useMemo(()=>{if(!y?.length)return{visits:"0"};const g=y.reduce((k,C)=>{const u=Number(C.visits);return k+(isNaN(u)?0:u)},0);return{visits:m(g)}},[y]),oe=t;return e.jsxs(fe,{children:[e.jsx(be,{children:e.jsx(Ce,{children:e.jsx(je,{excludeRanges:["today"]})})}),e.jsxs(ve,{isLoading:oe,loadingComponent:e.jsx(e.Fragment,{}),children:[e.jsx(Oe,{currencySymbol:d,growthTotals:h,isLoading:_||l,kpiValues:ne,membersChartData:U,mrrChartData:ie,visitorsChartData:w,visitorsYRange:j}),e.jsx(Be,{isLoading:a,latestPostStats:v}),e.jsx(Ye,{isLoading:f,topPostsData:x}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsx(he,{className:"mt-4 -mb-4 lg:col-span-2",children:"Grow your audience"}),e.jsx(ee,{description:"Find out how to review the performance of your content and get the most out of post analytics in Ghost.",title:"Understanding analytics in Ghost",url:"https://ghost.org/help/native-analytics",children:e.jsx("div",{className:"flex h-18 w-[100px] min-w-[100px] items-center justify-center rounded-md bg-gradient-to-tr from-[#14B8FF]/20 to-[#00BBA7]/20 p-4 opacity-80 transition-all group-hover/card:opacity-100",children:e.jsx(Fe,{className:"text-[#00BBA7]",size:20,strokeWidth:1.5})})}),e.jsx(ee,{description:"Use these content distribution tactics to get more people to discover your work and increase engagement.",title:"How to get your content seen online",url:"https://ghost.org/resources/content-distribution/",children:e.jsx("div",{className:"flex h-18 w-[100px] min-w-[100px] items-center justify-center rounded-md bg-gradient-to-tl from-[#FDC700]/20 to-[#FF2056]/20 p-4 opacity-80 transition-all group-hover/card:opacity-100",children:e.jsx(M,{className:"text-[#FE9A00]",size:20,strokeWidth:1.5})})})]})]})]})};export{zs as default};
|
|
1
|
+
import{aT as Y,r as A,bX as L,bY as D,j as e,S as N,b7 as se,B as T,aX as M,ao as m,z as W,an as Q,cC as te,aU as le,cD as H,t as ce,cE as q,cF as de,bP as me,cG as X,bS as ue,cH as pe,ak as xe,al as z,a_ as V,$ as he,bU as ge}from"./index-CEnfjH5h.js";import{g as O,S as fe,a as be,D as je,b as ve}from"./stats-view-BWoPuaLz.js";import{C as $,a as E,b as F,h as U,c as I,E as Ne,K as we,d as ke,e as ye,u as _e,j as Ce}from"./pagemenu-DzpB1AkZ.js";import{E as K}from"./empty-indicator-2QGnEbtY.js";import{P as Ae}from"./post-share-modal-CTpdCS2X.js";import{g as Le,c as Te}from"./post-helpers-gInwAwEv.js";import{g as ae,a as ze}from"./audience-CBOR--z9.js";import{S as Me,P as De}from"./wallet-cards-CJcVzH0D.js";import{C as We,g as $e,L as Ee,h as J,i as Fe}from"./lucide-react-4VO5Dwow.js";import{U as re}from"./user-plus-CMxR50-Y.js";import{a as P,M as Ue,S as Z}from"./upload-BG7KNIn7.js";import{G}from"./gh-chart-fuWw60Ka.js";import{u as Ie}from"./use-growth-stats-CNGdl44N.js";import{u as Re}from"./posts-GvXDuhVG.js";import{h as Ve,i as Ge}from"./stats-Bs9ZbmXX.js";import"./select-CGr_5qad.js";import"./loader-circle-C8exRUku.js";import"./sprout-Td9eaOoY.js";import"./a-large-small-B_ulQCIs.js";import"./at-sign-B8xWKM0y.js";import"./copy-CDHcAPJw.js";import"./message-square-text-CC_1bY-Q.js";import"./hash-CI1pQ1UC.js";import"./inbox-DYY8-M1K.js";import"./minus-DSyx9DCe.js";import"./tags-_taMP0sJ.js";import"./square-Df8vEYlG.js";import"./user-round-check-2nhPmqP3.js";import"./repeat-y6HlMgGO.js";import"./reply-Cc8ryI5v.js";import"./trash-BeZZgbn-.js";import"./chart-_slUcr-K.js";import"./_baseAssignValue-BKAl5FrV.js";import"./index-BDAOs7pI.js";import"./currency-fEUUCkj0.js";const Be=s=>s.email_only?"Sent":s.email?"Published and sent":"Published",Se=({latestPostStats:s,isLoading:n})=>{const t=Y(),[r,i]=A.useState(!1),{site:c,settings:p}=L(),{appSettings:l}=D(),{emailTrackClicks:o,emailTrackOpens:h,webAnalytics:d=!1,membersTrackSources:v=!1}=l?.analytics||{},a=c.title||String(p.find(j=>j.key==="title")?.value||"Ghost Site"),x=String(p.find(j=>j.key==="timezone")?.value||"Etc/UTC"),f=s?Le(s,{membersTrackSources:v}):null,b="group mr-2 flex flex-col gap-1.5 hover:cursor-pointer",k=!!s?.email,_=ae({postId:s?.id,hasEmailData:k,analytics:{webAnalytics:d,membersTrackSources:v}}),w=_.startsWith("/editor/");return e.jsxs($,{className:"group/card bg-gradient-to-tr from-muted/40 to-muted/0 to-50%","data-testid":"latest-post",children:[e.jsxs(E,{children:[e.jsx(F,{className:"flex items-baseline justify-between leading-snug font-medium text-muted-foreground",children:"Latest post performance"}),e.jsx(U,{className:"hidden",children:"How your last post did"})]}),e.jsxs(I,{className:"flex flex-col gap-6 px-0 lg:flex-row xl:grid xl:grid-cols-3",children:[n&&e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex w-full items-center gap-6 px-6 xl:col-span-2",children:[e.jsx("div",{className:"w-full max-w-[232px] grow",children:e.jsx(N,{className:"aspect-[16/10] rounded-md"})}),e.jsxs("div",{className:"w-full grow",children:[e.jsx(N,{className:"w-full max-w-[420px]"}),e.jsx(N,{className:"w-1/2"})]})]}),e.jsx("div",{className:"flex flex-col items-stretch gap-2 px-6 text-sm",children:e.jsxs("div",{className:"grid grid-cols-2 gap-5",children:[e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]}),e.jsxs("div",{children:[e.jsx(N,{className:"w-3/4"}),e.jsx(N,{className:"h-10 w-1/3"})]})]})})]}),!n&&s&&f?e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex flex-col gap-6 px-6 transition-all md:flex-row md:items-start xl:col-span-2",children:[s.feature_image&&e.jsx("div",{className:"aspect-[16/10] w-full min-w-[100px] rounded-sm bg-cover bg-center sm:max-w-[170px] lg:max-w-[170px] xl:max-w-[232px]",style:{backgroundImage:`url(${s.feature_image})`}}),e.jsxs("div",{className:"flex grow flex-col items-start justify-center self-stretch",children:[e.jsx("div",{className:"text-lg leading-tighter font-semibold tracking-tight hover:cursor-pointer hover:opacity-75",onClick:()=>{!n&&s&&t(_,{crossApp:!0})},children:s.title}),e.jsxs("div",{className:"mt-0.5 text-sm text-muted-foreground",children:[s.authors&&s.authors.length>0&&e.jsxs("div",{children:["By ",s.authors.map(j=>j.name).join(", ")," – ",se(s.published_at,x)]}),e.jsx("div",{className:"mt-0.5",children:Be(s)})]}),e.jsxs("div",{className:"mt-6 flex items-center gap-2",children:[!s.email_only&&e.jsx(Ae,{author:s.authors?.map(j=>j.name).join(", ")||"",description:"",faviconURL:c.icon||"",featureImageURL:s.feature_image||"",open:r,postExcerpt:s.excerpt||"",postTitle:s.title,postURL:s.url||"",siteTitle:a,onClose:()=>i(!1),onOpenChange:i,children:e.jsxs(T,{onClick:()=>i(!0),children:[e.jsx(Me,{})," Share post"]})}),e.jsx(T,{className:s.email_only?"w-full":"",variant:"outline",onClick:()=>{t(_,{crossApp:!0})},children:w?e.jsxs(e.Fragment,{children:[e.jsx(De,{}),e.jsx("span",{className:"hidden md:visible! md:block!",children:"Edit post"})]}):e.jsxs(e.Fragment,{children:[e.jsx(We,{}),e.jsx("span",{className:"hidden md:visible! md:block!",children:s.email_only?"Post analytics":"Analytics"})]})})]})]})]}),e.jsx("div",{className:"-ml-4 flex w-full flex-col items-stretch gap-2 pr-6 text-sm xl:h-full xl:max-w-none",children:e.jsxs("div",{className:"grid grid-cols-2 gap-6 pl-10 lg:border-l xl:h-full",children:[f.showWebMetrics&&d&&e.jsxs("div",{className:b,"data-testid":"latest-post-visitors",onClick:()=>{t(`/posts/analytics/${s.id}/web`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(M,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden md:visible! md:block!",children:"Visitors"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:m(s.visitors)})]}),f.showMemberGrowth&&e.jsxs("div",{className:W(b,f.showEmailMetrics&&(!f.showWebMetrics||!d)&&"row-[2/3] col-[1/2]"),"data-testid":"latest-post-members",onClick:()=>{t(`/posts/analytics/${s.id}/growth`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(re,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden md:visible! md:block!",children:"Members"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:s.member_delta?e.jsxs(e.Fragment,{children:["+",m(s.member_delta)]}):0})]}),f.showEmailMetrics&&s.email&&e.jsxs(e.Fragment,{children:[h&&e.jsxs("div",{className:b,onClick:()=>{t(`/posts/analytics/${s.id}/newsletter`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(P,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden whitespace-nowrap md:visible! md:block!",children:"Opens"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:s.email.email_count?Q((s.email.opened_count||0)/s.email.email_count):"0%"})]}),o&&e.jsxs("div",{className:b,onClick:()=>{t(`/posts/analytics/${s.id}/newsletter`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-1.5 font-medium text-muted-foreground transition-all group-hover:text-foreground",children:[e.jsx(Ue,{size:16,strokeWidth:1.25}),e.jsx("span",{className:"hidden whitespace-nowrap md:visible! md:block!",children:"Clicks"})]}),e.jsx("span",{className:"text-[2.2rem] leading-none font-semibold tracking-tighter",children:s.email.email_count&&s.count?.clicks?Q((s.count.clicks||0)/s.email.email_count):"0%"})]})]})]})})]}):!n&&e.jsx(K,{actions:e.jsx(T,{variant:"secondary",onClick:()=>{t("/editor/post",{crossApp:!0})},children:"New post"}),className:"w-full pb-10 xl:col-span-3",description:"Once it's live, you can track performance here",title:"Publish your first post",children:e.jsx(te,{strokeWidth:1.5})})]})]})},He=()=>{const{data:s}=L();return{isLimited:t=>{const r=s?.config;return r?.hostSettings?.limits&&t==="limitAnalytics"?r.hostSettings.limits.limitAnalytics?.disabled===!0:!1}}},B=({title:s,iconName:n,description:t,color:r,diffDirection:i,diffValue:c,formattedValue:p,trendingFromValue:l,children:o,onClick:h})=>{const{range:d}=L(),v=n&&Ee[n],a=ce.useMemo(()=>{if(!i||i==="empty"||d===q.allTime.value||!c)return"";const x=i==="up"?"up":i==="down"?"down":"at",b=O(d).replace("in the ","").replace(/^\(|\)$/g,"");return i==="same"?e.jsxs("span",{children:["You're trending at the same level as ",e.jsx("span",{className:"font-semibold",children:p})," compared to the ",e.jsx("span",{className:"font-semibold",children:b})]}):e.jsxs("span",{children:["You're trending ",e.jsxs("span",{className:"font-semibold",children:[x," ",c]})," from ",e.jsx("span",{className:"font-semibold",children:l})," compared to the ",b]})},[i,c,l,p,d]);return e.jsxs($,{className:"group","data-testid":s,children:[e.jsxs(E,{className:"hidden",children:[e.jsx(F,{children:s}),e.jsx(U,{children:t})]}),e.jsxs(we,{className:"relative flex grow flex-row items-start justify-between gap-5 border-none pb-2 xl:pb-4",children:[e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsxs(ke,{className:h&&"transition-all group-hover:text-foreground",children:[r&&e.jsx("span",{className:"inline-block size-2 rounded-full opacity-50",style:{backgroundColor:r}}),v&&e.jsx(v,{size:16,strokeWidth:1.5}),s]}),e.jsx(ye,{diffDirection:d===q.allTime.value?"hidden":i,diffTooltip:a,diffValue:c,value:p})]}),h&&e.jsx(T,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-200 group-hover:translate-x-0 group-hover:opacity-100",size:"sm",variant:"outline",onClick:h,children:"View more"})]}),e.jsx(I,{children:o})]})},Oe=({kpiValues:s,visitorsChartData:n,visitorsYRange:t,growthTotals:r,membersChartData:i,mrrChartData:c,currencySymbol:p,isLoading:l})=>{const o=Y(),{range:h}=L(),{appSettings:d}=D(),a=He().isLimited("limitAnalytics"),x="-mb-3 h-[10vw] max-h-[200px] min-h-[100px] hover:cursor-pointer!";if(l)return e.jsx(Ne,{className:"flex h-[calc(10vw+116px)] max-h-[416px] min-h-20 items-center justify-center hover:cursor-pointer!",children:e.jsx(le,{})});const f=d?.analytics.webAnalytics,b=a&&!f,k=!0,_=d?.paidMembersEnabled,w=[f,b,k,_].filter(Boolean).length;let j="lg:grid-cols-3";w===2?j="lg:grid-cols-2":w===1&&(j="lg:grid-cols-1");const R=`flex flex-col lg:grid ${j} gap-6`;return e.jsxs("div",{className:R,children:[f&&!b&&e.jsx(B,{description:"Number of individual people who visited your website",diffDirection:"empty",formattedValue:s.visits,iconName:"Globe",linkto:"/analytics/web/",title:"Unique visitors",onClick:()=>{o("/analytics/web/")},children:e.jsx(G,{className:x,color:"var(--chart-blue)",data:n,id:"visitors",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts",yAxisRange:t})}),b&&e.jsxs($,{children:[e.jsxs(E,{className:"hidden",children:[e.jsx(F,{children:"Unlock web analytics"}),e.jsx(U,{children:"Get the full picture of what's working with detailed, cookie-free traffic analytics."})]}),e.jsx(I,{className:"flex h-full items-center justify-center p-6",children:e.jsx(K,{actions:e.jsx(T,{variant:"outline",onClick:()=>o("/pro",{crossApp:!0}),children:"Upgrade now"}),className:"py-10",description:"Get the full picture of what's working with detailed, cookie-free traffic analytics.",title:"Unlock web analytics",children:e.jsx($e,{})})})]}),e.jsx(B,{description:"How number of members of your publication changed over time",diffDirection:r.directions.total,diffValue:r.percentChanges.total,formattedValue:m(r.totalMembers),iconName:"User",linkto:"/analytics/growth/",title:"Members",trendingFromValue:`${m(i[0].value)}`,onClick:()=>{o("/analytics/growth/?tab=total-members")},children:e.jsx(G,{className:x,color:"var(--chart-darkblue)",data:i,id:"members",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts"})}),_&&e.jsx(B,{description:"Monthly recurring revenue changes over time",diffDirection:r.directions.mrr,diffValue:r.percentChanges.mrr,formattedValue:`${p}${m(H(r.mrr))}`,iconName:"Coins",linkto:"/analytics/growth/",title:"MRR",trendingFromValue:`${p}${m(c[0].value)}`,onClick:()=>{o("/analytics/growth/?tab=mrr")},children:e.jsx(G,{className:x,color:"var(--chart-teal)",data:c,id:"mrr",range:h,showHorizontalLines:!0,showYAxisValues:!1,syncId:"overview-charts"})})]})},Pe=({className:s})=>e.jsx("div",{className:W("rounded-sm bg-muted dark:bg-[#36373a] flex flex-col items-center justify-center gap-1 p-6",s),children:e.jsx(de,{className:"text-muted-foreground/50",size:18,strokeWidth:1.5})}),S=({className:s,metrics:n,title:t})=>e.jsx(e.Fragment,{children:e.jsxs("div",{className:W("pointer-events-none absolute bottom-[calc(100%+2px)] left-1/2 z-50 min-w-[160px] -translate-x-1/2 rounded-md bg-background p-3 text-sm opacity-0 shadow-md transition-all group-hover/tooltip:bottom-[calc(100%+12px)] group-hover/tooltip:opacity-100",s),children:[e.jsx("div",{className:"mb-1.5 border-b pr-10 pb-1.5 font-medium whitespace-nowrap text-muted-foreground",children:t}),e.jsx("div",{className:"flex flex-col gap-1.5",children:n?.map(r=>e.jsxs("div",{className:"flex items-center justify-between gap-5",children:[e.jsxs("div",{className:"flex items-center gap-1.5 whitespace-nowrap",children:[r.icon,r.label]}),e.jsx("span",{className:"font-mono",children:r.metric})]},r.label))})]})}),Ye=({topPostsData:s,isLoading:n})=>{const t=Y(),{range:r,settings:i}=L(),{appSettings:c}=D(),p=String(i.find(a=>a.key==="timezone")?.value||"Etc/UTC"),{webAnalytics:l=!1,membersTrackSources:o=!1,emailTrackClicks:h=!1,emailTrackOpens:d=!1}=c?.analytics||{},v="flex items-center justify-end gap-1 rounded-md px-2 py-1 font-mono text-gray-800 hover:bg-muted-foreground/10 group-hover:text-foreground";return e.jsxs($,{className:"group/card w-full lg:col-span-2","data-testid":"top-posts-card",children:[e.jsxs(E,{children:[e.jsxs(F,{className:"flex items-baseline justify-between leading-snug font-medium text-muted-foreground",children:["Top posts ",O(r)]}),e.jsx(U,{className:"hidden",children:"Most viewed posts in this period"})]}),e.jsx(I,{children:n?e.jsx(me,{className:"mt-6"}):e.jsxs(e.Fragment,{children:[s?.stats?.map(a=>e.jsxs("div",{className:'group relative flex w-full items-start justify-between gap-5 border-t border-border/50 py-4 before:absolute before:-inset-x-4 before:inset-y-0 before:z-0 before:hidden before:rounded-md before:bg-accent before:opacity-80 before:content-[""] first:border-border! hover:cursor-pointer hover:border-transparent hover:before:block md:items-center dark:before:bg-accent/50 [&+div]:hover:border-transparent',children:[e.jsxs("div",{className:"z-10 flex min-w-[160px] grow items-start gap-4 md:items-center lg:min-w-[320px]",onClick:()=>{t(ae({postId:a.post_id,hasEmailData:a.sent_count!==null,analytics:{webAnalytics:l,membersTrackSources:o}}),{crossApp:!0})},children:[a.feature_image?e.jsx("div",{className:"hidden aspect-[16/10] w-[80px] shrink-0 rounded-sm bg-cover bg-center sm:visible! sm:block! lg:w-[100px]",style:{backgroundImage:`url(${a.feature_image})`}}):e.jsx(Pe,{className:"hidden aspect-[16/10] w-[80px] shrink-0 group-hover:bg-muted-foreground/10 sm:visible! sm:flex! lg:w-[100px]"}),e.jsxs("div",{className:"flex flex-col",children:[e.jsx("span",{className:"line-clamp-2 text-lg leading-[1.35em] font-semibold",children:a.title}),e.jsxs("span",{className:"text-sm text-muted-foreground",children:["By ",a.authors," – ",se(a.published_at,p)]}),e.jsx("span",{className:"text-sm text-muted-foreground",children:Te(a)})]})]}),e.jsxs("div",{className:"z-10 flex flex-col items-end justify-center gap-0.5 text-sm md:flex-row md:items-center md:justify-end md:gap-3",children:[l&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]","data-testid":"statistics-visitors",onClick:x=>{x.stopPropagation(),t(`/posts/analytics/${a.post_id}/web`,{crossApp:!0})},children:[e.jsx(S,{metrics:[{icon:e.jsx(M,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Unique visitors",metric:m(a.views)}],title:"Web traffic"}),e.jsxs("div",{className:v,children:[e.jsx(M,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),X(a.views)]})]}),a.sent_count!==null&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]",onClick:x=>{x.stopPropagation(),t(`/posts/analytics/${a.post_id}/newsletter`,{crossApp:!0})},children:[e.jsx(S,{className:`${o?"":"right-0 left-auto translate-x-0"}`,metrics:[{icon:e.jsx(Z,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Sent",metric:m(a.sent_count||0)},...d?[{icon:e.jsx(P,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Opens",metric:m(a.opened_count||0)}]:[],...h?[{icon:e.jsx(J,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Clicks",metric:m(a.clicked_count||0)}]:[]],title:"Newsletter performance"}),e.jsx("div",{className:v,children:d?e.jsxs(e.Fragment,{children:[e.jsx(P,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),a.open_rate?`${Math.round(a.open_rate)}%`:"0%"]}):h?e.jsxs(e.Fragment,{children:[e.jsx(J,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),a.click_rate?`${Math.round(a.click_rate)}%`:"0%"]}):e.jsxs(e.Fragment,{children:[e.jsx(Z,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),X(a.sent_count||0)]})})]}),o&&e.jsxs("div",{className:"group/tooltip relative flex w-[66px] lg:w-[92px]","data-testid":"statistics-members",onClick:x=>{x.stopPropagation(),t(`/posts/analytics/${a.post_id}/growth`,{crossApp:!0})},children:[e.jsx(S,{className:"right-0 left-auto translate-x-0",metrics:[{icon:e.jsx(ue,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Free",metric:a.free_members>0?`+${m(a.free_members)}`:"0"},...c?.paidMembersEnabled?[{icon:e.jsx(pe,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),label:"Paid",metric:a.paid_members>0?`+${m(a.paid_members)}`:"0"}]:[]],title:"New members"}),e.jsxs("div",{className:v,children:[e.jsx(re,{className:"text-muted-foreground group-hover:text-foreground",size:16,strokeWidth:1.5}),a.members>0?`+${m(a.members)}`:"0"]})]})]})]},a.post_id)),(!s?.stats||s.stats.length===0)&&e.jsx(K,{className:"w-full pb-10",title:`No posts ${O(r)}`,children:e.jsx(te,{strokeWidth:1.5})})]})})]})},Ke=()=>{const{data:{posts:[s]}={posts:[]},isLoading:n}=Re({searchParams:{filter:"status:[published,sent]",order:"published_at DESC",limit:"1",include:"authors,email,count.clicks"}}),t=s,r=Ve(t?.id||"",{enabled:!!t?.id}),{data:i,isLoading:c}=r;return{data:A.useMemo(()=>{if(!t)return null;const l=i?.stats?.[0]||{id:t.id,recipient_count:null,opened_count:null,open_rate:null,member_delta:0,free_members:0,paid_members:0,visitors:0};return{id:t.id,uuid:t.uuid,title:t.title||"",slug:t.slug||"",feature_image:t.feature_image||null,published_at:t.published_at||"",url:t.url||"",excerpt:t.excerpt||"",email_only:t.email_only||!1,status:t.status,email:t.email,count:t.count,authors:t.authors||[],recipient_count:l.recipient_count,opened_count:l.opened_count,open_rate:l.open_rate,member_delta:l.member_delta,free_members:l.free_members,paid_members:l.paid_members,visitors:l.visitors,click_rate:null}},[t,i]),isLoading:n||!!t?.id&&c}},ee=({className:s,title:n,description:t,url:r,children:i})=>e.jsx("a",{className:W("block rounded-xl border bg-card p-6 transition-all hover:shadow-xs hover:bg-accent/50 group/card",s),href:r,rel:"noreferrer",target:"_blank",children:e.jsxs("div",{className:"flex items-center gap-6",children:[i,e.jsxs("div",{className:"flex flex-col gap-0.5 leading-tight",children:[e.jsx("span",{className:"text-base font-semibold",children:n}),e.jsx("span",{className:"text-sm font-normal text-gray-700",children:t})]})]})}),zs=()=>{const{appSettings:s}=D(),{statsConfig:n,isLoading:t,range:r}=L(),{startDate:i,endDate:c,timezone:p}=xe(r),{isLoading:l,chartData:o,totals:h,currencySymbol:d}=Ie(r),{data:v,isLoading:a}=Ke(),{data:x,isLoading:f}=Ge({searchParams:{date_from:z(i),date_to:z(c),limit:"5",timezone:p}}),b={site_uuid:n?.id||"",date_from:z(i),date_to:z(c),timezone:p,member_status:ze(ge)},{data:k,loading:_}=_e({endpoint:"api_kpis",statsConfig:n,params:b}),w=A.useMemo(()=>V(k||[],r,"visits","sum")?.map(g=>{const y=Number(g.visits),C=isNaN(y)?0:y;return{date:String(g.date),value:C,formattedValue:m(C),label:"Visitors"}}),[k,r]),j=A.useMemo(()=>{const g=[0,1];if(!w||w.length===0)return g;const y=w.map(u=>u.value).filter(u=>u>=0);return y.length===0?g:[0,Math.max(...y)||g[1]]},[w]),R=A.useMemo(()=>{if(!o||o.length===0)return[];let g=[];return g=V(o,r,"value","exact"),g.map(u=>({date:u.date,value:u.free+u.paid,formattedValue:m(u.free+u.paid),label:"Members"}))},[o,r]),ie=A.useMemo(()=>{if(!s?.paidMembersEnabled||!o||o.length===0)return[];let g=[];return g=V(o,r,"mrr","exact"),g.map(u=>({date:u.date,value:H(u.mrr),formattedValue:`${d}${m(H(u.mrr))}`,label:"MRR"}))},[o,r,d,s]),ne=A.useMemo(()=>{if(!k?.length)return{visits:"0"};const g=k.reduce((y,C)=>{const u=Number(C.visits);return y+(isNaN(u)?0:u)},0);return{visits:m(g)}},[k]),oe=t;return e.jsxs(fe,{children:[e.jsx(be,{children:e.jsx(Ce,{children:e.jsx(je,{excludeRanges:["today"]})})}),e.jsxs(ve,{isLoading:oe,loadingComponent:e.jsx(e.Fragment,{}),children:[e.jsx(Oe,{currencySymbol:d,growthTotals:h,isLoading:_||l,kpiValues:ne,membersChartData:R,mrrChartData:ie,visitorsChartData:w,visitorsYRange:j}),e.jsx(Se,{isLoading:a,latestPostStats:v}),e.jsx(Ye,{isLoading:f,topPostsData:x}),e.jsxs("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-2",children:[e.jsx(he,{className:"mt-4 -mb-4 lg:col-span-2",children:"Grow your audience"}),e.jsx(ee,{description:"Find out how to review the performance of your content and get the most out of post analytics in Ghost.",title:"Understanding analytics in Ghost",url:"https://ghost.org/help/native-analytics",children:e.jsx("div",{className:"flex h-18 w-[100px] min-w-[100px] items-center justify-center rounded-md bg-gradient-to-tr from-[#14B8FF]/20 to-[#00BBA7]/20 p-4 opacity-80 transition-all group-hover/card:opacity-100",children:e.jsx(Fe,{className:"text-[#00BBA7]",size:20,strokeWidth:1.5})})}),e.jsx(ee,{description:"Use these content distribution tactics to get more people to discover your work and increase engagement.",title:"How to get your content seen online",url:"https://ghost.org/resources/content-distribution/",children:e.jsx("div",{className:"flex h-18 w-[100px] min-w-[100px] items-center justify-center rounded-md bg-gradient-to-tl from-[#FDC700]/20 to-[#FF2056]/20 p-4 opacity-80 transition-all group-hover/card:opacity-100",children:e.jsx(M,{className:"text-[#FE9A00]",size:20,strokeWidth:1.5})})})]})]})]})};export{zs as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{dt as Sr,du as Nt}from"./index-
|
|
1
|
+
import{dt as Sr,du as Nt}from"./index-CEnfjH5h.js";import{_ as wr}from"./dropzone-B9JUsQlW.js";function Jt(e){throw new Error('Could not dynamically require "'+e+'". Please configure the dynamicRequireTargets or/and ignoreDynamicRequires option of @rollup/plugin-commonjs appropriately for this require call to work.')}var ye={},pe={exports:{}};const Zt={},Yt=Object.freeze(Object.defineProperty({__proto__:null,default:Zt},Symbol.toStringTag,{value:"Module"})),Tr=Sr(Yt);var Ir;function Kt(){return Ir||(Ir=1,(function(e,r){var o=(function(){var i=function(L,h,S,w){for(S=S||{},w=L.length;w--;S[L[w]]=h);return S},y=[1,5],p=[1,7],g=[1,8],u=[1,6,10],c=[1,9],d=[1,6,8,10],m=[1,24],v=[1,25],A=[1,26],C=[1,27],M=[1,28],F=[1,29],I=[1,30],k=[1,17],B=[1,18],_=[1,19],N=[21,22,23,24,25,29,30],H=[1,6,8,10,18],J=[1,47],G=[6,18],Z={trace:function(){},yy:{},symbols_:{error:2,expressions:3,expression:4,andCondition:5,OR:6,filterExpr:7,AND:8,LPAREN:9,RPAREN:10,propExpr:11,valueExpr:12,PROP:13,NOT:14,REGEXPOP:15,LBRACKET:16,inExpr:17,RBRACKET:18,OP:19,VALUE:20,NULL:21,TRUE:22,FALSE:23,NUMBER:24,NOW:25,DATEOP:26,AMOUNT:27,INTERVAL:28,LITERAL:29,STRING:30,ADD:31,SUB:32,CONTAINS:33,STARTSWITH:34,ENDSWITH:35,GT:36,LT:37,GTE:38,LTE:39,$accept:0,$end:1},terminals_:{2:"error",6:"OR",8:"AND",9:"LPAREN",10:"RPAREN",13:"PROP",14:"NOT",16:"LBRACKET",18:"RBRACKET",21:"NULL",22:"TRUE",23:"FALSE",24:"NUMBER",25:"NOW",27:"AMOUNT",28:"INTERVAL",29:"LITERAL",30:"STRING",31:"ADD",32:"SUB",33:"CONTAINS",34:"STARTSWITH",35:"ENDSWITH",36:"GT",37:"LT",38:"GTE",39:"LTE"},productions_:[0,[3,1],[4,1],[4,3],[5,1],[5,3],[7,3],[7,2],[11,1],[12,2],[12,1],[12,4],[12,3],[12,2],[12,1],[17,3],[17,1],[20,1],[20,1],[20,1],[20,1],[20,4],[20,1],[20,1],[26,1],[26,1],[15,2],[15,2],[15,2],[19,1],[19,1],[19,1],[19,1],[19,1]],performAction:function(h,S,w,P,E,f,K,W){var l=f.length-1;switch(E){case 1:return P.debug("expression",f[l]),P.debug("opt",W),f[l]&&f[l].yg?f[l].yg:f[l];case 2:P.debug("andCondition",f[l]),this.$=f[l];break;case 3:P.debug("expression OR andCondition",f[l-2],f[l]),f[l-2]=f[l-2].$or?f[l-2]:{$or:[P.ungroup(f[l-2])]},f[l-2].$or.push(P.ungroup(f[l])),this.$=f[l-2];break;case 4:P.debug("filterExpr",f[l]),this.$=f[l];break;case 5:P.debug("andCondition AND filterExpr",f[l-2],f[l]),f[l-2]=f[l-2].$and?f[l-2]:{$and:[P.ungroup(f[l-2])]},f[l-2].$and.push(P.ungroup(f[l])),this.$=f[l-2];break;case 6:P.debug("LPAREN expression RPAREN",f[l-1]),this.$={yg:f[l-1]};break;case 7:this.$={[f[l-1]]:f[l]};break;case 8:f[l]=f[l].replace(/:$/,""),f[l]=W.aliases&&W.aliases[f[l]]?W.aliases[f[l]]:f[l],this.$=f[l];break;case 9:this.$={$not:f[l]};break;case 10:this.$={$regex:f[l]};break;case 11:this.$={$nin:f[l-1]};break;case 12:this.$={$in:f[l-1]};break;case 13:this.$={},this.$[f[l-1]]=f[l];break;case 14:this.$=f[l];break;case 15:this.$.push(f[l]);break;case 16:this.$=[f[l]];break;case 17:this.$=null;break;case 18:this.$=!0;break;case 19:this.$=!1;break;case 20:this.$=parseInt(h);break;case 21:this.$=P.relDateToAbsolute(f[l-2],f[l-1],f[l]);break;case 22:this.$=P.unescape(f[l]);break;case 23:f[l]=f[l].replace(/^'|'$/g,""),this.$=P.unescape(f[l]);break;case 24:this.$="add";break;case 25:this.$="sub";break;case 26:f[l]=f[l].replace(/^'|'$/g,""),f[l]=P.unescape(f[l]),this.$=P.stringToRegExp(f[l]);break;case 27:f[l]=f[l].replace(/^'|'$/g,""),f[l]=P.unescape(f[l]),this.$=P.stringToRegExp(f[l],"^");break;case 28:f[l]=f[l].replace(/^'|'$/g,""),f[l]=P.unescape(f[l]),this.$=P.stringToRegExp(f[l],"$");break;case 29:this.$="$ne";break;case 30:this.$="$gt";break;case 31:this.$="$lt";break;case 32:this.$="$gte";break;case 33:this.$="$lte";break}},table:[{3:1,4:2,5:3,7:4,9:y,11:6,13:p},{1:[3]},{1:[2,1],6:g},i(u,[2,2],{8:c}),i(d,[2,4]),{4:10,5:3,7:4,9:y,11:6,13:p},{12:11,14:[1,12],15:13,16:[1,14],19:15,20:16,21:m,22:v,23:A,24:C,25:M,29:F,30:I,33:k,34:B,35:_,36:[1,20],37:[1,21],38:[1,22],39:[1,23]},i([14,16,21,22,23,24,25,29,30,33,34,35,36,37,38,39],[2,8]),{5:31,7:4,9:y,11:6,13:p},{7:32,9:y,11:6,13:p},{6:g,10:[1,33]},i(d,[2,7]),i(N,[2,29],{15:34,16:[1,35],33:k,34:B,35:_}),i(d,[2,10]),{17:36,20:37,21:m,22:v,23:A,24:C,25:M,29:F,30:I},{20:38,21:m,22:v,23:A,24:C,25:M,29:F,30:I},i(d,[2,14]),{30:[1,39]},{30:[1,40]},{30:[1,41]},i(N,[2,30]),i(N,[2,31]),i(N,[2,32]),i(N,[2,33]),i(H,[2,17]),i(H,[2,18]),i(H,[2,19]),i(H,[2,20]),{26:42,31:[1,43],32:[1,44]},i(H,[2,22]),i(H,[2,23]),i(u,[2,3],{8:c}),i(d,[2,5]),i(d,[2,6]),i(d,[2,9]),{17:45,20:37,21:m,22:v,23:A,24:C,25:M,29:F,30:I},{6:J,18:[1,46]},i(G,[2,16]),i(d,[2,13]),i(d,[2,26]),i(d,[2,27]),i(d,[2,28]),{27:[1,48]},{27:[2,24]},{27:[2,25]},{6:J,18:[1,49]},i(d,[2,12]),{20:50,21:m,22:v,23:A,24:C,25:M,29:F,30:I},{28:[1,51]},i(d,[2,11]),i(G,[2,15]),i(H,[2,21])],defaultActions:{43:[2,24],44:[2,25]},parseError:function(h,S){if(S.recoverable)this.trace(h);else{var w=new Error(h);throw w.hash=S,w}},parse:function(h){var S=this,w=[0],P=[null],E=[],f=this.table,K="",W=0,l=0,ie=2,X=1,t=E.slice.call(arguments,1),n=Object.create(this.lexer),s={yy:{}};for(var T in this.yy)Object.prototype.hasOwnProperty.call(this.yy,T)&&(s.yy[T]=this.yy[T]);n.setInput(h,s.yy),s.yy.lexer=n,s.yy.parser=this,typeof n.yylloc>"u"&&(n.yylloc={});var q=n.yylloc;E.push(q);var D=n.options&&n.options.ranges;typeof s.yy.parseError=="function"?this.parseError=s.yy.parseError:this.parseError=Object.getPrototypeOf(this).parseError;for(var R=function(){var Q;return Q=n.lex()||X,typeof Q!="number"&&(Q=S.symbols_[Q]||Q),Q},b,O,j,x,V={},$,U,ne,re;;){if(O=w[w.length-1],this.defaultActions[O]?j=this.defaultActions[O]:((b===null||typeof b>"u")&&(b=R()),j=f[O]&&f[O][b]),typeof j>"u"||!j.length||!j[0]){var a="";re=[];for($ in f[O])this.terminals_[$]&&$>ie&&re.push("'"+this.terminals_[$]+"'");n.showPosition?a="Parse error on line "+(W+1)+`:
|
|
2
2
|
`+n.showPosition()+`
|
|
3
3
|
Expecting `+re.join(", ")+", got '"+(this.terminals_[b]||b)+"'":a="Parse error on line "+(W+1)+": Unexpected "+(b==X?"end of input":"'"+(this.terminals_[b]||b)+"'"),this.parseError(a,{text:n.match,token:this.terminals_[b]||b,line:n.yylineno,loc:q,expected:re})}if(j[0]instanceof Array&&j.length>1)throw new Error("Parse Error: multiple actions possible at state: "+O+", token: "+b);switch(j[0]){case 1:w.push(b),P.push(n.yytext),E.push(n.yylloc),w.push(j[1]),b=null,l=n.yyleng,K=n.yytext,W=n.yylineno,q=n.yylloc;break;case 2:if(U=this.productions_[j[1]][1],V.$=P[P.length-U],V._$={first_line:E[E.length-(U||1)].first_line,last_line:E[E.length-1].last_line,first_column:E[E.length-(U||1)].first_column,last_column:E[E.length-1].last_column},D&&(V._$.range=[E[E.length-(U||1)].range[0],E[E.length-1].range[1]]),x=this.performAction.apply(V,[K,l,W,s.yy,j[1],P,E].concat(t)),typeof x<"u")return x;U&&(w=w.slice(0,-1*U*2),P=P.slice(0,-1*U),E=E.slice(0,-1*U)),w.push(this.productions_[j[1]][0]),P.push(V.$),E.push(V._$),ne=f[w[w.length-2]][w[w.length-1]],w.push(ne);break;case 3:return!0}}return!0}};Z.parseError=function(L,h){var S=L.split(`
|
|
4
4
|
`);throw S[0]="Query Error: unexpected character in filter at char "+(h.loc.first_column+1),new Error(S.join(`
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as t,bB as A,t as u,b as g,bC as E,r as j,bx as T,by as z,L as S,E as M,c as P,bD as U,S as w,A as $,B,bp as L,m as C,h as v,d as W,n as _,bE as D,bF as H,e as O,P as q}from"./index-JMWMnGGt.js";import{A as V}from"./at-sign-vqoOA4VZ.js";import{R as G,U as K}from"./user-round-check-caJYm0bB.js";import{R as Q}from"./reply-C4V0xZ2U.js";const I=({notificationType:a,size:l="lg",className:i})=>{let r,s="";const n="white",c=l==="sm"?13:20,o=l==="sm"?2:1.5;switch(a){case"follow":r=t.jsx(K,{className:`-mt-0.5 -mr-0.5 ${l==="sm"&&"size-[11px]"}`,color:n,size:c,strokeWidth:o}),s="bg-blue-600";break;case"like":r=t.jsx(A,{className:`${l==="sm"?"size-[11px]":"mt-px size-5"}`,color:n,strokeWidth:o}),s="bg-pink-600";break;case"reply":r=t.jsx(Q,{className:"mr-px mb-px",color:n,size:c,strokeWidth:o}),s="bg-purple-600";break;case"repost":r=t.jsx(G,{color:n,size:c,strokeWidth:o}),s="bg-green-500";break;case"mention":r=t.jsx(V,{className:`${l==="sm"?"size-[12px]":"size-5"}`,color:n,size:c,strokeWidth:o}),s="bg-orange-500";break}return t.jsx("div",{className:`flex ${l==="sm"?"size-5":"size-9"} items-center justify-center rounded-full ${s} ${i&&i}`,children:r})},Z=u.createContext(void 0),h=({isGrouped:a,centerAlign:l,children:i,onClick:r,url:s,className:n})=>t.jsx(Z.Provider,{value:{onClick:r,url:s},children:t.jsx("div",{className:`group relative -mx-4 -my-px ${a?"grid":"flex"} ${l?"items-center":"items-start"} break-anywhere cursor-pointer grid-cols-[auto_1fr] gap-x-4 gap-y-2.5 rounded-lg px-4 py-5 text-left hover:bg-gray-75 ${n}`,role:"button",onClick:r,children:i})}),J=({size:a="lg",type:l})=>t.jsx("div",{className:"col-start-1 row-start-1",children:t.jsx(I,{notificationType:l,size:a})}),X=({children:a})=>t.jsx("div",{className:"col-start-2 row-start-1 flex gap-2",children:a}),Y=({children:a})=>t.jsx("div",{className:"col-start-2 row-start-2 -mt-0.5 grow overflow-hidden",children:a});h.Icon=J;h.Avatars=X;h.Content=Y;const ee=()=>t.jsx("div",{className:"h-px w-full bg-gray-150 dark:bg-gray-950"});function te(a){const r=new Date(a).getTime();return(Math.floor(r/864e5)*864e5).toString()}function se(a){const l={};let i=null,r=0;return a.forEach(s=>{s.type!==i&&(r+=1,i=s.type);let n="";const c=`_${te(s.createdAt)}`,o=`_seq${r}`;switch(s.type){case"like":s.post?.id&&(n=`like_${s.post.id}${c}${o}`);break;case"reply":n=`reply_${s.id}`;break;case"repost":s.post?.id&&(n=`repost_${s.post.id}${c}${o}`);break;case"follow":n=`follow_${c}${o}`;break;case"mention":n=`mention_${s.id}`;break}l[n]||(l[n]={id:s.id,type:s.type,actors:[],post:s.post,inReplyTo:s.inReplyTo,createdAt:s.createdAt}),l[n].actors.find(f=>f.id===s.actor.id)||l[n].actors.push(s.actor)}),Object.values(l)}const ae=({group:a})=>{const[l,...i]=a.actors,r=i.length>0,s="cursor-pointer font-semibold hover:underline text-black dark:text-white",n=g(),c=t.jsxs(t.Fragment,{children:[t.jsx(q,{actor:l,align:"center",isCurrentUser:!1,children:t.jsx("span",{className:s,onClick:o=>{o?.stopPropagation(),v(l.handle,n)},children:l.name})}),r&&` and ${i.length} ${i.length>1?"others":"other"}`]});switch(a.type){case"follow":return t.jsxs(t.Fragment,{children:[c," followed you"]});case"like":return t.jsxs(t.Fragment,{children:[c," liked your ",a.post?.type==="article"?"post":"note"]});case"repost":return t.jsxs(t.Fragment,{children:[c," reposted your ",a.post?.type==="article"?"post":"note"]});case"reply":if(a.inReplyTo&&typeof a.inReplyTo!="string")return c;break;case"mention":return c}return t.jsx(t.Fragment,{})},ne=({content:a,className:l,stripTags:i=[]})=>{const r=j.useRef(null),s=g();return j.useEffect(()=>{const n=r.current;if(!n)return;const c=o=>{const y=o.target.closest("a[data-profile]");if(y){const x=y.getAttribute("data-profile")?.trim();/^@([\w.-]+)@([\w-]+\.[\w.-]+[a-zA-Z])$/.test(x||"")&&x&&(o.preventDefault(),o.stopPropagation(),v(x,s))}};return n.addEventListener("click",c),()=>{n.removeEventListener("click",c)}},[s,a]),t.jsx("div",{dangerouslySetInnerHTML:{__html:_(a||"",i)},ref:r,className:l})},ce=()=>{const[a,l]=u.useState({}),i=g(),r=e=>{l(d=>({...d,[e]:!d[e]}))},s=()=>{},n=5,{data:c,error:o,fetchNextPage:f,hasNextPage:y,isFetchingNextPage:x,isLoading:b}=E("index"),k=c?.pages.flatMap(e=>se(e.notifications))??Array(10).fill({actors:[{}]}),p=j.useRef(null),N=j.useRef(null);j.useEffect(()=>(p.current&&p.current.disconnect(),p.current=new IntersectionObserver(e=>{e[0].isIntersecting&&y&&!x&&f()}),N.current&&p.current.observe(N.current),()=>{p.current&&p.current.disconnect()}),[y,x,f]);const R=(e,d)=>{switch(e.type){case"like":e.post&&i(`/${e.post.type==="article"?"reader":"notes"}/${encodeURIComponent(e.post.id)}`);break;case"reply":e.post&&e.inReplyTo&&i(`/notes/${encodeURIComponent(e.post.id)}`);break;case"repost":e.post&&i(`/${e.post.type==="article"?"reader":"notes"}/${encodeURIComponent(e.post.id)}`);break;case"follow":e.actors.length>1?r(e.id||`${e.type}_${d}`):v(e.actors[0].handle,i);break;case"mention":e.post&&i(`/notes/${encodeURIComponent(e.post.id)}`);break}};return o&&T(o)?t.jsx(z,{errorCode:o.code,statusCode:o.statusCode}):t.jsx(S,{children:t.jsxs("div",{className:"z-0 flex w-full flex-col items-center",children:[b===!1&&k.length===0&&t.jsxs(M,{children:[t.jsx(P,{children:t.jsx(U,{})}),"Quiet for now, but not for long! When someone likes, boosts, or replies to you, you'll find it here."]}),k.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"my-8 flex w-full max-w-[620px] flex-col max-md:mt-5",children:k.map((e,d)=>t.jsxs(u.Fragment,{children:[t.jsxs(h,{centerAlign:e.actors.length<2&&e.type==="follow",className:"hover:bg-gray-75 dark:hover:bg-gray-950",isGrouped:e.actors.length>1,onClick:()=>R(e,d),children:[b?t.jsx(w,{className:"rounded-full",containerClassName:"flex h-10 w-10"}):e.actors.length>1?t.jsx(h.Icon,{type:e.type}):t.jsxs("div",{className:"relative",children:[t.jsx($,{author:{icon:{url:e.actors[0].avatarUrl||""},name:e.actors[0].name,handle:e.actors[0].handle},size:"notification"},e.actors[0].id),t.jsx(I,{className:"absolute -right-1 -bottom-1 z-10 border-2 border-white dark:border-black",notificationType:e.type,size:"sm"})]}),e.actors.length>1&&t.jsx(h.Avatars,{children:t.jsxs("div",{className:"flex w-full flex-col",children:[t.jsxs("div",{className:"relative flex items-center pl-2",children:[!a[e.id||`${e.type}_${d}`]&&e.actors.slice(0,n).map(m=>t.jsx($,{author:{icon:{url:m.avatarUrl||""},name:m.name,handle:m.handle},className:"-ml-2 bg-[#F3F3F3]! outline outline-2 outline-white group-hover:bg-[#EDEEF0]! group-hover:outline-gray-75 dark:outline-black group-hover:dark:outline-gray-950",size:"notification"},m.id)),e.actors.length>n&&!a[e.id||`${e.type}_${d}`]&&t.jsx("div",{className:"absolute right-[28px] z-10 flex size-9 items-center justify-center rounded-full bg-black/50 text-base font-semibold tracking-tightest text-white",children:`+${e.actors.length-n}`}),e.actors.length>1&&t.jsxs(B,{className:`group flex items-center gap-0.5 text-gray-700 hover:bg-transparent hover:text-black dark:text-gray-600 dark:hover:text-white ${a[e.id||`${e.type}_${d}`]?"ml-[-20px]":"ml-0 w-[28px]"}`,variant:"ghost",onClick:m=>{m?.stopPropagation(),r(e.id||`${e.type}_${d}`)},children:[t.jsx(L,{className:`${a[e.id||`${e.type}_${d}`]?"rotate-180":""}`,size:20,strokeWidth:1.5}),a[e.id||`${e.type}_${d}`]?"Hide":t.jsx("span",{className:"sr-only",children:"Show all"})]})]}),t.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${a[e.id||`${e.type}_${d}`]?"mb-2 max-h-[1384px] opacity-100":"max-h-0 opacity-0"}`,children:a[e.id||`${e.type}_${d}`]&&e.actors.length>1&&t.jsx("div",{className:"flex flex-col gap-2 pt-2",children:e.actors.map(m=>t.jsxs("div",{className:"group/item break-anywhere flex items-center justify-between gap-4",onClick:F=>{F?.stopPropagation(),v(m.handle,i)},children:[t.jsxs("div",{className:"flex min-w-0 items-center",children:[t.jsx($,{author:{icon:{url:m.avatarUrl||""},name:m.name,handle:m.handle},size:"xs"}),t.jsx("span",{className:"ml-2 line-clamp-1 text-base font-semibold group-hover/item:underline dark:text-white",children:m.name}),t.jsx("span",{className:"ml-1 line-clamp-1 text-base text-gray-700 dark:text-gray-600",children:m.handle})]}),e.type==="follow"&&!m.followedByMe&&t.jsx(C,{following:!1,handle:m.handle,variant:"link"})]},m.id))})})]})}),t.jsxs(h.Content,{children:[t.jsx("div",{children:b?t.jsxs(t.Fragment,{children:[t.jsx(w,{}),t.jsx(w,{className:"w-full max-w-60"})]}):t.jsxs("div",{className:"flex justify-between",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"truncate",children:t.jsx(ae,{group:e})}),e.actors.length<2&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mt-px text-[8px] text-gray-700 dark:text-gray-600",children:"•"}),t.jsx("span",{className:"mt-0.5 text-sm text-gray-700 dark:text-gray-600",children:W(e,!1)})]})]}),e.actors.length===1&&(e.type==="follow"||e.type==="reply"||e.type==="mention")&&!e.actors[0].followedByMe&&t.jsx(C,{following:!1,handle:e.actors[0].handle,variant:"link"})]})}),(e.type==="reply"&&e.inReplyTo||e.type==="mention"||e.type==="like"&&!e.post?.name&&e.post?.content||e.type==="repost"&&!e.post?.name&&e.post?.content)&&(e.type!=="reply"&&e.type!=="mention"?t.jsxs("div",{className:"ap-note-content mt-0.5 line-clamp-1 text-sm text-pretty text-gray-700 dark:text-gray-600",children:[e.post?.type==="article"&&e.post?.title&&t.jsxs(t.Fragment,{children:[e.post.title," — "]}),t.jsx("span",{dangerouslySetInnerHTML:{__html:_(e.post?.content||"")}})]}):t.jsx(t.Fragment,{children:t.jsxs("div",{className:"mt-2.5 rounded-md bg-gray-100 px-5 py-[14px] group-hover:bg-gray-200 dark:bg-gray-925/30 group-hover:dark:bg-black/40",children:[t.jsx(ne,{className:"ap-note-content text-pretty",content:e.post?.content||"",stripTags:["a"]}),e.post&&e.post.attachments&&e.post.attachments.length>0&&t.jsx("div",{className:"notification-attachments mb-1 [&_.attachment-gallery]:flex [&_.attachment-gallery]:flex-wrap [&_img]:aspect-square [&_img]:max-w-[calc(20%-6.4px)]",children:D({...e.post,type:"Note",attachment:e.post.attachments})})]})})),(e.type==="reply"&&e.post||e.type==="mention")&&t.jsx("div",{className:"mt-1.5",children:t.jsx(H,{actor:{...e.actors[0],icon:{url:e.actors[0].avatarUrl||""},id:e.actors[0].url,preferredUsername:e.actors[0].handle?.replace(/^@([^@]+)@.*$/,"$1")||"unknown"},buttonClassName:"hover:bg-gray-200",commentCount:e.post.replyCount||0,layout:"notification",likeCount:e.post.likeCount||0,object:{...e.post,liked:e.post.likedByMe,reposted:e.post.repostedByMe},repostCount:e.post.repostCount||0,onLikeClick:s})})]})]}),d<k.length-1&&t.jsx("div",{className:"pl-[52px]",children:t.jsx(ee,{})})]},e.id||`${e.type}_${d}`))}),t.jsx("div",{ref:N,className:"h-1"}),x&&t.jsx("div",{className:"-mt-4 mb-8 flex flex-col items-center justify-center gap-4 text-center",children:t.jsx(O,{size:"md"})})]})]})})};export{ce as default};
|
|
1
|
+
import{j as t,bB as A,t as u,b as g,bC as E,r as j,bx as T,by as z,L as S,E as M,c as P,bD as U,S as w,A as $,B,bp as L,m as C,h as v,d as W,n as _,bE as D,bF as H,e as O,P as q}from"./index-CEnfjH5h.js";import{A as V}from"./at-sign-B8xWKM0y.js";import{R as G,U as K}from"./user-round-check-2nhPmqP3.js";import{R as Q}from"./reply-Cc8ryI5v.js";const I=({notificationType:a,size:l="lg",className:i})=>{let r,s="";const n="white",c=l==="sm"?13:20,o=l==="sm"?2:1.5;switch(a){case"follow":r=t.jsx(K,{className:`-mt-0.5 -mr-0.5 ${l==="sm"&&"size-[11px]"}`,color:n,size:c,strokeWidth:o}),s="bg-blue-600";break;case"like":r=t.jsx(A,{className:`${l==="sm"?"size-[11px]":"mt-px size-5"}`,color:n,strokeWidth:o}),s="bg-pink-600";break;case"reply":r=t.jsx(Q,{className:"mr-px mb-px",color:n,size:c,strokeWidth:o}),s="bg-purple-600";break;case"repost":r=t.jsx(G,{color:n,size:c,strokeWidth:o}),s="bg-green-500";break;case"mention":r=t.jsx(V,{className:`${l==="sm"?"size-[12px]":"size-5"}`,color:n,size:c,strokeWidth:o}),s="bg-orange-500";break}return t.jsx("div",{className:`flex ${l==="sm"?"size-5":"size-9"} items-center justify-center rounded-full ${s} ${i&&i}`,children:r})},Z=u.createContext(void 0),h=({isGrouped:a,centerAlign:l,children:i,onClick:r,url:s,className:n})=>t.jsx(Z.Provider,{value:{onClick:r,url:s},children:t.jsx("div",{className:`group relative -mx-4 -my-px ${a?"grid":"flex"} ${l?"items-center":"items-start"} break-anywhere cursor-pointer grid-cols-[auto_1fr] gap-x-4 gap-y-2.5 rounded-lg px-4 py-5 text-left hover:bg-gray-75 ${n}`,role:"button",onClick:r,children:i})}),J=({size:a="lg",type:l})=>t.jsx("div",{className:"col-start-1 row-start-1",children:t.jsx(I,{notificationType:l,size:a})}),X=({children:a})=>t.jsx("div",{className:"col-start-2 row-start-1 flex gap-2",children:a}),Y=({children:a})=>t.jsx("div",{className:"col-start-2 row-start-2 -mt-0.5 grow overflow-hidden",children:a});h.Icon=J;h.Avatars=X;h.Content=Y;const ee=()=>t.jsx("div",{className:"h-px w-full bg-gray-150 dark:bg-gray-950"});function te(a){const r=new Date(a).getTime();return(Math.floor(r/864e5)*864e5).toString()}function se(a){const l={};let i=null,r=0;return a.forEach(s=>{s.type!==i&&(r+=1,i=s.type);let n="";const c=`_${te(s.createdAt)}`,o=`_seq${r}`;switch(s.type){case"like":s.post?.id&&(n=`like_${s.post.id}${c}${o}`);break;case"reply":n=`reply_${s.id}`;break;case"repost":s.post?.id&&(n=`repost_${s.post.id}${c}${o}`);break;case"follow":n=`follow_${c}${o}`;break;case"mention":n=`mention_${s.id}`;break}l[n]||(l[n]={id:s.id,type:s.type,actors:[],post:s.post,inReplyTo:s.inReplyTo,createdAt:s.createdAt}),l[n].actors.find(f=>f.id===s.actor.id)||l[n].actors.push(s.actor)}),Object.values(l)}const ae=({group:a})=>{const[l,...i]=a.actors,r=i.length>0,s="cursor-pointer font-semibold hover:underline text-black dark:text-white",n=g(),c=t.jsxs(t.Fragment,{children:[t.jsx(q,{actor:l,align:"center",isCurrentUser:!1,children:t.jsx("span",{className:s,onClick:o=>{o?.stopPropagation(),v(l.handle,n)},children:l.name})}),r&&` and ${i.length} ${i.length>1?"others":"other"}`]});switch(a.type){case"follow":return t.jsxs(t.Fragment,{children:[c," followed you"]});case"like":return t.jsxs(t.Fragment,{children:[c," liked your ",a.post?.type==="article"?"post":"note"]});case"repost":return t.jsxs(t.Fragment,{children:[c," reposted your ",a.post?.type==="article"?"post":"note"]});case"reply":if(a.inReplyTo&&typeof a.inReplyTo!="string")return c;break;case"mention":return c}return t.jsx(t.Fragment,{})},ne=({content:a,className:l,stripTags:i=[]})=>{const r=j.useRef(null),s=g();return j.useEffect(()=>{const n=r.current;if(!n)return;const c=o=>{const y=o.target.closest("a[data-profile]");if(y){const x=y.getAttribute("data-profile")?.trim();/^@([\w.-]+)@([\w-]+\.[\w.-]+[a-zA-Z])$/.test(x||"")&&x&&(o.preventDefault(),o.stopPropagation(),v(x,s))}};return n.addEventListener("click",c),()=>{n.removeEventListener("click",c)}},[s,a]),t.jsx("div",{dangerouslySetInnerHTML:{__html:_(a||"",i)},ref:r,className:l})},ce=()=>{const[a,l]=u.useState({}),i=g(),r=e=>{l(d=>({...d,[e]:!d[e]}))},s=()=>{},n=5,{data:c,error:o,fetchNextPage:f,hasNextPage:y,isFetchingNextPage:x,isLoading:b}=E("index"),k=c?.pages.flatMap(e=>se(e.notifications))??Array(10).fill({actors:[{}]}),p=j.useRef(null),N=j.useRef(null);j.useEffect(()=>(p.current&&p.current.disconnect(),p.current=new IntersectionObserver(e=>{e[0].isIntersecting&&y&&!x&&f()}),N.current&&p.current.observe(N.current),()=>{p.current&&p.current.disconnect()}),[y,x,f]);const R=(e,d)=>{switch(e.type){case"like":e.post&&i(`/${e.post.type==="article"?"reader":"notes"}/${encodeURIComponent(e.post.id)}`);break;case"reply":e.post&&e.inReplyTo&&i(`/notes/${encodeURIComponent(e.post.id)}`);break;case"repost":e.post&&i(`/${e.post.type==="article"?"reader":"notes"}/${encodeURIComponent(e.post.id)}`);break;case"follow":e.actors.length>1?r(e.id||`${e.type}_${d}`):v(e.actors[0].handle,i);break;case"mention":e.post&&i(`/notes/${encodeURIComponent(e.post.id)}`);break}};return o&&T(o)?t.jsx(z,{errorCode:o.code,statusCode:o.statusCode}):t.jsx(S,{children:t.jsxs("div",{className:"z-0 flex w-full flex-col items-center",children:[b===!1&&k.length===0&&t.jsxs(M,{children:[t.jsx(P,{children:t.jsx(U,{})}),"Quiet for now, but not for long! When someone likes, boosts, or replies to you, you'll find it here."]}),k.length>0&&t.jsxs(t.Fragment,{children:[t.jsx("div",{className:"my-8 flex w-full max-w-[620px] flex-col max-md:mt-5",children:k.map((e,d)=>t.jsxs(u.Fragment,{children:[t.jsxs(h,{centerAlign:e.actors.length<2&&e.type==="follow",className:"hover:bg-gray-75 dark:hover:bg-gray-950",isGrouped:e.actors.length>1,onClick:()=>R(e,d),children:[b?t.jsx(w,{className:"rounded-full",containerClassName:"flex h-10 w-10"}):e.actors.length>1?t.jsx(h.Icon,{type:e.type}):t.jsxs("div",{className:"relative",children:[t.jsx($,{author:{icon:{url:e.actors[0].avatarUrl||""},name:e.actors[0].name,handle:e.actors[0].handle},size:"notification"},e.actors[0].id),t.jsx(I,{className:"absolute -right-1 -bottom-1 z-10 border-2 border-white dark:border-black",notificationType:e.type,size:"sm"})]}),e.actors.length>1&&t.jsx(h.Avatars,{children:t.jsxs("div",{className:"flex w-full flex-col",children:[t.jsxs("div",{className:"relative flex items-center pl-2",children:[!a[e.id||`${e.type}_${d}`]&&e.actors.slice(0,n).map(m=>t.jsx($,{author:{icon:{url:m.avatarUrl||""},name:m.name,handle:m.handle},className:"-ml-2 bg-[#F3F3F3]! outline outline-2 outline-white group-hover:bg-[#EDEEF0]! group-hover:outline-gray-75 dark:outline-black group-hover:dark:outline-gray-950",size:"notification"},m.id)),e.actors.length>n&&!a[e.id||`${e.type}_${d}`]&&t.jsx("div",{className:"absolute right-[28px] z-10 flex size-9 items-center justify-center rounded-full bg-black/50 text-base font-semibold tracking-tightest text-white",children:`+${e.actors.length-n}`}),e.actors.length>1&&t.jsxs(B,{className:`group flex items-center gap-0.5 text-gray-700 hover:bg-transparent hover:text-black dark:text-gray-600 dark:hover:text-white ${a[e.id||`${e.type}_${d}`]?"ml-[-20px]":"ml-0 w-[28px]"}`,variant:"ghost",onClick:m=>{m?.stopPropagation(),r(e.id||`${e.type}_${d}`)},children:[t.jsx(L,{className:`${a[e.id||`${e.type}_${d}`]?"rotate-180":""}`,size:20,strokeWidth:1.5}),a[e.id||`${e.type}_${d}`]?"Hide":t.jsx("span",{className:"sr-only",children:"Show all"})]})]}),t.jsx("div",{className:`overflow-hidden transition-all duration-300 ease-in-out ${a[e.id||`${e.type}_${d}`]?"mb-2 max-h-[1384px] opacity-100":"max-h-0 opacity-0"}`,children:a[e.id||`${e.type}_${d}`]&&e.actors.length>1&&t.jsx("div",{className:"flex flex-col gap-2 pt-2",children:e.actors.map(m=>t.jsxs("div",{className:"group/item break-anywhere flex items-center justify-between gap-4",onClick:F=>{F?.stopPropagation(),v(m.handle,i)},children:[t.jsxs("div",{className:"flex min-w-0 items-center",children:[t.jsx($,{author:{icon:{url:m.avatarUrl||""},name:m.name,handle:m.handle},size:"xs"}),t.jsx("span",{className:"ml-2 line-clamp-1 text-base font-semibold group-hover/item:underline dark:text-white",children:m.name}),t.jsx("span",{className:"ml-1 line-clamp-1 text-base text-gray-700 dark:text-gray-600",children:m.handle})]}),e.type==="follow"&&!m.followedByMe&&t.jsx(C,{following:!1,handle:m.handle,variant:"link"})]},m.id))})})]})}),t.jsxs(h.Content,{children:[t.jsx("div",{children:b?t.jsxs(t.Fragment,{children:[t.jsx(w,{}),t.jsx(w,{className:"w-full max-w-60"})]}):t.jsxs("div",{className:"flex justify-between",children:[t.jsxs("div",{className:"flex items-center gap-1",children:[t.jsx("span",{className:"truncate",children:t.jsx(ae,{group:e})}),e.actors.length<2&&t.jsxs(t.Fragment,{children:[t.jsx("span",{className:"mt-px text-[8px] text-gray-700 dark:text-gray-600",children:"•"}),t.jsx("span",{className:"mt-0.5 text-sm text-gray-700 dark:text-gray-600",children:W(e,!1)})]})]}),e.actors.length===1&&(e.type==="follow"||e.type==="reply"||e.type==="mention")&&!e.actors[0].followedByMe&&t.jsx(C,{following:!1,handle:e.actors[0].handle,variant:"link"})]})}),(e.type==="reply"&&e.inReplyTo||e.type==="mention"||e.type==="like"&&!e.post?.name&&e.post?.content||e.type==="repost"&&!e.post?.name&&e.post?.content)&&(e.type!=="reply"&&e.type!=="mention"?t.jsxs("div",{className:"ap-note-content mt-0.5 line-clamp-1 text-sm text-pretty text-gray-700 dark:text-gray-600",children:[e.post?.type==="article"&&e.post?.title&&t.jsxs(t.Fragment,{children:[e.post.title," — "]}),t.jsx("span",{dangerouslySetInnerHTML:{__html:_(e.post?.content||"")}})]}):t.jsx(t.Fragment,{children:t.jsxs("div",{className:"mt-2.5 rounded-md bg-gray-100 px-5 py-[14px] group-hover:bg-gray-200 dark:bg-gray-925/30 group-hover:dark:bg-black/40",children:[t.jsx(ne,{className:"ap-note-content text-pretty",content:e.post?.content||"",stripTags:["a"]}),e.post&&e.post.attachments&&e.post.attachments.length>0&&t.jsx("div",{className:"notification-attachments mb-1 [&_.attachment-gallery]:flex [&_.attachment-gallery]:flex-wrap [&_img]:aspect-square [&_img]:max-w-[calc(20%-6.4px)]",children:D({...e.post,type:"Note",attachment:e.post.attachments})})]})})),(e.type==="reply"&&e.post||e.type==="mention")&&t.jsx("div",{className:"mt-1.5",children:t.jsx(H,{actor:{...e.actors[0],icon:{url:e.actors[0].avatarUrl||""},id:e.actors[0].url,preferredUsername:e.actors[0].handle?.replace(/^@([^@]+)@.*$/,"$1")||"unknown"},buttonClassName:"hover:bg-gray-200",commentCount:e.post.replyCount||0,layout:"notification",likeCount:e.post.likeCount||0,object:{...e.post,liked:e.post.likedByMe,reposted:e.post.repostedByMe},repostCount:e.post.repostCount||0,onLikeClick:s})})]})]}),d<k.length-1&&t.jsx("div",{className:"pl-[52px]",children:t.jsx(ee,{})})]},e.id||`${e.type}_${d}`))}),t.jsx("div",{ref:N,className:"h-1"}),x&&t.jsx("div",{className:"-mt-4 mb-8 flex flex-col items-center justify-center gap-4 text-center",children:t.jsx(O,{size:"md"})})]})]})})};export{ce as default};
|