ghost 6.19.0 → 6.19.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/components/tryghost-i18n-6.19.1.tgz +0 -0
- package/components/{tryghost-parse-email-address-6.19.0.tgz → tryghost-parse-email-address-6.19.1.tgz} +0 -0
- package/core/built/admin/assets/{PolarAngleAxis-CGprvq8M.js → PolarAngleAxis-BzbazaED.js} +1 -1
- package/core/built/admin/assets/{_baseAssignValue-Bwn07Ln5.js → _baseAssignValue-D0bBhNG1.js} +1 -1
- package/core/built/admin/assets/{a-large-small-p58xibEK.js → a-large-small-gBDqOWOy.js} +1 -1
- package/core/built/admin/assets/{at-sign-BZPuAx5m.js → at-sign-V79EBNTJ.js} +1 -1
- package/core/built/admin/assets/{audience-Cy9gLIa9.js → audience-DF--nR_q.js} +1 -1
- package/core/built/admin/assets/{avatar-flipboard-CLmWb5Xn.js → avatar-flipboard-GK39JNWl.js} +1 -1
- package/core/built/admin/assets/{bluesky-sharing-BHt0oiii.js → bluesky-sharing-BKRqTAow.js} +1 -1
- package/core/built/admin/assets/{chart--RFLGIL4.js → chart-0ezwQhyB.js} +1 -1
- package/core/built/admin/assets/{chunk.524.5c5c3f3273a86d1d9913.js → chunk.524.e62f8276cc561fcddb66.js} +6 -6
- package/core/built/admin/assets/{chunk.582.e6c787cdf7e6de7819e0.js → chunk.582.0cdc35e120cf621f18b9.js} +8 -8
- package/core/built/admin/assets/{code-editor-view-BW9y0JXN.js → code-editor-view-xVA7A1IE.js} +1 -1
- package/core/built/admin/assets/{comments-C_lilDBp.js → comments-Tt1iOjcd.js} +1 -1
- package/core/built/admin/assets/{content-helpers-BOnQQADZ.js → content-helpers-TSHyiXwF.js} +1 -1
- package/core/built/admin/assets/{copy-Bi7VpgPR.js → copy-CTHgI4YI.js} +1 -1
- package/core/built/admin/assets/{data-list-Bu3jzs1s.js → data-list-6rXP5AUF.js} +1 -1
- package/core/built/admin/assets/{deleted-feed-item-B-doIIKc.js → deleted-feed-item-CK_4qToF.js} +1 -1
- package/core/built/admin/assets/{edit-profile-ZBdjFfvL.js → edit-profile-B_ViIhsd.js} +1 -1
- package/core/built/admin/assets/{empty-indicator-C6BBh99D.js → empty-indicator-CzTRebSi.js} +1 -1
- package/core/built/admin/assets/{en-C7eSFQRw.js → en-D1H4BpXe.js} +1 -1
- package/core/built/admin/assets/{feed-CAioauwD.js → feed-0iLmr_Xb.js} +1 -1
- package/core/built/admin/assets/{filters-DEKF0tIB.js → filters-6zg35bLL.js} +1 -1
- package/core/built/admin/assets/{gh-chart-D9KI0_sO.js → gh-chart-ldqA2tQU.js} +1 -1
- package/core/built/admin/assets/{ghost-6bff5c535ef015b0ed9421ceb6c699a7.js → ghost-6b109ed708c502afee4ff1d9185ae40c.js} +256 -268
- package/core/built/admin/assets/ghost-b3dff8469d9c9af487866537210234bd.css +1 -0
- package/core/built/admin/assets/ghost-dark-16a7b98c352c1f70016e73af10962179.css +1 -0
- package/core/built/admin/assets/{growth-C6XGchvT.js → growth-BUQvBEMA.js} +1 -1
- package/core/built/admin/assets/{hash-DFhnGHId.js → hash-CRtHv162.js} +1 -1
- package/core/built/admin/assets/{inbox-p-Y5uScT.js → inbox-DWYGFLuU.js} +1 -1
- package/core/built/admin/assets/{index-CIZ_upe2.js → index-1J5JrBgd.js} +1 -1
- package/core/built/admin/assets/{index-CS4XqyC-.js → index-BFT8PQPd.js} +1 -1
- package/core/built/admin/assets/{index-BWnrLoWI.js → index-BeG1PnbN.js} +1 -1
- package/core/built/admin/assets/{index-DCTdAEHx.js → index-Bgo4hw-T.js} +3 -3
- package/core/built/admin/assets/{index-jAidr8jI.js → index-CCmy-hD6.js} +1 -1
- package/core/built/admin/assets/index-CKfif8kf.js +13 -0
- package/core/built/admin/assets/{index-FPf-AERu.js → index-Cc9yKRsT.js} +1 -1
- package/core/built/admin/assets/{index-3uU4zg_6.js → index-CvV71sVO.js} +1 -1
- package/core/built/admin/assets/{index-LyfDjTto.js → index-D0RISNEd.js} +1 -1
- package/core/built/admin/assets/{index-JmqyGBro.js → index-D1AppGlg.js} +1 -1
- package/core/built/admin/assets/{index-D17PEsUB.js → index-EFWmaChO.js} +1 -1
- package/core/built/admin/assets/{index-Wx8_AGZX.js → index-SulwGym9.js} +1 -1
- package/core/built/admin/assets/{index-lPLmWtv0.js → index-_dLVP2u2.js} +1 -1
- package/core/built/admin/assets/{index-BzU2odQq.js → index-nb8rSrz_.js} +1 -1
- package/core/built/admin/assets/{index--VlvGKWi.js → index-zvNmrx86.js} +1 -1
- package/core/built/admin/assets/{koenig-lexical-CWnkYKQt.js → koenig-lexical-D8K6acyr.js} +1 -1
- package/core/built/admin/assets/{kpi-card-B5UaJgOT.js → kpi-card-CaX6eHyr.js} +1 -1
- package/core/built/admin/assets/{kpis-Cc2RxnvZ.js → kpis-BfR_uoFr.js} +1 -1
- package/core/built/admin/assets/{label-CW7Kmp9w.js → label-BQ5mfFHN.js} +1 -1
- package/core/built/admin/assets/{links-wWNc9Uat.js → links-lZnz9cuZ.js} +1 -1
- package/core/built/admin/assets/{list-filter-3EF6cVg-.js → list-filter-CofVbkA4.js} +1 -1
- package/core/built/admin/assets/{lucide-react-DtMIZssr.js → lucide-react-7D_Tsesk.js} +1 -1
- package/core/built/admin/assets/{main-layout-BFYhCrLn.js → main-layout-DBVy-lM5.js} +1 -1
- package/core/built/admin/assets/{message-square-text-BDZtUW-2.js → message-square-text-DzuHB7uU.js} +1 -1
- package/core/built/admin/assets/{minus-CSphShdJ.js → minus-BIdO1CDG.js} +1 -1
- package/core/built/admin/assets/{modals-CDWP04Iy.js → modals-GY5yP0Bl.js} +1 -1
- package/core/built/admin/assets/{moderation-qcng2_lB.js → moderation-CB9TwdgZ.js} +1 -1
- package/core/built/admin/assets/{newsletter-R-IYcV4M.js → newsletter-Bww4nkp5.js} +1 -1
- package/core/built/admin/assets/{newsletters-BB4e24i1.js → newsletters-C8pT7kSQ.js} +1 -1
- package/core/built/admin/assets/{note-B_bpRX66.js → note-BeCIv25U.js} +1 -1
- package/core/built/admin/assets/{overview-Nh-IoP-v.js → overview-BCZDRsR0.js} +1 -1
- package/core/built/admin/assets/{pagemenu-Cd45frnF.js → pagemenu-D3ByoZIR.js} +1 -1
- package/core/built/admin/assets/{post-analytics-jHZOhQ8L.js → post-analytics-B4z47Loe.js} +1 -1
- package/core/built/admin/assets/{post-analytics-context-BST4bzps.js → post-analytics-context-BQ8IcW4n.js} +1 -1
- package/core/built/admin/assets/{post-analytics-header-DAZPp6M8.js → post-analytics-header-CpBVLNat.js} +1 -1
- package/core/built/admin/assets/{post-share-modal-D1JQfuYx.js → post-share-modal-Dz4BNSV-.js} +1 -1
- package/core/built/admin/assets/{posts-DFiJPOft.js → posts-C94RiQ4S.js} +1 -1
- package/core/built/admin/assets/{repeat-Smml9n0k.js → repeat-YTCeIlQZ.js} +1 -1
- package/core/built/admin/assets/{reply-CooY4lmk.js → reply-CUazFbTY.js} +1 -1
- package/core/built/admin/assets/{select-WwMsbBbg.js → select-MVpx-Kfp.js} +1 -1
- package/core/built/admin/assets/{settings-CQEhPDQU.js → settings-CEfmF6wO.js} +4 -4
- package/core/built/admin/assets/{settings-CxWtvcUf.js → settings-Q3y0Zw5o.js} +1 -1
- package/core/built/admin/assets/{sort-button-DFr8vezl.js → sort-button-CEXkgGLb.js} +1 -1
- package/core/built/admin/assets/{source-icon-VpYWpwYb.js → source-icon-BDparw9V.js} +1 -1
- package/core/built/admin/assets/{sprout-DRqlFJSK.js → sprout-CXg43Zav.js} +1 -1
- package/core/built/admin/assets/{square-CwHQ9sJ2.js → square-C8G-1gV_.js} +1 -1
- package/core/built/admin/assets/stats/{audience-Caf7BjaU.mjs → audience-DJv-je5C.mjs} +3 -3
- package/core/built/admin/assets/stats/{content-helpers-MbtAvUJh.mjs → content-helpers-Bq8zgCUT.mjs} +4 -4
- package/core/built/admin/assets/stats/{index-DMkZbbZs.mjs → index-B12PHa64.mjs} +8 -8
- package/core/built/admin/assets/stats/{index-wT0OIw_N.mjs → index-DRN41f8l.mjs} +5 -5
- package/core/built/admin/assets/stats/{index-ChjIxhHy.mjs → index-DwqY9qrn.mjs} +5 -5
- package/core/built/admin/assets/stats/{index-BGqKbF1D.mjs → index-GLg_cfiu.mjs} +464 -461
- package/core/built/admin/assets/stats/{index-BTjfXOi6.mjs → index-gS3EAScL.mjs} +5 -5
- package/core/built/admin/assets/stats/{sort-button-B8n8fYMi.mjs → sort-button-f_Dfri5f.mjs} +8 -8
- package/core/built/admin/assets/stats/{stats-CGH-0JNs.mjs → stats-CTWb7qo1.mjs} +96 -91
- package/core/built/admin/assets/stats/stats.js +1 -1
- package/core/built/admin/assets/stats/{tabs-EQCUj3Y9.mjs → tabs-DVvxZ7wa.mjs} +7 -7
- package/core/built/admin/assets/stats/{use-growth-stats--CIfag21.mjs → use-growth-stats-w7-2bD-r.mjs} +3 -3
- package/core/built/admin/assets/{stats-lnFiOQZx.js → stats-B2vPCVx7.js} +1 -1
- package/core/built/admin/assets/stats-view-BRy4IDHe.js +1 -0
- package/core/built/admin/assets/{step-1-Bx8MiQVF.js → step-1-MLqNxHrJ.js} +1 -1
- package/core/built/admin/assets/{step-2-CLLXppER.js → step-2-DY3jIa6G.js} +1 -1
- package/core/built/admin/assets/{step-3-C5WrQe8u.js → step-3-Dt6w5-MB.js} +1 -1
- package/core/built/admin/assets/{table-2waWpIF5.js → table-BWAnP2ln.js} +1 -1
- package/core/built/admin/assets/{tabs-CBD0hW8V.js → tabs-Bw13eFRh.js} +1 -1
- package/core/built/admin/assets/{tags-CKrBptuC.js → tags-BQz2NtFF.js} +1 -1
- package/core/built/admin/assets/{tags-Bgw5Hrb5.js → tags-Bj9RJW9l.js} +1 -1
- package/core/built/admin/assets/{tiers-CO-pz1FX.js → tiers-jCNws2RK.js} +1 -1
- package/core/built/admin/assets/{toggle-group-BXAZzvJ9.js → toggle-group-B0wGpmLS.js} +1 -1
- package/core/built/admin/assets/{topic-filter-U3qUH2P_.js → topic-filter-BPOZf5IO.js} +1 -1
- package/core/built/admin/assets/{trash-CJY1Wro_.js → trash-BKeiM6WP.js} +1 -1
- package/core/built/admin/assets/{use-growth-stats-BrLZI7da.js → use-growth-stats-C5TiRW1S.js} +1 -1
- package/core/built/admin/assets/{use-infinite-virtual-scroll-CiRn3kpz.js → use-infinite-virtual-scroll-CdNJ5RT5.js} +1 -1
- package/core/built/admin/assets/{use-simple-pagination-CskJ0MDP.js → use-simple-pagination-CCVB_aJH.js} +1 -1
- package/core/built/admin/assets/{user-round-check-zOuzV3OS.js → user-round-check-Df7ko4Tm.js} +1 -1
- package/core/built/admin/assets/{wallet-cards-ddLuIN-b.js → wallet-cards-Cl4bJBBw.js} +1 -1
- package/core/built/admin/assets/{web-CGbkZWn3.js → web-DxLX2yUi.js} +1 -1
- package/core/built/admin/index.html +5 -5
- package/core/frontend/helpers/get.js +51 -3
- package/core/server/api/endpoints/utils/serializers/input/utils/slug-filter-order.js +8 -5
- package/core/server/models/base/plugins/crud.js +6 -1
- package/core/server/services/email-suppression-list/email-suppression-list.js +1 -1
- package/package.json +16 -10
- package/yarn.lock +128 -181
- package/components/tryghost-i18n-6.19.0.tgz +0 -0
- package/core/built/admin/assets/ghost-3c48d37b32f4fcd7eb15cfd739905a03.css +0 -1
- package/core/built/admin/assets/ghost-dark-0100fe3ec7b4c3f6d8d043c904254a63.css +0 -1
- package/core/built/admin/assets/index-S62-c8TV.js +0 -13
- package/core/built/admin/assets/stats-view-BJVawuIv.js +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ae as Re,r,u as Se,aP as re,j as e,ai as N,aS as ne,aR as K,bB as le,cv as ee,bs as _e,bu as Fe,cw as Te,cx as Ae,cy as $e,B as q,aU as ze,aQ as Ee,aj as E,c8 as Me,C as De}from"./index-DCTdAEHx.js";import{C as Q,a as Y,b as J,f as X,c as _,g as ce}from"./pagemenu-Cd45frnF.js";import{u as oe,S as de,a as me,b as pe,c as ue}from"./use-simple-pagination-CskJ0MDP.js";import{T as Ie,a as Ue,b as se}from"./tabs-CBD0hW8V.js";import{e as Be,f as Ve,g as Oe}from"./lucide-react-DtMIZssr.js";import{a as We,P as Ge}from"./wallet-cards-ddLuIN-b.js";import{K as U,d as B,a as V,b as O,c as W}from"./kpi-card-B5UaJgOT.js";import{P as He,a as Ke}from"./post-analytics-header-DAZPp6M8.js";import{D as qe,a as Qe,b as Ye,c as Je,d as Xe,e as Ze,f as es,g as ss}from"./data-list-Bu3jzs1s.js";import{a as ts,u as as,p as is,g as G,N as H}from"./links-wWNc9Uat.js";import{u as rs}from"./post-analytics-context-BST4bzps.js";import{h as ns}from"./post-helpers-gInwAwEv.js";import{f as ls,g as cs}from"./stats-lnFiOQZx.js";import{g as te}from"./posts-DFiJPOft.js";import"./index-LyfDjTto.js";import"./a-large-small-p58xibEK.js";import"./at-sign-BZPuAx5m.js";import"./message-square-text-BDZtUW-2.js";import"./copy-Bi7VpgPR.js";import"./hash-DFhnGHId.js";import"./inbox-p-Y5uScT.js";import"./list-filter-3EF6cVg-.js";import"./minus-CSphShdJ.js";import"./tags-CKrBptuC.js";import"./square-CwHQ9sJ2.js";import"./user-round-check-zOuzV3OS.js";import"./repeat-Smml9n0k.js";import"./reply-CooY4lmk.js";import"./sprout-DRqlFJSK.js";import"./trash-CJY1Wro_.js";import"./post-share-modal-D1JQfuYx.js";import"./chart--RFLGIL4.js";import"./_baseAssignValue-Bwn07Ln5.js";import"./PolarAngleAxis-CGprvq8M.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(Q,{children:[e.jsxs(Y,{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(Ue,{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(Be,{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)`,y=`${encodeURIComponent(d)}&post=${a}`,h=`${encodeURIComponent(m)}&post=${a}`;c(`/members?filter=${o==="positive"?y: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:y,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||y}},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})]})]}),Ys=()=>{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:y,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,P=t+u;return{positiveFeedback:t,negativeFeedback:u,totalFeedback:P}},[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=P=>{f.current&&!f.current.contains(P.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:y.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:y.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(Q,{className:j&&i?"lg:col-span-2":"",children:[e.jsxs(Y,{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(U,{className:"group relative isolate grow p-3 md:px-6 md:py-5",children:[e.jsx(B,{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(U,{className:"p-3 md:px-6 md:py-5",children:[e.jsx(B,{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(U,{className:"group relative isolate grow p-3 md:px-6 md:py-5",children:[e.jsx(B,{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(y.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(y.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(Q,{className:"group/datalist overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-6",children:[e.jsxs(Y,{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(Qe,{children:ge?.map(t=>{const u=m.clicked>0?t.count/m.clicked:0,P=t.link.link_id,Z=t.link.title,ye=t.link.to,Pe=t.link.edited;return e.jsxs(Ye,{children:[a!==P&&e.jsx(Je,{style:{width:`${u?Math.round(u*100):0}%`}}),e.jsx(Xe,{className:"w-full",children:a===P?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(P),children:e.jsx(Ge,{})}),e.jsx("a",{className:"block truncate font-medium hover:underline",href:ye,rel:"noreferrer",target:"_blank",title:Z,children:Z}),Pe&&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)})]})]},P)})})}):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{Ys as default};
|
|
1
|
+
import{ae as Re,r,u as Se,aP as re,j as e,ai as N,aS as ne,aR as K,bB as le,cv as ee,bs as _e,bu as Fe,cw as Te,cx as Ae,cy as $e,B as q,aU as ze,aQ as Ee,aj as E,c8 as Me,C as De}from"./index-Bgo4hw-T.js";import{C as Q,a as Y,b as J,f as X,c as _,g as ce}from"./pagemenu-D3ByoZIR.js";import{u as oe,S as de,a as me,b as pe,c as ue}from"./use-simple-pagination-CCVB_aJH.js";import{T as Ie,a as Ue,b as se}from"./tabs-Bw13eFRh.js";import{e as Be,f as Ve,g as Oe}from"./lucide-react-7D_Tsesk.js";import{a as We,P as Ge}from"./wallet-cards-Cl4bJBBw.js";import{K as U,d as B,a as V,b as O,c as W}from"./kpi-card-CaX6eHyr.js";import{P as He,a as Ke}from"./post-analytics-header-CpBVLNat.js";import{D as qe,a as Qe,b as Ye,c as Je,d as Xe,e as Ze,f as es,g as ss}from"./data-list-6rXP5AUF.js";import{a as ts,u as as,p as is,g as G,N as H}from"./links-lZnz9cuZ.js";import{u as rs}from"./post-analytics-context-BQ8IcW4n.js";import{h as ns}from"./post-helpers-gInwAwEv.js";import{f as ls,g as cs}from"./stats-B2vPCVx7.js";import{g as te}from"./posts-C94RiQ4S.js";import"./index-D0RISNEd.js";import"./a-large-small-gBDqOWOy.js";import"./at-sign-V79EBNTJ.js";import"./message-square-text-DzuHB7uU.js";import"./copy-CTHgI4YI.js";import"./hash-CRtHv162.js";import"./inbox-DWYGFLuU.js";import"./list-filter-CofVbkA4.js";import"./minus-BIdO1CDG.js";import"./tags-BQz2NtFF.js";import"./square-C8G-1gV_.js";import"./user-round-check-Df7ko4Tm.js";import"./repeat-YTCeIlQZ.js";import"./reply-CUazFbTY.js";import"./sprout-CXg43Zav.js";import"./trash-BKeiM6WP.js";import"./post-share-modal-Dz4BNSV-.js";import"./chart-0ezwQhyB.js";import"./_baseAssignValue-D0bBhNG1.js";import"./PolarAngleAxis-BzbazaED.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(Q,{children:[e.jsxs(Y,{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(Ue,{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(Be,{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)`,y=`${encodeURIComponent(d)}&post=${a}`,h=`${encodeURIComponent(m)}&post=${a}`;c(`/members?filter=${o==="positive"?y: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:y,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||y}},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})]})]}),Ys=()=>{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:y,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,P=t+u;return{positiveFeedback:t,negativeFeedback:u,totalFeedback:P}},[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=P=>{f.current&&!f.current.contains(P.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:y.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:y.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(Q,{className:j&&i?"lg:col-span-2":"",children:[e.jsxs(Y,{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(U,{className:"group relative isolate grow p-3 md:px-6 md:py-5",children:[e.jsx(B,{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(U,{className:"p-3 md:px-6 md:py-5",children:[e.jsx(B,{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(U,{className:"group relative isolate grow p-3 md:px-6 md:py-5",children:[e.jsx(B,{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(y.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(y.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(Q,{className:"group/datalist overflow-hidden",children:[e.jsxs("div",{className:"flex items-center justify-between p-6",children:[e.jsxs(Y,{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(Qe,{children:ge?.map(t=>{const u=m.clicked>0?t.count/m.clicked:0,P=t.link.link_id,Z=t.link.title,ye=t.link.to,Pe=t.link.edited;return e.jsxs(Ye,{children:[a!==P&&e.jsx(Je,{style:{width:`${u?Math.round(u*100):0}%`}}),e.jsx(Xe,{className:"w-full",children:a===P?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(P),children:e.jsx(Ge,{})}),e.jsx("a",{className:"block truncate font-medium hover:underline",href:ye,rel:"noreferrer",target:"_blank",title:Z,children:Z}),Pe&&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)})]})]},P)})})}):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{Ys as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ak as p,ad as n,al as u,am as i}from"./index-
|
|
1
|
+
import{ak as p,ad as n,al as u,am as i}from"./index-Bgo4hw-T.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-
|
|
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-Bgo4hw-T.js";import{u as re,D as de,A as ue,S as A}from"./deleted-feed-item-CK_4qToF.js";import{H as xe}from"./hash-CRtHv162.js";import"./trash-BKeiM6WP.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 Y,aP as A,r as h,j as e,B as P,aQ as V,ai as C,aR as D,aS as J,ab as re,aj as f,aT as F,aU as ie,aV as le,af as oe,ag as U,aW as ne,S as q}from"./index-DCTdAEHx.js";import{u as ce,c as de,D as me}from"./growth-C6XGchvT.js";import{K as L,a as S,b as _,c as T}from"./kpi-card-B5UaJgOT.js";import{C as E,a as K,b as O,c as y,K as R,d as I,e as M,u as Q}from"./pagemenu-Cd45frnF.js";import{D as pe,a as he,b as xe,c as ue,d as ge,e as je,f as fe,g as ve}from"./data-list-Bu3jzs1s.js";import{u as be,p as Ne,N as ye,c as we}from"./links-wWNc9Uat.js";import{M as ke}from"./wallet-cards-ddLuIN-b.js";import{P as Ce,a as Le}from"./post-analytics-header-DAZPp6M8.js";import{S as Se,K as _e}from"./kpis-Cc2RxnvZ.js";import{E as Te}from"./empty-indicator-C6BBh99D.js";import{G as De}from"./gh-chart-D9KI0_sO.js";import{u as X,S as Re}from"./post-analytics-context-BST4bzps.js";import{h as Ie,i as Me}from"./post-helpers-gInwAwEv.js";import{S as Ae}from"./sprout-DRqlFJSK.js";import"./source-icon-VpYWpwYb.js";import"./source-utils-B1S3ZHA2.js";import"./table-2waWpIF5.js";import"./currency-fEUUCkj0.js";import"./stats-lnFiOQZx.js";import"./chart--RFLGIL4.js";import"./_baseAssignValue-Bwn07Ln5.js";import"./PolarAngleAxis-CGprvq8M.js";import"./post-share-modal-D1JQfuYx.js";import"./posts-DFiJPOft.js";import"./trash-CJY1Wro_.js";import"./lucide-react-DtMIZssr.js";import"./a-large-small-p58xibEK.js";import"./at-sign-BZPuAx5m.js";import"./message-square-text-BDZtUW-2.js";import"./copy-Bi7VpgPR.js";import"./hash-DFhnGHId.js";import"./inbox-p-Y5uScT.js";import"./list-filter-3EF6cVg-.js";import"./minus-CSphShdJ.js";import"./tags-CKrBptuC.js";import"./square-CwHQ9sJ2.js";import"./user-round-check-zOuzV3OS.js";import"./repeat-Smml9n0k.js";import"./reply-CooY4lmk.js";import"./tabs-CBD0hW8V.js";import"./index-LyfDjTto.js";const Pe=({post:o,isNewsletterStatsLoading:c,isWebShown:x})=>{const{postId:s}=Y(),a=A(),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}=be({searchParams:{filter:`post_id:'${s}'`}}),u=h.useMemo(()=>Ne(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))"}],n={percentage:{label:"Opened"},Average:{label:"Clicked"},"This newsletter":{label:"Opened"}},i=o.email_only||!x;return e.jsxs(E,{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(K,{children:e.jsxs(O,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(ke,{size:16,strokeWidth:1.5}),"Newsletter performance"]})}),e.jsx(P,{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"})]}),c?e.jsx(y,{children:e.jsx("div",{className:"mx-auto flex min-h-[250px] items-center justify-center xl:size-full",children:e.jsx(V,{})})}):e.jsxs(y,{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(R,{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(I,{color:"hsl(var(--chart-blue))",children:"Open rate"}),e.jsx(M,{value:C(t.openedRate)})]})}),e.jsx(R,{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(I,{color:"hsl(var(--chart-teal))",children:"Click rate"}),e.jsx(M,{value:C(t.clickedRate)})]})})]}),!i&&e.jsx(D,{}),e.jsx("div",{className:"mx-auto my-6 h-[240px]",children:e.jsx(ye,{className:"pointer-events-none aspect-square h-[240px]",config:n,data:g,tooltip:!1})})]}),e.jsxs("div",{className:`${i&&"pl-6"}`,children:[!i&&e.jsx(D,{}),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(J,{children:"Members"})]}),u.length>0?e.jsx(pe,{className:"",children:e.jsx(he,{children:u.slice(0,i?10:5).map(l=>{const r=t.clicked>0?l.count/t.clicked:0;return e.jsxs(xe,{children:[e.jsx(ue,{style:{width:`${r?Math.round(r*100):0}%`}}),e.jsx(ge,{children:e.jsxs("div",{className:"flex items-center space-x-2 overflow-hidden",children:[e.jsx(re,{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:we(l.link.to,!0)})]})}),e.jsxs(je,{children:[e.jsx(fe,{children:f(l.count||0)}),e.jsx(ve,{children:C(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."})]})]})]})]})},Ve=({chartData:o,range:c,isLoading:x,visitors:s,sourcesData:a,isNewsletterShown:t=!0})=>{const{postId:m}=Y(),u=A(),{data:g}=X(),n=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(E,{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(K,{children:e.jsxs(O,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(F,{size:16,strokeWidth:1.5}),"Web performance"]})}),e.jsx(P,{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(y,{children:[e.jsxs("div",{children:[e.jsx(R,{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(I,{color:"hsl(var(--chart-blue))",children:"Unique visitors"}),e.jsx(M,{value:f(s)})]})}),e.jsx(D,{}),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(V,{})}):e.jsx(De,{className:"aspect-auto h-[240px] w-full",color:"hsl(var(--chart-blue))",data:o||[],id:"visitors",range:c,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(J,{children:"Visitors"})]})}),a&&a.length>0?e.jsx(Se,{data:a,range:c,siteIcon:i,siteUrl:n,tableOnly:!0,topSourcesLimit:5,totalVisitors:l}):e.jsx(Te,{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(F,{strokeWidth:1.5})})]})]})]})})},ks=()=>{const o=A(),{statsConfig:c,isLoading:x,post:s,isPostLoading:a,postId:t}=X(),{totals:m,isLoading:u,currencySymbol:g}=ce(t),{appSettings:n}=ie(),{emailTrackClicks:i,emailTrackOpens:l}=n?.analytics||{},r=h.useMemo(()=>s?.published_at?le(s.published_at):Re.ALL_TIME.value,[s?.published_at]),{startDate:p,endDate:z,timezone:$}=oe(r),W=h.useMemo(()=>{const d={site_uuid:c?.id||"",date_from:U(p),date_to:U(z),timezone:$,post_uuid:""};return!a&&s?.uuid?{...d,post_uuid:s.uuid}:d},[a,s,c?.id,p,z,$]),{data:v,loading:G}=Q({endpoint:"api_kpis",statsConfig:c||{id:""},params:W}),Z=h.useMemo(()=>v?.length?v.reduce((d,j)=>{const H=Number(j.visits);return d+(isNaN(H)?0:H)},0):0,[v]),b=_e.visits,ee=ne(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:se,loading:ae}=Q({endpoint:"api_top_sources",statsConfig:c||{id:""},params:W}),B=x||u||a||G,te=a||x||G,w=Ie(s)&&l&&i,k=!s?.email_only&&n?.analytics.webAnalytics,N=n?.analytics.membersTrackSources;return h.useEffect(()=>{!a&&s&&Me(s)&&!n?.analytics.webAnalytics&&N&&o(`/posts/analytics/${t}/growth`,{replace:!0})},[a,s,n?.analytics.webAnalytics,o,t,N]),a?e.jsx(V,{}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{currentTab:"Overview"}),e.jsx(Le,{children:e.jsxs("div",{className:"flex flex-col gap-6 lg:grid lg:grid-cols-2",children:[k&&e.jsx(Ve,{chartData:ee,isLoading:te||B||ae,isNewsletterShown:w,range:r,sourcesData:se,visitors:Z}),w&&e.jsx(Pe,{isNewsletterStatsLoading:a,isWebShown:k,post:s}),N&&e.jsxs(E,{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(K,{children:e.jsxs(O,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(Ae,{size:16,strokeWidth:1.5}),"Growth"]})}),e.jsx(P,{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(y,{className:"flex flex-col gap-6 px-0 md:grid md:grid-cols-3 md:items-stretch md:gap-0",children:B?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(L,{className:"grow gap-1 py-0",children:[e.jsx(S,{children:"Free members"}),e.jsx(_,{children:e.jsx(T,{className:"text-[2.2rem]",children:f(m?.free_members||0)})})]}),n?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs(L,{className:"grow gap-1 py-0",children:[e.jsx(S,{children:"Paid members"}),e.jsx(_,{children:e.jsx(T,{className:"text-[2.2rem]",children:f(m?.paid_members||0)})})]}),e.jsxs(L,{className:"grow gap-1 py-0",children:[e.jsx(S,{children:"MRR impact"}),e.jsx(_,{children:e.jsxs(T,{className:"text-[2.2rem]",children:[g,f(de(m?.mrr||0))]})})]})]})]})})]}),!k&&!w&&!N&&e.jsx(me,{className:"col-span-2 py-20"})]})})]})};export{ks as default};
|
|
1
|
+
import{u as Y,aP as A,r as h,j as e,B as P,aQ as V,ai as C,aR as D,aS as J,ab as re,aj as f,aT as F,aU as ie,aV as le,af as oe,ag as U,aW as ne,S as q}from"./index-Bgo4hw-T.js";import{u as ce,c as de,D as me}from"./growth-BUQvBEMA.js";import{K as L,a as S,b as _,c as T}from"./kpi-card-CaX6eHyr.js";import{C as E,a as K,b as O,c as y,K as R,d as I,e as M,u as Q}from"./pagemenu-D3ByoZIR.js";import{D as pe,a as he,b as xe,c as ue,d as ge,e as je,f as fe,g as ve}from"./data-list-6rXP5AUF.js";import{u as be,p as Ne,N as ye,c as we}from"./links-lZnz9cuZ.js";import{M as ke}from"./wallet-cards-Cl4bJBBw.js";import{P as Ce,a as Le}from"./post-analytics-header-CpBVLNat.js";import{S as Se,K as _e}from"./kpis-BfR_uoFr.js";import{E as Te}from"./empty-indicator-CzTRebSi.js";import{G as De}from"./gh-chart-ldqA2tQU.js";import{u as X,S as Re}from"./post-analytics-context-BQ8IcW4n.js";import{h as Ie,i as Me}from"./post-helpers-gInwAwEv.js";import{S as Ae}from"./sprout-CXg43Zav.js";import"./source-icon-BDparw9V.js";import"./source-utils-B1S3ZHA2.js";import"./table-BWAnP2ln.js";import"./currency-fEUUCkj0.js";import"./stats-B2vPCVx7.js";import"./chart-0ezwQhyB.js";import"./_baseAssignValue-D0bBhNG1.js";import"./PolarAngleAxis-BzbazaED.js";import"./post-share-modal-Dz4BNSV-.js";import"./posts-C94RiQ4S.js";import"./trash-BKeiM6WP.js";import"./lucide-react-7D_Tsesk.js";import"./a-large-small-gBDqOWOy.js";import"./at-sign-V79EBNTJ.js";import"./message-square-text-DzuHB7uU.js";import"./copy-CTHgI4YI.js";import"./hash-CRtHv162.js";import"./inbox-DWYGFLuU.js";import"./list-filter-CofVbkA4.js";import"./minus-BIdO1CDG.js";import"./tags-BQz2NtFF.js";import"./square-C8G-1gV_.js";import"./user-round-check-Df7ko4Tm.js";import"./repeat-YTCeIlQZ.js";import"./reply-CUazFbTY.js";import"./tabs-Bw13eFRh.js";import"./index-D0RISNEd.js";const Pe=({post:o,isNewsletterStatsLoading:c,isWebShown:x})=>{const{postId:s}=Y(),a=A(),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}=be({searchParams:{filter:`post_id:'${s}'`}}),u=h.useMemo(()=>Ne(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))"}],n={percentage:{label:"Opened"},Average:{label:"Clicked"},"This newsletter":{label:"Opened"}},i=o.email_only||!x;return e.jsxs(E,{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(K,{children:e.jsxs(O,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(ke,{size:16,strokeWidth:1.5}),"Newsletter performance"]})}),e.jsx(P,{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"})]}),c?e.jsx(y,{children:e.jsx("div",{className:"mx-auto flex min-h-[250px] items-center justify-center xl:size-full",children:e.jsx(V,{})})}):e.jsxs(y,{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(R,{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(I,{color:"hsl(var(--chart-blue))",children:"Open rate"}),e.jsx(M,{value:C(t.openedRate)})]})}),e.jsx(R,{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(I,{color:"hsl(var(--chart-teal))",children:"Click rate"}),e.jsx(M,{value:C(t.clickedRate)})]})})]}),!i&&e.jsx(D,{}),e.jsx("div",{className:"mx-auto my-6 h-[240px]",children:e.jsx(ye,{className:"pointer-events-none aspect-square h-[240px]",config:n,data:g,tooltip:!1})})]}),e.jsxs("div",{className:`${i&&"pl-6"}`,children:[!i&&e.jsx(D,{}),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(J,{children:"Members"})]}),u.length>0?e.jsx(pe,{className:"",children:e.jsx(he,{children:u.slice(0,i?10:5).map(l=>{const r=t.clicked>0?l.count/t.clicked:0;return e.jsxs(xe,{children:[e.jsx(ue,{style:{width:`${r?Math.round(r*100):0}%`}}),e.jsx(ge,{children:e.jsxs("div",{className:"flex items-center space-x-2 overflow-hidden",children:[e.jsx(re,{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:we(l.link.to,!0)})]})}),e.jsxs(je,{children:[e.jsx(fe,{children:f(l.count||0)}),e.jsx(ve,{children:C(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."})]})]})]})]})},Ve=({chartData:o,range:c,isLoading:x,visitors:s,sourcesData:a,isNewsletterShown:t=!0})=>{const{postId:m}=Y(),u=A(),{data:g}=X(),n=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(E,{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(K,{children:e.jsxs(O,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(F,{size:16,strokeWidth:1.5}),"Web performance"]})}),e.jsx(P,{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(y,{children:[e.jsxs("div",{children:[e.jsx(R,{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(I,{color:"hsl(var(--chart-blue))",children:"Unique visitors"}),e.jsx(M,{value:f(s)})]})}),e.jsx(D,{}),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(V,{})}):e.jsx(De,{className:"aspect-auto h-[240px] w-full",color:"hsl(var(--chart-blue))",data:o||[],id:"visitors",range:c,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(J,{children:"Visitors"})]})}),a&&a.length>0?e.jsx(Se,{data:a,range:c,siteIcon:i,siteUrl:n,tableOnly:!0,topSourcesLimit:5,totalVisitors:l}):e.jsx(Te,{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(F,{strokeWidth:1.5})})]})]})]})})},ks=()=>{const o=A(),{statsConfig:c,isLoading:x,post:s,isPostLoading:a,postId:t}=X(),{totals:m,isLoading:u,currencySymbol:g}=ce(t),{appSettings:n}=ie(),{emailTrackClicks:i,emailTrackOpens:l}=n?.analytics||{},r=h.useMemo(()=>s?.published_at?le(s.published_at):Re.ALL_TIME.value,[s?.published_at]),{startDate:p,endDate:z,timezone:$}=oe(r),W=h.useMemo(()=>{const d={site_uuid:c?.id||"",date_from:U(p),date_to:U(z),timezone:$,post_uuid:""};return!a&&s?.uuid?{...d,post_uuid:s.uuid}:d},[a,s,c?.id,p,z,$]),{data:v,loading:G}=Q({endpoint:"api_kpis",statsConfig:c||{id:""},params:W}),Z=h.useMemo(()=>v?.length?v.reduce((d,j)=>{const H=Number(j.visits);return d+(isNaN(H)?0:H)},0):0,[v]),b=_e.visits,ee=ne(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:se,loading:ae}=Q({endpoint:"api_top_sources",statsConfig:c||{id:""},params:W}),B=x||u||a||G,te=a||x||G,w=Ie(s)&&l&&i,k=!s?.email_only&&n?.analytics.webAnalytics,N=n?.analytics.membersTrackSources;return h.useEffect(()=>{!a&&s&&Me(s)&&!n?.analytics.webAnalytics&&N&&o(`/posts/analytics/${t}/growth`,{replace:!0})},[a,s,n?.analytics.webAnalytics,o,t,N]),a?e.jsx(V,{}):e.jsxs(e.Fragment,{children:[e.jsx(Ce,{currentTab:"Overview"}),e.jsx(Le,{children:e.jsxs("div",{className:"flex flex-col gap-6 lg:grid lg:grid-cols-2",children:[k&&e.jsx(Ve,{chartData:ee,isLoading:te||B||ae,isNewsletterShown:w,range:r,sourcesData:se,visitors:Z}),w&&e.jsx(Pe,{isNewsletterStatsLoading:a,isWebShown:k,post:s}),N&&e.jsxs(E,{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(K,{children:e.jsxs(O,{className:"flex items-center gap-1.5 text-lg",children:[e.jsx(Ae,{size:16,strokeWidth:1.5}),"Growth"]})}),e.jsx(P,{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(y,{className:"flex flex-col gap-6 px-0 md:grid md:grid-cols-3 md:items-stretch md:gap-0",children:B?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(L,{className:"grow gap-1 py-0",children:[e.jsx(S,{children:"Free members"}),e.jsx(_,{children:e.jsx(T,{className:"text-[2.2rem]",children:f(m?.free_members||0)})})]}),n?.paidMembersEnabled&&e.jsxs(e.Fragment,{children:[e.jsxs(L,{className:"grow gap-1 py-0",children:[e.jsx(S,{children:"Paid members"}),e.jsx(_,{children:e.jsx(T,{className:"text-[2.2rem]",children:f(m?.paid_members||0)})})]}),e.jsxs(L,{className:"grow gap-1 py-0",children:[e.jsx(S,{children:"MRR impact"}),e.jsx(_,{children:e.jsxs(T,{className:"text-[2.2rem]",children:[g,f(de(m?.mrr||0))]})})]})]})]})})]}),!k&&!w&&!N&&e.jsx(me,{className:"col-span-2 py-20"})]})})]})};export{ks as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as bt,e as ea,ed as BL,ee as VL,ef as Nm,aL as zL,j as Lt,y as pe,an as lh,ao as GL,bE as FL,ap as HL,B as Xw,bK as WL,bF as UL,bG as YL}from"./index-
|
|
1
|
+
import{r as bt,e as ea,ed as BL,ee as VL,ef as Nm,aL as zL,j as Lt,y as pe,an as lh,ao as GL,bE as FL,ap as HL,B as Xw,bK as WL,bF as UL,bG as YL}from"./index-Bgo4hw-T.js";import{T as $L}from"./wallet-cards-Cl4bJBBw.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,aO as D}from"./index-
|
|
1
|
+
import{j as u,r as l,e as i,aO as D}from"./index-Bgo4hw-T.js";import{M as E}from"./main-layout-DBVy-lM5.js";import{P as j}from"./post-share-modal-Dz4BNSV-.js";import{u as b}from"./posts-C94RiQ4S.js";import{u as M}from"./post-analytics-context-BQ8IcW4n.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})})}),_=()=>{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}=_();return u.jsxs(C,{children:[u.jsx(D,{}),a&&r&&u.jsx(j,{...r})]})};export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as c,u as v,aI as p,aJ as y,aK as h,aL as D,j as C}from"./index-
|
|
1
|
+
import{r as c,u as v,aI as p,aJ as y,aK as h,aL as D,j as C}from"./index-Bgo4hw-T.js";import{u as I}from"./posts-C94RiQ4S.js";const k={TODAY:{name:"Today",value:1},LAST_7_DAYS:{name:"Last 7 days",value:7},LAST_30_DAYS:{name:"Last 30 days",value:31},LAST_90_DAYS:{name:"Last 90 days",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}},U={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"},x=["NULL","ᴺᵁᴸᴸ","","Others","Other"],t={PUBLIC:1,FREE:2,PAID:4},Y=t.PUBLIC|t.FREE|t.PAID,G=[{name:"Public visitors",value:"undefined",bit:t.PUBLIC},{name:"Free members",value:"free",bit:t.FREE},{name:"Paid members",value:"paid",bit:t.PAID}],m=c.createContext(void 0),w=()=>{const o=c.useContext(m);if(!o)throw new Error("useGlobalData must be used within a PostAnalyticsProvider");return o},B=({children:o})=>{const{postId:a}=v();if(!a)throw new Error("Post ID is required for PostAnalyticsProvider");const e=p(),s=y(),[g,A]=c.useState(k.LAST_30_DAYS.value),d=h(),n=!!e.data?.config?.stats,i=D({enabled:n}),{data:{posts:[S]}={posts:[]},isLoading:L}=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=[e,s,d],T=u.map(r=>r.error).find(Boolean),_=n?i.error:null,l=T||_,b=u.some(r=>r.isLoading),E=n?i.isLoading:!1,P=b||E;if(l)throw l;const f=s.data?.site?{url:s.data.site.url,icon:s.data.site.icon,title:s.data.site.title}:void 0;return C.jsx(m.Provider,{value:{data:e.data?.config,site:f,statsConfig:e.data?.config?.stats,tinybirdToken:i.token,isLoading:P,range:g,setRange:A,settings:d.data?.settings||[],postId:a,post:S,isPostLoading:L},children:o})},R=Object.freeze(Object.defineProperty({__proto__:null,default:B,useGlobalData:w},Symbol.toStringTag,{value:"Module"}));export{Y as A,k as S,x as U,U as a,G as b,t as c,R as p,w as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as l,j as e,y as d,bI as I,C as W,aP as z,aU as U,bJ as V,aj as F,B as k,bE as H,ap as J,bK as K,bF as Y,bL as D,bG as g,x as q,bM as Q,bN as X,bO as j,bP as w,aT as Z,a0 as ee,a1 as se,a2 as ae,a3 as te,a4 as re,a5 as ie,a6 as le,a7 as ne}from"./index-
|
|
1
|
+
import{r as l,j as e,y as d,bI as I,C as W,aP as z,aU as U,bJ as V,aj as F,B as k,bE as H,ap as J,bK as K,bF as Y,bL as D,bG as g,x as q,bM as Q,bN as X,bO as j,bP as w,aT as Z,a0 as ee,a1 as se,a2 as ae,a3 as te,a4 as re,a5 as ie,a6 as le,a7 as ne}from"./index-Bgo4hw-T.js";import{h as oe,N as ce,P as de,i as u}from"./pagemenu-D3ByoZIR.js";import{P as me}from"./post-share-modal-Dz4BNSV-.js";import{u as ue}from"./post-analytics-context-BQ8IcW4n.js";import{i as C,h as pe,a as xe,b as he}from"./post-helpers-gInwAwEv.js";import{a as be}from"./posts-C94RiQ4S.js";import{S as fe,P as ge,G as je,M as we}from"./wallet-cards-Cl4bJBBw.js";import{T as ye}from"./trash-BKeiM6WP.js";import{S as ve}from"./sprout-CXg43Zav.js";const P=l.forwardRef(({...r},t)=>e.jsx("nav",{ref:t,"aria-label":"breadcrumb",...r}));P.displayName="Breadcrumb";const S=l.forwardRef(({className:r,...t},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]",r),...t}));S.displayName="BreadcrumbList";const p=l.forwardRef(({className:r,...t},a)=>e.jsx("li",{ref:a,className:d("inline-flex items-center gap-1.5",r),...t}));p.displayName="BreadcrumbItem";const y=l.forwardRef(({asChild:r,className:t,...a},x)=>{const i=r?I:"a";return e.jsx(i,{ref:x,className:d("inline-flex items-center gap-1 transition-colors hover:text-foreground",t),...a})});y.displayName="BreadcrumbLink";const T=l.forwardRef(({className:r,...t},a)=>e.jsx("span",{ref:a,"aria-current":"page","aria-disabled":"true",className:d("font-medium text-foreground",r),role:"link",...t}));T.displayName="BreadcrumbPage";const B=({children:r,className:t,...a})=>e.jsx("li",{"aria-hidden":"true",className:d("[&>svg]:w-3.5 [&>svg]:h-3.5",t),role:"presentation",...a,children:r??e.jsx(W,{})});B.displayName="BreadcrumbSeparator";const Me=({children:r,className:t,...a})=>e.jsx("section",{className:d("flex gap-6 flex-col py-8 size-full grow",t),...a,children:r}),Ne=r=>{for(const t of r)if(t.key==="timezone"){const a=t.value;if(typeof a!="string")throw new TypeError("Site timezone setting is not a string");return a}return"Etc/UTC"},Oe=({currentTab:r,children:t})=>{const a=z(),{fromAnalytics:x,appSettings:i}=U(),{mutateAsync:E}=be(),_=V(),[M,h]=l.useState(!1),[O,b]=l.useState(!1),{settings:$,site:v,statsConfig:L,post:s,isPostLoading:f,postId:o}=ue(),c=Ne($),{activeVisitors:N,isLoading:A}=oe({postUuid:s?.uuid,statsConfig:L,enabled:i?.analytics?.webAnalytics??!1}),m=l.useMemo(()=>{if(!s)return[];const n=[];return C(s)&&!i?.analytics.webAnalytics||(n.push("Overview"),!s.email_only&&i?.analytics.webAnalytics&&n.push("Web")),pe(s)&&n.push("Newsletter"),i?.analytics.membersTrackSources&&n.push("Growth"),n},[s,i?.analytics.webAnalytics,i?.analytics.membersTrackSources]),G=()=>{s&&h(!0)},R=async()=>{if(s)try{await E(o),h(!1),a("/posts/",{crossApp:!0})}catch(n){_(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(P,{children:e.jsxs(S,{children:[x?e.jsx(p,{children:e.jsx(y,{className:"cursor-pointer leading-[24px]",onClick:()=>a("/analytics/",{crossApp:!0}),children:"Analytics"})}):e.jsx(p,{children:e.jsx(y,{className:"cursor-pointer leading-[24px]",onClick:()=>a("/posts/",{crossApp:!0}),children:"Posts"})}),e.jsx(B,{}),e.jsx(p,{children:e.jsx(T,{className:"leading-[24px]",children:"Post analytics"})})]})}),e.jsxs("div",{className:"flex w-full items-center gap-2 md:w-auto",children:[i?.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:[A?"":F(N)," reading now"]}),e.jsx("div",{className:`size-2 rounded-full ${A?"animate-pulse bg-muted":N?"bg-green-500":"border border-muted-foreground"}`})]})}),!f&&e.jsxs(e.Fragment,{children:[!s?.email_only&&e.jsx(me,{author:s?.authors?.[0]?.name||"",description:"",faviconURL:v?.icon||"",featureImageURL:s?.feature_image,open:O,postExcerpt:s?.excerpt||"",postTitle:s?.title,postURL:s?.url,siteTitle:v?.title||"",onClose:()=>b(!1),onOpenChange:b,children:e.jsxs(k,{variant:"outline",onClick:()=>b(!0),children:[e.jsx(fe,{})," Share"]})}),e.jsxs(H,{children:[e.jsx(J,{asChild:!0,children:e.jsx(k,{variant:"outline",children:e.jsx(K,{})})}),e.jsxs(Y,{align:"end",children:[e.jsxs(D,{children:[e.jsx(g,{asChild:!0,children:e.jsxs("a",{href:s?.url,rel:"noopener noreferrer",target:"_blank",children:[e.jsx(q,{}),"View in browser"]})}),e.jsxs(g,{onClick:()=>{a(`/editor/post/${o}`,{crossApp:!0})},children:[e.jsx(ge,{}),"Edit post"]})]}),e.jsx(Q,{}),e.jsx(D,{children:e.jsxs(g,{className:"text-destructive focus:text-destructive",onClick:G,children:[e.jsx(ye,{}),"Delete post"]})})]})]})]})]})]}),!f&&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:[xe(s)&&`Sent on ${j(s.published_at,c)} at ${w(s.published_at,c)}`,C(s)&&`Published on your site on ${j(s.published_at,c)} at ${w(s.published_at,c)}`,he(s)&&`Published and sent on ${j(s.published_at,c)} at ${w(s.published_at,c)}`]})]})]})]})})}),e.jsxs(ce,{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:[!f&&e.jsxs(de,{className:"min-h-[34px]",defaultValue:r,responsive:!0,children:[m.includes("Overview")&&e.jsxs(u,{value:"Overview",onClick:()=>{a(`/posts/analytics/${o}`)},children:[e.jsx(je,{}),"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(we,{}),"Newsletter"]}),m.includes("Growth")&&e.jsxs(u,{value:"Growth",onClick:()=>{a(`/posts/analytics/${o}/growth`)},children:[e.jsx(ve,{}),"Growth"]})]}),t]}),e.jsx(ee,{open:M,onOpenChange:h,children:e.jsxs(se,{children:[e.jsxs(ae,{children:[e.jsx(te,{children:"Are you sure you want to delete this post?"}),e.jsxs(re,{children:[`You're about to delete "`,e.jsx("strong",{children:s?.title}),'". This is permanent! We warned you, k?']})]}),e.jsxs(ie,{children:[e.jsx(le,{children:"Cancel"}),e.jsx(ne,{className:"hover:bg-red-700 bg-red-600 text-white",onClick:R,children:"Delete"})]})]})})]})};export{Oe as P,Me as a};
|
package/core/built/admin/assets/{post-share-modal-D1JQfuYx.js → post-share-modal-Dz4BNSV-.js}
RENAMED
|
@@ -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-
|
|
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-Bgo4hw-T.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-
|
|
1
|
+
import{ac as e,ad as o,ae as a}from"./index-Bgo4hw-T.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{r as o,aX as Pe,aq as mt,ar as Te,j as r,aY as ht,as as vt,at as be,aZ as gt,aE as L,a_ as $,au as j,aF as xt,a$ as St,b0 as wt,ay as N,b1 as yt,aB as Re,b2 as Ct,b3 as bt,b4 as It,b5 as Tt,b6 as Nt,b7 as Pt,b8 as Rt,b9 as Et,ba as _t,y as G,bb as Ee,bc as jt,$ as Mt}from"./index-DCTdAEHx.js";import{C as At}from"./message-square-text-BDZtUW-2.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]=gt(Q),[oe]=vt(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:g,autoComplete:w,disabled:P,required:I,form:C}=t,d=ue(n),[h,x]=o.useState(null),[m,v]=o.useState(null),[U,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:v,valueNodeHasChildren:U,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 F=new Set(D);return F.delete(E),F})},[]),children:e})}),B?r.jsxs(tt,{"aria-hidden":!0,required:I,tabIndex:-1,name:g,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),g=o.useRef("touch"),[w,P,I]=nt(d=>{const h=f().filter(v=>!v.disabled),x=h.find(v=>v.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(),g.current!=="mouse"&&C(d)}),onPointerDown:N(a.onPointerDown,d=>{g.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,g=u!==void 0,w=L(n,i.onValueNodeChange);return $(()=>{f(g)},[f,g]),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 Ft="SelectPortal",Le=t=>r.jsx(yt,{asChild:!0,...t});Le.displayName=Ft;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),Ut="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:g,arrowPadding:w,collisionBoundary:P,collisionPadding:I,sticky:C,hideWhenDetached:d,avoidCollisions:h,...x}=t,m=Y(ee,e),[v,U]=o.useState(null),[M,ne]=o.useState(null),R=L(n,p=>U(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(v)return bt(v)},[v]),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,v]),[E,O,v]);o.useEffect(()=>{K&&D()},[K,D]);const{onOpenChange:F,triggerPointerDownPosRef:z}=m;o.useEffect(()=>{if(v){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():v.contains(S.target)||F(!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})}}},[v,F,z]),o.useEffect(()=>{const p=()=>F(!1);return window.addEventListener("blur",p),window.addEventListener("resize",p),()=>{window.removeEventListener("blur",p),window.removeEventListener("resize",p)}},[F]);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(()=>v?.focus(),[v]),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:g,arrowPadding:w,collisionBoundary:P,collisionPadding:I,sticky:C,hideWhenDetached:d,avoidCollisions:h}:{};return r.jsx(Be,{scope:e,content:v,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=Ut;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,g]=o.useState(null),w=L(n,R=>g(R)),P=de(e),I=o.useRef(!1),C=o.useRef(!0),{viewport:d,selectedItem:h,selectedItemText:x,focusSelectedItem:m}=s,v=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),ve=window.innerWidth-A,ge=Ne(T,[A,Math.max(A,ve-he)]);c.style.minWidth=J+"px",c.style.left=ge+"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),ve=window.innerWidth-A,ge=Ne(T,[A,Math.max(A,ve-he)]);c.style.minWidth=J+"px",c.style.right=ge+"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),F=parseInt(V.paddingBottom,10),z=H+E+K+F+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]);$(()=>v(),[v]);const[U,M]=o.useState();$(()=>{f&&M(window.getComputedStyle(f).zIndex)},[f]);const ne=o.useCallback(R=>{R&&C.current===!0&&(v(),m?.(),C.current=!1)},[v,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:U},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",Fe=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 g=f.currentTarget,{contentWrapper:w,shouldExpandOnScrollRef:P}=s;if(P?.current&&w){const I=Math.abs(i.current-g.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,v=Math.min(C,m),U=m-v;w.style.height=v+"px",w.style.bottom==="0px"&&(g.scrollTop=U>0?U:0,w.style.justifyContent="flex-end")}}}i.current=g.scrollTop})})})]})});Fe.displayName=Se;var Ue="SelectGroup",[Gt,Yt]=oe(Ue),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=Ue;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,[g,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(v=>v||(m?.textContent??"").trim())},[]),children:r.jsx(ie.ItemSlot,{scope:e,value:l,disabled:a,textValue:g,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),[g,w]=o.useState(null),P=L(n,x=>w(x),i.onItemTextChange,x=>c.itemTextRefCallback?.(x,i.value,i.disabled)),I=g?.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,g=Math.ceil(i.scrollTop)<f;u(g)};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(g=>g.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,g=Object.getOwnPropertyDescriptor(i,"value").set;if(s!==n&&g){const w=new Event("change",{bubbles:!0});g.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=Fe,so=We,lt=ze,ct=Ge,ao=Ye,lo=Xe,it=Ze,dt=Je,ut=et;const vo=eo,go=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{vo as S,co as a,xo as b,io as c,go as d,uo as e,po as f};
|
|
1
|
+
import{r as o,aX as Pe,aq as mt,ar as Te,j as r,aY as ht,as as vt,at as be,aZ as gt,aE as L,a_ as $,au as j,aF as xt,a$ as St,b0 as wt,ay as N,b1 as yt,aB as Re,b2 as Ct,b3 as bt,b4 as It,b5 as Tt,b6 as Nt,b7 as Pt,b8 as Rt,b9 as Et,ba as _t,y as G,bb as Ee,bc as jt,$ as Mt}from"./index-Bgo4hw-T.js";import{C as At}from"./message-square-text-DzuHB7uU.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]=gt(Q),[oe]=vt(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:g,autoComplete:w,disabled:P,required:I,form:C}=t,d=ue(n),[h,x]=o.useState(null),[m,v]=o.useState(null),[U,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:v,valueNodeHasChildren:U,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 F=new Set(D);return F.delete(E),F})},[]),children:e})}),B?r.jsxs(tt,{"aria-hidden":!0,required:I,tabIndex:-1,name:g,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),g=o.useRef("touch"),[w,P,I]=nt(d=>{const h=f().filter(v=>!v.disabled),x=h.find(v=>v.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(),g.current!=="mouse"&&C(d)}),onPointerDown:N(a.onPointerDown,d=>{g.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,g=u!==void 0,w=L(n,i.onValueNodeChange);return $(()=>{f(g)},[f,g]),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 Ft="SelectPortal",Le=t=>r.jsx(yt,{asChild:!0,...t});Le.displayName=Ft;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),Ut="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:g,arrowPadding:w,collisionBoundary:P,collisionPadding:I,sticky:C,hideWhenDetached:d,avoidCollisions:h,...x}=t,m=Y(ee,e),[v,U]=o.useState(null),[M,ne]=o.useState(null),R=L(n,p=>U(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(v)return bt(v)},[v]),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,v]),[E,O,v]);o.useEffect(()=>{K&&D()},[K,D]);const{onOpenChange:F,triggerPointerDownPosRef:z}=m;o.useEffect(()=>{if(v){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():v.contains(S.target)||F(!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})}}},[v,F,z]),o.useEffect(()=>{const p=()=>F(!1);return window.addEventListener("blur",p),window.addEventListener("resize",p),()=>{window.removeEventListener("blur",p),window.removeEventListener("resize",p)}},[F]);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(()=>v?.focus(),[v]),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:g,arrowPadding:w,collisionBoundary:P,collisionPadding:I,sticky:C,hideWhenDetached:d,avoidCollisions:h}:{};return r.jsx(Be,{scope:e,content:v,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=Ut;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,g]=o.useState(null),w=L(n,R=>g(R)),P=de(e),I=o.useRef(!1),C=o.useRef(!0),{viewport:d,selectedItem:h,selectedItemText:x,focusSelectedItem:m}=s,v=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),ve=window.innerWidth-A,ge=Ne(T,[A,Math.max(A,ve-he)]);c.style.minWidth=J+"px",c.style.left=ge+"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),ve=window.innerWidth-A,ge=Ne(T,[A,Math.max(A,ve-he)]);c.style.minWidth=J+"px",c.style.right=ge+"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),F=parseInt(V.paddingBottom,10),z=H+E+K+F+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]);$(()=>v(),[v]);const[U,M]=o.useState();$(()=>{f&&M(window.getComputedStyle(f).zIndex)},[f]);const ne=o.useCallback(R=>{R&&C.current===!0&&(v(),m?.(),C.current=!1)},[v,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:U},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",Fe=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 g=f.currentTarget,{contentWrapper:w,shouldExpandOnScrollRef:P}=s;if(P?.current&&w){const I=Math.abs(i.current-g.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,v=Math.min(C,m),U=m-v;w.style.height=v+"px",w.style.bottom==="0px"&&(g.scrollTop=U>0?U:0,w.style.justifyContent="flex-end")}}}i.current=g.scrollTop})})})]})});Fe.displayName=Se;var Ue="SelectGroup",[Gt,Yt]=oe(Ue),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=Ue;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,[g,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(v=>v||(m?.textContent??"").trim())},[]),children:r.jsx(ie.ItemSlot,{scope:e,value:l,disabled:a,textValue:g,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),[g,w]=o.useState(null),P=L(n,x=>w(x),i.onItemTextChange,x=>c.itemTextRefCallback?.(x,i.value,i.disabled)),I=g?.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,g=Math.ceil(i.scrollTop)<f;u(g)};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(g=>g.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,g=Object.getOwnPropertyDescriptor(i,"value").set;if(s!==n&&g){const w=new Event("change",{bubbles:!0});g.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=Fe,so=We,lt=ze,ct=Ge,ao=Ye,lo=Xe,it=Ze,dt=Je,ut=et;const vo=eo,go=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{vo as S,co as a,xo as b,io as c,go as d,uo as e,po as f};
|