1import{m as F}from"./vue3-apexcharts-DUfcJClU.js";import{f as g}from"./NumberHelpers-BClf9MwZ.js";import{_ as C}from"./InfoTooltip-CPi1ys-b.js";import{r as E,p as r,e as A,b as a,d as b,g as z,o as D,S as M}from"./app-DLVO1ZW7.js";import"./info-circle-Bed_7EX6.js";import"./TooltipHelpers-BfXJe2AN.js";const B={class:"bg-white dark:bg-dark-800 border dark:border-dark-700 rounded-md overflow-hidden"},N={class:"px-4 py-3 border-b dark:border-dark-700 flex items-start justify-between gap-2"},O={class:"p-3"},$=.5,I={__name:"RetentionCurveChart",props:{cohorts:Object,filters:Object},setup(k){const y=M(F),l=k,s=E(document.documentElement.classList.contains("dark")),h=r(()=>({hours:"Hour",days:"Day",weeks:"Week",months:"Month",years:"Year"})[l.filters.range_type]??"Period"),u=r(()=>{var v;const e=l.cohorts.cohorts,o=e.reduce((t,i)=>t+i.size,0),p=[],f=[];for(let t=0;t<l.cohorts.period_count;t++){let i=0,n=0;for(const c of e){const d=(v=c.retention)==null?void 0:v[t];d!=null&&(i+=d*c.size,n+=c.size)}const _=o>0?n/o:0;if(t>1&&_<$)break;p.push(n>0?Math.round(i/n*10)/10:null),f.push(`${h.value} ${t}`)}return{values:p,labels:f}}),w=r(()=>[{name:"Avg retention",data:u.value.values}]),x=r(()=>` 2 <div> 3 <div class="font-bold text-green-300">Average retention</div> 4 <div>Size-weighted average share of cohorts still returning at each ${h.value.toLowerCase()} of age. The curve stops where fewer than half of registered users have reached that age, to avoid a survivorship-biased tail from only the oldest cohorts.</div> 5 </div> 6`),m=r(()=>({chart:{height:260,type:"area",toolbar:{show:!1},zoom:{enabled:!1},background:s.value?"#262626":"#FFFFFF"},theme:{mode:s.value?"dark":"light"},colors:[s.value?"#00A3E0":"#3b82f6"],stroke:{width:2,curve:"smooth"},fill:{type:"gradient",gradient:{opacityFrom:.4,opacityTo:.05}},dataLabels:{enabled:!1},xaxis:{type:"string",categories:u.value.labels,tickAmount:8,labels:{rotate:0},tooltip:{enabled:!1}},yaxis:{min:0,labels:{formatter:e=>e==null?"":g.percent(e,{minimumFractionDigits:0,maximumFractionDigits:0})}},tooltip:{y:{formatter:e=>e==null?"â":g.percent(e,{minimumFractionDigits:1,maximumFractionDigits:1})}},grid:{borderColor:s.value?"#3f3f46":"#E5E7EB"}}));return(e,o)=>(D(),A("div",B,[a("div",N,[o[0]||(o[0]=a("div",null,[a("h3",{class:"font-medium text-gray-900 dark:text-dark-100"},"Average retention curve"),a("p",{class:"text-sm text-gray-500 dark:text-dark-400"}," How retention decays with cohort age, averaged across the visible cohorts. It stops where too few cohorts have reached that age, so the tail is not skewed by only the oldest ones. ")],-1)),b(C,{html:x.value,placement:"left",iconClass:"shrink-0 size-5"},null,8,["html"])]),a("div",O,[b(z(y),{type:"area",height:m.value.chart.height,options:m.value,series:w.value},null,8,["height","options","series"])])]))}};export{I as default};
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.