/** 
 * Kendo UI v2016.3.1118 (http://www.telerik.com/kendo-ui)                                                                                                                                              
 * Copyright 2016 Telerik AD. All rights reserved.                                                                                                                                                      
 *                                                                                                                                                                                                      
 * Kendo UI commercial licenses may be obtained at                                                                                                                                                      
 * http://www.telerik.com/purchase/license-agreement/kendo-ui-complete                                                                                                                                  
 * If you do not own a commercial license, this file shall be governed by the trial license terms.                                                                                                      
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       
                                                                                                                                                                                                       

*/
!function(e,define){define("kendo.upload.min",["kendo.core.min"],e)}(function(){return function(e,t){function a(t){return e.map(n(t),function(e){return e.name}).join(", ")}function n(e){var t=e[0];return t.files?o(t.files):[{name:r(t.value),extension:s(t.value),size:null}]}function o(t){return e.map(t,function(e){return i(e)})}function i(e){var t=e.name||e.fileName;return{name:C.htmlEncode(t),extension:s(t),size:"number"==typeof e.size?e.size:e.fileSize,rawFile:e}}function s(e){var t=e.match(x);return t?t[0]:""}function r(e){var t=e.lastIndexOf("\\");return t!=-1?e.substr(t+1):e}function l(t,a){var n=C.guid();return e.map(t,function(e){return e.uid=a?C.guid():n,e})}function p(e,t){var a,n=d(t.allowedExtensions),o=t.maxFileSize,i=t.minFileSize;for(a=0;a<e.length;a++)u(e[a],n),c(e[a],i,o)}function d(t){var a=e.map(t,function(e){var t="."===e.substring(0,1)?e:"."+e;return t.toLowerCase()});return a}function u(t,a){a.length>0&&a.indexOf(t.extension.toLowerCase())<0&&(t.validationErrors=t.validationErrors||[],e.inArray(L,t.validationErrors)===-1&&t.validationErrors.push(L))}function c(t,a,n){0!==a&&t.size<a&&(t.validationErrors=t.validationErrors||[],e.inArray(M,t.validationErrors)===-1&&t.validationErrors.push(M)),0!==n&&t.size>n&&(t.validationErrors=t.validationErrors||[],e.inArray(P,t.validationErrors)===-1&&t.validationErrors.push(P))}function f(e){var t,a=0;if("number"!=typeof e[0].size)return"";for(t=0;t<e.length;t++)e[t].size&&(a+=e[t].size);return a/=1024,a<1024?a.toFixed(2)+" KB":(a/1024).toFixed(2)+" MB"}function m(t){return!t.multiple&&e(".k-file",t.wrapper).length>1}function h(a,n,o,i){var s,r;return n._supportsRemove()?(s=a.data("fileNames"),r=e.map(s,function(e){return e.name}),i===!1?(n._removeFileEntry(a),t):(n._submitRemove(r,o,function(e,t,o){var i=n.trigger(R,{operation:"remove",files:s,response:e,XMLHttpRequest:o});i||n._removeFileEntry(a)},function(e){m(n)&&n._removeFileEntry(a),n.trigger(N,{operation:"remove",files:s,XMLHttpRequest:e}),E("Server response: "+e.responseText)}),t)):(!m(n)&&i||n._removeFileEntry(a),t)}function v(t,a,n){var o=!1,i="";try{i=e.parseJSON(g(t)),o=!0}catch(s){n()}o&&a(i)}function g(e){return t!==e&&""!==e||(e="{}"),e}function k(e){e.stopPropagation(),e.preventDefault()}function _(e,t,a,n){var o,i;e.on("dragenter"+t,function(e){a(e),i=new Date,o||(o=setInterval(function(){var e=new Date-i;e>100&&(n(),clearInterval(o),o=null)},100))}).on("dragover"+t,function(){i=new Date})}function w(e){return e.is(".k-file-progress, .k-file-success, .k-file-error")}function F(t){return e(t.target).closest(".k-file")}var y,U,C=window.kendo,S=C.ui.Widget,b=C.antiForgeryTokens,E=C.logToConsole,x=/\.([^\.]+)$/,z=".kendoUpload",D="select",A="upload",R="success",N="error",I="complete",T="cancel",q="progress",H="remove",B="validationErrors",P="invalidMaxFileSize",M="invalidMinFileSize",L="invalidFileExtension",O=1e3,V=2e3,W={loading:"k-i-loading",warning:"k-i-warning",success:"k-i-tick"},X=S.extend({init:function(t,a){var n,o,i,s=this;S.fn.init.call(s,t,a),s.name=t.name,s.multiple=s.options.multiple,s.localization=s.options.localization,n=s.element,s.wrapper=n.closest(".k-upload"),0===s.wrapper.length&&(s.wrapper=s._wrapInput(n)),s._activeInput(n),s.toggle(s.options.enabled),o=s._ns=z+"-"+C.guid(),n.closest("form").on("submit"+o,e.proxy(s._onParentFormSubmit,s)).on("reset"+o,e.proxy(s._onParentFormReset,s)),s.options.async.saveUrl?(s._module=s._supportsFormData()?new U(s):new y(s),s._async=!0,i=s.options.files,i.length>0&&s._renderInitialFiles(i)):s._module=new Z(s),s._supportsDrop()&&(""!==s.options.dropZone?s._setupCustomDropZone():s._setupDropZone()),s.wrapper.on("click",".k-upload-action",e.proxy(s._onFileAction,s)).on("click",".k-clear-selected",e.proxy(s._onClearSelected,s)).on("click",".k-upload-selected",e.proxy(s._onUploadSelected,s)),s.element.val()&&s._onInputChange({target:s.element})},events:[D,A,R,N,I,T,q,H],options:{name:"Upload",enabled:!0,multiple:!0,showFileList:!0,template:"",files:[],async:{removeVerb:"POST",autoUpload:!0,withCredentials:!0,accept:"*/*; q=0.5, application/json"},localization:{select:"Select files...",cancel:"Cancel",retry:"Retry",remove:"Remove",clearSelectedFiles:"Clear",uploadSelectedFiles:"Upload",dropFilesHere:"drop files here to upload",statusUploading:"uploading",statusUploaded:"uploaded",statusWarning:"warning",statusFailed:"failed",headerStatusUploading:"Uploading...",headerStatusUploaded:"Done",invalidMaxFileSize:"File size too large.",invalidMinFileSize:"File size too small.",invalidFileExtension:"File type not allowed."},validation:{allowedExtensions:[],maxFileSize:0,minFileSize:0},dropZone:""},setOptions:function(e){var t=this,a=t.element;S.fn.setOptions.call(t,e),t.multiple=t.options.multiple,a.attr("multiple",!!t._supportsMultiple()&&t.multiple),t.toggle(t.options.enabled)},enable:function(e){e=t===e||e,this.toggle(e)},disable:function(){this.toggle(!1)},toggle:function(e){e=t===e?e:!e,this.wrapper.toggleClass("k-state-disabled",e),this.element.prop("disabled",e)},destroy:function(){var t=this,a=e(t.options.dropZone);e(document).add(e(".k-dropzone",t.wrapper)).add(t.wrapper.closest("form")).off(t._ns),a.length>0&&a.off(t._ns),e(t.element).off(z),S.fn.destroy.call(t)},upload:function(){var e=this;e._module.onSaveSelected()},getFiles:function(){var t,a,n,o=this,i=[],s=o.wrapper.find(".k-file");for(a=0;a<s.length;a++)if(t=e(s[a]).data("fileNames"))for(n=0;n<t.length;n++)i.push(t[n]);return i},clearAllFiles:function(){var e=this,t=e.wrapper.find(".k-file");t.each(function(t,a){e._removeFileByDomElement(a,!1)})},removeAllFiles:function(){var e=this,t=e.wrapper.find(".k-file");t.each(function(t,a){e._removeFileByDomElement(a,!0)})},removeFileByUid:function(e){this._removeFileByUid(e,!0)},clearFileByUid:function(e){this._removeFileByUid(e,!1)},_removeFileByUid:function(t,a){var n,o=this;"string"==typeof t&&(n=e(".k-file["+C.attr("uid")+'="'+t+'"]',o.wrapper),n.length>0&&o._removeFileByDomElement(n,a))},clearFile:function(e){this._removeFile(e,!1)},removeFile:function(e){this._removeFile(e,!0)},_removeFile:function(t,a){var n,o=this,i=o.wrapper.find(".k-file");"function"==typeof t&&i.each(function(i,s){n=e(s).data("fileNames"),t(n)&&o._removeFileByDomElement(s,a)})},_removeFileByDomElement:function(t,a){var n,o=this,i={target:e(t,o.wrapper)};o.options.async.saveUrl?(e(t).hasClass("k-file-progress")?o._module.onCancel(i):o._module.onRemove(i,{},a),n=e(".k-file",o.wrapper),0===n.length?o._hideHeaderUploadstatus():o._updateHeaderUploadStatus()):o._module.onRemove(i,{},a)},_addInput:function(t){if(t[0].nodeType){var a=this,n=t.clone().val("");n.insertAfter(a.element).data("kendoUpload",a),e(a.element).hide().attr("tabindex","-1").removeAttr("id").off(z),a._activeInput(n),a.element.focus()}},_activeInput:function(t){var a=this,n=a.wrapper;a.element=t,t.attr("multiple",!!a._supportsMultiple()&&a.multiple).attr("autocomplete","off").on("click"+z,function(e){n.hasClass("k-state-disabled")&&e.preventDefault()}).on("focus"+z,function(){e(this).parent().addClass("k-state-focused")}).on("blur"+z,function(){e(this).parent().removeClass("k-state-focused")}).on("change"+z,e.proxy(a._onInputChange,a)).on("keydown"+z,e.proxy(a._onInputKeyDown,a))},_onInputKeyDown:function(e){var t=this,a=t.wrapper.find(".k-upload-action:visible:first");e.keyCode===C.keys.TAB&&a.length>0&&(e.preventDefault(),a.focus())},_onInputChange:function(t){var a,n=this,o=e(t.target),i=l(n._inputFiles(o),n._isAsyncNonBatch());p(i,n.options.validation),a=n.trigger(D,{files:i}),a?(n._addInput(o),o.remove()):n._module.onSelect({target:o},i)},_onDrop:function(t){var a,n=t.originalEvent.dataTransfer,i=this,s=n.files,r=l(o(s),i._isAsyncNonBatch());k(t),s.length>0&&!i.wrapper.hasClass("k-state-disabled")&&(!i.multiple&&r.length>1&&r.splice(1,r.length-1),p(r,i.options.validation),a=i.trigger(D,{files:r}),a||i._module.onSelect({target:e(".k-dropzone",i.wrapper)},r))},_filesContainValidationErrors:function(t){var a=!1;return e(t).each(function(e,t){if(t[B]&&t[B].length>0)return a=!0,!1}),a},_isAsyncNonBatch:function(){return this._async&&!this.options.async.batch||!1},_renderInitialFiles:function(t){var a,n,o=this,i=0;for(t=l(t,!0),i=0;i<t.length;i++)a=t[i],n=o._enqueueFile(a.name,{fileNames:[a]}),n.addClass("k-file-success").data("files",[t[i]]),o.options.template||e(".k-upload-status",n).prepend("<span class='k-upload-pct'>100%</span>"),o._supportsRemove()&&o._fileAction(n,H)},_prepareTemplateData:function(e,t){var a=t.fileNames,n={},o=0,i=0;for(i=0;i<a.length;i++)o+=a[i].size;return n.name=e,n.size=o,n.files=t.fileNames,n},_prepareDefaultSingleFileEntryTemplate:function(t){var a=this,n=t.fileNames[0],o=f(t.fileNames),i=n[B],s="";return s+=i&&i.length>0?"<li class='k-file k-file-invalid'><span class='k-progress'></span><span class='k-file-invalid-extension-wrapper'><span class='k-file-invalid-icon'>!</span><span class='k-file-state'></span></span><span class='k-file-name-size-wrapper'><span class='k-file-name k-file-name-invalid' title='"+n.name+"'>"+n.name+"</span><span class='k-file-validation-message'>"+a.localization[i[0]]+"</span></span>":"<li class='k-file'><span class='k-progress'></span><span class='k-file-extension-wrapper'><span class='k-file-extension'>"+n.extension.substring(1)+"</span><span class='k-file-state'></span></span><span class='k-file-name-size-wrapper'><span class='k-file-name' title='"+n.name+"'>"+n.name+"</span><span class='k-file-size'>"+o+"</span></span>",s+="<strong class='k-upload-status'></strong>",e(s)},_prepareDefaultMultipleFileEntriesTemplate:function(t){var a,n,o=this,i=t.fileNames,s=o._filesContainValidationErrors(i),r=f(i),l="";for(l+=s?"<li class='k-file k-file-invalid'><span class='k-progress'></span><span class='k-multiple-files-invalid-extension-wrapper'><span class='k-file-invalid-icon'>!</span>":"<li class='k-file'><span class='k-progress'></span><span class='k-multiple-files-extension-wrapper'>",l+="<span class='k-file-state'></span></span>",i.sort(function(e,t){return e[B]?-1:t[B]?1:0}),l+="<span class='k-file-name-size-wrapper'>",a=0;a<i.length;a++)n=i[a],l+=n[B]&&n[B].length>0?"<span class='k-file-name k-file-name-invalid' title='"+n.name+"'>"+n.name+"</span>":"<span class='k-file-name' title='"+n.name+"'>"+n.name+"</span>";return l+=s?"<span class='k-file-validation-message'>Invalid files(s). Please check file upload requirements.</span>":"<span class='k-file-information'>Total: "+i.length+" files, "+r+"</span>",l+="</span><strong class='k-upload-status'></strong>",e(l)},_enqueueFile:function(t,a){var n,o,i,s,r=this,l=a.fileNames[0].uid,p=e(".k-upload-files",r.wrapper),d=r.options,u=d.template;return 0===p.length&&(p=e("<ul class='k-upload-files k-reset'></ul>").appendTo(r.wrapper),r.options.showFileList||p.hide(),r.wrapper.removeClass("k-upload-empty")),n=e(".k-file",p),u?(i=r._prepareTemplateData(t,a),u=C.template(u),o=e("<li class='k-file'>"+u(i)+"</li>"),o.find(".k-upload-action").addClass("k-button k-button-bare"),r.angular("compile",function(){return{elements:o,data:[i]}})):o=1===a.fileNames.length?r._prepareDefaultSingleFileEntryTemplate(a):r._prepareDefaultMultipleFileEntriesTemplate(a),o.attr(C.attr("uid"),l).appendTo(p).data(a),r._async||e(".k-progress",o).width("100%"),!r.multiple&&n.length>0&&(s={files:n.data("fileNames")},r.trigger(H,s)||r._module.onRemove({target:e(n,r.wrapper)},s.data)),o},_removeFileEntry:function(t){var a,n,o,i=this,s=t.closest(".k-upload-files");t.remove(),a=e(".k-file",s),n=e(".k-file-success, .k-file-error",s),o=e(".k-file-invalid",s),n.length!==a.length&&o.length!==a.length||this._hideUploadButton(),0===a.length?(s.remove(),i.wrapper.addClass("k-upload-empty"),i._hideHeaderUploadstatus()):i._updateHeaderUploadStatus()},_fileAction:function(e,t){var a={remove:"k-i-delete",cancel:"k-i-cancel",retry:"k-i-retry"},n={remove:"k-i-close",cancel:"k-i-close",retry:"k-i-refresh"};a.hasOwnProperty(t)&&(this._clearFileAction(e),this.options.template?e.find(".k-upload-action").addClass("k-button k-button-bare").append("<span class='k-icon "+n[t]+" "+a[t]+"' title='"+this.localization[t]+"'aria-label='"+this.localization[t]+"'></span>").show():(e.find(".k-upload-status .k-upload-action").remove(),e.find(".k-upload-status").append(this._renderAction(a[t],this.localization[t],n[t]))))},_fileState:function(t,a){var n=this.localization,o={uploading:{text:n.statusUploading},uploaded:{text:n.statusUploaded},failed:{text:n.statusFailed}},i=o[a];i&&e("span.k-file-state",t).text(i.text)},_renderAction:function(t,a,n){return e(""!==t?"<button type='button' class='k-button k-button-bare k-upload-action'><span class='k-icon "+n+" "+t+"' title='"+a+"' aria-label='"+a+"'></span></button>":"<button type='button' class='k-button'>"+a+"</button>")},_clearFileAction:function(t){e(".k-upload-action",t).empty().hide()},_onFileAction:function(t){var a,n,o,i,s,r,l=this;return l.wrapper.hasClass("k-state-disabled")||(a=e(t.target).closest(".k-upload-action"),n=a.find(".k-icon"),o=a.closest(".k-file"),i=o.data("fileNames"),s=l._filesContainValidationErrors(i),r={files:i},n.hasClass("k-i-delete")?l.trigger(H,r)||l._module.onRemove({target:e(o,l.wrapper)},r.data,!s):n.hasClass("k-i-cancel")?(l.trigger(T,r),l._module.onCancel({target:e(o,l.wrapper)}),l._checkAllComplete(),l._updateHeaderUploadStatus()):n.hasClass("k-i-retry")&&(e(".k-i-warning",o).remove(),e(".k-progress",o).finish().show(),l._module.onRetry({target:e(o,l.wrapper)}))),!1},_onUploadSelected:function(){var e=this,t=e.wrapper;return t.hasClass("k-state-disabled")||this._module.onSaveSelected(),!1},_onClearSelected:function(){var e=this,t=e.wrapper;return t.hasClass("k-state-disabled")||e.clearAllFiles(),!1},_onFileProgress:function(t,a){var n;a>100&&(a=100),this.options.template?e(".k-progress",t.target).width(a+"%"):(n=e(".k-upload-pct",t.target),0===n.length&&e(".k-upload-status",t.target).prepend("<span class='k-upload-pct'></span>"),e(".k-upload-pct",t.target).text(a+"%"),e(".k-progress",t.target).width(a+"%")),this.trigger(q,{files:F(t).data("fileNames"),percentComplete:a})},_onUploadSuccess:function(e,t,a){var n=this,o=F(e),i=n.trigger(R,{files:o.data("fileNames"),response:t,operation:"upload",XMLHttpRequest:a});i?n._setUploadErrorState(o):(n._fileState(o,"uploaded"),o.removeClass("k-file-progress").addClass("k-file-success"),n._updateHeaderUploadStatus(),n._supportsRemove()?n._fileAction(o,H):n._clearFileAction(o)),n._hideUploadProgress(o),n._checkAllComplete()},_onUploadError:function(e,t){var a=this,n=F(e);a._setUploadErrorState(n),a.trigger(N,{operation:"upload",files:n.data("fileNames"),XMLHttpRequest:t}),E("Server response: "+t.responseText),a._hideUploadProgress(n),a._checkAllComplete()},_setUploadErrorState:function(t){var a=this,n=e(".k-upload-pct",t);a._fileState(t,"failed"),t.removeClass("k-file-progress").addClass("k-file-error"),e(".k-progress",t).width("100%"),n.length>0?n.empty().removeClass("k-upload-pct").addClass("k-icon k-i-warning"):e(".k-upload-status",t).prepend("<span class='k-icon k-i-warning'></span>"),this._updateHeaderUploadStatus(),this._fileAction(t,"retry")},_hideUploadProgress:function(t){e(".k-progress",t).delay(O).fadeOut(V,function(){e(this).css("width","0%")})},_showUploadButton:function(){var t=this,a=e(".k-upload-selected",t.wrapper),n=e(".k-clear-selected",t.wrapper);0===a.length&&(a=t._renderAction("",this.localization.uploadSelectedFiles).addClass("k-upload-selected"),n=t._renderAction("",this.localization.clearSelectedFiles).addClass("k-clear-selected")),this.wrapper.append(n,a)},_hideUploadButton:function(){e(".k-upload-selected, .k-clear-selected",this.wrapper).remove()},_showHeaderUploadStatus:function(t){var a=this,n=a.localization,o=e(".k-dropzone",a.wrapper),i=e(".k-upload-status-total",a.wrapper);0!==i.length&&i.remove(),i='<strong class="k-upload-status k-upload-status-total"><span class="k-icon"></span></strong>',t?(i=e(i).append(n.headerStatusUploading),i.find(".k-icon").addClass(W.loading).text(n.statusUploading)):(i=e(i).append(n.headerStatusUploaded),i.find(".k-icon").addClass(W.warning).text(n.statusWarning)),o.length>0?o.append(i):e(".k-upload-button",a.wrapper).after(i)},_updateHeaderUploadStatus:function(){var t,a,n=this,o=n.localization,i=e(".k-upload-status-total",this.wrapper),s=e(".k-file",n.wrapper).not(".k-file-success, .k-file-error, .k-file-invalid"),r=e(".k-file-invalid",n.wrapper);(0===s.length||r.length>0)&&(t=e(".k-file.k-file-error, .k-file.k-file-invalid",n.wrapper),i=e(".k-upload-status-total",n.wrapper),a=e(".k-icon",i).removeClass().addClass("k-icon").addClass(0!==t.length?W.warning:W.success).text(0!==t.length?o.statusWarning:o.statusUploaded),i.html(a).append(n.localization.headerStatusUploaded))},_hideHeaderUploadstatus:function(){e(".k-upload-status-total",this.wrapper).remove()},_onParentFormSubmit:function(){var a,n=this,o=n.element;t!==this._module.onAbort&&this._module.onAbort(),o.value||(a=e(o),a.attr("disabled","disabled"),window.setTimeout(function(){a.removeAttr("disabled")},0))},_onParentFormReset:function(){e(".k-upload-files",this.wrapper).remove()},_supportsFormData:function(){return"undefined"!=typeof FormData},_supportsMultiple:function(){var e=this._userAgent().indexOf("Windows")>-1;return!(C.support.browser.opera||C.support.browser.safari&&e)},_supportsDrop:function(){var e=this._userAgent().toLowerCase(),t=/chrome/.test(e),a=!t&&/safari/.test(e),n=a&&/windows/.test(e);return!n&&this._supportsFormData()&&this.options.async.saveUrl},_userAgent:function(){return navigator.userAgent},_setupDropZone:function(){var t,a,n=this;e(".k-upload-button",n.wrapper).wrap("<div class='k-dropzone'></div>"),t=n._ns,a=e(".k-dropzone",n.wrapper).append(e("<em>"+n.localization.dropFilesHere+"</em>")).on("dragenter"+t,k).on("dragover"+t,function(e){e.preventDefault()}).on("drop"+t,e.proxy(n._onDrop,n)),_(a,t,function(){a.closest(".k-upload").hasClass("k-state-disabled")||a.addClass("k-dropzone-hovered")},function(){a.removeClass("k-dropzone-hovered")}),n._bindDocumentDragEventWrappers(a)},_setupCustomDropZone:function(){var t,a=this,n=e(a.options.dropZone);e(".k-upload-button",a.wrapper).wrap("<div class='k-dropzone'></div>"),t=a._ns,n.on("dragenter"+t,k).on("dragover"+t,function(e){e.preventDefault()}).on("drop"+t,e.proxy(a._onDrop,a)),_(n,t,function(t){a.wrapper.hasClass("k-state-disabled")||(n.removeClass("k-dropzone-hovered"),e(t.target).addClass("k-dropzone-hovered"))},function(){n.removeClass("k-dropzone-hovered")}),a._bindDocumentDragEventWrappers(n)},_bindDocumentDragEventWrappers:function(t){var a=this,n=a._ns;_(e(document),n,function(){a.wrapper.hasClass("k-state-disabled")||(t.addClass("k-dropzone-active"),t.closest(".k-upload").removeClass("k-upload-empty"))},function(){t.removeClass("k-dropzone-active"),0===e("li.k-file",t.closest(".k-upload")).length&&t.closest(".k-upload").addClass("k-upload-empty")})},_supportsRemove:function(){return!!this.options.async.removeUrl},_submitRemove:function(t,a,n,o){var i=this,s=i.options.async.removeField||"fileNames",r=e.extend(a,b());r[s]=t,jQuery.ajax({type:this.options.async.removeVerb,dataType:"json",dataFilter:g,url:this.options.async.removeUrl,traditional:!0,data:r,success:n,error:o,xhrFields:{withCredentials:this.options.async.withCredentials}})},_wrapInput:function(e){var t=this,a=t.options;return e.wrap("<div class='k-widget k-upload k-header'><div class='k-button k-upload-button' aria-label='"+this.localization.select+"'></div></div>"),a.async.saveUrl||e.closest(".k-upload").addClass("k-upload-sync"),e.closest(".k-upload").addClass("k-upload-empty"),e.closest(".k-button").append("<span>"+this.localization.select+"</span>"),e.closest(".k-upload")},_checkAllComplete:function(){0===e(".k-file.k-file-progress",this.wrapper).length&&this.trigger(I)},_inputFiles:function(e){return n(e)}}),Z=function(e){this.name="syncUploadModule",this.element=e.wrapper,this.upload=e,this.element.closest("form").attr("enctype","multipart/form-data").attr("encoding","multipart/form-data")};Z.prototype={onSelect:function(t,n){var o,i,s=this.upload,r=e(t.target),l=s._filesContainValidationErrors(n);s._addInput(r),o={fileNames:n},l?r.remove():o.relatedInput=r,i=s._enqueueFile(a(r),o),l&&s._hideUploadProgress(i),s._fileAction(i,H)},onRemove:function(e){var t=F(e),a=t.data("relatedInput");a&&a.remove(),this.upload._removeFileEntry(t)}},y=function(e){this.name="iframeUploadModule",this.element=e.wrapper,this.upload=e,this.iframes=[]},X._frameId=0,y.prototype={onSelect:function(t,a){var n=this.upload,o=e(t.target),i=n._filesContainValidationErrors(a),s=this.prepareUpload(o,a,i);n.options.async.autoUpload?i?(n._fileAction(s,H),n._showHeaderUploadStatus(!1)):this.performUpload(s):(n._fileAction(s,H),i?n._updateHeaderUploadStatus():n._showUploadButton()),i&&n._hideUploadProgress(s)},prepareUpload:function(t,n,o){var i,s,r,l,p=this.upload,d=e(p.element),u=p.options.async.saveField||t.attr("name");return p._addInput(t),t.attr("name",u),o?(t.remove(),s={fileNames:n}):(r=this.createFrame(p.name+"_"+X._frameId++),this.registerFrame(r),l=this.createForm(p.options.async.saveUrl,r.attr("name")).append(d),s={frame:r,relatedInput:d,fileNames:n}),i=p._enqueueFile(a(t),s),r&&r.data({form:l,file:i}),i},performUpload:function(t){var a,n,o,i={files:t.data("fileNames")},s=t.data("frame"),r=this.upload;if(r.trigger(A,i))r._removeFileEntry(s.data("file")),this.cleanupFrame(s),this.unregisterFrame(s);else{r._hideUploadButton(),r._showHeaderUploadStatus(!0),s.appendTo(document.body),a=s.data("form").attr("action",r.options.async.saveUrl).appendTo(document.body),i.data=e.extend({},i.data,b());for(n in i.data)o=a.find("input[name='"+n+"']"),0===o.length&&(o=e("<input>",{type:"hidden",name:n}).prependTo(a)),o.val(i.data[n]);r._fileAction(t,T),r._fileState(t,"uploading"),e(t).removeClass("k-file-error").addClass("k-file-progress"),s.one("load",e.proxy(this.onIframeLoad,this)),a[0].submit()}},onSaveSelected:function(){var t=this,a=t.upload;e(".k-file",this.element).each(function(){var n=e(this),o=w(n),i=a._filesContainValidationErrors(n.data("fileNames"));o||i||t.performUpload(n)})},onIframeLoad:function(t){var a,n=e(t.target);try{a=n.contents().text()}catch(o){a="Error trying to get server response: "+o}this.processResponse(n,a)},processResponse:function(t,a){var n=t.data("file"),o=this,i={responseText:a};v(a,function(a){e.extend(i,{statusText:"OK",status:"200"}),o.upload._onFileProgress({target:e(n,o.upload.wrapper)},100),o.upload._onUploadSuccess({target:e(n,o.upload.wrapper)},a,i),o.cleanupFrame(t),o.unregisterFrame(t)},function(){e.extend(i,{statusText:"error",status:"500"}),o.upload._onUploadError({target:e(n,o.upload.wrapper)},i)})},onCancel:function(t){var a=e(t.target).data("frame");this.stopFrameSubmit(a),this.cleanupFrame(a),this.unregisterFrame(a),this.upload._removeFileEntry(a.data("file"))},onRetry:function(e){var t=F(e);this.performUpload(t)},onRemove:function(e,t,a){var n=this,o=n.upload,i=F(e),s=i.data("frame");s?(n.unregisterFrame(s),o._removeFileEntry(i),n.cleanupFrame(s)):i.hasClass("k-file-success")?h(i,o,t,a):o._removeFileEntry(i)},onAbort:function(){var t=this.element,a=this;e.each(this.iframes,function(){e("input",this.data("form")).appendTo(t),a.stopFrameSubmit(this[0]),this.data("form").remove(),this.remove()}),this.iframes=[]},createFrame:function(t){return e("<iframe name='"+t+"' id='"+t+"' style='display:none;' />")},createForm:function(t,a){return e("<form enctype='multipart/form-data' method='POST' action='"+t+"' target='"+a+"'/>")},stopFrameSubmit:function(e){t!==e.stop?e.stop():e.document&&e.document.execCommand("Stop")},registerFrame:function(e){this.iframes.push(e)},unregisterFrame:function(t){this.iframes=e.grep(this.iframes,function(e){return e.attr("name")!=t.attr("name")})},cleanupFrame:function(e){var t=e.data("form");e.data("file").data("frame",null),setTimeout(function(){t.remove(),e.remove()},1)}},U=function(e){this.name="formDataUploadModule",this.element=e.wrapper,this.upload=e},U.prototype={onSelect:function(t,a){var n,o=this.upload,i=this,s=e(t.target),r=this.prepareUpload(s,a);e.each(r,function(){n=o._filesContainValidationErrors(e(this.data("fileNames"))),o.options.async.autoUpload?n?(o._fileAction(this,H),o._showHeaderUploadStatus(!1)):i.performUpload(this):(o._fileAction(this,H),n?o._updateHeaderUploadStatus():o._showUploadButton()),n&&o._hideUploadProgress(this)})},prepareUpload:function(t,a){var n=this.enqueueFiles(a);return t.is("input")&&(e.each(n,function(){e(this).data("relatedInput",t)}),t.data("relatedFileEntries",n),this.upload._addInput(t)),n},enqueueFiles:function(t){var a,n,o,i,s=this.upload,r=t.length,l=[];if(s.options.async.batch===!0)a=e.map(t,function(e){return e.name}).join(", "),i=s._enqueueFile(a,{fileNames:t}),i.data("files",t),l.push(i);else for(n=0;n<r;n++)o=t[n],a=o.name,i=s._enqueueFile(a,{fileNames:[o]}),i.data("files",[o]),l.push(i);return l},performUpload:function(t){var a,n=this.upload,o=this.createFormData(),i=this.createXHR(),s={files:t.data("fileNames"),XMLHttpRequest:i};if(n.trigger(A,s))this.removeFileEntry(t);else{if(n._fileAction(t,T),n._hideUploadButton(),n._showHeaderUploadStatus(!0),s.formData)o=s.formData;else{s.data=e.extend({},s.data,b());for(a in s.data)o.append(a,s.data[a]);this.populateFormData(o,t.data("files"))}n._fileState(t,"uploading"),e(t).removeClass("k-file-error").addClass("k-file-progress"),this.postFormData(n.options.async.saveUrl,o,t,i)}},onSaveSelected:function(){var t=this,a=t.upload;e(".k-file",this.element).each(function(){var n=e(this),o=w(n),i=a._filesContainValidationErrors(n.data("fileNames"));o||i||t.performUpload(n)})},onCancel:function(e){var t=F(e);this.stopUploadRequest(t),this.removeFileEntry(t)},onRetry:function(e){var t=F(e);this.performUpload(t)},onRemove:function(e,t,a){var n=this,o=n.upload,i=F(e);i.hasClass("k-file-success")?h(i,o,t,a):n.removeFileEntry(i)},createXHR:function(){return new XMLHttpRequest},postFormData:function(e,t,a,n){var o,i=this;a.data("request",n),n.addEventListener("load",function(e){i.onRequestSuccess.call(i,e,a)},!1),n.addEventListener(N,function(e){i.onRequestError.call(i,e,a)},!1),n.upload.addEventListener("progress",function(e){i.onRequestProgress.call(i,e,a)},!1),n.open("POST",e,!0),n.withCredentials=this.upload.options.async.withCredentials,o=this.upload.options.async.accept,o&&n.setRequestHeader("Accept",o),n.send(t)},createFormData:function(){return new FormData},populateFormData:function(e,t){var a,n=this.upload,o=t.length;for(a=0;a<o;a++)e.append(n.options.async.saveField||n.name,t[a].rawFile);return e},onRequestSuccess:function(t,a){function n(){i.upload._onUploadError({target:e(a,i.upload.wrapper)},o)}var o=t.target,i=this;o.status>=200&&o.status<=299?v(o.responseText,function(t){i.upload._onFileProgress({target:e(a,i.upload.wrapper)},100),i.upload._onUploadSuccess({target:e(a,i.upload.wrapper)},t,o),i.cleanupFileEntry(a)},n):n()},onRequestError:function(t,a){var n=t.target;this.upload._onUploadError({target:e(a,this.upload.wrapper)},n)},cleanupFileEntry:function(t){var a=t.data("relatedInput"),n=!0;a&&(e.each(a.data("relatedFileEntries")||[],function(){this.parent().length>0&&this[0]!=t[0]&&(n=n&&this.hasClass("k-file-success"))}),n&&a.remove())},removeFileEntry:function(e){this.cleanupFileEntry(e),this.upload._removeFileEntry(e)},onRequestProgress:function(t,a){var n=Math.round(100*t.loaded/t.total);this.upload._onFileProgress({target:e(a,this.upload.wrapper)},n)},stopUploadRequest:function(e){e.data("request").abort()}},C.ui.plugin(X)}(window.kendo.jQuery),window.kendo},"function"==typeof define&&define.amd?define:function(e,t,a){(a||t)()});
//# sourceMappingURL=kendo.upload.min.js.map
