(window["aioseopjsonp"]=window["aioseopjsonp"]||[]).push([["tools-partials-ImportAioseo-vue"],{"1b5a2":function(e,i,t){},a551:function(e,i,t){"use strict";t.r(i);var s=function(){var e=this,i=e.$createElement,t=e._self._c||i;return t("core-card",{staticClass:"aioseo-import-aioseo",attrs:{slug:"importAioseoSettings",toggles:!1,"no-slide":"","header-text":e.strings.importRestoreAioseoSettings},scopedSlots:e._u([{key:"header-icon",fn:function(){return[t("svg-download")]},proxy:!0}])},[e.uploadError?t("core-alert",{staticClass:"import-error",attrs:{type:"red"}},[e._v(" "+e._s(e.uploadError)+" ")]):e._e(),e.uploadSuccess?t("core-alert",{staticClass:"import-error",attrs:{type:"green"}},[e._v(" "+e._s(e.strings.fileUploadedSuccessfully)+" ")]):e._e(),t("div",{staticClass:"file-upload"},[t("base-input",{class:{"aioseo-error":e.uploadError},attrs:{size:"medium",placeholder:e.strings.fileUploadPlaceholder},on:{focus:e.triggerFileUpload},model:{value:e.filename,callback:function(i){e.filename=i},expression:"filename"}}),t("base-button",{attrs:{type:"black",size:"medium"}},[e._v(" "+e._s(e.strings.chooseAFile)+" "),t("base-input",{ref:"file",attrs:{type:"file"},on:{click:e.reset,change:e.handleFileUpload},model:{value:e.inputFile,callback:function(i){e.inputFile=i},expression:"inputFile"}})],1)],1),t("div",{staticClass:"aioseo-description"},[e._v(" "+e._s(e.strings.fileUploadDescription)+" ")]),t("base-button",{staticClass:"import",attrs:{type:"blue",size:"medium",disabled:!e.file||!e.importValidated,loading:e.loading},on:{click:e.submitFile}},[e._v(" "+e._s(e.strings.import)+" ")])],1)},l=[],o=(t("b0c0"),t("8a79"),t("5530")),r=t("2f62"),a={data:function(){return{inputFile:null,filename:null,file:null,uploadError:!1,uploadSuccess:!1,loading:!1,strings:{importRestoreAioseoSettings:this.$t.sprintf(this.$t.__("Import / Restore %1$s Settings",this.$td),"AIOSEO"),fileUploadPlaceholder:this.$t.__("Import from a JSON or INI file...",this.$td),chooseAFile:this.$t.__("Choose a File",this.$td),fileUploadDescription:this.$t.__("Imported settings will overwrite existing settings and will not be merged.",this.$td),import:this.$t.__("Import",this.$td),jsonFileTypeRequired:this.$t.__("A JSON or INI file is required to import settings.",this.$td),fileUploadedSuccessfully:this.$t.__("Success! Your settings have been imported.",this.$td),fileUploadFailed:this.$t.__("There was an error importing your settings. Please make sure you are uploading the correct file or it is in the proper format.",this.$td)}}},computed:{importValidated:function(){return!("application/json"!==this.file.type&&!this.file.name.endsWith(".ini"))}},methods:Object(o["a"])(Object(o["a"])({},Object(r["b"])(["uploadFile"])),{},{reset:function(){this.uploadError=!1,this.filename=null,this.file=null,this.inputFile=null},triggerFileUpload:function(){this.reset(),this.$refs.file.$el.querySelector("input").focus(),this.$refs.file.$el.querySelector("input").click()},submitFile:function(){var e=this;this.loading=!0,this.uploadFile({file:this.file,filename:this.filename}).then((function(){e.reset(),e.uploadSuccess=!0,e.loading=!1})).catch((function(){e.reset(),e.loading=!1,e.uploadError=e.strings.fileUploadFailed}))},handleFileUpload:function(){this.reset(),this.file=this.$refs.file.$el.querySelector("input").files[0],this.file&&(this.filename=this.file.name,"application/json"===this.file.type||this.file.name.endsWith(".ini")||(this.uploadError=this.strings.jsonFileTypeRequired))}})},n=a,u=(t("e0b2"),t("2877")),p=Object(u["a"])(n,s,l,!1,null,null,null);i["default"]=p.exports},e0b2:function(e,i,t){"use strict";var s=t("1b5a2"),l=t.n(s);l.a}}]);