관리-도구
편집 파일: ImportExport.bfce6715.js
import{Q as ce,u as N,m as $,l as te}from"./index.20192476.js";import{l as pe}from"./license.37048367.js";import{D as J}from"./datetime.cb3980ce.js";import{C as Z,S as ue,d as Q}from"./Caret.662da1f3.js";import{C as L}from"./Card.46af096e.js";import{C as de}from"./Index.de83b4aa.js";import{C as Y,S as oe}from"./Upload.ec51a970.js";import{C as me}from"./Tooltip.b6b45c85.js";import{S as _e}from"./Plus.c3a1a43f.js";import{S as he}from"./History.4e6093cb.js";import{S as ge}from"./Refresh.69fd46ba.js";import{S as fe}from"./index.ee8124c6.js";import"./translations.12335a6a.js";import{v as n,o as a,k as m,l as t,C as i,c as k,a as T,t as p,b as d,x as u,F as P,J as z,G as M,E as be}from"./runtime-dom.esm-bundler.6789c400.js";import{_ as D}from"./_plugin-vue_export-helper.249dac1d.js";import{_ as r,s as U}from"./default-i18n.54b5d8cd.js";import{G as q,a as H}from"./Row.f01f32cd.js";import{a as X}from"./allowed.f428d9c9.js";import{u as ke}from"./ToolsSettings.db79754c.js";import{B as ee}from"./Checkbox.e983780b.js";import{u as G}from"./ToolsStore.75499a6c.js";import{C as Se}from"./Tabs.2fd33524.js";import{C as se}from"./Index.c0a0a208.js";import{B as xe}from"./Radio.e92f8160.js";import{S as ie}from"./Download.6a0d8455.js";import{C as ye}from"./Blur.31bfcf06.js";import{R as ve}from"./RequiredPlans.7629fd28.js";import"./helpers.f95d5840.js";import"./upperFirst.96c04516.js";import"./_stringToArray.08127ca9.js";import"./toString.1401d490.js";import"./Slide.d0517fb0.js";import"./params.764403f6.js";import"./Network.641df61c.js";import"./addons.9d0af6ad.js";import"./Checkmark.32f79576.js";import"./vue-router.fc4966b9.js";import"./ProBadge.7733ac87.js";import"./Information.82968754.js";import"./constants.2019bcb3.js";const E="all-in-one-seo-pack",we={setup(){return{backupsStore:ce(),rootStore:N()}},components:{CoreAlert:Z,CoreCard:L,CoreModal:de,CoreNetworkSiteSelector:Y,CoreTooltip:me,SvgCirclePlus:_e,SvgClose:ue,SvgHistory:he,SvgRefresh:ge,SvgTrash:fe},data(){return{site:null,timeout:null,backupToDelete:null,backupToRestore:null,backupsDeleteSuccess:!1,showModal:!1,backupsRestoreSuccess:!1,loading:!1,strings:{backupSettings:r("Backup Settings",E),areYouSureDeleteBackup:r("Are you sure you want to delete this backup?",E),areYouSureRestoreBackup:r("Are you sure you want to restore this backup?",E),yesDeleteBackup:r("Yes, I want to delete this backup",E),yesRestoreBackup:r("Yes, I want to restore this backup",E),noChangedMind:r("No, I changed my mind",E),actionCannotBeUndone:r("This action cannot be undone.",E),noBackups:r("You have no saved backups.",E),createBackup:r("Create Backup",E),restore:r("Restore",E),delete:r("Delete",E),backupSuccessfullyDeleted:r("Success! The backup was deleted.",E),backupSuccessfullyRestored:r("Success! The backup was restored.",E)}}},computed:{getBackups(){return this.site?this.backupsStore.networkBackups[this.site.blog_id]||[]:this.backupsStore.backups},areYouSure(){return this.backupToDelete?this.strings.areYouSureDeleteBackup:this.strings.areYouSureRestoreBackup},iAmSure(){return this.backupToDelete?this.strings.yesDeleteBackup:this.strings.yesRestoreBackup}},methods:{processCreateBackup(){this.loading=!0,this.backupsStore.createBackup({siteId:this.site?this.site.blog_id:null}).then(()=>{this.loading=!1})},maybeDeleteBackup(s){this.showModal=!0,this.backupToRestore=null,this.backupToDelete=s},maybeRestoreBackup(s){this.showModal=!0,this.backupToDelete=null,this.backupToRestore=s},processDeleteBackup(){this.loading=!0,this.backupsStore.deleteBackup({backup:this.backupToDelete,siteId:this.site?this.site.blog_id:null}).then(()=>{clearTimeout(this.timeout),this.loading=!1,this.showModal=!1,this.backupToDelete=null,this.backupsDeleteSuccess=!0,this.timeout=setTimeout(()=>{this.backupsDeleteSuccess=!1,this.backupsRestoreSuccess=!1},3e3)})},processRestoreBackup(){this.loading=!0,this.backupsStore.restoreBackup({backup:this.backupToRestore,siteId:this.site?this.site.blog_id:null}).then(()=>{clearTimeout(this.timeout),this.loading=!1,this.showModal=!1,this.backupToRestore=null,this.backupsRestoreSuccess=!0,this.timeout=setTimeout(()=>{this.backupsDeleteSuccess=!1,this.backupsRestoreSuccess=!1},3e3)})},getBackupName(s){const o=J.fromMillis(s*1e3).setZone(J.local().zoneName);return U(r("%1$s at %2$s",E),"<strong>"+o.toFormat("MMMM d, yyyy")+"</strong>","<strong>"+o.toFormat("h:mma ZZZZ")+"</strong>")},processBackupAction(){return this.backupToDelete?this.processDeleteBackup():this.processRestoreBackup()}}},Te={key:0,class:"aioseo-settings-row"},Ce={class:"select-site"},Ee={key:3,class:"aioseo-section-description"},Oe={key:4,class:"backups-table"},Ae={class:"backups-rows"},Be=["innerHTML"],Ue={class:"backup-actions"},Ve={class:"aioseo-modal-body"},De=["innerHTML"];function Re(s,o,h,l,e,c){const S=n("svg-history"),g=n("core-network-site-selector"),b=n("core-alert"),x=n("svg-refresh"),f=n("core-tooltip"),w=n("svg-trash"),C=n("svg-circle-plus"),v=n("base-button"),V=n("svg-close"),y=n("core-modal"),j=n("core-card");return a(),m(j,{id:"aioseo-backup-settings",class:"aioseo-backup-settings",slug:"backupSettings",toggles:!1,"no-slide":"","header-text":e.strings.backupSettings},{"header-icon":t(()=>[i(S)]),default:t(()=>[l.rootStore.aioseo.data.isNetworkAdmin?(a(),k("div",Te,[T("div",Ce,p(e.strings.selectSite),1),i(g,{onSelectedSite:o[0]||(o[0]=_=>e.site=_)})])):d("",!0),e.backupsDeleteSuccess?(a(),m(b,{key:1,type:"green"},{default:t(()=>[u(p(e.strings.backupSuccessfullyDeleted),1)]),_:1})):d("",!0),e.backupsRestoreSuccess?(a(),m(b,{key:2,type:"green"},{default:t(()=>[u(p(e.strings.backupSuccessfullyRestored),1)]),_:1})):d("",!0),c.getBackups.length?d("",!0):(a(),k("div",Ee,p(e.strings.noBackups),1)),c.getBackups.length&&!(l.rootStore.aioseo.data.isNetworkAdmin&&!e.site)?(a(),k("div",Oe,[T("div",Ae,[(a(!0),k(P,null,z(c.getBackups,(_,R)=>(a(),k("div",{class:M(["backup-row",{even:R%2===0}]),key:R},[T("div",{class:"backup-name",innerHTML:c.getBackupName(_)},null,8,Be),T("div",Ue,[i(f,{type:"action"},{tooltip:t(()=>[u(p(e.strings.restore),1)]),default:t(()=>[i(x,{onClick:F=>c.maybeRestoreBackup(_)},null,8,["onClick"])]),_:2},1024),i(f,{type:"action"},{tooltip:t(()=>[u(p(e.strings.delete),1)]),default:t(()=>[i(w,{onClick:F=>c.maybeDeleteBackup(_)},null,8,["onClick"])]),_:2},1024)])],2))),128))])])):d("",!0),i(v,{type:"blue",size:"medium",onClick:c.processCreateBackup,loading:e.loading,disabled:l.rootStore.aioseo.data.isNetworkAdmin&&!e.site},{default:t(()=>[i(C),u(" "+p(e.strings.createBackup),1)]),_:1},8,["onClick","loading","disabled"]),i(y,{show:e.showModal,"no-header":"",onClose:o[4]||(o[4]=_=>e.showModal=!1),classes:["aioseo-core-backup-settings-modal"]},{body:t(()=>[T("div",Ve,[T("button",{class:"close",onClick:o[2]||(o[2]=be(_=>e.showModal=!1,["stop"]))},[i(V,{onClick:o[1]||(o[1]=_=>e.showModal=!1)})]),T("h3",null,p(c.areYouSure),1),T("div",{class:"reset-description",innerHTML:e.strings.actionCannotBeUndone},null,8,De),i(v,{type:"blue",size:"medium",onClick:c.processBackupAction},{default:t(()=>[u(p(c.iAmSure),1)]),_:1},8,["onClick"]),i(v,{type:"gray",size:"medium",onClick:o[3]||(o[3]=_=>e.showModal=!1)},{default:t(()=>[u(p(e.strings.noChangedMind),1)]),_:1})])]),_:1},8,["show"])]),_:1},8,["header-text"])}const re=D(we,[["render",Re]]),W="all-in-one-seo-pack",Ie={setup(){const{toolsSettings:s}=ke();return{licenseStore:$(),rootStore:N(),toolsSettings:s,toolsStore:G()}},components:{BaseCheckbox:ee,CoreCard:L,CoreNetworkSiteSelector:Y,GridColumn:q,GridRow:H,SvgUpload:oe},data(){return{allowed:X,site:null,options:{},loadingSettings:!1,strings:{selectSite:r("Select Site",W),exportSettings:r("Export Settings",W),exportAllSettings:r("Export All Settings",W),errorExport:r("We had a problem when exporting data.",W)}}},methods:{canExport(s){if(this.rootStore.aioseo.data.isNetworkAdmin&&!this.site)return!1;const o=[];return Object.keys(s).forEach(h=>{o.push(s[h])}),o.some(h=>h)},processExportSettings(){const s=[];this.options.all?(this.rootStore.isPro&&s.push("general"),s.push("internal"),this.toolsSettings.filter(h=>h.value!=="all").forEach(h=>{s.push(h.value)})):Object.keys(this.options).forEach(h=>{this.options[h]&&s.push(h)});const o=this.site?`${this.site.domain}${this.site.path.replace("/","-")}`:"";this.loadingSettings=!0,this.toolsStore.exportSettings({settings:s,siteId:this.site?this.site.blog_id:null}).then(h=>{this.loadingSettings=!1,this.options={},this.prepareAfterResponse("settings",h.body.settings,o,"json")})},prepareAfterResponse(s,o,h,l){const e=this.getFileType(l),c=l==="json"?JSON.stringify(o):o,S=new Blob([c],{type:e}),g=document.createElement("a");g.href=URL.createObjectURL(S),g.download=`aioseo-export-${s}-${h}${J.now().toFormat("yyyy-MM-dd")}.`+l,g.click(),URL.revokeObjectURL(g.href)},getFileType(s){return s==="csv"?"text/csv":s==="json"?"application/json":!1}}},Ne={key:0,class:"aioseo-settings-row"},Fe={class:"select-site"};function Me(s,o,h,l,e,c){const S=n("svg-upload"),g=n("core-network-site-selector"),b=n("base-checkbox"),x=n("grid-column"),f=n("grid-row"),w=n("base-button"),C=n("core-card");return a(),m(C,{class:"aioseo-export-settings",slug:"exportSettings",toggles:!1,"no-slide":"","header-text":e.strings.exportSettings},{"header-icon":t(()=>[i(S)]),default:t(()=>[l.rootStore.aioseo.data.isNetworkAdmin?(a(),k("div",Ne,[T("div",Fe,p(e.strings.selectSite),1),i(g,{onSelectedSite:o[0]||(o[0]=v=>e.site=v)})])):d("",!0),i(f,null,{default:t(()=>[i(x,{class:"export-all"},{default:t(()=>[i(b,{size:"medium",modelValue:e.options.all,"onUpdate:modelValue":o[1]||(o[1]=v=>e.options.all=v),disabled:l.rootStore.aioseo.data.isNetworkAdmin&&!e.site},{default:t(()=>[u(p(e.strings.exportAllSettings),1)]),_:1},8,["modelValue","disabled"])]),_:1}),(a(!0),k(P,null,z(l.toolsSettings,(v,V)=>(a(),m(x,{key:V,sm:"6"},{default:t(()=>[e.options.all?d("",!0):(a(),m(b,{key:0,size:"medium",modelValue:e.options[v.value],"onUpdate:modelValue":y=>e.options[v.value]=y,disabled:l.rootStore.aioseo.data.isNetworkAdmin&&!e.site},{default:t(()=>[u(p(v.label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])),v.value!=="all"&&e.options.all?(a(),m(b,{key:1,size:"medium",modelValue:!0,disabled:""},{default:t(()=>[u(p(v.label),1)]),_:2},1024)):d("",!0)]),_:2},1024))),128))]),_:1}),i(w,{type:"blue",size:"medium",class:"import",onClick:c.processExportSettings,disabled:!c.canExport(e.options),loading:e.loadingSettings},{default:t(()=>[u(p(e.strings.exportSettings),1)]),_:1},8,["onClick","disabled","loading"])]),_:1},8,["header-text"])}const ne=D(Ie,[["render",Me]]),I="all-in-one-seo-pack",Pe={setup(){return{links:te}},components:{Cta:se},data(){return{strings:{ctaHeader:U(r("Exporting Terms is a %1$s Feature",I),"PRO"),ctaDescription:U(r("%1$s allows you to fully control your SEO and social meta for custom taxonomies, including the ability to import/export them.",I),"AIOSEO Pro"),ctaFeatures:[r("SEO Title/Description",I),r("Social Meta",I),r("SEO Revisions",I),r("Import/Export",I)],ctaButtonText:r("Unlock Custom Taxonomies",I)}}}},ze={class:"aioseo-tools-export-taxonomies"};function je(s,o,h,l,e,c){const S=n("cta");return a(),k("div",ze,[i(S,{"cta-link":l.links.getPricingUrl("taxonomies","taxonomies","export-taxonomies"),"button-text":e.strings.ctaButtonText,"learn-more-link":l.links.getUpsellUrl("taxonomies","export-taxonomies","liteUpgrade"),"feature-list":e.strings.ctaFeatures,floating:!1},{"header-text":t(()=>[u(p(e.strings.ctaHeader),1)]),description:t(()=>[u(p(e.strings.ctaDescription),1)]),_:1},8,["cta-link","button-text","learn-more-link","feature-list"])])}const Le=D(Pe,[["render",je]]),A="all-in-one-seo-pack",Ye={setup(){return{licenseStore:$(),rootStore:N(),toolsStore:G()}},components:{BaseCheckbox:ee,CoreAlert:Z,CoreCard:L,CoreMainTabs:Se,CoreNetworkSiteSelector:Y,CtaExportTaxonomies:Le,GridColumn:q,GridRow:H,SvgUpload:oe,BaseRadio:xe},data(){return{allowed:X,site:null,options:{},postOptions:{},taxonomiesOptions:{},loadingContent:!1,errorContent:null,tabsKey:0,activeTab:"post-types",strings:{selectSite:r("Select Site",A),exportContent:r("Export Content",A),exportAllPostTypes:r("Export All Post Types",A),exportAllTaxonomies:r("Export All Taxonomies",A),exportAs:r("Export As",A),errorExport:r("We had a problem when exporting data.",A),errorExportEmpty:r("We don't have any data to export.",A)},exportType:{label:r("Export as JSON",A),value:"json"},exportTypes:[{label:r("JSON",A),value:"json"},{label:r("CSV",A),value:"csv"}],tabOptions:[{slug:"post-types",name:r("Post Types",A)},{slug:"taxonomies",name:r("Taxonomies",A)}]}},watch:{errorContent(s){s&&Q(()=>{this.errorContent=!1},5e3)}},computed:{canExportPostOptions(){return["aioseo_page_general_settings","aioseo_page_advanced_settings","aioseo_page_schema_settings","aioseo_page_social_settings","aioseo_page_local_seo_settings"].some(s=>X(s))},isExportContentDisabled(){return this.activeTab==="post-types"?!this.canExport(this.postOptions):this.activeTab==="taxonomies"?!this.canExport(this.taxonomiesOptions):!1},canShowTaxonomies(){return this.rootStore.isPro&&this.licenseStore.license.isActive},canShowButtonExport(){return this.activeTab==="post-types"||this.activeTab==="taxonomies"&&this.canShowTaxonomies}},methods:{processChangeTab(s){this.activeTab=s},canExport(s){if(this.rootStore.aioseo.data.isNetworkAdmin&&!this.site)return!1;const o=[];return Object.keys(s).forEach(h=>{o.push(s[h])}),o.some(h=>h)},processExportContent(){let s=[],o=[];this.activeTab==="post-types"&&(s=this.rootStore.aioseo.postData.postTypes.filter(l=>this.postOptions.all||this.postOptions[l.name]).map(l=>l.name)),this.activeTab==="taxonomies"&&(o=this.rootStore.aioseo.postData.taxonomies.filter(l=>this.taxonomiesOptions.all||this.taxonomiesOptions[l.name]).map(l=>l.name));const h=this.site?`${this.site.domain}${this.site.path.replace("/","-")}`:"";this.exportType&&(this.loadingContent=!0,this.errorContent=null,this.toolsStore.exportContent({postOptions:s,taxonomiesOptions:o,typeFile:this.exportType.value,siteId:this.site?this.site.blog_id:null}).then(l=>{var e,c;if(this.loadingContent=!1,this.postOptions=this.activeTab==="post-types"?{}:this.postOptions,this.taxonomiesOptions=this.activeTab==="taxonomies"?{}:this.taxonomiesOptions,l.body.success===!1){this.errorContent=this.strings.errorExport;return}if((e=l.body)!=null&&e.postTypeData){this.prepareAfterResponse("post-types",l.body.postTypeData,h,this.exportType.value);return}if((c=l.body)!=null&&c.taxonomiesData){this.prepareAfterResponse("taxonomies",l.body.taxonomiesData,h,this.exportType.value);return}this.errorContent=this.strings.errorExportEmpty}).catch(l=>{console.error("Error fetching data:",l)}))},prepareAfterResponse(s,o,h,l){const e=this.getFileType(l),c=l==="json"?JSON.stringify(o):o,S=new Blob([c],{type:e}),g=document.createElement("a");g.href=URL.createObjectURL(S),g.download=`aioseo-export-${s}-${h}${J.now().toFormat("yyyy-MM-dd")}.`+l,g.click(),URL.revokeObjectURL(g.href)},getFileType(s){return s==="csv"?"text/csv":s==="json"?"application/json":!1}}},qe={key:0,class:"aioseo-settings-row"},He={class:"select-site"},We={class:"tabs-content"},Je={key:0},Ze={key:1};function Ge(s,o,h,l,e,c){const S=n("svg-upload"),g=n("core-network-site-selector"),b=n("core-main-tabs"),x=n("base-checkbox"),f=n("grid-column"),w=n("grid-row"),C=n("cta-export-taxonomies"),v=n("base-radio"),V=n("core-alert"),y=n("base-button"),j=n("core-card");return c.canExportPostOptions?(a(),m(j,{key:0,class:"aioseo-export-content",slug:"exportPostTypes",toggles:!1,"no-slide":"","header-text":e.strings.exportContent},{"header-icon":t(()=>[i(S)]),default:t(()=>[l.rootStore.aioseo.data.isNetworkAdmin?(a(),k("div",qe,[T("div",He,p(e.strings.selectSite),1),i(g,{onSelectedSite:o[0]||(o[0]=_=>e.site=_)})])):d("",!0),(a(),m(b,{internal:"",key:e.tabsKey,tabs:e.tabOptions,active:e.activeTab,showSaveButton:!1,onChanged:c.processChangeTab},null,8,["tabs","active","onChanged"])),T("div",We,[e.activeTab==="post-types"?(a(),k("div",Je,[i(w,null,{default:t(()=>[i(f,{class:"col-subtitle col-subtitle--bottom"},{default:t(()=>[i(x,{size:"medium",modelValue:e.postOptions.all,"onUpdate:modelValue":o[1]||(o[1]=_=>e.postOptions.all=_),disabled:l.rootStore.aioseo.data.isNetworkAdmin&&!e.site},{default:t(()=>[u(p(e.strings.exportAllPostTypes),1)]),_:1},8,["modelValue","disabled"])]),_:1}),(a(!0),k(P,null,z(l.rootStore.aioseo.postData.postTypes,(_,R)=>(a(),m(f,{key:R,sm:"6"},{default:t(()=>[e.postOptions.all?d("",!0):(a(),m(x,{key:0,size:"medium",modelValue:e.postOptions[_.name],"onUpdate:modelValue":F=>e.postOptions[_.name]=F,disabled:l.rootStore.aioseo.data.isNetworkAdmin&&!e.site},{default:t(()=>[u(p(_.label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])),_.name!=="all"&&e.postOptions.all?(a(),m(x,{key:1,size:"medium",modelValue:!0,disabled:""},{default:t(()=>[u(p(_.label),1)]),_:2},1024)):d("",!0)]),_:2},1024))),128))]),_:1})])):d("",!0),c.canShowTaxonomies&&e.activeTab==="taxonomies"?(a(),k("div",Ze,[i(w,null,{default:t(()=>[i(f,{class:"col-subtitle col-subtitle--bottom"},{default:t(()=>[i(x,{size:"medium",modelValue:e.taxonomiesOptions.all,"onUpdate:modelValue":o[2]||(o[2]=_=>e.taxonomiesOptions.all=_),disabled:l.rootStore.aioseo.data.isNetworkAdmin&&!e.site},{default:t(()=>[u(p(e.strings.exportAllTaxonomies),1)]),_:1},8,["modelValue","disabled"])]),_:1}),(a(!0),k(P,null,z(l.rootStore.aioseo.postData.taxonomies,(_,R)=>(a(),m(f,{key:R,sm:"6"},{default:t(()=>[e.taxonomiesOptions.all?d("",!0):(a(),m(x,{key:0,size:"medium",modelValue:e.taxonomiesOptions[_.name],"onUpdate:modelValue":F=>e.taxonomiesOptions[_.name]=F,disabled:l.rootStore.aioseo.data.isNetworkAdmin&&!e.site},{default:t(()=>[u(p(_.label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"])),_.name!=="all"&&e.taxonomiesOptions.all?(a(),m(x,{key:1,size:"medium",modelValue:!0,disabled:""},{default:t(()=>[u(p(_.label),1)]),_:2},1024)):d("",!0)]),_:2},1024))),128))]),_:1})])):d("",!0),!c.canShowTaxonomies&&e.activeTab==="taxonomies"?(a(),m(C,{key:2})):d("",!0)]),e.activeTab==="post-types"||c.canShowTaxonomies&&e.activeTab==="taxonomies"?(a(),m(w,{key:1},{default:t(()=>[i(f,{class:"col-subtitle col-subtitle--top"},{default:t(()=>[u(p(e.strings.exportAs),1)]),_:1}),i(f,null,{default:t(()=>[i(w,null,{default:t(()=>[(a(!0),k(P,null,z(e.exportTypes,(_,R)=>(a(),m(v,{key:R,size:"medium",name:"type",modelValue:_.value===e.exportType.value,"onUpdate:modelValue":F=>e.exportType=_,disabled:l.rootStore.aioseo.data.isNetworkAdmin&&!e.site,type:2},{default:t(()=>[u(p(_.label),1)]),_:2},1032,["modelValue","onUpdate:modelValue","disabled"]))),128))]),_:1})]),_:1})]),_:1})):d("",!0),e.errorContent?(a(),m(V,{key:2,class:"error-export-post-type",type:"red"},{default:t(()=>[u(p(e.errorContent),1)]),_:1})):d("",!0),c.canShowButtonExport?(a(),m(y,{key:3,type:"blue",size:"medium",class:"import",onClick:c.processExportContent,disabled:c.isExportContentDisabled,loading:e.loadingContent},{default:t(()=>[u(p(e.strings.exportContent),1)]),_:1},8,["onClick","disabled","loading"])):d("",!0)]),_:1},8,["header-text"])):d("",!0)}const Ke=D(Ye,[["render",Ge]]),B="all-in-one-seo-pack",Qe={setup(){return{rootStore:N(),toolsStore:G()}},components:{CoreAlert:Z,CoreCard:L,CoreNetworkSiteSelector:Y,SvgDownload:ie},data(){return{site:null,inputFile:null,filename:null,file:null,uploadError:!1,uploadSuccess:!1,loading:!1,strings:{selectSite:r("Select Site",B),importRestoreAioseoSettings:U(r("Import / Restore %1$s Settings or Content",B),"AIOSEO"),fileUploadPlaceholder:r("Import from a JSON, CSV or INI file...",B),chooseAFile:r("Choose a File",B),fileUploadDescription:r("Imported will overwrite existing data and will not be merged.",B),import:r("Import",B),jsonFileTypeRequired:r("A JSON, CSV or INI file is required to import.",B),fileUploadedSuccessfully:r("Success! Your settings have been imported.",B),fileUploadFailed:r("There was an error importing your file. Please make sure you are uploading the correct file or it is in the proper format.",B),v3ImportWarning:U(r("Please note that if you are importing post/term meta from %1$s v3.7.1 or below, this will only be successful if the post/term IDs of this site are identical to those of the source site.",B),"AIOSEO")}}},watch:{uploadError(s){s&&Q(()=>{this.uploadError=!1},5e3)}},computed:{importValidated(){return!(this.rootStore.aioseo.data.isNetworkAdmin&&!this.site||!this.file.type||!this.file.name||this.file.type!=="application/json"&&this.file.type!=="text/csv"&&!this.file.name.endsWith(".ini"))}},methods:{reset(){this.uploadError=!1,this.filename=null,this.file=null,this.inputFile=null},triggerFileUpload(){this.reset(),this.$refs.file.$el.querySelector("input").focus(),this.$refs.file.$el.querySelector("input").click()},submitFile(){this.loading=!0,this.toolsStore.uploadFile({file:this.file,filename:this.filename,siteId:this.site?this.site.blog_id:null}).then(s=>{if(this.loading=!1,!s.body.success){this.uploadError=this.strings.fileUploadFailed,this.uploadSuccess=!1;return}this.reset(),this.uploadSuccess=!0,Q(()=>{this.uploadSuccess=!1},5e3)}).catch(()=>{this.uploadError=this.strings.fileUploadFailed,this.loading=!1})},handleFileUpload(){this.reset(),this.file=this.$refs.file.$el.querySelector("input").files[0],this.file&&(this.filename=this.file.name,this.file.type!=="application/json"&&this.file.type!=="text/csv"&&!this.file.name.endsWith(".ini")&&(this.uploadError=this.strings.jsonFileTypeRequired))}}},Xe={key:0,class:"aioseo-settings-row"},$e={class:"select-site"},et={class:"file-upload"},tt={class:"aioseo-description"};function ot(s,o,h,l,e,c){const S=n("svg-download"),g=n("core-network-site-selector"),b=n("core-alert"),x=n("base-input"),f=n("base-button"),w=n("core-card");return a(),m(w,{class:"aioseo-import-aioseo",slug:"importAioseoSettings",toggles:!1,"no-slide":"","header-text":e.strings.importRestoreAioseoSettings},{"header-icon":t(()=>[i(S)]),default:t(()=>[l.rootStore.aioseo.data.isNetworkAdmin?(a(),k("div",Xe,[T("div",$e,p(e.strings.selectSite),1),i(g,{onSelectedSite:o[0]||(o[0]=C=>e.site=C)})])):d("",!0),e.uploadError?(a(),m(b,{key:1,type:"red",class:"import-alert"},{default:t(()=>[u(p(e.uploadError),1)]),_:1})):d("",!0),e.filename&&e.filename.endsWith(".ini")?(a(),m(b,{key:2,type:"yellow",class:"import-alert"},{default:t(()=>[u(p(e.strings.v3ImportWarning),1)]),_:1})):d("",!0),e.uploadSuccess?(a(),m(b,{key:3,type:"green",class:"import-alert"},{default:t(()=>[u(p(e.strings.fileUploadedSuccessfully),1)]),_:1})):d("",!0),T("div",et,[i(x,{modelValue:e.filename,"onUpdate:modelValue":o[1]||(o[1]=C=>e.filename=C),size:"medium",onFocus:c.triggerFileUpload,placeholder:e.strings.fileUploadPlaceholder,class:M({"aioseo-error":e.uploadError}),disabled:l.rootStore.aioseo.data.isNetworkAdmin&&!e.site},null,8,["modelValue","onFocus","placeholder","class","disabled"]),i(f,{type:"black",size:"medium",onClick:c.triggerFileUpload,disabled:l.rootStore.aioseo.data.isNetworkAdmin&&!e.site},{default:t(()=>[u(p(e.strings.chooseAFile),1)]),_:1},8,["onClick","disabled"])]),i(x,{modelValue:e.inputFile,"onUpdate:modelValue":o[2]||(o[2]=C=>e.inputFile=C),type:"file",onClick:c.reset,onChange:c.handleFileUpload,ref:"file"},null,8,["modelValue","onClick","onChange"]),T("div",tt,p(e.strings.fileUploadDescription),1),i(f,{type:"blue",size:"medium",class:"import",onClick:c.submitFile,disabled:!e.file||!c.importValidated,loading:e.loading},{default:t(()=>[u(p(e.strings.import),1)]),_:1},8,["onClick","disabled","loading"])]),_:1},8,["header-text"])}const le=D(Qe,[["render",ot]]),O="all-in-one-seo-pack",st={setup(){return{rootStore:N(),toolsStore:G()}},components:{BaseCheckbox:ee,CoreAlert:Z,CoreCard:L,CoreNetworkSiteSelector:Y,GridColumn:q,GridRow:H,SvgDownload:ie},data(){return{site:null,importSuccess:!1,importError:!1,options:{},plugin:null,loading:!1,strings:{selectSite:r("Select Site",O),importSettingsFromOtherPlugins:r("Import Settings From Other Plugins",O),importOthersDescription:U(r("Choose a plugin to import SEO data directly into %1$s.",O),"AIOSEO"),selectPlugin:r("Select a plugin...",O),import:r("Import",O),allSettings:r("All Settings",O),notInstalled:r("not installed",O)}}},watch:{plugin(){this.importSuccess=!1,this.importError=!1,this.options={}}},computed:{settings(){const s=[{value:"settings",label:r("SEO Settings",O)},{value:"postMeta",label:r("Post Meta",O)}];return this.rootStore.isPro&&s.push({value:"termMeta",label:r("Term Meta",O)}),s},plugins(){const s=[];return this.rootStore.aioseo.importers.forEach(o=>{s.push({value:o.slug,label:o.name,canImport:o.canImport,version:o.version,$isDisabled:!o.installed})}),s},canImport(){if(this.rootStore.aioseo.data.isNetworkAdmin&&!this.site)return!1;const s=[];return Object.keys(this.options).forEach(o=>{s.push(this.options[o])}),s.some(o=>o)},importSuccessful(){return U(r("%1$s was successfully imported!",O),this.plugin.label)},importErrorMessage(){return U(r("An error occurred while importing %1$s. Please try again.",O),this.plugin.label)}},methods:{processImportPlugin(){this.importSuccess=!1,this.importError=!1,this.loading=!0;const s=[];this.options.all?this.settings.filter(o=>o.value!=="all").forEach(o=>{s.push(o.value)}):Object.keys(this.options).forEach(o=>{this.options[o]&&s.push(o)}),this.toolsStore.importPlugins({plugins:[{plugin:this.plugin.value,settings:s}],siteId:this.site?this.site.blog_id:null}).then(()=>{this.loading=!1,this.importSuccess=!0,this.options={}}).catch(()=>{this.loading=!1,this.importError=!0,this.options={}})},invalidVersion(s){return U(r("We do not support importing from the currently installed version of %1$s (%2$s). Please upgrade to the latest version and try again.",O),s.label,s.version)}}},it={key:0,class:"aioseo-settings-row"},rt={class:"select-site"},nt={class:"aioseo-section-description"},lt={class:"import-plugin-label"},at={class:"plugin-label"},ct={key:0,class:"plugin-status"},pt={key:3,class:"import-settings"};function ut(s,o,h,l,e,c){const S=n("svg-download"),g=n("core-network-site-selector"),b=n("core-alert"),x=n("base-select"),f=n("base-checkbox"),w=n("grid-column"),C=n("grid-row"),v=n("base-button"),V=n("core-card");return a(),m(V,{id:"aioseo-import-others",class:"aioseo-import-others",slug:"importOtherPlugins",toggles:!1,"no-slide":"","header-text":e.strings.importSettingsFromOtherPlugins},{"header-icon":t(()=>[i(S)]),default:t(()=>[l.rootStore.aioseo.data.isNetworkAdmin?(a(),k("div",it,[T("div",rt,p(e.strings.selectSite),1),i(g,{onSelectedSite:o[0]||(o[0]=y=>e.site=y)})])):d("",!0),T("div",nt,p(e.strings.importOthersDescription),1),e.importSuccess?(a(),m(b,{key:1,class:"import-success",type:"green"},{default:t(()=>[u(p(c.importSuccessful),1)]),_:1})):d("",!0),e.importError?(a(),m(b,{key:2,class:"import-error",type:"red"},{default:t(()=>[u(p(c.importErrorMessage),1)]),_:1})):d("",!0),i(x,{size:"medium",modelValue:e.plugin,"onUpdate:modelValue":o[1]||(o[1]=y=>e.plugin=y),options:c.plugins,placeholder:e.strings.selectPlugin,disabled:l.rootStore.aioseo.data.isNetworkAdmin&&!e.site},{option:t(({option:y})=>[T("div",lt,[T("span",at,p(y.label),1),y.$isDisabled?(a(),k("span",ct,p(e.strings.notInstalled),1)):d("",!0)])]),_:1},8,["modelValue","options","placeholder","disabled"]),e.plugin?(a(),k("div",pt,[e.plugin.canImport?(a(),m(C,{key:0},{default:t(()=>[i(w,null,{default:t(()=>[i(f,{size:"medium",modelValue:e.options.all,"onUpdate:modelValue":o[2]||(o[2]=y=>e.options.all=y)},{default:t(()=>[u(p(e.strings.allSettings),1)]),_:1},8,["modelValue"])]),_:1}),(a(!0),k(P,null,z(c.settings,(y,j)=>(a(),m(w,{key:j,sm:"6"},{default:t(()=>[e.options.all?d("",!0):(a(),m(f,{key:0,size:"medium",modelValue:e.options[y.value],"onUpdate:modelValue":_=>e.options[y.value]=_},{default:t(()=>[u(p(y.label),1)]),_:2},1032,["modelValue","onUpdate:modelValue"])),y.value!=="all"&&e.options.all?(a(),m(f,{key:1,size:"medium",modelValue:!0,disabled:""},{default:t(()=>[u(p(y.label),1)]),_:2},1024)):d("",!0)]),_:2},1024))),128))]),_:1})):d("",!0),e.plugin.canImport?d("",!0):(a(),m(b,{key:1,type:"red"},{default:t(()=>[u(p(c.invalidVersion(e.plugin)),1)]),_:1}))])):d("",!0),i(v,{type:"blue",size:"medium",class:"import",onClick:c.processImportPlugin,disabled:!e.plugin||!c.canImport,loading:e.loading},{default:t(()=>[u(p(e.strings.import),1)]),_:1},8,["onClick","disabled","loading"])]),_:1},8,["header-text"])}const ae=D(st,[["render",ut]]),dt={components:{BackupSettings:re,GridColumn:q,GridRow:H,ExportSettings:ne,ExportContents:Ke,ImportAioseo:le,ImportOthers:ae}},mt={class:"aioseo-tools-import-export"};function _t(s,o,h,l,e,c){const S=n("import-aioseo"),g=n("grid-column"),b=n("export-settings"),x=n("import-others"),f=n("export-contents"),w=n("grid-row"),C=n("backup-settings");return a(),k("div",mt,[i(w,null,{default:t(()=>[i(g,{md:"6",class:M(["import-aiseo"])},{default:t(()=>[i(S)]),_:1}),i(g,{md:"6",class:M(["export-settings"])},{default:t(()=>[i(b)]),_:1}),i(g,{md:"6",class:M(["import-others"])},{default:t(()=>[i(x)]),_:1}),i(g,{md:"6",class:M(["export-contents"])},{default:t(()=>[i(f)]),_:1})]),_:1}),i(w,null,{default:t(()=>[i(g,null,{default:t(()=>[i(C)]),_:1})]),_:1})])}const ht=D(dt,[["render",_t]]),K="all-in-one-seo-pack",gt={setup(){return{rootStore:N()}},components:{RequiredPlans:ve,BackupSettings:re,CoreBlur:ye,Cta:se,GridColumn:q,GridRow:H,ExportSettings:ne,ImportAioseo:le,ImportOthers:ae},data(){return{links:te,strings:{ctaHeader:U(r("Network Tools is a %1$s Feature",K),"PRO"),ctaButtonText:r("Unlock Network Tools",K),networkDatabaseToolsDescription:r("Unlock network-level tools to manage all your sites from one easy-to-use location. Migrate data or create backups without the need to visit each dashboard.",K)}}}},ft={class:"aioseo-tools-import-export"};function bt(s,o,h,l,e,c){const S=n("import-aioseo"),g=n("import-others"),b=n("grid-column"),x=n("export-settings"),f=n("grid-row"),w=n("backup-settings"),C=n("core-blur"),v=n("required-plans"),V=n("cta");return a(),k("div",ft,[i(C,null,{default:t(()=>[i(f,null,{default:t(()=>[i(b,{md:"6"},{default:t(()=>[i(S),i(g)]),_:1}),i(b,{md:"6"},{default:t(()=>[i(x)]),_:1})]),_:1}),i(f,null,{default:t(()=>[i(b,null,{default:t(()=>[i(w)]),_:1})]),_:1})]),_:1}),i(V,{"cta-link":e.links.getPricingUrl("network-tools","import-export"),"button-text":e.strings.ctaButtonText,"learn-more-link":e.links.getUpsellUrl("network-tools","import-export",l.rootStore.isPro?"pricing":"liteUpgrade")},{"header-text":t(()=>[u(p(e.strings.ctaHeader),1)]),description:t(()=>[i(v,{"core-feature":["tools","network-tools-import-export"]}),u(" "+p(e.strings.networkDatabaseToolsDescription),1)]),_:1},8,["cta-link","button-text","learn-more-link"])])}const kt=D(gt,[["render",bt]]),St={setup(){return{licenseStore:$(),rootStore:N()}},components:{ImportExport:ht,LiteImportExport:kt},data(){return{license:pe}}};function xt(s,o,h,l,e,c){const S=n("import-export",!0),g=n("lite-import-export");return a(),k("div",null,[!l.rootStore.aioseo.data.isNetworkAdmin||!l.licenseStore.isUnlicensed&&e.license.hasCoreFeature("tools","network-tools-import-export")?(a(),m(S,{key:0})):d("",!0),l.rootStore.aioseo.data.isNetworkAdmin&&(l.licenseStore.isUnlicensed||!e.license.hasCoreFeature("tools","network-tools-import-export"))?(a(),m(g,{key:1})):d("",!0)])}const ao=D(St,[["render",xt]]);export{ao as default};