"use strict";function wpieUploadOnedriveFile(e){wpieSetProcessLoader({wpieDownloadFileText:wpiePluginSettings.wpieLocalizeText.wpieDownloadFileText});var i=e.value[0],t=i["@microsoft.graph.downloadUrl"],p=i.name,r={action:"wpie_import_upload_file_from_onedrive",wpie_import_id:wpiePluginSettings.wpieImportId,file_url:t,fileName:p,wpieSecurity:wpiePluginSettings.wpieSecurity};jQuery.ajax({url:wpiePluginSettings.wpieAjaxURL,type:"POST",data:r,dataType:"json",async:!0,success:function(e){return wpieUpdateProcessLoader("wpieDownloadFileText"),"error"===e.status?(wpieSetErrorMsg(e.message),!1):void wpieSetFileData(e)},error:function(e,i){wpieHandleAjaxError(e,i)}})}window.wpiePluginSettings=window.wpiePluginSettings||{},window.OneDrive=window.OneDrive||{},jQuery(document).on("click",".wpie_onedrive_upload_btn",function(){var e=jQuery(".wpie_onedrive_client_id").val();if(""!==e){var i=jQuery(".wpie_onedrive_redirect_uri").val(),t={clientId:e,action:"download",multiSelect:!1,advanced:{redirectUri:i},openInNewWindow:!0,success:function(e){wpieUploadOnedriveFile(e)},cancel:function(){},error:function(e){}};OneDrive.open(t)}});