!function(e){function t(n){if(i[n])return i[n].exports;var o=i[n]={exports:{},id:n,loaded:!1};return e[n].call(o.exports,o,o.exports,t),o.loaded=!0,o.exports}var i={};return t.m=e,t.c=i,t.p="",t(0)}([function(e,t,i){(function(e){"use strict";function n(e){return e&&e.__esModule?e:{default:e}}function o(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function r(e){return e=e.replace(/@3x|@2x|@1x/,""),e=e.replace(/\(/g,"%28"),e=e.replace(/\)/g,"%29"),e.match(/\.(jpe?g|png|gif|svg)$/i)?"![]("+e+")":"["+decodeURI(e)+"]("+e+")"}Object.defineProperty(t,"__esModule",{value:!0}),t.Instances=void 0;var s=function(){function e(e,t){for(var i=0;i\n
\n\n
\n
\n
\n
\n
\n
\n\n\n\n
\n\n \n \n Check\n Created with Sketch.\n \n \n \n \n \n \n
\n
\n\n \n \n error\n Created with Sketch.\n \n \n \n \n \n \n \n
\n '.trim()},f=function(){function t(){var e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:{},i=e.container,n=void 0===i?".dropzone.files-upload":i,r=e.options,s=void 0===r?{}:r;o(this,t),this.container=(0,a.default)(n),this.container.length&&(this.urls={},this.options=Object.assign({},h,m,{klass:this,url:this.container.data("file-url-add")||d.config.current_url,acceptedFiles:this.container.data("media-types"),init:this.initDropzone},this.container.data("dropzone-options"),s),this.dropzone=new p.default(n,this.options),this.dropzone.on("complete",this.onDropzoneComplete.bind(this)),this.dropzone.on("success",this.onDropzoneSuccess.bind(this)),this.dropzone.on("removedfile",this.onDropzoneRemovedFile.bind(this)),this.dropzone.on("sending",this.onDropzoneSending.bind(this)),this.dropzone.on("error",this.onDropzoneError.bind(this)))}return s(t,[{key:"initDropzone",value:function(){var e=this,t=this.options.klass.container.find("[data-file]"),i=this;t.length&&t.each(function(t,n){n=(0,a.default)(n);var o=n.data("file"),r={name:o.name,size:o.size,type:o.type,status:p.default.ADDED,accepted:!0,url:e.options.url,removeUrl:o.remove};i.files.push(r),i.options.addedfile.call(i,r),r.type.match(/^image\//)&&i.options.thumbnail.call(i,r,o.path),n.remove()})}},{key:"onDropzoneSending",value:function(e,t,i){i.append("__form-name__",this.container.closest("form").find('[name="__form-name__"]').val()),i.append("__form-file-uploader__",1),i.append("name",this.options.dotNotation),i.append("form-nonce",d.config.form_nonce),i.append("task","filesupload")}},{key:"onDropzoneSuccess",value:function(t,i,n){if(this.options.reloadPage&&e.location.reload(),i.session){t.sessionParams=i.session,t.removeUrl=this.options.url;var o=this.container.find('[name][type="hidden"]'),r=o.val();o.val(r+" ")}return this.handleError({file:t,data:i,mode:"removeFile",msg:"

"+d.translations.PLUGIN_FORM.FILE_ERROR_UPLOAD+" "+t.name+"

\n
"+i.message+"
"})}},{key:"onDropzoneComplete",value:function(t){if(!t.accepted&&!t.rejected){var i={status:"error",message:d.translations.PLUGIN_FORM.FILE_UNSUPPORTED+": "+t.name.match(/\..+/).join("")};return this.handleError({file:t,data:i,mode:"removeFile",msg:"

"+d.translations.PLUGIN_FORM.FILE_ERROR_ADD+" "+t.name+"

\n
"+i.message+"
"})}this.options.reloadPage&&e.location.reload()}},{key:"onDropzoneRemovedFile",value:function(t){var i=this;if(t.accepted&&!t.rejected){var n=t.removeUrl||this.urls.delete,o=(n||"").match(/path:(.*)\//),r={filename:t.name};t.sessionParams&&(r.task="filessessionremove",r.session=t.sessionParams),c(n,{method:"post",body:r},function(){if(o){o=e.atob(o[1]);var t=i.container.find('[name][type="hidden"]'),n=JSON.parse(t.val()||"{}");delete n[o],t.val(JSON.stringify(n))}})}}},{key:"onDropzoneError",value:function(e,t,i){var n=i&&t.error?t.error.message:t;return(0,a.default)(e.previewElement).find("[data-dz-errormessage]").html(n),this.handleError({file:e,data:{status:"error"},msg:"
"+n+"
"})}},{key:"handleError",value:function(e){return!0}}]),t}();t.default=f;var g=[],v=(0,a.default)(),F=function(e,t){var i=(0,a.default)(t).find(".dropzone.files-upload");i.length&&i.each(function(e,t){t=(0,a.default)(t),~v.index(t)||y(t)})},y=function(e){e=(0,a.default)(e);var t=e.find('input[type="file"]'),i=e.data("grav-file-settings")||{};i.accept&&~i.accept.indexOf("*")&&(i.accept=[""]);var n={url:e.data("file-url-add")||(e.closest("form").attr("action")||d.config.current_url)+".json",paramName:i.paramName||"file",dotNotation:i.name||"file",acceptedFiles:i.accept?i.accept.join(","):t.attr("accept")||e.data("media-types"),maxFilesize:i.filesize||256,maxFiles:i.limit||null};v=v.add(e),e=e[0],g.push(new f({container:e,options:n}))};t.Instances=function(){return(0,a.default)(".dropzone.files-upload").each(function(e,t){return y(t)}),(0,a.default)("body").on("mutation._grav",F),g}()}).call(t,function(){return this}())},function(e,t){e.exports=jQuery},function(e,t,i){(function(e){(function(){var t,i,n,o,r,s,l,a,u=[].slice,p={}.hasOwnProperty,d=function(e,t){function i(){this.constructor=e}for(var n in t)p.call(t,n)&&(e[n]=t[n]);return i.prototype=t.prototype,e.prototype=new i,e.__super__=t.prototype,e};l=function(){},i=function(){function e(){}return e.prototype.addEventListener=e.prototype.on,e.prototype.on=function(e,t){return this._callbacks=this._callbacks||{},this._callbacks[e]||(this._callbacks[e]=[]),this._callbacks[e].push(t),this},e.prototype.emit=function(){var e,t,i,n,o,r;if(n=arguments[0],e=2<=arguments.length?u.call(arguments,1):[],this._callbacks=this._callbacks||{},i=this._callbacks[n])for(o=0,r=i.length;o'),this.element.appendChild(i)),n=i.getElementsByTagName("span")[0],n&&(null!=n.textContent?n.textContent=this.options.dictFallbackMessage:null!=n.innerText&&(n.innerText=this.options.dictFallbackMessage)),this.element.appendChild(this.getFallbackForm())},resize:function(e){var t,i,n;return t={srcX:0,srcY:0,srcWidth:e.width,srcHeight:e.height},i=e.width/e.height,t.optWidth=this.options.thumbnailWidth,t.optHeight=this.options.thumbnailHeight,null==t.optWidth&&null==t.optHeight?(t.optWidth=t.srcWidth,t.optHeight=t.srcHeight):null==t.optWidth?t.optWidth=i*t.optHeight:null==t.optHeight&&(t.optHeight=1/i*t.optWidth),n=t.optWidth/t.optHeight,e.heightn?(t.srcHeight=e.height,t.srcWidth=t.srcHeight*n):(t.srcWidth=e.width,t.srcHeight=t.srcWidth/n),t.srcX=(e.width-t.srcWidth)/2,t.srcY=(e.height-t.srcHeight)/2,t},drop:function(e){return this.element.classList.remove("dz-drag-hover")},dragstart:l,dragend:function(e){return this.element.classList.remove("dz-drag-hover")},dragenter:function(e){return this.element.classList.add("dz-drag-hover")},dragover:function(e){return this.element.classList.add("dz-drag-hover")},dragleave:function(e){return this.element.classList.remove("dz-drag-hover")},paste:l,reset:function(){return this.element.classList.remove("dz-started")},addedfile:function(e){var i,n,o,r,s,l,a,u,p,d,c,h,m;if(this.element===this.previewsContainer&&this.element.classList.add("dz-started"),this.previewsContainer){for(e.previewElement=t.createElement(this.options.previewTemplate.trim()),e.previewTemplate=e.previewElement,this.previewsContainer.appendChild(e.previewElement),d=e.previewElement.querySelectorAll("[data-dz-name]"),r=0,a=d.length;r'+this.options.dictRemoveFile+""),e.previewElement.appendChild(e._removeLink)),n=function(i){return function(n){return n.preventDefault(),n.stopPropagation(),e.status===t.UPLOADING?t.confirm(i.options.dictCancelUploadConfirmation,function(){return i.removeFile(e)}):i.options.dictRemoveFileConfirmation?t.confirm(i.options.dictRemoveFileConfirmation,function(){return i.removeFile(e)}):i.removeFile(e)}}(this),h=e.previewElement.querySelectorAll("[data-dz-remove]"),m=[],l=0,p=h.length;l\n
\n
\n
\n
\n
\n
\n
\n
\n \n Check\n \n \n \n \n \n
\n
\n \n Error\n \n \n \n \n \n \n \n
\n'},n=function(){var e,t,i,n,o,r,s;for(n=arguments[0],i=2<=arguments.length?u.call(arguments,1):[],r=0,s=i.length;r'+this.options.dictDefaultMessage+"")),this.clickableElements.length&&(n=function(e){return function(){return e.hiddenFileInput&&e.hiddenFileInput.parentNode.removeChild(e.hiddenFileInput),e.hiddenFileInput=document.createElement("input"),e.hiddenFileInput.setAttribute("type","file"),(null==e.options.maxFiles||e.options.maxFiles>1)&&e.hiddenFileInput.setAttribute("multiple","multiple"),e.hiddenFileInput.className="dz-hidden-input",null!=e.options.acceptedFiles&&e.hiddenFileInput.setAttribute("accept",e.options.acceptedFiles),null!=e.options.capture&&e.hiddenFileInput.setAttribute("capture",e.options.capture),e.hiddenFileInput.style.visibility="hidden",e.hiddenFileInput.style.position="absolute",e.hiddenFileInput.style.top="0",e.hiddenFileInput.style.left="0",e.hiddenFileInput.style.height="0",e.hiddenFileInput.style.width="0",document.querySelector(e.options.hiddenInputContainer).appendChild(e.hiddenFileInput),e.hiddenFileInput.addEventListener("change",function(){var t,i,o,r;if(i=e.hiddenFileInput.files,i.length)for(o=0,r=i.length;o',this.options.dictFallbackText&&(n+="

"+this.options.dictFallbackText+"

"),n+='',i=t.createElement(n),"FORM"!==this.element.tagName?(o=t.createElement('
'),o.appendChild(i)):(this.element.setAttribute("enctype","multipart/form-data"),this.element.setAttribute("method",this.options.method)),null!=o?o:i)},t.prototype.getExistingFallback=function(){var e,t,i,n,o,r;for(t=function(e){var t,i,n;for(i=0,n=e.length;i0){for(s=["TB","GB","MB","KB","b"],i=l=0,a=s.length;l=t){n=e/Math.pow(this.options.filesizeBase,4-i),o=r;break}n=Math.round(10*n)/10}return""+n+" "+o},t.prototype._updateMaxFilesReachedClass=function(){return null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(this.getAcceptedFiles().length===this.options.maxFiles&&this.emit("maxfilesreached",this.files),this.element.classList.add("dz-max-files-reached")):this.element.classList.remove("dz-max-files-reached")},t.prototype.drop=function(e){var t,i;e.dataTransfer&&(this.emit("drop",e),t=e.dataTransfer.files,this.emit("addedfiles",t),t.length&&(i=e.dataTransfer.items,i&&i.length&&null!=i[0].webkitGetAsEntry?this._addFilesFromItems(i):this.handleFiles(t)))},t.prototype.paste=function(e){var t,i;if(null!=(null!=e&&null!=(i=e.clipboardData)?i.items:void 0))return this.emit("paste",e),t=e.clipboardData.items,t.length?this._addFilesFromItems(t):void 0},t.prototype.handleFiles=function(e){var t,i,n,o;for(o=[],i=0,n=e.length;i0){for(r=0,s=i.length;r1024*this.options.maxFilesize*1024?i(this.options.dictFileTooBig.replace("{{filesize}}",Math.round(e.size/1024/10.24)/100).replace("{{maxFilesize}}",this.options.maxFilesize)):t.isValidFile(e,this.options.acceptedFiles)?null!=this.options.maxFiles&&this.getAcceptedFiles().length>=this.options.maxFiles?(i(this.options.dictMaxFilesExceeded.replace("{{maxFiles}}",this.options.maxFiles)),this.emit("maxfilesexceeded",e)):this.options.accept.call(this,e,i):i(this.options.dictInvalidFileType)},t.prototype.addFile=function(e){return e.upload={progress:0,total:e.size,bytesSent:0},this.files.push(e),e.status=t.ADDED,this.emit("addedfile",e),this._enqueueThumbnail(e),this.accept(e,function(t){return function(i){return i?(e.accepted=!1,t._errorProcessing([e],i)):(e.accepted=!0,t.options.autoQueue&&t.enqueueFile(e)),t._updateMaxFilesReachedClass()}}(this))},t.prototype.enqueueFiles=function(e){var t,i,n;for(i=0,n=e.length;i=t)&&(n=this.getQueuedFiles(),n.length>0)){if(this.options.uploadMultiple)return this.processFiles(n.slice(0,t-i));for(;e=T;p=0<=T?++O:--O)r.append(this._getParamName(p),e[p],this._renameFilename(e[p].name));return this.submitRequest(b,r,e)},t.prototype.submitRequest=function(e,t,i){return e.send(t)},t.prototype._finished=function(e,i,n){var o,r,s;for(r=0,s=e.length;rp;)t=o[4*(a-1)+3],0===t?r=a:p=a,a=r+p>>1;return u=a/s,0===u?1:u},s=function(e,t,i,n,o,s,l,a,u,p){var d;return d=r(t),e.drawImage(t,i,n,o,s,l,a,u,p/d)},o=function(e,t){var i,n,o,r,s,l,a,u,p;if(o=!1,p=!0,n=e.document,u=n.documentElement,i=n.addEventListener?"addEventListener":"attachEvent",a=n.addEventListener?"removeEventListener":"detachEvent",l=n.addEventListener?"":"on",r=function(i){if("readystatechange"!==i.type||"complete"===n.readyState)return("load"===i.type?e:n)[a](l+i.type,r,!1),!o&&(o=!0)?t.call(e,i.type||i):void 0},s=function(){var e;try{u.doScroll("left")}catch(t){return e=t,void setTimeout(s,50)}return r("poll")},"complete"!==n.readyState){if(n.createEventObject&&u.doScroll){try{p=!e.frameElement}catch(e){}p&&s()}return n[i](l+"DOMContentLoaded",r,!1),n[i](l+"readystatechange",r,!1),e[i](l+"load",r,!1)}},t._autoDiscoverFunction=function(){if(t.autoDiscover)return t.discover()},o(window,t._autoDiscoverFunction)}).call(this)}).call(t,i(3)(e))},function(e,t){e.exports=function(e){return e.webpackPolyfill||(e.deprecate=function(){},e.paths=[],e.children=[],e.webpackPolyfill=1),e}},function(e,t){e.exports=GravForm}]); //# sourceMappingURL=form.min.js.map