import{a as g,c as T}from"./js/runtime-dom.esm-bundler.f6259c83.js";import{l as S}from"./js/index.7c01c5f2.js";import{l as x}from"./js/index.e8c482d5.js";import{l as E}from"./js/index.d80c2c2c.js";import{u as $,l as k,n as v,J as P,K as B,m as f,Y as b}from"./js/index.ed1fc0db.js";import{e as A}from"./js/elemLoaded.2921fc72.js";import{g as C,t as L,a as M}from"./js/helpers.637c6d77.js";import{S as N}from"./js/Information.2e3d122e.js";import{S as H}from"./js/Close.8fb798f7.js";import"./js/translations.d159963e.js";import{_ as w}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{s as p,_ as d}from"./js/default-i18n.20001971.js";import{a6 as m,o as _,c as h,m as c,a as l,a4 as U}from"./js/runtime-core.esm-bundler.4f558f23.js";import"./js/Button.e237bb50.js";import"./js/Input.d9e61fc6.js";import"./js/Index.504e4ac6.js";import"./js/Pencil.b89246dd.js";import"./js/Trash.263ee9c7.js";import"./js/Select.4ddf605b.js";import"./js/Caret.b694929e.js";import"./js/Toggle.61ecb096.js";import"./js/helpers.2a6f0df7.js";const u="all-in-one-seo-pack",I={setup(){return{postEditorStore:$()}},components:{SvgCircleInformation:N,SvgClose:H},props:{taxonomy:String},data(){return{selectedTerms:[],strings:{didYouKnow:p(d("Did you know that %1$s Pro allows you to choose a %2$sprimary category%3$s for your posts? This feature works hand in hand with our powerful Breadcrumbs template to give you full navigational control to help improve your search rankings!",u),"AIOSEO","<strong>","</strong>"),learnMoreLink:p('<a href="%1$s" target="_blank" rel="noreferrer nofollow">%2$s<span class="link-right-arrow">&nbsp;&rarr;</span></a>',k.getDocUrl("primaryTerm"),d("Learn more",u))}}},computed:{canShowUpsell(){const{options:o}=this.postEditorStore.currentPost;return!o.primaryTerm.productEducationDismissed&&1<this.selectedTerms.length}},methods:{updateSelectedTerms(){this.selectedTerms=C(this.taxonomy)}},mounted(){this.updateSelectedTerms(),window.aioseoBus.$on("updateSelectedTerms",this.updateSelectedTerms)},beforeUnmount(){window.aioseoBus.$off("updateSelectedTerms",this.updateSelectedTerms)}},V={key:0,class:"aioseo-primary-term-cta"},D=["innerHTML"],K=["innerHTML"];function Y(o,t,e,s,r,i){const n=m("svg-circle-information"),a=m("svg-close");return i.canShowUpsell?(_(),h("div",V,[c(n,{width:"15",height:"15"}),l("p",{innerHTML:r.strings.didYouKnow},null,8,D),l("p",{innerHTML:r.strings.learnMoreLink},null,8,K),c(a,{onClick:g(s.postEditorStore.disablePrimaryTermEducation,["stop"])},null,8,["onClick"])])):U("",!0)}const F=w(I,[["render",Y]]),O={components:{PrimaryTerm:F},props:{taxonomy:String}},j={class:"aioseo-app aioseo-primary-term"};function q(o,t,e,s,r,i){const n=m("primary-term");return _(),h("div",j,[c(n,{taxonomy:e.taxonomy},null,8,["taxonomy"])])}const J=w(O,[["render",q]]);if(v()&&window.wp){const{createElement:o,Fragment:t}=window.wp.element,{addFilter:e}=window.wp.hooks,{createHigherOrderComponent:s}=window.wp.compose,{subscribe:r}=window.wp.data;e("editor.PostTaxonomyType","aioseo/primary-term",s(i=>n=>{const{slug:a}=n;return L(a)?o(t,{},o(i,n),o("div",{id:`aioseo-primary-term-${a}`},o("div",{className:"aioseo-primary-term-app",taxonomy:a}))):o(i,n)},"withInspectorControls")),r(()=>{window.aioseoBus.$emit("updateSelectedTerms")})}(P()||B())&&(f(),M().forEach(o=>{var s;const t=(s=document.getElementById(`${o.name}div`))==null?void 0:s.querySelector(".inside");if(!t)return;const e=document.createElement("div");e.setAttribute("id",`aioseo-primary-term-${o.name}`),e.setAttribute("class","aioseo-primary-term-app"),e.setAttribute("taxonomy",o.name),t.append(e),function(r){r(`#${o.name}checklist`).on("change",'input[type="checkbox"]',()=>{window.aioseoBus.$emit("updateSelectedTerms")}),r(`#${o.name}checklist`).on("wpListAddEnd",()=>{window.aioseoBus.$emit("updateSelectedTerms")})}(window.jQuery)}));const y=o=>{if(!o)return;const t=o.getAttribute("taxonomy");let e=T({...J,name:"Standalone/PrimaryTerm"},{taxonomy:t});e=S(e),e=x(e),e=E(e),f(e),e.mount(o)};if(b()&&window.aioseo&&window.aioseo.currentPost&&window.aioseo.currentPost.context==="post"){const o=document.getElementsByClassName("aioseo-primary-term-app");Array.prototype.forEach.call(o,t=>y(t)),A(".aioseo-primary-term-app","aioseoPrimaryTerm"),document.addEventListener("animationstart",function(t){t.animationName==="aioseoPrimaryTerm"&&y(t.target)},{passive:!0})}
