import{u as v,d as g}from"./links.23796d97.js";import{C as T}from"./index.0eabb636.js";import{C as f}from"./DonutChartWithLegend.75733bae.js";import{r as p,o as i,c as n,t as c,f as l,a as h,b as d,K as b,L as w,F as P,h as k,d as S,n as $}from"./vue.runtime.esm-bundler.b39e1078.js";import{_ as C}from"./_plugin-vue_export-helper.b97bdf23.js";const D={setup(){return{rootStore:v(),settingsStore:g()}},components:{CoreAlert:T,CoreDonutChartWithLegend:f},props:{isWpDashboard:{type:Boolean,default(){return!1}},toHide:{type:Array,default(){return[]}},showDescription:{type:Boolean,default(){return!0}}},data(){return{strings:{description:this.$t.__("Below are the TruSEO scores of your published posts. Take some time to improve your TruSEO score to help increase your rankings.",this.$td),choosePostType:this.$t.__("Choose a Post Type",this.$td),upgradeToPro:this.$t.sprintf(this.$t.__("Get additional keyphrases and many more modules! %1$s",this.$td),this.$links.getUpsellLink("dashboard-overview",this.$t.__("Upgrade to Pro Today!",this.$td),"liteUpgrade",!0))},postTypeInitial:!0,postType:{},parts:[{slug:"needsImprovement",name:this.$t.__("Needs Improvement",this.$td),color:"#DF2A4A"},{slug:"okay",name:this.$t.__("Okay",this.$td),color:"#F18200"},{slug:"good",name:this.$t.__("Good",this.$td),color:"#00AA63"},{slug:"withoutFocusKeyphrase",name:this.$t.__("Without a Focus Keyphrase",this.$td),color:"#E8E8EB"}]}},watch:{postType(t){if(this.postTypeInitial){this.postTypeInitial=!1;return}this.settingsStore.toggleRadio({slug:"overviewPostType",value:t.value})}},computed:{postTypes(){const t=[];return this.rootStore.aioseo.postData.postTypes.forEach(e=>{this.rootStore.aioseo.seoOverview[e.name]&&t.push({value:e.name,label:e.label})}),t},totalPosts(){return this.rootStore.aioseo.seoOverview[this.postType.value].total},totalPostsLabel(){return this.$t.sprintf(this.$t.__("Total %1$s",this.$td),this.postType.label)},sortedParts(){const t=this.parts;return t.forEach((e,o)=>{t[o].count=this.rootStore.aioseo.seoOverview[this.postType.value][e.slug],t[o].ratio=o===0?100:e.count/this.totalPosts*100,t[o].link=`${this.rootStore.aioseo.urls.editScreen}?post_status=publish&post_type=${this.postType.value}&aioseo-filter=${e.slug}`}),t.filter(e=>e.count!==0),t.forEach((e,o)=>(o===0||t.forEach((u,s)=>(o<s&&(e.ratio=e.ratio+u.ratio),e)),e)),t}},mounted(){this.$nextTick(()=>{var o;const t=(o=this.settingsStore.settings.toggledRadio)==null?void 0:o.overviewPostType,e=this.postTypes.findIndex(u=>t===u.value);this.postType=this.postTypes[e]||this.postTypes[0]})}},A={key:0,class:"aioseo-overview-description"},E={class:"aioseo-overview-selector"},L=["value"];function B(t,e,o,u,s,a){const y=p("base-select"),_=p("core-donut-chart-with-legend"),m=p("core-alert");return s.postType.value?(i(),n("div",{key:0,class:$(["aioseo-overview",o.isWpDashboard?"aioseo-overview--wp-styles":""])},[o.toHide.includes("description")?l("",!0):(i(),n("p",A,c(s.strings.description),1)),h("div",E,[h("strong",null,c(s.strings.choosePostType),1),o.isWpDashboard?l("",!0):(i(),d(y,{key:0,size:"medium",placeholder:s.strings.choosePostType,options:a.postTypes,modelValue:s.postType,"onUpdate:modelValue":e[0]||(e[0]=r=>s.postType=r)},null,8,["placeholder","options","modelValue"])),o.isWpDashboard?b((i(),n("select",{key:1,"onUpdate:modelValue":e[1]||(e[1]=r=>s.postType=r)},[(i(!0),n(P,null,k(a.postTypes,r=>(i(),n("option",{key:r.value,value:r},c(r.label),9,L))),128))],512)),[[w,s.postType]]):l("",!0)]),S(_,{parts:a.sortedParts,total:a.totalPosts,label:a.totalPostsLabel,animatedNumber:!o.isWpDashboard},null,8,["parts","total","label","animatedNumber"]),!o.toHide.includes("upgradeAlert")&&!t.$isPro?(i(),d(m,{key:1,type:"yellow",innerHTML:s.strings.upgradeToPro},null,8,["innerHTML"])):l("",!0)],2)):l("",!0)}const N=C(D,[["render",B]]);export{N as C};
