import{g as l,r as i,D as u,b as c}from"./app-core.b862f9c8.js";import{u as p}from"./Network.6b54b298.js";import{_ as d}from"./_plugin-vue_export-helper.eefbdd86.js";import{_ as m}from"./vendor-other.7b559694.js";import{aq as f,f as _,i as h,a0 as w}from"./vendor-vue-ui.f00a1236.js";const k="all-in-one-seo-pack",S={emits:["selected-site"],setup(){const{getSites:t,getUniqueSiteId:e}=p();return{rootStore:c(),getSites:t,getUniqueSiteId:e}},props:{followSelectedSite:Boolean,showNetwork:Boolean},data(){return{site:null,network:{value:"network",label:m("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=l();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 A=d(S,[["render",g]]);export{A as C};
