import{C}from"./Tooltip.e5a30815.js";import{S as q}from"./Trash.544ebd43.js";import{_ as S}from"./_plugin-vue_export-helper.eefbdd86.js";import{a7 as f,o,a3 as a,a4 as u,a as g,t as n,c as y,w as i,q as P,b as l,a6 as c,F as b,af as A}from"./runtime-core.esm-bundler.50cb9e6d.js";import{_ as L}from"./Button.898cae57.js";import"./translations.e71e2202.js";import{b as T,H as w}from"./index.6205915e.js";import{a as h}from"./runtime-dom.esm-bundler.36191dca.js";import{_ as k,a as D}from"./default-i18n.65d58dd6.js";const F={components:{CoreTooltip:C,SvgCircleQuestionMark:q},props:{header:{type:String,required:!0},headerTooltip:{type:String,required:!1}}},x={class:"aioseo-field-group"},B={class:"header"},O={class:"header-title"},J={class:"fields"},R={key:0,class:"footer"};function V(e,s,r,v,G,t){const m=f("svg-circle-question-mark"),_=f("core-tooltip");return o(),a("section",x,[u("div",B,[u("span",O,[g(n(r.header)+" ",1),r.headerTooltip?(o(),y(_,{key:0},{tooltip:i(()=>[g(n(r.headerTooltip),1)]),default:i(()=>[P(m)]),_:1})):l("",!0)]),c(e.$slots,"header-extra")]),u("div",J,[c(e.$slots,"default")]),e.$slots.footer?(o(),a("div",R,[c(e.$slots,"footer")])):l("",!0)])}const M=S(F,[["render",V]]),N="aioseo-pro",E={setup(){return{rootStore:T()}},components:{BaseButton:L,FieldGroup:M},props:{groupProp:{type:Array,required:!0},defaults:{type:Object,required:!0},pluralName:{type:String,required:!0},singularName:{type:String,required:!0},maxGroups:{type:Number,required:!1},minGroups:{type:Number,default(){return 1}},headerTooltip:{type:String,required:!1},onAddGroup:{type:Function,required:!1},onDeleteGroup:{type:Function,required:!1}},data(){return{strings:{delete:k("Delete",N)}}},computed:{addLink(){return D(k("Add Another %1$s",N),this.singularName)},showLink(){if(!this.singularName)return!1;const e=this.maxGroups||this.rootStore.aioseo.data.vueComponentsDefaults.fieldGroupRepeater.maxGroups;return!this.groupProp.length||!e?!0:this.groupProp.length<e}},methods:{addGroup(){const e=JSON.parse(JSON.stringify(this.defaults));this.onAddGroup?this.onAddGroup(e):this.groupProp.push(e)},deleteGroup(e){this.onDeleteGroup?this.onDeleteGroup(e):this.groupProp.splice(e,1)}},beforeMount(){this.groupProp.forEach((e,s)=>{const r=JSON.parse(JSON.stringify(this.defaults));this.groupProp[s]=w(r,e)})}},$={class:"header"},j={class:"header-title"},H={class:"fields-inner"};function Q(e,s,r,v,G,t){const m=f("base-button"),_=f("field-group");return o(),y(_,{class:"aioseo-schema-field-group-repeater",header:r.pluralName,headerTooltip:r.headerTooltip},{"header-extra":i(()=>[t.showLink?(o(),a("a",{key:0,href:"#",onClick:s[0]||(s[0]=h((...p)=>t.addGroup&&t.addGroup(...p),["prevent"]))},n(t.addLink),1)):l("",!0)]),footer:i(()=>[t.showLink?(o(),a("a",{key:0,href:"#",onClick:s[1]||(s[1]=h((...p)=>t.addGroup&&t.addGroup(...p),["prevent"]))},n(t.addLink),1)):l("",!0)]),default:i(()=>[(o(!0),a(b,null,A(r.groupProp,(p,d)=>(o(),a("section",{class:"aioseo-schema-field-group-repeater-inner",key:d},[u("div",$,[u("span",j,n(r.singularName+" "+(d+1)),1),r.groupProp.length>r.minGroups?(o(),y(m,{key:0,class:"small",type:"gray",onClick:h(U=>t.deleteGroup(d),["prevent"])},{default:i(()=>[g(n(G.strings.delete),1)]),_:2},1032,["onClick"])):l("",!0)]),u("div",H,[c(e.$slots,"fields-inner",{groupIndex:d})])]))),128))]),_:3},8,["header","headerTooltip"])}const te=S(E,[["render",Q]]);export{te as C,M as a};
