import{n as r,V as l}from"./js/vueComponentNormalizer.67c9b86e.js";import"./js/index.81e35b24.js";import{e as u}from"./js/elemLoaded.b1f6e29c.js";import{u as c}from"./js/url.2761a990.js";import{c as d,a as m,m as p}from"./js/vuex.esm.19624049.js";import{S as k}from"./js/Information.be119534.js";import{S as f}from"./js/Caret.eeb84d06.js";import{s as _}from"./js/index.7b63dad7.js";import"./js/client.90beecd8.js";import"./js/_commonjsHelpers.10c44588.js";import"./js/translations.3bc9d58c.js";import"./js/default-i18n.0e73c33c.js";import"./js/helpers.a2b0759e.js";import"./js/constants.8bff9f56.js";import"./js/isArrayLikeObject.5268a676.js";import"./js/portal-vue.esm.18ed59c3.js";var h=function(){var n=this,t=n.$createElement,i=n._self._c||t;return n.canShowUpsell?i("div",{staticClass:"aioseo-link-assistant-did-you-know"},[i("svg-circle-information"),i("span",{domProps:{innerHTML:n._s(n.strings.upsell)},on:{click:function(s){s.stopPropagation(),n.disabled=!0}}}),i("svg-close",{nativeOn:{click:function(s){return s.stopPropagation(),n.disableLinkAssistantEducation.apply(null,arguments)}}})],1):n._e()},L=[];const v={components:{SvgCircleInformation:k,SvgClose:f},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:{...d(["isUnlicensed"]),...m(["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:{...p(["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?void 0:n.value)&&(this.linkFormatValue=JSON.parse(n.value))},isInternalLink(n){const t=c.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)}},e={};var g=r(v,h,L,!1,A,null,null,null);function A(n){for(let t in e)this[t]=e[t]}const w=function(){return g.exports}(),a=()=>{new l({store:_,render:n=>n(w)}).$mount("#aioseo-link-assistant-education-mount")};window.aioseo&&window.aioseo.currentPost&&window.aioseo.currentPost.context==="post"&&(document.getElementById("aioseo-link-assistant-education")?a():(u("#aioseo-link-assistant-education","aioseoLaDidYouKnow"),document.addEventListener("animationstart",function(t){t.animationName==="aioseoLaDidYouKnow"&&a()},{passive:!0})));
