import{n as e,V as r}from"./js/_plugin-vue2_normalizer.61652a7c.js";import"./js/index.cf60653e.js";import{e as l}from"./js/elemLoaded.9a6eb745.js";import{u}from"./js/url.37788892.js";import{c,a as d,m}from"./js/vuex.esm.8fdeb4b6.js";import{S as p}from"./js/Information.93f80cbf.js";import{S as k}from"./js/Caret.6d7f2e24.js";import{s as f}from"./js/index.3751d023.js";import"./js/client.e62d6c37.js";import"./js/_commonjsHelpers.f84db168.js";import"./js/translations.c394afe3.js";import"./js/default-i18n.3a91e0e5.js";import"./js/helpers.de7566d0.js";import"./js/constants.59a77347.js";import"./js/isArrayLikeObject.cf278c5f.js";import"./js/portal-vue.esm.98f2e05b.js";const _={components:{SvgCircleInformation:p,SvgClose:k},data(){return{linkFormatValue:{},disabled:!1,url:null,strings:{upsell:this.$t.sprintf(this.$t.__("Did you know you can automatically add internal links using Link Assistant? %1$s",this.$td),this.$links.getPlainLink(this.$constants.GLOBAL_STRINGS.learnMore,this.$aioseo.urls.aio.linkAssistant,!0))}}},computed:{...c(["isUnlicensed"]),...d(["currentPost"]),canShowUpsell(){const n=this.$addons.getAddon("aioseo-link-assistant"),{options:t}=this.currentPost,i=t.linkFormat.internalLinkCount,s=t.linkFormat.linkAssistantDismissed;return(this.isUnlicensed||!n||!n.isActive||n.requiresUpgrade)&&2<i&&!s&&!this.disabled&&this.linkFormatValue.url&&this.isInternalLink(this.linkFormatValue.url)}},methods:{...m(["incrementInternalLinkCount","disableLinkAssistantEducation"]),async linkAdded(n){var o;await this.$nextTick();const{options:t}=this.currentPost,i=t.linkFormat.internalLinkCount,s=t.linkFormat.linkAssistantDismissed;2<i||s||this.isInternalLink(n.url||((o=n.suggestion)==null?void 0:o.url)||null)&&this.incrementInternalLinkCount()},async setLinkFormatValue(){await this.$nextTick();const n=document.querySelector("#aioseo-link-assistant-education input");!this.linkFormatValue.url&&(n!=null&&n.value)&&(this.linkFormatValue=JSON.parse(n.value))},isInternalLink(n){const t=u.parse(n,!1,!0);return n.indexOf("//")===-1&&n.indexOf("/")===0?!0:n.indexOf("#")===0?!1:t.host?t.host===this.$aioseo.urls.domain:!0}},created(){this.setLinkFormatValue();const{addAction:n,hasAction:t}=window.wp.hooks;t("aioseo-link-format-link-added","aioseo")||n("aioseo-link-format-link-added","aioseo",this.linkAdded)}};var h=function(){var t=this,i=t._self._c;return t.canShowUpsell?i("div",{staticClass:"aioseo-link-assistant-did-you-know"},[i("svg-circle-information"),i("span",{domProps:{innerHTML:t._s(t.strings.upsell)},on:{click:function(s){s.stopPropagation(),t.disabled=!0}}}),i("svg-close",{nativeOn:{click:function(s){return s.stopPropagation(),t.disableLinkAssistantEducation.apply(null,arguments)}}})],1):t._e()},L=[],g=e(_,h,L,!1,null,null,null,null);const A=g.exports,a=()=>{new r({store:f,render:n=>n(A)}).$mount("#aioseo-link-assistant-education-mount")};window.aioseo&&window.aioseo.currentPost&&window.aioseo.currentPost.context==="post"&&(document.getElementById("aioseo-link-assistant-education")?a():(l("#aioseo-link-assistant-education","aioseoLaDidYouKnow"),document.addEventListener("animationstart",function(t){t.animationName==="aioseoLaDidYouKnow"&&a()},{passive:!0})));
