document.addEventListener("DOMContentLoaded",function(){const a=document.getElementById("file"),e=document.getElementById("job-form"),t=document.getElementById("file-form"),r=document.getElementById("upload-file-id"),i=document.getElementById("upload-file-error"),o=document.getElementById("file-form-submit"),d=document.getElementById("main-form-submit"),n=document.getElementById("clear-resume"),l=document.getElementById("FileUploadWarning"),s=document.getElementById("upload-url").value,c=document.getElementById("file-selector-error"),u=document.getElementById("OptInOutProxy"),f=document.getElementById("OptInOut");function v(e){c.textContent=e}function m(){g(""),v("")}function g(e){e?(l.innerHTML=e,l.classList.remove("field-validation-valid"),l.classList.remove("hidden"),l.classList.add("field-validation-error")):(l.innerHTML="",l.classList.add("field-validation-valid"),l.classList.remove("field-validation-error"))}function p(e){try{e.value=null}catch(e){}e.value&&(e.parentNode.replaceChild(e.cloneNode(!0),e),r.value="0")}u?.addEventListener("click",e=>(u.checked?f.value="true":f.value="false",!0)),n.addEventListener("click",e=>{p(a),m(),v("File has been removed.")}),a.addEventListener("cancel",e=>{m()}),a.addEventListener("change",e=>{return m(),!(r.value=0)}),a.addEventListener("change",e=>{var t,n=0;try{t=e.target.files[0].name,n=e.target.files[0].size}catch{return void v("No file selected.")}return"pdf"!==t.split(".").pop()?(v("Wrong file type. Please select a PDF file."),p(a),g("Wrong file type. Please select a PDF file."),!1):1048576<n?(v("File is too big. Please select a file that is no larger than 1MB."),p(a),g("File is too big. Please select a file that is no larger than 1MB."),!1):(v("File selected successfully."),!(r.value=0))}),o.addEventListener("click",e=>{if(e.preventDefault(),o.innerText="Sending...",e=r.value,i.value="",function(e){var t=a.value,t=!(!t||0===t.length);return function(e){return!e||0===e.length||"0"==e}(e)&&t}(e)){var e=new FormData,t=a.files[0],n=(t&&e.append("file",t),new XMLHttpRequest);n.responseType="json";const l=n.status;n.open("POST",s,!0),n.onerror=()=>{console.log("Error occurred: ",n.statusText),401===l?(r.value=-1,g("You are not authorized to access this file resource.")):500===l?(r.value=-1,g("An unexpected error occurred while uploading the file to the server. Please try again later.")):(r.value=-1,g("An unknown file upload error occurred."))},n.onload=()=>{var e=n.response,t=(e.fileStatus,"success"),e=(e.success?"Uploaded"==e.fileStatus?r.value=e.fileId:t="There was an error uploading the file. Please check and try again.":(p(a),t="Invalid"==e.fileStatus?e.errors:"There was an error uploading the file. Please check and try again."),t);return i.value="success"==e?"":e,d.click(),"success"!=e&&(v(e),g(e),r.value=0),i.Value="",!1},n.send(e)}else d.click();return!(o.innerText="Send")}),window.addEventListener("pageshow",()=>{e.reset(),t.reset()})});
//# sourceMappingURL=file-selector-0face285a8.js.map
