import{u as v,m as g}from"./links.96ffe3f0.js";import{C as T}from"./index.57ad6f19.js";import{C as f}from"./DonutChartWithLegend.e13a433d.js";import{r as p,o as i,c as n,x as c,b as l,a as h,d,J as b,K as w,F as P,C as k,g as S,n as C}from"./vue.runtime.esm-bundler.f433d23f.js";import{_ as $}from"./_plugin-vue_export-helper.3febc96a.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:C(["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 F=$(D,[["render",B]]);export{F as C};
