ghost 6.11.0 → 6.12.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (435) hide show
  1. package/components/tryghost-i18n-6.12.0.tgz +0 -0
  2. package/core/boot.js +4 -2
  3. package/core/built/admin/assets/{_baseAssignValue-BX8EallQ.js → _baseAssignValue-hsL6ItjC.js} +1 -1
  4. package/core/built/admin/assets/{a-large-small-CKZJgscl.js → a-large-small-BPPu_Iy7.js} +1 -1
  5. package/core/built/admin/assets/admin-x-settings/admin-x-settings.js +1 -1
  6. package/core/built/admin/assets/admin-x-settings/{code-editor-view-n8DFeXbv.mjs → code-editor-view-Bq6l5arq.mjs} +2 -2
  7. package/core/built/admin/assets/admin-x-settings/{index-v6qQgUXt.mjs → index-CKaxer_o.mjs} +2 -2
  8. package/core/built/admin/assets/admin-x-settings/{index-CXL12uvO.mjs → index-CtYEAgeN.mjs} +2 -2
  9. package/core/built/admin/assets/admin-x-settings/{index-D4ye6uvI.mjs → index-D4NstoNQ.mjs} +11 -6
  10. package/core/built/admin/assets/admin-x-settings/{modals-CdsPaTfy.mjs → modals-BzljHVa7.mjs} +2 -2
  11. package/core/built/admin/assets/{at-sign-CqQzllfI.js → at-sign-CYnGzOFc.js} +1 -1
  12. package/core/built/admin/assets/{audience-select-DQD7iDOb.js → audience-select-DYoxiiwy.js} +1 -1
  13. package/core/built/admin/assets/{avatar-flipboard-uq7ptTxT.js → avatar-flipboard-C9-npfmZ.js} +1 -1
  14. package/core/built/admin/assets/{bluesky-sharing-qyIGv6Ny.js → bluesky-sharing-BGcmGcee.js} +1 -1
  15. package/core/built/admin/assets/{chart-DGA1MaFs.js → chart-CqJxisVP.js} +1 -1
  16. package/core/built/admin/assets/{chunk.524.1289543297329587cf8a.js → chunk.524.74a9629dd2ba0d21bbef.js} +7 -7
  17. package/core/built/admin/assets/{chunk.582.344ea0d0a16d671345cd.js → chunk.582.3846471396b3a7c46e66.js} +8 -8
  18. package/core/built/admin/assets/{code-editor-view-Bz6kXDiv.js → code-editor-view-C8l3gNnO.js} +1 -1
  19. package/core/built/admin/assets/{comments-C-lkEDkz.js → comments-CpHDoxov.js} +1 -1
  20. package/core/built/admin/assets/{copy-BFuV16bY.js → copy-DWiB-781.js} +1 -1
  21. package/core/built/admin/assets/{data-list-Bw1CQEZ9.js → data-list-yngXNZDF.js} +1 -1
  22. package/core/built/admin/assets/{deleted-feed-item-CmNbSYiO.js → deleted-feed-item-C0FcyLMN.js} +1 -1
  23. package/core/built/admin/assets/{edit-profile-DlIPB2km.js → edit-profile-BjtDkDAq.js} +1 -1
  24. package/core/built/admin/assets/{empty-indicator-DBrIZcFq.js → empty-indicator-BXWniwsl.js} +1 -1
  25. package/core/built/admin/assets/{en-BBc7b85q.js → en-B8qaJx-T.js} +1 -1
  26. package/core/built/admin/assets/{feed-B3XQzKZl.js → feed-DsCVb1SA.js} +1 -1
  27. package/core/built/admin/assets/{filters-DUFXZZnu.js → filters-jAXQSPq6.js} +1 -1
  28. package/core/built/admin/assets/{gh-chart-BV97-O7c.js → gh-chart-DwTCK8z_.js} +1 -1
  29. package/core/built/admin/assets/{ghost-9aa1e7c5992f122dba6932af78bf8e56.js → ghost-6367d022df9db9dacbcb9bfa30232ec7.js} +2 -2
  30. package/core/built/admin/assets/{growth-njR0GqK2.js → growth-DshcRqda.js} +1 -1
  31. package/core/built/admin/assets/{hash-CdH0ikFp.js → hash-p9dv0yuc.js} +1 -1
  32. package/core/built/admin/assets/{inbox-Bd0uf1Ez.js → inbox-CRoP9sy5.js} +1 -1
  33. package/core/built/admin/assets/{index-Kji6JKl7.js → index-6syrC9X1.js} +1 -1
  34. package/core/built/admin/assets/{index-C7M19LpB.js → index-BKtz3UH0.js} +1 -1
  35. package/core/built/admin/assets/{index-DWk7hKRR.js → index-BwY94Fb4.js} +1 -1
  36. package/core/built/admin/assets/{index-BFhECYgc.js → index-C3DF6aFe.js} +1 -1
  37. package/core/built/admin/assets/index-C6NCNp1B.js +1 -0
  38. package/core/built/admin/assets/{index-BYawr8p9.js → index-CJU9a2PB.js} +3 -3
  39. package/core/built/admin/assets/{index-CIE2_z5J.js → index-CUWE7aD1.js} +1 -1
  40. package/core/built/admin/assets/{index-DgRIbSpg.js → index-CuQ_II0e.js} +1 -1
  41. package/core/built/admin/assets/{index-Birw80cQ.js → index-DG8f-HuU.js} +1 -1
  42. package/core/built/admin/assets/{index-DziHC2du.js → index-DItZTRQ4.js} +1 -1
  43. package/core/built/admin/assets/{index-DG53N3Xt.js → index-eLx96SEn.js} +1 -1
  44. package/core/built/admin/assets/{index-DCw6JaEl.js → index-j2_Q-_8H.js} +1 -1
  45. package/core/built/admin/assets/{index-BZ21H0xH.js → index-qWpHJAMP.js} +1 -1
  46. package/core/built/admin/assets/{index-DXCu9e7c.js → index-sy6xRtoO.js} +1 -1
  47. package/core/built/admin/assets/{koenig-lexical-BDJVCHtm.js → koenig-lexical-DgAlBHHS.js} +1 -1
  48. package/core/built/admin/assets/{kpi-card-cv8roErt.js → kpi-card-CHZSLw4p.js} +1 -1
  49. package/core/built/admin/assets/{kpis-Dt4OFY3L.js → kpis-DzbAHfKK.js} +1 -1
  50. package/core/built/admin/assets/{links-08beB3Ij.js → links-BQHRbn46.js} +1 -1
  51. package/core/built/admin/assets/{lucide-react-DKlmxVQI.js → lucide-react-B7UnD_Dp.js} +1 -1
  52. package/core/built/admin/assets/{main-layout-Cl09wG7F.js → main-layout-9nmU5WlG.js} +1 -1
  53. package/core/built/admin/assets/{message-square-text-CaMVBVPr.js → message-square-text-CS3iRuPc.js} +1 -1
  54. package/core/built/admin/assets/{minus-2XwCoFJV.js → minus-emzwh6hq.js} +1 -1
  55. package/core/built/admin/assets/{modals-CIgzYQgv.js → modals-CumFuZ2d.js} +1 -1
  56. package/core/built/admin/assets/{moderation-FjlsSym6.js → moderation-DyfFc9m4.js} +1 -1
  57. package/core/built/admin/assets/{newsletter-BNOwZNlE.js → newsletter-BWul5IFc.js} +1 -1
  58. package/core/built/admin/assets/{newsletters-DUusEYSg.js → newsletters-N6bwI1OF.js} +1 -1
  59. package/core/built/admin/assets/{note-BpYwIDK6.js → note-CiBzkHzz.js} +1 -1
  60. package/core/built/admin/assets/{overview-Y5QYPClr.js → overview-D9gRvn7X.js} +1 -1
  61. package/core/built/admin/assets/{pagemenu-BMXHDXYy.js → pagemenu-aHubMPwB.js} +1 -1
  62. package/core/built/admin/assets/{post-analytics-UerFnJse.js → post-analytics-Bm9xH8nA.js} +1 -1
  63. package/core/built/admin/assets/{post-analytics-context-geHk7rOj.js → post-analytics-context-C7oW3aBz.js} +1 -1
  64. package/core/built/admin/assets/{post-analytics-header-DXfc4KeX.js → post-analytics-header-BjGFgN6A.js} +1 -1
  65. package/core/built/admin/assets/{post-share-modal-Dql4fYjR.js → post-share-modal-Su923uIc.js} +1 -1
  66. package/core/built/admin/assets/{posts-Bsvw11Zo.js → posts-BwP7BNcB.js} +1 -1
  67. package/core/built/admin/assets/{referrers-B8xJpCcR.js → referrers-n_ln9DqI.js} +1 -1
  68. package/core/built/admin/assets/{repeat-COP-3g8d.js → repeat-ms5ocvE0.js} +1 -1
  69. package/core/built/admin/assets/{reply-JE8tmvOn.js → reply-BvO85IDn.js} +1 -1
  70. package/core/built/admin/assets/{select-BhvNY3I-.js → select-B4QhMW5f.js} +1 -1
  71. package/core/built/admin/assets/{settings-BJwVfuWG.js → settings-D5rGcWJ7.js} +4 -4
  72. package/core/built/admin/assets/{settings-C6ZUZQe4.js → settings-QtZ6a2TL.js} +1 -1
  73. package/core/built/admin/assets/{sort-button-iOtR-vQ1.js → sort-button-84sYUZMN.js} +1 -1
  74. package/core/built/admin/assets/{source-icon-C2iFWMlV.js → source-icon-Bzw-AU8p.js} +1 -1
  75. package/core/built/admin/assets/{sprout-BW9HFVU8.js → sprout-C2R5CbXV.js} +1 -1
  76. package/core/built/admin/assets/{square-BCNGSZhW.js → square-DT1uWkxs.js} +1 -1
  77. package/core/built/admin/assets/stats/{audience-select-DNAWmT7R.mjs → audience-select-fTCiZ9MT.mjs} +3 -3
  78. package/core/built/admin/assets/stats/{index-DbGvSTMe.mjs → index-BKgioyC7.mjs} +5 -5
  79. package/core/built/admin/assets/stats/{index-s19ZmxbX.mjs → index-CR2t5Xd-.mjs} +5 -5
  80. package/core/built/admin/assets/stats/index-DEkYwR7C.mjs +739 -0
  81. package/core/built/admin/assets/stats/{index-BS3KMSy9.mjs → index-Djwey97a.mjs} +5 -5
  82. package/core/built/admin/assets/stats/{index-MOQSSYwT.mjs → index-FiU_XgEe.mjs} +6 -6
  83. package/core/built/admin/assets/stats/{sort-button-D76rcldr.mjs → sort-button-Bvi1wfa7.mjs} +3 -3
  84. package/core/built/admin/assets/stats/{stats-CJ7fhUyT.mjs → stats-Bbm6yWZq.mjs} +2 -2
  85. package/core/built/admin/assets/stats/stats.js +1 -1
  86. package/core/built/admin/assets/stats/{tabs-CkbxYgOE.mjs → tabs-BKwH5k-q.mjs} +3 -3
  87. package/core/built/admin/assets/stats/{url-helpers-DICtqCrE.mjs → url-helpers-DmHnUIGc.mjs} +9 -9
  88. package/core/built/admin/assets/stats/{use-growth-stats-DzO7zEy4.mjs → use-growth-stats-BVj3j1hb.mjs} +3 -3
  89. package/core/built/admin/assets/{stats-r0Bphuvi.js → stats-B1mhlQSp.js} +1 -1
  90. package/core/built/admin/assets/{stats-view-DzZxrBDz.js → stats-view-C6MTCwRW.js} +1 -1
  91. package/core/built/admin/assets/{step-1-CUoUOyMm.js → step-1-CzQmZJ93.js} +1 -1
  92. package/core/built/admin/assets/{step-2-CpAkPD8D.js → step-2-DXGDWSQo.js} +1 -1
  93. package/core/built/admin/assets/{step-3-Ci6oJDmK.js → step-3-CYuxXKac.js} +1 -1
  94. package/core/built/admin/assets/{table-DeBuf80X.js → table-mjAkKNdb.js} +1 -1
  95. package/core/built/admin/assets/{tabs-C2sFfNcp.js → tabs-BwQ-i6MY.js} +1 -1
  96. package/core/built/admin/assets/{tags-Bl6G5rvf.js → tags-BkUqCuvX.js} +1 -1
  97. package/core/built/admin/assets/{tags-BL_N4nn2.js → tags-DXDZbfxp.js} +1 -1
  98. package/core/built/admin/assets/{toggle-group-B2X-8giI.js → toggle-group-CqDO3Kkx.js} +1 -1
  99. package/core/built/admin/assets/{topic-filter-DeqMID_s.js → topic-filter-DnuJJBAE.js} +1 -1
  100. package/core/built/admin/assets/{trash-BglGemAb.js → trash-CZ3EXwTL.js} +1 -1
  101. package/core/built/admin/assets/{url-helpers-84icqAuE.js → url-helpers-BE3VXr__.js} +1 -1
  102. package/core/built/admin/assets/{use-growth-stats-DF-7tL8g.js → use-growth-stats-CiuWWM6O.js} +1 -1
  103. package/core/built/admin/assets/{use-infinite-virtual-scroll-BHH7oscK.js → use-infinite-virtual-scroll-BjATkxBj.js} +1 -1
  104. package/core/built/admin/assets/{use-simple-pagination-BsvYfixw.js → use-simple-pagination-C9cb7dDz.js} +1 -1
  105. package/core/built/admin/assets/{user-round-check-BjHbfXKY.js → user-round-check-D3ihrrKL.js} +1 -1
  106. package/core/built/admin/assets/{wallet-cards-KaTkgqvi.js → wallet-cards-Do7nPf3f.js} +1 -1
  107. package/core/built/admin/assets/{web-CUWbpFil.js → web-BEwI2Gfy.js} +1 -1
  108. package/core/built/admin/index-forward.html +4 -4
  109. package/core/built/admin/index.html +3 -3
  110. package/core/frontend/web/middleware/index.js +1 -0
  111. package/core/frontend/web/middleware/serve-indexnow-key.js +66 -0
  112. package/core/frontend/web/site.js +3 -0
  113. package/core/server/api/endpoints/authentication.js +1 -1
  114. package/core/server/api/endpoints/pages.js +1 -1
  115. package/core/server/api/endpoints/posts-public.js +1 -1
  116. package/core/server/api/endpoints/posts.js +1 -1
  117. package/core/server/api/endpoints/search-index-public.js +1 -1
  118. package/core/server/api/endpoints/search-index.js +1 -1
  119. package/core/server/api/endpoints/users.js +1 -1
  120. package/core/server/api/endpoints/utils/serializers/input/settings.js +2 -1
  121. package/core/server/api/endpoints/utils/serializers/output/mappers/posts.js +1 -1
  122. package/core/server/api/endpoints/utils/validators/input/settings.js +1 -1
  123. package/core/server/data/exporter/table-lists.js +2 -1
  124. package/core/server/data/migrations/versions/6.12/2026-01-08-11-48-16-add-indexnow-api-key-setting.js +9 -0
  125. package/core/server/data/schema/default-settings/default-settings.json +6 -0
  126. package/core/server/lib/lexical.js +1 -1
  127. package/core/server/models/settings.js +2 -1
  128. package/core/server/services/activitypub/{ActivityPubServiceWrapper.js → activity-pub-service-wrapper.js} +1 -1
  129. package/core/server/services/activitypub/{ActivityPubService.ts → activity-pub-service.ts} +1 -1
  130. package/core/server/services/activitypub/index.js +1 -1
  131. package/core/server/services/adapter-manager/index.js +1 -1
  132. package/core/server/services/announcement-bar-service/{AnnouncementBarSettings.js → announcement-bar-settings.js} +1 -1
  133. package/core/server/services/announcement-bar-service/index.js +1 -1
  134. package/core/server/services/audience-feedback/{AudienceFeedbackController.js → audience-feedback-controller.js} +3 -3
  135. package/core/server/services/audience-feedback/index.js +4 -4
  136. package/core/server/services/auth/session/express-session.js +1 -1
  137. package/core/server/services/comments/{CommentsController.js → comments-controller.js} +2 -2
  138. package/core/server/services/comments/{CommentsServiceEmails.js → comments-service-emails.js} +1 -1
  139. package/core/server/services/comments/{CommentsService.js → comments-service.js} +1 -1
  140. package/core/server/services/comments/index.js +3 -3
  141. package/core/server/services/custom-redirects/index.js +2 -2
  142. package/core/server/services/donations/{DonationBookshelfRepository.ts → donation-bookshelf-repository.ts} +1 -1
  143. package/core/server/services/donations/{DonationServiceWrapper.js → donation-service-wrapper.js} +1 -1
  144. package/core/server/services/donations/index.js +1 -1
  145. package/core/server/services/email-address/{EmailAddressServiceWrapper.js → email-address-service-wrapper.js} +2 -2
  146. package/core/server/services/email-address/{EmailAddressService.js → email-address-service.js} +4 -4
  147. package/core/server/services/email-address/{EmailAddressService.ts → email-address-service.ts} +1 -1
  148. package/core/server/services/email-address/index.js +1 -1
  149. package/core/server/services/email-analytics/{EmailAnalyticsProviderMailgun.js → email-analytics-provider-mailgun.js} +1 -1
  150. package/core/server/services/email-analytics/{EmailAnalyticsServiceWrapper.js → email-analytics-service-wrapper.js} +5 -5
  151. package/core/server/services/email-analytics/{EmailAnalyticsService.js → email-analytics-service.js} +2 -2
  152. package/core/server/services/email-analytics/index.js +1 -1
  153. package/core/server/services/email-analytics/jobs/fetch-latest/index.js +1 -1
  154. package/core/server/services/email-service/{BatchSendingService.js → batch-sending-service.js} +8 -8
  155. package/core/server/services/email-service/{EmailEventProcessor.js → email-event-processor.js} +6 -6
  156. package/core/server/services/email-service/{EmailEventStorage.js → email-event-storage.js} +1 -1
  157. package/core/server/services/email-service/{EmailRenderer.js → email-renderer.js} +1 -1
  158. package/core/server/services/email-service/{EmailServiceWrapper.js → email-service-wrapper.js} +9 -9
  159. package/core/server/services/email-service/{EmailService.js → email-service.js} +13 -13
  160. package/core/server/services/email-service/index.js +1 -1
  161. package/core/server/services/email-service/{MailgunEmailProvider.js → mailgun-email-provider.js} +1 -1
  162. package/core/server/services/email-service/{SendingService.js → sending-service.js} +6 -6
  163. package/core/server/services/email-suppression-list/{InMemoryEmailSuppressionList.js → in-memory-email-suppression-list.js} +1 -1
  164. package/core/server/services/email-suppression-list/{MailgunEmailSuppressionList.js → mailgun-email-suppression-list.js} +3 -3
  165. package/core/server/services/email-suppression-list/service.js +2 -2
  166. package/core/server/services/explore/index.js +2 -2
  167. package/core/server/services/explore-ping/index.js +2 -2
  168. package/core/server/services/frontend-data-service/index.js +1 -1
  169. package/core/server/services/identity-tokens/{IdentityTokenServiceWrapper.js → identity-token-service-wrapper.js} +1 -1
  170. package/core/server/services/identity-tokens/index.js +1 -1
  171. package/core/server/services/indexnow.js +212 -0
  172. package/core/server/services/invites/index.js +1 -1
  173. package/core/server/services/link-redirection/index.js +2 -2
  174. package/core/server/services/link-redirection/{LinkRedirectRepository.js → link-redirect-repository.js} +1 -1
  175. package/core/server/services/link-redirection/{LinkRedirectsService.js → link-redirects-service.js} +2 -2
  176. package/core/server/services/link-redirection/{RedirectEvent.js → redirect-event.js} +1 -1
  177. package/core/server/services/link-tracking/index.js +3 -3
  178. package/core/server/services/link-tracking/{LinkClickRepository.js → link-click-repository.js} +1 -1
  179. package/core/server/services/link-tracking/{LinkClickTrackingService.js → link-click-tracking-service.js} +4 -4
  180. package/core/server/services/link-tracking/{PostLinkRepository.js → post-link-repository.js} +7 -7
  181. package/core/server/services/mail/{GhostMailer.js → ghost-mailer.js} +1 -1
  182. package/core/server/services/mail/index.js +2 -2
  183. package/core/server/services/media-inliner/service.js +1 -1
  184. package/core/server/services/member-attribution/README.md +6 -6
  185. package/core/server/services/member-attribution/{AttributionBuilder.js → attribution-builder.js} +4 -4
  186. package/core/server/services/member-attribution/index.js +5 -5
  187. package/core/server/services/member-attribution/{MemberAttributionService.js → member-attribution-service.js} +9 -9
  188. package/core/server/services/member-attribution/{ReferrerTranslator.js → referrer-translator.js} +1 -1
  189. package/core/server/services/member-attribution/{UrlTranslator.js → url-translator.js} +1 -1
  190. package/core/server/services/member-welcome-emails/constants.js +22 -1
  191. package/core/server/services/member-welcome-emails/service.js +23 -5
  192. package/core/server/services/members/api.js +1 -1
  193. package/core/server/services/members/importer/index.js +3 -3
  194. package/core/server/services/members/importer/{MembersCSVImporter.js → members-csv-importer.js} +2 -2
  195. package/core/server/services/members/members-api/members-api.js +14 -14
  196. package/core/server/services/members/members-api/repositories/{MemberRepository.js → member-repository.js} +17 -8
  197. package/core/server/services/members/members-api/services/{MemberBREADService.js → member-bread-service.js} +1 -1
  198. package/core/server/services/members/members-api/services/{PaymentsService.js → payments-service.js} +12 -12
  199. package/core/server/services/members/service.js +4 -4
  200. package/core/server/services/members-events/index.js +3 -3
  201. package/core/server/services/members-events/{LastSeenAtUpdater.js → last-seen-at-updater.js} +2 -2
  202. package/core/server/services/mentions/{BookshelfMentionRepository.js → bookshelf-mention-repository.js} +9 -9
  203. package/core/server/services/mentions/{InMemoryMentionRepository.js → in-memory-mention-repository.js} +4 -4
  204. package/core/server/services/mentions/{MentionController.js → mention-controller.js} +5 -5
  205. package/core/server/services/mentions/{MentionCreatedEvent.js → mention-created-event.js} +1 -1
  206. package/core/server/services/mentions/{Mention.js → mention.js} +1 -1
  207. package/core/server/services/mentions/{MentionsAPI.js → mentions-api.js} +1 -1
  208. package/core/server/services/mentions/{ResourceService.js → resource-service.js} +2 -2
  209. package/core/server/services/mentions/{RoutingService.js → routing-service.js} +2 -2
  210. package/core/server/services/mentions/service.js +11 -11
  211. package/core/server/services/mentions/{WebmentionMetadata.js → webmention-metadata.js} +1 -1
  212. package/core/server/services/mentions-email-report/job.js +1 -1
  213. package/core/server/services/mentions-email-report/{MentionEmailReportJob.js → mention-email-report-job.js} +1 -1
  214. package/core/server/services/mentions-email-report/service.js +2 -2
  215. package/core/server/services/milestones/{BookshelfMilestoneRepository.js → bookshelf-milestone-repository.js} +2 -2
  216. package/core/server/services/milestones/{InMemoryMilestoneRepository.js → in-memory-milestone-repository.js} +2 -2
  217. package/core/server/services/milestones/{Milestone.js → milestone.js} +1 -1
  218. package/core/server/services/milestones/{MilestonesService.js → milestones-service.js} +1 -1
  219. package/core/server/services/milestones/service.js +4 -4
  220. package/core/server/services/newsletters/index.js +2 -2
  221. package/core/server/services/newsletters/{NewslettersService.js → newsletters-service.js} +1 -1
  222. package/core/server/services/notifications/index.js +1 -1
  223. package/core/server/services/oembed/service.js +3 -3
  224. package/core/server/services/offers/application/{OfferMapper.js → offer-mapper.js} +1 -1
  225. package/core/server/services/offers/application/{OffersAPI.js → offers-api.js} +9 -9
  226. package/core/server/services/offers/application/{UniqueChecker.js → unique-checker.js} +2 -2
  227. package/core/server/services/offers/domain/events/{OfferCodeChangeEvent.js → offer-code-change-event.js} +1 -1
  228. package/core/server/services/offers/domain/events/{OfferCreatedEvent.js → offer-created-event.js} +1 -1
  229. package/core/server/services/offers/domain/models/{OfferAmount.js → offer-amount.js} +1 -1
  230. package/core/server/services/offers/domain/models/{OfferCadence.js → offer-cadence.js} +1 -1
  231. package/core/server/services/offers/domain/models/{OfferCode.js → offer-code.js} +1 -1
  232. package/core/server/services/offers/domain/models/{OfferCreatedAt.js → offer-created-at.js} +1 -1
  233. package/core/server/services/offers/domain/models/{OfferCurrency.js → offer-currency.js} +1 -1
  234. package/core/server/services/offers/domain/models/{OfferDescription.js → offer-description.js} +1 -1
  235. package/core/server/services/offers/domain/models/{OfferDuration.js → offer-duration.js} +1 -1
  236. package/core/server/services/offers/domain/models/{OfferName.js → offer-name.js} +1 -1
  237. package/core/server/services/offers/domain/models/{OfferStatus.js → offer-status.js} +1 -1
  238. package/core/server/services/offers/domain/models/{OfferTitle.js → offer-title.js} +1 -1
  239. package/core/server/services/offers/domain/models/{OfferType.js → offer-type.js} +1 -1
  240. package/core/server/services/offers/domain/models/{Offer.js → offer.js} +14 -14
  241. package/core/server/services/offers/domain/models/{StripeCoupon.js → stripe-coupon.js} +1 -1
  242. package/core/server/services/offers/{OfferBookshelfRepository.js → offer-bookshelf-repository.js} +6 -6
  243. package/core/server/services/offers/{OffersModule.js → offers-module.js} +4 -4
  244. package/core/server/services/offers/service.js +3 -3
  245. package/core/server/services/outbox/index.js +2 -2
  246. package/core/server/services/outbox/jobs/outbox-job.js +2 -2
  247. package/core/server/services/posts/posts-service-instance.js +47 -0
  248. package/core/server/services/posts/posts-service.js +572 -45
  249. package/core/server/services/recommendations/index.js +1 -1
  250. package/core/server/services/recommendations/{RecommendationEnablerService.js → recommendation-enabler-service.js} +2 -2
  251. package/core/server/services/recommendations/{RecommendationServiceWrapper.js → recommendation-service-wrapper.js} +2 -2
  252. package/core/server/services/recommendations/service/{BookshelfClickEventRepository.js → bookshelf-click-event-repository.js} +4 -4
  253. package/core/server/services/recommendations/service/{BookshelfClickEventRepository.ts → bookshelf-click-event-repository.ts} +2 -2
  254. package/core/server/services/recommendations/service/{BookshelfRecommendationRepository.js → bookshelf-recommendation-repository.js} +4 -4
  255. package/core/server/services/recommendations/service/{BookshelfRecommendationRepository.ts → bookshelf-recommendation-repository.ts} +3 -3
  256. package/core/server/services/recommendations/service/{BookshelfSubscribeEventRepository.js → bookshelf-subscribe-event-repository.js} +4 -4
  257. package/core/server/services/recommendations/service/{BookshelfSubscribeEventRepository.ts → bookshelf-subscribe-event-repository.ts} +2 -2
  258. package/core/server/services/recommendations/service/{InMemoryRecommendationRepository.js → in-memory-recommendation-repository.js} +2 -2
  259. package/core/server/services/recommendations/service/{InMemoryRecommendationRepository.ts → in-memory-recommendation-repository.ts} +3 -3
  260. package/core/server/services/recommendations/service/{IncomingRecommendationController.js → incoming-recommendation-controller.js} +2 -2
  261. package/core/server/services/recommendations/service/{IncomingRecommendationController.ts → incoming-recommendation-controller.ts} +3 -3
  262. package/core/server/services/recommendations/service/{IncomingRecommendationEmailRenderer.ts → incoming-recommendation-email-renderer.ts} +2 -2
  263. package/core/server/services/recommendations/service/{IncomingRecommendationService.ts → incoming-recommendation-service.ts} +2 -2
  264. package/core/server/services/recommendations/service/index.js +15 -15
  265. package/core/server/services/recommendations/service/index.ts +15 -15
  266. package/core/server/services/recommendations/service/{RecommendationController.js → recommendation-controller.js} +13 -13
  267. package/core/server/services/recommendations/service/{RecommendationController.ts → recommendation-controller.ts} +4 -4
  268. package/core/server/services/recommendations/service/{RecommendationRepository.ts → recommendation-repository.ts} +3 -3
  269. package/core/server/services/recommendations/service/{RecommendationService.js → recommendation-service.js} +6 -6
  270. package/core/server/services/recommendations/service/{RecommendationService.ts → recommendation-service.ts} +8 -8
  271. package/core/server/services/recommendations/service/{Recommendation.js → recommendation.js} +4 -4
  272. package/core/server/services/recommendations/service/{Recommendation.ts → recommendation.ts} +1 -1
  273. package/core/server/services/recommendations/service/{WellknownService.ts → well-known-service.ts} +1 -1
  274. package/core/server/services/route-settings/index.js +4 -4
  275. package/core/server/services/settings/{SettingsBREADService.js → settings-bread-service.js} +1 -1
  276. package/core/server/services/settings/settings-service.js +2 -2
  277. package/core/server/services/settings-helpers/index.js +1 -1
  278. package/core/server/services/settings-helpers/{SettingsHelpers.js → settings-helpers.js} +5 -5
  279. package/core/server/services/slack-notifications/service.js +4 -4
  280. package/core/server/services/slack-notifications/{SlackNotificationsService.js → slack-notifications-service.js} +2 -2
  281. package/core/server/services/slack-notifications/{SlackNotifications.js → slack-notifications.js} +2 -2
  282. package/core/server/services/staff/index.js +1 -1
  283. package/core/server/services/staff/{StaffServiceEmails.js → staff-service-emails.js} +2 -2
  284. package/core/server/services/staff/{StaffService.js → staff-service.js} +2 -2
  285. package/core/server/services/stats/{PostsStatsService.js → posts-stats-service.js} +25 -25
  286. package/core/server/services/stats/{ReferrersStatsService.js → referrers-stats-service.js} +3 -3
  287. package/core/server/services/stats/service.js +1 -1
  288. package/core/server/services/stats/{StatsService.js → stats-service.js} +23 -23
  289. package/core/server/services/stripe/events/index.js +2 -2
  290. package/core/server/services/stripe/service.js +1 -1
  291. package/core/server/services/stripe/services/webhook/{CheckoutSessionEventService.js → checkout-session-event-service.js} +2 -2
  292. package/core/server/services/stripe/{StripeMigrations.js → stripe-migrations.js} +1 -1
  293. package/core/server/services/stripe/{StripeService.js → stripe-service.js} +8 -8
  294. package/core/server/services/stripe/{WebhookController.js → webhook-controller.js} +4 -4
  295. package/core/server/services/stripe/{WebhookManager.js → webhook-manager.js} +5 -5
  296. package/core/server/services/themes/storage.js +1 -1
  297. package/core/server/services/tiers/{InMemoryTierRepository.js → in-memory-tier-repository.js} +1 -1
  298. package/core/server/services/tiers/service.js +2 -2
  299. package/core/server/services/tiers/{TierActivatedEvent.js → tier-activated-event.js} +1 -1
  300. package/core/server/services/tiers/{TierArchivedEvent.js → tier-archived-event.js} +1 -1
  301. package/core/server/services/tiers/{TierCreatedEvent.js → tier-created-event.js} +1 -1
  302. package/core/server/services/tiers/{TierNameChangeEvent.js → tier-name-change-event.js} +1 -1
  303. package/core/server/services/tiers/{TierPriceChangeEvent.js → tier-price-change-event.js} +1 -1
  304. package/core/server/services/tiers/{TierRepository.js → tier-repository.js} +7 -7
  305. package/core/server/services/tiers/{Tier.js → tier.js} +5 -5
  306. package/core/server/services/tiers/{TiersAPI.js → tiers-api.js} +1 -1
  307. package/core/server/services/tinybird/index.js +1 -1
  308. package/core/server/services/tinybird/{TinybirdServiceWrapper.js → tinybird-service-wrapper.js} +2 -2
  309. package/core/server/services/update-check/index.js +1 -1
  310. package/core/server/services/url/index.js +2 -2
  311. package/core/server/services/url/{Resources.js → resources.js} +1 -1
  312. package/core/server/services/url/{UrlGenerator.js → url-generator.js} +1 -1
  313. package/core/server/services/url/{UrlService.js → url-service.js} +4 -4
  314. package/core/server/services/url/{Urls.js → urls.js} +1 -1
  315. package/core/server/services/webhooks/listen.js +1 -1
  316. package/core/shared/labs.js +2 -1
  317. package/package.json +3 -3
  318. package/tsconfig.tsbuildinfo +1 -1
  319. package/components/tryghost-i18n-6.11.0.tgz +0 -0
  320. package/core/built/admin/assets/index-Cr_YX9yU.js +0 -1
  321. package/core/built/admin/assets/stats/index-BBCJ2EZo.mjs +0 -733
  322. package/core/server/services/posts/PostsService.js +0 -574
  323. /package/core/server/{GhostServer.js → ghost-server.js} +0 -0
  324. /package/core/server/services/activitypub/{ActivityPubService.js → activity-pub-service.js} +0 -0
  325. /package/core/server/services/adapter-manager/{AdapterManager.js → adapter-manager.js} +0 -0
  326. /package/core/server/services/announcement-bar-service/{AnnouncementVisibilityValues.js → announcement-visibility-values.js} +0 -0
  327. /package/core/server/services/audience-feedback/{AudienceFeedbackService.js → audience-feedback-service.js} +0 -0
  328. /package/core/server/services/audience-feedback/{FeedbackRepository.js → feedback-repository.js} +0 -0
  329. /package/core/server/services/audience-feedback/{Feedback.js → feedback.js} +0 -0
  330. /package/core/server/services/auth/session/{SessionStore.js → session-store.js} +0 -0
  331. /package/core/server/services/comments/{CommentsServiceEmailRenderer.js → comments-service-email-renderer.js} +0 -0
  332. /package/core/server/services/comments/{CommentsStatsService.js → comments-stats-service.js} +0 -0
  333. /package/core/server/services/custom-redirects/{CustomRedirectsAPI.js → custom-redirects-api.js} +0 -0
  334. /package/core/server/services/donations/{DonationBookshelfRepository.js → donation-bookshelf-repository.js} +0 -0
  335. /package/core/server/services/donations/{DonationPaymentEvent.js → donation-payment-event.js} +0 -0
  336. /package/core/server/services/donations/{DonationPaymentEvent.ts → donation-payment-event.ts} +0 -0
  337. /package/core/server/services/email-address/{EmailAddressParser.js → email-address-parser.js} +0 -0
  338. /package/core/server/services/email-address/{EmailAddressParser.js.d.ts → email-address-parser.js.d.ts} +0 -0
  339. /package/core/server/services/email-analytics/{EventProcessingResult.js → event-processing-result.js} +0 -0
  340. /package/core/server/services/email-analytics/events/{StartEmailAnalyticsJobEvent.js → start-email-analytics-job-event.js} +0 -0
  341. /package/core/server/services/email-service/{DomainWarmingService.js → domain-warming-service.js} +0 -0
  342. /package/core/server/services/email-service/{DomainWarmingService.ts → domain-warming-service.ts} +0 -0
  343. /package/core/server/services/email-service/{EmailBodyCache.js → email-body-cache.js} +0 -0
  344. /package/core/server/services/email-service/{EmailController.js → email-controller.js} +0 -0
  345. /package/core/server/services/email-service/{EmailSegmenter.js → email-segmenter.js} +0 -0
  346. /package/core/server/services/email-service/events/{EmailBouncedEvent.js → email-bounced-event.js} +0 -0
  347. /package/core/server/services/email-service/events/{EmailDeliveredEvent.js → email-delivered-event.js} +0 -0
  348. /package/core/server/services/email-service/events/{EmailOpenedEvent.js → email-opened-event.js} +0 -0
  349. /package/core/server/services/email-service/events/{EmailTemporaryBouncedEvent.js → email-temporary-bounced-event.js} +0 -0
  350. /package/core/server/services/email-service/events/{EmailUnsubscribedEvent.js → email-unsubscribed-event.js} +0 -0
  351. /package/core/server/services/email-service/events/{SpamComplaintEvent.js → spam-complaint-event.js} +0 -0
  352. /package/core/server/services/email-suppression-list/{EmailSuppressionList.js → email-suppression-list.js} +0 -0
  353. /package/core/server/services/explore/{ExploreService.js → explore-service.js} +0 -0
  354. /package/core/server/services/explore-ping/{ExplorePingService.js → explore-ping-service.js} +0 -0
  355. /package/core/server/services/frontend-data-service/{FrontendDataService.js → front-end-data-service.js} +0 -0
  356. /package/core/server/services/identity-tokens/{IdentityTokenService.js → identity-token-service.js} +0 -0
  357. /package/core/server/services/identity-tokens/{IdentityTokenService.ts → identity-token-service.ts} +0 -0
  358. /package/core/server/services/invites/{Invites.js → invites.js} +0 -0
  359. /package/core/server/services/lib/{DynamicRedirectManager.js → dynamic-redirect-manager.js} +0 -0
  360. /package/core/server/services/lib/{EmailContentGenerator.js → email-content-generator.js} +0 -0
  361. /package/core/server/services/lib/{InMemoryRepository.js → in-memory-repository.js} +0 -0
  362. /package/core/server/services/lib/{InMemoryRepository.ts → in-memory-repository.ts} +0 -0
  363. /package/core/server/services/lib/magic-link/{MagicLink.js → magic-link.js} +0 -0
  364. /package/core/server/services/lib/{MailgunClient.js → mailgun-client.js} +0 -0
  365. /package/core/server/services/link-redirection/{LinkRedirect.js → link-redirect.js} +0 -0
  366. /package/core/server/services/link-tracking/{ClickEvent.js → click-event.js} +0 -0
  367. /package/core/server/services/link-tracking/{FullPostLink.js → full-post-link.js} +0 -0
  368. /package/core/server/services/link-tracking/{PostLink.js → post-link.js} +0 -0
  369. /package/core/server/services/media-inliner/{ExternalMediaInliner.js → external-media-inliner.js} +0 -0
  370. /package/core/server/services/member-attribution/{OutboundLinkTagger.js → outbound-link-tagger.js} +0 -0
  371. /package/core/server/services/member-attribution/{UrlHistory.js → url-history.js} +0 -0
  372. /package/core/server/services/member-welcome-emails/{MemberWelcomeEmailRenderer.js → member-welcome-email-renderer.js} +0 -0
  373. /package/core/server/services/members/importer/{MembersCSVImporterStripeUtils.js → members-csv-importer-stripe-utils.js} +0 -0
  374. /package/core/server/services/members/members-api/controllers/{MemberController.js → member-controller.js} +0 -0
  375. /package/core/server/services/members/members-api/controllers/{RouterController.js → router-controller.js} +0 -0
  376. /package/core/server/services/members/members-api/controllers/{WellKnownController.js → well-known-controller.js} +0 -0
  377. /package/core/server/services/members/members-api/repositories/{EventRepository.js → event-repository.js} +0 -0
  378. /package/core/server/services/members/members-api/repositories/{ProductRepository.js → product-repository.js} +0 -0
  379. /package/core/server/services/members/members-api/services/{GeolocationService.js → geolocation-service.js} +0 -0
  380. /package/core/server/services/members/members-api/services/{TokenService.js → token-service.js} +0 -0
  381. /package/core/server/services/members/{MembersConfigProvider.js → members-config-provider.js} +0 -0
  382. /package/core/server/services/members/{RequestIntegrityTokenProvider.js → request-integrity-token-provider.js} +0 -0
  383. /package/core/server/services/members/{SingleUseTokenProvider.js → single-use-token-provider.js} +0 -0
  384. /package/core/server/services/members/stats/{MembersStats.js → members-stats.js} +0 -0
  385. /package/core/server/services/members-events/{EventStorage.js → event-storage.js} +0 -0
  386. /package/core/server/services/members-events/{LastSeenAtCache.js → last-seen-at-cache.js} +0 -0
  387. /package/core/server/services/mentions/{MentionDiscoveryService.js → mention-discovery-service.js} +0 -0
  388. /package/core/server/services/mentions/{MentionSendingService.js → mention-sending-service.js} +0 -0
  389. /package/core/server/services/mentions-email-report/{StartMentionEmailReportJob.js → start-mention-email-report-job.js} +0 -0
  390. /package/core/server/services/milestones/{MilestoneCreatedEvent.js → milestone-created-event.js} +0 -0
  391. /package/core/server/services/milestones/{MilestoneQueries.js → milestone-queries.js} +0 -0
  392. /package/core/server/services/notifications/{Notifications.js → notifications.js} +0 -0
  393. /package/core/server/services/oembed/{NFTOEmbedProvider.js → nft-oembed-provider.js} +0 -0
  394. /package/core/server/services/oembed/{OEmbedService.js → oembed-service.js} +0 -0
  395. /package/core/server/services/oembed/{TwitterOEmbedProvider.js → twitter-oembed-provider.js} +0 -0
  396. /package/core/server/services/offers/domain/models/shared/{ValueObject.js → value-object.js} +0 -0
  397. /package/core/server/services/outbox/events/{StartOutboxProcessingEvent.js → start-outbox-processing-event.js} +0 -0
  398. /package/core/server/services/posts/{PostsExporter.js → posts-exporter.js} +0 -0
  399. /package/core/server/services/posts/stats/{PostStats.js → post-stats.js} +0 -0
  400. /package/core/server/services/recommendations/service/{BookshelfRepository.js → bookshelf-repository.js} +0 -0
  401. /package/core/server/services/recommendations/service/{BookshelfRepository.ts → bookshelf-repository.ts} +0 -0
  402. /package/core/server/services/recommendations/service/{ClickEvent.js → click-event.js} +0 -0
  403. /package/core/server/services/recommendations/service/{ClickEvent.ts → click-event.ts} +0 -0
  404. /package/core/server/services/recommendations/service/{IncomingRecommendationEmailRenderer.js → incoming-recommendation-email-renderer.js} +0 -0
  405. /package/core/server/services/recommendations/service/{IncomingRecommendationService.js → incoming-recommendation-service.js} +0 -0
  406. /package/core/server/services/recommendations/service/{RecommendationMetadataService.js → recommendation-metadata-service.js} +0 -0
  407. /package/core/server/services/recommendations/service/{RecommendationMetadataService.ts → recommendation-metadata-service.ts} +0 -0
  408. /package/core/server/services/recommendations/service/{RecommendationRepository.js → recommendation-repository.js} +0 -0
  409. /package/core/server/services/recommendations/service/{SubscribeEvent.js → subscribe-event.js} +0 -0
  410. /package/core/server/services/recommendations/service/{SubscribeEvent.ts → subscribe-event.ts} +0 -0
  411. /package/core/server/services/recommendations/service/{UnsafeData.js → unsafe-data.js} +0 -0
  412. /package/core/server/services/recommendations/service/{UnsafeData.ts → unsafe-data.ts} +0 -0
  413. /package/core/server/services/recommendations/service/{WellknownService.js → well-known-service.js} +0 -0
  414. /package/core/server/services/route-settings/{DefaultSettingsManager.js → default-settings-manager.js} +0 -0
  415. /package/core/server/services/route-settings/{RouteSettings.js → route-settings.js} +0 -0
  416. /package/core/server/services/route-settings/{SettingsLoader.js → settings-loader.js} +0 -0
  417. /package/core/server/services/route-settings/{SettingsPathManager.js → settings-path-manager.js} +0 -0
  418. /package/core/server/services/stats/{ContentStatsService.js → content-stats-service.js} +0 -0
  419. /package/core/server/services/stats/{MembersStatsService.js → members-stats-service.js} +0 -0
  420. /package/core/server/services/stats/{MrrStatsService.js → mrr-stats-service.js} +0 -0
  421. /package/core/server/services/stats/{SubscriptionStatsService.js → subscription-stats-service.js} +0 -0
  422. /package/core/server/services/stripe/events/{StripeLiveDisabledEvent.js → stripe-live-disabled-event.js} +0 -0
  423. /package/core/server/services/stripe/events/{StripeLiveEnabledEvent.js → stripe-live-enabled-event.js} +0 -0
  424. /package/core/server/services/stripe/services/webhook/{InvoiceEventService.js → invoice-event-service.js} +0 -0
  425. /package/core/server/services/stripe/services/webhook/{SubscriptionEventService.js → subscription-event-service.js} +0 -0
  426. /package/core/server/services/stripe/{StripeAPI.js → stripe-api.js} +0 -0
  427. /package/core/server/services/themes/{ThemeStorage.js → theme-storage.js} +0 -0
  428. /package/core/server/services/tinybird/{TinybirdService.js → tinybird-service.js} +0 -0
  429. /package/core/server/services/update-check/{UpdateCheckService.js → update-check-service.js} +0 -0
  430. /package/core/server/services/url/{LocalFileCache.js → local-file-cache.js} +0 -0
  431. /package/core/server/services/url/{Queue.js → queue.js} +0 -0
  432. /package/core/server/services/url/{Resource.js → resource.js} +0 -0
  433. /package/core/server/services/{Users.js → users.js} +0 -0
  434. /package/core/server/services/{VerificationTrigger.js → verification-trigger.js} +0 -0
  435. /package/core/server/services/webhooks/{WebhookTrigger.js → webhook-trigger.js} +0 -0
@@ -1 +1 @@
1
- import{G as T,I as F,J as _,K as E,r as d,M as V,N as H,b as R,j as e,L as W,O as $,Q as k,R as b,T as j,P as G,U as v,h as J,A as K,S as o,B as i,V as c}from"./index-BYawr8p9.js";import{T as O,a as Q,b as w,c as f}from"./tabs-C2sFfNcp.js";import"./index-Kji6JKl7.js";import"./lucide-react-DKlmxVQI.js";import"./a-large-small-CKZJgscl.js";import"./wallet-cards-KaTkgqvi.js";import"./at-sign-CqQzllfI.js";import"./message-square-text-CaMVBVPr.js";import"./copy-BFuV16bY.js";import"./hash-CdH0ikFp.js";import"./inbox-Bd0uf1Ez.js";import"./minus-2XwCoFJV.js";import"./tags-BL_N4nn2.js";import"./square-BCNGSZhW.js";import"./user-round-check-BjHbfXKY.js";import"./repeat-COP-3g8d.js";import"./reply-JE8tmvOn.js";import"./sprout-BW9HFVU8.js";import"./trash-BglGemAb.js";const he=()=>{const{data:N,isLoading:l}=T("index"),{data:g,isLoading:n}=F("index"),m=l?Array(5).fill({apId:"",name:"",handle:"",avatarUrl:""}):N?.pages.flatMap(s=>s.accounts)??[],u=n?Array(5).fill({apId:"",name:""}):g?.pages.flatMap(s=>s.domains)??[],U=_("index"),I=E("index"),[M,x]=d.useState(new Set),B=V("index"),D=H("index"),[S,h]=d.useState(new Set),[p,r]=d.useState(null),y=R(),A=s=>{x(t=>{const a=new Set([...t]);return a.add(s.apId),a}),I.mutate(s),c.success("User unblocked")},L=s=>{x(t=>{const a=new Set([...t]);return a.delete(s.apId),a}),U.mutate(s),c.success("User blocked")},C=s=>{h(t=>{const a=new Set([...t]);return a.add(s.url),a}),D.mutate({url:s.url}),c.success("Domain unblocked")},P=s=>{h(t=>{const a=new Set([...t]);return a.delete(s.url),a}),B.mutate({url:s.url}),c.success("Domain blocked")};return e.jsx(W,{children:e.jsxs("div",{className:"mx-auto max-w-[620px] py-[min(4vh,48px)]",children:[e.jsx("div",{className:"flex items-center justify-between gap-8",children:e.jsx($,{children:"Moderation"})}),e.jsx("div",{className:"mt-6",children:e.jsxs(O,{defaultValue:"blocked_users",variant:"underline",children:[e.jsxs(Q,{children:[e.jsx(w,{value:"blocked_users",children:"Blocked users"}),e.jsx(w,{value:"blocked_domains",children:"Blocked domains"})]}),e.jsx(f,{className:"mt-2",value:"blocked_users",children:!l&&m.length===0?e.jsxs(k,{children:[e.jsx(b,{children:e.jsx(j,{})}),e.jsx("div",{className:"mt-2 flex max-w-[400px] flex-col items-center gap-1 text-center",children:e.jsx("p",{children:"When you block someone, they won't be able to follow you or interact with your content on the social web."})})]}):m.map((s,t)=>e.jsx(G,{actor:s,isCurrentUser:!0,children:e.jsx("div",{children:e.jsxs(v,{onClick:l?void 0:()=>J(s.handle,y),children:[e.jsx(K,{author:{icon:{url:s.avatarUrl},name:s.name,handle:s.handle}}),e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"block truncate font-semibold text-black dark:text-white",children:l?e.jsx(o,{className:"w-24"}):s.name}),e.jsx("span",{className:"block truncate text-sm text-gray-600",children:l?e.jsx(o,{className:"w-40"}):s.handle})]}),M.has(s.apId)?e.jsx(i,{className:"ml-auto min-w-[90px] text-red hover:!bg-red/5 hover:text-red-400",variant:"outline",onClick:a=>{a.stopPropagation(),L(s)},children:"Block"}):l?e.jsx("div",{className:"ml-auto w-16",children:e.jsx(o,{})}):e.jsx(i,{className:"ml-auto min-w-[90px]",variant:"destructive",onClick:a=>{a.stopPropagation(),A(s)},onMouseEnter:()=>r(s.apId),onMouseLeave:()=>r(null),children:p===s.apId?"Unblock":"Blocked"})]})})},s.apId?s.apId:`loading-${t}`))}),e.jsx(f,{className:"mt-[11px]",value:"blocked_domains",children:!n&&u.length===0?e.jsxs(k,{children:[e.jsx(b,{children:e.jsx(j,{})}),e.jsx("div",{className:"mt-2 flex max-w-[400px] flex-col items-center gap-1 text-center",children:e.jsx("p",{children:"When you block a domain, all users from that domain won't be able to follow you or interact with your content."})})]}):u.map((s,t)=>e.jsxs(v,{children:[e.jsx("div",{className:"flex min-w-0 flex-col",children:e.jsx("span",{className:"block truncate font-semibold text-black dark:text-white",children:n?e.jsx(o,{className:"w-48"}):new URL(s.url).hostname})}),S.has(s.url)?e.jsx(i,{className:"ml-auto min-w-[90px] text-red hover:!bg-red/5 hover:text-red-400",variant:"outline",onClick:()=>P(s),children:"Block"}):n?e.jsx("div",{className:"ml-auto w-16",children:e.jsx(o,{})}):e.jsx(i,{className:"ml-auto min-w-[90px]",variant:"destructive",onClick:()=>C(s),onMouseEnter:()=>r(s.url),onMouseLeave:()=>r(null),children:p===s.url?"Unblock":"Blocked"})]},s.url?s.url:`loading-${t}`))})]})})]})})};export{he as default};
1
+ import{G as T,I as F,J as _,K as E,r as d,M as V,N as H,b as R,j as e,L as W,O as $,Q as k,R as b,T as j,P as G,U as v,h as J,A as K,S as o,B as i,V as c}from"./index-CJU9a2PB.js";import{T as O,a as Q,b as w,c as f}from"./tabs-BwQ-i6MY.js";import"./index-6syrC9X1.js";import"./lucide-react-B7UnD_Dp.js";import"./a-large-small-BPPu_Iy7.js";import"./wallet-cards-Do7nPf3f.js";import"./at-sign-CYnGzOFc.js";import"./message-square-text-CS3iRuPc.js";import"./copy-DWiB-781.js";import"./hash-p9dv0yuc.js";import"./inbox-CRoP9sy5.js";import"./minus-emzwh6hq.js";import"./tags-DXDZbfxp.js";import"./square-DT1uWkxs.js";import"./user-round-check-D3ihrrKL.js";import"./repeat-ms5ocvE0.js";import"./reply-BvO85IDn.js";import"./sprout-C2R5CbXV.js";import"./trash-CZ3EXwTL.js";const he=()=>{const{data:N,isLoading:l}=T("index"),{data:g,isLoading:n}=F("index"),m=l?Array(5).fill({apId:"",name:"",handle:"",avatarUrl:""}):N?.pages.flatMap(s=>s.accounts)??[],u=n?Array(5).fill({apId:"",name:""}):g?.pages.flatMap(s=>s.domains)??[],U=_("index"),I=E("index"),[M,x]=d.useState(new Set),B=V("index"),D=H("index"),[S,h]=d.useState(new Set),[p,r]=d.useState(null),y=R(),A=s=>{x(t=>{const a=new Set([...t]);return a.add(s.apId),a}),I.mutate(s),c.success("User unblocked")},L=s=>{x(t=>{const a=new Set([...t]);return a.delete(s.apId),a}),U.mutate(s),c.success("User blocked")},C=s=>{h(t=>{const a=new Set([...t]);return a.add(s.url),a}),D.mutate({url:s.url}),c.success("Domain unblocked")},P=s=>{h(t=>{const a=new Set([...t]);return a.delete(s.url),a}),B.mutate({url:s.url}),c.success("Domain blocked")};return e.jsx(W,{children:e.jsxs("div",{className:"mx-auto max-w-[620px] py-[min(4vh,48px)]",children:[e.jsx("div",{className:"flex items-center justify-between gap-8",children:e.jsx($,{children:"Moderation"})}),e.jsx("div",{className:"mt-6",children:e.jsxs(O,{defaultValue:"blocked_users",variant:"underline",children:[e.jsxs(Q,{children:[e.jsx(w,{value:"blocked_users",children:"Blocked users"}),e.jsx(w,{value:"blocked_domains",children:"Blocked domains"})]}),e.jsx(f,{className:"mt-2",value:"blocked_users",children:!l&&m.length===0?e.jsxs(k,{children:[e.jsx(b,{children:e.jsx(j,{})}),e.jsx("div",{className:"mt-2 flex max-w-[400px] flex-col items-center gap-1 text-center",children:e.jsx("p",{children:"When you block someone, they won't be able to follow you or interact with your content on the social web."})})]}):m.map((s,t)=>e.jsx(G,{actor:s,isCurrentUser:!0,children:e.jsx("div",{children:e.jsxs(v,{onClick:l?void 0:()=>J(s.handle,y),children:[e.jsx(K,{author:{icon:{url:s.avatarUrl},name:s.name,handle:s.handle}}),e.jsxs("div",{className:"flex min-w-0 flex-col",children:[e.jsx("span",{className:"block truncate font-semibold text-black dark:text-white",children:l?e.jsx(o,{className:"w-24"}):s.name}),e.jsx("span",{className:"block truncate text-sm text-gray-600",children:l?e.jsx(o,{className:"w-40"}):s.handle})]}),M.has(s.apId)?e.jsx(i,{className:"ml-auto min-w-[90px] text-red hover:!bg-red/5 hover:text-red-400",variant:"outline",onClick:a=>{a.stopPropagation(),L(s)},children:"Block"}):l?e.jsx("div",{className:"ml-auto w-16",children:e.jsx(o,{})}):e.jsx(i,{className:"ml-auto min-w-[90px]",variant:"destructive",onClick:a=>{a.stopPropagation(),A(s)},onMouseEnter:()=>r(s.apId),onMouseLeave:()=>r(null),children:p===s.apId?"Unblock":"Blocked"})]})})},s.apId?s.apId:`loading-${t}`))}),e.jsx(f,{className:"mt-[11px]",value:"blocked_domains",children:!n&&u.length===0?e.jsxs(k,{children:[e.jsx(b,{children:e.jsx(j,{})}),e.jsx("div",{className:"mt-2 flex max-w-[400px] flex-col items-center gap-1 text-center",children:e.jsx("p",{children:"When you block a domain, all users from that domain won't be able to follow you or interact with your content."})})]}):u.map((s,t)=>e.jsxs(v,{children:[e.jsx("div",{className:"flex min-w-0 flex-col",children:e.jsx("span",{className:"block truncate font-semibold text-black dark:text-white",children:n?e.jsx(o,{className:"w-48"}):new URL(s.url).hostname})}),S.has(s.url)?e.jsx(i,{className:"ml-auto min-w-[90px] text-red hover:!bg-red/5 hover:text-red-400",variant:"outline",onClick:()=>P(s),children:"Block"}):n?e.jsx("div",{className:"ml-auto w-16",children:e.jsx(o,{})}):e.jsx(i,{className:"ml-auto min-w-[90px]",variant:"destructive",onClick:()=>C(s),onMouseEnter:()=>r(s.url),onMouseLeave:()=>r(null),children:p===s.url?"Unblock":"Blocked"})]},s.url?s.url:`loading-${t}`))})]})})]})})};export{he as default};
@@ -1 +1 @@
1
- import{ae as Re,r,u as Se,aM as re,j as e,ai as N,aP as ne,aO as K,bP as le,cz as ee,bG as _e,bI as Fe,cA as Te,cB as Ae,cC as $e,B as q,aR as ze,aN as Ee,aj as E,cq as Me,C as De}from"./index-BYawr8p9.js";import{C as Y,a as Q,b as J,h as X,c as _,i as ce}from"./pagemenu-BMXHDXYy.js";import{u as oe,S as de,a as me,b as pe,c as ue}from"./use-simple-pagination-BsvYfixw.js";import{T as Ie,a as Be,b as se}from"./tabs-C2sFfNcp.js";import{e as Ue,f as Ve,g as Oe}from"./lucide-react-DKlmxVQI.js";import{a as We,P as Ge}from"./wallet-cards-KaTkgqvi.js";import{K as B,d as U,a as V,b as O,c as W}from"./kpi-card-cv8roErt.js";import{P as He,a as Ke}from"./post-analytics-header-DXfc4KeX.js";import{D as qe,a as Ye,b as Qe,c as Je,d as Xe,e as Ze,f as es,g as ss}from"./data-list-Bw1CQEZ9.js";import{a as ts,u as as,p as is,g as G,N as H}from"./links-08beB3Ij.js";import{u as rs}from"./post-analytics-context-geHk7rOj.js";import{h as ns}from"./post-helpers-gInwAwEv.js";import{f as ls,g as cs}from"./stats-r0Bphuvi.js";import{g as te}from"./posts-Bsvw11Zo.js";import"./index-Kji6JKl7.js";import"./a-large-small-CKZJgscl.js";import"./at-sign-CqQzllfI.js";import"./message-square-text-CaMVBVPr.js";import"./copy-BFuV16bY.js";import"./hash-CdH0ikFp.js";import"./inbox-Bd0uf1Ez.js";import"./minus-2XwCoFJV.js";import"./tags-BL_N4nn2.js";import"./square-BCNGSZhW.js";import"./user-round-check-BjHbfXKY.js";import"./repeat-COP-3g8d.js";import"./reply-JE8tmvOn.js";import"./sprout-BW9HFVU8.js";import"./trash-BglGemAb.js";import"./post-share-modal-Dql4fYjR.js";import"./chart-DGA1MaFs.js";import"./_baseAssignValue-BX8EallQ.js";const os="FeedbackResponseType",ds=Re({dataType:os,path:s=>`/feedback/${s}/`}),ms=(s,a)=>{const{data:c,isLoading:o,error:g}=ds(s,{searchParams:{limit:"50",...a!==void 0?{score:a.toString()}:{}}});return{feedback:r.useMemo(()=>c?.feedback?c.feedback:[],[c]),isLoading:o,error:g}},ps=({feedbackStats:s})=>{const{postId:a}=Se(),c=re(),[o,g]=r.useState("positive"),n=9,f=o==="positive"?1:0,{feedback:F,isLoading:L}=ms(a||"",f),{totalPages:k,paginatedData:i,nextPage:v,previousPage:R,hasNextPage:C,hasPreviousPage:l}=oe({data:F,itemsPerPage:n}),x=L;return e.jsxs(Y,{children:[e.jsxs(Q,{className:"pb-5",children:[e.jsx(J,{children:"Feedback"}),e.jsx(X,{children:"What did your readers think?"})]}),s.totalFeedback>0?e.jsxs(_,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(Ie,{className:"pb-3",defaultValue:"positive",value:o,variant:"button",onValueChange:d=>g(d),children:e.jsxs(Be,{className:"gap-1",children:[e.jsx(se,{className:"h-7",value:"positive",children:e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(Ue,{size:14,strokeWidth:1.25}),e.jsx("span",{className:"hidden font-medium sm:!visible sm:!inline",children:"More like this"}),e.jsx("span",{className:"font-semibold tracking-tight",children:N(s.positiveFeedback/s.totalFeedback)})]})}),e.jsx(se,{className:"h-7",value:"negative",children:e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(Ve,{size:14,strokeWidth:1.25}),e.jsx("span",{className:"hidden font-medium sm:!visible sm:!inline",children:"Less like this"}),e.jsx("span",{className:"font-semibold tracking-tight",children:N(s.negativeFeedback/s.totalFeedback)})]})})]})}),e.jsx(ne,{className:"mb-3 mr-2 lg:hidden xl:!visible xl:!block",children:"Date"})]}),e.jsx(K,{}),x?e.jsx(le,{className:"mt-3",lines:3}):i&&i.length>0?e.jsx("div",{className:"flex w-full flex-col py-3",children:i.map(d=>e.jsxs("div",{className:"flex h-10 w-full items-center justify-between gap-3 rounded-sm border-none px-2 text-sm hover:cursor-pointer hover:bg-accent",onClick:()=>{c(`/members/${d.member.id}`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[e.jsxs(_e,{className:"size-7",children:[d.member?.avatar_image&&e.jsx("img",{className:"absolute aspect-square size-full",src:d.member?.avatar_image}),e.jsx(Fe,{className:"text-white",style:{backgroundColor:`${Ae(ee(d.member),75,55)}`},children:Te(d.member)})]}),ee(d.member)]}),e.jsx("div",{className:"whitespace-nowrap text-muted-foreground",children:$e(d.created_at)})]},d.id))}):e.jsx("div",{className:"flex h-full items-center justify-center py-8 text-center text-sm text-muted-foreground",children:e.jsxs("div",{children:["No ",o==="positive"?"positive":"negative"," feedback yet"]})})]}):e.jsxs(_,{className:"flex grow flex-col items-center justify-center text-center text-sm text-muted-foreground",children:[e.jsx("div",{children:"No members have given feedback yet"}),e.jsx("div",{children:"When someone does, you'll see their response here."})]}),s.totalFeedback>0&&e.jsx(ce,{className:"grow-0",children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[e.jsxs(q,{variant:"outline",onClick:()=>{const d=`(feedback.post_id:'${a}'+feedback.score:1)`,m=`(feedback.post_id:'${a}'+feedback.score:0)`,P=`${encodeURIComponent(d)}&post=${a}`,h=`${encodeURIComponent(m)}&post=${a}`;c(`/members?filter=${o==="positive"?P:h}`,{crossApp:!0})},children:["View all",e.jsx(We,{})]}),k>1&&e.jsx(de,{className:"pb-0",children:e.jsxs(me,{children:[e.jsx(pe,{disabled:!l,onClick:R}),e.jsx(ue,{disabled:!C,onClick:v})]})})]})})]})},us=()=>{const{mutateAsync:s,isLoading:a}=ts();return{editLinks:s,isEditLinksLoading:a}},gs=s=>{const{data:a,isLoading:c}=te(s),{data:o,isLoading:g}=te(s,{searchParams:{include:"count.positive_feedback,count.negative_feedback"}}),n=r.useMemo(()=>a?.posts[0],[a]),f=r.useMemo(()=>o?.posts[0],[o]),F=r.useMemo(()=>n?{sent:n.email?.email_count||0,opened:n.email?.opened_count||0,clicked:n.count?.clicks||0,openedRate:n.email?.opened_count?n.email.opened_count/n.email.email_count:0,clickedRate:n.count?.clicks&&n.email?.email_count?n.count.clicks/n.email.email_count:0}:{sent:0,opened:0,clicked:0,openedRate:0,clickedRate:0},[n]),L=r.useMemo(()=>{if(!f?.count)return{positiveFeedback:0,negativeFeedback:0,totalFeedback:0};const p=f.count.positive_feedback||0,w=f.count.negative_feedback||0,j=p+w;return{positiveFeedback:p,negativeFeedback:w,totalFeedback:j}},[f]),k=r.useMemo(()=>n?.newsletter?.id,[n]),{data:i,isLoading:v}=ls({searchParams:k?{newsletter_id:k}:{},enabled:!!k}),R=r.useMemo(()=>i?.stats?i.stats.map(p=>p.post_id):[],[i]),{data:C,isLoading:l}=cs({searchParams:k&&R.length>0?{newsletter_id:k,post_ids:R.join(",")}:{},enabled:!!k&&R.length>0}),x=r.useMemo(()=>{if(!i?.stats)return;const p=i.stats,w=C?.stats||[],j=new Map;w.forEach(b=>{j.set(b.post_id,b)});const S=p.map(b=>{const z=j.get(b.post_id);return{...b,total_clicks:z?.total_clicks||0,click_rate:z?.click_rate||0}});return{...i,stats:S}},[i,C]),d=v||l,{data:m,isLoading:P,refetch:h}=as({searchParams:{filter:`post_id:'${s}'`}}),T=r.useMemo(()=>{if(!x||!x.stats)return{openRate:0,clickRate:0};const p=x.stats;if(p.length===0)return{openRate:0,clickRate:0};const w=p.reduce((S,b)=>S+(b.open_rate||0),0),j=p.reduce((S,b)=>S+(b.click_rate||0),0);return{openRate:Number((w/p.length).toFixed(2)),clickRate:Number((j/p.length).toFixed(2))}},[x]),M=r.useMemo(()=>is(m),[m]),D=r.useMemo(()=>({openedRate:T.openRate,clickedRate:T.clickRate}),[T]);return{post:n,stats:F,feedbackStats:L,averageStats:D,topLinks:M,refetchTopLinks:h,isLoading:c||g||d||P}},xs=({breakpoints:s={sm:1080,md:1280,lg:1360}}={})=>{const[a,c]=r.useState("md");return r.useEffect(()=>{const o=()=>{const g=window.innerWidth;g<s.sm?c("sm"):g<s.md?c("md"):c("lg")};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[s]),{chartSize:a,isSmall:a==="sm",isMedium:a==="md",isLarge:a==="lg"}},ae=()=>e.jsx("div",{className:"absolute -right-4 top-1/2 z-10 hidden size-8 -translate-y-1/2 items-center justify-center rounded-full border bg-background text-muted-foreground md:!visible md:!flex",children:e.jsx(De,{className:"ml-0.5",size:16,strokeWidth:1.5})}),ie=({dataColor:s,value:a,avgValue:c})=>e.jsxs("div",{className:"absolute left-1/2 top-6 z-50 flex w-[200px] -translate-x-1/2 flex-col items-stretch gap-1.5 rounded-md bg-background px-4 py-2 text-sm opacity-0 shadow-md transition-all group-hover/block:top-3 group-hover/block:opacity-100",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("div",{className:"size-2 rounded-full bg-chart-blue opacity-50",style:{backgroundColor:s}}),"This newsletter"]}),e.jsx("div",{className:"text-right font-mono",children:a})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("div",{className:"size-2 rounded-full bg-chart-gray opacity-80"}),"Average"]}),e.jsx("div",{className:"text-right font-mono",children:c})]})]}),qs=()=>{const s=re(),[a,c]=r.useState(null),[o,g]=r.useState(""),n=r.useRef(null),f=r.useRef(null),F=10,{chartSize:L}=xs(),{appSettings:k}=ze(),{emailTrackClicks:i,emailTrackOpens:v}=k?.analytics||{},{post:R,isPostLoading:C,postId:l}=rs(),x=R,d=ns(x);r.useEffect(()=>{!C&&!d&&s(`/posts/analytics/${l}`)},[s,l,C,d]);const{stats:m,averageStats:P,topLinks:h,isLoading:T,refetchTopLinks:M}=gs(l),{editLinks:D}=us(),p=r.useMemo(()=>{if(!x?.count)return{positiveFeedback:0,negativeFeedback:0,totalFeedback:0};const t=x.count.positive_feedback||0,u=x.count.negative_feedback||0,y=t+u;return{positiveFeedback:t,negativeFeedback:u,totalFeedback:y}},[x]),w=r.useMemo(()=>x?.newsletter?.feedback_enabled===!0,[x]),j=r.useMemo(()=>p.totalFeedback>0?!0:w,[p.totalFeedback,w]),S=t=>{const u=G(h,t);u&&(c(t),g(u.link.to))},b=()=>{if(!a)return;const t=G(h,a);if(!t)return;const u=o.trim();if(u===""||u===t.link.to){c(null),g("");return}D({originalUrl:t.link.originalTo,editedUrl:o,postId:l},{onSuccess:()=>{c(null),g(""),M()}})},{totalPages:z,paginatedData:ge,nextPage:xe,previousPage:he,hasNextPage:be,hasPreviousPage:fe}=oe({data:h,itemsPerPage:F});r.useEffect(()=>{if(a&&n.current){n.current.focus();const t=G(h,a),u=y=>{f.current&&!f.current.contains(y.target)&&o===t?.link.to&&(c(null),g(""))};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}}},[a,o,h]);const I=T||C,ke=[{datatype:"Sent",value:1,fill:"url(#gradientPurple)",color:"hsl(var(--chart-purple))"}],ve={percentage:{label:"O"},Average:{label:"Average"},"This newsletter":{label:"This newsletter"}},je=[{datatype:"Average",value:P.openedRate,fill:"url(#gradientGray)",color:"hsl(var(--chart-gray))"},{datatype:"This newsletter",value:m.openedRate,fill:"url(#gradientBlue)",color:"hsl(var(--chart-blue))"}],Ne={percentage:{label:"Opened"},Average:{label:"Average"},"This newsletter":{label:"This newsletter"}},we=[{datatype:"Average",value:P.clickedRate,fill:"url(#gradientGray)",color:"hsl(var(--chart-gray))"},{datatype:"This newsletter",value:m.clickedRate,fill:"url(#gradientTeal)",color:"hsl(var(--chart-teal))"}],Ce={percentage:{label:"Clicked"},Average:{label:"Average"},"This newsletter":{label:"This newsletter"}};let A="grid-cols-3",$="aspect-[16/10] w-full max-w-[320px] sm:aspect-[2/1] md:aspect-[10/14] md:max-w-none lg:aspect-square";return(!i||!v)&&(A="grid-cols-2",$="aspect-[16/10] w-full max-w-[320px] sm:aspect-[2/1] md:aspect-square md:max-w-none lg:aspect-[15/10]"),!i&&!v&&(A="grid-cols-1",$="aspect-square w-full sm:aspect-[16/10] md:max-w-[320px] md:max-h-[320px] lg:aspect-[12/10]"),e.jsxs(e.Fragment,{children:[e.jsx(He,{currentTab:"Newsletter"}),e.jsx(Ke,{children:e.jsxs("div",{className:`grid grid-cols-1 gap-6 ${j&&i&&"lg:grid-cols-2"}`,children:[e.jsxs(Y,{className:j&&i?"lg:col-span-2":"",children:[e.jsxs(Q,{className:"hidden",children:[e.jsx(J,{children:"Newsletters"}),e.jsx(X,{children:"How did this post perform"})]}),I?e.jsx(_,{className:"h-[25vw] p-6",children:e.jsx(Ee,{})}):e.jsxs(_,{className:"p-0",children:[e.jsxs("div",{className:`grid ${A} items-stretch border-b`,children:[e.jsxs(B,{className:"group relative isolate grow p-3 md:px-6 md:py-5",children:[e.jsx(U,{onClick:()=>{const t=new URLSearchParams({filterParam:`emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:"View members →"}),e.jsxs(V,{onClick:()=>{const t=new URLSearchParams({filterParam:`emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:[e.jsx("div",{className:"ml-0.5 size-[9px] rounded-full bg-chart-purple !text-sm opacity-50 lg:text-base"}),"Sent"]}),e.jsx(O,{children:e.jsx(W,{className:"text-xl leading-none sm:text-2xl md:text-[2.6rem]",children:E(m.sent)})})]}),v&&e.jsxs(B,{className:"p-3 md:px-6 md:py-5",children:[e.jsx(U,{onClick:()=>{const t=new URLSearchParams({filterParam:`opened_emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:"View members →"}),e.jsxs(V,{onClick:()=>{const t=new URLSearchParams({filterParam:`opened_emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:[e.jsx("div",{className:"ml-0.5 size-[9px] rounded-full bg-chart-blue !text-sm opacity-50 lg:text-base"}),"Opened"]}),e.jsx(O,{children:e.jsx(W,{className:"text-xl leading-none sm:text-2xl md:text-[2.6rem]",children:E(m.opened)})})]}),i&&e.jsxs(B,{className:"group relative isolate grow p-3 md:px-6 md:py-5",children:[e.jsx(U,{onClick:()=>{const t=new URLSearchParams({filterParam:`clicked_links.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:"View members →"}),e.jsxs(V,{onClick:()=>{const t=new URLSearchParams({filterParam:`clicked_links.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:[e.jsx("div",{className:"ml-0.5 size-[9px] rounded-full bg-chart-teal !text-sm opacity-50 lg:text-base"}),"Clicked"]}),e.jsx(O,{children:e.jsx(W,{className:"text-xl leading-none sm:text-2xl md:text-[2.6rem]",children:E(m.clicked)})})]})]}),e.jsxs("div",{className:`$ mx-auto grid grid-cols-1 items-center justify-center gap-4 transition-all md:gap-0 ${A==="grid-cols-2"&&"md:grid-cols-2"} ${A==="grid-cols-3"&&"md:grid-cols-3"}`,children:[e.jsxs("div",{className:`relative border-r-0 px-6 ${(v||i)&&"md:border-r"}`,children:[e.jsx(H,{className:$,config:ve,data:ke,percentageLabel:"Sent",percentageValue:N(1),size:L,tooltip:!1}),(v||i)&&e.jsx(ae,{})]}),v&&e.jsxs("div",{className:`group/block relative border-r-0 px-6 transition-all hover:bg-muted/25 ${i&&"md:border-r"}`,children:[e.jsx(ie,{avgValue:N(P.openedRate),dataColor:"hsl(var(--chart-blue))",value:N(m.openedRate)}),e.jsx(H,{className:$,config:Ne,data:je,percentageLabel:"Open rate",percentageValue:N(m.openedRate),size:L,tooltip:!1}),i&&e.jsx(ae,{})]}),i&&e.jsxs("div",{className:"group/block relative px-6 transition-all hover:bg-muted/25",children:[e.jsx(ie,{avgValue:N(P.clickedRate),dataColor:"hsl(var(--chart-teal))",value:N(m.clickedRate)}),e.jsx(H,{className:$,config:Ce,data:we,percentageLabel:"Click rate",percentageValue:N(m.clickedRate),size:L,tooltip:!1})]})]})]})]}),j&&e.jsx(ps,{feedbackStats:p}),i&&e.jsxs(Y,{className:"group/datalist overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-6",children:[e.jsxs(Q,{className:"p-0",children:[e.jsx(J,{children:"Newsletter clicks"}),e.jsx(X,{children:"Which links resonated with your readers"})]}),e.jsx(ne,{className:"mr-2",children:"Members"})]}),I?e.jsxs(_,{className:"p-6 pt-0",children:[e.jsx(K,{}),e.jsx(le,{className:"mt-6"})]}):e.jsxs(_,{className:"pb-0",children:[e.jsx(K,{}),h.length>0?e.jsx(qe,{className:"",children:e.jsx(Ye,{children:ge?.map(t=>{const u=m.clicked>0?t.count/m.clicked:0,y=t.link.link_id,Z=t.link.title,Pe=t.link.to,ye=t.link.edited;return e.jsxs(Qe,{children:[a!==y&&e.jsx(Je,{style:{width:`${u?Math.round(u*100):0}%`}}),e.jsx(Xe,{className:"w-full",children:a===y?e.jsxs("div",{ref:f,className:"flex w-full items-center gap-2",children:[e.jsx(Me,{ref:n,className:"z-50 h-7 w-full border-border bg-background text-sm",value:o,onChange:Le=>g(Le.target.value)}),e.jsx(q,{size:"sm",onClick:b,children:"Update"})]}):e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"mr-2 shrink-0 bg-background",size:"sm",variant:"outline",onClick:()=>S(y),children:e.jsx(Ge,{})}),e.jsx("a",{className:"block truncate font-medium hover:underline",href:Pe,rel:"noreferrer",target:"_blank",title:Z,children:Z}),ye&&e.jsx("span",{className:"ml-1 text-gray-500",children:"(edited)"})]})}),e.jsxs(Ze,{children:[e.jsx(es,{children:E(t.count||0)}),e.jsx(ss,{children:N(u)})]})]},y)})})}):e.jsx("div",{className:"py-20 text-center text-sm text-gray-700",children:"You have no links in your post."})]}),!I&&h.length>1&&e.jsx(ce,{children:e.jsxs("div",{className:"flex w-full items-start justify-between gap-3",children:[e.jsxs("div",{className:"mt-2 flex items-start gap-2 pl-4 text-sm text-green",children:[e.jsx(Oe,{size:20,strokeWidth:1.5}),"Sent a broken link? You can update it!"]}),z>1&&e.jsx(de,{className:"pb-0",children:e.jsxs(me,{children:[e.jsx(pe,{disabled:!fe,onClick:he}),e.jsx(ue,{disabled:!be,onClick:xe})]})})]})})]})]})})]})};export{qs as default};
1
+ import{ae as Re,r,u as Se,aM as re,j as e,ai as N,aP as ne,aO as K,bP as le,cz as ee,bG as _e,bI as Fe,cA as Te,cB as Ae,cC as $e,B as q,aR as ze,aN as Ee,aj as E,cq as Me,C as De}from"./index-CJU9a2PB.js";import{C as Y,a as Q,b as J,h as X,c as _,i as ce}from"./pagemenu-aHubMPwB.js";import{u as oe,S as de,a as me,b as pe,c as ue}from"./use-simple-pagination-C9cb7dDz.js";import{T as Ie,a as Be,b as se}from"./tabs-BwQ-i6MY.js";import{e as Ue,f as Ve,g as Oe}from"./lucide-react-B7UnD_Dp.js";import{a as We,P as Ge}from"./wallet-cards-Do7nPf3f.js";import{K as B,d as U,a as V,b as O,c as W}from"./kpi-card-CHZSLw4p.js";import{P as He,a as Ke}from"./post-analytics-header-BjGFgN6A.js";import{D as qe,a as Ye,b as Qe,c as Je,d as Xe,e as Ze,f as es,g as ss}from"./data-list-yngXNZDF.js";import{a as ts,u as as,p as is,g as G,N as H}from"./links-BQHRbn46.js";import{u as rs}from"./post-analytics-context-C7oW3aBz.js";import{h as ns}from"./post-helpers-gInwAwEv.js";import{f as ls,g as cs}from"./stats-B1mhlQSp.js";import{g as te}from"./posts-BwP7BNcB.js";import"./index-6syrC9X1.js";import"./a-large-small-BPPu_Iy7.js";import"./at-sign-CYnGzOFc.js";import"./message-square-text-CS3iRuPc.js";import"./copy-DWiB-781.js";import"./hash-p9dv0yuc.js";import"./inbox-CRoP9sy5.js";import"./minus-emzwh6hq.js";import"./tags-DXDZbfxp.js";import"./square-DT1uWkxs.js";import"./user-round-check-D3ihrrKL.js";import"./repeat-ms5ocvE0.js";import"./reply-BvO85IDn.js";import"./sprout-C2R5CbXV.js";import"./trash-CZ3EXwTL.js";import"./post-share-modal-Su923uIc.js";import"./chart-CqJxisVP.js";import"./_baseAssignValue-hsL6ItjC.js";const os="FeedbackResponseType",ds=Re({dataType:os,path:s=>`/feedback/${s}/`}),ms=(s,a)=>{const{data:c,isLoading:o,error:g}=ds(s,{searchParams:{limit:"50",...a!==void 0?{score:a.toString()}:{}}});return{feedback:r.useMemo(()=>c?.feedback?c.feedback:[],[c]),isLoading:o,error:g}},ps=({feedbackStats:s})=>{const{postId:a}=Se(),c=re(),[o,g]=r.useState("positive"),n=9,f=o==="positive"?1:0,{feedback:F,isLoading:L}=ms(a||"",f),{totalPages:k,paginatedData:i,nextPage:v,previousPage:R,hasNextPage:C,hasPreviousPage:l}=oe({data:F,itemsPerPage:n}),x=L;return e.jsxs(Y,{children:[e.jsxs(Q,{className:"pb-5",children:[e.jsx(J,{children:"Feedback"}),e.jsx(X,{children:"What did your readers think?"})]}),s.totalFeedback>0?e.jsxs(_,{className:"pb-3",children:[e.jsxs("div",{className:"flex items-center justify-between gap-3",children:[e.jsx(Ie,{className:"pb-3",defaultValue:"positive",value:o,variant:"button",onValueChange:d=>g(d),children:e.jsxs(Be,{className:"gap-1",children:[e.jsx(se,{className:"h-7",value:"positive",children:e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(Ue,{size:14,strokeWidth:1.25}),e.jsx("span",{className:"hidden font-medium sm:!visible sm:!inline",children:"More like this"}),e.jsx("span",{className:"font-semibold tracking-tight",children:N(s.positiveFeedback/s.totalFeedback)})]})}),e.jsx(se,{className:"h-7",value:"negative",children:e.jsxs("div",{className:"flex items-center gap-1 text-xs",children:[e.jsx(Ve,{size:14,strokeWidth:1.25}),e.jsx("span",{className:"hidden font-medium sm:!visible sm:!inline",children:"Less like this"}),e.jsx("span",{className:"font-semibold tracking-tight",children:N(s.negativeFeedback/s.totalFeedback)})]})})]})}),e.jsx(ne,{className:"mb-3 mr-2 lg:hidden xl:!visible xl:!block",children:"Date"})]}),e.jsx(K,{}),x?e.jsx(le,{className:"mt-3",lines:3}):i&&i.length>0?e.jsx("div",{className:"flex w-full flex-col py-3",children:i.map(d=>e.jsxs("div",{className:"flex h-10 w-full items-center justify-between gap-3 rounded-sm border-none px-2 text-sm hover:cursor-pointer hover:bg-accent",onClick:()=>{c(`/members/${d.member.id}`,{crossApp:!0})},children:[e.jsxs("div",{className:"flex items-center gap-2 font-medium",children:[e.jsxs(_e,{className:"size-7",children:[d.member?.avatar_image&&e.jsx("img",{className:"absolute aspect-square size-full",src:d.member?.avatar_image}),e.jsx(Fe,{className:"text-white",style:{backgroundColor:`${Ae(ee(d.member),75,55)}`},children:Te(d.member)})]}),ee(d.member)]}),e.jsx("div",{className:"whitespace-nowrap text-muted-foreground",children:$e(d.created_at)})]},d.id))}):e.jsx("div",{className:"flex h-full items-center justify-center py-8 text-center text-sm text-muted-foreground",children:e.jsxs("div",{children:["No ",o==="positive"?"positive":"negative"," feedback yet"]})})]}):e.jsxs(_,{className:"flex grow flex-col items-center justify-center text-center text-sm text-muted-foreground",children:[e.jsx("div",{children:"No members have given feedback yet"}),e.jsx("div",{children:"When someone does, you'll see their response here."})]}),s.totalFeedback>0&&e.jsx(ce,{className:"grow-0",children:e.jsxs("div",{className:"flex w-full items-center justify-between gap-3",children:[e.jsxs(q,{variant:"outline",onClick:()=>{const d=`(feedback.post_id:'${a}'+feedback.score:1)`,m=`(feedback.post_id:'${a}'+feedback.score:0)`,P=`${encodeURIComponent(d)}&post=${a}`,h=`${encodeURIComponent(m)}&post=${a}`;c(`/members?filter=${o==="positive"?P:h}`,{crossApp:!0})},children:["View all",e.jsx(We,{})]}),k>1&&e.jsx(de,{className:"pb-0",children:e.jsxs(me,{children:[e.jsx(pe,{disabled:!l,onClick:R}),e.jsx(ue,{disabled:!C,onClick:v})]})})]})})]})},us=()=>{const{mutateAsync:s,isLoading:a}=ts();return{editLinks:s,isEditLinksLoading:a}},gs=s=>{const{data:a,isLoading:c}=te(s),{data:o,isLoading:g}=te(s,{searchParams:{include:"count.positive_feedback,count.negative_feedback"}}),n=r.useMemo(()=>a?.posts[0],[a]),f=r.useMemo(()=>o?.posts[0],[o]),F=r.useMemo(()=>n?{sent:n.email?.email_count||0,opened:n.email?.opened_count||0,clicked:n.count?.clicks||0,openedRate:n.email?.opened_count?n.email.opened_count/n.email.email_count:0,clickedRate:n.count?.clicks&&n.email?.email_count?n.count.clicks/n.email.email_count:0}:{sent:0,opened:0,clicked:0,openedRate:0,clickedRate:0},[n]),L=r.useMemo(()=>{if(!f?.count)return{positiveFeedback:0,negativeFeedback:0,totalFeedback:0};const p=f.count.positive_feedback||0,w=f.count.negative_feedback||0,j=p+w;return{positiveFeedback:p,negativeFeedback:w,totalFeedback:j}},[f]),k=r.useMemo(()=>n?.newsletter?.id,[n]),{data:i,isLoading:v}=ls({searchParams:k?{newsletter_id:k}:{},enabled:!!k}),R=r.useMemo(()=>i?.stats?i.stats.map(p=>p.post_id):[],[i]),{data:C,isLoading:l}=cs({searchParams:k&&R.length>0?{newsletter_id:k,post_ids:R.join(",")}:{},enabled:!!k&&R.length>0}),x=r.useMemo(()=>{if(!i?.stats)return;const p=i.stats,w=C?.stats||[],j=new Map;w.forEach(b=>{j.set(b.post_id,b)});const S=p.map(b=>{const z=j.get(b.post_id);return{...b,total_clicks:z?.total_clicks||0,click_rate:z?.click_rate||0}});return{...i,stats:S}},[i,C]),d=v||l,{data:m,isLoading:P,refetch:h}=as({searchParams:{filter:`post_id:'${s}'`}}),T=r.useMemo(()=>{if(!x||!x.stats)return{openRate:0,clickRate:0};const p=x.stats;if(p.length===0)return{openRate:0,clickRate:0};const w=p.reduce((S,b)=>S+(b.open_rate||0),0),j=p.reduce((S,b)=>S+(b.click_rate||0),0);return{openRate:Number((w/p.length).toFixed(2)),clickRate:Number((j/p.length).toFixed(2))}},[x]),M=r.useMemo(()=>is(m),[m]),D=r.useMemo(()=>({openedRate:T.openRate,clickedRate:T.clickRate}),[T]);return{post:n,stats:F,feedbackStats:L,averageStats:D,topLinks:M,refetchTopLinks:h,isLoading:c||g||d||P}},xs=({breakpoints:s={sm:1080,md:1280,lg:1360}}={})=>{const[a,c]=r.useState("md");return r.useEffect(()=>{const o=()=>{const g=window.innerWidth;g<s.sm?c("sm"):g<s.md?c("md"):c("lg")};return o(),window.addEventListener("resize",o),()=>window.removeEventListener("resize",o)},[s]),{chartSize:a,isSmall:a==="sm",isMedium:a==="md",isLarge:a==="lg"}},ae=()=>e.jsx("div",{className:"absolute -right-4 top-1/2 z-10 hidden size-8 -translate-y-1/2 items-center justify-center rounded-full border bg-background text-muted-foreground md:!visible md:!flex",children:e.jsx(De,{className:"ml-0.5",size:16,strokeWidth:1.5})}),ie=({dataColor:s,value:a,avgValue:c})=>e.jsxs("div",{className:"absolute left-1/2 top-6 z-50 flex w-[200px] -translate-x-1/2 flex-col items-stretch gap-1.5 rounded-md bg-background px-4 py-2 text-sm opacity-0 shadow-md transition-all group-hover/block:top-3 group-hover/block:opacity-100",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("div",{className:"size-2 rounded-full bg-chart-blue opacity-50",style:{backgroundColor:s}}),"This newsletter"]}),e.jsx("div",{className:"text-right font-mono",children:a})]}),e.jsxs("div",{className:"flex items-center justify-between gap-4",children:[e.jsxs("div",{className:"flex items-center gap-2 text-muted-foreground",children:[e.jsx("div",{className:"size-2 rounded-full bg-chart-gray opacity-80"}),"Average"]}),e.jsx("div",{className:"text-right font-mono",children:c})]})]}),qs=()=>{const s=re(),[a,c]=r.useState(null),[o,g]=r.useState(""),n=r.useRef(null),f=r.useRef(null),F=10,{chartSize:L}=xs(),{appSettings:k}=ze(),{emailTrackClicks:i,emailTrackOpens:v}=k?.analytics||{},{post:R,isPostLoading:C,postId:l}=rs(),x=R,d=ns(x);r.useEffect(()=>{!C&&!d&&s(`/posts/analytics/${l}`)},[s,l,C,d]);const{stats:m,averageStats:P,topLinks:h,isLoading:T,refetchTopLinks:M}=gs(l),{editLinks:D}=us(),p=r.useMemo(()=>{if(!x?.count)return{positiveFeedback:0,negativeFeedback:0,totalFeedback:0};const t=x.count.positive_feedback||0,u=x.count.negative_feedback||0,y=t+u;return{positiveFeedback:t,negativeFeedback:u,totalFeedback:y}},[x]),w=r.useMemo(()=>x?.newsletter?.feedback_enabled===!0,[x]),j=r.useMemo(()=>p.totalFeedback>0?!0:w,[p.totalFeedback,w]),S=t=>{const u=G(h,t);u&&(c(t),g(u.link.to))},b=()=>{if(!a)return;const t=G(h,a);if(!t)return;const u=o.trim();if(u===""||u===t.link.to){c(null),g("");return}D({originalUrl:t.link.originalTo,editedUrl:o,postId:l},{onSuccess:()=>{c(null),g(""),M()}})},{totalPages:z,paginatedData:ge,nextPage:xe,previousPage:he,hasNextPage:be,hasPreviousPage:fe}=oe({data:h,itemsPerPage:F});r.useEffect(()=>{if(a&&n.current){n.current.focus();const t=G(h,a),u=y=>{f.current&&!f.current.contains(y.target)&&o===t?.link.to&&(c(null),g(""))};return document.addEventListener("mousedown",u),()=>{document.removeEventListener("mousedown",u)}}},[a,o,h]);const I=T||C,ke=[{datatype:"Sent",value:1,fill:"url(#gradientPurple)",color:"hsl(var(--chart-purple))"}],ve={percentage:{label:"O"},Average:{label:"Average"},"This newsletter":{label:"This newsletter"}},je=[{datatype:"Average",value:P.openedRate,fill:"url(#gradientGray)",color:"hsl(var(--chart-gray))"},{datatype:"This newsletter",value:m.openedRate,fill:"url(#gradientBlue)",color:"hsl(var(--chart-blue))"}],Ne={percentage:{label:"Opened"},Average:{label:"Average"},"This newsletter":{label:"This newsletter"}},we=[{datatype:"Average",value:P.clickedRate,fill:"url(#gradientGray)",color:"hsl(var(--chart-gray))"},{datatype:"This newsletter",value:m.clickedRate,fill:"url(#gradientTeal)",color:"hsl(var(--chart-teal))"}],Ce={percentage:{label:"Clicked"},Average:{label:"Average"},"This newsletter":{label:"This newsletter"}};let A="grid-cols-3",$="aspect-[16/10] w-full max-w-[320px] sm:aspect-[2/1] md:aspect-[10/14] md:max-w-none lg:aspect-square";return(!i||!v)&&(A="grid-cols-2",$="aspect-[16/10] w-full max-w-[320px] sm:aspect-[2/1] md:aspect-square md:max-w-none lg:aspect-[15/10]"),!i&&!v&&(A="grid-cols-1",$="aspect-square w-full sm:aspect-[16/10] md:max-w-[320px] md:max-h-[320px] lg:aspect-[12/10]"),e.jsxs(e.Fragment,{children:[e.jsx(He,{currentTab:"Newsletter"}),e.jsx(Ke,{children:e.jsxs("div",{className:`grid grid-cols-1 gap-6 ${j&&i&&"lg:grid-cols-2"}`,children:[e.jsxs(Y,{className:j&&i?"lg:col-span-2":"",children:[e.jsxs(Q,{className:"hidden",children:[e.jsx(J,{children:"Newsletters"}),e.jsx(X,{children:"How did this post perform"})]}),I?e.jsx(_,{className:"h-[25vw] p-6",children:e.jsx(Ee,{})}):e.jsxs(_,{className:"p-0",children:[e.jsxs("div",{className:`grid ${A} items-stretch border-b`,children:[e.jsxs(B,{className:"group relative isolate grow p-3 md:px-6 md:py-5",children:[e.jsx(U,{onClick:()=>{const t=new URLSearchParams({filterParam:`emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:"View members →"}),e.jsxs(V,{onClick:()=>{const t=new URLSearchParams({filterParam:`emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:[e.jsx("div",{className:"ml-0.5 size-[9px] rounded-full bg-chart-purple !text-sm opacity-50 lg:text-base"}),"Sent"]}),e.jsx(O,{children:e.jsx(W,{className:"text-xl leading-none sm:text-2xl md:text-[2.6rem]",children:E(m.sent)})})]}),v&&e.jsxs(B,{className:"p-3 md:px-6 md:py-5",children:[e.jsx(U,{onClick:()=>{const t=new URLSearchParams({filterParam:`opened_emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:"View members →"}),e.jsxs(V,{onClick:()=>{const t=new URLSearchParams({filterParam:`opened_emails.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:[e.jsx("div",{className:"ml-0.5 size-[9px] rounded-full bg-chart-blue !text-sm opacity-50 lg:text-base"}),"Opened"]}),e.jsx(O,{children:e.jsx(W,{className:"text-xl leading-none sm:text-2xl md:text-[2.6rem]",children:E(m.opened)})})]}),i&&e.jsxs(B,{className:"group relative isolate grow p-3 md:px-6 md:py-5",children:[e.jsx(U,{onClick:()=>{const t=new URLSearchParams({filterParam:`clicked_links.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:"View members →"}),e.jsxs(V,{onClick:()=>{const t=new URLSearchParams({filterParam:`clicked_links.post_id:${l}`,postAnalytics:l});s(`/members?${t.toString()}`,{crossApp:!0})},children:[e.jsx("div",{className:"ml-0.5 size-[9px] rounded-full bg-chart-teal !text-sm opacity-50 lg:text-base"}),"Clicked"]}),e.jsx(O,{children:e.jsx(W,{className:"text-xl leading-none sm:text-2xl md:text-[2.6rem]",children:E(m.clicked)})})]})]}),e.jsxs("div",{className:`$ mx-auto grid grid-cols-1 items-center justify-center gap-4 transition-all md:gap-0 ${A==="grid-cols-2"&&"md:grid-cols-2"} ${A==="grid-cols-3"&&"md:grid-cols-3"}`,children:[e.jsxs("div",{className:`relative border-r-0 px-6 ${(v||i)&&"md:border-r"}`,children:[e.jsx(H,{className:$,config:ve,data:ke,percentageLabel:"Sent",percentageValue:N(1),size:L,tooltip:!1}),(v||i)&&e.jsx(ae,{})]}),v&&e.jsxs("div",{className:`group/block relative border-r-0 px-6 transition-all hover:bg-muted/25 ${i&&"md:border-r"}`,children:[e.jsx(ie,{avgValue:N(P.openedRate),dataColor:"hsl(var(--chart-blue))",value:N(m.openedRate)}),e.jsx(H,{className:$,config:Ne,data:je,percentageLabel:"Open rate",percentageValue:N(m.openedRate),size:L,tooltip:!1}),i&&e.jsx(ae,{})]}),i&&e.jsxs("div",{className:"group/block relative px-6 transition-all hover:bg-muted/25",children:[e.jsx(ie,{avgValue:N(P.clickedRate),dataColor:"hsl(var(--chart-teal))",value:N(m.clickedRate)}),e.jsx(H,{className:$,config:Ce,data:we,percentageLabel:"Click rate",percentageValue:N(m.clickedRate),size:L,tooltip:!1})]})]})]})]}),j&&e.jsx(ps,{feedbackStats:p}),i&&e.jsxs(Y,{className:"group/datalist overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-6",children:[e.jsxs(Q,{className:"p-0",children:[e.jsx(J,{children:"Newsletter clicks"}),e.jsx(X,{children:"Which links resonated with your readers"})]}),e.jsx(ne,{className:"mr-2",children:"Members"})]}),I?e.jsxs(_,{className:"p-6 pt-0",children:[e.jsx(K,{}),e.jsx(le,{className:"mt-6"})]}):e.jsxs(_,{className:"pb-0",children:[e.jsx(K,{}),h.length>0?e.jsx(qe,{className:"",children:e.jsx(Ye,{children:ge?.map(t=>{const u=m.clicked>0?t.count/m.clicked:0,y=t.link.link_id,Z=t.link.title,Pe=t.link.to,ye=t.link.edited;return e.jsxs(Qe,{children:[a!==y&&e.jsx(Je,{style:{width:`${u?Math.round(u*100):0}%`}}),e.jsx(Xe,{className:"w-full",children:a===y?e.jsxs("div",{ref:f,className:"flex w-full items-center gap-2",children:[e.jsx(Me,{ref:n,className:"z-50 h-7 w-full border-border bg-background text-sm",value:o,onChange:Le=>g(Le.target.value)}),e.jsx(q,{size:"sm",onClick:b,children:"Update"})]}):e.jsxs(e.Fragment,{children:[e.jsx(q,{className:"mr-2 shrink-0 bg-background",size:"sm",variant:"outline",onClick:()=>S(y),children:e.jsx(Ge,{})}),e.jsx("a",{className:"block truncate font-medium hover:underline",href:Pe,rel:"noreferrer",target:"_blank",title:Z,children:Z}),ye&&e.jsx("span",{className:"ml-1 text-gray-500",children:"(edited)"})]})}),e.jsxs(Ze,{children:[e.jsx(es,{children:E(t.count||0)}),e.jsx(ss,{children:N(u)})]})]},y)})})}):e.jsx("div",{className:"py-20 text-center text-sm text-gray-700",children:"You have no links in your post."})]}),!I&&h.length>1&&e.jsx(ce,{children:e.jsxs("div",{className:"flex w-full items-start justify-between gap-3",children:[e.jsxs("div",{className:"mt-2 flex items-start gap-2 pl-4 text-sm text-green",children:[e.jsx(Oe,{size:20,strokeWidth:1.5}),"Sent a broken link? You can update it!"]}),z>1&&e.jsx(de,{className:"pb-0",children:e.jsxs(me,{children:[e.jsx(pe,{disabled:!fe,onClick:he}),e.jsx(ue,{disabled:!be,onClick:xe})]})})]})})]})]})})]})};export{qs as default};
@@ -1 +1 @@
1
- import{ak as p,ad as n,al as u,am as i}from"./index-BYawr8p9.js";const a="NewslettersResponseType",d=a,l=p({dataType:a,path:"/newsletters/",defaultSearchParams:{include:"count.active_members,count.posts",limit:"50"},defaultNextPageParams:(e,t)=>{var s;return{...t,page:(((s=e.meta)==null?void 0:s.pagination.next)||1).toString()}},returnData:e=>{const{pages:t}=e,s=t.flatMap(o=>o.newsletters),r=t[t.length-1].meta;return{newsletters:s,meta:r,isEnd:r?r.pagination.pages===r.pagination.page:!0}}}),m=n({method:"POST",path:()=>"/newsletters/",body:({opt_in_existing:e,...t})=>({newsletters:[t]}),searchParams:e=>({opt_in_existing:e.opt_in_existing.toString(),include:"count.active_members,count.posts"}),updateQueries:{dataType:a,emberUpdateType:"createOrUpdate",update:u("newsletters")}}),w=n({method:"PUT",path:e=>`/newsletters/${e.id}/`,body:e=>({newsletters:[e]}),defaultSearchParams:{include:"count.active_members,count.posts"},updateQueries:{dataType:a,emberUpdateType:"createOrUpdate",update:i("newsletters")}}),g=n({method:"PUT",path:()=>"/newsletters/verifications/",body:({token:e})=>({token:e}),defaultSearchParams:{include:"count.active_members,count.posts"},updateQueries:{dataType:a,emberUpdateType:"createOrUpdate",update:i("newsletters")}});export{m as a,w as b,g as c,d as n,l as u};
1
+ import{ak as p,ad as n,al as u,am as i}from"./index-CJU9a2PB.js";const a="NewslettersResponseType",d=a,l=p({dataType:a,path:"/newsletters/",defaultSearchParams:{include:"count.active_members,count.posts",limit:"50"},defaultNextPageParams:(e,t)=>{var s;return{...t,page:(((s=e.meta)==null?void 0:s.pagination.next)||1).toString()}},returnData:e=>{const{pages:t}=e,s=t.flatMap(o=>o.newsletters),r=t[t.length-1].meta;return{newsletters:s,meta:r,isEnd:r?r.pagination.pages===r.pagination.page:!0}}}),m=n({method:"POST",path:()=>"/newsletters/",body:({opt_in_existing:e,...t})=>({newsletters:[t]}),searchParams:e=>({opt_in_existing:e.opt_in_existing.toString(),include:"count.active_members,count.posts"}),updateQueries:{dataType:a,emberUpdateType:"createOrUpdate",update:u("newsletters")}}),w=n({method:"PUT",path:e=>`/newsletters/${e.id}/`,body:e=>({newsletters:[e]}),defaultSearchParams:{include:"count.active_members,count.posts"},updateQueries:{dataType:a,emberUpdateType:"createOrUpdate",update:i("newsletters")}}),g=n({method:"PUT",path:()=>"/newsletters/verifications/",body:({token:e})=>({token:e}),defaultSearchParams:{include:"count.active_members,count.posts"},updateQueries:{dataType:a,emberUpdateType:"createOrUpdate",update:i("newsletters")}});export{m as a,w as b,g as c,d as n,l as u};
@@ -1 +1 @@
1
- import{u as Z,a as _,r as a,b as G,j as e,L as N,S as r,E as ee,c as te,P as se,A as ne,g as ae,d as oe,h as le,F as j,e as ce,i as y,f as ie}from"./index-BYawr8p9.js";import{u as re,D as de,A as ue,S as A}from"./deleted-feed-item-CmNbSYiO.js";import{H as xe}from"./hash-CdH0ikFp.js";import"./trash-BglGemAb.js";const C=()=>e.jsx("div",{className:"h-px w-full bg-gray-200 dark:bg-gray-950"}),Ce=()=>{const{postId:$}=Z(),{canGoBack:R}=_(),[U,z]=a.useState(new Set),[B,T]=a.useState(new Set),[k,S]=a.useState(new Set),[p,P]=a.useState(!1),H=a.useRef(null),w=a.useRef(null),d=a.useRef(null),v=a.useRef(null),m=G(),{threadParents:u,post:n,processedReplies:E,isLoading:I,loadMoreChildren:D,loadMoreChildReplies:F,hasMoreChildren:b,hasMoreChildReplies:f}=re(decodeURIComponent($??""),{includeAncestors:!0}),o=n?.object,V=o?.replyCount??0,[L,q]=a.useState(!1);if(a.useEffect(()=>{w.current&&u.length>0&&!L&&(w.current.scrollIntoView({behavior:"instant",block:"start"}),q(!0))},[u,L]),a.useEffect(()=>{d.current&&d.current.disconnect();const t=document.querySelector("[data-scrollable-container]");if(t)return d.current=new IntersectionObserver(async l=>{if(l[0].isIntersecting&&b&&!p){P(!0);try{await D()}catch(s){console.error("Failed to load more top-level replies:",s)}finally{P(!1)}}},{root:t,rootMargin:"200px"}),v.current&&d.current.observe(v.current),()=>{d.current&&d.current.disconnect()}},[b,p,D]),I)return e.jsx(N,{children:e.jsxs("div",{className:"mx-auto flex max-w-[620px] flex-col items-center gap-3 pt-9 lg:px-8",children:[e.jsxs("div",{className:"flex w-full items-center gap-3",children:[e.jsx(r,{className:"size-10 rounded-full"}),e.jsxs("div",{className:"grow pt-1",children:[e.jsx(r,{className:"w-24"}),e.jsx(r,{className:"w-3/5"})]})]}),e.jsxs("div",{className:"mb-7 w-full",children:[e.jsx(r,{}),e.jsx(r,{className:"w-4/5"}),e.jsx(r,{})]}),e.jsx(C,{}),e.jsxs("div",{className:"flex w-full items-center gap-3 py-3",children:[e.jsx(r,{className:"block size-full",containerClassName:"size-10 rounded-full overflow-hidden"}),e.jsxs("div",{children:[e.jsx(r,{className:"w-52"}),e.jsx(r,{className:"w-28"})]})]}),e.jsx(C,{})]})});if(!n)return e.jsx(N,{children:e.jsx("div",{className:"mx-auto mt-4 flex w-full max-w-[620px] flex-col items-center",children:e.jsxs(ee,{children:[e.jsx(te,{children:e.jsx(xe,{})}),e.jsx("div",{children:"Error loading note."})]})})});function g(){}function O(t){z(l=>{const s=new Set(l);return s.has(t)?s.delete(t):(s.add(t),T(c=>{const x=new Set(c);return x.add(t),x})),s})}async function W(t,l){if(!k.has(t)){S(s=>new Set(s).add(t));try{F&&await F(l)}catch(s){console.error("Failed to load more replies for chain:",s)}finally{S(s=>{const c=new Set(s);return c.delete(t),c})}}}return e.jsx(N,{children:e.jsx("div",{className:"mx-auto flex h-full max-w-[620px] flex-col",children:e.jsx("div",{className:"relative flex-1",children:e.jsx("div",{className:"grow overflow-y-auto",children:e.jsxs("div",{className:"mx-auto px-8 pb-10 pt-5 max-lg:px-0",children:[!u.length&&e.jsx(se,{actor:n.actor,isCurrentUser:n.object.authored,children:e.jsxs("div",{className:`col-[2/3] mx-auto flex w-full cursor-pointer items-center gap-3 ${R?"pt-10 max-md:pt-5":"pt-5"}`,children:[e.jsx("div",{className:"relative z-10",children:e.jsx(ne,{author:n.actor,showFollowButton:!n.object.authored&&!n.actor.followedByMe})}),e.jsxs("div",{className:"relative z-10 flex w-full min-w-0 cursor-pointer flex-col overflow-visible text-[1.5rem]",onClick:t=>{le(n.actor,m,t)},children:[e.jsx("div",{className:"flex w-full",children:e.jsx("span",{className:"min-w-0 truncate whitespace-nowrap font-semibold hover:underline",children:n.actor.name})}),e.jsxs("div",{className:"flex w-full",children:[e.jsx("span",{className:'truncate text-gray-700 after:mx-1 after:font-normal after:text-gray-700 after:content-["·"]',children:ae(n.actor)}),e.jsx("span",{className:"text-gray-700",children:oe(o,!o.authored)})]})]})]})}),u.map(t=>t.object.type==="Tombstone"?e.jsx(de,{last:!1}):e.jsx(j,{actor:t.actor,allowDelete:!1,commentCount:t.object.replyCount??0,last:!1,layout:"reply",likeCount:t.object.likeCount??0,object:t.object,repostCount:t.object.repostCount??0,type:"Note",onClick:()=>{m(`/${t.object.type==="Article"?"reader":"notes"}/${encodeURIComponent(t.object.id)}`)}})),e.jsx("div",{ref:w,className:`${R?"scroll-mt-[12px]":"scroll-mt-[124px]"}`,children:e.jsxs("div",{className:`${u.length>0&&"min-h-[calc(100vh-52px)]"}`,children:[e.jsx(j,{actor:n.actor,allowDelete:!1,commentCount:V,last:!0,layout:"modal",likeCount:o.likeCount??0,object:o,repostCount:o.repostCount,showHeader:u.length>0,showStats:!0,type:"Note"}),e.jsx(ue,{object:o}),e.jsx(C,{}),e.jsxs("div",{ref:H,children:[E.map((t,l)=>{const s=l===E.length-1,c=t.mainReply.id,x=U.has(c),J=B.has(c),K=k.has(c),h=t.chain.length>0;return e.jsxs(ce.Fragment,{children:[e.jsx(j,{actor:t.mainReply.actor,allowDelete:t.mainReply.object.authored,commentCount:t.mainReply.object.replyCount??0,isChainParent:h,isPending:y(t.mainReply.id),last:!h,layout:"reply",likeCount:t.mainReply.object.likeCount??0,object:t.mainReply.object,parentId:o.id,repostCount:t.mainReply.object.repostCount??0,type:"Note",onClick:()=>{m(`/notes/${encodeURIComponent(t.mainReply.id)}`)},onDelete:g}),h&&t.chain[0]&&e.jsx(j,{actor:t.chain[0].actor,allowDelete:t.chain[0].object.authored,commentCount:t.chain[0].object.replyCount??0,isChainContinuation:!0,isPending:y(t.chain[0].id),last:t.chain.length===1,layout:"reply",likeCount:t.chain[0].object.likeCount??0,object:t.chain[0].object,parentId:o.id,repostCount:t.chain[0].object.repostCount??0,type:"Note",onClick:()=>{m(`/notes/${encodeURIComponent(t.chain[0].id)}`)},onDelete:g},t.chain[0].id),h&&x&&t.chain.slice(1).map((i,Q)=>{const M=Q===t.chain.slice(1).length-1,X=f&&f(l),Y=M&&X;return e.jsx(j,{actor:i.actor,allowDelete:i.object.authored,commentCount:i.object.replyCount??0,isChainContinuation:!0,isPending:y(i.id),last:M&&!Y,layout:"reply",likeCount:i.object.likeCount??0,object:i.object,parentId:o.id,repostCount:i.object.repostCount??0,type:"Note",onClick:()=>{m(`/notes/${encodeURIComponent(i.id)}`)},onDelete:g},i.id)}),h&&t.chain.length>1&&!x&&e.jsx(A,{variant:"expand",onClick:()=>O(c)}),h&&x&&J&&f&&f(l)&&e.jsx(A,{loading:K,variant:"loadMore",onClick:()=>W(c,l)}),!s&&e.jsx(C,{})]},t.mainReply.id)}),p&&e.jsx("div",{className:"flex flex-col items-center justify-center text-center",children:e.jsx(ie,{size:"md"})})]}),b&&e.jsx("div",{ref:v,className:"h-1"})]})})]})})})})})};export{Ce as default};
1
+ import{u as Z,a as _,r as a,b as G,j as e,L as N,S as r,E as ee,c as te,P as se,A as ne,g as ae,d as oe,h as le,F as j,e as ce,i as y,f as ie}from"./index-CJU9a2PB.js";import{u as re,D as de,A as ue,S as A}from"./deleted-feed-item-C0FcyLMN.js";import{H as xe}from"./hash-p9dv0yuc.js";import"./trash-CZ3EXwTL.js";const C=()=>e.jsx("div",{className:"h-px w-full bg-gray-200 dark:bg-gray-950"}),Ce=()=>{const{postId:$}=Z(),{canGoBack:R}=_(),[U,z]=a.useState(new Set),[B,T]=a.useState(new Set),[k,S]=a.useState(new Set),[p,P]=a.useState(!1),H=a.useRef(null),w=a.useRef(null),d=a.useRef(null),v=a.useRef(null),m=G(),{threadParents:u,post:n,processedReplies:E,isLoading:I,loadMoreChildren:D,loadMoreChildReplies:F,hasMoreChildren:b,hasMoreChildReplies:f}=re(decodeURIComponent($??""),{includeAncestors:!0}),o=n?.object,V=o?.replyCount??0,[L,q]=a.useState(!1);if(a.useEffect(()=>{w.current&&u.length>0&&!L&&(w.current.scrollIntoView({behavior:"instant",block:"start"}),q(!0))},[u,L]),a.useEffect(()=>{d.current&&d.current.disconnect();const t=document.querySelector("[data-scrollable-container]");if(t)return d.current=new IntersectionObserver(async l=>{if(l[0].isIntersecting&&b&&!p){P(!0);try{await D()}catch(s){console.error("Failed to load more top-level replies:",s)}finally{P(!1)}}},{root:t,rootMargin:"200px"}),v.current&&d.current.observe(v.current),()=>{d.current&&d.current.disconnect()}},[b,p,D]),I)return e.jsx(N,{children:e.jsxs("div",{className:"mx-auto flex max-w-[620px] flex-col items-center gap-3 pt-9 lg:px-8",children:[e.jsxs("div",{className:"flex w-full items-center gap-3",children:[e.jsx(r,{className:"size-10 rounded-full"}),e.jsxs("div",{className:"grow pt-1",children:[e.jsx(r,{className:"w-24"}),e.jsx(r,{className:"w-3/5"})]})]}),e.jsxs("div",{className:"mb-7 w-full",children:[e.jsx(r,{}),e.jsx(r,{className:"w-4/5"}),e.jsx(r,{})]}),e.jsx(C,{}),e.jsxs("div",{className:"flex w-full items-center gap-3 py-3",children:[e.jsx(r,{className:"block size-full",containerClassName:"size-10 rounded-full overflow-hidden"}),e.jsxs("div",{children:[e.jsx(r,{className:"w-52"}),e.jsx(r,{className:"w-28"})]})]}),e.jsx(C,{})]})});if(!n)return e.jsx(N,{children:e.jsx("div",{className:"mx-auto mt-4 flex w-full max-w-[620px] flex-col items-center",children:e.jsxs(ee,{children:[e.jsx(te,{children:e.jsx(xe,{})}),e.jsx("div",{children:"Error loading note."})]})})});function g(){}function O(t){z(l=>{const s=new Set(l);return s.has(t)?s.delete(t):(s.add(t),T(c=>{const x=new Set(c);return x.add(t),x})),s})}async function W(t,l){if(!k.has(t)){S(s=>new Set(s).add(t));try{F&&await F(l)}catch(s){console.error("Failed to load more replies for chain:",s)}finally{S(s=>{const c=new Set(s);return c.delete(t),c})}}}return e.jsx(N,{children:e.jsx("div",{className:"mx-auto flex h-full max-w-[620px] flex-col",children:e.jsx("div",{className:"relative flex-1",children:e.jsx("div",{className:"grow overflow-y-auto",children:e.jsxs("div",{className:"mx-auto px-8 pb-10 pt-5 max-lg:px-0",children:[!u.length&&e.jsx(se,{actor:n.actor,isCurrentUser:n.object.authored,children:e.jsxs("div",{className:`col-[2/3] mx-auto flex w-full cursor-pointer items-center gap-3 ${R?"pt-10 max-md:pt-5":"pt-5"}`,children:[e.jsx("div",{className:"relative z-10",children:e.jsx(ne,{author:n.actor,showFollowButton:!n.object.authored&&!n.actor.followedByMe})}),e.jsxs("div",{className:"relative z-10 flex w-full min-w-0 cursor-pointer flex-col overflow-visible text-[1.5rem]",onClick:t=>{le(n.actor,m,t)},children:[e.jsx("div",{className:"flex w-full",children:e.jsx("span",{className:"min-w-0 truncate whitespace-nowrap font-semibold hover:underline",children:n.actor.name})}),e.jsxs("div",{className:"flex w-full",children:[e.jsx("span",{className:'truncate text-gray-700 after:mx-1 after:font-normal after:text-gray-700 after:content-["·"]',children:ae(n.actor)}),e.jsx("span",{className:"text-gray-700",children:oe(o,!o.authored)})]})]})]})}),u.map(t=>t.object.type==="Tombstone"?e.jsx(de,{last:!1}):e.jsx(j,{actor:t.actor,allowDelete:!1,commentCount:t.object.replyCount??0,last:!1,layout:"reply",likeCount:t.object.likeCount??0,object:t.object,repostCount:t.object.repostCount??0,type:"Note",onClick:()=>{m(`/${t.object.type==="Article"?"reader":"notes"}/${encodeURIComponent(t.object.id)}`)}})),e.jsx("div",{ref:w,className:`${R?"scroll-mt-[12px]":"scroll-mt-[124px]"}`,children:e.jsxs("div",{className:`${u.length>0&&"min-h-[calc(100vh-52px)]"}`,children:[e.jsx(j,{actor:n.actor,allowDelete:!1,commentCount:V,last:!0,layout:"modal",likeCount:o.likeCount??0,object:o,repostCount:o.repostCount,showHeader:u.length>0,showStats:!0,type:"Note"}),e.jsx(ue,{object:o}),e.jsx(C,{}),e.jsxs("div",{ref:H,children:[E.map((t,l)=>{const s=l===E.length-1,c=t.mainReply.id,x=U.has(c),J=B.has(c),K=k.has(c),h=t.chain.length>0;return e.jsxs(ce.Fragment,{children:[e.jsx(j,{actor:t.mainReply.actor,allowDelete:t.mainReply.object.authored,commentCount:t.mainReply.object.replyCount??0,isChainParent:h,isPending:y(t.mainReply.id),last:!h,layout:"reply",likeCount:t.mainReply.object.likeCount??0,object:t.mainReply.object,parentId:o.id,repostCount:t.mainReply.object.repostCount??0,type:"Note",onClick:()=>{m(`/notes/${encodeURIComponent(t.mainReply.id)}`)},onDelete:g}),h&&t.chain[0]&&e.jsx(j,{actor:t.chain[0].actor,allowDelete:t.chain[0].object.authored,commentCount:t.chain[0].object.replyCount??0,isChainContinuation:!0,isPending:y(t.chain[0].id),last:t.chain.length===1,layout:"reply",likeCount:t.chain[0].object.likeCount??0,object:t.chain[0].object,parentId:o.id,repostCount:t.chain[0].object.repostCount??0,type:"Note",onClick:()=>{m(`/notes/${encodeURIComponent(t.chain[0].id)}`)},onDelete:g},t.chain[0].id),h&&x&&t.chain.slice(1).map((i,Q)=>{const M=Q===t.chain.slice(1).length-1,X=f&&f(l),Y=M&&X;return e.jsx(j,{actor:i.actor,allowDelete:i.object.authored,commentCount:i.object.replyCount??0,isChainContinuation:!0,isPending:y(i.id),last:M&&!Y,layout:"reply",likeCount:i.object.likeCount??0,object:i.object,parentId:o.id,repostCount:i.object.repostCount??0,type:"Note",onClick:()=>{m(`/notes/${encodeURIComponent(i.id)}`)},onDelete:g},i.id)}),h&&t.chain.length>1&&!x&&e.jsx(A,{variant:"expand",onClick:()=>O(c)}),h&&x&&J&&f&&f(l)&&e.jsx(A,{loading:K,variant:"loadMore",onClick:()=>W(c,l)}),!s&&e.jsx(C,{})]},t.mainReply.id)}),p&&e.jsx("div",{className:"flex flex-col items-center justify-center text-center",children:e.jsx(ie,{size:"md"})})]}),b&&e.jsx("div",{ref:v,className:"h-1"})]})})]})})})})})};export{Ce as default};
@@ -1 +1 @@
1
- import{u as U,aM as D,r as h,j as e,B as I,aN as M,ai as y,aO as _,aP as Y,ab as te,aj as f,aQ as H,aR as re,aS as ie,af as le,ag as F,aT as oe,S as q}from"./index-BYawr8p9.js";import{K as w,a as k,b as C,c as L}from"./kpi-card-cv8roErt.js";import{C as A,a as O,b as P,c as N,K as S,d as T,e as R,u as Q}from"./pagemenu-BMXHDXYy.js";import{D as ne,a as ce,b as de,c as me,d as pe,e as he,f as xe,g as ue}from"./data-list-Bw1CQEZ9.js";import{u as ge,p as je,N as fe,c as ve}from"./links-08beB3Ij.js";import{M as be}from"./wallet-cards-KaTkgqvi.js";import{P as Ne,a as ye}from"./post-analytics-header-DXfc4KeX.js";import{S as we,K as ke}from"./kpis-Dt4OFY3L.js";import{E as Ce}from"./empty-indicator-DBrIZcFq.js";import{G as Le}from"./gh-chart-BV97-O7c.js";import{u as J,S as _e}from"./post-analytics-context-geHk7rOj.js";import{u as Se,c as Te}from"./growth-njR0GqK2.js";import{h as Re,i as De}from"./post-helpers-gInwAwEv.js";import{S as Ie}from"./sprout-BW9HFVU8.js";import"./chart-DGA1MaFs.js";import"./_baseAssignValue-BX8EallQ.js";import"./post-share-modal-Dql4fYjR.js";import"./posts-Bsvw11Zo.js";import"./trash-BglGemAb.js";import"./source-icon-C2iFWMlV.js";import"./source-utils-B1S3ZHA2.js";import"./lucide-react-DKlmxVQI.js";import"./a-large-small-CKZJgscl.js";import"./at-sign-CqQzllfI.js";import"./message-square-text-CaMVBVPr.js";import"./copy-BFuV16bY.js";import"./hash-CdH0ikFp.js";import"./inbox-Bd0uf1Ez.js";import"./minus-2XwCoFJV.js";import"./tags-BL_N4nn2.js";import"./square-BCNGSZhW.js";import"./user-round-check-BjHbfXKY.js";import"./repeat-COP-3g8d.js";import"./reply-JE8tmvOn.js";import"./tabs-C2sFfNcp.js";import"./index-Kji6JKl7.js";import"./table-DeBuf80X.js";import"./currency-fEUUCkj0.js";import"./stats-r0Bphuvi.js";const Me=({post:o,isNewsletterStatsLoading:n,isWebShown:x})=>{const{postId:s}=U(),a=D(),t=h.useMemo(()=>{const l=o.email?.opened_count||0,r=o.email?.email_count||0,p=o.count?.clicks||0;return{opened:l,clicked:p,openedRate:r>0?l/r:0,clickedRate:r>0?p/r:0,sent:r}},[o]),{data:m}=ge({searchParams:{filter:`post_id:'${s}'`}}),u=h.useMemo(()=>je(m),[m]),g=[{datatype:"Clicked",value:t.clickedRate,fill:"url(#gradientTeal)",color:"hsl(var(--chart-teal))"},{datatype:"Opened",value:t.openedRate,fill:"url(#gradientBlue)",color:"hsl(var(--chart-blue))"}],c={percentage:{label:"Opened"},Average:{label:"Clicked"},"This newsletter":{label:"Opened"}},i=o.email_only||!x;return e.jsxs(A,{className:`group/datalist overflow-hidden ${i&&"col-span-2"}`,children:[e.jsxs("div",{className:"relative flex items-center justify-between gap-6",children:[e.jsx(O,{children:e.jsxs(P,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(be,{size:16,strokeWidth:1.5}),"Newsletter performance"]})}),e.jsx(I,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100",size:"sm",variant:"outline",onClick:()=>{a(`/posts/analytics/${s}/newsletter`)},children:"View more"})]}),n?e.jsx(N,{children:e.jsx("div",{className:"mx-auto flex min-h-[250px] items-center justify-center xl:size-full",children:e.jsx(M,{})})}):e.jsxs(N,{className:`${i&&"grid grid-cols-2"}`,children:[e.jsxs("div",{className:`${i&&"border-r pr-6"}`,children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsx(S,{className:"group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0",children:e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsx(T,{color:"hsl(var(--chart-blue))",children:"Open rate"}),e.jsx(R,{value:y(t.openedRate)})]})}),e.jsx(S,{className:"group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0",children:e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsx(T,{color:"hsl(var(--chart-teal))",children:"Click rate"}),e.jsx(R,{value:y(t.clickedRate)})]})})]}),!i&&e.jsx(_,{}),e.jsx("div",{className:"mx-auto my-6 h-[240px]",children:e.jsx(fe,{className:"pointer-events-none aspect-square h-[240px]",config:c,data:g,tooltip:!1})})]}),e.jsxs("div",{className:`${i&&"pl-6"}`,children:[!i&&e.jsx(_,{}),e.jsxs("div",{className:i?"":"pt-3",children:[e.jsxs("div",{className:`flex items-center justify-between gap-3 ${i?"pb-3":"py-3"}`,children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Top clicked links in this email"}),e.jsx(Y,{children:"Members"})]}),u.length>0?e.jsx(ne,{className:"",children:e.jsx(ce,{children:u.slice(0,i?10:5).map(l=>{const r=t.clicked>0?l.count/t.clicked:0;return e.jsxs(de,{children:[e.jsx(me,{style:{width:`${r?Math.round(r*100):0}%`}}),e.jsx(pe,{children:e.jsxs("div",{className:"flex items-center space-x-2 overflow-hidden",children:[e.jsx(te,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),e.jsx("a",{className:"block truncate font-medium hover:underline",href:l.link.to,rel:"noreferrer",target:"_blank",title:l.link.to,children:ve(l.link.to,!0)})]})}),e.jsxs(he,{children:[e.jsx(xe,{children:f(l.count||0)}),e.jsx(ue,{children:y(r)})]})]},l.link.link_id)})})}):e.jsx("div",{className:"py-20 text-center text-sm text-gray-700",children:"You have no links in your post."})]})]})]})]})},Ae=({chartData:o,range:n,isLoading:x,visitors:s,sourcesData:a,isNewsletterShown:t=!0})=>{const{postId:m}=U(),u=D(),{data:g}=J(),c=g?.url,i=g?.icon,l=h.useMemo(()=>a?a.reduce((r,p)=>r+Number(p.visits||0),0):0,[a]);return e.jsx(e.Fragment,{children:e.jsxs(A,{className:`group/datalist overflow-hidden ${!t&&"col-span-2"}`,"data-testid":"web-performance",children:[e.jsxs("div",{className:"relative flex items-center justify-between gap-6",children:[e.jsx(O,{children:e.jsxs(P,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(H,{size:16,strokeWidth:1.5}),"Web performance"]})}),e.jsx(I,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100",size:"sm",variant:"outline",onClick:()=>{u(`/posts/analytics/${m}/web`)},children:"View more"})]}),e.jsxs(N,{children:[e.jsxs("div",{children:[e.jsx(S,{className:"group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0","data-testid":"unique-visitors",children:e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsx(T,{color:"hsl(var(--chart-blue))",children:"Unique visitors"}),e.jsx(R,{value:f(s)})]})}),e.jsx(_,{}),e.jsx("div",{className:"max-h-[288px] py-6 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500",children:x?e.jsx("div",{className:"flex h-[16vw] min-h-[240px] items-center justify-center",children:e.jsx(M,{})}):e.jsx(Le,{className:"aspect-auto h-[240px] w-full",color:"hsl(var(--chart-blue))",data:o||[],id:"visitors",range:n,syncId:"overview-charts"})})]}),t&&e.jsxs("div",{className:t?"border-t pt-3":"-mt-3",children:[e.jsx("div",{children:e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"How readers found this post"}),e.jsx(Y,{children:"Visitors"})]})}),a&&a.length>0?e.jsx(we,{data:a,range:n,siteIcon:i,siteUrl:c,tableOnly:!0,topSourcesLimit:5,totalVisitors:l}):e.jsx(Ce,{className:"h-full py-10",description:"Once someone visits this post, sources will show here",title:"No visitors since you published this post",children:e.jsx(H,{strokeWidth:1.5})})]})]})]})})},bs=()=>{const o=D(),{statsConfig:n,isLoading:x,post:s,isPostLoading:a,postId:t}=J(),{totals:m,isLoading:u,currencySymbol:g}=Se(t),{appSettings:c}=re(),{emailTrackClicks:i,emailTrackOpens:l}=c?.analytics||{},r=h.useMemo(()=>s?.published_at?ie(s.published_at):_e.ALL_TIME.value,[s?.published_at]),{startDate:p,endDate:E,timezone:K}=le(r),V=h.useMemo(()=>{const d={site_uuid:n?.id||"",date_from:F(p),date_to:F(E),timezone:K,post_uuid:""};return!a&&s?.uuid?{...d,post_uuid:s.uuid}:d},[a,s,n?.id,p,E,K]),{data:v,loading:z}=Q({endpoint:"api_kpis",statsConfig:n||{id:""},params:V}),X=h.useMemo(()=>v?.length?v.reduce((d,j)=>{const G=Number(j.visits);return d+(isNaN(G)?0:G)},0):0,[v]),b=ke.visits,Z=oe(v||[],r,b.dataKey,"sum")?.map(d=>{const j=Number(d[b.dataKey]);return{date:String(d.date),value:j,formattedValue:b.formatter(j),label:b.label}}),{data:ee,loading:se}=Q({endpoint:"api_top_sources",statsConfig:n||{id:""},params:V}),$=x||u||a||z,ae=a||x||z,W=Re(s)&&l&&i,B=!s?.email_only&&c?.analytics.webAnalytics;return h.useEffect(()=>{!a&&s&&De(s)&&!c?.analytics.webAnalytics&&o(`/posts/analytics/${t}/growth`)},[a,s,c?.analytics.webAnalytics,o,t]),a?e.jsx(M,{}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{currentTab:"Overview"}),e.jsx(ye,{children:e.jsxs("div",{className:"flex flex-col gap-6 lg:grid lg:grid-cols-2",children:[B&&e.jsx(Ae,{chartData:Z,isLoading:ae||$||se,isNewsletterShown:W,range:r,sourcesData:ee,visitors:X}),W&&e.jsx(Me,{isNewsletterStatsLoading:a,isWebShown:B,post:s}),e.jsxs(A,{className:"group col-span-2 overflow-hidden p-0","data-testid":"growth",children:[e.jsxs("div",{className:"relative flex items-center justify-between gap-6",children:[e.jsx(O,{children:e.jsxs(P,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(Ie,{size:16,strokeWidth:1.5}),"Growth"]})}),e.jsx(I,{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:()=>{o(`/posts/analytics/${t}/growth`)},children:"View more"})]}),e.jsx(N,{className:"flex flex-col gap-6 px-0 md:grid md:grid-cols-3 md:items-stretch md:gap-0",children:$?Array.from({length:3},(d,j)=>e.jsxs("div",{className:"h-[98px] gap-1 border-r px-6 py-5 last:border-r-0",children:[e.jsx(q,{className:"w-2/3"}),e.jsx(q,{className:"h-7 w-12"})]},j)):e.jsxs(e.Fragment,{children:[e.jsxs(w,{className:"grow gap-1 py-0",children:[e.jsx(k,{children:"Free members"}),e.jsx(C,{children:e.jsx(L,{className:"text-[2.2rem]",children:f(m?.free_members||0)})})]}),c?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs(w,{className:"grow gap-1 py-0",children:[e.jsx(k,{children:"Paid members"}),e.jsx(C,{children:e.jsx(L,{className:"text-[2.2rem]",children:f(m?.paid_members||0)})})]}),e.jsxs(w,{className:"grow gap-1 py-0",children:[e.jsx(k,{children:"MRR impact"}),e.jsx(C,{children:e.jsxs(L,{className:"text-[2.2rem]",children:[g,f(Te(m?.mrr||0))]})})]})]})]})})]})]})})]})};export{bs as default};
1
+ import{u as U,aM as D,r as h,j as e,B as I,aN as M,ai as y,aO as _,aP as Y,ab as te,aj as f,aQ as H,aR as re,aS as ie,af as le,ag as F,aT as oe,S as q}from"./index-CJU9a2PB.js";import{K as w,a as k,b as C,c as L}from"./kpi-card-CHZSLw4p.js";import{C as A,a as O,b as P,c as N,K as S,d as T,e as R,u as Q}from"./pagemenu-aHubMPwB.js";import{D as ne,a as ce,b as de,c as me,d as pe,e as he,f as xe,g as ue}from"./data-list-yngXNZDF.js";import{u as ge,p as je,N as fe,c as ve}from"./links-BQHRbn46.js";import{M as be}from"./wallet-cards-Do7nPf3f.js";import{P as Ne,a as ye}from"./post-analytics-header-BjGFgN6A.js";import{S as we,K as ke}from"./kpis-DzbAHfKK.js";import{E as Ce}from"./empty-indicator-BXWniwsl.js";import{G as Le}from"./gh-chart-DwTCK8z_.js";import{u as J,S as _e}from"./post-analytics-context-C7oW3aBz.js";import{u as Se,c as Te}from"./growth-DshcRqda.js";import{h as Re,i as De}from"./post-helpers-gInwAwEv.js";import{S as Ie}from"./sprout-C2R5CbXV.js";import"./chart-CqJxisVP.js";import"./_baseAssignValue-hsL6ItjC.js";import"./post-share-modal-Su923uIc.js";import"./posts-BwP7BNcB.js";import"./trash-CZ3EXwTL.js";import"./source-icon-Bzw-AU8p.js";import"./source-utils-B1S3ZHA2.js";import"./lucide-react-B7UnD_Dp.js";import"./a-large-small-BPPu_Iy7.js";import"./at-sign-CYnGzOFc.js";import"./message-square-text-CS3iRuPc.js";import"./copy-DWiB-781.js";import"./hash-p9dv0yuc.js";import"./inbox-CRoP9sy5.js";import"./minus-emzwh6hq.js";import"./tags-DXDZbfxp.js";import"./square-DT1uWkxs.js";import"./user-round-check-D3ihrrKL.js";import"./repeat-ms5ocvE0.js";import"./reply-BvO85IDn.js";import"./tabs-BwQ-i6MY.js";import"./index-6syrC9X1.js";import"./table-mjAkKNdb.js";import"./currency-fEUUCkj0.js";import"./stats-B1mhlQSp.js";const Me=({post:o,isNewsletterStatsLoading:n,isWebShown:x})=>{const{postId:s}=U(),a=D(),t=h.useMemo(()=>{const l=o.email?.opened_count||0,r=o.email?.email_count||0,p=o.count?.clicks||0;return{opened:l,clicked:p,openedRate:r>0?l/r:0,clickedRate:r>0?p/r:0,sent:r}},[o]),{data:m}=ge({searchParams:{filter:`post_id:'${s}'`}}),u=h.useMemo(()=>je(m),[m]),g=[{datatype:"Clicked",value:t.clickedRate,fill:"url(#gradientTeal)",color:"hsl(var(--chart-teal))"},{datatype:"Opened",value:t.openedRate,fill:"url(#gradientBlue)",color:"hsl(var(--chart-blue))"}],c={percentage:{label:"Opened"},Average:{label:"Clicked"},"This newsletter":{label:"Opened"}},i=o.email_only||!x;return e.jsxs(A,{className:`group/datalist overflow-hidden ${i&&"col-span-2"}`,children:[e.jsxs("div",{className:"relative flex items-center justify-between gap-6",children:[e.jsx(O,{children:e.jsxs(P,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(be,{size:16,strokeWidth:1.5}),"Newsletter performance"]})}),e.jsx(I,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100",size:"sm",variant:"outline",onClick:()=>{a(`/posts/analytics/${s}/newsletter`)},children:"View more"})]}),n?e.jsx(N,{children:e.jsx("div",{className:"mx-auto flex min-h-[250px] items-center justify-center xl:size-full",children:e.jsx(M,{})})}):e.jsxs(N,{className:`${i&&"grid grid-cols-2"}`,children:[e.jsxs("div",{className:`${i&&"border-r pr-6"}`,children:[e.jsxs("div",{className:"grid grid-cols-2 gap-6",children:[e.jsx(S,{className:"group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0",children:e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsx(T,{color:"hsl(var(--chart-blue))",children:"Open rate"}),e.jsx(R,{value:y(t.openedRate)})]})}),e.jsx(S,{className:"group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0",children:e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsx(T,{color:"hsl(var(--chart-teal))",children:"Click rate"}),e.jsx(R,{value:y(t.clickedRate)})]})})]}),!i&&e.jsx(_,{}),e.jsx("div",{className:"mx-auto my-6 h-[240px]",children:e.jsx(fe,{className:"pointer-events-none aspect-square h-[240px]",config:c,data:g,tooltip:!1})})]}),e.jsxs("div",{className:`${i&&"pl-6"}`,children:[!i&&e.jsx(_,{}),e.jsxs("div",{className:i?"":"pt-3",children:[e.jsxs("div",{className:`flex items-center justify-between gap-3 ${i?"pb-3":"py-3"}`,children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"Top clicked links in this email"}),e.jsx(Y,{children:"Members"})]}),u.length>0?e.jsx(ne,{className:"",children:e.jsx(ce,{children:u.slice(0,i?10:5).map(l=>{const r=t.clicked>0?l.count/t.clicked:0;return e.jsxs(de,{children:[e.jsx(me,{style:{width:`${r?Math.round(r*100):0}%`}}),e.jsx(pe,{children:e.jsxs("div",{className:"flex items-center space-x-2 overflow-hidden",children:[e.jsx(te,{className:"shrink-0 text-muted-foreground",size:16,strokeWidth:1.5}),e.jsx("a",{className:"block truncate font-medium hover:underline",href:l.link.to,rel:"noreferrer",target:"_blank",title:l.link.to,children:ve(l.link.to,!0)})]})}),e.jsxs(he,{children:[e.jsx(xe,{children:f(l.count||0)}),e.jsx(ue,{children:y(r)})]})]},l.link.link_id)})})}):e.jsx("div",{className:"py-20 text-center text-sm text-gray-700",children:"You have no links in your post."})]})]})]})]})},Ae=({chartData:o,range:n,isLoading:x,visitors:s,sourcesData:a,isNewsletterShown:t=!0})=>{const{postId:m}=U(),u=D(),{data:g}=J(),c=g?.url,i=g?.icon,l=h.useMemo(()=>a?a.reduce((r,p)=>r+Number(p.visits||0),0):0,[a]);return e.jsx(e.Fragment,{children:e.jsxs(A,{className:`group/datalist overflow-hidden ${!t&&"col-span-2"}`,"data-testid":"web-performance",children:[e.jsxs("div",{className:"relative flex items-center justify-between gap-6",children:[e.jsx(O,{children:e.jsxs(P,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(H,{size:16,strokeWidth:1.5}),"Web performance"]})}),e.jsx(I,{className:"absolute right-6 translate-x-10 opacity-0 transition-all duration-300 group-hover/datalist:translate-x-0 group-hover/datalist:opacity-100",size:"sm",variant:"outline",onClick:()=>{u(`/posts/analytics/${m}/web`)},children:"View more"})]}),e.jsxs(N,{children:[e.jsxs("div",{children:[e.jsx(S,{className:"group relative flex grow flex-row items-start justify-between gap-5 border-none px-0 pt-0","data-testid":"unique-visitors",children:e.jsxs("div",{className:"flex grow flex-col gap-1.5 border-none pb-0",children:[e.jsx(T,{color:"hsl(var(--chart-blue))",children:"Unique visitors"}),e.jsx(R,{value:f(s)})]})}),e.jsx(_,{}),e.jsx("div",{className:"max-h-[288px] py-6 [&_.recharts-cartesian-axis-tick-value]:fill-gray-500",children:x?e.jsx("div",{className:"flex h-[16vw] min-h-[240px] items-center justify-center",children:e.jsx(M,{})}):e.jsx(Le,{className:"aspect-auto h-[240px] w-full",color:"hsl(var(--chart-blue))",data:o||[],id:"visitors",range:n,syncId:"overview-charts"})})]}),t&&e.jsxs("div",{className:t?"border-t pt-3":"-mt-3",children:[e.jsx("div",{children:e.jsxs("div",{className:"flex items-center justify-between gap-3 py-3",children:[e.jsx("span",{className:"font-medium text-muted-foreground",children:"How readers found this post"}),e.jsx(Y,{children:"Visitors"})]})}),a&&a.length>0?e.jsx(we,{data:a,range:n,siteIcon:i,siteUrl:c,tableOnly:!0,topSourcesLimit:5,totalVisitors:l}):e.jsx(Ce,{className:"h-full py-10",description:"Once someone visits this post, sources will show here",title:"No visitors since you published this post",children:e.jsx(H,{strokeWidth:1.5})})]})]})]})})},bs=()=>{const o=D(),{statsConfig:n,isLoading:x,post:s,isPostLoading:a,postId:t}=J(),{totals:m,isLoading:u,currencySymbol:g}=Se(t),{appSettings:c}=re(),{emailTrackClicks:i,emailTrackOpens:l}=c?.analytics||{},r=h.useMemo(()=>s?.published_at?ie(s.published_at):_e.ALL_TIME.value,[s?.published_at]),{startDate:p,endDate:E,timezone:K}=le(r),V=h.useMemo(()=>{const d={site_uuid:n?.id||"",date_from:F(p),date_to:F(E),timezone:K,post_uuid:""};return!a&&s?.uuid?{...d,post_uuid:s.uuid}:d},[a,s,n?.id,p,E,K]),{data:v,loading:z}=Q({endpoint:"api_kpis",statsConfig:n||{id:""},params:V}),X=h.useMemo(()=>v?.length?v.reduce((d,j)=>{const G=Number(j.visits);return d+(isNaN(G)?0:G)},0):0,[v]),b=ke.visits,Z=oe(v||[],r,b.dataKey,"sum")?.map(d=>{const j=Number(d[b.dataKey]);return{date:String(d.date),value:j,formattedValue:b.formatter(j),label:b.label}}),{data:ee,loading:se}=Q({endpoint:"api_top_sources",statsConfig:n||{id:""},params:V}),$=x||u||a||z,ae=a||x||z,W=Re(s)&&l&&i,B=!s?.email_only&&c?.analytics.webAnalytics;return h.useEffect(()=>{!a&&s&&De(s)&&!c?.analytics.webAnalytics&&o(`/posts/analytics/${t}/growth`)},[a,s,c?.analytics.webAnalytics,o,t]),a?e.jsx(M,{}):e.jsxs(e.Fragment,{children:[e.jsx(Ne,{currentTab:"Overview"}),e.jsx(ye,{children:e.jsxs("div",{className:"flex flex-col gap-6 lg:grid lg:grid-cols-2",children:[B&&e.jsx(Ae,{chartData:Z,isLoading:ae||$||se,isNewsletterShown:W,range:r,sourcesData:ee,visitors:X}),W&&e.jsx(Me,{isNewsletterStatsLoading:a,isWebShown:B,post:s}),e.jsxs(A,{className:"group col-span-2 overflow-hidden p-0","data-testid":"growth",children:[e.jsxs("div",{className:"relative flex items-center justify-between gap-6",children:[e.jsx(O,{children:e.jsxs(P,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(Ie,{size:16,strokeWidth:1.5}),"Growth"]})}),e.jsx(I,{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:()=>{o(`/posts/analytics/${t}/growth`)},children:"View more"})]}),e.jsx(N,{className:"flex flex-col gap-6 px-0 md:grid md:grid-cols-3 md:items-stretch md:gap-0",children:$?Array.from({length:3},(d,j)=>e.jsxs("div",{className:"h-[98px] gap-1 border-r px-6 py-5 last:border-r-0",children:[e.jsx(q,{className:"w-2/3"}),e.jsx(q,{className:"h-7 w-12"})]},j)):e.jsxs(e.Fragment,{children:[e.jsxs(w,{className:"grow gap-1 py-0",children:[e.jsx(k,{children:"Free members"}),e.jsx(C,{children:e.jsx(L,{className:"text-[2.2rem]",children:f(m?.free_members||0)})})]}),c?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs(w,{className:"grow gap-1 py-0",children:[e.jsx(k,{children:"Paid members"}),e.jsx(C,{children:e.jsx(L,{className:"text-[2.2rem]",children:f(m?.paid_members||0)})})]}),e.jsxs(w,{className:"grow gap-1 py-0",children:[e.jsx(k,{children:"MRR impact"}),e.jsx(C,{children:e.jsxs(L,{className:"text-[2.2rem]",children:[g,f(Te(m?.mrr||0))]})})]})]})]})})]})]})})]})};export{bs as default};
@@ -1,4 +1,4 @@
1
- import{r as bt,e as ea,e6 as BL,e7 as VL,e8 as Nm,aI as zL,j as Lt,y as pe,an as lh,ao as GL,aW as FL,ap as HL,B as $w,aX as WL,aY as UL,a_ as YL}from"./index-BYawr8p9.js";import{T as XL}from"./wallet-cards-KaTkgqvi.js";/*! *****************************************************************************
1
+ import{r as bt,e as ea,e6 as BL,e7 as VL,e8 as Nm,aI as zL,j as Lt,y as pe,an as lh,ao as GL,aW as FL,ap as HL,B as $w,aX as WL,aY as UL,a_ as YL}from"./index-CJU9a2PB.js";import{T as XL}from"./wallet-cards-Do7nPf3f.js";/*! *****************************************************************************
2
2
  Copyright (c) Microsoft Corporation.
3
3
 
4
4
  Permission to use, copy, modify, and/or distribute this software for any
@@ -1 +1 @@
1
- import{j as u,r as l,e as i,aL as D}from"./index-BYawr8p9.js";import{M as E}from"./main-layout-Cl09wG7F.js";import{P as j}from"./post-share-modal-Dql4fYjR.js";import{u as b}from"./posts-Bsvw11Zo.js";import{u as M}from"./post-analytics-context-geHk7rOj.js";const C=({children:a})=>u.jsx(E,{children:u.jsx("div",{className:"grid w-full grow",children:u.jsx("div",{className:"flex h-full flex-col px-8",children:a})})}),L=()=>{const[a,r]=l.useState(!1),[p,d]=l.useState(null),[n,h]=l.useState(null),{site:f}=M(),{data:y}=b({searchParams:p?{filter:`id:${p.id}`,include:"authors,newsletter,email"}:{},enabled:!!p}),{data:g}=b({searchParams:{filter:"status:[published,sent]",limit:"1",fields:"id"},enabled:!!p}),e=y?.posts?.[0],P=s=>`${s.toLocaleString()} subscriber${s!==1?"s":""}`,S=s=>new Date(s).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}),w=s=>s?.map(o=>o.name).join(", ")||"",x=(s,o)=>s.length<=o?s:s.substring(0,o).trim()+"…",T=l.useMemo(()=>{if(!e)return null;const s=!!n,o=()=>{const t=[];if(e.email_only?t.push("Your email was sent to"):e.email?.email_count?t.push("Your post was published on your site and sent to"):t.push("Your post was published on your site"),e.email?.email_count){const m=P(e.email.email_count);t.push(" "),t.push(i.createElement("strong",{key:"subscriber-count"},m)),e.newsletter?.name&&(t.push(" of "),t.push(i.createElement("strong",{key:"newsletter-name"},e.newsletter.name))),t.push(",")}if(e.published_at){const m=new Date(e.published_at);m.toDateString()===new Date().toDateString()?(t.push(" "),t.push(i.createElement("strong",{key:"today"},"today"))):(t.push(" on "),t.push(i.createElement("strong",{key:"date"},m.toLocaleDateString("en-US",{month:"long",day:"numeric"})))),t.push(" at "),t.push(i.createElement("strong",{key:"time"},S(e.published_at)))}return t.push("."),i.createElement("span",{},...t)},c=()=>{r(!1),d(null),h(null)};return{open:a,onOpenChange:t=>{t||c()},emailOnly:e.email_only,postURL:e.url||"",primaryTitle:"Boom! It's out there.",secondaryTitle:s&&n?`That's ${n.toLocaleString()} post${n!==1?"s":""} published.`:"Spread the word!",description:o(),featureImageURL:e.feature_image||"",postTitle:e.title||"",postExcerpt:x(e.excerpt||"",100),faviconURL:f?.icon||"",siteTitle:f?.title||"",author:w(e.authors),onClose:c}},[e,a,n,f?.title]);return l.useEffect(()=>{const s=()=>{try{const c=localStorage.getItem("ghost-last-published-post");if(c){const t=JSON.parse(c);d(t),r(!0),localStorage.removeItem("ghost-last-published-post")}}catch{}};s();const o=setTimeout(s,100);return()=>clearTimeout(o)},[]),l.useEffect(()=>{g?.meta?.pagination?.total&&h(g.meta.pagination.total)},[g]),{isModalOpen:a,post:e,postCount:n,showPostCount:!!n,closeModal:()=>{r(!1),d(null),h(null)},modalProps:T}},v=()=>{const{isModalOpen:a,modalProps:r}=L();return u.jsxs(C,{children:[u.jsx(D,{}),a&&r&&u.jsx(j,{...r})]})};export{v as default};
1
+ import{j as u,r as l,e as i,aL as D}from"./index-CJU9a2PB.js";import{M as E}from"./main-layout-9nmU5WlG.js";import{P as j}from"./post-share-modal-Su923uIc.js";import{u as b}from"./posts-BwP7BNcB.js";import{u as M}from"./post-analytics-context-C7oW3aBz.js";const C=({children:a})=>u.jsx(E,{children:u.jsx("div",{className:"grid w-full grow",children:u.jsx("div",{className:"flex h-full flex-col px-8",children:a})})}),L=()=>{const[a,r]=l.useState(!1),[p,d]=l.useState(null),[n,h]=l.useState(null),{site:f}=M(),{data:y}=b({searchParams:p?{filter:`id:${p.id}`,include:"authors,newsletter,email"}:{},enabled:!!p}),{data:g}=b({searchParams:{filter:"status:[published,sent]",limit:"1",fields:"id"},enabled:!!p}),e=y?.posts?.[0],P=s=>`${s.toLocaleString()} subscriber${s!==1?"s":""}`,S=s=>new Date(s).toLocaleTimeString("en-US",{hour:"2-digit",minute:"2-digit",hour12:!1}),w=s=>s?.map(o=>o.name).join(", ")||"",x=(s,o)=>s.length<=o?s:s.substring(0,o).trim()+"…",T=l.useMemo(()=>{if(!e)return null;const s=!!n,o=()=>{const t=[];if(e.email_only?t.push("Your email was sent to"):e.email?.email_count?t.push("Your post was published on your site and sent to"):t.push("Your post was published on your site"),e.email?.email_count){const m=P(e.email.email_count);t.push(" "),t.push(i.createElement("strong",{key:"subscriber-count"},m)),e.newsletter?.name&&(t.push(" of "),t.push(i.createElement("strong",{key:"newsletter-name"},e.newsletter.name))),t.push(",")}if(e.published_at){const m=new Date(e.published_at);m.toDateString()===new Date().toDateString()?(t.push(" "),t.push(i.createElement("strong",{key:"today"},"today"))):(t.push(" on "),t.push(i.createElement("strong",{key:"date"},m.toLocaleDateString("en-US",{month:"long",day:"numeric"})))),t.push(" at "),t.push(i.createElement("strong",{key:"time"},S(e.published_at)))}return t.push("."),i.createElement("span",{},...t)},c=()=>{r(!1),d(null),h(null)};return{open:a,onOpenChange:t=>{t||c()},emailOnly:e.email_only,postURL:e.url||"",primaryTitle:"Boom! It's out there.",secondaryTitle:s&&n?`That's ${n.toLocaleString()} post${n!==1?"s":""} published.`:"Spread the word!",description:o(),featureImageURL:e.feature_image||"",postTitle:e.title||"",postExcerpt:x(e.excerpt||"",100),faviconURL:f?.icon||"",siteTitle:f?.title||"",author:w(e.authors),onClose:c}},[e,a,n,f?.title]);return l.useEffect(()=>{const s=()=>{try{const c=localStorage.getItem("ghost-last-published-post");if(c){const t=JSON.parse(c);d(t),r(!0),localStorage.removeItem("ghost-last-published-post")}}catch{}};s();const o=setTimeout(s,100);return()=>clearTimeout(o)},[]),l.useEffect(()=>{g?.meta?.pagination?.total&&h(g.meta.pagination.total)},[g]),{isModalOpen:a,post:e,postCount:n,showPostCount:!!n,closeModal:()=>{r(!1),d(null),h(null)},modalProps:T}},v=()=>{const{isModalOpen:a,modalProps:r}=L();return u.jsxs(C,{children:[u.jsx(D,{}),a&&r&&u.jsx(j,{...r})]})};export{v as default};
@@ -1 +1 @@
1
- import{r as e,u as v,aF as y,aG as D,aH as C,aI as k,j as w}from"./index-BYawr8p9.js";import{u as I}from"./posts-Bsvw11Zo.js";const N={TODAY:{name:"Today",value:1},LAST_7_DAYS:{name:"Last 7 days",value:7},LAST_30_DAYS:{name:"Last 30 days",value:31},LAST_3_MONTHS:{name:"Last 3 months",value:91},YEAR_TO_DATE:{name:"Year to date",value:366},LAST_12_MONTHS:{name:"Last 12 months",value:372},ALL_TIME:{name:"All time",value:1e3}},G={US:"United States",TWN:"Taiwan",TW:"Taiwan",CN:"China","mobile-ios":"iOS","mobile-android":"Android",macos:"macOS","google.com":"Google","ghost.org":"Ghost","bing.com":"Bing","bsky.app":"Bluesky","yahoo.com":"Yahoo","duckduckgo.com":"DuckDuckGo"},R=["NULL","ᴺᵁᴸᴸ","","Others","Other"],c={PUBLIC:1,FREE:2,PAID:4},Y=c.PUBLIC|c.FREE|c.PAID,g=e.createContext(void 0),O=()=>{const s=e.useContext(g);if(!s)throw new Error("useGlobalData must be used within a PostAnalyticsProvider");return s},B=({children:s})=>{const{postId:a}=v();if(!a)throw new Error("Post ID is required for PostAnalyticsProvider");const o=y(),t=D(),[A,S]=e.useState(N.LAST_30_DAYS.value),d=C(),n=!!o.data?.config?.stats,i=k({enabled:n}),[m,L]=e.useState(7),{data:{posts:[T]}={posts:[]},isLoading:_}=I({searchParams:{filter:`id:${a}`,include:"email,authors,tags,tiers,count.clicks,count.signups,count.paid_conversions,count.positive_feedback,count.negative_feedback,newsletter"}}),u=[o,t,d],f=u.map(r=>r.error).find(Boolean),E=n?i.error:null,l=f||E,P=u.some(r=>r.isLoading),b=n?i.isLoading:!1,h=P||b;if(l)throw l;const p=t.data?.site?{url:t.data.site.url,icon:t.data.site.icon,title:t.data.site.title}:void 0;return w.jsx(g.Provider,{value:{data:o.data?.config,site:p,statsConfig:o.data?.config?.stats,tinybirdToken:i.token,isLoading:h,range:A,setRange:S,audience:m,setAudience:L,settings:d.data?.settings||[],postId:a,post:T,isPostLoading:_},children:s})},j=Object.freeze(Object.defineProperty({__proto__:null,default:B,useGlobalData:O},Symbol.toStringTag,{value:"Module"}));export{Y as A,N as S,R as U,c as a,G as b,j as p,O as u};
1
+ import{r as e,u as v,aF as y,aG as D,aH as C,aI as k,j as w}from"./index-CJU9a2PB.js";import{u as I}from"./posts-BwP7BNcB.js";const N={TODAY:{name:"Today",value:1},LAST_7_DAYS:{name:"Last 7 days",value:7},LAST_30_DAYS:{name:"Last 30 days",value:31},LAST_3_MONTHS:{name:"Last 3 months",value:91},YEAR_TO_DATE:{name:"Year to date",value:366},LAST_12_MONTHS:{name:"Last 12 months",value:372},ALL_TIME:{name:"All time",value:1e3}},G={US:"United States",TWN:"Taiwan",TW:"Taiwan",CN:"China","mobile-ios":"iOS","mobile-android":"Android",macos:"macOS","google.com":"Google","ghost.org":"Ghost","bing.com":"Bing","bsky.app":"Bluesky","yahoo.com":"Yahoo","duckduckgo.com":"DuckDuckGo"},R=["NULL","ᴺᵁᴸᴸ","","Others","Other"],c={PUBLIC:1,FREE:2,PAID:4},Y=c.PUBLIC|c.FREE|c.PAID,g=e.createContext(void 0),O=()=>{const s=e.useContext(g);if(!s)throw new Error("useGlobalData must be used within a PostAnalyticsProvider");return s},B=({children:s})=>{const{postId:a}=v();if(!a)throw new Error("Post ID is required for PostAnalyticsProvider");const o=y(),t=D(),[A,S]=e.useState(N.LAST_30_DAYS.value),d=C(),n=!!o.data?.config?.stats,i=k({enabled:n}),[m,L]=e.useState(7),{data:{posts:[T]}={posts:[]},isLoading:_}=I({searchParams:{filter:`id:${a}`,include:"email,authors,tags,tiers,count.clicks,count.signups,count.paid_conversions,count.positive_feedback,count.negative_feedback,newsletter"}}),u=[o,t,d],f=u.map(r=>r.error).find(Boolean),E=n?i.error:null,l=f||E,P=u.some(r=>r.isLoading),b=n?i.isLoading:!1,h=P||b;if(l)throw l;const p=t.data?.site?{url:t.data.site.url,icon:t.data.site.icon,title:t.data.site.title}:void 0;return w.jsx(g.Provider,{value:{data:o.data?.config,site:p,statsConfig:o.data?.config?.stats,tinybirdToken:i.token,isLoading:h,range:A,setRange:S,audience:m,setAudience:L,settings:d.data?.settings||[],postId:a,post:T,isPostLoading:_},children:s})},j=Object.freeze(Object.defineProperty({__proto__:null,default:B,useGlobalData:O},Symbol.toStringTag,{value:"Module"}));export{Y as A,N as S,R as U,c as a,G as b,j as p,O as u};
@@ -1 +1 @@
1
- import{r as i,j as e,y as d,aU as L,C as R,aM as H,aR as W,aV as G,aj as I,B as N,aW as T,ap as U,aX as V,aY as z,aZ as A,a_ as b,x as F,a$ as Q,b0 as X,b1 as c,aQ as Z,a0 as q,a1 as J,a2 as K,a3 as ee,a4 as se,a5 as ae,a6 as te,a7 as re}from"./index-BYawr8p9.js";import{f as ie,N as le,P as ne,g as u}from"./pagemenu-BMXHDXYy.js";import{P as oe}from"./post-share-modal-Dql4fYjR.js";import{u as ce}from"./post-analytics-context-geHk7rOj.js";import{i as D,h as de,a as me,b as ue}from"./post-helpers-gInwAwEv.js";import{a as xe}from"./posts-Bsvw11Zo.js";import{S as pe,P as he,G as fe,M as ge}from"./wallet-cards-KaTkgqvi.js";import{T as be}from"./trash-BglGemAb.js";import{S as je}from"./sprout-BW9HFVU8.js";const k=i.forwardRef(({...t},r)=>e.jsx("nav",{ref:r,"aria-label":"breadcrumb",...t}));k.displayName="Breadcrumb";const C=i.forwardRef(({className:t,...r},a)=>e.jsx("ol",{ref:a,className:d("flex flex-wrap items-center gap-1.5 break-words text-sm font-medium text-muted-foreground sm:gap-2.5 h-[34px]",t),...r}));C.displayName="BreadcrumbList";const x=i.forwardRef(({className:t,...r},a)=>e.jsx("li",{ref:a,className:d("inline-flex items-center gap-1.5",t),...r}));x.displayName="BreadcrumbItem";const j=i.forwardRef(({asChild:t,className:r,...a},p)=>{const l=t?L:"a";return e.jsx(l,{ref:p,className:d("inline-flex items-center gap-1 transition-colors hover:text-foreground",r),...a})});j.displayName="BreadcrumbLink";const P=i.forwardRef(({className:t,...r},a)=>e.jsx("span",{ref:a,"aria-current":"page","aria-disabled":"true",className:d("font-medium text-foreground",t),role:"link",...r}));P.displayName="BreadcrumbPage";const M=({children:t,className:r,...a})=>e.jsx("li",{"aria-hidden":"true",className:d("[&>svg]:w-3.5 [&>svg]:h-3.5",r),role:"presentation",...a,children:t??e.jsx(R,{})});M.displayName="BreadcrumbSeparator";const Se=({children:t,className:r,...a})=>e.jsx("section",{className:d("flex gap-6 flex-col py-8 size-full grow",r),...a,children:t}),Be=({currentTab:t,children:r})=>{const a=H(),{fromAnalytics:p,appSettings:l}=W(),{mutateAsync:S}=xe(),B=G(),[_,h]=i.useState(!1),[Y,f]=i.useState(!1),{site:w,statsConfig:$,post:s,isPostLoading:g,postId:o}=ce(),{activeVisitors:y,isLoading:v}=ie({postUuid:s?.uuid,statsConfig:$,enabled:l?.analytics?.webAnalytics??!1}),m=i.useMemo(()=>{if(!s)return[];const n=[];return D(s)&&!l?.analytics.webAnalytics||(n.push("Overview"),!s.email_only&&l?.analytics.webAnalytics&&n.push("Web")),de(s)&&n.push("Newsletter"),n.push("Growth"),n},[s,l?.analytics.webAnalytics]),O=()=>{s&&h(!0)},E=async()=>{if(s)try{await S(o),h(!1),a("/posts/",{crossApp:!0})}catch(n){B(n)}};return e.jsxs(e.Fragment,{children:[e.jsx("header",{className:"z-50 -mx-8 bg-white/70 backdrop-blur-md dark:bg-black",children:e.jsx("div",{className:"relative flex min-h-[102px] w-full items-start justify-between gap-5 px-8 pb-0 pt-8","data-header":"header",children:e.jsxs("div",{className:"flex w-full flex-col gap-5",children:[e.jsxs("div",{className:"flex w-full flex-col justify-between md:flex-row md:items-center",children:[e.jsx(k,{children:e.jsxs(C,{children:[p?e.jsx(x,{children:e.jsx(j,{className:"cursor-pointer leading-[24px]",onClick:()=>a("/analytics/",{crossApp:!0}),children:"Analytics"})}):e.jsx(x,{children:e.jsx(j,{className:"cursor-pointer leading-[24px]",onClick:()=>a("/posts/",{crossApp:!0}),children:"Posts"})}),e.jsx(M,{}),e.jsx(x,{children:e.jsx(P,{className:"leading-[24px]",children:"Post analytics"})})]})}),e.jsxs("div",{className:"flex w-full items-center gap-2 md:w-auto",children:[l?.analytics.webAnalytics&&!s?.email_only&&e.jsx("div",{className:"mr-3 flex grow items-center gap-2 text-sm md:grow-0",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",title:"Active readers in the last 5 minutes · Updates every 60 seconds",children:[e.jsxs("span",{className:"text-sm",children:[v?"":I(y)," reading now"]}),e.jsx("div",{className:`size-2 rounded-full ${v?"animate-pulse bg-muted":y?"bg-green-500":"border border-muted-foreground"}`})]})}),!g&&e.jsxs(e.Fragment,{children:[!s?.email_only&&e.jsx(oe,{author:s?.authors?.[0]?.name||"",description:"",faviconURL:w?.icon||"",featureImageURL:s?.feature_image,open:Y,postExcerpt:s?.excerpt||"",postTitle:s?.title,postURL:s?.url,siteTitle:w?.title||"",onClose:()=>f(!1),onOpenChange:f,children:e.jsxs(N,{variant:"outline",onClick:()=>f(!0),children:[e.jsx(pe,{})," Share"]})}),e.jsxs(T,{children:[e.jsx(U,{asChild:!0,children:e.jsx(N,{variant:"outline",children:e.jsx(V,{})})}),e.jsxs(z,{align:"end",children:[e.jsxs(A,{children:[e.jsx(b,{asChild:!0,children:e.jsxs("a",{href:s?.url,rel:"noopener noreferrer",target:"_blank",children:[e.jsx(F,{}),"View in browser"]})}),e.jsxs(b,{onClick:()=>{a(`/editor/post/${o}`,{crossApp:!0})},children:[e.jsx(he,{}),"Edit post"]})]}),e.jsx(Q,{}),e.jsx(A,{children:e.jsxs(b,{className:"text-destructive focus:text-destructive",onClick:O,children:[e.jsx(be,{}),"Delete post"]})})]})]})]})]})]}),!g&&e.jsxs("div",{className:"flex items-start gap-6 md:items-center",children:[s?.feature_image&&e.jsx("div",{className:"aspect-[16/10] w-full max-w-[100px] rounded-md bg-cover bg-center md:max-w-[132px]",style:{backgroundImage:`url(${s.feature_image})`}}),e.jsxs("div",{children:[e.jsx(X,{className:"-ml-px max-w-[920px] indent-0 text-xl md:min-h-[35px] md:text-3xl md:leading-[1.2em]","data-header":"header-title",children:s?.title}),s?.published_at&&e.jsxs("div",{className:"mt-0.5 flex items-center justify-start text-sm leading-[1.65em] text-muted-foreground",children:[me(s)&&`Sent on ${c(s.published_at).format("D MMM YYYY")} at ${c(s.published_at).format("HH:mm")}`,D(s)&&`Published on your site on ${c(s.published_at).format("D MMM YYYY")} at ${c(s.published_at).format("HH:mm")}`,ue(s)&&`Published and sent on ${c(s.published_at).format("D MMM YYYY")} at ${c(s.published_at).format("HH:mm")}`]})]})]})]})})}),e.jsxs(le,{className:"sticky top-0 z-50 -mb-8 transform-gpu flex-col items-start gap-y-0 border-none bg-white/70 py-8 backdrop-blur-md lg:flex-row lg:items-center dark:bg-black",children:[!g&&e.jsxs(ne,{className:"min-h-[34px]",defaultValue:t,responsive:!0,children:[m.includes("Overview")&&e.jsxs(u,{value:"Overview",onClick:()=>{a(`/posts/analytics/${o}`)},children:[e.jsx(fe,{}),"Overview"]}),m.includes("Web")&&e.jsxs(u,{value:"Web",onClick:()=>{a(`/posts/analytics/${o}/web`)},children:[e.jsx(Z,{}),"Web traffic"]}),m.includes("Newsletter")&&e.jsxs(u,{value:"Newsletter",onClick:()=>{a(`/posts/analytics/${o}/newsletter`)},children:[e.jsx(ge,{}),"Newsletter"]}),m.includes("Growth")&&e.jsxs(u,{value:"Growth",onClick:()=>{a(`/posts/analytics/${o}/growth`)},children:[e.jsx(je,{}),"Growth"]})]}),r]}),e.jsx(q,{open:_,onOpenChange:h,children:e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsx(ee,{children:"Are you sure you want to delete this post?"}),e.jsxs(se,{children:[`You're about to delete "`,e.jsx("strong",{children:s?.title}),'". This is permanent! We warned you, k?']})]}),e.jsxs(ae,{children:[e.jsx(te,{children:"Cancel"}),e.jsx(re,{className:"hover:bg-red-700 bg-red-600 text-white",onClick:E,children:"Delete"})]})]})})]})};export{Be as P,Se as a};
1
+ import{r as i,j as e,y as d,aU as L,C as R,aM as H,aR as W,aV as G,aj as I,B as N,aW as T,ap as U,aX as V,aY as z,aZ as A,a_ as b,x as F,a$ as Q,b0 as X,b1 as c,aQ as Z,a0 as q,a1 as J,a2 as K,a3 as ee,a4 as se,a5 as ae,a6 as te,a7 as re}from"./index-CJU9a2PB.js";import{f as ie,N as le,P as ne,g as u}from"./pagemenu-aHubMPwB.js";import{P as oe}from"./post-share-modal-Su923uIc.js";import{u as ce}from"./post-analytics-context-C7oW3aBz.js";import{i as D,h as de,a as me,b as ue}from"./post-helpers-gInwAwEv.js";import{a as xe}from"./posts-BwP7BNcB.js";import{S as pe,P as he,G as fe,M as ge}from"./wallet-cards-Do7nPf3f.js";import{T as be}from"./trash-CZ3EXwTL.js";import{S as je}from"./sprout-C2R5CbXV.js";const k=i.forwardRef(({...t},r)=>e.jsx("nav",{ref:r,"aria-label":"breadcrumb",...t}));k.displayName="Breadcrumb";const C=i.forwardRef(({className:t,...r},a)=>e.jsx("ol",{ref:a,className:d("flex flex-wrap items-center gap-1.5 break-words text-sm font-medium text-muted-foreground sm:gap-2.5 h-[34px]",t),...r}));C.displayName="BreadcrumbList";const x=i.forwardRef(({className:t,...r},a)=>e.jsx("li",{ref:a,className:d("inline-flex items-center gap-1.5",t),...r}));x.displayName="BreadcrumbItem";const j=i.forwardRef(({asChild:t,className:r,...a},p)=>{const l=t?L:"a";return e.jsx(l,{ref:p,className:d("inline-flex items-center gap-1 transition-colors hover:text-foreground",r),...a})});j.displayName="BreadcrumbLink";const P=i.forwardRef(({className:t,...r},a)=>e.jsx("span",{ref:a,"aria-current":"page","aria-disabled":"true",className:d("font-medium text-foreground",t),role:"link",...r}));P.displayName="BreadcrumbPage";const M=({children:t,className:r,...a})=>e.jsx("li",{"aria-hidden":"true",className:d("[&>svg]:w-3.5 [&>svg]:h-3.5",r),role:"presentation",...a,children:t??e.jsx(R,{})});M.displayName="BreadcrumbSeparator";const Se=({children:t,className:r,...a})=>e.jsx("section",{className:d("flex gap-6 flex-col py-8 size-full grow",r),...a,children:t}),Be=({currentTab:t,children:r})=>{const a=H(),{fromAnalytics:p,appSettings:l}=W(),{mutateAsync:S}=xe(),B=G(),[_,h]=i.useState(!1),[Y,f]=i.useState(!1),{site:w,statsConfig:$,post:s,isPostLoading:g,postId:o}=ce(),{activeVisitors:y,isLoading:v}=ie({postUuid:s?.uuid,statsConfig:$,enabled:l?.analytics?.webAnalytics??!1}),m=i.useMemo(()=>{if(!s)return[];const n=[];return D(s)&&!l?.analytics.webAnalytics||(n.push("Overview"),!s.email_only&&l?.analytics.webAnalytics&&n.push("Web")),de(s)&&n.push("Newsletter"),n.push("Growth"),n},[s,l?.analytics.webAnalytics]),O=()=>{s&&h(!0)},E=async()=>{if(s)try{await S(o),h(!1),a("/posts/",{crossApp:!0})}catch(n){B(n)}};return e.jsxs(e.Fragment,{children:[e.jsx("header",{className:"z-50 -mx-8 bg-white/70 backdrop-blur-md dark:bg-black",children:e.jsx("div",{className:"relative flex min-h-[102px] w-full items-start justify-between gap-5 px-8 pb-0 pt-8","data-header":"header",children:e.jsxs("div",{className:"flex w-full flex-col gap-5",children:[e.jsxs("div",{className:"flex w-full flex-col justify-between md:flex-row md:items-center",children:[e.jsx(k,{children:e.jsxs(C,{children:[p?e.jsx(x,{children:e.jsx(j,{className:"cursor-pointer leading-[24px]",onClick:()=>a("/analytics/",{crossApp:!0}),children:"Analytics"})}):e.jsx(x,{children:e.jsx(j,{className:"cursor-pointer leading-[24px]",onClick:()=>a("/posts/",{crossApp:!0}),children:"Posts"})}),e.jsx(M,{}),e.jsx(x,{children:e.jsx(P,{className:"leading-[24px]",children:"Post analytics"})})]})}),e.jsxs("div",{className:"flex w-full items-center gap-2 md:w-auto",children:[l?.analytics.webAnalytics&&!s?.email_only&&e.jsx("div",{className:"mr-3 flex grow items-center gap-2 text-sm md:grow-0",children:e.jsxs("div",{className:"flex items-center gap-2 text-sm text-muted-foreground",title:"Active readers in the last 5 minutes · Updates every 60 seconds",children:[e.jsxs("span",{className:"text-sm",children:[v?"":I(y)," reading now"]}),e.jsx("div",{className:`size-2 rounded-full ${v?"animate-pulse bg-muted":y?"bg-green-500":"border border-muted-foreground"}`})]})}),!g&&e.jsxs(e.Fragment,{children:[!s?.email_only&&e.jsx(oe,{author:s?.authors?.[0]?.name||"",description:"",faviconURL:w?.icon||"",featureImageURL:s?.feature_image,open:Y,postExcerpt:s?.excerpt||"",postTitle:s?.title,postURL:s?.url,siteTitle:w?.title||"",onClose:()=>f(!1),onOpenChange:f,children:e.jsxs(N,{variant:"outline",onClick:()=>f(!0),children:[e.jsx(pe,{})," Share"]})}),e.jsxs(T,{children:[e.jsx(U,{asChild:!0,children:e.jsx(N,{variant:"outline",children:e.jsx(V,{})})}),e.jsxs(z,{align:"end",children:[e.jsxs(A,{children:[e.jsx(b,{asChild:!0,children:e.jsxs("a",{href:s?.url,rel:"noopener noreferrer",target:"_blank",children:[e.jsx(F,{}),"View in browser"]})}),e.jsxs(b,{onClick:()=>{a(`/editor/post/${o}`,{crossApp:!0})},children:[e.jsx(he,{}),"Edit post"]})]}),e.jsx(Q,{}),e.jsx(A,{children:e.jsxs(b,{className:"text-destructive focus:text-destructive",onClick:O,children:[e.jsx(be,{}),"Delete post"]})})]})]})]})]})]}),!g&&e.jsxs("div",{className:"flex items-start gap-6 md:items-center",children:[s?.feature_image&&e.jsx("div",{className:"aspect-[16/10] w-full max-w-[100px] rounded-md bg-cover bg-center md:max-w-[132px]",style:{backgroundImage:`url(${s.feature_image})`}}),e.jsxs("div",{children:[e.jsx(X,{className:"-ml-px max-w-[920px] indent-0 text-xl md:min-h-[35px] md:text-3xl md:leading-[1.2em]","data-header":"header-title",children:s?.title}),s?.published_at&&e.jsxs("div",{className:"mt-0.5 flex items-center justify-start text-sm leading-[1.65em] text-muted-foreground",children:[me(s)&&`Sent on ${c(s.published_at).format("D MMM YYYY")} at ${c(s.published_at).format("HH:mm")}`,D(s)&&`Published on your site on ${c(s.published_at).format("D MMM YYYY")} at ${c(s.published_at).format("HH:mm")}`,ue(s)&&`Published and sent on ${c(s.published_at).format("D MMM YYYY")} at ${c(s.published_at).format("HH:mm")}`]})]})]})]})})}),e.jsxs(le,{className:"sticky top-0 z-50 -mb-8 transform-gpu flex-col items-start gap-y-0 border-none bg-white/70 py-8 backdrop-blur-md lg:flex-row lg:items-center dark:bg-black",children:[!g&&e.jsxs(ne,{className:"min-h-[34px]",defaultValue:t,responsive:!0,children:[m.includes("Overview")&&e.jsxs(u,{value:"Overview",onClick:()=>{a(`/posts/analytics/${o}`)},children:[e.jsx(fe,{}),"Overview"]}),m.includes("Web")&&e.jsxs(u,{value:"Web",onClick:()=>{a(`/posts/analytics/${o}/web`)},children:[e.jsx(Z,{}),"Web traffic"]}),m.includes("Newsletter")&&e.jsxs(u,{value:"Newsletter",onClick:()=>{a(`/posts/analytics/${o}/newsletter`)},children:[e.jsx(ge,{}),"Newsletter"]}),m.includes("Growth")&&e.jsxs(u,{value:"Growth",onClick:()=>{a(`/posts/analytics/${o}/growth`)},children:[e.jsx(je,{}),"Growth"]})]}),r]}),e.jsx(q,{open:_,onOpenChange:h,children:e.jsxs(J,{children:[e.jsxs(K,{children:[e.jsx(ee,{children:"Are you sure you want to delete this post?"}),e.jsxs(se,{children:[`You're about to delete "`,e.jsx("strong",{children:s?.title}),'". This is permanent! We warned you, k?']})]}),e.jsxs(ae,{children:[e.jsx(te,{children:"Cancel"}),e.jsx(re,{className:"hover:bg-red-700 bg-red-600 text-white",onClick:E,children:"Delete"})]})]})})]})};export{Be as P,Se as a};
@@ -1 +1 @@
1
- import{r as k,j as e,D as w,q as N,t as C,B as t,X as z,v as y,w as H,a9 as $,_ as M,aa as D,$ as P,ab as V}from"./index-BYawr8p9.js";const I=({emailOnly:x=!1,postURL:s="",primaryTitle:m="Your post is published.",secondaryTitle:p="Spread the word!",description:a="",featureImageURL:i="",postTitle:r="",postExcerpt:n="",faviconURL:f="",siteTitle:g="",author:j="",onClose:c=()=>{},children:u,...v})=>{const[o,d]=k.useState(!1),_=async()=>{try{await navigator.clipboard.writeText(s),d(!0),setTimeout(()=>d(!1),2e3)}catch{}},h=encodeURIComponent(r),l=encodeURIComponent(s),b=encodeURIComponent(`${r} ${s}`);return e.jsxs(w,{...v,children:[e.jsx(N,{className:"cursor-pointer",asChild:!0,children:u}),e.jsxs(C,{className:"max-h-[calc(100vh-16vmin)] max-w-[540px] overflow-y-auto p-8",children:[e.jsx("div",{className:"sticky top-0 ml-auto size-0",children:e.jsx(t,{className:"absolute -right-5 -top-5 cursor-pointer p-2 text-muted-foreground hover:text-foreground [&_svg]:!size-6",size:"lg",variant:"link",onClick:c,children:e.jsx(z,{size:24,strokeWidth:1})})}),e.jsxs(y,{className:"relative -mt-5",children:[e.jsxs(H,{className:"text-3xl font-bold leading-[1.15em]",children:[e.jsx("span",{className:"text-green-500",children:m}),e.jsx("br",{}),e.jsx("span",{children:p})]}),a&&e.jsx($,{className:"mb-0 pb-0 pt-1 text-lg text-foreground",children:a})]}),e.jsxs("a",{className:"flex flex-col items-stretch overflow-hidden rounded-md border transition-all hover:border-muted-foreground/40",href:s,rel:"noopener noreferrer",target:"_blank",children:[i&&e.jsx("div",{className:"aspect-video bg-cover bg-center",style:{backgroundImage:`url(${i})`}}),e.jsxs("div",{className:"p-6 pt-5",children:[e.jsx(M,{children:r}),n&&e.jsx("p",{children:n}),e.jsxs("div",{className:"mt-2 flex items-start gap-2",children:[e.jsx("div",{className:"mt-0.5 size-4 bg-cover bg-center",style:{backgroundImage:`url(${f})`}}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("strong",{children:g}),e.jsx("span",{children:"•"}),e.jsx("span",{children:j})]})]})]})]}),e.jsx(D,{className:"justify-between gap-6",children:x?e.jsx(t,{className:"cursor-pointer",type:"submit",onClick:c,children:"Close"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`https://twitter.com/intent/tweet?text=${h}%0A${l}`,rel:"noopener noreferrer",target:"_blank",children:e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",children:e.jsx("path",{className:"social-x_svg__x",d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})}),e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`https://threads.net/intent/post?text=${b}`,rel:"noopener noreferrer",target:"_blank",children:e.jsxs("svg",{fill:"none",viewBox:"0 0 18 18",children:[e.jsx("g",{clipPath:"url(#social-threads_svg__clip0_351_18008)",children:e.jsx("path",{d:"M13.033 8.38a5.924 5.924 0 00-.223-.102c-.13-2.418-1.452-3.802-3.67-3.816h-.03c-1.327 0-2.43.566-3.11 1.597l1.22.837c.507-.77 1.304-.934 1.89-.934h.02c.73.004 1.282.217 1.639.63.26.302.433.72.519 1.245a9.334 9.334 0 00-2.097-.101c-2.109.121-3.465 1.351-3.374 3.06.047.868.478 1.614 1.216 2.1.624.413 1.428.614 2.263.568 1.103-.06 1.969-.48 2.572-1.25.459-.585.749-1.342.877-2.296.526.317.915.735 1.13 1.236.366.854.387 2.255-.756 3.398-1.003 1.002-2.207 1.435-4.028 1.448-2.02-.015-3.547-.663-4.54-1.925-.93-1.182-1.41-2.89-1.428-5.075.018-2.185.498-3.893 1.428-5.075.993-1.262 2.52-1.91 4.54-1.925 2.034.015 3.588.666 4.62 1.934.505.622.886 1.405 1.137 2.317l1.43-.382c-.305-1.122-.784-2.09-1.436-2.892C13.52 1.35 11.587.517 9.096.5h-.01C6.6.517 4.689 1.354 3.404 2.986 2.262 4.44 1.672 6.46 1.652 8.994v.012c.02 2.534.61 4.555 1.752 6.008C4.69 16.646 6.6 17.483 9.086 17.5h.01c2.21-.015 3.768-.594 5.051-1.876 1.68-1.678 1.629-3.78 1.075-5.07-.397-.927-1.154-1.678-2.189-2.175zm-3.816 3.587c-.924.052-1.884-.363-1.932-1.252-.035-.659.47-1.394 1.99-1.482a8.9 8.9 0 01.512-.014c.552 0 1.068.053 1.538.156-.175 2.187-1.203 2.542-2.108 2.592z",fill:"#000"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"social-threads_svg__clip0_351_18008",children:e.jsx("path",{d:"M0 0h17v17H0z",fill:"#fff",transform:"translate(.5 .5)"})})})]})}),e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`https://www.facebook.com/sharer/sharer.php?u=${l}`,rel:"noopener noreferrer",target:"_blank",children:e.jsxs("svg",{fill:"none",viewBox:"0 0 40 40",children:[e.jsx("title",{children:"social-facebook"}),e.jsx("path",{className:"social-facebook_svg__fb",d:"M20 40.004c11.046 0 20-8.955 20-20 0-11.046-8.954-20-20-20s-20 8.954-20 20c0 11.045 8.954 20 20 20z",fill:"#1977f3"}),e.jsx("path",{d:"M27.785 25.785l.886-5.782h-5.546V16.25c0-1.58.773-3.125 3.26-3.125h2.522V8.204s-2.29-.39-4.477-.39c-4.568 0-7.555 2.767-7.555 7.781v4.408h-5.08v5.782h5.08v13.976a20.08 20.08 0 003.125.242c1.063 0 2.107-.085 3.125-.242V25.785h4.66z",fill:"#fff"})]})}),e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`http://www.linkedin.com/shareArticle?mini=true&title=${h}&url=${l}`,rel:"noopener noreferrer",target:"_blank",children:e.jsxs("svg",{fill:"none",viewBox:"0 0 16 16",children:[e.jsxs("g",{clipPath:"url(#social-linkedin_svg__clip0_537_833)",children:[e.jsx("path",{className:"social-linkedin_svg__linkedin",clipRule:"evenodd",d:"M1.778 16h12.444c.982 0 1.778-.796 1.778-1.778V1.778C16 .796 15.204 0 14.222 0H1.778C.796 0 0 .796 0 1.778v12.444C0 15.204.796 16 1.778 16z",fill:"#007ebb",fillRule:"evenodd"}),e.jsx("path",{clipRule:"evenodd",d:"M13.778 13.778h-2.374V9.734c0-1.109-.421-1.729-1.299-1.729-.955 0-1.453.645-1.453 1.729v4.044H6.363V6.074h2.289v1.038s.688-1.273 2.322-1.273c1.634 0 2.804.997 2.804 3.061v4.878zM3.634 5.065c-.78 0-1.411-.636-1.411-1.421s.631-1.422 1.41-1.422c.78 0 1.411.637 1.411 1.422 0 .785-.631 1.421-1.41 1.421zm-1.182 8.713h2.386V6.074H2.452v7.704z",fill:"#fff",fillRule:"evenodd"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"social-linkedin_svg__clip0_537_833",children:e.jsx("path",{d:"M0 0h16v16H0z",fill:"#fff"})})})]})})]}),e.jsxs(t,{className:"!ml-0 grow cursor-pointer",disabled:!s,type:"button",onClick:_,children:[o?e.jsx(P,{}):e.jsx(V,{}),o?"Copied!":"Copy link"]})]})})]})]})};export{I as P};
1
+ import{r as k,j as e,D as w,q as N,t as C,B as t,X as z,v as y,w as H,a9 as $,_ as M,aa as D,$ as P,ab as V}from"./index-CJU9a2PB.js";const I=({emailOnly:x=!1,postURL:s="",primaryTitle:m="Your post is published.",secondaryTitle:p="Spread the word!",description:a="",featureImageURL:i="",postTitle:r="",postExcerpt:n="",faviconURL:f="",siteTitle:g="",author:j="",onClose:c=()=>{},children:u,...v})=>{const[o,d]=k.useState(!1),_=async()=>{try{await navigator.clipboard.writeText(s),d(!0),setTimeout(()=>d(!1),2e3)}catch{}},h=encodeURIComponent(r),l=encodeURIComponent(s),b=encodeURIComponent(`${r} ${s}`);return e.jsxs(w,{...v,children:[e.jsx(N,{className:"cursor-pointer",asChild:!0,children:u}),e.jsxs(C,{className:"max-h-[calc(100vh-16vmin)] max-w-[540px] overflow-y-auto p-8",children:[e.jsx("div",{className:"sticky top-0 ml-auto size-0",children:e.jsx(t,{className:"absolute -right-5 -top-5 cursor-pointer p-2 text-muted-foreground hover:text-foreground [&_svg]:!size-6",size:"lg",variant:"link",onClick:c,children:e.jsx(z,{size:24,strokeWidth:1})})}),e.jsxs(y,{className:"relative -mt-5",children:[e.jsxs(H,{className:"text-3xl font-bold leading-[1.15em]",children:[e.jsx("span",{className:"text-green-500",children:m}),e.jsx("br",{}),e.jsx("span",{children:p})]}),a&&e.jsx($,{className:"mb-0 pb-0 pt-1 text-lg text-foreground",children:a})]}),e.jsxs("a",{className:"flex flex-col items-stretch overflow-hidden rounded-md border transition-all hover:border-muted-foreground/40",href:s,rel:"noopener noreferrer",target:"_blank",children:[i&&e.jsx("div",{className:"aspect-video bg-cover bg-center",style:{backgroundImage:`url(${i})`}}),e.jsxs("div",{className:"p-6 pt-5",children:[e.jsx(M,{children:r}),n&&e.jsx("p",{children:n}),e.jsxs("div",{className:"mt-2 flex items-start gap-2",children:[e.jsx("div",{className:"mt-0.5 size-4 bg-cover bg-center",style:{backgroundImage:`url(${f})`}}),e.jsxs("div",{className:"flex gap-1",children:[e.jsx("strong",{children:g}),e.jsx("span",{children:"•"}),e.jsx("span",{children:j})]})]})]})]}),e.jsx(D,{className:"justify-between gap-6",children:x?e.jsx(t,{className:"cursor-pointer",type:"submit",onClick:c,children:"Close"}):e.jsxs(e.Fragment,{children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`https://twitter.com/intent/tweet?text=${h}%0A${l}`,rel:"noopener noreferrer",target:"_blank",children:e.jsx("svg",{"aria-hidden":"true",viewBox:"0 0 24 24",children:e.jsx("path",{className:"social-x_svg__x",d:"M18.244 2.25h3.308l-7.227 8.26 8.502 11.24H16.17l-5.214-6.817L4.99 21.75H1.68l7.73-8.835L1.254 2.25H8.08l4.713 6.231zm-1.161 17.52h1.833L7.084 4.126H5.117z"})})}),e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`https://threads.net/intent/post?text=${b}`,rel:"noopener noreferrer",target:"_blank",children:e.jsxs("svg",{fill:"none",viewBox:"0 0 18 18",children:[e.jsx("g",{clipPath:"url(#social-threads_svg__clip0_351_18008)",children:e.jsx("path",{d:"M13.033 8.38a5.924 5.924 0 00-.223-.102c-.13-2.418-1.452-3.802-3.67-3.816h-.03c-1.327 0-2.43.566-3.11 1.597l1.22.837c.507-.77 1.304-.934 1.89-.934h.02c.73.004 1.282.217 1.639.63.26.302.433.72.519 1.245a9.334 9.334 0 00-2.097-.101c-2.109.121-3.465 1.351-3.374 3.06.047.868.478 1.614 1.216 2.1.624.413 1.428.614 2.263.568 1.103-.06 1.969-.48 2.572-1.25.459-.585.749-1.342.877-2.296.526.317.915.735 1.13 1.236.366.854.387 2.255-.756 3.398-1.003 1.002-2.207 1.435-4.028 1.448-2.02-.015-3.547-.663-4.54-1.925-.93-1.182-1.41-2.89-1.428-5.075.018-2.185.498-3.893 1.428-5.075.993-1.262 2.52-1.91 4.54-1.925 2.034.015 3.588.666 4.62 1.934.505.622.886 1.405 1.137 2.317l1.43-.382c-.305-1.122-.784-2.09-1.436-2.892C13.52 1.35 11.587.517 9.096.5h-.01C6.6.517 4.689 1.354 3.404 2.986 2.262 4.44 1.672 6.46 1.652 8.994v.012c.02 2.534.61 4.555 1.752 6.008C4.69 16.646 6.6 17.483 9.086 17.5h.01c2.21-.015 3.768-.594 5.051-1.876 1.68-1.678 1.629-3.78 1.075-5.07-.397-.927-1.154-1.678-2.189-2.175zm-3.816 3.587c-.924.052-1.884-.363-1.932-1.252-.035-.659.47-1.394 1.99-1.482a8.9 8.9 0 01.512-.014c.552 0 1.068.053 1.538.156-.175 2.187-1.203 2.542-2.108 2.592z",fill:"#000"})}),e.jsx("defs",{children:e.jsx("clipPath",{id:"social-threads_svg__clip0_351_18008",children:e.jsx("path",{d:"M0 0h17v17H0z",fill:"#fff",transform:"translate(.5 .5)"})})})]})}),e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`https://www.facebook.com/sharer/sharer.php?u=${l}`,rel:"noopener noreferrer",target:"_blank",children:e.jsxs("svg",{fill:"none",viewBox:"0 0 40 40",children:[e.jsx("title",{children:"social-facebook"}),e.jsx("path",{className:"social-facebook_svg__fb",d:"M20 40.004c11.046 0 20-8.955 20-20 0-11.046-8.954-20-20-20s-20 8.954-20 20c0 11.045 8.954 20 20 20z",fill:"#1977f3"}),e.jsx("path",{d:"M27.785 25.785l.886-5.782h-5.546V16.25c0-1.58.773-3.125 3.26-3.125h2.522V8.204s-2.29-.39-4.477-.39c-4.568 0-7.555 2.767-7.555 7.781v4.408h-5.08v5.782h5.08v13.976a20.08 20.08 0 003.125.242c1.063 0 2.107-.085 3.125-.242V25.785h4.66z",fill:"#fff"})]})}),e.jsx("a",{className:"flex h-[34px] w-14 items-center justify-center rounded-sm bg-muted px-3 hover:bg-muted-foreground/20 [&_svg]:h-4",href:`http://www.linkedin.com/shareArticle?mini=true&title=${h}&url=${l}`,rel:"noopener noreferrer",target:"_blank",children:e.jsxs("svg",{fill:"none",viewBox:"0 0 16 16",children:[e.jsxs("g",{clipPath:"url(#social-linkedin_svg__clip0_537_833)",children:[e.jsx("path",{className:"social-linkedin_svg__linkedin",clipRule:"evenodd",d:"M1.778 16h12.444c.982 0 1.778-.796 1.778-1.778V1.778C16 .796 15.204 0 14.222 0H1.778C.796 0 0 .796 0 1.778v12.444C0 15.204.796 16 1.778 16z",fill:"#007ebb",fillRule:"evenodd"}),e.jsx("path",{clipRule:"evenodd",d:"M13.778 13.778h-2.374V9.734c0-1.109-.421-1.729-1.299-1.729-.955 0-1.453.645-1.453 1.729v4.044H6.363V6.074h2.289v1.038s.688-1.273 2.322-1.273c1.634 0 2.804.997 2.804 3.061v4.878zM3.634 5.065c-.78 0-1.411-.636-1.411-1.421s.631-1.422 1.41-1.422c.78 0 1.411.637 1.411 1.422 0 .785-.631 1.421-1.41 1.421zm-1.182 8.713h2.386V6.074H2.452v7.704z",fill:"#fff",fillRule:"evenodd"})]}),e.jsx("defs",{children:e.jsx("clipPath",{id:"social-linkedin_svg__clip0_537_833",children:e.jsx("path",{d:"M0 0h16v16H0z",fill:"#fff"})})})]})})]}),e.jsxs(t,{className:"!ml-0 grow cursor-pointer",disabled:!s,type:"button",onClick:_,children:[o?e.jsx(P,{}):e.jsx(V,{}),o?"Copied!":"Copy link"]})]})})]})]})};export{I as P};
@@ -1 +1 @@
1
- import{ac as e,ad as o,ae as a}from"./index-BYawr8p9.js";const t="PostsResponseType",r=e({dataType:t,path:"/posts/"}),c=a({dataType:t,path:s=>`/posts/${s}/`}),n=e({dataType:t,path:"/posts/export/"}),u=o({method:"DELETE",path:s=>`/posts/${s}/`});export{u as a,n as b,c as g,r as u};
1
+ import{ac as e,ad as o,ae as a}from"./index-CJU9a2PB.js";const t="PostsResponseType",r=e({dataType:t,path:"/posts/"}),c=a({dataType:t,path:s=>`/posts/${s}/`}),n=e({dataType:t,path:"/posts/export/"}),u=o({method:"DELETE",path:s=>`/posts/${s}/`});export{u as a,n as b,c as g,r as u};
@@ -1 +1 @@
1
- import{ac as e}from"./index-BYawr8p9.js";const r="ReferrerHistoryResponseType",t=e({dataType:r,path:"/stats/referrers/"}),o=e({dataType:"TopSourcesGrowthResponseType",path:"/stats/top-sources-growth"});export{t as a,o as u};
1
+ import{ac as e}from"./index-CJU9a2PB.js";const r="ReferrerHistoryResponseType",t=e({dataType:r,path:"/stats/referrers/"}),o=e({dataType:"TopSourcesGrowthResponseType",path:"/stats/top-sources-growth"});export{t as a,o as u};
@@ -1,4 +1,4 @@
1
- import{aA as e}from"./index-BYawr8p9.js";/**
1
+ import{aA as e}from"./index-CJU9a2PB.js";/**
2
2
  * @license lucide-react v0.553.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1,4 +1,4 @@
1
- import{aA as e}from"./index-BYawr8p9.js";/**
1
+ import{aA as e}from"./index-CJU9a2PB.js";/**
2
2
  * @license lucide-react v0.553.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
@@ -1 +1 @@
1
- import{r as o,b7 as Pe,aq as mt,ar as Te,j as r,b8 as ht,as as gt,at as be,b9 as vt,ba as L,bb as $,au as j,bc as xt,bd as St,be as wt,ay as N,bf as yt,aB as Re,bg as Ct,bh as bt,bi as It,bj as Tt,bk as Nt,bl as Pt,bm as Rt,bn as Et,bo as _t,y as G,bp as Ee,bq as jt,$ as Mt}from"./index-BYawr8p9.js";import{C as At}from"./message-square-text-CaMVBVPr.js";function Ne(t,[n,e]){return Math.min(e,Math.max(n,t))}var Ot=[" ","Enter","ArrowUp","ArrowDown"],Dt=[" ","Enter"],Q="Select",[ie,de,Lt]=vt(Q),[oe]=gt(Q,[Lt,Pe]),ue=Pe(),[kt,Y]=oe(Q),[Bt,Vt]=oe(Q),_e=t=>{const{__scopeSelect:n,children:e,open:l,defaultOpen:a,onOpenChange:u,value:s,defaultValue:c,onValueChange:i,dir:f,name:v,autoComplete:w,disabled:P,required:I,form:C}=t,d=ue(n),[h,x]=o.useState(null),[m,g]=o.useState(null),[F,M]=o.useState(!1),ne=mt(f),[R,O]=Te({prop:l,defaultProp:a??!1,onChange:u,caller:Q}),[W,X]=Te({prop:s,defaultProp:c,onChange:i,caller:Q}),k=o.useRef(null),B=h?C||!!h.closest("form"):!0,[K,V]=o.useState(new Set),H=Array.from(K).map(E=>E.props.value).join(";");return r.jsx(ht,{...d,children:r.jsxs(kt,{required:I,scope:n,trigger:h,onTriggerChange:x,valueNode:m,onValueNodeChange:g,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:be(),value:W,onValueChange:X,open:R,onOpenChange:O,dir:ne,triggerPointerDownPosRef:k,disabled:P,children:[r.jsx(ie.Provider,{scope:n,children:r.jsx(Bt,{scope:t.__scopeSelect,onNativeOptionAdd:o.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:o.useCallback(E=>{V(D=>{const U=new Set(D);return U.delete(E),U})},[]),children:e})}),B?r.jsxs(tt,{"aria-hidden":!0,required:I,tabIndex:-1,name:v,autoComplete:w,value:W,onChange:E=>X(E.target.value),disabled:P,form:C,children:[W===void 0?r.jsx("option",{value:""}):null,Array.from(K)]},H):null]})})};_e.displayName=Q;var je="SelectTrigger",Me=o.forwardRef((t,n)=>{const{__scopeSelect:e,disabled:l=!1,...a}=t,u=ue(e),s=Y(je,e),c=s.disabled||l,i=L(n,s.onTriggerChange),f=de(e),v=o.useRef("touch"),[w,P,I]=nt(d=>{const h=f().filter(g=>!g.disabled),x=h.find(g=>g.value===s.value),m=rt(h,d,x);m!==void 0&&s.onValueChange(m.value)}),C=d=>{c||(s.onOpenChange(!0),I()),d&&(s.triggerPointerDownPosRef.current={x:Math.round(d.pageX),y:Math.round(d.pageY)})};return r.jsx(wt,{asChild:!0,...u,children:r.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":ot(s.value)?"":void 0,...a,ref:i,onClick:N(a.onClick,d=>{d.currentTarget.focus(),v.current!=="mouse"&&C(d)}),onPointerDown:N(a.onPointerDown,d=>{v.current=d.pointerType;const h=d.target;h.hasPointerCapture(d.pointerId)&&h.releasePointerCapture(d.pointerId),d.button===0&&d.ctrlKey===!1&&d.pointerType==="mouse"&&(C(d),d.preventDefault())}),onKeyDown:N(a.onKeyDown,d=>{const h=w.current!=="";!(d.ctrlKey||d.altKey||d.metaKey)&&d.key.length===1&&P(d.key),!(h&&d.key===" ")&&Ot.includes(d.key)&&(C(),d.preventDefault())})})})});Me.displayName=je;var Ae="SelectValue",Oe=o.forwardRef((t,n)=>{const{__scopeSelect:e,className:l,style:a,children:u,placeholder:s="",...c}=t,i=Y(Ae,e),{onValueNodeHasChildrenChange:f}=i,v=u!==void 0,w=L(n,i.onValueNodeChange);return $(()=>{f(v)},[f,v]),r.jsx(j.span,{...c,ref:w,style:{pointerEvents:"none"},children:ot(i.value)?r.jsx(r.Fragment,{children:s}):u})});Oe.displayName=Ae;var Ht="SelectIcon",De=o.forwardRef((t,n)=>{const{__scopeSelect:e,children:l,...a}=t;return r.jsx(j.span,{"aria-hidden":!0,...a,ref:n,children:l||"▼"})});De.displayName=Ht;var Ut="SelectPortal",Le=t=>r.jsx(yt,{asChild:!0,...t});Le.displayName=Ut;var ee="SelectContent",ke=o.forwardRef((t,n)=>{const e=Y(ee,t.__scopeSelect),[l,a]=o.useState();if($(()=>{a(new DocumentFragment)},[]),!e.open){const u=l;return u?Re.createPortal(r.jsx(Be,{scope:t.__scopeSelect,children:r.jsx(ie.Slot,{scope:t.__scopeSelect,children:r.jsx("div",{children:t.children})})}),u):null}return r.jsx(Ve,{...t,ref:n})});ke.displayName=ee;var A=10,[Be,q]=oe(ee),Ft="SelectContentImpl",Wt=Nt("SelectContent.RemoveScroll"),Ve=o.forwardRef((t,n)=>{const{__scopeSelect:e,position:l="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:u,onPointerDownOutside:s,side:c,sideOffset:i,align:f,alignOffset:v,arrowPadding:w,collisionBoundary:P,collisionPadding:I,sticky:C,hideWhenDetached:d,avoidCollisions:h,...x}=t,m=Y(ee,e),[g,F]=o.useState(null),[M,ne]=o.useState(null),R=L(n,p=>F(p)),[O,W]=o.useState(null),[X,k]=o.useState(null),B=de(e),[K,V]=o.useState(!1),H=o.useRef(!1);o.useEffect(()=>{if(g)return bt(g)},[g]),It();const E=o.useCallback(p=>{const[b,..._]=B().map(T=>T.ref.current),[S]=_.slice(-1),y=document.activeElement;for(const T of p)if(T===y||(T?.scrollIntoView({block:"nearest"}),T===b&&M&&(M.scrollTop=0),T===S&&M&&(M.scrollTop=M.scrollHeight),T?.focus(),document.activeElement!==y))return},[B,M]),D=o.useCallback(()=>E([O,g]),[E,O,g]);o.useEffect(()=>{K&&D()},[K,D]);const{onOpenChange:U,triggerPointerDownPosRef:z}=m;o.useEffect(()=>{if(g){let p={x:0,y:0};const b=S=>{p={x:Math.abs(Math.round(S.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(S.pageY)-(z.current?.y??0))}},_=S=>{p.x<=10&&p.y<=10?S.preventDefault():g.contains(S.target)||U(!1),document.removeEventListener("pointermove",b),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",b),document.addEventListener("pointerup",_,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",_,{capture:!0})}}},[g,U,z]),o.useEffect(()=>{const p=()=>U(!1);return window.addEventListener("blur",p),window.addEventListener("resize",p),()=>{window.removeEventListener("blur",p),window.removeEventListener("resize",p)}},[U]);const[pe,ae]=nt(p=>{const b=B().filter(y=>!y.disabled),_=b.find(y=>y.ref.current===document.activeElement),S=rt(b,p,_);S&&setTimeout(()=>S.ref.current.focus())}),fe=o.useCallback((p,b,_)=>{const S=!H.current&&!_;(m.value!==void 0&&m.value===b||S)&&(W(p),S&&(H.current=!0))},[m.value]),me=o.useCallback(()=>g?.focus(),[g]),te=o.useCallback((p,b,_)=>{const S=!H.current&&!_;(m.value!==void 0&&m.value===b||S)&&k(p)},[m.value]),le=l==="popper"?xe:He,re=le===xe?{side:c,sideOffset:i,align:f,alignOffset:v,arrowPadding:w,collisionBoundary:P,collisionPadding:I,sticky:C,hideWhenDetached:d,avoidCollisions:h}:{};return r.jsx(Be,{scope:e,content:g,viewport:M,onViewportChange:ne,itemRefCallback:fe,selectedItem:O,onItemLeave:me,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:X,position:l,isPositioned:K,searchRef:pe,children:r.jsx(Tt,{as:Wt,allowPinchZoom:!0,children:r.jsx(Pt,{asChild:!0,trapped:m.open,onMountAutoFocus:p=>{p.preventDefault()},onUnmountAutoFocus:N(a,p=>{m.trigger?.focus({preventScroll:!0}),p.preventDefault()}),children:r.jsx(Rt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:s,onFocusOutside:p=>p.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:r.jsx(le,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:p=>p.preventDefault(),...x,...re,onPlaced:()=>V(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:N(x.onKeyDown,p=>{const b=p.ctrlKey||p.altKey||p.metaKey;if(p.key==="Tab"&&p.preventDefault(),!b&&p.key.length===1&&ae(p.key),["ArrowUp","ArrowDown","Home","End"].includes(p.key)){let S=B().filter(y=>!y.disabled).map(y=>y.ref.current);if(["ArrowUp","End"].includes(p.key)&&(S=S.slice().reverse()),["ArrowUp","ArrowDown"].includes(p.key)){const y=p.target,T=S.indexOf(y);S=S.slice(T+1)}setTimeout(()=>E(S)),p.preventDefault()}})})})})})})});Ve.displayName=Ft;var Kt="SelectItemAlignedPosition",He=o.forwardRef((t,n)=>{const{__scopeSelect:e,onPlaced:l,...a}=t,u=Y(ee,e),s=q(ee,e),[c,i]=o.useState(null),[f,v]=o.useState(null),w=L(n,R=>v(R)),P=de(e),I=o.useRef(!1),C=o.useRef(!0),{viewport:d,selectedItem:h,selectedItemText:x,focusSelectedItem:m}=s,g=o.useCallback(()=>{if(u.trigger&&u.valueNode&&c&&f&&d&&h&&x){const R=u.trigger.getBoundingClientRect(),O=f.getBoundingClientRect(),W=u.valueNode.getBoundingClientRect(),X=x.getBoundingClientRect();if(u.dir!=="rtl"){const y=X.left-O.left,T=W.left-y,Z=R.left-T,J=R.width+Z,he=Math.max(J,O.width),ge=window.innerWidth-A,ve=Ne(T,[A,Math.max(A,ge-he)]);c.style.minWidth=J+"px",c.style.left=ve+"px"}else{const y=O.right-X.right,T=window.innerWidth-W.right-y,Z=window.innerWidth-R.right-T,J=R.width+Z,he=Math.max(J,O.width),ge=window.innerWidth-A,ve=Ne(T,[A,Math.max(A,ge-he)]);c.style.minWidth=J+"px",c.style.right=ve+"px"}const k=P(),B=window.innerHeight-A*2,K=d.scrollHeight,V=window.getComputedStyle(f),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),U=parseInt(V.paddingBottom,10),z=H+E+K+U+D,pe=Math.min(h.offsetHeight*5,z),ae=window.getComputedStyle(d),fe=parseInt(ae.paddingTop,10),me=parseInt(ae.paddingBottom,10),te=R.top+R.height/2-A,le=B-te,re=h.offsetHeight/2,p=h.offsetTop+re,b=H+E+p,_=z-b;if(b<=te){const y=k.length>0&&h===k[k.length-1].ref.current;c.style.bottom="0px";const T=f.clientHeight-d.offsetTop-d.offsetHeight,Z=Math.max(le,re+(y?me:0)+T+D),J=b+Z;c.style.height=J+"px"}else{const y=k.length>0&&h===k[0].ref.current;c.style.top="0px";const Z=Math.max(te,H+d.offsetTop+(y?fe:0)+re)+_;c.style.height=Z+"px",d.scrollTop=b-te+d.offsetTop}c.style.margin=`${A}px 0`,c.style.minHeight=pe+"px",c.style.maxHeight=B+"px",l?.(),requestAnimationFrame(()=>I.current=!0)}},[P,u.trigger,u.valueNode,c,f,d,h,x,u.dir,l]);$(()=>g(),[g]);const[F,M]=o.useState();$(()=>{f&&M(window.getComputedStyle(f).zIndex)},[f]);const ne=o.useCallback(R=>{R&&C.current===!0&&(g(),m?.(),C.current=!1)},[g,m]);return r.jsx($t,{scope:e,contentWrapper:c,shouldExpandOnScrollRef:I,onScrollButtonChange:ne,children:r.jsx("div",{ref:i,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:r.jsx(j.div,{...a,ref:w,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});He.displayName=Kt;var zt="SelectPopperPosition",xe=o.forwardRef((t,n)=>{const{__scopeSelect:e,align:l="start",collisionPadding:a=A,...u}=t,s=ue(e);return r.jsx(Et,{...s,...u,ref:n,align:l,collisionPadding:a,style:{boxSizing:"border-box",...u.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xe.displayName=zt;var[$t,Ie]=oe(ee,{}),Se="SelectViewport",Ue=o.forwardRef((t,n)=>{const{__scopeSelect:e,nonce:l,...a}=t,u=q(Se,e),s=Ie(Se,e),c=L(n,u.onViewportChange),i=o.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),r.jsx(ie.Slot,{scope:e,children:r.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:N(a.onScroll,f=>{const v=f.currentTarget,{contentWrapper:w,shouldExpandOnScrollRef:P}=s;if(P?.current&&w){const I=Math.abs(i.current-v.scrollTop);if(I>0){const C=window.innerHeight-A*2,d=parseFloat(w.style.minHeight),h=parseFloat(w.style.height),x=Math.max(d,h);if(x<C){const m=x+I,g=Math.min(C,m),F=m-g;w.style.height=g+"px",w.style.bottom==="0px"&&(v.scrollTop=F>0?F:0,w.style.justifyContent="flex-end")}}}i.current=v.scrollTop})})})]})});Ue.displayName=Se;var Fe="SelectGroup",[Gt,Yt]=oe(Fe),We=o.forwardRef((t,n)=>{const{__scopeSelect:e,...l}=t,a=be();return r.jsx(Gt,{scope:e,id:a,children:r.jsx(j.div,{role:"group","aria-labelledby":a,...l,ref:n})})});We.displayName=Fe;var Ke="SelectLabel",ze=o.forwardRef((t,n)=>{const{__scopeSelect:e,...l}=t,a=Yt(Ke,e);return r.jsx(j.div,{id:a.id,...l,ref:n})});ze.displayName=Ke;var ce="SelectItem",[qt,$e]=oe(ce),Ge=o.forwardRef((t,n)=>{const{__scopeSelect:e,value:l,disabled:a=!1,textValue:u,...s}=t,c=Y(ce,e),i=q(ce,e),f=c.value===l,[v,w]=o.useState(u??""),[P,I]=o.useState(!1),C=L(n,m=>i.itemRefCallback?.(m,l,a)),d=be(),h=o.useRef("touch"),x=()=>{a||(c.onValueChange(l),c.onOpenChange(!1))};if(l==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(qt,{scope:e,value:l,disabled:a,textId:d,isSelected:f,onItemTextChange:o.useCallback(m=>{w(g=>g||(m?.textContent??"").trim())},[]),children:r.jsx(ie.ItemSlot,{scope:e,value:l,disabled:a,textValue:v,children:r.jsx(j.div,{role:"option","aria-labelledby":d,"data-highlighted":P?"":void 0,"aria-selected":f&&P,"data-state":f?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...s,ref:C,onFocus:N(s.onFocus,()=>I(!0)),onBlur:N(s.onBlur,()=>I(!1)),onClick:N(s.onClick,()=>{h.current!=="mouse"&&x()}),onPointerUp:N(s.onPointerUp,()=>{h.current==="mouse"&&x()}),onPointerDown:N(s.onPointerDown,m=>{h.current=m.pointerType}),onPointerMove:N(s.onPointerMove,m=>{h.current=m.pointerType,a?i.onItemLeave?.():h.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:N(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&i.onItemLeave?.()}),onKeyDown:N(s.onKeyDown,m=>{i.searchRef?.current!==""&&m.key===" "||(Dt.includes(m.key)&&x(),m.key===" "&&m.preventDefault())})})})})});Ge.displayName=ce;var se="SelectItemText",Ye=o.forwardRef((t,n)=>{const{__scopeSelect:e,className:l,style:a,...u}=t,s=Y(se,e),c=q(se,e),i=$e(se,e),f=Vt(se,e),[v,w]=o.useState(null),P=L(n,x=>w(x),i.onItemTextChange,x=>c.itemTextRefCallback?.(x,i.value,i.disabled)),I=v?.textContent,C=o.useMemo(()=>r.jsx("option",{value:i.value,disabled:i.disabled,children:I},i.value),[i.disabled,i.value,I]),{onNativeOptionAdd:d,onNativeOptionRemove:h}=f;return $(()=>(d(C),()=>h(C)),[d,h,C]),r.jsxs(r.Fragment,{children:[r.jsx(j.span,{id:i.textId,...u,ref:P}),i.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Re.createPortal(u.children,s.valueNode):null]})});Ye.displayName=se;var qe="SelectItemIndicator",Xe=o.forwardRef((t,n)=>{const{__scopeSelect:e,...l}=t;return $e(qe,e).isSelected?r.jsx(j.span,{"aria-hidden":!0,...l,ref:n}):null});Xe.displayName=qe;var we="SelectScrollUpButton",Ze=o.forwardRef((t,n)=>{const e=q(we,t.__scopeSelect),l=Ie(we,t.__scopeSelect),[a,u]=o.useState(!1),s=L(n,l.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let c=function(){const f=i.scrollTop>0;u(f)};const i=e.viewport;return c(),i.addEventListener("scroll",c),()=>i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),a?r.jsx(Qe,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop-i.offsetHeight)}}):null});Ze.displayName=we;var ye="SelectScrollDownButton",Je=o.forwardRef((t,n)=>{const e=q(ye,t.__scopeSelect),l=Ie(ye,t.__scopeSelect),[a,u]=o.useState(!1),s=L(n,l.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let c=function(){const f=i.scrollHeight-i.clientHeight,v=Math.ceil(i.scrollTop)<f;u(v)};const i=e.viewport;return c(),i.addEventListener("scroll",c),()=>i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),a?r.jsx(Qe,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop+i.offsetHeight)}}):null});Je.displayName=ye;var Qe=o.forwardRef((t,n)=>{const{__scopeSelect:e,onAutoScroll:l,...a}=t,u=q("SelectScrollButton",e),s=o.useRef(null),c=de(e),i=o.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return o.useEffect(()=>()=>i(),[i]),$(()=>{c().find(v=>v.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),r.jsx(j.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:N(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(l,50))}),onPointerMove:N(a.onPointerMove,()=>{u.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(l,50))}),onPointerLeave:N(a.onPointerLeave,()=>{i()})})}),Xt="SelectSeparator",et=o.forwardRef((t,n)=>{const{__scopeSelect:e,...l}=t;return r.jsx(j.div,{"aria-hidden":!0,...l,ref:n})});et.displayName=Xt;var Ce="SelectArrow",Zt=o.forwardRef((t,n)=>{const{__scopeSelect:e,...l}=t,a=ue(e),u=Y(Ce,e),s=q(Ce,e);return u.open&&s.position==="popper"?r.jsx(_t,{...a,...l,ref:n}):null});Zt.displayName=Ce;var Jt="SelectBubbleInput",tt=o.forwardRef(({__scopeSelect:t,value:n,...e},l)=>{const a=o.useRef(null),u=L(l,a),s=xt(n);return o.useEffect(()=>{const c=a.current;if(!c)return;const i=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(i,"value").set;if(s!==n&&v){const w=new Event("change",{bubbles:!0});v.call(c,n),c.dispatchEvent(w)}},[s,n]),r.jsx(j.select,{...e,style:{...St,...e.style},ref:u,defaultValue:n})});tt.displayName=Jt;function ot(t){return t===""||t===void 0}function nt(t){const n=Ct(t),e=o.useRef(""),l=o.useRef(0),a=o.useCallback(s=>{const c=e.current+s;n(c),(function i(f){e.current=f,window.clearTimeout(l.current),f!==""&&(l.current=window.setTimeout(()=>i(""),1e3))})(c)},[n]),u=o.useCallback(()=>{e.current="",window.clearTimeout(l.current)},[]);return o.useEffect(()=>()=>window.clearTimeout(l.current),[]),[e,a,u]}function rt(t,n,e){const a=n.length>1&&Array.from(n).every(f=>f===n[0])?n[0]:n,u=e?t.indexOf(e):-1;let s=Qt(t,Math.max(u,0));a.length===1&&(s=s.filter(f=>f!==e));const i=s.find(f=>f.textValue.toLowerCase().startsWith(a.toLowerCase()));return i!==e?i:void 0}function Qt(t,n){return t.map((e,l)=>t[(n+l)%t.length])}var eo=_e,st=Me,to=Oe,oo=De,no=Le,at=ke,ro=Ue,so=We,lt=ze,ct=Ge,ao=Ye,lo=Xe,it=Ze,dt=Je,ut=et;const go=eo,vo=so,xo=to,co=o.forwardRef(({className:t,children:n,...e},l)=>r.jsxs(st,{ref:l,className:G("flex h-[34px] w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent hover:bg-accent px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...e,children:[n,r.jsx(oo,{asChild:!0,children:r.jsx(Ee,{className:"-mr-0.5 ml-1 size-4 opacity-50"})})]}));co.displayName=st.displayName;const pt=o.forwardRef(({className:t,...n},e)=>r.jsx(it,{ref:e,className:G("flex cursor-default items-center justify-center py-1",t),...n,children:r.jsx(At,{className:"size-4"})}));pt.displayName=it.displayName;const ft=o.forwardRef(({className:t,...n},e)=>r.jsx(dt,{ref:e,className:G("flex cursor-default items-center justify-center py-1",t),...n,children:r.jsx(Ee,{className:"size-4"})}));ft.displayName=dt.displayName;const io=o.forwardRef(({className:t,children:n,position:e="popper",...l},a)=>r.jsx(no,{children:r.jsx("div",{className:jt,children:r.jsxs(at,{ref:a,className:G("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",e==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:e,...l,children:[r.jsx(pt,{}),r.jsx(ro,{className:G("p-1",e==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),r.jsx(ft,{})]})})}));io.displayName=at.displayName;const uo=o.forwardRef(({className:t,...n},e)=>r.jsx(lt,{ref:e,className:G("px-2 py-1.5 text-sm font-semibold",t),...n}));uo.displayName=lt.displayName;const po=o.forwardRef(({className:t,children:n,...e},l)=>r.jsxs(ct,{ref:l,className:G("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...e,children:[r.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:r.jsx(lo,{children:r.jsx(Mt,{className:"size-4"})})}),r.jsx(ao,{children:n})]}));po.displayName=ct.displayName;const fo=o.forwardRef(({className:t,...n},e)=>r.jsx(ut,{ref:e,className:G("-mx-1 my-1 h-px bg-muted",t),...n}));fo.displayName=ut.displayName;export{go as S,co as a,xo as b,io as c,vo as d,uo as e,po as f};
1
+ import{r as o,b7 as Pe,aq as mt,ar as Te,j as r,b8 as ht,as as gt,at as be,b9 as vt,ba as L,bb as $,au as j,bc as xt,bd as St,be as wt,ay as N,bf as yt,aB as Re,bg as Ct,bh as bt,bi as It,bj as Tt,bk as Nt,bl as Pt,bm as Rt,bn as Et,bo as _t,y as G,bp as Ee,bq as jt,$ as Mt}from"./index-CJU9a2PB.js";import{C as At}from"./message-square-text-CS3iRuPc.js";function Ne(t,[n,e]){return Math.min(e,Math.max(n,t))}var Ot=[" ","Enter","ArrowUp","ArrowDown"],Dt=[" ","Enter"],Q="Select",[ie,de,Lt]=vt(Q),[oe]=gt(Q,[Lt,Pe]),ue=Pe(),[kt,Y]=oe(Q),[Bt,Vt]=oe(Q),_e=t=>{const{__scopeSelect:n,children:e,open:l,defaultOpen:a,onOpenChange:u,value:s,defaultValue:c,onValueChange:i,dir:f,name:v,autoComplete:w,disabled:P,required:I,form:C}=t,d=ue(n),[h,x]=o.useState(null),[m,g]=o.useState(null),[F,M]=o.useState(!1),ne=mt(f),[R,O]=Te({prop:l,defaultProp:a??!1,onChange:u,caller:Q}),[W,X]=Te({prop:s,defaultProp:c,onChange:i,caller:Q}),k=o.useRef(null),B=h?C||!!h.closest("form"):!0,[K,V]=o.useState(new Set),H=Array.from(K).map(E=>E.props.value).join(";");return r.jsx(ht,{...d,children:r.jsxs(kt,{required:I,scope:n,trigger:h,onTriggerChange:x,valueNode:m,onValueNodeChange:g,valueNodeHasChildren:F,onValueNodeHasChildrenChange:M,contentId:be(),value:W,onValueChange:X,open:R,onOpenChange:O,dir:ne,triggerPointerDownPosRef:k,disabled:P,children:[r.jsx(ie.Provider,{scope:n,children:r.jsx(Bt,{scope:t.__scopeSelect,onNativeOptionAdd:o.useCallback(E=>{V(D=>new Set(D).add(E))},[]),onNativeOptionRemove:o.useCallback(E=>{V(D=>{const U=new Set(D);return U.delete(E),U})},[]),children:e})}),B?r.jsxs(tt,{"aria-hidden":!0,required:I,tabIndex:-1,name:v,autoComplete:w,value:W,onChange:E=>X(E.target.value),disabled:P,form:C,children:[W===void 0?r.jsx("option",{value:""}):null,Array.from(K)]},H):null]})})};_e.displayName=Q;var je="SelectTrigger",Me=o.forwardRef((t,n)=>{const{__scopeSelect:e,disabled:l=!1,...a}=t,u=ue(e),s=Y(je,e),c=s.disabled||l,i=L(n,s.onTriggerChange),f=de(e),v=o.useRef("touch"),[w,P,I]=nt(d=>{const h=f().filter(g=>!g.disabled),x=h.find(g=>g.value===s.value),m=rt(h,d,x);m!==void 0&&s.onValueChange(m.value)}),C=d=>{c||(s.onOpenChange(!0),I()),d&&(s.triggerPointerDownPosRef.current={x:Math.round(d.pageX),y:Math.round(d.pageY)})};return r.jsx(wt,{asChild:!0,...u,children:r.jsx(j.button,{type:"button",role:"combobox","aria-controls":s.contentId,"aria-expanded":s.open,"aria-required":s.required,"aria-autocomplete":"none",dir:s.dir,"data-state":s.open?"open":"closed",disabled:c,"data-disabled":c?"":void 0,"data-placeholder":ot(s.value)?"":void 0,...a,ref:i,onClick:N(a.onClick,d=>{d.currentTarget.focus(),v.current!=="mouse"&&C(d)}),onPointerDown:N(a.onPointerDown,d=>{v.current=d.pointerType;const h=d.target;h.hasPointerCapture(d.pointerId)&&h.releasePointerCapture(d.pointerId),d.button===0&&d.ctrlKey===!1&&d.pointerType==="mouse"&&(C(d),d.preventDefault())}),onKeyDown:N(a.onKeyDown,d=>{const h=w.current!=="";!(d.ctrlKey||d.altKey||d.metaKey)&&d.key.length===1&&P(d.key),!(h&&d.key===" ")&&Ot.includes(d.key)&&(C(),d.preventDefault())})})})});Me.displayName=je;var Ae="SelectValue",Oe=o.forwardRef((t,n)=>{const{__scopeSelect:e,className:l,style:a,children:u,placeholder:s="",...c}=t,i=Y(Ae,e),{onValueNodeHasChildrenChange:f}=i,v=u!==void 0,w=L(n,i.onValueNodeChange);return $(()=>{f(v)},[f,v]),r.jsx(j.span,{...c,ref:w,style:{pointerEvents:"none"},children:ot(i.value)?r.jsx(r.Fragment,{children:s}):u})});Oe.displayName=Ae;var Ht="SelectIcon",De=o.forwardRef((t,n)=>{const{__scopeSelect:e,children:l,...a}=t;return r.jsx(j.span,{"aria-hidden":!0,...a,ref:n,children:l||"▼"})});De.displayName=Ht;var Ut="SelectPortal",Le=t=>r.jsx(yt,{asChild:!0,...t});Le.displayName=Ut;var ee="SelectContent",ke=o.forwardRef((t,n)=>{const e=Y(ee,t.__scopeSelect),[l,a]=o.useState();if($(()=>{a(new DocumentFragment)},[]),!e.open){const u=l;return u?Re.createPortal(r.jsx(Be,{scope:t.__scopeSelect,children:r.jsx(ie.Slot,{scope:t.__scopeSelect,children:r.jsx("div",{children:t.children})})}),u):null}return r.jsx(Ve,{...t,ref:n})});ke.displayName=ee;var A=10,[Be,q]=oe(ee),Ft="SelectContentImpl",Wt=Nt("SelectContent.RemoveScroll"),Ve=o.forwardRef((t,n)=>{const{__scopeSelect:e,position:l="item-aligned",onCloseAutoFocus:a,onEscapeKeyDown:u,onPointerDownOutside:s,side:c,sideOffset:i,align:f,alignOffset:v,arrowPadding:w,collisionBoundary:P,collisionPadding:I,sticky:C,hideWhenDetached:d,avoidCollisions:h,...x}=t,m=Y(ee,e),[g,F]=o.useState(null),[M,ne]=o.useState(null),R=L(n,p=>F(p)),[O,W]=o.useState(null),[X,k]=o.useState(null),B=de(e),[K,V]=o.useState(!1),H=o.useRef(!1);o.useEffect(()=>{if(g)return bt(g)},[g]),It();const E=o.useCallback(p=>{const[b,..._]=B().map(T=>T.ref.current),[S]=_.slice(-1),y=document.activeElement;for(const T of p)if(T===y||(T?.scrollIntoView({block:"nearest"}),T===b&&M&&(M.scrollTop=0),T===S&&M&&(M.scrollTop=M.scrollHeight),T?.focus(),document.activeElement!==y))return},[B,M]),D=o.useCallback(()=>E([O,g]),[E,O,g]);o.useEffect(()=>{K&&D()},[K,D]);const{onOpenChange:U,triggerPointerDownPosRef:z}=m;o.useEffect(()=>{if(g){let p={x:0,y:0};const b=S=>{p={x:Math.abs(Math.round(S.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(S.pageY)-(z.current?.y??0))}},_=S=>{p.x<=10&&p.y<=10?S.preventDefault():g.contains(S.target)||U(!1),document.removeEventListener("pointermove",b),z.current=null};return z.current!==null&&(document.addEventListener("pointermove",b),document.addEventListener("pointerup",_,{capture:!0,once:!0})),()=>{document.removeEventListener("pointermove",b),document.removeEventListener("pointerup",_,{capture:!0})}}},[g,U,z]),o.useEffect(()=>{const p=()=>U(!1);return window.addEventListener("blur",p),window.addEventListener("resize",p),()=>{window.removeEventListener("blur",p),window.removeEventListener("resize",p)}},[U]);const[pe,ae]=nt(p=>{const b=B().filter(y=>!y.disabled),_=b.find(y=>y.ref.current===document.activeElement),S=rt(b,p,_);S&&setTimeout(()=>S.ref.current.focus())}),fe=o.useCallback((p,b,_)=>{const S=!H.current&&!_;(m.value!==void 0&&m.value===b||S)&&(W(p),S&&(H.current=!0))},[m.value]),me=o.useCallback(()=>g?.focus(),[g]),te=o.useCallback((p,b,_)=>{const S=!H.current&&!_;(m.value!==void 0&&m.value===b||S)&&k(p)},[m.value]),le=l==="popper"?xe:He,re=le===xe?{side:c,sideOffset:i,align:f,alignOffset:v,arrowPadding:w,collisionBoundary:P,collisionPadding:I,sticky:C,hideWhenDetached:d,avoidCollisions:h}:{};return r.jsx(Be,{scope:e,content:g,viewport:M,onViewportChange:ne,itemRefCallback:fe,selectedItem:O,onItemLeave:me,itemTextRefCallback:te,focusSelectedItem:D,selectedItemText:X,position:l,isPositioned:K,searchRef:pe,children:r.jsx(Tt,{as:Wt,allowPinchZoom:!0,children:r.jsx(Pt,{asChild:!0,trapped:m.open,onMountAutoFocus:p=>{p.preventDefault()},onUnmountAutoFocus:N(a,p=>{m.trigger?.focus({preventScroll:!0}),p.preventDefault()}),children:r.jsx(Rt,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:u,onPointerDownOutside:s,onFocusOutside:p=>p.preventDefault(),onDismiss:()=>m.onOpenChange(!1),children:r.jsx(le,{role:"listbox",id:m.contentId,"data-state":m.open?"open":"closed",dir:m.dir,onContextMenu:p=>p.preventDefault(),...x,...re,onPlaced:()=>V(!0),ref:R,style:{display:"flex",flexDirection:"column",outline:"none",...x.style},onKeyDown:N(x.onKeyDown,p=>{const b=p.ctrlKey||p.altKey||p.metaKey;if(p.key==="Tab"&&p.preventDefault(),!b&&p.key.length===1&&ae(p.key),["ArrowUp","ArrowDown","Home","End"].includes(p.key)){let S=B().filter(y=>!y.disabled).map(y=>y.ref.current);if(["ArrowUp","End"].includes(p.key)&&(S=S.slice().reverse()),["ArrowUp","ArrowDown"].includes(p.key)){const y=p.target,T=S.indexOf(y);S=S.slice(T+1)}setTimeout(()=>E(S)),p.preventDefault()}})})})})})})});Ve.displayName=Ft;var Kt="SelectItemAlignedPosition",He=o.forwardRef((t,n)=>{const{__scopeSelect:e,onPlaced:l,...a}=t,u=Y(ee,e),s=q(ee,e),[c,i]=o.useState(null),[f,v]=o.useState(null),w=L(n,R=>v(R)),P=de(e),I=o.useRef(!1),C=o.useRef(!0),{viewport:d,selectedItem:h,selectedItemText:x,focusSelectedItem:m}=s,g=o.useCallback(()=>{if(u.trigger&&u.valueNode&&c&&f&&d&&h&&x){const R=u.trigger.getBoundingClientRect(),O=f.getBoundingClientRect(),W=u.valueNode.getBoundingClientRect(),X=x.getBoundingClientRect();if(u.dir!=="rtl"){const y=X.left-O.left,T=W.left-y,Z=R.left-T,J=R.width+Z,he=Math.max(J,O.width),ge=window.innerWidth-A,ve=Ne(T,[A,Math.max(A,ge-he)]);c.style.minWidth=J+"px",c.style.left=ve+"px"}else{const y=O.right-X.right,T=window.innerWidth-W.right-y,Z=window.innerWidth-R.right-T,J=R.width+Z,he=Math.max(J,O.width),ge=window.innerWidth-A,ve=Ne(T,[A,Math.max(A,ge-he)]);c.style.minWidth=J+"px",c.style.right=ve+"px"}const k=P(),B=window.innerHeight-A*2,K=d.scrollHeight,V=window.getComputedStyle(f),H=parseInt(V.borderTopWidth,10),E=parseInt(V.paddingTop,10),D=parseInt(V.borderBottomWidth,10),U=parseInt(V.paddingBottom,10),z=H+E+K+U+D,pe=Math.min(h.offsetHeight*5,z),ae=window.getComputedStyle(d),fe=parseInt(ae.paddingTop,10),me=parseInt(ae.paddingBottom,10),te=R.top+R.height/2-A,le=B-te,re=h.offsetHeight/2,p=h.offsetTop+re,b=H+E+p,_=z-b;if(b<=te){const y=k.length>0&&h===k[k.length-1].ref.current;c.style.bottom="0px";const T=f.clientHeight-d.offsetTop-d.offsetHeight,Z=Math.max(le,re+(y?me:0)+T+D),J=b+Z;c.style.height=J+"px"}else{const y=k.length>0&&h===k[0].ref.current;c.style.top="0px";const Z=Math.max(te,H+d.offsetTop+(y?fe:0)+re)+_;c.style.height=Z+"px",d.scrollTop=b-te+d.offsetTop}c.style.margin=`${A}px 0`,c.style.minHeight=pe+"px",c.style.maxHeight=B+"px",l?.(),requestAnimationFrame(()=>I.current=!0)}},[P,u.trigger,u.valueNode,c,f,d,h,x,u.dir,l]);$(()=>g(),[g]);const[F,M]=o.useState();$(()=>{f&&M(window.getComputedStyle(f).zIndex)},[f]);const ne=o.useCallback(R=>{R&&C.current===!0&&(g(),m?.(),C.current=!1)},[g,m]);return r.jsx($t,{scope:e,contentWrapper:c,shouldExpandOnScrollRef:I,onScrollButtonChange:ne,children:r.jsx("div",{ref:i,style:{display:"flex",flexDirection:"column",position:"fixed",zIndex:F},children:r.jsx(j.div,{...a,ref:w,style:{boxSizing:"border-box",maxHeight:"100%",...a.style}})})})});He.displayName=Kt;var zt="SelectPopperPosition",xe=o.forwardRef((t,n)=>{const{__scopeSelect:e,align:l="start",collisionPadding:a=A,...u}=t,s=ue(e);return r.jsx(Et,{...s,...u,ref:n,align:l,collisionPadding:a,style:{boxSizing:"border-box",...u.style,"--radix-select-content-transform-origin":"var(--radix-popper-transform-origin)","--radix-select-content-available-width":"var(--radix-popper-available-width)","--radix-select-content-available-height":"var(--radix-popper-available-height)","--radix-select-trigger-width":"var(--radix-popper-anchor-width)","--radix-select-trigger-height":"var(--radix-popper-anchor-height)"}})});xe.displayName=zt;var[$t,Ie]=oe(ee,{}),Se="SelectViewport",Ue=o.forwardRef((t,n)=>{const{__scopeSelect:e,nonce:l,...a}=t,u=q(Se,e),s=Ie(Se,e),c=L(n,u.onViewportChange),i=o.useRef(0);return r.jsxs(r.Fragment,{children:[r.jsx("style",{dangerouslySetInnerHTML:{__html:"[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}"},nonce:l}),r.jsx(ie.Slot,{scope:e,children:r.jsx(j.div,{"data-radix-select-viewport":"",role:"presentation",...a,ref:c,style:{position:"relative",flex:1,overflow:"hidden auto",...a.style},onScroll:N(a.onScroll,f=>{const v=f.currentTarget,{contentWrapper:w,shouldExpandOnScrollRef:P}=s;if(P?.current&&w){const I=Math.abs(i.current-v.scrollTop);if(I>0){const C=window.innerHeight-A*2,d=parseFloat(w.style.minHeight),h=parseFloat(w.style.height),x=Math.max(d,h);if(x<C){const m=x+I,g=Math.min(C,m),F=m-g;w.style.height=g+"px",w.style.bottom==="0px"&&(v.scrollTop=F>0?F:0,w.style.justifyContent="flex-end")}}}i.current=v.scrollTop})})})]})});Ue.displayName=Se;var Fe="SelectGroup",[Gt,Yt]=oe(Fe),We=o.forwardRef((t,n)=>{const{__scopeSelect:e,...l}=t,a=be();return r.jsx(Gt,{scope:e,id:a,children:r.jsx(j.div,{role:"group","aria-labelledby":a,...l,ref:n})})});We.displayName=Fe;var Ke="SelectLabel",ze=o.forwardRef((t,n)=>{const{__scopeSelect:e,...l}=t,a=Yt(Ke,e);return r.jsx(j.div,{id:a.id,...l,ref:n})});ze.displayName=Ke;var ce="SelectItem",[qt,$e]=oe(ce),Ge=o.forwardRef((t,n)=>{const{__scopeSelect:e,value:l,disabled:a=!1,textValue:u,...s}=t,c=Y(ce,e),i=q(ce,e),f=c.value===l,[v,w]=o.useState(u??""),[P,I]=o.useState(!1),C=L(n,m=>i.itemRefCallback?.(m,l,a)),d=be(),h=o.useRef("touch"),x=()=>{a||(c.onValueChange(l),c.onOpenChange(!1))};if(l==="")throw new Error("A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.");return r.jsx(qt,{scope:e,value:l,disabled:a,textId:d,isSelected:f,onItemTextChange:o.useCallback(m=>{w(g=>g||(m?.textContent??"").trim())},[]),children:r.jsx(ie.ItemSlot,{scope:e,value:l,disabled:a,textValue:v,children:r.jsx(j.div,{role:"option","aria-labelledby":d,"data-highlighted":P?"":void 0,"aria-selected":f&&P,"data-state":f?"checked":"unchecked","aria-disabled":a||void 0,"data-disabled":a?"":void 0,tabIndex:a?void 0:-1,...s,ref:C,onFocus:N(s.onFocus,()=>I(!0)),onBlur:N(s.onBlur,()=>I(!1)),onClick:N(s.onClick,()=>{h.current!=="mouse"&&x()}),onPointerUp:N(s.onPointerUp,()=>{h.current==="mouse"&&x()}),onPointerDown:N(s.onPointerDown,m=>{h.current=m.pointerType}),onPointerMove:N(s.onPointerMove,m=>{h.current=m.pointerType,a?i.onItemLeave?.():h.current==="mouse"&&m.currentTarget.focus({preventScroll:!0})}),onPointerLeave:N(s.onPointerLeave,m=>{m.currentTarget===document.activeElement&&i.onItemLeave?.()}),onKeyDown:N(s.onKeyDown,m=>{i.searchRef?.current!==""&&m.key===" "||(Dt.includes(m.key)&&x(),m.key===" "&&m.preventDefault())})})})})});Ge.displayName=ce;var se="SelectItemText",Ye=o.forwardRef((t,n)=>{const{__scopeSelect:e,className:l,style:a,...u}=t,s=Y(se,e),c=q(se,e),i=$e(se,e),f=Vt(se,e),[v,w]=o.useState(null),P=L(n,x=>w(x),i.onItemTextChange,x=>c.itemTextRefCallback?.(x,i.value,i.disabled)),I=v?.textContent,C=o.useMemo(()=>r.jsx("option",{value:i.value,disabled:i.disabled,children:I},i.value),[i.disabled,i.value,I]),{onNativeOptionAdd:d,onNativeOptionRemove:h}=f;return $(()=>(d(C),()=>h(C)),[d,h,C]),r.jsxs(r.Fragment,{children:[r.jsx(j.span,{id:i.textId,...u,ref:P}),i.isSelected&&s.valueNode&&!s.valueNodeHasChildren?Re.createPortal(u.children,s.valueNode):null]})});Ye.displayName=se;var qe="SelectItemIndicator",Xe=o.forwardRef((t,n)=>{const{__scopeSelect:e,...l}=t;return $e(qe,e).isSelected?r.jsx(j.span,{"aria-hidden":!0,...l,ref:n}):null});Xe.displayName=qe;var we="SelectScrollUpButton",Ze=o.forwardRef((t,n)=>{const e=q(we,t.__scopeSelect),l=Ie(we,t.__scopeSelect),[a,u]=o.useState(!1),s=L(n,l.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let c=function(){const f=i.scrollTop>0;u(f)};const i=e.viewport;return c(),i.addEventListener("scroll",c),()=>i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),a?r.jsx(Qe,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop-i.offsetHeight)}}):null});Ze.displayName=we;var ye="SelectScrollDownButton",Je=o.forwardRef((t,n)=>{const e=q(ye,t.__scopeSelect),l=Ie(ye,t.__scopeSelect),[a,u]=o.useState(!1),s=L(n,l.onScrollButtonChange);return $(()=>{if(e.viewport&&e.isPositioned){let c=function(){const f=i.scrollHeight-i.clientHeight,v=Math.ceil(i.scrollTop)<f;u(v)};const i=e.viewport;return c(),i.addEventListener("scroll",c),()=>i.removeEventListener("scroll",c)}},[e.viewport,e.isPositioned]),a?r.jsx(Qe,{...t,ref:s,onAutoScroll:()=>{const{viewport:c,selectedItem:i}=e;c&&i&&(c.scrollTop=c.scrollTop+i.offsetHeight)}}):null});Je.displayName=ye;var Qe=o.forwardRef((t,n)=>{const{__scopeSelect:e,onAutoScroll:l,...a}=t,u=q("SelectScrollButton",e),s=o.useRef(null),c=de(e),i=o.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return o.useEffect(()=>()=>i(),[i]),$(()=>{c().find(v=>v.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:"nearest"})},[c]),r.jsx(j.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:N(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(l,50))}),onPointerMove:N(a.onPointerMove,()=>{u.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(l,50))}),onPointerLeave:N(a.onPointerLeave,()=>{i()})})}),Xt="SelectSeparator",et=o.forwardRef((t,n)=>{const{__scopeSelect:e,...l}=t;return r.jsx(j.div,{"aria-hidden":!0,...l,ref:n})});et.displayName=Xt;var Ce="SelectArrow",Zt=o.forwardRef((t,n)=>{const{__scopeSelect:e,...l}=t,a=ue(e),u=Y(Ce,e),s=q(Ce,e);return u.open&&s.position==="popper"?r.jsx(_t,{...a,...l,ref:n}):null});Zt.displayName=Ce;var Jt="SelectBubbleInput",tt=o.forwardRef(({__scopeSelect:t,value:n,...e},l)=>{const a=o.useRef(null),u=L(l,a),s=xt(n);return o.useEffect(()=>{const c=a.current;if(!c)return;const i=window.HTMLSelectElement.prototype,v=Object.getOwnPropertyDescriptor(i,"value").set;if(s!==n&&v){const w=new Event("change",{bubbles:!0});v.call(c,n),c.dispatchEvent(w)}},[s,n]),r.jsx(j.select,{...e,style:{...St,...e.style},ref:u,defaultValue:n})});tt.displayName=Jt;function ot(t){return t===""||t===void 0}function nt(t){const n=Ct(t),e=o.useRef(""),l=o.useRef(0),a=o.useCallback(s=>{const c=e.current+s;n(c),(function i(f){e.current=f,window.clearTimeout(l.current),f!==""&&(l.current=window.setTimeout(()=>i(""),1e3))})(c)},[n]),u=o.useCallback(()=>{e.current="",window.clearTimeout(l.current)},[]);return o.useEffect(()=>()=>window.clearTimeout(l.current),[]),[e,a,u]}function rt(t,n,e){const a=n.length>1&&Array.from(n).every(f=>f===n[0])?n[0]:n,u=e?t.indexOf(e):-1;let s=Qt(t,Math.max(u,0));a.length===1&&(s=s.filter(f=>f!==e));const i=s.find(f=>f.textValue.toLowerCase().startsWith(a.toLowerCase()));return i!==e?i:void 0}function Qt(t,n){return t.map((e,l)=>t[(n+l)%t.length])}var eo=_e,st=Me,to=Oe,oo=De,no=Le,at=ke,ro=Ue,so=We,lt=ze,ct=Ge,ao=Ye,lo=Xe,it=Ze,dt=Je,ut=et;const go=eo,vo=so,xo=to,co=o.forwardRef(({className:t,children:n,...e},l)=>r.jsxs(st,{ref:l,className:G("flex h-[34px] w-full items-center justify-between whitespace-nowrap rounded-md border border-input bg-transparent hover:bg-accent px-3 py-2 text-sm ring-offset-background data-[placeholder]:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1",t),...e,children:[n,r.jsx(oo,{asChild:!0,children:r.jsx(Ee,{className:"-mr-0.5 ml-1 size-4 opacity-50"})})]}));co.displayName=st.displayName;const pt=o.forwardRef(({className:t,...n},e)=>r.jsx(it,{ref:e,className:G("flex cursor-default items-center justify-center py-1",t),...n,children:r.jsx(At,{className:"size-4"})}));pt.displayName=it.displayName;const ft=o.forwardRef(({className:t,...n},e)=>r.jsx(dt,{ref:e,className:G("flex cursor-default items-center justify-center py-1",t),...n,children:r.jsx(Ee,{className:"size-4"})}));ft.displayName=dt.displayName;const io=o.forwardRef(({className:t,children:n,position:e="popper",...l},a)=>r.jsx(no,{children:r.jsx("div",{className:jt,children:r.jsxs(at,{ref:a,className:G("relative z-50 max-h-[--radix-select-content-available-height] min-w-[8rem] overflow-y-auto overflow-x-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 origin-[--radix-select-content-transform-origin]",e==="popper"&&"data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1",t),position:e,...l,children:[r.jsx(pt,{}),r.jsx(ro,{className:G("p-1",e==="popper"&&"h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]"),children:n}),r.jsx(ft,{})]})})}));io.displayName=at.displayName;const uo=o.forwardRef(({className:t,...n},e)=>r.jsx(lt,{ref:e,className:G("px-2 py-1.5 text-sm font-semibold",t),...n}));uo.displayName=lt.displayName;const po=o.forwardRef(({className:t,children:n,...e},l)=>r.jsxs(ct,{ref:l,className:G("relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-2 pr-8 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",t),...e,children:[r.jsx("span",{className:"absolute right-2 flex size-3.5 items-center justify-center",children:r.jsx(lo,{children:r.jsx(Mt,{className:"size-4"})})}),r.jsx(ao,{children:n})]}));po.displayName=ct.displayName;const fo=o.forwardRef(({className:t,...n},e)=>r.jsx(ut,{ref:e,className:G("-mx-1 my-1 h-px bg-muted",t),...n}));fo.displayName=ut.displayName;export{go as S,co as a,xo as b,io as c,vo as d,uo as e,po as f};