import{an as a,f as n,i as _,a0 as g,R as c,j as y,Q as R,M as d,ae as w,U as C,ap as S}from"./js/vendor-vue-ui.c21c50b5.js";import{l as k}from"./js/index.e1395627.js";import{l as A}from"./js/index.695373d0.js";import{y as L,a6 as v,c as E,h as b,b as x,l as H}from"./js/app-core.52885c02.js";/* empty css                */import{C as P}from"./js/Index.191558ff.js";import{_ as U}from"./js/Index.5a0b28e0.js";import{_ as B}from"./js/_plugin-vue_export-helper.eefbdd86.js";import{q as T}from"./js/vendor-lodash.b9aaf385.js";import{a as M,_ as l}from"./js/vendor-other.ec82d685.js";import"./js/Button.7e4e5aaa.js";import"./js/Input.d5d0cc38.js";import"./js/Index.df48fa2a.js";import"./js/Close.4a8424fd.js";import"./js/Pencil.886eeda5.js";import"./js/Trash.e939fb36.js";import"./js/Select.f9b41564.js";import"./js/Caret.911868b5.js";import"./js/Toggle.9189cb4d.js";import"./js/JsonValues.a0694556.js";import"./js/Index.6bc98daf.js";import"./js/Url.205ac083.js";import"./js/Exclamation.7df31205.js";import"./js/Checkbox.d28f1a29.js";import"./js/Checkmark.ecbc0a01.js";import"./js/ProBadge.3032531f.js";import"./js/External.e4c3c14a.js";import"./js/Gear.3891833e.js";import"./js/Slide.a69b6847.js";import"./js/DatePicker.87733b6f.js";import"./js/Calendar.7ce59e57.js";import"./js/vendor-date-picker.3b443e3e.js";import"./js/Tooltip.9761aafe.js";import"./js/Plus.5862a87e.js";const p="all-in-one-seo-pack",N={setup(){return{rootStore:x(),licenseStore:b()}},components:{CoreModal:P,CoreAddRedirection:U},data(){return{urls:[],display:!1,target:null,loading:!1,strings:{modalHeader:l("Add a Redirect",p),redirectAdded:M(l('%2$sYour redirect was added and you may edit it <a href="%1$s" target="_blank">here</a>.%3$s',p),this.rootStore.aioseo.urls.aio.redirects,"<strong>","</strong>")},watchClasses:["aioseo-redirects-slug-changed","aioseo-redirects-trashed-post"]}},computed:{classSelectors(){return"."+this.watchClasses.join(", .")}},methods:{reload(){this.display=!1;const e=this.target?.parentElement?.parentElement;if(e&&(e.classList.contains("components-notice__content")||e.classList.contains("notice"))){e.innerHTML="<p>"+this.strings.redirectAdded+"</p>";return}this.target.outerHTML=this.strings.redirectAdded},loadRedirect(e){if(!L("aioseo_redirects_manage"))return Promise.resolve();this.loading=!0,v.get(E.restUrl("redirects/manual-redirects/"+e)).then(t=>{this.urls=t.body.redirects,this.loading=!1}).catch(t=>console.error("Redirect modal failed to load the redirect data.",t))},preloadRedirect(){const e=document.querySelector(this.classSelectors);if(e){const t=this.getElementRedirectHash(e);if(!t)return;this.loadRedirect(t)}},watchClicks(){document.body.onclick=e=>{if(!e.target?.classList)return;let t=!1;this.watchClasses.forEach(s=>{e.target.classList.contains(s)&&(t=!0)}),t&&(e.preventDefault(),this.target=e.target,this.display=!0,T(this.urls)&&this.loadRedirect(this.getElementRedirectHash(this.target)))}},getElementRedirectHash(e){return new URLSearchParams(e.href).get("aioseo-manual-urls")}},async created(){this.preloadRedirect(),this.watchClicks(),window.aioseoBus.$on("wp-core-notice-created",()=>{this.$nextTick(()=>{this.preloadRedirect()})})}},V={key:0,class:"aioseo-redirects-add-redirect-standalone"},D={class:"bd"};function j(e,t,s,i,r,u){const h=a("core-add-redirection"),f=a("core-modal");return!i.licenseStore.isUnlicensed&&i.rootStore.isPro?(n(),_("div",V,[g(f,{show:r.display,classes:["aioseo-redirects"],onClose:t[0]||(t[0]=Q=>r.display=!1),"allow-overflow":""},{headerTitle:c(()=>[w(C(r.strings.modalHeader),1)]),body:c(()=>[y("div",D,[r.loading?d("",!0):(n(),R(h,{key:0,urls:r.urls,target:r.urls[0]?.target?r.urls[0]?.target:"/",disableSource:!0,onAddedRedirect:u.reload},null,8,["urls","target","onAddedRedirect"]))])]),_:1},8,["show"])])):d("",!0)}const q=B(N,[["render",j]]),m=document.createElement("div");m.id="aioseo-redirects-add-redirect-standalone";document.body.appendChild(m);let o=S({...q,name:"Standalone/Redirects/AddRedirect"});o=k(o);o=A(o);H(o);o.mount("#aioseo-redirects-add-redirect-standalone");
