{"version":3,"sources":["kendo.upload.js"],"names":["f","define","$","undefined","getFileName","input","map","inputFiles","file","name","join","$input","files","getAllFileInfo","stripPath","value","extension","getFileExtension","size","rawFiles","getFileInfo","rawFile","fileName","kendo","htmlEncode","fileSize","matches","match","rFileExtension","slashIndex","lastIndexOf","substr","assignGuidToFiles","unique","uid","guid","validateFiles","validationInfo","i","allowedExtensions","parseAllowedExtensions","maxFileSize","minFileSize","length","validateFileExtension","validateFileSize","extensions","ext","parsedExt","substring","toLowerCase","indexOf","validationErrors","inArray","INVALIDFILEEXTENSION","push","INVALIDMINFILESIZE","INVALIDMAXFILESIZE","getTotalFilesSizeMessage","totalSize","toFixed","shouldRemoveFileEntry","upload","multiple","wrapper","removeUploadedFile","fileEntry","eventArgs","shouldSendRemoveRequest","fileNames","_supportsRemove","data","_removeFileEntry","_submitRemove","textStatus","xhr","prevented","trigger","SUCCESS","operation","response","XMLHttpRequest","ERROR","logToConsole","responseText","tryParseJSON","onSuccess","onError","success","json","parseJSON","normalizeJSON","e","stopEvent","stopPropagation","preventDefault","bindDragEventWrappers","element","namespace","onDragEnter","onDragLeave","hideInterval","lastDrag","on","Date","setInterval","sinceLastDrag","clearInterval","isFileUploadStarted","is","getFileEntry","target","closest","iframeUploadModule","formDataUploadModule","window","Widget","ui","antiForgeryTokens","NS","SELECT","UPLOAD","COMPLETE","CANCEL","CLEAR","PAUSE","RESUME","PROGRESS","REMOVE","VALIDATIONERRORS","PROGRESSHIDEDELAY","PROGRESSHIDEDURATION","headerStatusIcon","loading","warning","Upload","extend","init","options","activeInput","ns","initialFiles","that","this","fn","call","directory","localization","_wrapInput","_activeInput","toggle","enabled","_ns","proxy","_onParentFormSubmit","_onParentFormReset","async","saveUrl","_module","_supportsFormData","_async","_renderInitialFiles","syncUploadModule","_toggleDropZone","_onFileAction","_onClearSelected","_onUploadSelected","val","_onInputChange","events","showFileList","template","autoRetryAfter","bufferChunkSize","maxAutoRetries","removeVerb","autoUpload","withCredentials","accept","useArrayBuffer","select","cancel","retry","remove","pause","resume","clearSelectedFiles","uploadSelectedFiles","dropFilesHere","invalidFiles","statusUploading","statusUploaded","statusWarning","statusFailed","headerStatusUploading","headerStatusPaused","headerStatusUploaded","uploadSuccess","uploadFail","invalidMaxFileSize","invalidMinFileSize","invalidFileExtension","validation","dropZone","setOptions","off","attr","_supportsMultiple","enable","disable","toggleClass","prop","focus","destroy","customDropZone","document","add","onPause","pauseIcon","find","removeClass","addClass","parent","onResume","playIcon","onSaveSelected","getFiles","filesData","j","allFiles","listItems","clearAllFiles","each","index","_removeFileByDomElement","removeAllFiles","removeFileByUid","_removeFileByUid","clearFileByUid","clearFile","callback","_removeFile","removeFile","fileData","hasClass","onCancel","onRemove","_hideHeaderUploadstatus","_updateHeaderUploadStatus","_addInput","sourceInput","nodeType","clone","insertAfter","prefix","hide","removeAttr","_onInputKeyDown","firstButton","keyCode","keys","TAB","shiftKey","_inputFiles","_isAsyncNonBatch","onSelect","_readDirectory","item","deferred","Deferred","dirReader","createReader","allFolderFiles","readEntries","entries","concat","resolve","reject","promise","_readFile","fullpath","fullPath","relativePath","slice","droppedFolderFiles","droppedFolderCounter","setTimeout","_proceedDroppedItems","_traverseFileTree","skipCounter","then","items","isFile","isDirectory","_onDrop","entry","dt","originalEvent","dataTransfer","droppedFiles","directoryDrop","webkitGetAsEntry","splice","_filesContainValidationErrors","hasErrors","batch","currentFile","idx","_enqueueFile","_fileAction","_prepareTemplateData","templateData","_prepareDefaultSingleFileEntryTemplate","fileGroup","getFileGroup","errors","_prepareDefaultMultipleFileEntriesTemplate","filesHaveValidationErrors","totalFileSize","sort","a","b","existingFileEntries","removeEventArgs","fileUid","fileList","appendTo","angular","elements","width","headers","allCompletedFiles","allInvalidFiles","_hideActionButtons","fileElement","actionKey","skipClear","firstActionButton","classDictionary","iconsClassDictionary","hasOwnProperty","_clearFileAction","first","next","append","show","_renderAction","_fileState","stateKey","states","uploading","text","uploaded","failed","currentState","actionClass","actionText","iconClass","empty","button","icon","hasValidationErrors","_retryClicked","_checkAllComplete","finish","onRetry","clearEventArgs","_onFileProgress","percentComplete","progressPct","prepend","_onUploadSuccess","fileInfo","_setUploadErrorState","after","_hideUploadProgress","_onUploadError","module","chunkSize","_decreasePosition","_autoRetryAfter","retries","performUpload","uploadPercentage","_updateUploadProgress","fileMetaData","metaData","totalChunks","Math","round","chunkIndex","delay","fadeOut","css","_showActionButtons","actionsWrapper","uploadButton","clearButton","_showHeaderUploadStatus","isUploading","headerUploadStatus","failedUploads","headerUploadStatusIcon","currentlyUploading","not","currentlyInvalid","currentlyFailed","currentlyPaused","concurrent","html","onAbort","FormData","windows","_userAgent","support","browser","opera","safari","_supportsDrop","userAgent","isChrome","test","isSafari","isWindowsSafari","navigator","_setupDropZone","_bindDocumentDragEventWrappers","_setupCustomDropZone","removeUrl","removeField","params","jQuery","ajax","type","dataType","dataFilter","url","traditional","error","xhrFields","wrap","prototype","filesContainErrors","relatedInput","iframes","_frameId","prepareUpload","iframe","form","saveField","createFrame","registerFrame","createForm","frame","key","dataInput","fileValidation","cleanupFrame","unregisterFrame","body","prependTo","one","onIframeLoad","submit","started","contents","ex","processResponse","fakeXHR","jsonResult","statusText","status","stopFrameSubmit","id","action","stop","execCommand","grep","position","cancelled","paused","prev","sourceElement","fileEntries","prepareChunk","enqueueFiles","filesLength","webkitRelativePath","formData","createFormData","createXHR","removeFileEntry","populateFormData","FileReader","postFormData","reader","onload","fileArrayBuffer","_appendBuffer","result","err","onerror","readAsArrayBuffer","_getCurrentChunk","buffer1","buffer2","tmp","Uint8Array","byteLength","set","buffer","filter","prevEntry","stopUploadRequest","_increaseChunkIndex","addEventListener","onRequestSuccess","onRequestError","onRequestProgress","open","setRequestHeader","send","chunk","serializedMetaData","JSON","stringify","raiseError","parseSuccess","cleanupFileEntry","_resetChunkIndex","uploadComplete","isUploadButtonVisible","loaded","total","abort","contentType","ceil","uploadUid","_decreaseChunkIndex","methodToInvoke","oldPosition","_getChunker","mozSlice","webkitSlice","plugin","amd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AAaC,KAAKoJ,KAAKngB,EAAQH,KAAOwW,GACtC+J,UAAWvf,IAGnBwf,oBAAqB,SAAUxf,GAC3B6G,KAAKmP,SAAShW,GAAKoW,cAEvB4H,oBAAqB,SAAUhe,GAC3B6G,KAAKmP,SAAShW,GAAKoW,cAEvB2I,iBAAkB,SAAU/e,GACxB6G,KAAKmP,SAAShW,GAAKoW,WAAa,GAEpCX,kBAAmB,SAAUzV,GACzB6G,KAAK+U,SAAS5b,IAAQ6G,KAAKjF,OAAO4E,QAAQkB,MAAM8N,WAEpD6H,iBAAkB,SAAU/e,EAAM0B,GAAhB,GAEVyf,GADAC,EAAc7Y,KAAK+U,SAAS5b,GAE5B0H,EAAQb,KAAKjF,OAAO4E,QAAQkB,MAC5B8N,EAAY9N,EAAM8N,WAAa9N,EAAMiB,eAKzC,OAJK9B,MAAK+U,SAAS5b,KACf6G,KAAK+U,SAAS5b,GAAO,GAEzB6G,KAAK+U,SAAS5b,IAAQwV,GACfiK,EAAiB5Y,KAAK8Y,YAAYrhB,IAC9BA,EAAKmhB,GAAgBC,EAAa7Y,KAAK+U,SAAS5b,IAEhD1B,GAGfqhB,YAAa,SAAUrhB,GACnB,MAAIA,GAAKmR,MACE,QACAnR,EAAKshB,SACL,WACAthB,EAAKuhB,YACL,cAEA,OAmMnBxgB,EAAM8F,GAAG2a,OAAOzZ,IAClBpB,OAAO5F,MAAMwZ,QACR5T,OAAO5F,OACE,kBAAVtB,SAAwBA,OAAOgiB,IAAMhiB,OAAS,SAAUiiB,EAAIC,EAAIC,IACrEA,GAAMD","file":"kendo.upload.min.js","sourcesContent":["/*!\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n\n*/\n(function (f, define) {\n define('kendo.upload', ['kendo.core'], f);\n}(function () {\n var __meta__ = {\n id: 'upload',\n name: 'Upload',\n category: 'web',\n description: 'The Upload widget uses progressive enhancement to deliver the best possible uploading experience to users.',\n depends: ['core']\n };\n (function ($, undefined) {\n var kendo = window.kendo, Widget = kendo.ui.Widget, antiForgeryTokens = kendo.antiForgeryTokens, logToConsole = kendo.logToConsole, rFileExtension = /\\.([^\\.]+)$/, NS = '.kendoUpload', SELECT = 'select', UPLOAD = 'upload', SUCCESS = 'success', ERROR = 'error', COMPLETE = 'complete', CANCEL = 'cancel', CLEAR = 'clear', PAUSE = 'pause', RESUME = 'resume', PROGRESS = 'progress', REMOVE = 'remove', VALIDATIONERRORS = 'validationErrors', INVALIDMAXFILESIZE = 'invalidMaxFileSize', INVALIDMINFILESIZE = 'invalidMinFileSize', INVALIDFILEEXTENSION = 'invalidFileExtension', PROGRESSHIDEDELAY = 1000, PROGRESSHIDEDURATION = 2000;\n var headerStatusIcon = {\n loading: 'k-i-upload',\n warning: 'k-i-warning',\n success: 'k-i-check'\n };\n var Upload = Widget.extend({\n init: function (element, options) {\n var that = this;\n Widget.fn.init.call(that, element, options);\n that.name = element.name;\n that.multiple = that.options.multiple;\n that.directory = that.options.directory;\n that.localization = that.options.localization;\n var activeInput = that.element;\n that.wrapper = activeInput.closest('.k-upload');\n if (that.wrapper.length === 0) {\n that.wrapper = that._wrapInput(activeInput);\n }\n that._activeInput(activeInput);\n that.toggle(that.options.enabled);\n var ns = that._ns = NS + '-' + kendo.guid();\n activeInput.closest('form').on('submit' + ns, $.proxy(that._onParentFormSubmit, that)).on('reset' + ns, $.proxy(that._onParentFormReset, that));\n if (that.options.async.saveUrl) {\n that._module = that._supportsFormData() ? new formDataUploadModule(that) : new iframeUploadModule(that);\n that._async = true;\n var initialFiles = that.options.files;\n if (initialFiles.length > 0) {\n that._renderInitialFiles(initialFiles);\n }\n } else {\n that._module = new syncUploadModule(that);\n }\n that._toggleDropZone();\n that.wrapper.on('click', '.k-upload-action', $.proxy(that._onFileAction, that)).on('click', '.k-clear-selected', $.proxy(that._onClearSelected, that)).on('click', '.k-upload-selected', $.proxy(that._onUploadSelected, that));\n if (that.element.val()) {\n that._onInputChange({ target: that.element });\n }\n },\n events: [\n SELECT,\n UPLOAD,\n SUCCESS,\n ERROR,\n COMPLETE,\n CANCEL,\n CLEAR,\n PROGRESS,\n REMOVE,\n PAUSE,\n RESUME\n ],\n options: {\n name: 'Upload',\n enabled: true,\n multiple: true,\n directory: false,\n showFileList: true,\n template: '',\n files: [],\n async: {\n autoRetryAfter: 0,\n bufferChunkSize: 10000000,\n maxAutoRetries: 1,\n removeVerb: 'POST',\n autoUpload: true,\n withCredentials: true,\n accept: '*/*; q=0.5, application/json',\n useArrayBuffer: false\n },\n localization: {\n 'select': 'Select files...',\n 'cancel': 'Cancel',\n 'retry': 'Retry',\n 'remove': 'Remove',\n 'pause': 'Pause',\n 'resume': 'Resume',\n 'clearSelectedFiles': 'Clear',\n 'uploadSelectedFiles': 'Upload',\n 'dropFilesHere': 'Drop files here to upload',\n 'invalidFiles': 'Invalid file(s). Please check file upload requirements.',\n 'statusUploading': 'uploading',\n 'statusUploaded': 'uploaded',\n 'statusWarning': 'warning',\n 'statusFailed': 'failed',\n 'headerStatusUploading': 'Uploading...',\n 'headerStatusPaused': 'Paused',\n 'headerStatusUploaded': 'Done',\n 'uploadSuccess': 'File(s) uploaded successfully.',\n 'uploadFail': 'File(s) failed to upload.',\n 'invalidMaxFileSize': 'File size too large.',\n 'invalidMinFileSize': 'File size too small.',\n 'invalidFileExtension': 'File type not allowed.'\n },\n validation: {\n allowedExtensions: [],\n maxFileSize: 0,\n minFileSize: 0\n },\n dropZone: ''\n },\n setOptions: function (options) {\n var that = this, activeInput = that.element;\n $(that.options.dropZone).off(that._ns);\n Widget.fn.setOptions.call(that, options);\n that.multiple = that.options.multiple;\n that.directory = that.options.directory;\n activeInput.attr('multiple', that._supportsMultiple() ? that.multiple : false);\n if (that.directory) {\n activeInput.attr('webkitdirectory', that.directory);\n activeInput.attr('directory', that.directory);\n }\n that.toggle(that.options.enabled);\n that._toggleDropZone();\n },\n enable: function (enable) {\n enable = typeof enable === 'undefined' ? true : enable;\n this.toggle(enable);\n },\n disable: function () {\n this.toggle(false);\n },\n toggle: function (enable) {\n enable = typeof enable === 'undefined' ? enable : !enable;\n this.wrapper.toggleClass('k-state-disabled', enable);\n this.element.prop('disabled', enable);\n },\n focus: function () {\n this.element.focus();\n },\n destroy: function () {\n var that = this;\n var customDropZone = $(that.options.dropZone);\n $(document).add($('.k-dropzone', that.wrapper)).add(that.wrapper.closest('form')).off(that._ns);\n if (customDropZone.length > 0) {\n customDropZone.off(that._ns);\n }\n $(that.element).off(NS);\n Widget.fn.destroy.call(that);\n },\n pause: function (fileEntry) {\n this._module.onPause({ target: $(fileEntry, this.wrapper) });\n var pauseIcon = fileEntry.find('.k-i-pause-sm');\n pauseIcon.removeClass('k-i-pause-sm').addClass('k-i-play-sm').attr('title', this.localization.resume);\n $(pauseIcon).parent().attr('aria-label', this.localization.resume);\n },\n resume: function (fileEntry) {\n this._module.onResume({ target: $(fileEntry, this.wrapper) });\n var playIcon = fileEntry.find('.k-i-play-sm');\n playIcon.removeClass('k-i-play-sm').addClass('k-i-pause-sm').attr('title', this.localization.pause);\n $(playIcon).parent().attr('aria-label', this.localization.pause);\n },\n upload: function () {\n var that = this;\n that._module.onSaveSelected();\n },\n getFiles: function () {\n var that = this;\n var filesData;\n var allFiles = [];\n var listItems = that.wrapper.find('.k-file');\n for (var i = 0; i < listItems.length; i++) {\n filesData = $(listItems[i]).data('fileNames');\n if (filesData) {\n for (var j = 0; j < filesData.length; j++) {\n allFiles.push(filesData[j]);\n }\n }\n }\n return allFiles;\n },\n clearAllFiles: function () {\n var that = this;\n var files = that.wrapper.find('.k-file');\n files.each(function (index, file) {\n that._removeFileByDomElement(file, false);\n });\n },\n removeAllFiles: function () {\n var that = this;\n var files = that.wrapper.find('.k-file');\n files.each(function (index, file) {\n that._removeFileByDomElement(file, true);\n });\n },\n removeFileByUid: function (uid) {\n this._removeFileByUid(uid, true);\n },\n clearFileByUid: function (uid) {\n this._removeFileByUid(uid, false);\n },\n _removeFileByUid: function (uid, shouldSendRemoveRequest) {\n var that = this;\n var fileEntry;\n if (typeof uid !== 'string') {\n return;\n }\n fileEntry = $('.k-file[' + kendo.attr('uid') + '=\"' + uid + '\"]', that.wrapper);\n if (fileEntry.length > 0) {\n that._removeFileByDomElement(fileEntry, shouldSendRemoveRequest);\n }\n },\n clearFile: function (callback) {\n this._removeFile(callback, false);\n },\n removeFile: function (callback) {\n this._removeFile(callback, true);\n },\n _removeFile: function (callback, shouldSendRemoveRequest) {\n var that = this;\n var files = that.wrapper.find('.k-file');\n var fileData;\n if (typeof callback === 'function') {\n files.each(function (index, file) {\n fileData = $(file).data('fileNames');\n if (callback(fileData)) {\n that._removeFileByDomElement(file, shouldSendRemoveRequest);\n }\n });\n }\n },\n _removeFileByDomElement: function (fileEntry, shouldSendRemoveRequest) {\n var that = this;\n var fileData = { target: $(fileEntry, that.wrapper) };\n var allFiles;\n if (that.options.async.saveUrl) {\n if ($(fileEntry).hasClass('k-file-progress')) {\n that._module.onCancel(fileData);\n } else {\n that._module.onRemove(fileData, {}, shouldSendRemoveRequest);\n }\n allFiles = $('.k-file', that.wrapper);\n if (allFiles.length === 0) {\n that._hideHeaderUploadstatus();\n } else {\n that._updateHeaderUploadStatus();\n }\n } else {\n that._module.onRemove(fileData, {}, shouldSendRemoveRequest);\n }\n },\n _addInput: function (sourceInput) {\n if (!sourceInput[0].nodeType) {\n return;\n }\n var that = this, input = sourceInput.clone().val('');\n input.insertAfter(that.element).data('kendo' + that.options.prefix + that.options.name, that);\n $(that.element).hide().attr('tabindex', '-1').removeAttr('id').off(NS);\n that._activeInput(input);\n that.element.focus();\n },\n _activeInput: function (input) {\n var that = this, wrapper = that.wrapper;\n that.element = input;\n if (that.directory) {\n input.attr('webkitdirectory', that.directory);\n input.attr('directory', that.directory);\n }\n input.attr('multiple', that._supportsMultiple() ? that.multiple : false).attr('autocomplete', 'off').on('click' + NS, function (e) {\n if (wrapper.hasClass('k-state-disabled')) {\n e.preventDefault();\n }\n }).on('focus' + NS, function () {\n $(this).parent().addClass('k-state-focused');\n }).on('blur' + NS, function () {\n $(this).parent().removeClass('k-state-focused');\n }).on('change' + NS, $.proxy(that._onInputChange, that)).on('keydown' + NS, $.proxy(that._onInputKeyDown, that));\n },\n _onInputKeyDown: function (e) {\n var that = this;\n var firstButton = that.wrapper.find('.k-upload-action:visible:first');\n if (e.keyCode === kendo.keys.TAB && firstButton.length > 0 && !e.shiftKey) {\n e.preventDefault();\n firstButton.focus();\n }\n },\n _onInputChange: function (e) {\n var that = this;\n var input = $(e.target);\n var files = assignGuidToFiles(that._inputFiles(input), that._isAsyncNonBatch());\n validateFiles(files, that.options.validation);\n var prevented = that.trigger(SELECT, { files: files });\n if (prevented) {\n that._addInput(input);\n input.remove();\n } else {\n that._module.onSelect({ target: input }, files);\n }\n },\n _readDirectory: function (item) {\n var deferred = new $.Deferred();\n var dirReader = item.createReader();\n var allFolderFiles = [];\n var readEntries = function () {\n dirReader.readEntries(function (entries) {\n if (!entries.length) {\n deferred.resolve(allFolderFiles);\n } else {\n allFolderFiles = allFolderFiles.concat(entries);\n readEntries();\n }\n }, deferred.reject);\n };\n readEntries();\n return deferred.promise();\n },\n _readFile: function (item) {\n var that = this;\n var fullpath = item.fullPath;\n item.file(function (file) {\n file.relativePath = fullpath.slice(1);\n that.droppedFolderFiles.push(file);\n that.droppedFolderCounter--;\n if (that.droppedFolderCounter === 0) {\n setTimeout(function () {\n if (that.droppedFolderCounter === 0) {\n if (that.droppedFolderFiles.length) {\n that._proceedDroppedItems(that.droppedFolderFiles);\n that.droppedFolderFiles = [];\n }\n }\n }, 0);\n }\n }, function () {\n logToConsole('File error.');\n });\n },\n _traverseFileTree: function (item, skipCounter) {\n var that = this;\n if (!skipCounter) {\n that.droppedFolderCounter--;\n }\n this._readDirectory(item).then(function (items) {\n that.droppedFolderCounter += items.length;\n for (var i = 0; i < items.length; i++) {\n if (items[i].isFile) {\n that._readFile(items[i]);\n } else if (items[i].isDirectory) {\n that._traverseFileTree(items[i]);\n }\n }\n });\n },\n _onDrop: function (e) {\n var dt = e.originalEvent.dataTransfer;\n var that = this;\n var droppedFiles = dt.files;\n var length;\n stopEvent(e);\n if (that.options.directoryDrop && dt.items) {\n length = dt.items.length;\n that.droppedFolderCounter = 0;\n that.droppedFolderFiles = [];\n for (var i = 0; i < length; i++) {\n if (dt.items[i].webkitGetAsEntry) {\n var entry = dt.items[i].webkitGetAsEntry();\n if (entry.isDirectory) {\n that._traverseFileTree(entry, true);\n } else if (entry.isFile) {\n that.droppedFolderFiles.push(dt.files[i]);\n }\n } else {\n that._proceedDroppedItems(droppedFiles);\n }\n }\n } else {\n that._proceedDroppedItems(droppedFiles);\n }\n },\n _proceedDroppedItems: function (droppedFiles) {\n var that = this;\n var files = assignGuidToFiles(getAllFileInfo(droppedFiles), that._isAsyncNonBatch());\n if (droppedFiles.length > 0 && !that.wrapper.hasClass('k-state-disabled')) {\n if (!that.multiple && files.length > 1) {\n files.splice(1, files.length - 1);\n }\n validateFiles(files, that.options.validation);\n var prevented = that.trigger(SELECT, { files: files });\n if (!prevented) {\n that._module.onSelect({ target: $('.k-dropzone', that.wrapper) }, files);\n }\n }\n },\n _filesContainValidationErrors: function (files) {\n var hasErrors = false;\n $(files).each(function (index, file) {\n if (file[VALIDATIONERRORS] && file[VALIDATIONERRORS].length > 0) {\n hasErrors = true;\n return false;\n }\n });\n return hasErrors;\n },\n _isAsyncNonBatch: function () {\n return this._async && !this.options.async.batch || false;\n },\n _renderInitialFiles: function (files) {\n var that = this;\n var idx = 0;\n files = assignGuidToFiles(files, true);\n for (idx = 0; idx < files.length; idx++) {\n var currentFile = files[idx];\n var fileEntry = that._enqueueFile(currentFile.name, { fileNames: [currentFile] });\n fileEntry.addClass('k-file-success').data('files', [files[idx]]);\n if (that._supportsRemove()) {\n that._fileAction(fileEntry, REMOVE);\n }\n }\n },\n _prepareTemplateData: function (name, data) {\n var filesData = data.fileNames, templateData = {}, totalSize = 0, idx = 0;\n for (idx = 0; idx < filesData.length; idx++) {\n totalSize += filesData[idx].size;\n }\n templateData.name = name;\n templateData.size = totalSize;\n templateData.files = data.fileNames;\n return templateData;\n },\n _prepareDefaultSingleFileEntryTemplate: function (data) {\n var that = this;\n var file = data.fileNames[0];\n var fileSize = getTotalFilesSizeMessage(data.fileNames);\n var fileGroup = kendo.getFileGroup(file.extension, true);\n var errors = file[VALIDATIONERRORS];\n var template = '';\n if (errors && errors.length > 0) {\n template += '
  • ' + '' + '' + '' + '' + '' + '' + file.name + '' + '' + that.localization[errors[0]] + '' + '';\n } else {\n template += '
  • ' + '' + '' + '' + '' + '' + file.name + '' + '' + fileSize + '';\n }\n template += '';\n return $(template);\n },\n _prepareDefaultMultipleFileEntriesTemplate: function (data) {\n var that = this;\n var files = data.fileNames;\n var filesHaveValidationErrors = that._filesContainValidationErrors(files);\n var totalFileSize = getTotalFilesSizeMessage(files);\n var template = '';\n var i, currentFile;\n if (filesHaveValidationErrors) {\n template += '
  • ' + '' + '';\n } else {\n template += '
  • ' + '' + '';\n }\n template += '';\n files.sort(function (a, b) {\n if (a[VALIDATIONERRORS]) {\n return -1;\n }\n if (b[VALIDATIONERRORS]) {\n return 1;\n }\n return 0;\n });\n template += '';\n for (i = 0; i < files.length; i++) {\n currentFile = files[i];\n var fileSize = getTotalFilesSizeMessage([currentFile]);\n template += '';\n if (currentFile[VALIDATIONERRORS] && currentFile[VALIDATIONERRORS].length > 0) {\n template += '' + currentFile.name + '';\n } else {\n template += '' + currentFile.name + '';\n }\n template += '' + fileSize + '';\n }\n if (filesHaveValidationErrors) {\n template += '' + that.localization.invalidFiles + '';\n } else {\n template += 'Total: ' + files.length + ' files, ' + totalFileSize + '';\n }\n template += '';\n return $(template);\n },\n _enqueueFile: function (name, data) {\n var that = this;\n var existingFileEntries;\n var fileEntry;\n var fileUid = data.fileNames[0].uid;\n var fileList = $('.k-upload-files', that.wrapper);\n var options = that.options;\n var template = options.template;\n var templateData;\n var removeEventArgs;\n if (fileList.length === 0) {\n fileList = $('').appendTo(that.wrapper);\n if (!that.options.showFileList) {\n fileList.hide();\n }\n that.wrapper.removeClass('k-upload-empty');\n }\n existingFileEntries = $('.k-file', fileList);\n if (!template) {\n if (data.fileNames.length === 1) {\n fileEntry = that._prepareDefaultSingleFileEntryTemplate(data);\n } else {\n fileEntry = that._prepareDefaultMultipleFileEntriesTemplate(data);\n }\n } else {\n templateData = that._prepareTemplateData(name, data);\n template = kendo.template(template);\n fileEntry = $('
  • ' + template(templateData) + '
  • ');\n fileEntry.find('.k-upload-action').addClass('k-button k-button-icon k-flat');\n that.angular('compile', function () {\n return {\n elements: fileEntry,\n data: [templateData]\n };\n });\n }\n fileEntry.attr(kendo.attr('uid'), fileUid).appendTo(fileList).data(data);\n if (!that._async) {\n $('.k-progress', fileEntry).width('100%');\n }\n if (!that.multiple && existingFileEntries.length > 0) {\n removeEventArgs = {\n files: existingFileEntries.data('fileNames'),\n headers: {}\n };\n if (!that.trigger(REMOVE, removeEventArgs)) {\n that._module.onRemove({ target: $(existingFileEntries, that.wrapper) }, removeEventArgs);\n }\n }\n return fileEntry;\n },\n _removeFileEntry: function (fileEntry) {\n var that = this;\n var fileList = fileEntry.closest('.k-upload-files');\n var allFiles, allCompletedFiles, allInvalidFiles;\n fileEntry.remove();\n allFiles = $('.k-file', fileList);\n allCompletedFiles = $('.k-file-success, .k-file-error', fileList);\n allInvalidFiles = $('.k-file-invalid', fileList);\n if (allCompletedFiles.length === allFiles.length || allInvalidFiles.length === allFiles.length) {\n this._hideActionButtons();\n }\n if (allFiles.length === 0) {\n fileList.remove();\n that.wrapper.addClass('k-upload-empty');\n that._hideHeaderUploadstatus();\n } else {\n that._updateHeaderUploadStatus();\n }\n },\n _fileAction: function (fileElement, actionKey, skipClear) {\n var classDictionary = {\n remove: 'k-i-x',\n cancel: 'k-i-cancel',\n retry: 'k-i-retry',\n pause: 'k-i-pause-sm'\n };\n var iconsClassDictionary = {\n remove: 'k-i-close',\n cancel: 'k-i-cancel',\n retry: 'k-i-reload-sm',\n pause: 'k-i-pause-sm'\n };\n var firstActionButton;\n if (!classDictionary.hasOwnProperty(actionKey)) {\n return;\n }\n if (!skipClear) {\n this._clearFileAction(fileElement);\n }\n if (!this.options.template) {\n if (!skipClear) {\n fileElement.find('.k-upload-status .k-upload-action').remove();\n }\n fileElement.find('.k-upload-status').append(this._renderAction(classDictionary[actionKey], this.localization[actionKey], iconsClassDictionary[actionKey]));\n } else {\n firstActionButton = fileElement.find('.k-upload-action').first();\n if (!firstActionButton.find('.k-icon').length) {\n firstActionButton.addClass('k-button').append('').show();\n } else if (firstActionButton.next('.k-upload-action').length) {\n firstActionButton.next('.k-upload-action').addClass('k-button').append('').show();\n }\n }\n },\n _fileState: function (fileEntry, stateKey) {\n var localization = this.localization, states = {\n uploading: { text: localization.statusUploading },\n uploaded: { text: localization.statusUploaded },\n failed: { text: localization.statusFailed }\n }, currentState = states[stateKey];\n if (currentState) {\n $('span.k-file-state', fileEntry).text(currentState.text);\n }\n },\n _renderAction: function (actionClass, actionText, iconClass) {\n if (actionClass !== '') {\n return $('').on('focus', function () {\n $(this).addClass('k-state-focused');\n }).on('blur', function () {\n $(this).removeClass('k-state-focused');\n });\n } else {\n return $('');\n }\n },\n _clearFileAction: function (fileElement) {\n $('.k-upload-action', fileElement).empty().hide();\n },\n _onFileAction: function (e) {\n var that = this;\n if (!that.wrapper.hasClass('k-state-disabled')) {\n var button = $(e.target).closest('.k-upload-action');\n var icon = button.find('.k-icon');\n var fileEntry = button.closest('.k-file');\n var files = fileEntry.data('fileNames');\n var hasValidationErrors = that._filesContainValidationErrors(files);\n var eventArgs = {\n files: files,\n headers: {}\n };\n that._retryClicked = false;\n if (icon.hasClass('k-i-x')) {\n if (!that.trigger(REMOVE, eventArgs)) {\n that._module.onRemove({ target: $(fileEntry, that.wrapper) }, eventArgs, !hasValidationErrors);\n }\n } else if (icon.hasClass('k-i-cancel')) {\n that.trigger(CANCEL, eventArgs);\n that._module.onCancel({ target: $(fileEntry, that.wrapper) });\n that._checkAllComplete();\n that._updateHeaderUploadStatus();\n } else if (icon.hasClass('k-i-pause-sm')) {\n that.trigger(PAUSE, eventArgs);\n that.pause(fileEntry);\n that._updateHeaderUploadStatus();\n } else if (icon.hasClass('k-i-play-sm')) {\n that.trigger(RESUME, eventArgs);\n that.resume(fileEntry);\n } else if (icon.hasClass('k-i-retry')) {\n $('.k-i-warning', fileEntry).remove();\n $('.k-progressbar', fileEntry).finish().show();\n that._module.onRetry({ target: $(fileEntry, that.wrapper) });\n that._retryClicked = true;\n }\n }\n return false;\n },\n _onUploadSelected: function () {\n var that = this;\n var wrapper = that.wrapper;\n if (!wrapper.hasClass('k-state-disabled')) {\n this._module.onSaveSelected();\n }\n return false;\n },\n _onClearSelected: function () {\n var that = this;\n var wrapper = that.wrapper;\n var clearEventArgs = {};\n if (!wrapper.hasClass('k-state-disabled') && !that.trigger(CLEAR, clearEventArgs)) {\n that.clearAllFiles();\n }\n return false;\n },\n _onFileProgress: function (e, percentComplete) {\n var progressPct;\n if (percentComplete > 100) {\n percentComplete = 100;\n }\n $('.k-progressbar', e.target).removeClass('k-hidden');\n if (!this.options.template) {\n progressPct = $('.k-upload-pct', e.target);\n if (progressPct.length === 0) {\n $('.k-upload-status', e.target).prepend('');\n }\n if (percentComplete !== 100) {\n $('.k-upload-pct', e.target).text(percentComplete + '%');\n } else {\n $('.k-upload-pct', e.target).remove();\n }\n $('.k-progress', e.target).width(percentComplete + '%');\n } else {\n $('.k-progress', e.target).width(percentComplete + '%');\n }\n this.trigger(PROGRESS, {\n files: getFileEntry(e).data('fileNames'),\n percentComplete: percentComplete\n });\n },\n _onUploadSuccess: function (e, response, xhr) {\n var that = this;\n var fileEntry = getFileEntry(e);\n var files = fileEntry.data('fileNames');\n var fileInfo = fileEntry.find('.k-file-information');\n var fileSize = fileEntry.find('.k-file-size');\n var prevented = that.trigger(SUCCESS, {\n files: fileEntry.data('fileNames'),\n response: response,\n operation: 'upload',\n XMLHttpRequest: xhr\n });\n if (prevented) {\n that._setUploadErrorState(fileEntry);\n } else {\n that._fileState(fileEntry, 'uploaded');\n fileEntry.removeClass('k-file-progress').addClass('k-file-success');\n if (fileInfo.length > 0) {\n fileInfo.addClass('k-hidden').after('' + files.length + ' ' + that.localization.uploadSuccess + '');\n } else if (fileSize.length > 0) {\n fileSize.addClass('k-hidden').after('' + that.localization.uploadSuccess + '');\n }\n that._updateHeaderUploadStatus();\n if (that._supportsRemove()) {\n that._fileAction(fileEntry, REMOVE);\n } else {\n that._clearFileAction(fileEntry);\n }\n }\n that._hideUploadProgress(fileEntry);\n that._checkAllComplete();\n },\n _onUploadError: function (e, xhr) {\n var that = this;\n var module = that._module;\n var fileEntry = getFileEntry(e);\n var fileUid = fileEntry.data('uid');\n that._setUploadErrorState(fileEntry);\n that.trigger(ERROR, {\n operation: 'upload',\n files: fileEntry.data('fileNames'),\n XMLHttpRequest: xhr\n });\n logToConsole('Server response: ' + xhr.responseText);\n if (!that.options.async.chunkSize) {\n that._hideUploadProgress(fileEntry);\n } else {\n if (module._decreasePosition) {\n module._decreasePosition(fileUid);\n }\n }\n that._checkAllComplete();\n if (this.options.async.autoRetryAfter) {\n this._autoRetryAfter(fileEntry);\n }\n },\n _autoRetryAfter: function (fileEntry) {\n var that = this;\n var retries = this._module.retries;\n if (!retries) {\n return;\n }\n if (!retries[fileEntry.data('uid')]) {\n retries[fileEntry.data('uid')] = 1;\n }\n if (retries[fileEntry.data('uid')] <= this.options.async.maxAutoRetries) {\n retries[fileEntry.data('uid')]++;\n setTimeout(function () {\n that._module.performUpload(fileEntry);\n }, this.options.async.autoRetryAfter);\n }\n },\n _setUploadErrorState: function (fileEntry) {\n var that = this, uploadPercentage, files = fileEntry.data('fileNames'), fileInfo = fileEntry.find('.k-file-information'), fileSize = fileEntry.find('.k-file-size');\n that._fileState(fileEntry, 'failed');\n fileEntry.removeClass('k-file-progress').addClass('k-file-error');\n if (fileInfo.length > 0) {\n fileInfo.addClass('k-hidden').after('' + files.length + ' ' + that.localization.uploadFail + '');\n } else if (fileSize.length > 0) {\n fileSize.addClass('k-hidden').after('' + that.localization.uploadFail + '');\n }\n that._updateUploadProgress(fileEntry);\n uploadPercentage = $('.k-upload-pct', fileEntry);\n if (uploadPercentage.length > 0) {\n uploadPercentage.remove();\n }\n this._updateHeaderUploadStatus();\n this._fileAction(fileEntry, 'retry');\n this._fileAction(fileEntry, REMOVE, true);\n if (that._retryClicked) {\n fileEntry.find('.k-i-retry').parent().focus();\n }\n },\n _updateUploadProgress: function (fileEntry) {\n var that = this;\n if (!that.options.async.chunkSize) {\n $('.k-progress', fileEntry).width('100%');\n } else {\n var fileUid = fileEntry.data('uid');\n if (that._module.metaData) {\n var fileMetaData = that._module.metaData[fileUid];\n if (fileMetaData) {\n var percentComplete = fileMetaData.totalChunks ? Math.round(fileMetaData.chunkIndex / fileMetaData.totalChunks * 100) : 100;\n that._onFileProgress({ target: $(fileEntry, that.wrapper) }, percentComplete);\n }\n }\n }\n },\n _hideUploadProgress: function (fileEntry) {\n $('.k-progressbar', fileEntry).delay(PROGRESSHIDEDELAY).fadeOut(PROGRESSHIDEDURATION, function () {\n $(this).find('.k-progress').css('width', '0%');\n });\n },\n _showActionButtons: function () {\n var that = this;\n var actionsWrapper = $('.k-action-buttons', that.wrapper);\n var uploadButton = $('.k-upload-selected', that.wrapper);\n var clearButton = $('.k-clear-selected', that.wrapper);\n if (uploadButton.length === 0) {\n uploadButton = that._renderAction('', this.localization.uploadSelectedFiles).addClass('k-upload-selected').addClass('k-primary');\n clearButton = that._renderAction('', this.localization.clearSelectedFiles).addClass('k-clear-selected');\n }\n if (!actionsWrapper.length) {\n actionsWrapper = $('
    ').addClass('k-action-buttons').append(clearButton, uploadButton);\n }\n this.wrapper.append(actionsWrapper);\n },\n _hideActionButtons: function () {\n $('.k-action-buttons', this.wrapper).remove();\n },\n _showHeaderUploadStatus: function (isUploading) {\n var that = this;\n var localization = that.localization;\n var dropZone = $('.k-dropzone', that.wrapper);\n var headerUploadStatus = $('.k-upload-status-total', that.wrapper);\n if (headerUploadStatus.length !== 0) {\n headerUploadStatus.remove();\n }\n $('.k-dropzone-hint', that.wrapper).addClass('k-hidden');\n headerUploadStatus = '';\n if (isUploading) {\n headerUploadStatus = $(headerUploadStatus).append(localization.headerStatusUploading);\n headerUploadStatus.find('.k-icon').addClass(headerStatusIcon.loading);\n } else {\n headerUploadStatus = $(headerUploadStatus).append(localization.headerStatusUploaded);\n headerUploadStatus.find('.k-icon').addClass(headerStatusIcon.warning);\n }\n if (dropZone.length > 0) {\n dropZone.append(headerUploadStatus);\n } else {\n $('.k-upload-button', that.wrapper).after(headerUploadStatus);\n }\n },\n _updateHeaderUploadStatus: function () {\n var that = this;\n var headerUploadStatus = $('.k-upload-status-total', this.wrapper);\n var currentlyUploading = $('.k-file', that.wrapper).not('.k-file-success, .k-file-error, .k-file-invalid');\n var currentlyInvalid = $('.k-file-invalid', that.wrapper);\n var currentlyFailed = $('.k-file-error', that.wrapper);\n var currentlyPaused = $('.k-file', that.wrapper).find('.k-i-play-sm');\n var failedUploads, headerUploadStatusIcon;\n if (currentlyPaused.length && (currentlyPaused.length === currentlyUploading.length || !that.options.async.concurrent)) {\n headerUploadStatusIcon = $('.k-icon', headerUploadStatus).removeClass().addClass('k-icon').addClass('k-i-pause-sm');\n headerUploadStatus.html(headerUploadStatusIcon).append(that.localization.headerStatusPaused);\n } else if (currentlyUploading.length === 0 || currentlyInvalid.length > 0 || currentlyFailed.length > 0) {\n failedUploads = $('.k-file.k-file-error, .k-file.k-file-invalid', that.wrapper);\n headerUploadStatus = $('.k-upload-status-total', that.wrapper);\n headerUploadStatusIcon = $('.k-icon', headerUploadStatus).removeClass().addClass('k-icon').addClass(failedUploads.length !== 0 ? headerStatusIcon.warning : headerStatusIcon.success);\n headerUploadStatus.html(headerUploadStatusIcon).append(that.localization.headerStatusUploaded);\n }\n },\n _hideHeaderUploadstatus: function () {\n var that = this, dropZone = that.options.dropZone;\n $('.k-upload-status-total', this.wrapper).remove();\n if (dropZone === '') {\n $('.k-dropzone-hint', that.wrapper).removeClass('k-hidden');\n }\n },\n _onParentFormSubmit: function () {\n var upload = this, element = upload.element;\n if (typeof this._module.onAbort !== 'undefined') {\n this._module.onAbort();\n }\n if (!element.value) {\n var input = $(element);\n input.attr('disabled', 'disabled');\n window.setTimeout(function () {\n input.removeAttr('disabled');\n }, 0);\n }\n },\n _onParentFormReset: function () {\n $('.k-upload-files', this.wrapper).remove();\n },\n _supportsFormData: function () {\n return typeof FormData != 'undefined';\n },\n _supportsMultiple: function () {\n var windows = this._userAgent().indexOf('Windows') > -1;\n return !kendo.support.browser.opera && !(kendo.support.browser.safari && windows);\n },\n _supportsDrop: function () {\n var userAgent = this._userAgent().toLowerCase();\n var isChrome = /chrome/.test(userAgent);\n var isSafari = !isChrome && /safari/.test(userAgent);\n var isWindowsSafari = isSafari && /windows/.test(userAgent);\n return !isWindowsSafari && this._supportsFormData() && this.options.async.saveUrl;\n },\n _userAgent: function () {\n return navigator.userAgent;\n },\n _setupDropZone: function () {\n var that = this;\n var ns = that._ns;\n var dropZone = $('.k-dropzone', that.wrapper).on('dragenter' + ns, stopEvent).on('dragover' + ns, function (e) {\n e.preventDefault();\n }).on('drop' + ns, $.proxy(that._onDrop, that));\n if (!dropZone.find('.k-dropzone-hint').length) {\n dropZone.append($('' + that.localization.dropFilesHere + ''));\n }\n bindDragEventWrappers(dropZone, ns, function () {\n if (!dropZone.closest('.k-upload').hasClass('k-state-disabled')) {\n dropZone.addClass('k-dropzone-hovered');\n }\n }, function () {\n dropZone.removeClass('k-dropzone-hovered');\n });\n that._bindDocumentDragEventWrappers(dropZone);\n },\n _setupCustomDropZone: function () {\n var that = this;\n var dropZone = $(that.options.dropZone);\n if (!that.wrapper.find('.k-dropzone-hint').length) {\n $('.k-dropzone', that.wrapper).append($('' + that.localization.dropFilesHere + ''));\n } else {\n $('.k-dropzone-hint', that.wrapper).addClass('k-hidden');\n }\n var ns = that._ns;\n dropZone.on('dragenter' + ns, stopEvent).on('dragover' + ns, function (e) {\n e.preventDefault();\n }).on('drop' + ns, $.proxy(that._onDrop, that));\n bindDragEventWrappers(dropZone, ns, function (e) {\n if (!that.wrapper.hasClass('k-state-disabled')) {\n dropZone.removeClass('k-dropzone-hovered');\n dropZone.addClass('k-dropzone-hovered');\n $(e.target).addClass('k-dropzone-hovered');\n }\n }, function () {\n dropZone.removeClass('k-dropzone-hovered');\n dropZone.find('.k-dropzone-hovered').removeClass('k-dropzone-hovered');\n });\n that._bindDocumentDragEventWrappers(dropZone);\n },\n _bindDocumentDragEventWrappers: function (dropZone) {\n var that = this;\n var ns = that._ns;\n bindDragEventWrappers($(document), ns, function () {\n if (!that.wrapper.hasClass('k-state-disabled')) {\n dropZone.addClass('k-dropzone-active');\n dropZone.closest('.k-upload').removeClass('k-upload-empty');\n dropZone.find('.k-dropzone-hint').removeClass('k-hidden');\n }\n }, function () {\n dropZone.removeClass('k-dropzone-active');\n dropZone.find('.k-dropzone-hint').addClass('k-hidden');\n if ($('li.k-file', dropZone.closest('.k-upload')).length === 0) {\n dropZone.closest('.k-upload').addClass('k-upload-empty');\n }\n });\n },\n _toggleDropZone: function () {\n var that = this, dropZone = that.options.dropZone;\n if (!that._supportsDrop()) {\n return;\n }\n $(dropZone).off(that._ns);\n $('.k-dropzone', that.wrapper).off(that._ns);\n if (dropZone !== '') {\n that._setupCustomDropZone();\n } else {\n that._setupDropZone();\n }\n },\n _supportsRemove: function () {\n return !!this.options.async.removeUrl;\n },\n _submitRemove: function (fileNames, eventArgs, onSuccess, onError) {\n var upload = this, removeField = upload.options.async.removeField || 'fileNames', params = $.extend(eventArgs.data, antiForgeryTokens());\n params[removeField] = fileNames;\n jQuery.ajax({\n type: this.options.async.removeVerb,\n dataType: 'json',\n dataFilter: normalizeJSON,\n url: this.options.async.removeUrl,\n traditional: true,\n data: params,\n headers: eventArgs.headers,\n success: onSuccess,\n error: onError,\n xhrFields: { withCredentials: this.options.async.withCredentials }\n });\n },\n _wrapInput: function (input) {\n var that = this;\n var options = that.options;\n input.wrap('
    ');\n if (!options.async.saveUrl) {\n input.closest('.k-upload').addClass('k-upload-sync');\n } else {\n input.closest('.k-upload').addClass('k-upload-async');\n }\n input.closest('.k-upload').addClass('k-upload-empty');\n input.closest('.k-button').append('' + this.localization.select + '');\n return input.closest('.k-upload');\n },\n _checkAllComplete: function () {\n if ($('.k-file.k-file-progress', this.wrapper).length === 0) {\n this.trigger(COMPLETE);\n }\n },\n _inputFiles: function (sourceInput) {\n return inputFiles(sourceInput);\n }\n });\n var syncUploadModule = function (upload) {\n this.name = 'syncUploadModule';\n this.element = upload.wrapper;\n this.upload = upload;\n this.element.closest('form').attr('enctype', 'multipart/form-data').attr('encoding', 'multipart/form-data');\n };\n syncUploadModule.prototype = {\n onSelect: function (e, files) {\n var upload = this.upload;\n var sourceInput = $(e.target);\n var filesContainErrors = upload._filesContainValidationErrors(files);\n upload._addInput(sourceInput);\n var fileData = { 'fileNames': files };\n if (filesContainErrors) {\n sourceInput.remove();\n } else {\n fileData.relatedInput = sourceInput;\n }\n var file = upload._enqueueFile(getFileName(sourceInput), fileData);\n if (filesContainErrors) {\n upload._hideUploadProgress(file);\n }\n upload._fileAction(file, REMOVE);\n },\n onRemove: function (e) {\n var fileEntry = getFileEntry(e);\n var relatedInput = fileEntry.data('relatedInput');\n if (relatedInput) {\n relatedInput.remove();\n }\n this.upload._removeFileEntry(fileEntry);\n }\n };\n var iframeUploadModule = function (upload) {\n this.name = 'iframeUploadModule';\n this.element = upload.wrapper;\n this.upload = upload;\n this.iframes = [];\n };\n Upload._frameId = 0;\n iframeUploadModule.prototype = {\n onSelect: function (e, files) {\n var upload = this.upload;\n var sourceInput = $(e.target);\n var hasValidationErrors = upload._filesContainValidationErrors(files);\n var fileEntry = this.prepareUpload(sourceInput, files, hasValidationErrors);\n if (upload.options.async.autoUpload) {\n if (!hasValidationErrors) {\n this.performUpload(fileEntry);\n } else {\n upload._fileAction(fileEntry, REMOVE);\n upload._showHeaderUploadStatus(false);\n }\n } else {\n upload._fileAction(fileEntry, REMOVE);\n if (!hasValidationErrors) {\n upload._showActionButtons();\n } else {\n upload._updateHeaderUploadStatus();\n }\n }\n if (hasValidationErrors) {\n upload._hideUploadProgress(fileEntry);\n }\n },\n prepareUpload: function (sourceInput, files, hasValidationErrors) {\n var upload = this.upload;\n var activeInput = $(upload.element);\n var name = upload.options.async.saveField || sourceInput.attr('name');\n var fileEntry, fileData, iframe, form;\n upload._addInput(sourceInput);\n sourceInput.attr('name', name);\n if (!hasValidationErrors) {\n iframe = this.createFrame(upload.name + '_' + Upload._frameId++);\n this.registerFrame(iframe);\n form = this.createForm(upload.options.async.saveUrl, iframe.attr('name')).append(activeInput);\n fileData = {\n 'frame': iframe,\n 'relatedInput': activeInput,\n 'fileNames': files\n };\n } else {\n sourceInput.remove();\n fileData = { 'fileNames': files };\n }\n fileEntry = upload._enqueueFile(getFileName(sourceInput), fileData);\n if (iframe) {\n iframe.data({\n 'form': form,\n 'file': fileEntry\n });\n }\n return fileEntry;\n },\n performUpload: function (fileEntry) {\n var e = { files: fileEntry.data('fileNames') };\n var iframe = fileEntry.data('frame');\n var upload = this.upload;\n var fileValidation = fileEntry.find('.k-file-validation-message');\n var fileInfo = fileEntry.find('.k-file-information');\n var fileSize = fileEntry.find('.k-file-size');\n if (!upload.trigger(UPLOAD, e)) {\n upload._hideActionButtons();\n upload._showHeaderUploadStatus(true);\n iframe.appendTo(document.body);\n var form = iframe.data('form').attr('action', upload.options.async.saveUrl).appendTo(document.body);\n e.data = $.extend({}, e.data, antiForgeryTokens());\n for (var key in e.data) {\n var dataInput = form.find('input[name=\\'' + key + '\\']');\n if (dataInput.length === 0) {\n dataInput = $('', {\n type: 'hidden',\n name: key\n }).prependTo(form);\n }\n dataInput.val(e.data[key]);\n }\n upload._fileAction(fileEntry, CANCEL);\n upload._fileState(fileEntry, 'uploading');\n $(fileEntry).removeClass('k-file-error').addClass('k-file-progress');\n if (fileValidation.length > 0) {\n fileValidation.remove();\n }\n if (fileInfo.length > 0) {\n fileInfo.removeClass('k-hidden');\n } else if (fileSize.length > 0) {\n fileSize.removeClass('k-hidden');\n }\n iframe.one('load', $.proxy(this.onIframeLoad, this));\n form[0].submit();\n } else {\n upload._removeFileEntry(iframe.data('file'));\n this.cleanupFrame(iframe);\n this.unregisterFrame(iframe);\n }\n },\n onSaveSelected: function () {\n var module = this;\n var upload = module.upload;\n $('.k-file', this.element).each(function () {\n var fileEntry = $(this);\n var started = isFileUploadStarted(fileEntry);\n var hasValidationErrors = upload._filesContainValidationErrors(fileEntry.data('fileNames'));\n if (!started && !hasValidationErrors) {\n module.performUpload(fileEntry);\n }\n });\n },\n onIframeLoad: function (e) {\n var iframe = $(e.target), responseText;\n try {\n responseText = iframe.contents().text();\n } catch (ex) {\n responseText = 'Error trying to get server response: ' + ex;\n }\n this.processResponse(iframe, responseText);\n },\n processResponse: function (iframe, responseText) {\n var fileEntry = iframe.data('file'), module = this, fakeXHR = { responseText: responseText };\n tryParseJSON(responseText, function (jsonResult) {\n $.extend(fakeXHR, {\n statusText: 'OK',\n status: '200'\n });\n module.upload._onFileProgress({ target: $(fileEntry, module.upload.wrapper) }, 100);\n module.upload._onUploadSuccess({ target: $(fileEntry, module.upload.wrapper) }, jsonResult, fakeXHR);\n module.cleanupFrame(iframe);\n module.unregisterFrame(iframe);\n }, function () {\n $.extend(fakeXHR, {\n statusText: 'error',\n status: '500'\n });\n module.upload._onUploadError({ target: $(fileEntry, module.upload.wrapper) }, fakeXHR);\n });\n },\n onCancel: function (e) {\n var iframe = $(e.target).data('frame');\n this.stopFrameSubmit(iframe);\n this.cleanupFrame(iframe);\n this.unregisterFrame(iframe);\n this.upload._removeFileEntry(iframe.data('file'));\n },\n onRetry: function (e) {\n var fileEntry = getFileEntry(e);\n this.performUpload(fileEntry);\n },\n onRemove: function (e, eventArgs, shouldSendRemoveRequest) {\n var module = this;\n var upload = module.upload;\n var fileEntry = getFileEntry(e);\n var iframe = fileEntry.data('frame');\n if (iframe) {\n module.unregisterFrame(iframe);\n upload._removeFileEntry(fileEntry);\n module.cleanupFrame(iframe);\n } else {\n if (fileEntry.hasClass('k-file-success')) {\n removeUploadedFile(fileEntry, upload, eventArgs, shouldSendRemoveRequest);\n } else {\n upload._removeFileEntry(fileEntry);\n }\n }\n },\n onAbort: function () {\n var element = this.element, module = this;\n $.each(this.iframes, function () {\n $('input', this.data('form')).appendTo(element);\n module.stopFrameSubmit(this[0]);\n this.data('form').remove();\n this.remove();\n });\n this.iframes = [];\n },\n createFrame: function (id) {\n return $('');\n },\n createForm: function (action, target) {\n return $('
    ');\n },\n stopFrameSubmit: function (frame) {\n if (typeof frame.stop != 'undefined') {\n frame.stop();\n } else if (frame.document) {\n frame.document.execCommand('Stop');\n }\n },\n registerFrame: function (frame) {\n this.iframes.push(frame);\n },\n unregisterFrame: function (frame) {\n this.iframes = $.grep(this.iframes, function (value) {\n return value.attr('name') != frame.attr('name');\n });\n },\n cleanupFrame: function (frame) {\n var form = frame.data('form');\n frame.data('file').data('frame', null);\n setTimeout(function () {\n form.remove();\n frame.remove();\n }, 1);\n }\n };\n var formDataUploadModule = function (upload) {\n this.name = 'formDataUploadModule';\n this.element = upload.wrapper;\n this.upload = upload;\n this.position = {};\n this.metaData = {};\n this.cancelled = {};\n this.resume = {};\n this.paused = {};\n this.retries = {};\n };\n formDataUploadModule.prototype = {\n onSelect: function (e, files) {\n var upload = this.upload;\n var module = this;\n var sourceElement = $(e.target);\n var fileEntries = this.prepareUpload(sourceElement, files);\n var hasValidationErrors;\n var prev;\n $.each(fileEntries, function (index) {\n hasValidationErrors = upload._filesContainValidationErrors($(this.data('fileNames')));\n if (upload.options.async.autoUpload) {\n if (!hasValidationErrors) {\n if (upload.options.async.chunkSize) {\n module.prepareChunk(this);\n prev = this.prev();\n if (upload.options.async.concurrent || index === 0 && !prev.length || index === 0 && prev.hasClass('k-file-success')) {\n module.performUpload(this);\n }\n } else {\n module.performUpload(this);\n }\n } else {\n upload._fileAction(this, REMOVE);\n upload._showHeaderUploadStatus(false);\n }\n } else {\n upload._fileAction(this, REMOVE);\n if (!hasValidationErrors) {\n upload._showActionButtons();\n this.addClass('k-toupload');\n } else {\n upload._updateHeaderUploadStatus();\n }\n }\n if (hasValidationErrors) {\n upload._hideUploadProgress(this);\n }\n });\n },\n prepareUpload: function (sourceElement, files) {\n var fileEntries = this.enqueueFiles(files);\n if (sourceElement.is('input')) {\n $.each(fileEntries, function () {\n $(this).data('relatedInput', sourceElement);\n });\n sourceElement.data('relatedFileEntries', fileEntries);\n this.upload._addInput(sourceElement);\n }\n return fileEntries;\n },\n enqueueFiles: function (files) {\n var upload = this.upload;\n var name;\n var i;\n var filesLength = files.length;\n var currentFile;\n var fileEntry;\n var fileEntries = [];\n if (upload.options.async.batch === true) {\n name = $.map(files, function (file) {\n return file.name;\n }).join(', ');\n if (upload.directory || upload.options.directoryDrop) {\n $(files).each(function () {\n if (this.rawFile.webkitRelativePath || this.rawFile.relativePath) {\n this.name = this.rawFile.webkitRelativePath || this.rawFile.relativePath;\n }\n });\n }\n fileEntry = upload._enqueueFile(name, { fileNames: files });\n fileEntry.data('files', files);\n fileEntries.push(fileEntry);\n } else {\n for (i = 0; i < filesLength; i++) {\n currentFile = files[i];\n name = currentFile.name;\n if (upload.directory || upload.options.directoryDrop) {\n if (currentFile.rawFile.webkitRelativePath || currentFile.rawFile.relativePath) {\n currentFile.name = currentFile.rawFile.webkitRelativePath || currentFile.rawFile.relativePath;\n }\n }\n fileEntry = upload._enqueueFile(name, { fileNames: [currentFile] });\n fileEntry.data('files', [currentFile]);\n fileEntries.push(fileEntry);\n }\n }\n return fileEntries;\n },\n performUpload: function (fileEntry) {\n var upload = this.upload, formData = this.createFormData(), xhr = this.createXHR(), e = {\n files: fileEntry.data('fileNames'),\n XMLHttpRequest: xhr\n }, files;\n var fileValidation = fileEntry.find('.k-file-validation-message');\n var fileInfo = fileEntry.find('.k-file-information');\n var fileSize = fileEntry.find('.k-file-size');\n if (!upload.trigger(UPLOAD, e)) {\n if (fileEntry.find('.k-i-cancel').length === 0) {\n if (upload.options.async.chunkSize) {\n upload._fileAction(fileEntry, PAUSE);\n }\n upload._fileAction(fileEntry, CANCEL, upload.options.async.chunkSize);\n }\n if (!upload.wrapper.find('.k-toupload').length) {\n upload._hideActionButtons();\n }\n upload._showHeaderUploadStatus(true);\n if (e.formData) {\n formData = e.formData;\n } else {\n e.data = $.extend({}, e.data, antiForgeryTokens());\n for (var key in e.data) {\n formData.append(key, e.data[key]);\n }\n files = fileEntry.data('files');\n if (files) {\n this.populateFormData(formData, files);\n }\n }\n upload._fileState(fileEntry, 'uploading');\n $(fileEntry).removeClass('k-file-error').addClass('k-file-progress');\n if (fileValidation.length > 0) {\n fileValidation.remove();\n }\n if (fileInfo.length > 0) {\n fileInfo.removeClass('k-hidden');\n } else if (fileSize.length > 0) {\n fileSize.removeClass('k-hidden');\n }\n if (upload.options.async.useArrayBuffer && window.FileReader) {\n this._readFile(upload.options.async.saveUrl, formData, fileEntry, xhr);\n } else {\n this.postFormData(upload.options.async.saveUrl, formData, fileEntry, xhr);\n }\n } else {\n this.removeFileEntry(fileEntry);\n }\n },\n _readFile: function (saveUrl, formData, fileEntry, xhr) {\n var that = this;\n var upload = that.upload;\n var file = fileEntry.data('files')[0];\n var reader = new FileReader();\n reader.onload = function (e) {\n try {\n if (!that.fileArrayBuffer) {\n that.fileArrayBuffer = e.target.result;\n } else {\n that.fileArrayBuffer = that._appendBuffer(that.fileArrayBuffer, e.target.result);\n }\n } catch (err) {\n upload._onUploadError({ target: $(fileEntry, upload.wrapper) }, xhr);\n return;\n }\n if (that.position[file.uid] > file.size) {\n that.postFormData(upload.options.async.saveUrl, that.fileArrayBuffer, fileEntry, xhr);\n that.fileArrayBuffer = null;\n } else {\n that._readFile(saveUrl, formData, fileEntry, xhr);\n }\n };\n reader.onerror = function () {\n upload._onUploadError({ target: $(fileEntry, upload.wrapper) }, xhr);\n };\n reader.readAsArrayBuffer(that._getCurrentChunk(file.rawFile, file.uid));\n },\n _appendBuffer: function (buffer1, buffer2) {\n var tmp = new Uint8Array(buffer1.byteLength + buffer2.byteLength);\n tmp.set(new Uint8Array(buffer1), 0);\n tmp.set(new Uint8Array(buffer2), buffer1.byteLength);\n return tmp.buffer;\n },\n onSaveSelected: function () {\n var module = this;\n var upload = module.upload;\n $('.k-toupload', this.element).filter(function () {\n var fileEntry = $(this);\n var started = isFileUploadStarted(fileEntry);\n var hasValidationErrors = upload._filesContainValidationErrors(fileEntry.data('fileNames'));\n return !started && !hasValidationErrors;\n }).each(function (index) {\n var fileEntry = $(this);\n var prevEntry = fileEntry.prev();\n fileEntry.removeClass('k-toupload');\n if (upload.options.async.chunkSize) {\n module.prepareChunk(fileEntry);\n if (upload.options.async.concurrent || index === 0 && !prevEntry.length || (index === 0 && prevEntry.hasClass('k-file-success') || prevEntry.hasClass('k-file-error'))) {\n module.performUpload(fileEntry);\n }\n } else {\n module.performUpload(fileEntry);\n }\n });\n },\n onCancel: function (e) {\n var fileEntry = getFileEntry(e);\n if (this.upload.options.async.chunkSize) {\n this.cancelled[fileEntry.data('uid')] = true;\n }\n this.stopUploadRequest(fileEntry);\n this.removeFileEntry(fileEntry);\n },\n onPause: function (e) {\n var fileEntry = getFileEntry(e);\n var fileUid = fileEntry.data('uid');\n var async = this.upload.options.async;\n if (async.chunkSize) {\n this.retries[fileUid] = async.maxAutoRetries + 1;\n this.paused[fileUid] = true;\n this.resume[fileUid] = false;\n }\n },\n onResume: function (e) {\n var fileEntry = getFileEntry(e);\n var fileUid = fileEntry.data('uid');\n if (this.upload.options.async.chunkSize) {\n delete this.paused[fileUid];\n this.resume[fileUid] = true;\n this.retries[fileEntry.data('uid')] = 1;\n this._increaseChunkIndex(fileUid);\n this.performUpload(fileEntry);\n }\n },\n onRetry: function (e) {\n var fileEntry = getFileEntry(e);\n var async = this.upload.options.async;\n if (async.chunkSize) {\n this.retries[fileEntry.data('uid')] = async.maxAutoRetries + 1;\n delete this.paused[fileEntry.data('uid')];\n }\n this.performUpload(fileEntry);\n },\n onRemove: function (e, eventArgs, shouldSendRemoveRequest) {\n var module = this;\n var upload = module.upload;\n var fileEntry = getFileEntry(e);\n var async = this.upload.options.async;\n if (async.chunkSize) {\n this.retries[fileEntry.data('uid')] = async.maxAutoRetries + 1;\n }\n if (fileEntry.hasClass('k-file-success')) {\n removeUploadedFile(fileEntry, upload, eventArgs, shouldSendRemoveRequest);\n } else {\n module.removeFileEntry(fileEntry);\n }\n },\n createXHR: function () {\n return new XMLHttpRequest();\n },\n postFormData: function (url, data, fileEntry, xhr) {\n var module = this;\n fileEntry.data('request', xhr);\n xhr.addEventListener('load', function (e) {\n module.onRequestSuccess.call(module, e, fileEntry);\n }, false);\n xhr.addEventListener(ERROR, function (e) {\n module.onRequestError.call(module, e, fileEntry);\n }, false);\n xhr.upload.addEventListener('progress', function (e) {\n module.onRequestProgress.call(module, e, fileEntry);\n }, false);\n xhr.open('POST', url, true);\n xhr.withCredentials = this.upload.options.async.withCredentials;\n var accept = this.upload.options.async.accept;\n if (accept) {\n xhr.setRequestHeader('Accept', accept);\n }\n xhr.send(data);\n },\n createFormData: function () {\n return new FormData();\n },\n populateFormData: function (data, files) {\n var chunk;\n var i;\n var length = files.length;\n var uid;\n var upload = this.upload;\n if (upload.options.async.chunkSize) {\n uid = files[0].uid;\n chunk = this._getCurrentChunk(files[0].rawFile, uid);\n data.append(upload.options.async.saveField || upload.name, chunk);\n var serializedMetaData = JSON.stringify(this.metaData[uid]);\n data.append('metadata', serializedMetaData);\n } else {\n for (i = 0; i < length; i++) {\n data.append(upload.options.async.saveField || upload.name, files[i].rawFile);\n }\n }\n return data;\n },\n onRequestSuccess: function (e, fileEntry) {\n var xhr = e.target, module = this;\n function raiseError() {\n module.upload._onUploadError({ target: $(fileEntry, module.upload.wrapper) }, xhr);\n }\n function parseSuccess(jsonResult) {\n var batch = module.upload.options.async.batch;\n var chunkSize = module.upload.options.async.chunkSize;\n var concurrent = module.upload.options.async.concurrent;\n var fileUid = jsonResult.fileUid;\n if (module.paused[fileUid] || module.cancelled[fileUid]) {\n return;\n }\n delete module.retries[fileUid];\n if (chunkSize && !batch && !jsonResult.uploaded) {\n module._increaseChunkIndex(fileUid);\n module.performUpload(fileEntry);\n } else if (chunkSize && !batch && !concurrent && fileEntry.next().length && !fileEntry.next().hasClass('k-toupload')) {\n module.upload._onFileProgress({ target: $(fileEntry, module.upload.wrapper) }, 100);\n module._resetChunkIndex(fileUid);\n module.upload._onUploadSuccess({ target: $(fileEntry, module.upload.wrapper) }, jsonResult, xhr);\n module.performUpload(fileEntry.next());\n } else {\n module.upload._onFileProgress({ target: $(fileEntry, module.upload.wrapper) }, 100);\n module.upload._onUploadSuccess({ target: $(fileEntry, module.upload.wrapper) }, jsonResult, xhr);\n module.cleanupFileEntry(fileEntry);\n }\n }\n if (xhr.status >= 200 && xhr.status <= 299) {\n tryParseJSON(xhr.responseText, parseSuccess, raiseError);\n } else {\n raiseError();\n }\n },\n onRequestError: function (e, fileEntry) {\n var xhr = e.target;\n this.upload._onUploadError({ target: $(fileEntry, this.upload.wrapper) }, xhr);\n },\n cleanupFileEntry: function (fileEntry) {\n var relatedInput = fileEntry.data('relatedInput'), uploadComplete = true;\n if (relatedInput) {\n $.each(relatedInput.data('relatedFileEntries') || [], function () {\n if (this.parent().length > 0 && this[0] != fileEntry[0]) {\n uploadComplete = uploadComplete && this.hasClass('k-file-success');\n }\n });\n if (uploadComplete) {\n relatedInput.remove();\n }\n }\n },\n removeFileEntry: function (fileEntry) {\n var chunkSize = this.upload.options.async.chunkSize;\n var concurrent = this.upload.options.async.concurrent;\n var isUploadButtonVisible = this.upload.wrapper.find('.k-upload-selected').length > 0;\n this.cleanupFileEntry(fileEntry);\n if (chunkSize && !concurrent && !isUploadButtonVisible) {\n if (fileEntry.next().length) {\n this.performUpload(fileEntry.next());\n }\n }\n this.upload._removeFileEntry(fileEntry);\n },\n onRequestProgress: function (e, fileEntry) {\n var percentComplete = Math.round(e.loaded * 100 / e.total);\n var fileUid = fileEntry.data('uid');\n var fileMetaData;\n if (this.upload.options.async.chunkSize) {\n fileMetaData = this.metaData[fileUid];\n percentComplete = fileMetaData && fileMetaData.totalChunks ? Math.round(fileMetaData.chunkIndex / fileMetaData.totalChunks * 100) : 100;\n }\n this.upload._onFileProgress({ target: $(fileEntry, this.upload.wrapper) }, percentComplete);\n },\n stopUploadRequest: function (fileEntry) {\n fileEntry.data('request').abort();\n },\n prepareChunk: function (fileEntry) {\n var file = fileEntry.data('files')[0];\n var rawFile = file.rawFile;\n var uid = file.uid;\n var chunkSize = this.upload.options.async.chunkSize;\n this.position[uid] = 0;\n this.metaData[uid] = {\n chunkIndex: 0,\n contentType: rawFile.type,\n fileName: rawFile.name,\n relativePath: file.name,\n totalFileSize: rawFile.size,\n totalChunks: Math.ceil(rawFile.size / chunkSize),\n uploadUid: uid\n };\n },\n _decreaseChunkIndex: function (uid) {\n this.metaData[uid].chunkIndex--;\n },\n _increaseChunkIndex: function (uid) {\n this.metaData[uid].chunkIndex++;\n },\n _resetChunkIndex: function (uid) {\n this.metaData[uid].chunkIndex = 0;\n },\n _decreasePosition: function (uid) {\n this.position[uid] -= this.upload.options.async.chunkSize;\n },\n _getCurrentChunk: function (file, uid) {\n var oldPosition = this.position[uid];\n var methodToInvoke;\n var async = this.upload.options.async;\n var chunkSize = async.chunkSize || async.bufferChunkSize;\n if (!this.position[uid]) {\n this.position[uid] = 0;\n }\n this.position[uid] += chunkSize;\n if (!!(methodToInvoke = this._getChunker(file))) {\n return file[methodToInvoke](oldPosition, this.position[uid]);\n } else {\n return file;\n }\n },\n _getChunker: function (file) {\n if (file.slice) {\n return 'slice';\n } else if (file.mozSlice) {\n return 'mozSlice';\n } else if (file.webkitSlice) {\n return 'webkitSlice';\n } else {\n return null;\n }\n }\n };\n function getFileName(input) {\n return $.map(inputFiles(input), function (file) {\n return file.name;\n }).join(', ');\n }\n function inputFiles($input) {\n var input = $input[0];\n if (input.files) {\n return getAllFileInfo(input.files);\n } else {\n return [{\n name: stripPath(input.value),\n extension: getFileExtension(input.value),\n size: null\n }];\n }\n }\n function getAllFileInfo(rawFiles) {\n return $.map(rawFiles, function (file) {\n return getFileInfo(file);\n });\n }\n function getFileInfo(rawFile) {\n var fileName = rawFile.name || rawFile.fileName;\n return {\n name: kendo.htmlEncode(fileName),\n extension: getFileExtension(fileName),\n size: typeof rawFile.size == 'number' ? rawFile.size : rawFile.fileSize,\n rawFile: rawFile\n };\n }\n function getFileExtension(fileName) {\n var matches = fileName.match(rFileExtension);\n return matches ? matches[0] : '';\n }\n function stripPath(name) {\n var slashIndex = name.lastIndexOf('\\\\');\n return slashIndex != -1 ? name.substr(slashIndex + 1) : name;\n }\n function assignGuidToFiles(files, unique) {\n var uid = kendo.guid();\n return $.map(files, function (file) {\n file.uid = unique ? kendo.guid() : uid;\n return file;\n });\n }\n function validateFiles(files, validationInfo) {\n var allowedExtensions = parseAllowedExtensions(validationInfo.allowedExtensions);\n var maxFileSize = validationInfo.maxFileSize;\n var minFileSize = validationInfo.minFileSize;\n for (var i = 0; i < files.length; i++) {\n validateFileExtension(files[i], allowedExtensions);\n validateFileSize(files[i], minFileSize, maxFileSize);\n }\n }\n function parseAllowedExtensions(extensions) {\n var allowedExtensions = $.map(extensions, function (ext) {\n var parsedExt = ext.substring(0, 1) === '.' ? ext : '.' + ext;\n return parsedExt.toLowerCase();\n });\n return allowedExtensions;\n }\n function validateFileExtension(file, allowedExtensions) {\n if (allowedExtensions.length > 0) {\n if (allowedExtensions.indexOf(file.extension.toLowerCase()) < 0) {\n file.validationErrors = file.validationErrors || [];\n if ($.inArray(INVALIDFILEEXTENSION, file.validationErrors) === -1) {\n file.validationErrors.push(INVALIDFILEEXTENSION);\n }\n }\n }\n }\n function validateFileSize(file, minFileSize, maxFileSize) {\n if (minFileSize !== 0 && file.size < minFileSize) {\n file.validationErrors = file.validationErrors || [];\n if ($.inArray(INVALIDMINFILESIZE, file.validationErrors) === -1) {\n file.validationErrors.push(INVALIDMINFILESIZE);\n }\n }\n if (maxFileSize !== 0 && file.size > maxFileSize) {\n file.validationErrors = file.validationErrors || [];\n if ($.inArray(INVALIDMAXFILESIZE, file.validationErrors) === -1) {\n file.validationErrors.push(INVALIDMAXFILESIZE);\n }\n }\n }\n function getTotalFilesSizeMessage(files) {\n var totalSize = 0;\n if (typeof files[0].size == 'number') {\n for (var i = 0; i < files.length; i++) {\n if (files[i].size) {\n totalSize += files[i].size;\n }\n }\n } else {\n return '';\n }\n totalSize /= 1024;\n if (totalSize < 1024) {\n return totalSize.toFixed(2) + ' KB';\n } else {\n return (totalSize / 1024).toFixed(2) + ' MB';\n }\n }\n function shouldRemoveFileEntry(upload) {\n return !upload.multiple && $('.k-file', upload.wrapper).length > 1;\n }\n function removeUploadedFile(fileEntry, upload, eventArgs, shouldSendRemoveRequest) {\n if (!upload._supportsRemove()) {\n if (shouldRemoveFileEntry(upload) || !shouldSendRemoveRequest) {\n upload._removeFileEntry(fileEntry);\n }\n return;\n }\n var files = fileEntry.data('fileNames');\n var fileNames = $.map(files, function (file) {\n return file.name;\n });\n if (shouldSendRemoveRequest === false) {\n upload._removeFileEntry(fileEntry);\n return;\n }\n upload._submitRemove(fileNames, eventArgs, function onSuccess(data, textStatus, xhr) {\n var prevented = upload.trigger(SUCCESS, {\n operation: 'remove',\n files: files,\n response: data,\n XMLHttpRequest: xhr\n });\n if (!prevented) {\n upload._removeFileEntry(fileEntry);\n }\n }, function onError(xhr) {\n if (shouldRemoveFileEntry(upload)) {\n upload._removeFileEntry(fileEntry);\n }\n upload.trigger(ERROR, {\n operation: 'remove',\n files: files,\n XMLHttpRequest: xhr\n });\n logToConsole('Server response: ' + xhr.responseText);\n });\n }\n function tryParseJSON(input, onSuccess, onError) {\n var success = false, json = '';\n try {\n json = $.parseJSON(normalizeJSON(input));\n success = true;\n } catch (e) {\n onError();\n }\n if (success) {\n onSuccess(json);\n }\n }\n function normalizeJSON(input) {\n if (typeof input === 'undefined' || input === '') {\n input = '{}';\n }\n return input;\n }\n function stopEvent(e) {\n e.stopPropagation();\n e.preventDefault();\n }\n function bindDragEventWrappers(element, namespace, onDragEnter, onDragLeave) {\n var hideInterval, lastDrag;\n element.on('dragenter' + namespace, function (e) {\n onDragEnter(e);\n lastDrag = new Date();\n if (!hideInterval) {\n hideInterval = setInterval(function () {\n var sinceLastDrag = new Date() - lastDrag;\n if (sinceLastDrag > 100) {\n onDragLeave();\n clearInterval(hideInterval);\n hideInterval = null;\n }\n }, 100);\n }\n }).on('dragover' + namespace, function () {\n lastDrag = new Date();\n });\n }\n function isFileUploadStarted(fileEntry) {\n return fileEntry.is('.k-file-progress, .k-file-success, .k-file-error');\n }\n function getFileEntry(e) {\n return $(e.target).closest('.k-file');\n }\n kendo.ui.plugin(Upload);\n }(window.kendo.jQuery));\n return window.kendo;\n}, typeof define == 'function' && define.amd ? define : function (a1, a2, a3) {\n (a3 || a2)();\n}));"]}