import"./WpTable.8adff4c1.js";import"./default-i18n.ab92175e.js";import"./constants.e9426d11.js";import{_ as b,r as p,o as v,c as O,d as a,w as r,e as _,t as o,f as n,g as d}from"./_plugin-vue_export-helper.2d9794a3.js";import"./index.02a5ed9a.js";import{J as k}from"./JsonValues.870a4901.js";import"./SaveChanges.bc66cd69.js";import{m as C}from"./vuex.esm-bundler.8589b2dd.js";import{B as T,S as $}from"./Caret.42a820e0.js";import{a as S}from"./index.fd0fcee8.js";import{S as B}from"./AddPlus.303f6aa6.js";import{S as V}from"./External.e98f124d.js";const j={components:{BaseButton:T,BaseSelect:S,SvgAddPlus:B,SvgClose:$,SvgExternal:V},mixins:[k],props:{options:{type:Object,required:!0},type:{type:String,required:!0}},data(){return{excludeOptions:[],strings:{typeToSearch:this.$t.__("Type to search...",this.$td),noOptionsPosts:this.$t.__("Begin typing a post ID, title or slug to search...",this.$td),noOptionsTerms:this.$t.__("Begin typing a term ID or name to search...",this.$td),noResult:this.$t.__("No results found for your search. Try again!",this.$td),clear:this.$t.__("Clear",this.$td),id:this.$t.__("ID",this.$td),type:this.$t.__("Type",this.$td)}}},computed:{optionName:{get(){return this.type==="posts"?this.options.excludePosts:this.options.excludeTerms},set(s){if(this.type==="posts"){this.options.excludePosts=s;return}this.options.excludeTerms=s}},noOptions(){return this.type==="posts"?this.strings.noOptionsPosts:this.strings.noOptionsTerms}},methods:{...C(["getObjects"]),processGetObjects(s){return this.getObjects({query:s,type:this.type}).then(e=>{this.excludeOptions=e.body.objects})},getOptionTitle(s,e){const c=new RegExp(`(${e})`,"gi");return s.replace(c,'<span class="search-term">$1</span>')},searchableLabel({value:s,label:e,slug:c}){return`${s} ${e} ${c}`}}},L={class:"aioseo-exclude-posts"},N={class:"option"},P=["innerHTML"],w={class:"option-details"},A=["href"],E={class:"multiselect__tag"},R={class:"multiselect__tag-value"},D=["onClick"];function J(s,e,c,q,l,i){const h=p("svg-add-plus"),m=p("base-button"),g=p("svg-external"),y=p("svg-close"),x=p("base-select");return v(),O("div",L,[a(x,{options:l.excludeOptions,"ajax-search":i.processGetObjects,customLabel:i.searchableLabel,size:"medium",multiple:"",modelValue:s.getJsonValues(i.optionName),"onUpdate:modelValue":e[1]||(e[1]=t=>i.optionName=s.setJsonValues(t)),placeholder:l.strings.typeToSearch},{noOptions:r(()=>[_(o(i.noOptions),1)]),noResult:r(()=>[_(o(l.strings.noResult),1)]),caret:r(({toggle:t})=>[a(m,{class:"multiselect-toggle",style:{padding:"10px 13px",width:"40px",position:"absolute",height:"36px",right:"2px",top:"2px","text-align":"center",transition:"transform .2s ease"},type:"gray",onClick:t},{default:r(()=>[a(h,{style:{width:"14px",height:"14px",color:"black"}})]),_:2},1032,["onClick"])]),option:r(({option:t,search:u})=>[n("div",N,[n("div",{class:"option-title",innerHTML:i.getOptionTitle(t.label,u)},null,8,P),n("div",w,[n("span",null,o(l.strings.id)+": #"+o(t.value),1),n("span",null,o(l.strings.type)+": "+o(t.type),1)])]),n("a",{class:"option-permalink",href:t.link,target:"_blank",onClick:e[0]||(e[0]=d(()=>{},["stop"]))},[a(g)],8,A)]),tag:r(({option:t,remove:u})=>[n("div",E,[n("div",R,o(t.label)+" - #"+o(t.value),1),n("div",{class:"multiselect__tag-remove",onClick:d(f=>u(t),["stop"])},[a(y,{onClick:d(f=>u(t),["stop"])},null,8,["onClick"])],8,D)])]),_:1},8,["options","ajax-search","customLabel","modelValue","placeholder"]),a(m,{type:"gray",size:"medium",onClick:e[2]||(e[2]=t=>i.optionName=[])},{default:r(()=>[_(o(l.strings.clear),1)]),_:1})])}const Z=b(j,[["render",J]]);export{Z as C};
