import{a as l}from"./index.684c656d.js";import{r as i,a as u,g as c}from"./params.af7ed354.js";import{u as m}from"./Network.4cfad788.js";import"./translations.d159963e.js";import{_ as p}from"./_plugin-vue_export-helper.eefbdd86.js";import{_ as d}from"./default-i18n.20001971.js";import{y as f,o as _,d as h,H as w}from"./runtime-dom.esm-bundler.d8b05b6d.js";const k="all-in-one-seo-pack",S={emits:["selected-site"],setup(){const{getSites:t,getUniqueSiteId:e}=m();return{rootStore:l(),getSites:t,getUniqueSiteId:e}},props:{followSelectedSite:Boolean,showNetwork:Boolean},data(){return{site:null,network:{value:"network",label:d("Network Admin (no site)",k)}}},watch:{site(t){let e=this.rootStore.aioseo.data.network.sites.sites.find(o=>this.getUniqueSiteId(o)===t.value);t.value==="network"&&(e={blog_id:"network"}),this.$emit("selected-site",e),this.followSelectedSite&&this.querySelectedSite()}},computed:{sites(){const t=this.getSites.filter(e=>!e.parentDomain).map(e=>({value:this.getUniqueSiteId(e),label:`${e.domain}${e.path}`}));return this.showNetwork?[this.network].concat(t):t}},methods:{querySelectedSite(){i("aioseo-selected-site-value"),this.site.value!=="network"&&u("aioseo-selected-site-value",this.site.value)}},created(){const t=c();if(t["aioseo-selected-site-value"])return this.site=this.sites.find(e=>e.value===decodeURIComponent(t["aioseo-selected-site-value"])),i("aioseo-selected-site-value"),!1;this.showNetwork&&(this.site=this.network)}},v={class:"aioseo-network-site-selector"};function g(t,e,o,y,s,n){const r=f("base-select");return _(),h("div",v,[w(r,{size:"medium",modelValue:s.site,"onUpdate:modelValue":e[0]||(e[0]=a=>s.site=a),options:n.sites},null,8,["modelValue","options"])])}const C=p(S,[["render",g]]);export{C};
