function FileProperty(n){this.type=n;this.SourceExt="";this.DestExt="";this.IsValidFile=!1}function GetDestExt(){var t="",n=$("#conversion-modal-label").text();return n.toLowerCase().indexOf(AddNewDocText.toLowerCase())>=0?t="PDF":n.toLowerCase().indexOf(ToTextSimpliJs)>=0?(t=n.split(ToTextSimpliJs)[1].trim(),ImagetoTextModalText.toLowerCase().indexOf(t)>=0&&(t="Text")):t=n.toLowerCase().indexOf(SplitPdfsText.toLowerCase())>=0?SplitPdfsText.toUpperCase():n.toLowerCase().indexOf(MergePdfsText.toLowerCase())>=0?MergePdfsText.toUpperCase():n.toLowerCase().indexOf(CompressPdfsText.toLowerCase())>=0?CompressPdfsText.toUpperCase():n.toLowerCase().indexOf(EditPdfsText.toLowerCase())>=0?EditPdfsText.toUpperCase():n.toLowerCase().indexOf(WatermarkText.toLowerCase())>=0?WatermarkText:n.toLowerCase().indexOf(RotateText.toLowerCase())>=0?RotateText:n.toLowerCase().indexOf(SignPdfsText.toLowerCase())>=0?SignPdfsText.toUpperCase():"DOC",t}function validate(n){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(n)?(n.charAt(n.length-1)=="/"&&(n=n.replace(/^\/+|\/+$/g,"")),n):""}function GeneratePDF(){var t=$("#txtHtmlURL").val(),f,n;if(t=validate(t),t=="")$(".modal-footer #htmlErrorUploadLabel").text(wrongFormatErrorText.replace("###","HTML")),$(".modal-footer").removeClass("hidden");else{$("#progress-modal").modal("show");$("#HTML-conversion-modal").modal("hide");f=t.split("//").pop();n=f.split("?")[0];n!=""&&(n=n.split("/").pop());var r="pdf",i="html",u=generateUinqueIDentifier();u=u.split("-").join("");var e=getUserGuid(),o="ofn="+encodeURI(n)+"&unqn="+u+"&foln="+e+"&frm="+i+"&to="+r+"&url="+t,s="/account/html-to-pdf.ashx?"+language+o;$.ajax({url:s,type:"POST",contentType:!1,processData:!1,timeout:document.getElementById("ClientSideAjaxTimeOut").value,success:function(t){var u=$.parseJSON(t);u==null?($("#progress-modal").modal("hide"),$("#HTML-conversion-modal").modal("show"),$(".modal-footer #htmlErrorUploadLabel").text(wrongFormatErrorText.replace("###",i.toUpperCase())),$(".modal-footer").removeClass("hidden")):setTimeout(function(){(n==""||n==undefined)&&(n=u.PDFRender);var t="ofn="+encodeURI(n)+"&unqn="+u.PDFRender+"&frm="+i+"&to="+r+"&fskb="+u.SizeInKB+"&npdf="+u.UniqueName,f=document.getElementById("hdnEditorPageName").value;return redirectOrUpdate(u,document.getElementById("CultureInfo").value+"/userdocument/"+f+"?"+t,r),!1},1e3);$("#txtHtmlURL").val("")},error:function(){$("#progress-modal").modal("hide");$("#HTML-conversion-modal").modal("show");$(".modal-footer #htmlErrorUploadLabel").text(wrongFormatErrorText.replace("###",i.toUpperCase()));$(".modal-footer").removeClass("hidden")}})}}function CreateBlankPDF(n){var t;$("#progress-modal").modal("show");t=generateUinqueIDentifier();t=t.split("-").join("")+".pdf";var i="create",f=getUserGuid(),r="unqn="+t+"&to="+i,u="/account/fileuploadhandler.ashx?"+language+r;n=="true"&&createCookie("edtrpop","frms",1);$.ajax({url:u,type:"POST",contentType:!1,processData:!1,timeout:document.getElementById("ClientSideAjaxTimeOut").value,success:function(n){var t=$.parseJSON(n);setTimeout(function(){var n="ofn="+encodeURI(t.OriginalName)+"&unqn="+t.PDFRender+"&frm=pdf&to="+i+"&fskb="+t.SizeInKB+"&npdf="+t.UniqueName,r=document.getElementById("hdnEditorPageName").value;return redirectOrUpdate(t,document.getElementById("CultureInfo").value+"/userdocument/"+r+"?"+n,i),!1},1e3)},error:function(n){$("#progress-modal").modal("hide");alert(n.statusText)}})}function GetSourceExt(){var n=$("#conversion-modal-label").text();return n.toLowerCase().indexOf(ToTextSimpliJs)>=0?n.split(ToTextSimpliJs)[0].trim():n.toLowerCase().indexOf(SplitPdfsText)>=0||n.toLowerCase().indexOf(MergePdfsText.toLowerCase())>=0?"pdf":"pdf"}function deleteCookies(){document.cookie="signatures=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;";document.cookie="editorPage=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;";document.cookie="financeleadsaw=; expires=Thu, 01 Jan 1970 00:00:00 GMT; path=/;";deleteSignSimpliCookie("seml");deleteSignSimpliCookie("unqn_doc_name");deleteSignSimpliCookie("fName");deleteSignSimpliCookie("lName");deleteSignSimpliCookie("title");deleteSignSimpliCookie("company");deleteSignSimpliCookie("evp");deleteSignSimpliCookie("edid");deleteSignSimpliCookie("pwd");deleteSignSimpliCookie("pdfsimpliauth");deleteSignSimpliCookie("pdfsimplirefreshToken");deleteSignSimpliCookie("199offer");deleteSignSimpliCookie("rwk");deleteSignSimpliCookie("ssopl");deleteSignSimpliCookie("ssosi");localStorage.removeItem("recepients");removeLegacyCookie()}function deleteSignSimpliCookie(n){document.cookie=n+"=; Path=/; Expires=Thu, 01 Jan 1970 00:00:01 GMT;"}function RedirectToIntro(n){var t=n.split("?"),i;!!t&&t.length>1?(i=readCookie("IsMultiSigner"),location.href=i==="true"?document.getElementById("CultureInfo").value+"/esignature/add-recipients?"+t[1]:document.getElementById("CultureInfo").value+"/esignature/single?"+t[1]):window.location.href=n}function redirectOrUpdate(n,t,i){if($("#screenHdn").val()!="account")document.getElementById("CultureInfo").value==""?RedirectToIntro(t):window.location.href=t;else{if(n.IsAuthUser=="false")return window.location.href=document.getElementById("CultureInfo").value+"/account/login",!1;UpdateDocumentProfile(n,i)}}function uploadFilesForMerge(n,t){var e=generateUinqueIDentifier(),u,f,r,i;if(e=e.split("-").join(""),u=new FormData,t=="none"){for(i=0;i<n.length;i++)u.append(n[i].name,n[i]);f=changeToValidFileName(n[0].name)}else{if(t=="dropbox")if(n.length<6){for(r=0,i=0;i<n.length;i++)n[i].bytes>10485760==!0&&(r=r+1);if(r>0)$("#file-merge-modal").modal("show"),$(".modal-footer #mergeErrorLabel").text(ErrorMaximumSize),$(".modal-footer #mergeErrorLabel").removeClass("hidden");else{for($("#progress-modal").modal("show"),i=0;i<n.length;i++)u.append(n[i].name,n[i].link);f=changeToValidFileName(n[0].name)}}else $("#file-merge-modal").modal("show"),$(".modal-footer #mergeErrorLabel").text(MergeMaximumFiles),$(".modal-footer #mergeErrorLabel").removeClass("hidden");if(t=="googledrive"){for(i=0;i<n.length;i++)u.append(n[i].gFileName,n[i].gFileByteBase64String);f=changeToValidFileName(n[0].gFileName)}if(t=="onedrive")if(n.length<6){for(r=0,i=0;i<n.length;i++)n[i].size>10485760==!0&&(r=r+1);if(r>0)$("#file-merge-modal").modal("show"),$(".modal-footer #mergeErrorLabel").text(ErrorMaximumSize),$(".modal-footer #mergeErrorLabel").removeClass("hidden");else{for($("#progress-modal").modal("show"),i=0;i<n.length;i++)u.append(n[i].name,n[i]["@microsoft.graph.downloadUrl"]);f=changeToValidFileName(n[0].name)}}else $("#file-merge-modal").modal("show"),$(".modal-footer #mergeErrorLabel").text(MergeMaximumFiles),$(".modal-footer #mergeErrorLabel").removeClass("hidden");u.append(t,t)}if(f!=null){e=f.replace(/[^A-Za-z0-9._-]/gi,"").replace(".","_"+e+".");var s=getUserGuid(),h="frm=pdf&to="+MergePdfsText.toUpperCase()+"&foln="+s+"&unqn="+e,c="/account/upload-document.ashx?"+language+h,o=[];$(".dz-filename").each(function(){o.push($(this)[0].innerText)});u.append("filesequence",o);$.ajax({url:c,type:"POST",contentType:!1,processData:!1,data:u,timeout:document.getElementById("ClientSideAjaxTimeOut").value,success:function(n){if(n=="Error: Password protected PDF")$("#progress-modal").modal("hide"),$("#conversion-modal").modal("show"),$(".modal-footer").removeClass("hidden"),$(".modal-footer #errorUploadLabel").text(ErrorPasswordProtectedText);else{var t=$.parseJSON(n),i=getUserGuid();CloseSucess();setTimeout(function(){var u="ofn="+t.OriginalName+"&unqn="+t.PDFRender+"&frm=pdf&to="+MergePdfsText.toUpperCase()+"&fskb="+t.SizeInKB+"&npdf="+t.UniqueName,r=document.getElementById("CultureInfo"),f=document.getElementById("hdnEditorPageName").value,i="/userdocument/"+f+"?"+u,n;return r!=undefined&&(i=r.value+i),n="",language=="lang=es&"?n="UNIR":language=="lang=it&"?n="UNISCI":language=="lang=fr&"?n="FUSIONNER":language=="lang=pt&"?n="MESCLAR":language=="lang=ar&"&&(n="دمج"),redirectOrUpdate(t,i,n),$("#progress-modal").modal("hide"),!1},1e3)}},error:function(n){$("#progress-modal").modal("hide");alert(n.statusText)}})}}function uploadFiles(n,t,i,r){var o,f,u,s,e;if(readCookie("from_e_signature")!=="true"&&deleteSignSimpliCookie("signdirectflow"),deleteSignSimpliCookie("preeditorsaw"),$("#progress-modal").modal("show"),f=new FormData,r=="none"){for(u=0;u<n.length;u++)f.append(n[u].name,n[u]);o=changeToValidFileName(n[0].name)}else{if(r=="dropbox"){for(u=0;u<n.length;u++)f.append(n[u].name,n[u].link);o=changeToValidFileName(n[0].name)}if(r=="googledrive"&&(f.append(n.gFileName,n.gFileByteBase64String),o=n.gValidFileName),r=="onedrive")for(u=0;u<n.length;u++)f.append(n[u].name,n[u]["@microsoft.graph.downloadUrl"]),o=changeToValidFileName(n[u].name);f.append(r,r)}s=o;e=generateUinqueIDentifier();e=e.split("-").join("");e=s.replace(/[^A-Za-z0-9._-]/gi,"").replace(".","_"+e+".");var h=getUserGuid(),c="ofn="+encodeURI(s)+"&unqn="+e+"&foln="+h+"&frm="+t+"&to="+i,l="/account/upload-document.ashx?"+language+c;$.ajax({url:l,type:"POST",contentType:!1,processData:!1,data:f,timeout:document.getElementById("ClientSideAjaxTimeOut").value,success:function(n){var r,u;n=="Error: Password protected PDF"?($("#progress-modal").modal("hide"),$("#conversion-modal").modal("show"),$(".modal-footer").removeClass("hidden"),$(".modal-footer #errorUploadLabel").text(ErrorPasswordProtectedText)):(r=$.parseJSON(n),r==401?window.location.href=document.getElementById("CultureInfo").value:(u=getUserGuid(),createEnvelope(r.Id,e,u,1,r,t,i)));deleteSignSimpliCookie("from_e_signature")},error:function(n){$("#progress-modal").modal("hide");alert(n.statusText)}})}function createEnvelope(n,t,i,r,u,f,e){readCookie("uid")!=null&&readCookie("IsMultiSigner")=="true"?$.ajax({type:"POST",url:"/signsimplienvp/createEnvelope",contentType:"application/json; charset=utf-8",data:JSON.stringify({docId:n,unqn:t,userGuid:i,signerType:readCookie("IsMultiSigner")=="true"?2:1}),success:function(n){var t=JSON.parse(n);createCookie("evp",t.envelopeId,1);createCookie("edid",t.envelopeDocumentId,1);envelopeId=t.envelopeId;setTimeout(function(){var n="ofn="+u.OriginalName+"&unqn="+u.PDFRender+"&frm="+f+"&to="+e+"&fskb="+u.SizeInKB+"&npdf="+u.UniqueName,t=document.getElementById("hdnEditorPageName").value;return redirectOrUpdate(u,document.getElementById("CultureInfo").value+"/userdocument/"+t+"?"+n,e),!1},1e3)},error:function(){console.log("Error while creating Envelope")}}):setTimeout(function(){var n="ofn="+u.OriginalName+"&unqn="+u.PDFRender+"&frm="+f+"&to="+e+"&fskb="+u.SizeInKB+"&npdf="+u.UniqueName,t=document.getElementById("hdnEditorPageName").value;return redirectOrUpdate(u,document.getElementById("CultureInfo").value+"/userdocument/"+t+"?"+n,e),!1},1e3)}function generateUinqueIDentifier(){var n=(new Date).getTime();return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(t){var i=(n+Math.random()*16)%16|0;return n=Math.floor(n/16),(t=="x"?i:i&3|8).toString(16)})}function getUserGuid(){var t="a000000000000000000000000000000a",i=readCookie("uid"),n;return i==null||i==undefined?(n=$("#hdnUserGuid"),n!=undefined&&n.length>0&&(t=$(n).val())):t=i,t}function createCookie(n,t,i){var u,r;i?(r=new Date,r.setTime(r.getTime()+i*864e5),u="; expires="+r.toGMTString()):u="";document.cookie=encodeURIComponent(n)+"="+encodeURIComponent(t)+u+"; path=/"}function readCookie(n){for(var r=encodeURIComponent(n)+"=",u=document.cookie.split(";"),t,i=0;i<u.length;i++){for(t=u[i];t.charAt(0)===" ";)t=t.substring(1,t.length);if(t.indexOf(r)===0)return decodeURIComponent(t.substring(r.length,t.length))}return null}function eraseCookie(n){createCookie(n,"",-1)}function GetQueryStringParams(n){var i=window.location.search.substring(1),r,t,u;for(i=tryDecodeURIComponent(i),r=i.split("&"),t=0;t<r.length;t++)if(u=r[t].split("="),u[0]==n)return u[1]}function tryDecodeURIComponent(n){try{return decodeURIComponent(n)}catch(t){return n}}function changeToValidFileName(n){isIE()||(n=n.normalize("NFD").replace(/[\u0300-\u036f]/g,""));n=n.replace(/["~!@#$%^&*\(\)=`{}\[\]\|\\:;'<>,\/?"\t\r\n]+/g,"");var t=n.replace(/ /g," "),i=n.split(".").pop().toLowerCase();return t.length>=75&&(t=n.substring(0,69)+"."+i),t}function isIE(){var n=window.navigator.userAgent,t=n.indexOf("MSIE "),i=n.indexOf("Trident/");return t>0||i>0}function validateFiles(n,t,i,r,u){var f=!0;return typeof n=="undefined"?($(".modal-footer #errorUploadLabel").text(wrongFormatErrorText.replace("###",t.toUpperCase())),$(".modal-footer").removeClass("hidden"),f=!1):ImagetoTextModalText.toLowerCase().indexOf(t.toLowerCase())>=0?i!="jpg"&&i!="tiff"&&i!="png"&&i!="jpeg"&&i!="tif"&&($(".modal-footer #errorUploadLabel").text(wrongFormatErrorText.replace("###","jpg/tiff/png")),$(".modal-footer").removeClass("hidden"),t=i,f=!1):t.toLowerCase()!=i?($(".modal-footer #errorUploadLabel").text(wrongFormatErrorText.replace("###",t.toUpperCase())),$(".modal-footer").removeClass("hidden"),f=!1):u/1e3>2e4&&($(".modal-footer #errorUploadLabel").text(ErrorMaximumSize),$(".modal-footer").removeClass("hidden"),f=!1),fileProp=new FileProperty("FileProperty"),fileProp.DestExt=r,fileProp.SourceExt=t,fileProp.IsValidFile=f,fileProp}function validateFilesImageSelect(n,t,i,r,u){$("#errorLandingDragImage").addClass("hidden");var f=!0;return typeof n=="undefined"?($("#errorLandingDragImage").text(wrongFormatErrorText.replace("###",t.toUpperCase())),$("#errorLandingDragImage").removeClass("hidden"),$("#errorMessagePopup").modal("show"),$("#errorMessagePopup").find(".modal-title").text("Wrong Format Error"),$("#errorMessagePopup").find(".modal-body").text("Whoops! This file is the wrong format. Try choosing a valid ### for conversion.".replace("###",t.toUpperCase())),f=!1):ImagetoTextModalText.toLowerCase().indexOf(t.toLowerCase())>=0||t.toLowerCase()=="image"?i!="jpg"&&i!="tiff"&&i!="png"&&i!="jpeg"&&i!="tif"&&($("#errorLandingDragImage").text(wrongFormatErrorText.replace("###","jpg/tiff/png")),$("#errorLandingDragImage").removeClass("hidden"),t=i,f=!1):t.toLowerCase()!=i?($("#errorLandingDragImage").text(wrongFormatErrorText.replace("###",t.toUpperCase())),$("#errorLandingDragImage").removeClass("hidden"),f=!1,$("#errorSecondHeading").text(wrongFormatErrorText.replace("###",t.toUpperCase())),$("#errorSecondHeading").removeClass("hidden"),$("#errorMessagePopup").modal("show"),$("#errorMessagePopup").find(".modal-title").text("Wrong Format Error"),$("#errorMessagePopup").find(".modal-body").text("Whoops! This file is the wrong format. Try choosing a valid ### for conversion.".replace("###",t.toUpperCase()))):u/1e3>2e4&&($("#errorLandingDragImage").text(ErrorMaximumSize),$("#errorLandingDragImage").removeClass("hidden"),f=!1),f==!1&&resetAllInputControl(),fileProp=new FileProperty("FileProperty"),fileProp.DestExt=r,fileProp.SourceExt=t,fileProp.IsValidFile=f,fileProp}function ChangeCommonlyUsedExt(n){var t=n;return n=="tif"&&(t="tiff"),n=="jpeg"&&(t="jpg"),n=="xlsx"&&(t="xls"),n=="docx"&&(t="doc"),n=="pptx"&&(t="ppt"),t}function resetAllInputControl(){$("input:file").each(function(){$(this).val("")})}function validateFilesBeforeUpload(n,t){var c=$("#conversion-modal-label").text(),e=GetSourceExt(),o=GetDestExt(),r,f=$("#fileUploadFromModalControl"),i,s,u,h;return n=="dropbox"?(i=changeToValidFileName(t[0].name),r=t[0].bytes):n=="onedrive"?(i=t[0].name,r=t[0].size):n=="googledrive"?(i=t.gFileName,r=t.gFileSize):f[0].files[0]!=null?(i=f[0].files[0].name,r=f[0].files[0].size):(i="",r=""),c.toLowerCase().indexOf(AddNewDocText.toLowerCase())>=0&&(e=ChangeCommonlyUsedExt(i.split(".").pop().toLowerCase())),s=changeToValidFileName(i),u=i.split(".").pop().toLowerCase(),u=ChangeCommonlyUsedExt(u),h=checkValidExtensionForUploadFile(u.toLowerCase()),fileProp=validateFiles(s,e,u,o,r),fileProp.DestExt=o,fileProp.IsValidFile=h==!0&&fileProp.IsValidFile==!0?!0:!1,fileProp}function CloseSucess(){$("#progress-modal .progress-loading").addClass("hidden");$("#progress-modal .progress-done").removeClass("hidden");$("#progress-modal .modal-body-text").html(TaskCompleteText);$("#conversion-modal").modal("hide")}function sleep(n){for(var t=(new Date).getTime()+n*1e3;(new Date).getTime()<=t;);}function getAjaxServiceBaseUrl(n){var t=window.location.pathname.toLowerCase();return t.endsWith("/")==!1&&(t+="/"),t.indexOf("/es/")>-1?t=t.replace("/es/","/"):t.indexOf("/it/")>-1?t=t.replace("/it/","/"):t.indexOf("/fr/")>-1?t=t.replace("/fr/","/"):t.indexOf("/pt/")>-1?t=t.replace("/pt/","/"):t.indexOf("/ar/")>-1?t=t.replace("/ar/","/"):t.indexOf("/de/")>-1?t=t.replace("/de/","/"):t.indexOf("/nl/")>-1?t=t.replace("/nl/","/"):t.indexOf("/ja/")>-1?t=t.replace("/ja/","/"):t.indexOf("/zh/")>-1?t=t.replace("/zh/","/"):t.indexOf("/hi/")>-1?t=t.replace("/hi/","/"):t.indexOf("/vi/")>-1?t=t.replace("/vi/","/"):t.indexOf("/ru/")>-1?t=t.replace("/ru/","/"):t.indexOf("/pl/")>-1?t=t.replace("/pl/","/"):t.indexOf("/ph/")>-1?t=t.replace("/ph/","/"):t.indexOf("/tr/")>-1&&(t=t.replace("/tr/","/")),t=t.substr(0,t.length-1),t.indexOf(".aspx")<0&&(t=t+".aspx"),t+"/"+n}function checkValidExtensionForUploadFile(n){for(var i=["pdf","doc","docx","jpg","jpeg","png","xls","xlsx","tiff","tif","ppt","pptx"],t=0;t<i.length;t++)if(n==i[t])return!0;return $(".modal-footer #errorUploadLabel").text(wrongFormatErrorText.replace("###","File")),$(".modal-footer").removeClass("hidden"),!1}function DrawWatermarkOnPdf(n){var t=document.getElementById("hdnEditorPageName").value;t=="view-a"?CreateWatermark(n):t=="view-b"&&PageManager.drawWatermark()}function isMobile(){return"ontouchstart"in window}function DownloadViaLink(n){var t=document.getElementById("downloadLink");t.href=n;t.download="new file";t.click();SetDownloadDates(GetQueryStringParams("documentid"))}function SendFeedback(){$("#feedback-title").val()==""||$("#feedback-textarea").val()==""?($("#errorForFeedback").removeClass("hidden"),$("#CultureInfo").val()=="/ar"&&(ForSignFieldsError="ملء حقل واحد على الأقل"),$("#errorForFeedback").text(ErrorFeedbackText)):($("#errorForFeedback").addClass("hidden"),$("#progress-modal").modal("show"),$.ajax({type:"POST",url:getAjaxServiceBaseUrl("SendFeedback"),contentType:"application/json; charset=utf-8",data:JSON.stringify({title:$("#feedback-title").val(),message:$("#feedback-textarea").val()}),timeout:document.getElementById("ClientSideAjaxTimeOut").value,success:function(){$("#progress-modal").modal("hide");console.log("success: email sent");$("#fbackToggle").removeClass("toggled");$("#fback-section").removeClass("show");$("#feedback-title").val("");$("#feedback-textarea").val("")},error:function(){$("#progress-modal").modal("hide");console.log("Error: email sent")}}),setTimeout(function(){$("#progress-modal").modal("hide");$("#fbackToggle").removeClass("toggled");$("#fback-section").removeClass("show");$("#feedback-title").val("");$("#feedback-textarea").val("")},2e3))}function addAuditTrail(){}function logJSError(n,t,i,r){var u={jsName:n,jsMethod:t,error:i,url:r};$.ajax({url:restUrl+logJSErrorUrl,type:"post",data:JSON.stringify(u),contentType:"application/json",cache:!1,timeout:document.getElementById("ClientSideAjaxTimeOut").value,success:function(){},error:function(n,t,i){PageManager.consoleLog("Error in logJSError: "+i)}})}function uploadFilesForEditorMergeNew(n,t){var u=new FormData,f,r,i;if(t=="none"){for(i=0;i<n.length;i++)u.append(n[i].name,n[i]);f=changeToValidFileName(n[0].name)}else{if(t=="dropbox")if(n.length<6){for(r=0,i=0;i<n.length;i++)n[i].bytes>10485760==!0&&(r=r+1);if(r>0)$("#file-merge-modal").modal("show"),$(".modal-footer #mergeErrorLabel").text(ErrorMaximumSize),$(".modal-footer #mergeErrorLabel").removeClass("hidden");else{for($("#progress-modal").modal("show"),i=0;i<n.length;i++)u.append(n[i].name,n[i].link);f=changeToValidFileName(n[0].name)}}else $("#file-merge-modal").modal("show"),$(".modal-footer #mergeErrorLabel").text(MergeMaximumFiles),$(".modal-footer #mergeErrorLabel").removeClass("hidden");if(t=="googledrive"){for(i=0;i<n.length;i++)u.append(n[i].gFileName,n[i].gFileByteBase64String);f=changeToValidFileName(n[0].gFileName)}if(t=="onedrive")if(n.length<6){for(r=0,i=0;i<n.length;i++)n[i].size>10485760==!0&&(r=r+1);if(r>0)$("#file-merge-modal").modal("show"),$(".modal-footer #mergeErrorLabel").text(ErrorMaximumSize),$(".modal-footer #mergeErrorLabel").removeClass("hidden");else{for($("#progress-modal").modal("show"),i=0;i<n.length;i++)u.append(n[i].name,n[i]["@microsoft.graph.downloadUrl"]);f=changeToValidFileName(n[0].name)}}else $("#file-merge-modal").modal("show"),$(".modal-footer #mergeErrorLabel").text(MergeMaximumFiles),$(".modal-footer #mergeErrorLabel").removeClass("hidden");u.append(t,t)}if(f!=null){var s=GetQueryStringParams("unqn")!=undefined?GetQueryStringParams("unqn"):"",c=GetQueryStringParams("documentid")!=undefined?GetQueryStringParams("documentid"):"",e="";$("#mergedFileUrl").length&&(e=document.getElementById("mergedFileUrl").value);e!=null&&e!==""&&(s=e);var o=getUserGuid(),l="frm=pdf&to="+MergePdfsText.toUpperCase()+"&foln="+o+"&unqn="+s+"&documentId="+c+"&mergeInEditor=true",a="/account/upload-document.ashx?"+language+l,h=[];$(".dz-filename").each(function(){h.push($(this)[0].innerText)});u.append("filesequence",h);$.ajax({url:a,type:"POST",contentType:!1,processData:!1,data:u,timeout:document.getElementById("ClientSideAjaxTimeOut").value,success:function(n){if(n=="Error: Password protected PDF")$("#progress-modal").modal("hide"),$("#conversion-modal").modal("show"),$(".modal-footer").removeClass("hidden"),$(".modal-footer #errorUploadLabel").text(ErrorPasswordProtectedText);else{var t=JSON.parse(n);document.getElementById("documentFilePath").value=t.ModifieldFileUrl.replace(documentFilePath,"");document.getElementById("renderFileName").value=t.PDFRender;document.getElementById("uniqueFileName").value=t.UniqueName;document.getElementById("mergedInEditor").value=!0;document.getElementById("mergedFileUrl").value=t.PDFRender;document.getElementById("originalFileUrl").value=o+"/"+t.ModifiedName;setTimeout(function(){var n=1+Math.floor(Math.random()*6);setTimeout(function(){PDFViewerApplication.open(documentFilePath+document.getElementById("documentFilePath").value+sharedAccessSignature+"&"+n);var t=0,i=setInterval(function(){t=$("div.page[data-page-number]:visible").length;t>0&&(clearInterval(i),$("#progress-modal").modal("show"),setTimeout(function(){console.log("AFTER merge pdf display pdfDocuments.length >>>> ",t);t!=null&&setTimeout(function(){for(let n=1;n<=t;n++)n<=10&&setTimeout(function(){Annotationeer.goToPage(n)},500),(n===t||n>11)&&setTimeout(function(){Annotationeer.goToPage(1);this.ArrangerModal();CloseSucess();o!=="a000000000000000000000000000000a"&&downloadPdfWithAnnotation(!0)},2e3)},2e3)},2e3))},1e3)},2e3)},2e3)}},error:function(n){$("#progress-modal").modal("hide");alert(n.statusText)}})}}function UpdateAbTestByReferrer(n,t){readCookie("fnsmp_ref")!=null&&readCookie("fnsmp_ref")!=""&&$.ajax({type:"GET",url:"https://"+window.location.host+"/api/fspopuptest",data:{cookievalue:readCookie("fnsmp_ref"),key:n,value:t},dataType:"json",contentType:"application/json",cache:!1,timeout:document.getElementById("ClientSideAjaxTimeOut").value,success:function(){},error:function(){console.log("Error")}})}function UpdateAbTestByReferrerCookie(n,t,i){readCookie(i)!=null&&readCookie(i)!=""&&$.ajax({type:"GET",url:"https://"+window.location.host+"/api/updaterefererdata",data:{cookievalue:readCookie(i),key:n,value:t},dataType:"json",contentType:"application/json",cache:!1,timeout:document.getElementById("ClientSideAjaxTimeOut").value,success:function(){},error:function(){console.log("Error")}})}function SaveUserStageFlowToAzureTable(n,t){if(n!=null&&n!=""){var i=getUserGuid();$.ajax({type:"POST",url:"https://"+window.location.host+"/billing/main-cb.aspx/SaveUserStageFlowToAzureTable",contentType:"application/json; charset=utf-8",data:JSON.stringify({userStageName:n,pageUrl:t,userGuid:i}),success:function(){},error:function(){console.log("error occured SaveUserStageFlowToAzureTable")}})}}function ReArrangeMergeFiles(){var n=mergedPdfDropZone.files;n.sort(function(n,t){return $(n.previewElement).index()>$(t.previewElement).index()?1:-1});mergedPdfDropZone.removeAllFiles();mergedPdfDropZone.handleFiles(n)}function ShowHideBBBLogo(n){n!="US"&&$("#BBBLogo").css({display:"none"})}function ValidateHTMLFile(n){return n==""?!1:n.split(".")[1].toUpperCase()=="HTM"||n.split(".")[1].toUpperCase()=="HTML"?!0:!1}function SetDownloadDates(n){var t="https://"+window.location.host+"/document/SetDownloadDates";$.ajax({url:t,type:"post",data:JSON.stringify({documentID:n,userGuid:getUserGuid()}),contentType:"application/json",cache:!1,timeout:document.getElementById("ClientSideAjaxTimeOut").value,success:function(){},error:function(){}})}function onApiLoad(){gapi.load("auth",{callback:onAuthApiLoad});gapi.load("picker",{callback:onPickerApiLoad});gapi.load("client",{callback:onClientApiLoad})}function onSaveApiLoad(){gapi.load("auth",{callback:onSaveAuthApiLoad});gapi.load("picker",{callback:onPickerApiLoad});gapi.load("client",{callback:onClientApiLoad})}function onAuthApiLoad(){window.gapi.auth.authorize({client_id:clientId,scope:scope,immediate:!1},handleAuthResult)}function onSaveAuthApiLoad(){window.gapi.auth.authorize({client_id:clientId,scope:scope,immediate:!1},handleSaveAuthResult)}function onPickerApiLoad(){pickerApiLoaded=!0}function onClientApiLoad(){pickerApiLoaded=!0}function handleAuthResult(n){n&&!n.error&&(oauthToken=n.access_token,clickSource=="mergemodal"?createPickerForMergeModal():createPicker())}function handleSaveAuthResult(n){n&&!n.error&&(oauthToken=n.access_token,createSavePicker())}function createPicker(){if(pickerApiLoaded&&oauthToken){var n=new google.picker.View(google.picker.ViewId.DOCS),t=(new google.picker.PickerBuilder).enableFeature(google.picker.Feature.NAV_HIDDEN).setAppId(appId).setOAuthToken(oauthToken).addView(n).addView(new google.picker.DocsUploadView).setDeveloperKey(developerKey).setCallback(pickerSetDriveCallback).build();t.setVisible(!0)}}function createSavePicker(){if(pickerApiLoaded&&oauthToken){var n=(new google.picker.DocsView).setIncludeFolders(!0).setMimeTypes("application/vnd.google-apps.folder").setSelectFolderEnabled(!0),t=(new google.picker.PickerBuilder).setAppId(appId).setOAuthToken(oauthToken).addView(n).setTitle("Choose Folder").setDeveloperKey(developerKey).setCallback(pickerSaveDriveCallback).build();t.setVisible(!0)}}function createPickerForMergeModal(){if(pickerApiLoaded&&oauthToken){var n=new google.picker.View(google.picker.ViewId.PDFS),t=(new google.picker.PickerBuilder).enableFeature(google.picker.Feature.NAV_HIDDEN).enableFeature(google.picker.Feature.MULTISELECT_ENABLED).setAppId(appId).setOAuthToken(oauthToken).addView(n).addView(new google.picker.DocsUploadView).setDeveloperKey(developerKey).setCallback(pickerSetDriveMergeCallback).build();t.setVisible(!0)}}function pickerSaveDriveCallback(n){if(n.action==google.picker.Action.PICKED){var u=n.docs[0].id,t=new XMLHttpRequest,f=googleUploadBtn.attr("data-url")+sharedAccessSignature,e=googleUploadBtn.attr("data-url").split("/").pop().split("?")[0],o=googleUploadBtn.attr("data-url").split("/").pop().split("?")[0].split(".")[1],i=getContentType(o.toLowerCase()),r;t.open("GET",f,!0);t.responseType="arraybuffer";t.addEventListener("load",function(){if(t.status===200){r=new Blob([t.response],{type:i});var n=new MediaUploader({file:r,metadata:{title:e,mimeType:i,parents:[{id:u}]},token:oauthToken,onProgress:function(){$("#progress-modal").modal("show")},onComplete:function(){CloseSucess();setTimeout(function(){return $("#progress-modal").modal("hide"),!1},1e3)},onError:function(){}});n.upload()}},!1);t.send()}}function pickerSetDriveCallback(n){var o,t;if(n.action==google.picker.Action.PICKED){var s=n.docs[0].id,i=n.docs[0].name,u=changeToValidFileName(i),f=ChangeCommonlyUsedExt(u.split(".").pop().toLowerCase()),r=n.docs[0].sizeBytes,e=n.docs[0].serviceId.toLowerCase();googleDrivefile={gFileSize:r,gFileName:i,gFileByteBase64String:null,gValidFileName:u};e=="doclistblob"||e=="docs"?(o=gapi.auth.getToken().access_token,t=new XMLHttpRequest,t.open("GET","https://www.googleapis.com/drive/v3/files/"+s+"?alt=media",!0),t.setRequestHeader("Authorization","Bearer "+o),t.responseType="arraybuffer",t.onload=function(){var n;clickSource=="page"&&(n=validateFilesImageSelect(i,$("#imageDropZone").attr("data-filesource"),f,$("#imageDropZone").attr("data-filedest"),r),n.IsValidFile&&(googleDrivefile.gFileByteBase64String=base64ArrayBuffer(t.response),uploadFiles(googleDrivefile,n.SourceExt,n.DestExt,"googledrive"),$("#conversion-modal").modal("hide")));clickSource=="modal"&&(googleDrivefile.gFileByteBase64String=base64ArrayBuffer(t.response),n=validateFilesBeforeUpload("googledrive",googleDrivefile),n.IsValidFile?(uploadFiles(googleDrivefile,n.SourceExt,n.DestExt,"googledrive"),$("#conversion-modal").modal("hide")):($("#conversion-modal").modal("show"),validateFiles(i,n.SourceExt,f,n.DestExt,r)))},t.send()):clickSource=="page"?($("#errorLandingDragImage").text(GoogleDriveErrorText),$("#errorLandingDragImage").removeClass("hidden")):($("#conversion-modal").modal("show"),$(".modal-footer #errorUploadLabel").text(GoogleDriveErrorText),$(".modal-footer").removeClass("hidden"))}}function pickerSetDriveMergeCallback(n){if(n.action==google.picker.Action.PICKED){var i=n.docs.length,t=[];i<6?$.each(n.docs,function(r,u){$("#progress-modal").modal("show");var e=gapi.auth.getToken().access_token,f=new XMLHttpRequest;f.open("GET","https://www.googleapis.com/drive/v3/files/"+n.docs[r].id+"?alt=media",!0);f.setRequestHeader("Authorization","Bearer "+e);f.responseType="arraybuffer";f.onload=function(){var h=u.id,n=u.name,r=changeToValidFileName(n),c=ChangeCommonlyUsedExt(r.split(".").pop().toLowerCase()),e=u.sizeBytes,o=base64ArrayBuffer(f.response),s=new googleDriveObj(e,n,o,r);t.push(s);e<4194304==!0?t.length==i&&uploadFilesForMerge(t,"googledrive"):($("#progress-modal").modal("hide"),$("#file-merge-modal").modal("show"),$(".modal-footer #mergeErrorLabel").text("Maximum size of File Exceeded.Should be less than 4MB."),$(".modal-footer #mergeErrorLabel").removeClass("hidden"))};f.send()}):($("#progress-modal").modal("hide"),$("#file-merge-modal").modal("show"),$(".modal-footer #mergeErrorLabel").text("Maximum 5 files can be uploaded"),$(".modal-footer #mergeErrorLabel").removeClass("hidden"))}}function googleDriveObj(n,t,i,r){this.gFileSize=n;this.gFileName=t;this.gFileByteBase64String=i;this.gValidFileName=r}function base64ArrayBuffer(n){for(var o="",i="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",r=new Uint8Array(n),l=r.byteLength,c=l%3,s=l-c,f,e,h,a,t,u=0;u<s;u=u+3)t=r[u]<<16|r[u+1]<<8|r[u+2],f=(t&16515072)>>18,e=(t&258048)>>12,h=(t&4032)>>6,a=t&63,o+=i[f]+i[e]+i[h]+i[a];return c==1?(t=r[s],f=(t&252)>>2,e=(t&3)<<4,o+=i[f]+i[e]+"=="):c==2&&(t=r[s]<<8|r[s+1],f=(t&64512)>>10,e=(t&1008)>>4,h=(t&15)<<2,o+=i[f]+i[e]+i[h]+"="),o}function getContentType(n){var t="";switch(n){case"doc":t="application/vnd.ms-word";break;case"docx":t="application/vnd.ms-word";break;case"xls":t="application/vnd.ms-excel";break;case"xlsx":t="application/vnd.ms-excel";break;case"jpg":t="image/jpg";break;case"jpeg":t="image/jpeg";break;case"png":t="image/png";break;case"gif":t="image/gif";break;case"pdf":t="application/pdf";break;case"tiff":t="image/tiff";break;case"tif":t="image/tif";break;case"zip":t="application/zip"}return t}var language="",imageDropZone,genericDropZone,mergedPdfDropZone,googleUploadBtn,fileProp;(window.location.pathname.toLowerCase()+"/").indexOf("/es/")>-1?language="lang=es&":(window.location.pathname.toLowerCase()+"/").indexOf("/it/")>-1?language="lang=it&":(window.location.pathname.toLowerCase()+"/").indexOf("/fr/")>-1?language="lang=fr&":(window.location.pathname.toLowerCase()+"/").indexOf("/pt/")>-1?language="lang=pt&":(window.location.pathname.toLowerCase()+"/").indexOf("/ar/")>-1&&(language="lang=ar&");(window.location.pathname.toLowerCase()+"/").indexOf("/de/")>-1&&(language="lang=de&");(window.location.pathname.toLowerCase()+"/").indexOf("/nl/")>-1&&(language="lang=nl&");(window.location.pathname.toLowerCase()+"/").indexOf("/ja/")>-1&&(language="lang=ja&");(window.location.pathname.toLowerCase()+"/").indexOf("/zh/")>-1&&(language="lang=zh&");(window.location.pathname.toLowerCase()+"/").indexOf("/hi/")>-1&&(language="lang=hi&");(window.location.pathname.toLowerCase()+"/").indexOf("/vi/")>-1&&(language="lang=vi&");(window.location.pathname.toLowerCase()+"/").indexOf("/ru/")>-1&&(language="lang=ru&");(window.location.pathname.toLowerCase()+"/").indexOf("/pl/")>-1&&(language="lang=pl&");(window.location.pathname.toLowerCase()+"/").indexOf("/ph/")>-1&&(language="lang=ph&");(window.location.pathname.toLowerCase()+"/").indexOf("/tr/")>-1&&(language="lang=tr&");var dropZoneUri="/account/upload-document.ashx?"+language,dropZoneQS="",dropZoneExist=!1;if(typeof Dropzone=="undefined"==!1&&(Dropzone.autoDiscover=!1,dropZoneExist=!0),$("#imageDropZone").length>0&&dropZoneExist&&(imageDropZone=new Dropzone("#imageDropZone",{url:dropZoneUri,maxFiles:1,clickable:!0,init:function(){},addedfile:function(n){var i=changeToValidFileName(n.name),r=changeToValidFileName(i).split(".").pop().toLowerCase(),u,t,f;if(r=ChangeCommonlyUsedExt(r),u=validateFilesImageSelect(n,$("#imageDropZone").attr("data-filesource"),r,$("#imageDropZone").attr("data-filedest"),n.size),u.IsValidFile)$("#progress-modal").modal("show"),$("#conversion-modal").modal("hide"),t=generateUinqueIDentifier().toLowerCase(),t=t.split("-").join(""),t=i.replace(/[^A-Za-z0-9._-]/gi,"").replace(".","_"+t+"."),f=getUserGuid(),dropZoneQS="ofn="+encodeURI(i)+"&unqn="+t+"&foln="+f+"&frm="+$("#imageDropZone").attr("data-filesource")+"&to="+ChangeCommonlyUsedExt($("#imageDropZone").attr("data-filedest"))+"&fskb=100",dropZoneUri="/account/upload-document.ashx?"+language+dropZoneQS,this.options.url=dropZoneUri;else{resetAllInputControl();throw new Error("This is not an error. This is just to abort javascript");}},success:function(n,t){var r;if(t=="Error: Password protected PDF")$("#progress-modal").modal("hide"),$("#errorLandingDragImage").text(ErrorPasswordProtectedText),$("#errorLandingDragImage").removeClass("hidden");else if(t!="null"){r=changeToValidFileName(n.name);$("#progress-modal").modal("hide");var i=$.parseJSON(t),e=getUserGuid(),u="ofn="+encodeURI(r)+"&unqn="+i.PDFRender+"&frm="+$("#imageDropZone").attr("data-filesource")+"&to="+ChangeCommonlyUsedExt($("#imageDropZone").attr("data-filedest"))+"&fskb="+i.SizeInKB+"&npdf="+i.UniqueName,f=document.getElementById("hdnEditorPageName").value;return redirectOrUpdate(i,$("#CultureInfo").val()+"/userdocument/"+f+"?"+u,""),!1}},complete:function(){this.removeAllFiles(!0)},error:function(n){n.accepted||this.removeFile(n)}})),$("#genericDropZone").length>0&&dropZoneExist&&(genericDropZone=new Dropzone("#genericDropZone",{url:dropZoneUri,maxFiles:1,clickable:!0,init:function(){},addedfile:function(n){var i=changeToValidFileName(n.name),r=i.split(".").pop().toLowerCase(),u,t,f;if(r=ChangeCommonlyUsedExt(r),u=validateFiles(i,GetSourceExt(),r,GetDestExt(),n.size),u.IsValidFile)$("#progress-modal").modal("show"),$("#conversion-modal").modal("hide"),t=generateUinqueIDentifier().toLowerCase(),t=t.split("-").join(""),t=i.replace(/[^A-Za-z0-9._-]/gi,"").replace(".","_"+t+"."),f=getUserGuid(),dropZoneQS="ofn="+encodeURI(i)+"&unqn="+t+"&foln="+f+"&frm="+GetSourceExt()+"&to="+GetDestExt()+"&fskb=100",dropZoneUri="/account/upload-document.ashx?"+language+dropZoneQS,this.options.url=dropZoneUri;else{resetAllInputControl();throw new Error("This is not an error. This is just to abort javascript");}},success:function(n,t){var r;if(t=="Error: Password protected PDF")$("#progress-modal").modal("hide"),$("#conversion-modal").modal("show"),$(".modal-footer").removeClass("hidden"),$(".modal-footer #errorUploadLabel").text(ErrorPasswordProtectedText);else{if(t!="null"){r=changeToValidFileName(n.name);$("#progress-modal").modal("hide");var i=$.parseJSON(t),e=getUserGuid(),u="ofn="+encodeURI(r)+"&unqn="+i.PDFRender+"&frm="+GetSourceExt()+"&to="+GetDestExt()+"&fskb="+i.SizeInKB+"&npdf="+i.UniqueName,f=document.getElementById("hdnEditorPageName").value;return redirectOrUpdate(i,$("#CultureInfo").val()+"/userdocument/"+f+"?"+u,GetDestExt()),!1}this.removeFile(n)}},complete:function(){this.removeAllFiles(!0)},error:function(){}})),$("#mergePdfDiv").length>0&&dropZoneExist&&($("#mergePdfDiv").sortable({items:".dz-preview",cursor:"move",opacity:.5,connectWith:".dropzone",distance:20,tolerance:"pointer"}),mergedPdfDropZone=new Dropzone("#mergePdfDiv",{createImageThumbnails:!0,acceptedFiles:" .pdf",paramName:"file",addRemoveLinks:!0,sortable:!0,maxFiles:5,maxFilesize:20,autoProcessQueue:!1,autoQueue:!1,url:"/",init:function(){this.on("addedfile",function(n){return($(".modal-footer #mergeErrorLabel").text(""),$(".modal-footer #mergeErrorLabel").addClass("hidden"),n.size/1e3>2e4)?($(".modal-footer #mergeErrorLabel").text(ErrorMaximumSize),$(".modal-footer #mergeErrorLabel").removeClass("hidden"),this.removeFile(n),!1):(mergedPdfDropZone.files!=undefined&&mergedPdfDropZone.files.length>0&&$.each(mergedPdfDropZone.files,function(t,i){if(i.name==n.name&&t<=mergedPdfDropZone.files.length-2)return $(".modal-footer #mergeErrorLabel").text(alreadyExistsErrorText.replace("###",n.name)),$(".modal-footer #mergeErrorLabel").removeClass("hidden"),mergedPdfDropZone.removeFile(n),!1}),n.type.match("pdf.*")?void 0:($(".modal-footer #mergeErrorLabel").text(wrongFormatErrorText.replace("###","PDFs")),$(".modal-footer #mergeErrorLabel").removeClass("hidden"),this.removeFile(n),!1))})},maxfilesexceeded:function(){$(".modal-footer #mergeErrorLabel").text(MergeMaximumFiles);$(".modal-footer #mergeErrorLabel").removeClass("hidden")},success:function(){},queuecomplete:function(){},error:function(n){n.accepted||this.removeFile(n)},complete:function(){}})),$(document).ready(function(){setTimeout(function(){readCookie("bbblg")!=null&&readCookie("bbblg")=="showlogo"?$("#BBBLogo").load("/usercontrols/BBB-logo.html"):$("#BBBLogo").css({display:"none"})},2e3);$(".modal").on("show.bs.modal",function(n){var i=$(n.relatedTarget),t=i.data("modal-title"),u=i.data("modal-body"),r=$(this);if(r.find(".modal-title").text(t),r.find(".modal-body .modal-body-text").text(u),$(".modal-footer #mergeErrorLabel").addClass("hidden"),$("#mergeUploadButton").removeClass("hidden"),$("#progress-modal-label").html(ProcessingDocumentText),$("#progress-modal .modal-body-text").html(PleasewaitEngineWorkText),$("#conversion-modal").find(".modal-footer").addClass("hidden"),$("#progress-modal .progress-loading").removeClass("hidden"),$("#progress-modal .progress-done").addClass("hidden"),typeof t=="undefined")return!0;try{t.replace(/ /g,"").toUpperCase().startsWith("PDF")&&t.replace(/ /g,"").toUpperCase().endsWith("DOC")?($(".attributionSolid").removeClass("hidden"),$(".attributionAspose").addClass("hidden")):($(".attributionSolid").addClass("hidden"),$(".attributionAspose").removeClass("hidden"))}catch(f){t.replace(/ /g,"").toUpperCase().substring(0,3)=="PDF"&&t.replace(/ /g,"").toUpperCase().substring(5,8)=="DOC"?($(".attributionSolid").removeClass("hidden"),$(".attributionAspose").addClass("hidden")):($(".attributionSolid").addClass("hidden"),$(".attributionAspose").removeClass("hidden"))}});$(".modal").on("hidden.bs.modal",function(){mergedPdfDropZone.removeAllFiles();genericDropZone.removeAllFiles();!imageDropZone||imageDropZone.removeAllFiles();resetAllInputControl();$(".attributionSolid").addClass("hidden");$(".attributionAspose").addClass("hidden")});$("#fileUploadFromModalControl").on("change",function(){var n=validateFilesBeforeUpload(!1,null),t;n.IsValidFile&&(t=$("#fileUploadFromModalControl"),uploadFiles(t[0].files,n.SourceExt,n.DestExt,"none"),$("#conversion-modal").modal("hide"))});$("#htmlFileUploadFromModalControl").on("change",function(){var t=$("#htmlFileUploadFromModalControl"),i=t[0].files[0].name,r,n;i=changeToValidFileName(i);r=t[0].files[0].size;n=!0;r/1e3>2e4?(n=!1,$(".modal-footer #errorUploadLabel").text("Whoa Nelly! This file exceeded our limit of 20MB."),$(".modal-footer").removeClass("hidden")):(n=ValidateHTMLFile(i),n||($(".modal-footer #htmlErrorUploadLabel").text(wrongFormatErrorText.replace("###","HTML")),$(".modal-footer").removeClass("hidden")));n&&(uploadFiles(t[0].files,"html","pdf","none"),$("#HTML-conversion-modal").modal("hide"))});$("#draguploadpdf").on("change",function(){var i=$("#draguploadpdf"),n=i[0].files;if(typeof n=="undefined")validateFilesPDFSelect(n,"pdf",t);else{var r=changeToValidFileName(n[0].name),t=r.split(".").pop().toLowerCase(),u=validateFilesImageSelect(n[0],$("#imageDropZone").attr("data-filesource"),ChangeCommonlyUsedExt(t),$("#imageDropZone").attr("data-filedest"),n[0].size);u.IsValidFile&&($("#imageDropZone").attr("data-filesource").toLowerCase()=="image"?uploadFiles(n,t,"text","none"):uploadFiles(n,$("#imageDropZone").attr("data-filesource"),$("#imageDropZone").attr("data-filedest"),"none"),$("#draguploadpdf")[0].value="")}});$("#drag-upload-pdf").on("change",function(){var i=$("#drag-upload-pdf"),n=i[0].files;if(typeof n=="undefined")validateFilesPDFSelect(n,"pdf",t);else{var r=changeToValidFileName(n[0].name),t=r.split(".").pop().toLowerCase(),u=validateFilesImageSelect(n[0],$("#imageDropZone").attr("data-filesource"),ChangeCommonlyUsedExt(t),$("#imageDropZone").attr("data-filedest"),n[0].size);u.IsValidFile&&uploadFiles(n,$("#imageDropZone").attr("data-filesource"),$("#imageDropZone").attr("data-filedest"),"none")}});$("#mergeUploadButton").on("click",function(){mergedPdfDropZone.files.length<=1?($("#file-merge-modal").modal("show"),$(".modal-footer #mergeErrorLabel").html(MergeMinimumFiles),$(".modal-footer #mergeErrorLabel").removeClass("hidden")):mergedPdfDropZone.files.length>1&&($("#file-merge-modal").modal("hide"),$("#progress-modal").modal("show"),ReArrangeMergeFiles(),uploadFilesForMerge(mergedPdfDropZone.files,"none"))});$("#mergeEditorUploadButton").on("click",function(){mergedPdfDropZone.files.length<1?($("#file-merge-modal").modal("show"),$(".modal-footer #mergeErrorLabel").html(UploadJoinConvert),$(".modal-footer #mergeErrorLabel").removeClass("hidden")):mergedPdfDropZone.files.length>=1&&($("#file-merge-modal").modal("hide"),$("#progress-modal").modal("show"),ReArrangeMergeFiles(),uploadFilesForEditorMergeNew(mergedPdfDropZone.files,"none"))});$("#HTML-conversion-modal").on("hidden.bs.modal",function(){$(".modal-footer #htmlErrorUploadLabel").text("");$(".modal-footer").addClass("hidden")})}),$("#txtHtmlURL").keypress(function(n){if(n.which==13)return!1}),$(document).ready(function(){var n=168;$("#document-area").css("height",window.innerHeight-n);$(".document-wrapper").css("height",window.innerHeight-n);$(window).resize(function(){$("#document-area").css("height",window.innerHeight-n);$(".document-wrapper").css("height",window.innerHeight-n)})}),$(document).ready(function(){var n=GetQueryStringParams("utm_source"),t=GetQueryStringParams("utm_medium"),i=GetQueryStringParams("utm_campaign"),r=GetQueryStringParams("click_id"),u=GetQueryStringParams("s2"),f=GetQueryStringParams("s1"),e=GetQueryStringParams("s1"),o=GetQueryStringParams("s1"),s=GetQueryStringParams("s2");if(typeof n=="undefined"||typeof t=="undefined"||typeof i=="undefined")return!0;n.toLowerCase()=="clickmeter"&&t.toLowerCase()=="affiliate"&&i.toLowerCase()=="pikoya"&&readCookie("pikoya_clickid")==null&&createCookie("pikoya_clickid",r,1);n.toLowerCase()=="clickmeter"&&t.toLowerCase()=="affiliate"&&i.toLowerCase()=="maxbounty"&&readCookie("maxbounty_clickid")==null&&createCookie("maxbounty_clickid",u,1);n.toLowerCase()=="clickmeter"&&t.toLowerCase()=="affiliate"&&i.toLowerCase()=="rainy-day-marketing"&&readCookie("rainyday_clickid")==null&&createCookie("rainyday_clickid",f,1);n.toLowerCase()=="clickmeter"&&t.toLowerCase()=="affiliate"&&i.toLowerCase()=="namoffers"&&readCookie("namoffers_click_id")==null&&createCookie("namoffers_click_id",e,1);n.toLowerCase()=="propel"&&t.toLowerCase()=="affiliate"&&i.toLowerCase()=="propel"&&readCookie("propel_click_id")==null&&createCookie("propel_click_id",o,1);n.toLowerCase()=="globalwidemedia"&&t.toLowerCase()=="affiliate"&&i.toLowerCase()=="gwm"&&readCookie("gwm_click_id")==null&&createCookie("gwm_click_id",s,1)}),$(document).ready(function(){var n=GetQueryStringParams("AFFID");if(typeof n=="undefined")return!0;n.toLowerCase()=="bdub"&&readCookie("edatabase_click_id")==null&&createCookie("edatabase_click_id",n,1)}),document.getElementById("dropBoxFromPage")!=null&&(document.getElementById("dropBoxFromPage").onclick=function(){Dropbox.choose({success:function(n){var i=changeToValidFileName(n[0].name),r=ChangeCommonlyUsedExt(i.split(".").pop().toLowerCase()),t=validateFilesImageSelect(n[0],$("#imageDropZone").attr("data-filesource"),r,$("#imageDropZone").attr("data-filedest"),n[0].bytes);t.IsValidFile&&(uploadFiles(n,t.SourceExt,t.DestExt,"dropbox"),$("#conversion-modal").modal("hide"))},cancel:function(){},linkType:"direct",multiselect:!1})}),document.getElementById("dropboxFromModal")!=null&&(document.getElementById("dropboxFromModal").onclick=function(){Dropbox.choose({success:function(n){var i=changeToValidFileName(n[0].name),r=ChangeCommonlyUsedExt(i.split(".").pop().toLowerCase()),t=validateFilesBeforeUpload("dropbox",n);t.IsValidFile?(uploadFiles(n,t.SourceExt,t.DestExt,"dropbox"),$("#conversion-modal").modal("hide")):($("#conversion-modal").modal("show"),validateFiles(n[0].name,t.SourceExt,r,t.DestExt,n[0].bytes))},cancel:function(){},linkType:"direct",multiselect:!1})}),document.getElementById("dropboxFromMergeModal")!=null&&(document.getElementById("dropboxFromMergeModal").onclick=function(){Dropbox.choose({success:function(n){uploadFilesForMerge(n,"dropbox");$("#conversion-modal").modal("hide")},cancel:function(){},linkType:"direct",multiselect:!0,extensions:[".pdf"]})}),$(".uploadToDropBoxBtn")!=null)$(document).on("click",".uploadToDropBoxBtn",function(){$("#rrwerwceSta").val()=="10010001"?($("#progress-modal").modal("show"),window.location.href=document.getElementById("CultureInfo").value+"/billing/"+document.getElementById("paymentPage").value):Dropbox.save({files:[{url:$(this).attr("data-url")+sharedAccessSignature,filename:$(this).attr("data-url").split("/").pop().split("?")[0]}],success:function(){CloseSucess();setTimeout(function(){return $("#progress-modal").modal("hide"),!1},1e3)},progress:function(){$("#progress-modal").modal("show")},cancel:function(){},error:function(){}})});if(document.getElementById("oneDriveFromPage")!=null&&(document.getElementById("oneDriveFromPage").onclick=function(){var n={clientId:"84c28341-5861-499b-a984-12f46424fbf5",action:"download",multiSelect:!1,advanced:{},success:function(n){var i=changeToValidFileName(n.value[0].name),r=ChangeCommonlyUsedExt(i.split(".").pop().toLowerCase()),t=validateFilesImageSelect(n.value,$("#imageDropZone").attr("data-filesource"),r,$("#imageDropZone").attr("data-filedest"),n.value[0].size);t.IsValidFile&&(uploadFiles(n.value,t.SourceExt,t.DestExt,"onedrive"),$("#conversion-modal").modal("hide"))},cancel:function(){},error:function(){alert("error")}};OneDrive.open(n)}),document.getElementById("onedriveFromModal")!=null&&(document.getElementById("onedriveFromModal").onclick=function(){var n={clientId:"84c28341-5861-499b-a984-12f46424fbf5",action:"download",multiSelect:!1,advanced:{},success:function(n){var i=changeToValidFileName(n.value[0].name),r=ChangeCommonlyUsedExt(i.split(".").pop().toLowerCase()),t=validateFilesBeforeUpload("onedrive",n.value);t.IsValidFile?(uploadFiles(n.value,t.SourceExt,t.DestExt,"onedrive"),$("#conversion-modal").modal("hide")):($("#conversion-modal").modal("show"),validateFiles(n.value[0].name,t.SourceExt,r,t.DestExt,n.value[0].size))},cancel:function(){},error:function(){alert("error")}};OneDrive.open(n)}),document.getElementById("onedriveFromMergeModal")!=null&&(document.getElementById("onedriveFromMergeModal").onclick=function(){var n={clientId:"84c28341-5861-499b-a984-12f46424fbf5",action:"download",multiSelect:!0,advanced:{filter:".PDF,.pdf"},success:function(n){uploadFilesForMerge(n.value,"onedrive");$("#conversion-modal").modal("hide")},cancel:function(){},error:function(){alert("error")}};OneDrive.open(n)}),$(".uploadToOneDriveBtn")!=null)$(document).on("click",".uploadToOneDriveBtn",function(){if($("#rrwerwceSta").val()=="10010001")$("#progress-modal").modal("show"),window.location.href=document.getElementById("CultureInfo").value+"/billing/"+document.getElementById("paymentPage").value;else{var n={clientId:"84c28341-5861-499b-a984-12f46424fbf5",action:"save",sourceInputElementId:"",sourceUri:$(this).attr("data-url")+sharedAccessSignature,fileName:$(this).attr("data-url").split("/").pop().split("?")[0],openInNewWindow:!0,advanced:{},success:function(){$("#progress-modal").modal("show");CloseSucess();setTimeout(function(){return $("#progress-modal").modal("hide"),!1},1e3)},progress:function(){},cancel:function(){},error:function(){}};OneDrive.save(n)}});var clickSource="",developerKey="AIzaSyAHpRFb0hM5vVgXLOAuI6tXgqrmpJGA7yM",clientId="832193499453-f0sm7bft1ls6j8ctd5m6uh9u7qkohilf.apps.googleusercontent.com",appId="832193499453",scope=["https://www.googleapis.com/auth/drive"],pickerApiLoaded=!1,oauthToken;if(document.getElementById("googeleDriveFromPage")!=null&&$("#googeleDriveFromPage").click(function(){clickSource="page";onApiLoad()}),document.getElementById("googledriveFromModal")!=null&&$("#googledriveFromModal").click(function(){clickSource="modal";onApiLoad()}),document.getElementById("googledriveFromMergeModal")!=null&&$("#googledriveFromMergeModal").click(function(){clickSource="mergemodal";onApiLoad()}),$(".uploadToGoogleBtn")!=null)$(document).on("click",".uploadToGoogleBtn",function(){$("#rrwerwceSta").val()=="10010001"?($("#progress-modal").modal("show"),window.location.href=document.getElementById("CultureInfo").value+"/billing/"+document.getElementById("paymentPage").value):(googleUploadBtn=$(this),onSaveApiLoad())})