{"version":3,"sources":["jquery.fileupload.js"],"names":["factory","define","amd","window","jQuery","$","support","xhrFileUpload","XMLHttpRequestUpload","FileReader","xhrFormDataFileUpload","FormData","widget","options","namespace","undefined","dropZone","document","fileInput","replaceFileInput","paramName","singleFileUploads","limitMultiFileUploads","sequentialUploads","limitConcurrentUploads","forceIframeTransport","redirect","redirectParamName","postMessage","multipart","maxChunkSize","uploadedBytes","recalculateProgress","formData","form","serializeArray","add","e","data","submit","done","failer","processData","contentType","cache","_refreshOptionsList","_isXHRUpload","_getFormData","isArray","each","name","value","push","_getTotal","files","total","index","file","size","_onProgress","lengthComputable","this","loaded","parseInt","chunkSize","_loaded","_trigger","_total","_initProgressListener","that","xhr","ajaxSettings","upload","bind","oe","originalEvent","_initXHRData","blob","headers","extend","X-File-Name","X-File-Type","type","X-File-Size","field","append","Blob","_initIframeSettings","dataType","prop","url","location","host","_initDataSettings","_chunkedUpload","_getParamName","input","i","length","_initFormSettings","href","toUpperCase","_getAJAXSettings","_enhancePromise","promise","success","error","fail","complete","always","_getXHRPromise","resolveOrReject","context","args","dfd","Deferred","resolveWith","rejectWith","abort","testOnly","n","jqXHR","pipe","fs","ub","mcs","slice","webkitSlice","mozSlice","Math","ceil","o","call","ajax","Event","_beforeSend","_active","_onDone","result","textStatus","_onFail","errorThrown","_onAlways","jqXHRorResult","jqXHRorError","_onSend","slot","send","resolve","_sending","nextSlot","_slots","shift","isRejected","_sequence","_onAdd","paramNameSet","paramNameSlice","fileSet","limit","originalFiles","element","newData","_normalizeFile","fileName","fileSize","_replaceFileInput","inputClone","clone","reset","after","detach","cleanData","unbind","map","el","_onChange","fileupload","makeArray","target","replace","_onPaste","cbd","clipboardData","items","item","getAsFile","_onDrop","dataTransfer","preventDefault","_onDragOver","dropEffect","effectAllowed","_initEventHandlers","ns","_destroyEventHandlers","_setOption","key","refresh","inArray","Widget","prototype","_initSpecialOptions","is","find","_create","cloneNode","widgetName","destroy","enable","disable","disabled"],"mappings":"CAcC,SAAUA,G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S,WACLrJ,KAAKsI,wBACL9L,EAAEmM,OAAOC,UAAUS,QAAQ9E,KAAKvE,OAOpCzB,IAAK,SAAUE,GACNA,IAAQuB,KAAKhD,QAAQsM,WAG1B7K,EAAKgB,MAAQjD,EAAE4C,KAAK5C,EAAE6K,UAAU5I,EAAKgB,OAAQO,KAAKsG,gBAClDtG,KAAK8F,OAAO,KAAMrH,KAQtB6G,KAAM,SAAU7G,GACZ,OAAIA,IAASuB,KAAKhD,QAAQsM,WACtB7K,EAAKgB,MAAQjD,EAAE4C,KAAK5C,EAAE6K,UAAU5I,EAAKgB,OAAQO,KAAKsG,gBAC9C7H,EAAKgB,MAAM4C,QACJrC,KAAKoF,QAAQ,KAAM3G,GAG3BuB,KAAKiD,gBAAe,EAAOxE,GAAQA,EAAK0E","file":"jquery.fileupload.js","sourcesContent":["/*\r\n* jQuery File Upload Plugin 5.10.1\r\n* https://github.com/blueimp/jQuery-File-Upload\r\n*\r\n* Copyright 2010, Sebastian Tschan\r\n* https://blueimp.net\r\n*\r\n* Licensed under the MIT license:\r\n* http://www.opensource.org/licenses/MIT\r\n*/\r\n\r\n/*jslint nomen: true, unparam: true, regexp: true */\r\n/*global define, window, document, Blob, FormData, location */\r\n\r\n(function (factory) {\r\n 'use strict';\r\n if (typeof define === 'function' && define.amd) {\r\n // Register as an anonymous AMD module:\r\n define([\r\n 'jquery',\r\n 'jquery.ui.widget'\r\n ], factory);\r\n } else {\r\n // Browser globals:\r\n factory(window.jQuery);\r\n }\r\n} (function ($) {\r\n //'use strict';\r\n\r\n // The FileReader API is not actually used, but works as feature detection,\r\n // as e.g. Safari supports XHR file uploads via the FormData API,\r\n // but not non-multipart XHR file uploads:\r\n $.support.xhrFileUpload = !!(window.XMLHttpRequestUpload && window.FileReader);\r\n $.support.xhrFormDataFileUpload = !!window.FormData;\r\n\r\n // The fileupload widget listens for change events on file input fields defined\r\n // via fileInput setting and paste or drop events of the given dropZone.\r\n // In addition to the default jQuery Widget methods, the fileupload widget\r\n // exposes the \"add\" and \"send\" methods, to add or directly send files using\r\n // the fileupload API.\r\n // By default, files added via file input selection, paste, drag & drop or\r\n // \"add\" method are uploaded immediately, but it is possible to override\r\n // the \"add\" callback option to queue file uploads.\r\n $.widget('blueimp.fileupload', {\r\n\r\n options: {\r\n // The namespace used for event handler binding on the dropZone and\r\n // fileInput collections.\r\n // If not set, the name of the widget (\"fileupload\") is used.\r\n namespace: undefined,\r\n // The drop target collection, by the default the complete document.\r\n // Set to null or an empty collection to disable drag & drop support:\r\n dropZone: $(document),\r\n // The file input field collection, that is listened for change events.\r\n // If undefined, it is set to the file input fields inside\r\n // of the widget element on plugin initialization.\r\n // Set to null or an empty collection to disable the change listener.\r\n fileInput: undefined,\r\n // By default, the file input field is replaced with a clone after\r\n // each input field change event. This is required for iframe transport\r\n // queues and allows change events to be fired for the same file\r\n // selection, but can be disabled by setting the following option to false:\r\n replaceFileInput: true,\r\n // The parameter name for the file form data (the request argument name).\r\n // If undefined or empty, the name property of the file input field is\r\n // used, or \"files[]\" if the file input name property is also empty,\r\n // can be a string or an array of strings:\r\n paramName: undefined,\r\n // By default, each file of a selection is uploaded using an individual\r\n // request for XHR type uploads. Set to false to upload file\r\n // selections in one request each:\r\n singleFileUploads: true,\r\n // To limit the number of files uploaded with one XHR request,\r\n // set the following option to an integer greater than 0:\r\n limitMultiFileUploads: undefined,\r\n // Set the following option to true to issue all file upload requests\r\n // in a sequential order:\r\n sequentialUploads: false,\r\n // To limit the number of concurrent uploads,\r\n // set the following option to an integer greater than 0:\r\n limitConcurrentUploads: undefined,\r\n // Set the following option to true to force iframe transport uploads:\r\n forceIframeTransport: false,\r\n // Set the following option to the location of a redirect url on the\r\n // origin server, for cross-domain iframe transport uploads:\r\n redirect: undefined,\r\n // The parameter name for the redirect url, sent as part of the form\r\n // data and set to 'redirect' if this option is empty:\r\n redirectParamName: undefined,\r\n // Set the following option to the location of a postMessage window,\r\n // to enable postMessage transport uploads:\r\n postMessage: undefined,\r\n // By default, XHR file uploads are sent as multipart/form-data.\r\n // The iframe transport is always using multipart/form-data.\r\n // Set to false to enable non-multipart XHR uploads:\r\n multipart: true,\r\n // To upload large files in smaller chunks, set the following option\r\n // to a preferred maximum chunk size. If set to 0, null or undefined,\r\n // or the browser does not support the required Blob API, files will\r\n // be uploaded as a whole.\r\n maxChunkSize: undefined,\r\n // When a non-multipart upload or a chunked multipart upload has been\r\n // aborted, this option can be used to resume the upload by setting\r\n // it to the size of the already uploaded bytes. This option is most\r\n // useful when modifying the options object inside of the \"add\" or\r\n // \"send\" callbacks, as the options are cloned for each file upload.\r\n uploadedBytes: undefined,\r\n // By default, failed (abort or error) file uploads are removed from the\r\n // global progress calculation. Set the following option to false to\r\n // prevent recalculating the global progress data:\r\n recalculateProgress: true,\r\n\r\n // Additional form data to be sent along with the file uploads can be set\r\n // using this option, which accepts an array of objects with name and\r\n // value properties, a function returning such an array, a FormData\r\n // object (for XHR file uploads), or a simple object.\r\n // The form of the first fileInput is given as parameter to the function:\r\n formData: function (form) {\r\n return form.serializeArray();\r\n },\r\n\r\n // The add callback is invoked as soon as files are added to the fileupload\r\n // widget (via file input selection, drag & drop, paste or add API call).\r\n // If the singleFileUploads option is enabled, this callback will be\r\n // called once for each file in the selection for XHR file uplaods, else\r\n // once for each file selection.\r\n // The upload starts when the submit method is invoked on the data parameter.\r\n // The data object contains a files property holding the added files\r\n // and allows to override plugin options as well as define ajax settings.\r\n // Listeners for this callback can also be bound the following way:\r\n // .bind('fileuploadadd', func);\r\n // data.submit() returns a Promise object and allows to attach additional\r\n // handlers using jQuery's Deferred callbacks:\r\n // data.submit().done(func).fail(func).always(func);\r\n add: function (e, data) {\r\n data.submit();\r\n },\r\n\r\n // Other callbacks:\r\n // Callback for the submit event of each file upload:\r\n // submit: function (e, data) {}, // .bind('fileuploadsubmit', func);\r\n // Callback for the start of each file upload request:\r\n // send: function (e, data) {}, // .bind('fileuploadsend', func);\r\n // Callback for successful uploads:\r\n done: function (e, data) {}, // .bind('fileuploaddone', func);\r\n // Callback for failed (abort or error) uploads:\r\n failer: function (e, data) { }, // .bind('fileuploadfail', func);\r\n // Callback for completed (success, abort or error) requests:\r\n // always: function (e, data) {}, // .bind('fileuploadalways', func);\r\n // Callback for upload progress events:\r\n // progress: function (e, data) {}, // .bind('fileuploadprogress', func);\r\n // Callback for global upload progress events:\r\n // progressall: function (e, data) {}, // .bind('fileuploadprogressall', func);\r\n // Callback for uploads start, equivalent to the global ajaxStart event:\r\n // start: function (e) {}, // .bind('fileuploadstart', func);\r\n // Callback for uploads stop, equivalent to the global ajaxStop event:\r\n // stop: function (e) {}, // .bind('fileuploadstop', func);\r\n // Callback for change events of the fileInput collection:\r\n // change: function (e, data) {}, // .bind('fileuploadchange', func);\r\n // Callback for paste events to the dropZone collection:\r\n // paste: function (e, data) {}, // .bind('fileuploadpaste', func);\r\n // Callback for drop events of the dropZone collection:\r\n // drop: function (e, data) {}, // .bind('fileuploaddrop', func);\r\n // Callback for dragover events of the dropZone collection:\r\n // dragover: function (e) {}, // .bind('fileuploaddragover', func);\r\n\r\n // The plugin options are used as settings object for the ajax calls.\r\n // The following are jQuery ajax settings required for the file uploads:\r\n processData: false,\r\n contentType: false,\r\n cache: false\r\n },\r\n\r\n // A list of options that require a refresh after assigning a new value:\r\n _refreshOptionsList: [\r\n 'namespace',\r\n 'dropZone',\r\n 'fileInput',\r\n 'multipart',\r\n 'forceIframeTransport'\r\n ],\r\n\r\n _isXHRUpload: function (options) {\r\n return !options.forceIframeTransport &&\r\n ((!options.multipart && $.support.xhrFileUpload) ||\r\n $.support.xhrFormDataFileUpload);\r\n },\r\n\r\n _getFormData: function (options) {\r\n var formData;\r\n if (typeof options.formData === 'function') {\r\n return options.formData(options.form);\r\n } else if ($.isArray(options.formData)) {\r\n return options.formData;\r\n } else if (options.formData) {\r\n formData = [];\r\n $.each(options.formData, function (name, value) {\r\n formData.push({ name: name, value: value });\r\n });\r\n return formData;\r\n }\r\n return [];\r\n },\r\n\r\n _getTotal: function (files) {\r\n var total = 0;\r\n $.each(files, function (index, file) {\r\n total += file.size || 1;\r\n });\r\n return total;\r\n },\r\n\r\n _onProgress: function (e, data) {\r\n if (e.lengthComputable) {\r\n var total = data.total || this._getTotal(data.files),\r\n loaded = parseInt(\r\n e.loaded / e.total * (data.chunkSize || total),\r\n 10\r\n ) + (data.uploadedBytes || 0);\r\n this._loaded += loaded - (data.loaded || data.uploadedBytes || 0);\r\n data.lengthComputable = true;\r\n data.loaded = loaded;\r\n data.total = total;\r\n // Trigger a custom progress event with a total data property set\r\n // to the file size(s) of the current upload and a loaded data\r\n // property calculated accordingly:\r\n this._trigger('progress', e, data);\r\n // Trigger a global progress event for all current file uploads,\r\n // including ajax calls queued for sequential file uploads:\r\n this._trigger('progressall', e, {\r\n lengthComputable: true,\r\n loaded: this._loaded,\r\n total: this._total\r\n });\r\n }\r\n },\r\n\r\n _initProgressListener: function (options) {\r\n var that = this,\r\n xhr = options.xhr ? options.xhr() : $.ajaxSettings.xhr();\r\n // Accesss to the native XHR object is required to add event listeners\r\n // for the upload progress event:\r\n if (xhr.upload) {\r\n $(xhr.upload).bind('progress', function (e) {\r\n var oe = e.originalEvent;\r\n // Make sure the progress event properties get copied over:\r\n e.lengthComputable = oe.lengthComputable;\r\n e.loaded = oe.loaded;\r\n e.total = oe.total;\r\n that._onProgress(e, options);\r\n });\r\n options.xhr = function () {\r\n return xhr;\r\n };\r\n }\r\n },\r\n\r\n _initXHRData: function (options) {\r\n var formData,\r\n file = options.files[0],\r\n // Ignore non-multipart setting if not supported:\r\n multipart = options.multipart || !$.support.xhrFileUpload,\r\n paramName = options.paramName[0];\r\n if (!multipart || options.blob) {\r\n // For non-multipart uploads and chunked uploads,\r\n // file meta data is not part of the request body,\r\n // so we transmit this data as part of the HTTP headers.\r\n // For cross domain requests, these headers must be allowed\r\n // via Access-Control-Allow-Headers or removed using\r\n // the beforeSend callback:\r\n options.headers = $.extend(options.headers, {\r\n 'X-File-Name': file.name,\r\n 'X-File-Type': file.type,\r\n 'X-File-Size': file.size\r\n });\r\n if (!options.blob) {\r\n // Non-chunked non-multipart upload:\r\n options.contentType = file.type;\r\n options.data = file;\r\n } else if (!multipart) {\r\n // Chunked non-multipart upload:\r\n options.contentType = 'application/octet-stream';\r\n options.data = options.blob;\r\n }\r\n }\r\n if (multipart && $.support.xhrFormDataFileUpload) {\r\n if (options.postMessage) {\r\n // window.postMessage does not allow sending FormData\r\n // objects, so we just add the File/Blob objects to\r\n // the formData array and let the postMessage window\r\n // create the FormData object out of this array:\r\n formData = this._getFormData(options);\r\n if (options.blob) {\r\n formData.push({\r\n name: paramName,\r\n value: options.blob\r\n });\r\n } else {\r\n $.each(options.files, function (index, file) {\r\n formData.push({\r\n name: options.paramName[index] || paramName,\r\n value: file\r\n });\r\n });\r\n }\r\n } else {\r\n if (options.formData instanceof FormData) {\r\n formData = options.formData;\r\n } else {\r\n formData = new FormData();\r\n $.each(this._getFormData(options), function (index, field) {\r\n formData.append(field.name, field.value);\r\n });\r\n }\r\n if (options.blob) {\r\n formData.append(paramName, options.blob, file.name);\r\n } else {\r\n $.each(options.files, function (index, file) {\r\n // File objects are also Blob instances.\r\n // This check allows the tests to run with\r\n // dummy objects:\r\n if (file instanceof Blob) {\r\n formData.append(\r\n options.paramName[index] || paramName,\r\n file,\r\n file.name\r\n );\r\n }\r\n });\r\n }\r\n }\r\n options.data = formData;\r\n }\r\n // Blob reference is not needed anymore, free memory:\r\n options.blob = null;\r\n },\r\n\r\n _initIframeSettings: function (options) {\r\n // Setting the dataType to iframe enables the iframe transport:\r\n options.dataType = 'iframe ' + (options.dataType || '');\r\n // The iframe transport accepts a serialized array as form data:\r\n options.formData = this._getFormData(options);\r\n // Add redirect url to form data on cross-domain uploads:\r\n if (options.redirect && $('').prop('href', options.url)\r\n .prop('host') !== location.host) {\r\n options.formData.push({\r\n name: options.redirectParamName || 'redirect',\r\n value: options.redirect\r\n });\r\n }\r\n },\r\n\r\n _initDataSettings: function (options) {\r\n if (this._isXHRUpload(options)) {\r\n if (!this._chunkedUpload(options, true)) {\r\n if (!options.data) {\r\n this._initXHRData(options);\r\n }\r\n this._initProgressListener(options);\r\n }\r\n if (options.postMessage) {\r\n // Setting the dataType to postmessage enables the\r\n // postMessage transport:\r\n options.dataType = 'postmessage ' + (options.dataType || '');\r\n }\r\n } else {\r\n this._initIframeSettings(options, 'iframe');\r\n }\r\n },\r\n\r\n _getParamName: function (options) {\r\n var fileInput = $(options.fileInput),\r\n paramName = options.paramName;\r\n if (!paramName) {\r\n paramName = [];\r\n fileInput.each(function () {\r\n var input = $(this),\r\n name = input.prop('name') || 'files[]',\r\n i = (input.prop('files') || [1]).length;\r\n while (i) {\r\n paramName.push(name);\r\n i -= 1;\r\n }\r\n });\r\n if (!paramName.length) {\r\n paramName = [fileInput.prop('name') || 'files[]'];\r\n }\r\n } else if (!$.isArray(paramName)) {\r\n paramName = [paramName];\r\n }\r\n return paramName;\r\n },\r\n\r\n _initFormSettings: function (options) {\r\n // Retrieve missing options from the input field and the\r\n // associated form, if available:\r\n if (!options.form || !options.form.length) {\r\n options.form = $(options.fileInput.prop('form'));\r\n }\r\n options.paramName = this._getParamName(options);\r\n if (!options.url) {\r\n options.url = options.form.prop('action') || location.href;\r\n }\r\n // The HTTP request method must be \"POST\" or \"PUT\":\r\n options.type = (options.type || options.form.prop('method') || '')\r\n .toUpperCase();\r\n if (options.type !== 'POST' && options.type !== 'PUT') {\r\n options.type = 'POST';\r\n }\r\n },\r\n\r\n _getAJAXSettings: function (data) {\r\n var options = $.extend({}, this.options, data);\r\n this._initFormSettings(options);\r\n this._initDataSettings(options);\r\n return options;\r\n },\r\n\r\n // Maps jqXHR callbacks to the equivalent\r\n // methods of the given Promise object:\r\n _enhancePromise: function (promise) {\r\n promise.success = promise.done;\r\n promise.error = promise.fail;\r\n promise.complete = promise.always;\r\n return promise;\r\n },\r\n\r\n // Creates and returns a Promise object enhanced with\r\n // the jqXHR methods abort, success, error and complete:\r\n _getXHRPromise: function (resolveOrReject, context, args) {\r\n var dfd = $.Deferred(),\r\n promise = dfd.promise();\r\n context = context || this.options.context || promise;\r\n if (resolveOrReject === true) {\r\n dfd.resolveWith(context, args);\r\n } else if (resolveOrReject === false) {\r\n dfd.rejectWith(context, args);\r\n }\r\n promise.abort = dfd.promise;\r\n return this._enhancePromise(promise);\r\n },\r\n\r\n // Uploads a file in multiple, sequential requests\r\n // by splitting the file up in multiple blob chunks.\r\n // If the second parameter is true, only tests if the file\r\n // should be uploaded in chunks, but does not invoke any\r\n // upload requests:\r\n _chunkedUpload: function (options, testOnly) {\r\n var that = this,\r\n file = options.files[0],\r\n fs = file.size,\r\n ub = options.uploadedBytes = options.uploadedBytes || 0,\r\n mcs = options.maxChunkSize || fs,\r\n // Use the Blob methods with the slice implementation\r\n // according to the W3C Blob API specification:\r\n slice = file.webkitSlice || file.mozSlice || file.slice,\r\n upload,\r\n n,\r\n jqXHR,\r\n pipe;\r\n if (!(this._isXHRUpload(options) && slice && (ub || mcs < fs)) ||\r\n options.data) {\r\n return false;\r\n }\r\n if (testOnly) {\r\n return true;\r\n }\r\n if (ub >= fs) {\r\n file.error = 'uploadedBytes';\r\n return this._getXHRPromise(\r\n false,\r\n options.context,\r\n [null, 'error', file.error]\r\n );\r\n }\r\n // n is the number of blobs to upload,\r\n // calculated via filesize, uploaded bytes and max chunk size:\r\n n = Math.ceil((fs - ub) / mcs);\r\n // The chunk upload method accepting the chunk number as parameter:\r\n upload = function (i) {\r\n if (!i) {\r\n return that._getXHRPromise(true, options.context);\r\n }\r\n // Upload the blobs in sequential order:\r\n return upload(i -= 1).pipe(function () {\r\n // Clone the options object for each chunk upload:\r\n var o = $.extend({}, options);\r\n o.blob = slice.call(\r\n file,\r\n ub + i * mcs,\r\n ub + (i + 1) * mcs\r\n );\r\n // Store the current chunk size, as the blob itself\r\n // will be dereferenced after data processing:\r\n o.chunkSize = o.blob.size;\r\n // Process the upload data (the blob and potential form data):\r\n that._initXHRData(o);\r\n // Add progress listeners for this chunk upload:\r\n that._initProgressListener(o);\r\n jqXHR = ($.ajax(o) || that._getXHRPromise(false, o.context))\r\n .done(function () {\r\n // Create a progress event if upload is done and\r\n // no progress event has been invoked for this chunk:\r\n if (!o.loaded) {\r\n that._onProgress($.Event('progress', {\r\n lengthComputable: true,\r\n loaded: o.chunkSize,\r\n total: o.chunkSize\r\n }), o);\r\n }\r\n options.uploadedBytes = o.uploadedBytes +=\r\n o.chunkSize;\r\n });\r\n return jqXHR;\r\n });\r\n };\r\n // Return the piped Promise object, enhanced with an abort method,\r\n // which is delegated to the jqXHR object of the current upload,\r\n // and jqXHR callbacks mapped to the equivalent Promise methods:\r\n pipe = upload(n);\r\n pipe.abort = function () {\r\n return jqXHR.abort();\r\n };\r\n return this._enhancePromise(pipe);\r\n },\r\n\r\n _beforeSend: function (e, data) {\r\n if (this._active === 0) {\r\n // the start callback is triggered when an upload starts\r\n // and no other uploads are currently running,\r\n // equivalent to the global ajaxStart event:\r\n this._trigger('start');\r\n }\r\n this._active += 1;\r\n // Initialize the global progress values:\r\n this._loaded += data.uploadedBytes || 0;\r\n this._total += this._getTotal(data.files);\r\n },\r\n\r\n _onDone: function (result, textStatus, jqXHR, options) {\r\n if (!this._isXHRUpload(options)) {\r\n // Create a progress event for each iframe load:\r\n this._onProgress($.Event('progress', {\r\n lengthComputable: true,\r\n loaded: 1,\r\n total: 1\r\n }), options);\r\n }\r\n options.result = result;\r\n options.textStatus = textStatus;\r\n options.jqXHR = jqXHR;\r\n this._trigger('done', null, options);\r\n },\r\n\r\n _onFail: function (jqXHR, textStatus, errorThrown, options) {\r\n options.jqXHR = jqXHR;\r\n options.textStatus = textStatus;\r\n options.errorThrown = errorThrown;\r\n this._trigger('fail', null, options);\r\n if (options.recalculateProgress) {\r\n // Remove the failed (error or abort) file upload from\r\n // the global progress calculation:\r\n this._loaded -= options.loaded || options.uploadedBytes || 0;\r\n this._total -= options.total || this._getTotal(options.files);\r\n }\r\n },\r\n\r\n _onAlways: function (jqXHRorResult, textStatus, jqXHRorError, options) {\r\n this._active -= 1;\r\n options.textStatus = textStatus;\r\n if (jqXHRorError && jqXHRorError.always) {\r\n options.jqXHR = jqXHRorError;\r\n options.result = jqXHRorResult;\r\n } else {\r\n options.jqXHR = jqXHRorResult;\r\n options.errorThrown = jqXHRorError;\r\n }\r\n this._trigger('always', null, options);\r\n if (this._active === 0) {\r\n // The stop callback is triggered when all uploads have\r\n // been completed, equivalent to the global ajaxStop event:\r\n this._trigger('stop');\r\n // Reset the global progress values:\r\n this._loaded = this._total = 0;\r\n }\r\n },\r\n\r\n _onSend: function (e, data) {\r\n var that = this,\r\n jqXHR,\r\n slot,\r\n pipe,\r\n options = that._getAJAXSettings(data),\r\n send = function (resolve, args) {\r\n that._sending += 1;\r\n jqXHR = jqXHR || (\r\n (resolve !== false &&\r\n that._trigger('send', e, options) !== false &&\r\n (that._chunkedUpload(options) || $.ajax(options))) ||\r\n that._getXHRPromise(false, options.context, args)\r\n ).done(function (result, textStatus, jqXHR) {\r\n that._onDone(result, textStatus, jqXHR, options);\r\n }).fail(function (jqXHR, textStatus, errorThrown) {\r\n that._onFail(jqXHR, textStatus, errorThrown, options);\r\n }).always(function (jqXHRorResult, textStatus, jqXHRorError) {\r\n that._sending -= 1;\r\n that._onAlways(\r\n jqXHRorResult,\r\n textStatus,\r\n jqXHRorError,\r\n options\r\n );\r\n if (options.limitConcurrentUploads &&\r\n options.limitConcurrentUploads > that._sending) {\r\n // Start the next queued upload,\r\n // that has not been aborted:\r\n var nextSlot = that._slots.shift();\r\n while (nextSlot) {\r\n if (!nextSlot.isRejected()) {\r\n nextSlot.resolve();\r\n break;\r\n }\r\n nextSlot = that._slots.shift();\r\n }\r\n }\r\n });\r\n return jqXHR;\r\n };\r\n this._beforeSend(e, options);\r\n if (this.options.sequentialUploads ||\r\n (this.options.limitConcurrentUploads &&\r\n this.options.limitConcurrentUploads <= this._sending)) {\r\n if (this.options.limitConcurrentUploads > 1) {\r\n slot = $.Deferred();\r\n this._slots.push(slot);\r\n pipe = slot.pipe(send);\r\n } else {\r\n pipe = (this._sequence = this._sequence.pipe(send, send));\r\n }\r\n // Return the piped Promise object, enhanced with an abort method,\r\n // which is delegated to the jqXHR object of the current upload,\r\n // and jqXHR callbacks mapped to the equivalent Promise methods:\r\n pipe.abort = function () {\r\n var args = [undefined, 'abort', 'abort'];\r\n if (!jqXHR) {\r\n if (slot) {\r\n slot.rejectWith(args);\r\n }\r\n return send(false, args);\r\n }\r\n return jqXHR.abort();\r\n };\r\n return this._enhancePromise(pipe);\r\n }\r\n return send();\r\n },\r\n\r\n _onAdd: function (e, data) {\r\n var that = this,\r\n result = true,\r\n options = $.extend({}, this.options, data),\r\n limit = options.limitMultiFileUploads,\r\n paramName = this._getParamName(options),\r\n paramNameSet,\r\n paramNameSlice,\r\n fileSet,\r\n i;\r\n if (!(options.singleFileUploads || limit) ||\r\n !this._isXHRUpload(options)) {\r\n fileSet = [data.files];\r\n paramNameSet = [paramName];\r\n } else if (!options.singleFileUploads && limit) {\r\n fileSet = [];\r\n paramNameSet = [];\r\n for (i = 0; i < data.files.length; i += limit) {\r\n fileSet.push(data.files.slice(i, i + limit));\r\n paramNameSlice = paramName.slice(i, i + limit);\r\n if (!paramNameSlice.length) {\r\n paramNameSlice = paramName;\r\n }\r\n paramNameSet.push(paramNameSlice);\r\n }\r\n } else {\r\n paramNameSet = paramName;\r\n }\r\n data.originalFiles = data.files;\r\n $.each(fileSet || data.files, function (index, element) {\r\n var newData = $.extend({}, data);\r\n newData.files = fileSet ? element : [element];\r\n newData.paramName = paramNameSet[index];\r\n newData.submit = function () {\r\n newData.jqXHR = this.jqXHR =\r\n (that._trigger('submit', e, this) !== false) &&\r\n that._onSend(e, this);\r\n return this.jqXHR;\r\n };\r\n return (result = that._trigger('add', e, newData));\r\n });\r\n return result;\r\n },\r\n\r\n // File Normalization for Gecko 1.9.1 (Firefox 3.5) support:\r\n _normalizeFile: function (index, file) {\r\n if (file.name === undefined && file.size === undefined) {\r\n file.name = file.fileName;\r\n file.size = file.fileSize;\r\n }\r\n },\r\n\r\n _replaceFileInput: function (input) {\r\n var inputClone = input.clone(true);\r\n $('
').append(inputClone)[0].reset();\r\n // Detaching allows to insert the fileInput on another form\r\n // without loosing the file input value:\r\n input.after(inputClone).detach();\r\n // Avoid memory leaks with the detached file input:\r\n $.cleanData(input.unbind('remove'));\r\n // Replace the original file input element in the fileInput\r\n // collection with the clone, which has been copied including\r\n // event handlers:\r\n this.options.fileInput = this.options.fileInput.map(function (i, el) {\r\n if (el === input[0]) {\r\n return inputClone[0];\r\n }\r\n return el;\r\n });\r\n // If the widget has been initialized on the file input itself,\r\n // override this.element with the file input clone:\r\n if (input[0] === this.element[0]) {\r\n this.element = inputClone;\r\n }\r\n },\r\n\r\n _onChange: function (e) {\r\n var that = e.data.fileupload,\r\n data = {\r\n files: $.each($.makeArray(e.target.files), that._normalizeFile),\r\n fileInput: $(e.target),\r\n form: $(e.target.form)\r\n };\r\n if (!data.files.length) {\r\n // If the files property is not available, the browser does not\r\n // support the File API and we add a pseudo File object with\r\n // the input value as name with path information removed:\r\n data.files = [{ name: e.target.value.replace(/^.*\\\\/, '')}];\r\n }\r\n if (that.options.replaceFileInput) {\r\n that._replaceFileInput(data.fileInput);\r\n }\r\n if (that._trigger('change', e, data) === false ||\r\n that._onAdd(e, data) === false) {\r\n return false;\r\n }\r\n },\r\n\r\n _onPaste: function (e) {\r\n var that = e.data.fileupload,\r\n cbd = e.originalEvent.clipboardData,\r\n items = (cbd && cbd.items) || [],\r\n data = { files: [] };\r\n $.each(items, function (index, item) {\r\n var file = item.getAsFile && item.getAsFile();\r\n if (file) {\r\n data.files.push(file);\r\n }\r\n });\r\n if (that._trigger('paste', e, data) === false ||\r\n that._onAdd(e, data) === false) {\r\n return false;\r\n }\r\n },\r\n\r\n _onDrop: function (e) {\r\n var that = e.data.fileupload,\r\n dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer,\r\n data = {\r\n files: $.each(\r\n $.makeArray(dataTransfer && dataTransfer.files),\r\n that._normalizeFile\r\n )\r\n };\r\n if (that._trigger('drop', e, data) === false ||\r\n that._onAdd(e, data) === false) {\r\n return false;\r\n }\r\n e.preventDefault();\r\n },\r\n\r\n _onDragOver: function (e) {\r\n var that = e.data.fileupload,\r\n dataTransfer = e.dataTransfer = e.originalEvent.dataTransfer;\r\n if (that._trigger('dragover', e) === false) {\r\n return false;\r\n }\r\n if (dataTransfer) {\r\n dataTransfer.dropEffect = dataTransfer.effectAllowed = 'copy';\r\n }\r\n e.preventDefault();\r\n },\r\n\r\n _initEventHandlers: function () {\r\n var ns = this.options.namespace;\r\n if (this._isXHRUpload(this.options)) {\r\n this.options.dropZone\r\n .bind('dragover.' + ns, { fileupload: this }, this._onDragOver)\r\n .bind('drop.' + ns, { fileupload: this }, this._onDrop)\r\n .bind('paste.' + ns, { fileupload: this }, this._onPaste);\r\n }\r\n this.options.fileInput\r\n .bind('change.' + ns, { fileupload: this }, this._onChange);\r\n },\r\n\r\n _destroyEventHandlers: function () {\r\n var ns = this.options.namespace;\r\n this.options.dropZone\r\n .unbind('dragover.' + ns, this._onDragOver)\r\n .unbind('drop.' + ns, this._onDrop)\r\n .unbind('paste.' + ns, this._onPaste);\r\n this.options.fileInput\r\n .unbind('change.' + ns, this._onChange);\r\n },\r\n\r\n _setOption: function (key, value) {\r\n var refresh = $.inArray(key, this._refreshOptionsList) !== -1;\r\n if (refresh) {\r\n this._destroyEventHandlers();\r\n }\r\n $.Widget.prototype._setOption.call(this, key, value);\r\n if (refresh) {\r\n this._initSpecialOptions();\r\n this._initEventHandlers();\r\n }\r\n },\r\n\r\n _initSpecialOptions: function () {\r\n var options = this.options;\r\n if (options.fileInput === undefined) {\r\n options.fileInput = this.element.is('input:file') ?\r\n this.element : this.element.find('input:file');\r\n } else if (!(options.fileInput instanceof $)) {\r\n options.fileInput = $(options.fileInput);\r\n }\r\n if (!(options.dropZone instanceof $)) {\r\n options.dropZone = $(options.dropZone);\r\n }\r\n },\r\n\r\n _create: function () {\r\n var options = this.options;\r\n // Initialize options set via HTML5 data-attributes:\r\n $.extend(options, $(this.element[0].cloneNode(false)).data());\r\n options.namespace = options.namespace || this.widgetName;\r\n this._initSpecialOptions();\r\n this._slots = [];\r\n this._sequence = this._getXHRPromise(true);\r\n this._sending = this._active = this._loaded = this._total = 0;\r\n this._initEventHandlers();\r\n },\r\n\r\n destroy: function () {\r\n this._destroyEventHandlers();\r\n $.Widget.prototype.destroy.call(this);\r\n },\r\n\r\n enable: function () {\r\n $.Widget.prototype.enable.call(this);\r\n this._initEventHandlers();\r\n },\r\n\r\n disable: function () {\r\n this._destroyEventHandlers();\r\n $.Widget.prototype.disable.call(this);\r\n },\r\n\r\n // This method is exposed to the widget API and allows adding files\r\n // using the fileupload API. The data parameter accepts an object which\r\n // must have a files property and can contain additional options:\r\n // .fileupload('add', {files: filesList});\r\n add: function (data) {\r\n if (!data || this.options.disabled) {\r\n return;\r\n }\r\n data.files = $.each($.makeArray(data.files), this._normalizeFile);\r\n this._onAdd(null, data);\r\n },\r\n\r\n // This method is exposed to the widget API and allows sending files\r\n // using the fileupload API. The data parameter accepts an object which\r\n // must have a files property and can contain additional options:\r\n // .fileupload('send', {files: filesList});\r\n // The method returns a Promise object for the file upload call.\r\n send: function (data) {\r\n if (data && !this.options.disabled) {\r\n data.files = $.each($.makeArray(data.files), this._normalizeFile);\r\n if (data.files.length) {\r\n return this._onSend(null, data);\r\n }\r\n }\r\n return this._getXHRPromise(false, data && data.context);\r\n }\r\n\r\n });\r\n\r\n}));\r\n"]}