!function(i,t){var p=function(i){this.$form=i,this.xhr=!1,this.mapping=dlp_import_params.mapping,this.position=0,this.file=dlp_import_params.file,this.delimiter=dlp_import_params.delimiter,this.security=dlp_import_params.import_nonce,this.ajax_url=dlp_import_params.ajax_url,this.imported=0,this.failed=0,this.skipped=0,this.$form.find(".dlp-importer-progress").val(0),this.run_import=this.run_import.bind(this),this.run_import()};p.prototype.run_import=function(){var p=this;i.ajax({type:"POST",url:p.ajax_url,data:{action:"dlp_document_import",position:p.position,mapping:p.mapping,file:p.file,delimiter:p.delimiter,security:p.security},dataType:"json",success:function(i){if(i.success)if(p.position=i.data.position,p.imported+=i.data.imported,p.failed+=i.data.failed,p.skipped+=i.data.skipped,p.$form.find(".dlp-importer-progress").val(i.data.percentage),"done"===i.data.position){var r=p.file.split("/").pop();t.location=i.data.url+"&documents-imported="+parseInt(p.imported,10)+"&documents-failed="+parseInt(p.failed,10)+"&documents-skipped="+parseInt(p.skipped,10)+"&file-name="+r}else p.run_import()}}).fail((function(i){t.console.log(i)}))},i.fn.dlp_importer=function(){return new p(this),this},i(".dlp-importer").dlp_importer()}(jQuery,window);