!function(){"use strict";const t=function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return window.FormieTranslations&&(t=window.FormieTranslations[t]||t),t.replace(/{([a-zA-Z0-9]+)}/g,((t,e)=>i[e]?i[e]:t))};window.FormieFileUpload=class{constructor(){let t=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{};this.$form=t.$form,this.form=this.$form.form,this.$field=t.$field,this.form.registerEvent("registerFormieValidation",this.registerValidation.bind(this)),this.form.addEventListener(this.$form,function(t){let i=arguments.length>1&&void 0!==arguments[1]?arguments[1]:null;return i||(i=Math.random().toString(36).substr(2,5)),`${t}.${i}`}("onAfterFormieSubmit"),this.onAfterSubmit.bind(this))}registerValidation(i){i.validator.addValidator("fileSizeMinLimit",(t=>{let{input:i}=t;const e=i.getAttribute("type"),r=i.getAttribute("data-size-min-limit"),l=1e3*parseFloat(r)*1e3;if("file"!==e||!l)return!0;for(const t of i.files)if(t.size<l)return!1;return!0}),(i=>{let{input:e}=i;return t("File must be larger than {filesize} MB.",{filesize:e.getAttribute("data-size-min-limit")})})),i.validator.addValidator("fileSizeMaxLimit",(t=>{let{input:i}=t;const e=i.getAttribute("type"),r=i.getAttribute("data-size-max-limit"),l=1e3*parseFloat(r)*1e3;if("file"!==e||!l)return!0;for(const t of i.files)if(t.size>l)return!1;return!0}),(i=>{let{input:e}=i;return t("File must be smaller than {filesize} MB.",{filesize:e.getAttribute("data-size-max-limit")})})),i.validator.addValidator("fileLimit",(t=>{let{input:i}=t;const e=i.getAttribute("type"),r=parseInt(i.getAttribute("data-file-limit"));return"file"!==e||!r||!(i.files.length>r)}),(i=>{let{input:e}=i;return t("Choose up to {files} files.",{files:e.getAttribute("data-file-limit")})}))}onAfterSubmit(){const t=this.$field.querySelector('[type="file"]');t&&!t.getAttribute("name").includes("[rows]")&&(t.value=null)}}}();