import{a8 as N,b as M,a as Y,a3 as U,d as E}from"./app-core.ae890a3f.js";import{B as $}from"./Checkbox.79be52ca.js";import{_ as y}from"./_plugin-vue_export-helper.eefbdd86.js";import{_ as w,d as H,a as m}from"./vendor-other.7b559694.js";import{aq as r,f as s,i as l,O as S,ad as C,a0 as h,R as u,ae as A,U as g,j as c,Q as v,M as T,v as O,S as V,T as z}from"./vendor-vue-ui.de3ab35f.js";import{C as W}from"./Index.52399193.js";import{C as K}from"./Card.c7ceb11b.js";import{C as P}from"./Tabs.b5aef6dd.js";import{C as j}from"./Index.ab3bcf62.js";import{C as G}from"./NetworkSiteSelector.06c8a311.js";import{C as q}from"./SettingsRow.0c329e43.js";import{G as F,a as Q}from"./Row.6337df55.js";import{S as J}from"./Close.098d4b76.js";import"./vendor-lodash.8e35bd59.js";import"./Checkmark.fac3f231.js";import"./Tooltip.ae7a1028.js";import"./Caret.a017b70a.js";import"./Trash.d35f8063.js";import"./Slide.e6618126.js";import"./Button.a549093d.js";import"./ProBadge.fd60f711.js";import"./Information.278772ab.js";import"./Network.4e751b57.js";const B="all-in-one-seo-pack",X={emits:["update"],setup(){return{rootStore:M(),addonsStore:N()}},components:{BaseCheckbox:$},props:{loading:Boolean,disabled:Boolean},data(){return{selectedAddons:{},strings:{runAction:w("Run Action",B),noAddons:w("There are no active addons at the moment.",B)}}},computed:{activeAddons(){return this.addonsStore.addons.filter(e=>e.isActive)},selectedSkus(){return Object.keys(this.selectedAddons).filter(e=>this.selectedAddons[e])},selectedAddonsNames(){return this.activeAddons.filter(e=>this.selectedSkus.includes(e.sku)).map(e=>e.name)}}},Z={class:"aioseo-addons-list"},ee={key:1};function te(e,t,n,d,o,a){const p=r("base-checkbox"),b=r("base-button");return s(),l("div",Z,[a.activeAddons.length>0?(s(),l(S,{key:0},[(s(!0),l(S,null,C(a.activeAddons,(_,k)=>(s(),l("div",{key:k},[h(p,{size:"medium",modelValue:o.selectedAddons[_.sku],"onUpdate:modelValue":f=>o.selectedAddons[_.sku]=f,disabled:n.disabled},{default:u(()=>[A(g(_.name),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])]))),128)),c("div",null,[h(b,{type:"blue",size:"medium",onClick:t[0]||(t[0]=_=>(e.$emit("update",a.selectedSkus),e.$emit("addons-selected",a.selectedAddonsNames))),loading:n.loading,disabled:n.disabled||a.selectedSkus.length===0},{default:u(()=>[A(g(o.strings.runAction),1)]),_:1},8,["loading","disabled"])])],64)):(s(),l("b",ee,g(o.strings.noAddons),1))])}const oe=y(X,[["render",te],["__scopeId","data-v-a1f4dc34"]]),se="all-in-one-seo-pack",ne={emits:["update"],setup(){return{rootStore:M()}},components:{BaseCheckbox:$,GridColumn:Q,GridRow:F},props:{loading:Boolean,disabled:Boolean},data(){return{options:{},strings:{updateOptions:w("Update Options",se)}}},mounted(){this.rootStore.aioseo.deprecatedOptions.forEach(e=>{e.enabled&&(this.options[e.value]=!0)})}},ie={class:"aioseo-deprecated-options"};function ae(e,t,n,d,o,a){const p=r("base-checkbox"),b=r("grid-column"),_=r("grid-row"),k=r("base-button");return s(),l("div",ie,[h(_,{class:"settings"},{default:u(()=>[(s(!0),l(S,null,C(d.rootStore.aioseo.deprecatedOptions,(f,L)=>(s(),v(b,{key:L,xl:"6",sm:"12"},{default:u(()=>[h(p,{size:"medium",modelValue:o.options[f.value],"onUpdate:modelValue":x=>o.options[f.value]=x,disabled:n.disabled},{default:u(()=>[A(g(f.label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])]),_:2},1024))),128))]),_:1}),t[1]||(t[1]=c("br",null,null,-1)),h(k,{type:"blue",size:"medium",onClick:t[0]||(t[0]=f=>e.$emit("update",o.options)),loading:n.loading,disabled:n.disabled},{default:u(()=>[A(g(o.strings.updateOptions),1)]),_:1},8,["loading","disabled"]),t[2]||(t[2]=c("br",null,null,-1)),t[3]||(t[3]=c("br",null,null,-1))])}const re=y(ne,[["render",ae]]),le={setup(){return{optionsStore:Y()}},computed:{infoItems(){return[{label:"Migrated Version",value:this.optionsStore.internalOptions.internal.migratedVersion},{label:"First Activated",value:this.optionsStore.internalOptions.internal.firstActivated!==0?H(this.optionsStore.internalOptions.internal.firstActivated*1e3).format("MMMM D, YYYY"):!1}]}}},de={class:"v3-migration-info aioseo-description"},ce={class:"info-items"},ue={key:0},pe={key:1};function he(e,t,n,d,o,a){return s(),l("div",de,[c("ul",ce,[(s(!0),l(S,null,C(a.infoItems,(p,b)=>(s(),l("li",{key:b},[p.value?(s(),l("span",ue,g(p.label),1)):T("",!0),p.value?(s(),l("span",pe,g(p.value),1)):T("",!0)]))),128))])])}const ge=y(le,[["render",he]]),me={class:"aioseo-writing-assistant"},_e={__name:"WritingAssistant",setup(e){const t=U(),n="all-in-one-seo-pack",d={resetLogins:w("Reset SEOBoost Logins",n)};let o=!1;const a=()=>{confirm(w("Are you sure you want to reset SEOBoost logins?",n))&&(o=!0,t.doTask({action:"aioseo-reset-seoboost-logins"}).finally(()=>{alert(w("SEOBoost logins have been reset.",n)),o=!1}))};return(p,b)=>{const _=r("base-button");return s(),l("div",me,[h(_,{type:"blue",size:"medium",onClick:a,loading:O(o),disabled:O(o)},{default:u(()=>[A(g(d.resetLogins),1)]),_:1},8,["loading","disabled"])])}}},be={setup(){return{rootStore:M(),toolsStore:U()}},components:{AddonsList:oe,CoreAlert:W,CoreCard:K,CoreMainTabs:P,CoreModal:j,CoreNetworkSiteSelector:G,CoreSettingsRow:q,DeprecatedOptions:re,MigrationInfo:ge,SvgClose:J,WritingAssistant:_e},props:{extraActions:{type:Array,required:!1}},data(){return{site:{},tabsKey:0,doingActionKey:0,activeTab:"general",currentAction:"",currentData:{},showAreYouSureModal:!1,doingAction:[],selectedAddonsNames:[],strings:{selectSite:"Select Site",cardLabel:"Debug",selectLabel:"Select a Debug Action:",buttonLabel:"Run Action",alertWarning:"Before you run any action, please make sure that you have fully read the description and understand the consequences as these cannot be reverted.",cannotBeUndone:"This action cannot be undone.",yesDoAction:"Yes, run this action",noChangedMind:"No, I changed my mind"},alertLink:E.getPlainLink("Click here to open to the Scheduled Actions panel",this.rootStore.aioseo.urls.admin.scheduledActions,!0)}},computed:{areYouSureTitle(){return this.currentAction.slug==="rerun-addon-migrations"?m('Are you sure you want to run the "%1$s" action for the following addons?
%2$s
',this.currentAction.label,``):`Are you sure you want to run the "${this.currentAction.label}" action?`},tabs(){const e=m('Scheduled Actions',this.rootStore.aioseo.urls.admin.scheduledActions),t=this.rootStore.aioseo.data.isNetworkAdmin?"
NOTE: If no site is selected, this will clear the network cache.":"",n=this.rootStore.aioseo.data.isNetworkAdmin?"
NOTE: If no site is selected, this will clear the network plugin updates transient.":"";return[{slug:"general",name:"General",actions:[{label:"Clear Cache",slug:"clear-cache",shortDescription:`This action deletes all records of the aioseo_cache table in the database.${t}`,longDescription:"",showModal:!1,network:!0},{label:"Clear Plugin Updates Transient",slug:"clear-plugin-updates-transient",shortDescription:`This action clears the plugin updates transient, which forces WordPress Core to check for plugin updates.${n}`,longDescription:"",showModal:!1,network:!0},{label:"Readd Capabilities",slug:"readd-capabilities",shortDescription:"This action will readd our capabilities (access permissions) for all users.",longDescription:"",showModal:!1},{label:"Reset Data",slug:"reset-data",shortDescription:"This action will delete all our custom tables and options.",longDescription:"",showModal:!0}]},{slug:"sitemap",name:"Sitemap",actions:[{label:"Clear Image Data",slug:"clear-image-data",shortDescription:"This action removes all image data from the database, forcing a site-wide rescan via Action Scheduler.",longDescription:m("To speed up the image scan, go to %1$s and run the aioseo_image_sitemap_scan action.",e),showModal:!1}]},{slug:"migrations",name:"Migrations",actions:[{label:"Rerun V4+ Migrations",slug:"rerun-migrations",shortDescription:"This action will rerun all update migrations since 4.0.0, excluding the V3 migration.",longDescription:"",showModal:!0},{label:"Rerun Migrations for Active Addons",slug:"rerun-addon-migrations",shortDescription:"This action will rerun all update migrations for the selected addons.",longDescription:"",showModal:!0,component:"addons-list"}]},{slug:"old-issues",name:"Old Issues",actions:[{label:"Remove Duplicates",slug:"remove-duplicates",shortDescription:"This action will delete any duplicate records that are found in the aioseo_posts and aioseo_terms tables.",longDescription:"",showModal:!1},{label:"Unescape Data",slug:"unescape-data",shortDescription:"This action will clean aioseo_posts and aioseo_term records whose data is corrupted.",longDescription:m("The action will trigger a routine which runs in batches via Action Scheduler. It may take some time for this routine to complete, To speed up this process, go to %1$s and run the aioseo_unslash_escaped_data_posts or aioseo_unslash_escaped_data_terms action.",e),showModal:!1}]},{slug:"deprecated-options",name:"Deprecated Options",actions:[{label:"Deprecated Options",slug:"deprecated-options",shortDescription:"Enable or disable any options that have been deprecated in AIOSEO.",longDescription:"These options are not guaranteed to work and all support has been dropped.",showModal:!1,component:"deprecated-options"}]},{slug:"writing-assistant",name:"Writing Assistant",actions:[{label:"Writing Assistant",slug:"writing-assistant",shortDescription:"Resets all users SEOBoost logins.",longDescription:"",showModal:!1,component:"writing-assistant"}]}]},activeTabObject(){return this.tabs.find(e=>e.slug===this.activeTab)}},methods:{isActionDisabled(e){return this.rootStore.aioseo.data.isNetworkAdmin?this.site.blog_id?this.site.blog_id==="network"&&e.network?!1:this.site.blog_id==="network"&&!e.network:!0:!1},isLoading(e){return!!this.doingAction[e.slug]},getSelectedActionObject(e){let t=null;return this.actions.forEach(n=>{const d=n.options.find(o=>o.value===e);d&&(t=d)}),t},maybeDoAction(e,t){if(this.currentAction=e,this.currentData=t,e.showModal){this.showAreYouSureModal=!0;return}this.doAction(t)},doAction(e){this.doingAction[this.currentAction.slug]=!0,this.showAreYouSureModal=!1,this.doingActionKey++,this.toolsStore.doTask({action:this.currentAction.slug,siteId:this.site.blog_id||this.rootStore.aioseo.data.currentBlogId,data:e}).then(()=>{console.log(`Action "${this.currentAction.label}" has been completed.`)}).catch(t=>{console.error(`Action "${this.currentAction.label}" could not be completed: `,t)}).finally(()=>{this.doingAction[this.currentAction.slug]=!1,this.doingActionKey++})}},beforeMount(){let e=-1;if(this.rootStore.aioseo.data.v3Options&&(e=this.tabs.findIndex(t=>t.slug.toLowerCase()==="migrations"),e!==-1)){const t=m('Scheduled Actions',this.rootStore.aioseo.urls.admin.scheduledActions);this.tabs[e].actions.push({label:"Rerun V3 Migration",slug:"restart-v3-migration",shortDescription:"This action restarts the migration from V3 to V4.",longDescription:m("All settings will be migrated immediately. However, the post/term meta needs to be migrated via a routine which runs in batches via Action Scheduler. To speed up the post/term meta migration, go to %1$s and run the aioseo_migrate_post_meta or aioseo_migrate_term_meta action.",t),infoComponent:"MigrationInfo",showModal:!0})}this.extraActions?.length&&this.extraActions.forEach(t=>{if(e=this.tabs.findIndex(n=>n.slug.toLowerCase()===t.slug.toLowerCase()),e!==-1){this.tabs[e].actions=this.tabs[e].actions.concat(t.actions);return}this.tabs.push(t)})}},fe={class:"aioseo-tools-debug"},Ae={key:0,class:"aioseo-settings-row"},ke={class:"select-site"},ve=["innerHTML"],we=["innerHTML"],Se=["innerHTML"],ye={class:"aioseo-modal-body"},De=["innerHTML"],Te=["innerHTML"];function Me(e,t,n,d,o,a){const p=r("core-network-site-selector"),b=r("core-alert"),_=r("core-main-tabs"),k=r("base-button"),f=r("core-settings-row"),L=r("svg-close"),x=r("core-modal"),I=r("core-card");return s(),l("div",fe,[h(I,{slug:"debug","header-text":o.strings.cardLabel},{default:u(()=>[d.rootStore.aioseo.data.isNetworkAdmin?(s(),l("div",Ae,[c("div",ke,g(o.strings.selectSite),1),h(p,{onSelectedSite:t[0]||(t[0]=i=>o.site=i),"show-network":""})])):T("",!0),h(b,{type:"yellow"},{default:u(()=>[c("div",null,g(o.strings.alertWarning),1),c("div",{innerHTML:o.alertLink},null,8,ve)]),_:1}),(s(),v(_,{internal:"",key:o.tabsKey,tabs:a.tabs,active:o.activeTab,showSaveButton:!1,onChanged:t[1]||(t[1]=i=>o.activeTab=i)},null,8,["tabs","active"])),(s(!0),l(S,null,C(a.activeTabObject.actions,(i,R)=>(s(),v(f,{key:o.activeTab+R,name:i.label,align:""},{content:u(()=>[i.component?(s(),v(V(i.component),{key:0,onUpdate:D=>a.maybeDoAction(i,D),onAddonsSelected:t[2]||(t[2]=D=>o.selectedAddonsNames=D),loading:o.doingAction[i.slug],disabled:a.isActionDisabled(i)},null,40,["onUpdate","loading","disabled"])):(s(),v(k,{type:"blue",size:"medium",onClick:D=>a.maybeDoAction(i),loading:o.doingAction[i.slug],key:o.doingActionKey,disabled:a.isActionDisabled(i)},{default:u(()=>[A(g(o.strings.buttonLabel),1)]),_:1},8,["onClick","loading","disabled"])),c("div",{class:"aioseo-description",innerHTML:i.shortDescription},null,8,we),c("div",{class:"aioseo-description",innerHTML:i.longDescription},null,8,Se),i.infoComponent?(s(),v(V(i.infoComponent),{key:2})):T("",!0)]),_:2},1032,["name"]))),128)),h(x,{show:o.showAreYouSureModal,"no-header":"",onClose:t[7]||(t[7]=i=>o.showAreYouSureModal=!1),classes:["aioseo-debug-modal"]},{body:u(()=>[c("div",ye,[c("button",{class:"close",onClick:t[4]||(t[4]=z(i=>o.showAreYouSureModal=!1,["stop"]))},[h(L,{onClick:t[3]||(t[3]=i=>o.showAreYouSureModal=!1)})]),c("h3",{innerHTML:a.areYouSureTitle},null,8,De),c("div",{class:"description",innerHTML:o.strings.cannotBeUndone},null,8,Te),h(k,{type:"blue",size:"medium",onClick:t[5]||(t[5]=i=>a.doAction(o.currentData))},{default:u(()=>[A(g(o.strings.yesDoAction),1)]),_:1}),h(k,{type:"gray",size:"medium",onClick:t[6]||(t[6]=i=>o.showAreYouSureModal=!1)},{default:u(()=>[A(g(o.strings.noChangedMind),1)]),_:1})])]),_:1},8,["show"])]),_:1},8,["header-text"])])}const Ce=y(be,[["render",Me]]),Le={setup(){return{addonsStore:N(),rootStore:M()}},components:{Debug:Ce},computed:{extraActions(){const e=m('Scheduled Actions',this.rootStore.aioseo.urls.admin.scheduledActions),t=this.addonsStore.addons.find(o=>o.sku==="aioseo-video-sitemap"),n=this.addonsStore.addons.find(o=>o.sku==="aioseo-link-assistant"),d=[];return t.isActive&&d.push({slug:"sitemap",actions:[{label:"Clear Video Data",slug:"clear-video-data",shortDescription:"This action removes all video data from the database, forcing a site-wide rescan via Action Scheduler.",longDescription:m("To speed up the video scan, go to %1$s and run the aioseo_video_sitemap_scan action.",e),showModal:!1}]}),n.isActive&&d.push({slug:"link-assistant",name:"Link Assistant",actions:[{label:"Clear Data",slug:"link-assistant-clear-data",shortDescription:"This action removes all Link Assistant data from the database, forcing a site-wide rescan via Action Scheduler.",longDescription:m("The various Link Assistant scans can be sped up through the %1$s",e),showModal:!0},{label:"Clear Links",slug:"link-assistant-clear-links",shortDescription:"This action removes all link data from the database, forcing a site-wide rescan via Action Scheduler.",longDescription:m("To speed up the links scan, go to %1$s and run the aioseo_link_assistant_links_scan action.",e),showModal:!0},{label:"Clear Suggestions",slug:"link-assistant-clear-suggestions",shortDescription:"This action removes all link suggestion data from the database, forcing a site-wide rescan via Action Scheduler.",longDescription:m("To speed up the links scan, go to %1$s and run the aioseo_link_assistant_link_suggestions_scan action.",e),showModal:!0},{label:"Undismiss Suggestions",slug:"link-assistant-undismiss-suggestions",shortDescription:"This action removes the dismissed state from all suggestions, which makes them appear in the UI again.",longDescription:m("To speed up the video scan, go to %1$s and run the aioseo_video_sitemap_scan action.",e),showModal:!1}]}),d}}};function xe(e,t,n,d,o,a){const p=r("debug",!0);return s(),v(p,{extraActions:a.extraActions},null,8,["extraActions"])}const et=y(Le,[["render",xe]]);export{et as default};