import{a as g,c as T}from"./js/runtime-dom.esm-bundler.dc49ee3e.js";import{l as S}from"./js/index.b24095c1.js";import{l as x}from"./js/index.6dbf4bd7.js";import{l as E}from"./js/index.d80c2c2c.js";import{u as $,l as k,n as v,K as P,L as B,m as f,Z as b}from"./js/index.e0fdfdc6.js";import{e as A}from"./js/elemLoaded.2921fc72.js";import{g as L,t as C,a as M}from"./js/helpers.87d53421.js";import{S as N}from"./js/Information.98ebb530.js";import{S as H}from"./js/Close.ccd53ef3.js";import"./js/translations.5e539ab1.js";import{_}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{s as p,_ as d}from"./js/default-i18n.368c2d5c.js";import{a6 as m,o as w,c as h,l as c,_ as l,a4 as U}from"./js/runtime-core.esm-bundler.ce5add0b.js";import"./js/Button.277f0e3d.js";import"./js/Input.94feb999.js";import"./js/Index.2a391835.js";import"./js/Pencil.d82df6a1.js";import"./js/Trash.87a7d946.js";import"./js/Select.2339c1ce.js";import"./js/Caret.cd869c5d.js";import"./js/Toggle.78d1886d.js";import"./js/helpers.b1696305.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=L(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 F(o,t,e,s,r,i){const n=m("svg-circle-information"),a=m("svg-close");return i.canShowUpsell?(w(),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 O=_(I,[["render",F]]),Y={components:{PrimaryTerm:O},props:{taxonomy:String}},j={class:"aioseo-app aioseo-primary-term"};function q(o,t,e,s,r,i){const n=m("primary-term");return w(),h("div",j,[c(n,{taxonomy:e.taxonomy},null,8,["taxonomy"])])}const Q=_(Y,[["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 C(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({...Q,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})}
