/*! * Fine Uploader * * Copyright 2013, Widen Enterprises, Inc. info@fineuploader.com * * Version: 4.2.2 * * Homepage: http://fineuploader.com * * Repository: git://github.com/Widen/fine-uploader.git * * Licensed under GNU GPL v3, see LICENSE */ var qq=function(a){"use strict";return{hide:function(){return a.style.display="none",this},attach:function(b,c){return a.addEventListener?a.addEventListener(b,c,!1):a.attachEvent&&a.attachEvent("on"+b,c),function(){qq(a).detach(b,c)}},detach:function(b,c){return a.removeEventListener?a.removeEventListener(b,c,!1):a.attachEvent&&a.detachEvent("on"+b,c),this},contains:function(b){return b?a===b?!0:a.contains?a.contains(b):!!(8&b.compareDocumentPosition(a)):!1},insertBefore:function(b){return b.parentNode.insertBefore(a,b),this},remove:function(){return a.parentNode.removeChild(a),this},css:function(b){if(null==a.style)throw new qq.Error("Can't apply style to node as it is not on the HTMLElement prototype chain!");return null!=b.opacity&&"string"!=typeof a.style.opacity&&"undefined"!=typeof a.filters&&(b.filter="alpha(opacity="+Math.round(100*b.opacity)+")"),qq.extend(a.style,b),this},hasClass:function(b){var c=new RegExp("(^| )"+b+"( |$)");return c.test(a.className)},addClass:function(b){return qq(a).hasClass(b)||(a.className+=" "+b),this},removeClass:function(b){var c=new RegExp("(^| )"+b+"( |$)");return a.className=a.className.replace(c," ").replace(/^\s+|\s+$/g,""),this},getByClass:function(b){var c,d=[];return a.querySelectorAll?a.querySelectorAll("."+b):(c=a.getElementsByTagName("*"),qq.each(c,function(a,c){qq(c).hasClass(b)&&d.push(c)}),d)},children:function(){for(var b=[],c=a.firstChild;c;)1===c.nodeType&&b.push(c),c=c.nextSibling;return b},setText:function(b){return a.innerText=b,a.textContent=b,this},clearText:function(){return qq(a).setText("")},hasAttribute:function(b){var c;return a.hasAttribute?a.hasAttribute(b)?null==/^false$/i.exec(a.getAttribute(b)):!1:(c=a[b],void 0===c?!1:null==/^false$/i.exec(c))}}};!function(){"use strict";qq.log=function(a,b){window.console&&(b&&"info"!==b?window.console[b]?window.console[b](a):window.console.log("<"+b+"> "+a):window.console.log(a))},qq.isObject=function(a){return a&&!a.nodeType&&"[object Object]"===Object.prototype.toString.call(a)},qq.isFunction=function(a){return"function"==typeof a},qq.isArray=function(a){return"[object Array]"===Object.prototype.toString.call(a)||a&&window.ArrayBuffer&&a.buffer&&a.buffer.constructor===ArrayBuffer},qq.isItemList=function(a){return"[object DataTransferItemList]"===Object.prototype.toString.call(a)},qq.isNodeList=function(a){return"[object NodeList]"===Object.prototype.toString.call(a)||a.item&&a.namedItem},qq.isString=function(a){return"[object String]"===Object.prototype.toString.call(a)},qq.trimStr=function(a){return String.prototype.trim?a.trim():a.replace(/^\s+|\s+$/g,"")},qq.format=function(a){var b=Array.prototype.slice.call(arguments,1),c=a,d=c.indexOf("{}");return qq.each(b,function(a,b){var e=c.substring(0,d),f=c.substring(d+2);return c=e+b+f,d=c.indexOf("{}",d+b.length),0>d?!1:void 0}),c},qq.isFile=function(a){return window.File&&"[object File]"===Object.prototype.toString.call(a)},qq.isFileList=function(a){return window.FileList&&"[object FileList]"===Object.prototype.toString.call(a)},qq.isFileOrInput=function(a){return qq.isFile(a)||qq.isInput(a)},qq.isInput=function(a){return window.HTMLInputElement&&"[object HTMLInputElement]"===Object.prototype.toString.call(a)&&a.type&&"file"===a.type.toLowerCase()?!0:a.tagName&&"input"===a.tagName.toLowerCase()&&a.type&&"file"===a.type.toLowerCase()?!0:!1},qq.isBlob=function(a){return window.Blob&&"[object Blob]"===Object.prototype.toString.call(a)},qq.isXhrUploadSupported=function(){var a=document.createElement("input");return a.type="file",void 0!==a.multiple&&"undefined"!=typeof File&&"undefined"!=typeof FormData&&"undefined"!=typeof qq.createXhrInstance().upload},qq.createXhrInstance=function(){if(window.XMLHttpRequest)return new XMLHttpRequest;try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(a){return qq.log("Neither XHR or ActiveX are supported!","error"),null}},qq.isFolderDropSupported=function(a){return a.items&&a.items[0].webkitGetAsEntry},qq.isFileChunkingSupported=function(){return!qq.android()&&qq.isXhrUploadSupported()&&(void 0!==File.prototype.slice||void 0!==File.prototype.webkitSlice||void 0!==File.prototype.mozSlice)},qq.sliceBlob=function(a,b,c){var d=a.slice||a.mozSlice||a.webkitSlice;return d.call(a,b,c)},qq.arrayBufferToHex=function(a){var b="",c=new Uint8Array(a);return qq.each(c,function(a,c){var d=c.toString(16);d.length<2&&(d="0"+d),b+=d}),b},qq.readBlobToHex=function(a,b,c){var d=qq.sliceBlob(a,b,b+c),e=new FileReader,f=new qq.Promise;return e.onload=function(){f.success(qq.arrayBufferToHex(e.result))},e.readAsArrayBuffer(d),f},qq.extend=function(a,b,c){return qq.each(b,function(b,d){c&&qq.isObject(d)?(void 0===a[b]&&(a[b]={}),qq.extend(a[b],d,!0)):a[b]=d}),a},qq.override=function(a,b){var c={},d=b(c);return qq.each(d,function(b,d){void 0!==a[b]&&(c[b]=a[b]),a[b]=d}),a},qq.indexOf=function(a,b,c){if(a.indexOf)return a.indexOf(b,c);c=c||0;var d=a.length;for(0>c&&(c+=d);d>c;c+=1)if(a.hasOwnProperty(c)&&a[c]===b)return c;return-1},qq.getUniqueId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(a){var b=16*Math.random()|0,c="x"==a?b:3&b|8;return c.toString(16)})},qq.ie=function(){return-1!==navigator.userAgent.indexOf("MSIE")},qq.ie7=function(){return-1!==navigator.userAgent.indexOf("MSIE 7")},qq.ie10=function(){return-1!==navigator.userAgent.indexOf("MSIE 10")},qq.ie11=function(){return-1!==navigator.userAgent.indexOf("Trident")&&-1!==navigator.userAgent.indexOf("rv:11")},qq.safari=function(){return void 0!==navigator.vendor&&-1!==navigator.vendor.indexOf("Apple")},qq.chrome=function(){return void 0!==navigator.vendor&&-1!==navigator.vendor.indexOf("Google")},qq.opera=function(){return void 0!==navigator.vendor&&-1!==navigator.vendor.indexOf("Opera")},qq.firefox=function(){return!qq.ie11()&&-1!==navigator.userAgent.indexOf("Mozilla")&&void 0!==navigator.vendor&&""===navigator.vendor},qq.windows=function(){return"Win32"===navigator.platform},qq.android=function(){return-1!==navigator.userAgent.toLowerCase().indexOf("android")},qq.ios7=function(){return qq.ios()&&-1!==navigator.userAgent.indexOf(" OS 7_")},qq.ios=function(){return-1!==navigator.userAgent.indexOf("iPad")||-1!==navigator.userAgent.indexOf("iPod")||-1!==navigator.userAgent.indexOf("iPhone")},qq.preventDefault=function(a){a.preventDefault?a.preventDefault():a.returnValue=!1},qq.toElement=function(){var a=document.createElement("div");return function(b){a.innerHTML=b;var c=a.firstChild;return a.removeChild(c),c}}(),qq.each=function(a,b){var c,d;if(a)if(window.Storage&&a.constructor===window.Storage)for(c=0;c0?a.substr(b,a.length-b):void 0},qq.getFilename=function(a){return qq.isInput(a)?a.value.replace(/.*(\/|\\)/,""):qq.isFile(a)&&null!==a.fileName&&void 0!==a.fileName?a.fileName:a.name},qq.DisposeSupport=function(){var a=[];return{dispose:function(){var b;do b=a.shift(),b&&b();while(b)},attach:function(){var a=arguments;this.addDisposer(qq(a[0]).attach.apply(this,Array.prototype.slice.call(arguments,1)))},addDisposer:function(b){a.push(b)}}}}(),function(){"use strict";qq.Error=function(a){this.message=a},qq.Error.prototype=new Error}(),qq.version="4.2.2",qq.supportedFeatures=function(){"use strict";function a(){var a,b=!0;try{a=document.createElement("input"),a.type="file",qq(a).hide(),a.disabled&&(b=!1)}catch(c){b=!1}return b}function b(){return(qq.chrome()||qq.opera())&&void 0!==navigator.userAgent.match(/Chrome\/[2][1-9]|Chrome\/[3-9][0-9]/)}function c(){return(qq.chrome()||qq.opera())&&void 0!==navigator.userAgent.match(/Chrome\/[1][4-9]|Chrome\/[2-9][0-9]/)}function d(){if(window.XMLHttpRequest){var a=qq.createXhrInstance();return void 0!==a.withCredentials}return!1}function e(){return void 0!==window.XDomainRequest}function f(){return d()?!0:e()}function g(){return void 0!==document.createElement("input").webkitdirectory}var h,i,j,k,l,m,n,o,p,q,r,s;return h=a(),i=h&&qq.isXhrUploadSupported(),j=i&&b(),k=i&&qq.isFileChunkingSupported(),l=i&&k&&qq.areCookiesEnabled(),m=i&&c(),n=h&&(void 0!==window.postMessage||i),p=d(),o=e(),q=f(),r=g(),s=i&&void 0!==window.FileReader,{uploading:h,ajaxUploading:i,fileDrop:i,folderDrop:j,chunking:k,resume:l,uploadCustomHeaders:i,uploadNonMultipart:i,itemSizeValidation:i,uploadViaPaste:m,progressBar:i,uploadCors:n,deleteFileCorsXhr:p,deleteFileCorsXdr:o,deleteFileCors:q,canDetermineSize:i,folderSelection:r,imagePreviews:s,imageValidation:s,pause:k}}(),qq.Promise=function(){"use strict";var a,b,c=[],d=[],e=[],f=0;qq.extend(this,{then:function(e,g){return 0===f?(e&&c.push(e),g&&d.push(g)):-1===f?g&&g.apply(null,b):e&&e.apply(null,a),this},done:function(c){return 0===f?e.push(c):c.apply(null,void 0===b?a:b),this},success:function(){return f=1,a=arguments,c.length&&qq.each(c,function(b,c){c.apply(null,a)}),e.length&&qq.each(e,function(b,c){c.apply(null,a)}),this},failure:function(){return f=-1,b=arguments,d.length&&qq.each(d,function(a,c){c.apply(null,b)}),e.length&&qq.each(e,function(a,c){c.apply(null,b)}),this}})},qq.UploadButton=function(a){"use strict";function b(){var a=document.createElement("input");return a.setAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME,d),f.multiple&&a.setAttribute("multiple",""),f.folders&&qq.supportedFeatures.folderSelection&&a.setAttribute("webkitdirectory",""),f.acceptFiles&&a.setAttribute("accept",f.acceptFiles),a.setAttribute("type","file"),a.setAttribute("name",f.name),qq(a).css({position:"absolute",right:0,top:0,fontFamily:"Arial",fontSize:"118px",margin:0,padding:0,cursor:"pointer",opacity:0}),f.element.appendChild(a),e.attach(a,"change",function(){f.onChange(a)}),e.attach(a,"mouseover",function(){qq(f.element).addClass(f.hoverClass)}),e.attach(a,"mouseout",function(){qq(f.element).removeClass(f.hoverClass)}),e.attach(a,"focus",function(){qq(f.element).addClass(f.focusClass)}),e.attach(a,"blur",function(){qq(f.element).removeClass(f.focusClass)}),window.attachEvent&&a.setAttribute("tabIndex","-1"),a}var c,d,e=new qq.DisposeSupport,f={element:null,multiple:!1,acceptFiles:null,folders:!1,name:"qqfile",onChange:function(){},hoverClass:"qq-upload-button-hover",focusClass:"qq-upload-button-focus"};qq.extend(f,a),d=qq.getUniqueId(),qq(f.element).css({position:"relative",overflow:"hidden",direction:"ltr"}),c=b(),qq.extend(this,{getInput:function(){return c},getButtonId:function(){return d},setMultiple:function(a){a!==f.multiple&&(a?c.setAttribute("multiple",""):c.removeAttribute("multiple"))},setAcceptFiles:function(a){a!==f.acceptFiles&&c.setAttribute("accept",a)},reset:function(){c.parentNode&&qq(c).remove(),qq(f.element).removeClass(f.focusClass),c=b()}})},qq.UploadButton.BUTTON_ID_ATTR_NAME="qq-button-id",qq.UploadData=function(a){"use strict";function b(a){if(qq.isArray(a)){var b=[];return qq.each(a,function(a,c){b.push(e[c])}),b}return e[a]}function c(a){if(qq.isArray(a)){var b=[];return qq.each(a,function(a,c){b.push(e[f[c]])}),b}return e[f[a]]}function d(a){var b=[],c=[].concat(a);return qq.each(c,function(a,c){var d=g[c];void 0!==d&&qq.each(d,function(a,c){b.push(e[c])})}),b}var e=[],f={},g={};qq.extend(this,{addFile:function(b,c,d,h){h=h||qq.status.SUBMITTING;var i=e.push({name:c,originalName:c,uuid:b,size:d,status:h})-1;return e[i].id=i,f[b]=i,void 0===g[h]&&(g[h]=[]),g[h].push(i),a.onStatusChange(i,null,h),i},retrieve:function(a){return qq.isObject(a)&&e.length?void 0!==a.id?b(a.id):void 0!==a.uuid?c(a.uuid):a.status?d(a.status):void 0:qq.extend([],e,!0)},reset:function(){e=[],f={},g={}},setStatus:function(b,c){var d=e[b].status,f=qq.indexOf(g[d],b);g[d].splice(f,1),e[b].status=c,void 0===g[c]&&(g[c]=[]),g[c].push(b),a.onStatusChange(b,d,c)},uuidChanged:function(a,b){var c=e[a].uuid;e[a].uuid=b,f[b]=a,delete f[c]},updateName:function(a,b){e[a].name=b}})},qq.status={SUBMITTING:"submitting",SUBMITTED:"submitted",REJECTED:"rejected",QUEUED:"queued",CANCELED:"canceled",PAUSED:"paused",UPLOADING:"uploading",UPLOAD_RETRYING:"retrying upload",UPLOAD_SUCCESSFUL:"upload successful",UPLOAD_FAILED:"upload failed",DELETE_FAILED:"delete failed",DELETING:"deleting",DELETED:"deleted"},function(){"use strict";qq.basePublicApi={log:function(a,b){!this._options.debug||b&&"info"!==b?b&&"info"!==b&&qq.log("[FineUploader "+qq.version+"] "+a,b):qq.log("[FineUploader "+qq.version+"] "+a)},setParams:function(a,b){null==b?this._options.request.params=a:this._paramsStore.setParams(a,b)},setDeleteFileParams:function(a,b){null==b?this._options.deleteFile.params=a:this._deleteFileParamsStore.setParams(a,b)},setEndpoint:function(a,b){null==b?this._options.request.endpoint=a:this._endpointStore.setEndpoint(a,b)},getInProgress:function(){return this._uploadData.retrieve({status:[qq.status.UPLOADING,qq.status.UPLOAD_RETRYING,qq.status.QUEUED]}).length},getNetUploads:function(){return this._netUploaded},uploadStoredFiles:function(){var a;if(0===this._storedIds.length)this._itemError("noFilesError");else for(;this._storedIds.length;)a=this._storedIds.shift(),this._uploadFile(a)},clearStoredFiles:function(){this._storedIds=[]},retry:function(a){return this._manualRetry(a)},cancel:function(a){this._handler.cancel(a)},cancelAll:function(){var a=[],b=this;qq.extend(a,this._storedIds),qq.each(a,function(a,c){b.cancel(c)}),this._handler.cancelAll()},reset:function(){this.log("Resetting uploader..."),this._handler.reset(),this._storedIds=[],this._autoRetries=[],this._retryTimeouts=[],this._preventRetries=[],this._thumbnailUrls=[],qq.each(this._buttons,function(a,b){b.reset()}),this._paramsStore.reset(),this._endpointStore.reset(),this._netUploadedOrQueued=0,this._netUploaded=0,this._uploadData.reset(),this._buttonIdsForFileIds=[],this._pasteHandler&&this._pasteHandler.reset(),this._options.session.refreshOnReset&&this._refreshSessionData()},addFiles:function(a,b,c){var d,e,f,g=[];if(a){for(qq.isFileList(a)||(a=[].concat(a)),d=0;d0,maxSize:c>0?c:null};return!d&&qq.supportedFeatures.imagePreviews&&(e=this.getFile(a)),null==e?(new qq.Promise).failure(b,"File or URL not found."):this._imageGenerator.generate(e,b,f)}},pauseUpload:function(a){var b=this._uploadData.retrieve({id:a});if(!qq.supportedFeatures.pause||!this._options.chunking.enabled)return!1;if(qq.indexOf([qq.status.UPLOADING,qq.status.UPLOAD_RETRYING],b.status)>=0){if(this._handler.pause(a))return this._uploadData.setStatus(a,qq.status.PAUSED),!0;qq.log(qq.format("Unable to pause file ID {} ({}).",a,this.getName(a)),"error")}else qq.log(qq.format("Ignoring pause for file ID {} ({}). Not in progress.",a,this.getName(a)),"error");return!1},continueUpload:function(a){var b=this._uploadData.retrieve({id:a});return qq.supportedFeatures.pause&&this._options.chunking.enabled?b.status===qq.status.PAUSED?(qq.log(qq.format("Paused file ID {} ({}) will be continued. Not paused.",a,this.getName(a))),this._uploadFile(a),!0):(qq.log(qq.format("Ignoring continue for file ID {} ({}). Not paused.",a,this.getName(a)),"error"),!1):!1},getRemainingAllowedItems:function(){var a=this._options.validation.itemLimit;return a>0?this._options.validation.itemLimit-this._netUploadedOrQueued:null}},qq.basePrivateApi={_uploadFile:function(a){this._handler.upload(a)||this._uploadData.setStatus(a,qq.status.QUEUED)},_refreshSessionData:function(){var a=this,b=this._options.session;qq.Session&&null!=this._options.session.endpoint&&(this._session||(qq.extend(b,this._options.cors),b.log=qq.bind(this.log,this),b.addFileRecord=qq.bind(this._addCannedFile,this),this._session=new qq.Session(b)),setTimeout(function(){a._session.refresh().then(function(b,c){a._options.callbacks.onSessionRequestComplete(b,!0,c)},function(b,c){a._options.callbacks.onSessionRequestComplete(b,!1,c)})},0))},_addCannedFile:function(a){var b=this._uploadData.addFile(a.uuid,a.name,a.size,qq.status.UPLOAD_SUCCESSFUL);return a.deleteFileEndpoint&&this.setDeleteFileEndpoint(a.deleteFileEndpoint,b),a.deleteFileParams&&this.setDeleteFileParams(a.deleteFileParams,b),a.thumbnailUrl&&(this._thumbnailUrls[b]=a.thumbnailUrl),this._netUploaded++,this._netUploadedOrQueued++,b},_handleNewFile:function(a,b){var c,d=-1,e=qq.getUniqueId(),f=qq.getFilename(a);a.size>=0?d=a.size:a.blob&&(d=a.blob.size),c=this._uploadData.addFile(e,f,d),this._handler.add(c,a),this._netUploadedOrQueued++,b.push({id:c,file:a})},_generateExtraButtonSpecs:function(){var a=this;this._extraButtonSpecs={},qq.each(this._options.extraButtons,function(b,c){var d=c.multiple,e=qq.extend({},a._options.validation,!0),f=qq.extend({},c);void 0===d&&(d=a._options.multiple),f.validation&&qq.extend(e,c.validation,!0),qq.extend(f,{multiple:d,validation:e},!0),a._initExtraButton(f)})},_initExtraButton:function(a){var b=this._createUploadButton({element:a.element,multiple:a.multiple,accept:a.validation.acceptFiles,folders:a.folders,allowedExtensions:a.validation.allowedExtensions});this._extraButtonSpecs[b.getButtonId()]=a},_getButtonId:function(a){var b,c;if(a&&!a.blob&&!qq.isBlob(a)){if(qq.isFile(a))return a.qqButtonId;if("input"===a.tagName.toLowerCase()&&"file"===a.type.toLowerCase())return a.getAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME);if(b=a.getElementsByTagName("input"),qq.each(b,function(a,b){return"file"===b.getAttribute("type")?(c=b,!1):void 0}),c)return c.getAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME)}},_annotateWithButtonId:function(a,b){qq.isFile(a)&&(a.qqButtonId=this._getButtonId(b))},_getButton:function(a){var b=this._extraButtonSpecs[a];return b?b.element:a===this._defaultButtonId?this._options.button:void 0},_handleCheckedCallback:function(a){var b=this,c=a.callback();return c instanceof qq.Promise?(this.log(a.name+" - waiting for "+a.name+" promise to be fulfilled for "+a.identifier),c.then(function(c){b.log(a.name+" promise success for "+a.identifier),a.onSuccess(c)},function(){a.onFailure?(b.log(a.name+" promise failure for "+a.identifier),a.onFailure()):b.log(a.name+" promise failure for "+a.identifier)})):(c!==!1?a.onSuccess(c):a.onFailure?(this.log(a.name+" - return value was 'false' for "+a.identifier+". Invoking failure callback."),a.onFailure()):this.log(a.name+" - return value was 'false' for "+a.identifier+". Will not proceed."),c)},_createUploadButton:function(a){function b(){return qq.supportedFeatures.ajaxUploading?qq.ios7()&&c._isAllowedExtension(e,".mov")?!1:void 0===a.multiple?c._options.multiple:a.multiple:!1}var c=this,d=a.accept||this._options.validation.acceptFiles,e=a.allowedExtensions||this._options.validation.allowedExtensions,f=new qq.UploadButton({element:a.element,folders:a.folders,name:this._options.request.inputName,multiple:b(),acceptFiles:d,onChange:function(a){c._onInputChange(a)},hoverClass:this._options.classes.buttonHover,focusClass:this._options.classes.buttonFocus});return this._disposeSupport.addDisposer(function(){f.dispose()}),c._buttons.push(f),f},_createUploadHandler:function(a,b){var c=this,d={debug:this._options.debug,maxConnections:this._options.maxConnections,cors:this._options.cors,demoMode:this._options.demoMode,paramsStore:this._paramsStore,endpointStore:this._endpointStore,chunking:this._options.chunking,resume:this._options.resume,blobs:this._options.blobs,log:qq.bind(c.log,c),onProgress:function(a,b,d,e){c._onProgress(a,b,d,e),c._options.callbacks.onProgress(a,b,d,e)},onComplete:function(a,b,d,e){var f=c._onComplete(a,b,d,e);f instanceof qq.Promise?f.done(function(){c._options.callbacks.onComplete(a,b,d,e)}):c._options.callbacks.onComplete(a,b,d,e)},onCancel:function(a,b){return c._handleCheckedCallback({name:"onCancel",callback:qq.bind(c._options.callbacks.onCancel,c,a,b),onSuccess:qq.bind(c._onCancel,c,a,b),identifier:a})},onUpload:function(a,b){c._onUpload(a,b),c._options.callbacks.onUpload(a,b)},onUploadChunk:function(a,b,d){c._onUploadChunk(a,d),c._options.callbacks.onUploadChunk(a,b,d)},onUploadChunkSuccess:function(){c._options.callbacks.onUploadChunkSuccess.apply(c,arguments)},onResume:function(a,b,d){return c._options.callbacks.onResume(a,b,d)},onAutoRetry:function(){return c._onAutoRetry.apply(c,arguments)},onUuidChanged:function(a,b){c.log("Server requested UUID change from '"+c.getUuid(a)+"' to '"+b+"'"),c.setUuid(a,b)},getName:qq.bind(c.getName,c),getUuid:qq.bind(c.getUuid,c),getSize:qq.bind(c.getSize,c)};return qq.each(this._options.request,function(a,b){d[a]=b}),a&&qq.each(a,function(a,b){d[a]=b}),new qq.UploadHandler(d,b)},_createDeleteHandler:function(){var a=this;return new qq.DeleteFileAjaxRequester({method:this._options.deleteFile.method.toUpperCase(),maxConnections:this._options.maxConnections,uuidParamName:this._options.request.uuidName,customHeaders:this._options.deleteFile.customHeaders,paramsStore:this._deleteFileParamsStore,endpointStore:this._deleteFileEndpointStore,demoMode:this._options.demoMode,cors:this._options.cors,log:qq.bind(a.log,a),onDelete:function(b){a._onDelete(b),a._options.callbacks.onDelete(b)},onDeleteComplete:function(b,c,d){a._onDeleteComplete(b,c,d),a._options.callbacks.onDeleteComplete(b,c,d)}})},_createPasteHandler:function(){var a=this;return new qq.PasteSupport({targetElement:this._options.paste.targetElement,callbacks:{log:qq.bind(a.log,a),pasteReceived:function(b){a._handleCheckedCallback({name:"onPasteReceived",callback:qq.bind(a._options.callbacks.onPasteReceived,a,b),onSuccess:qq.bind(a._handlePasteSuccess,a,b),identifier:"pasted image"})}}})},_createUploadDataTracker:function(){var a=this;return new qq.UploadData({getName:function(b){return a.getName(b)},getUuid:function(b){return a.getUuid(b)},getSize:function(b){return a.getSize(b)},onStatusChange:function(b,c,d){a._onUploadStatusChange(b,c,d),a._options.callbacks.onStatusChange(b,c,d)}})},_onUploadStatusChange:function(a,b,c){c===qq.status.PAUSED&&clearTimeout(this._retryTimeouts[a])},_handlePasteSuccess:function(a,b){var c=a.type.split("/")[1],d=b;null==d&&(d=this._options.paste.defaultName),d+="."+c,this.addBlobs({name:d,blob:a})},_preventLeaveInProgress:function(){var a=this;this._disposeSupport.attach(window,"beforeunload",function(b){return a.getInProgress()?(b=b||window.event,b.returnValue=a._options.messages.onLeave,a._options.messages.onLeave):void 0})},_onSubmit:function(){},_onProgress:function(){},_onComplete:function(a,b,c,d){return c.success?(c.thumbnailUrl&&(this._thumbnailUrls[a]=c.thumbnailUrl),this._netUploaded++,this._uploadData.setStatus(a,qq.status.UPLOAD_SUCCESSFUL)):(this._netUploadedOrQueued--,this._uploadData.setStatus(a,qq.status.UPLOAD_FAILED)),this._maybeParseAndSendUploadError(a,b,c,d),c.success?!0:!1},_onCancel:function(a){this._netUploadedOrQueued--,clearTimeout(this._retryTimeouts[a]);var b=qq.indexOf(this._storedIds,a);!this._options.autoUpload&&b>=0&&this._storedIds.splice(b,1),this._uploadData.setStatus(a,qq.status.CANCELED)},_isDeletePossible:function(){return qq.DeleteFileAjaxRequester&&this._options.deleteFile.enabled?this._options.cors.expected?qq.supportedFeatures.deleteFileCorsXhr?!0:qq.supportedFeatures.deleteFileCorsXdr&&this._options.cors.allowXdr?!0:!1:!0:!1},_onSubmitDelete:function(a,b,c){var d,e=this.getUuid(a);return b&&(d=qq.bind(b,this,a,e,c)),this._isDeletePossible()?this._handleCheckedCallback({name:"onSubmitDelete",callback:qq.bind(this._options.callbacks.onSubmitDelete,this,a),onSuccess:d||qq.bind(this._deleteHandler.sendDelete,this,a,e,c),identifier:a}):(this.log("Delete request ignored for ID "+a+", delete feature is disabled or request not possible due to CORS on a user agent that does not support pre-flighting.","warn"),!1)},_onDelete:function(a){this._uploadData.setStatus(a,qq.status.DELETING)},_onDeleteComplete:function(a,b,c){var d=this.getName(a);c?(this._uploadData.setStatus(a,qq.status.DELETE_FAILED),this.log("Delete request for '"+d+"' has failed.","error"),void 0===b.withCredentials?this._options.callbacks.onError(a,d,"Delete request failed",b):this._options.callbacks.onError(a,d,"Delete request failed with response code "+b.status,b)):(this._netUploadedOrQueued--,this._netUploaded--,this._handler.expunge(a),this._uploadData.setStatus(a,qq.status.DELETED),this.log("Delete request for '"+d+"' has succeeded."))},_onUpload:function(a){this._uploadData.setStatus(a,qq.status.UPLOADING)},_onUploadChunk:function(){},_onInputChange:function(a){var b;if(qq.supportedFeatures.ajaxUploading){for(b=0;b0&&this.addFiles(a);qq.each(this._buttons,function(a,b){b.reset()})},_onBeforeAutoRetry:function(a,b){this.log("Waiting "+this._options.retry.autoAttemptDelay+" seconds before retrying "+b+"...")},_onAutoRetry:function(a,b,c,d,e){var f=this;return f._preventRetries[a]=c[f._options.retry.preventRetryResponseProperty],f._shouldAutoRetry(a,b,c)?(f._maybeParseAndSendUploadError.apply(f,arguments),f._options.callbacks.onAutoRetry(a,b,f._autoRetries[a]+1),f._onBeforeAutoRetry(a,b),f._retryTimeouts[a]=setTimeout(function(){f.log("Retrying "+b+"..."),f._autoRetries[a]++,f._uploadData.setStatus(a,qq.status.UPLOAD_RETRYING),e?e(a):f._handler.retry(a)},1e3*f._options.retry.autoAttemptDelay),!0):void 0},_shouldAutoRetry:function(a){var b=this._uploadData.retrieve({id:a});return!this._preventRetries[a]&&this._options.retry.enableAuto&&b.status!==qq.status.PAUSED?(void 0===this._autoRetries[a]&&(this._autoRetries[a]=0),this._autoRetries[a]0&&this._netUploadedOrQueued+1>b?(this._itemError("retryFailTooManyItems"),!1):(this.log("Retrying upload for '"+c+"' (id: "+a+")..."),!0)}return this.log("'"+a+"' is not a valid file ID","error"),!1},_manualRetry:function(a,b){return this._onBeforeManualRetry(a)?(this._netUploadedOrQueued++,this._uploadData.setStatus(a,qq.status.UPLOAD_RETRYING),b?b(a):this._handler.retry(a),!0):void 0},_maybeParseAndSendUploadError:function(a,b,c,d){if(!c.success)if(d&&200!==d.status&&!c.error)this._options.callbacks.onError(a,b,"XHR returned response code "+d.status,d);else{var e=c.error?c.error:this._options.text.defaultResponseError;this._options.callbacks.onError(a,b,e,d)}},_prepareItemsForUpload:function(a,b,c){var d=this._getValidationDescriptors(a),e=this._getButtonId(a[0].file),f=this._getButton(e);this._handleCheckedCallback({name:"onValidateBatch",callback:qq.bind(this._options.callbacks.onValidateBatch,this,d,f),onSuccess:qq.bind(this._onValidateBatchCallbackSuccess,this,d,a,b,c,f),onFailure:qq.bind(this._onValidateBatchCallbackFailure,this,a),identifier:"batch validation"})},_upload:function(a,b,c){var d=this.getName(a);b&&this.setParams(b,a),c&&this.setEndpoint(c,a),this._handleCheckedCallback({name:"onSubmit",callback:qq.bind(this._options.callbacks.onSubmit,this,a,d),onSuccess:qq.bind(this._onSubmitCallbackSuccess,this,a,d),onFailure:qq.bind(this._fileOrBlobRejected,this,a,d),identifier:a})},_onSubmitCallbackSuccess:function(a){var b;b=qq.supportedFeatures.ajaxUploading?this._handler.getFile(a).qqButtonId:this._getButtonId(this._handler.getInput(a)),b&&(this._buttonIdsForFileIds[a]=b),this._onSubmit.apply(this,arguments),this._uploadData.setStatus(a,qq.status.SUBMITTED),this._onSubmitted.apply(this,arguments),this._options.callbacks.onSubmitted.apply(this,arguments),this._options.autoUpload?this._uploadFile(a):this._storeForLater(a)},_onSubmitted:function(){},_storeForLater:function(a){this._storedIds.push(a)},_onValidateBatchCallbackSuccess:function(a,b,c,d,e){var f,g=this._options.validation.itemLimit,h=this._netUploadedOrQueued;0===g||g>=h?b.length>0?this._handleCheckedCallback({name:"onValidate",callback:qq.bind(this._options.callbacks.onValidate,this,a[0],e),onSuccess:qq.bind(this._onValidateCallbackSuccess,this,b,0,c,d),onFailure:qq.bind(this._onValidateCallbackFailure,this,b,0,c,d),identifier:"Item '"+b[0].file.name+"', size: "+b[0].file.size}):this._itemError("noFilesError"):(this._onValidateBatchCallbackFailure(b),f=this._options.messages.tooManyItemsError.replace(/\{netItems\}/g,h).replace(/\{itemLimit\}/g,g),this._batchError(f)) }, _onValidateBatchCallbackFailure: function (a) { var b = this; qq.each(a, function (a, c) { b._fileOrBlobRejected(c.id) }) }, _onValidateCallbackSuccess: function (a, b, c, d) { var e = this, f = b + 1, g = this._getValidationDescriptor(a[b].file); this._validateFileOrBlobData(a[b], g).then(function () { e._upload(a[b].id, c, d), e._maybeProcessNextItemAfterOnValidateCallback(!0, a, f, c, d) }, function () { e._maybeProcessNextItemAfterOnValidateCallback(!1, a, f, c, d) }) }, _onValidateCallbackFailure: function (a, b, c, d) { var e = b + 1; this._fileOrBlobRejected(a[0].id, a[0].file.name), this._maybeProcessNextItemAfterOnValidateCallback(!1, a, e, c, d) }, _maybeProcessNextItemAfterOnValidateCallback: function (a, b, c, d, e) { var f = this; if (b.length > c) if (a || !this._options.validation.stopOnFirstInvalidFile) setTimeout(function () { var a = f._getValidationDescriptor(b[c].file); f._handleCheckedCallback({ name: "onValidate", callback: qq.bind(f._options.callbacks.onValidate, f, b[c].file), onSuccess: qq.bind(f._onValidateCallbackSuccess, f, b, c, d, e), onFailure: qq.bind(f._onValidateCallbackFailure, f, b, c, d, e), identifier: "Item '" + a.name + "', size: " + a.size }) }, 0); else if (!a) for (; c < b.length; c++) f._fileOrBlobRejected(b[c].id) }, _validateFileOrBlobData: function (a, b) { var c = this, d = a.file, e = b.name, f = b.size, g = this._getButtonId(d), h = this._getValidationBase(g), i = new qq.Promise; return i.then(function () { }, function () { c._fileOrBlobRejected(a.id, e) }), qq.isFileOrInput(d) && !this._isAllowedExtension(h.allowedExtensions, e) ? (this._itemError("typeError", e, d), i.failure()) : 0 === f ? (this._itemError("emptyError", e, d), i.failure()) : f && h.sizeLimit && f > h.sizeLimit ? (this._itemError("sizeError", e, d), i.failure()) : f && f < h.minSizeLimit ? (this._itemError("minSizeError", e, d), i.failure()) : (qq.ImageValidation && qq.supportedFeatures.imagePreviews && qq.isFile(d) ? new qq.ImageValidation(d, qq.bind(c.log, c)).validate(h.image).then(i.success, function (a) { c._itemError(a + "ImageError", e, d), i.failure() }) : i.success(), i) }, _fileOrBlobRejected: function (a) { this._netUploadedOrQueued--, this._uploadData.setStatus(a, qq.status.REJECTED) }, _itemError: function (a, b, c) { function d(a, b) { g = g.replace(a, b) } var e, f, g = this._options.messages[a], h = [], i = [].concat(b), j = i[0], k = this._getButtonId(c), l = this._getValidationBase(k); return qq.each(l.allowedExtensions, function (a, b) { qq.isString(b) && h.push(b) }), e = h.join(", ").toLowerCase(), d("{file}", this._options.formatFileName(j)), d("{extensions}", e), d("{sizeLimit}", this._formatSize(l.sizeLimit)), d("{minSizeLimit}", this._formatSize(l.minSizeLimit)), f = g.match(/(\{\w+\})/g), null !== f && qq.each(f, function (a, b) { d(b, i[a]) }), this._options.callbacks.onError(null, j, g, void 0), g }, _batchError: function (a) { this._options.callbacks.onError(null, null, a, void 0) }, _isAllowedExtension: function (a, b) { var c = !1; return a.length ? (qq.each(a, function (a, d) { if (qq.isString(d)) { var e = new RegExp("\\." + d + "$", "i"); if (null != b.match(e)) return c = !0, !1 } }), c) : !0 }, _formatSize: function (a) { var b = -1; do a /= 1e3, b++; while (a > 999); return Math.max(a, .1).toFixed(1) + this._options.text.sizeSymbols[b] }, _wrapCallbacks: function () { var a, b; a = this, b = function (b, c, d) { var e; try { return c.apply(a, d) } catch (f) { e = f.message || f.toString(), a.log("Caught exception in '" + b + "' callback - " + e, "error") } }; for (var c in this._options.callbacks) !function () { var d, e; d = c, e = a._options.callbacks[d], a._options.callbacks[d] = function () { return b(d, e, arguments) } }() }, _parseFileOrBlobDataName: function (a) { var b; return b = qq.isFileOrInput(a) ? a.value ? a.value.replace(/.*(\/|\\)/, "") : null !== a.fileName && void 0 !== a.fileName ? a.fileName : a.name : a.name }, _parseFileOrBlobDataSize: function (a) { var b; return qq.isFileOrInput(a) ? void 0 === a.value && (b = null !== a.fileSize && void 0 !== a.fileSize ? a.fileSize : a.size) : b = a.blob.size, b }, _getValidationDescriptor: function (a) { var b = {}, c = this._parseFileOrBlobDataName(a), d = this._parseFileOrBlobDataSize(a); return b.name = c, void 0 !== d && (b.size = d), b }, _getValidationDescriptors: function (a) { var b = this, c = []; return qq.each(a, function (a, d) { c.push(b._getValidationDescriptor(d.file)) }), c }, _createParamsStore: function (a) { var b = {}, c = this; return { setParams: function (a, c) { var d = {}; qq.extend(d, a), b[c] = d }, getParams: function (d) { var e = {}; return null != d && b[d] ? qq.extend(e, b[d]) : qq.extend(e, c._options[a].params), e }, remove: function (a) { return delete b[a] }, reset: function () { b = {} } } }, _createEndpointStore: function (a) { var b = {}, c = this; return { setEndpoint: function (a, c) { b[c] = a }, getEndpoint: function (d) { return null != d && b[d] ? b[d] : c._options[a].endpoint }, remove: function (a) { return delete b[a] }, reset: function () { b = {} } } }, _handleCameraAccess: function () { if (this._options.camera.ios && qq.ios()) { var a = "image/*;capture=camera", b = this._options.camera.button, c = b ? this._getButtonId(b) : this._defaultButtonId, d = this._options; c && c !== this._defaultButtonId && (d = this._extraButtonSpecs[c]), d.multiple = !1, null === d.validation.acceptFiles ? d.validation.acceptFiles = a : d.validation.acceptFiles += "," + a, qq.each(this._buttons, function (a, b) { return b.getButtonId() === c ? (b.setMultiple(d.multiple), b.setAcceptFiles(d.acceptFiles), !1) : void 0 }) } }, _getValidationBase: function (a) { var b = this._extraButtonSpecs[a]; return b ? b.validation : this._options.validation } }}(), function () { "use strict"; qq.FineUploaderBasic = function (a) { this._options = { debug: !1, button: null, multiple: !0, maxConnections: 3, disableCancelForFormUploads: !1, autoUpload: !0, request: { endpoint: "/server/upload", params: {}, paramsInBody: !0, customHeaders: {}, forceMultipart: !0, inputName: "qqfile", uuidName: "qquuid", totalFileSizeName: "qqtotalfilesize", filenameParam: "qqfilename" }, validation: { allowedExtensions: [], sizeLimit: 0, minSizeLimit: 0, itemLimit: 0, stopOnFirstInvalidFile: !0, acceptFiles: null, image: { maxHeight: 0, maxWidth: 0, minHeight: 0, minWidth: 0 } }, callbacks: { onSubmit: function () { }, onSubmitted: function () { }, onComplete: function () { }, onCancel: function () { }, onUpload: function () { }, onUploadChunk: function () { }, onUploadChunkSuccess: function () { }, onResume: function () { }, onProgress: function () { }, onError: function () { }, onAutoRetry: function () { }, onManualRetry: function () { }, onValidateBatch: function () { }, onValidate: function () { }, onSubmitDelete: function () { }, onDelete: function () { }, onDeleteComplete: function () { }, onPasteReceived: function () { }, onStatusChange: function () { }, onSessionRequestComplete: function () { } }, messages: { typeError: "عفوا هذا الملف يحتوى على مسار غير مسموح به , المسارات المتاحة {extensions} ", sizeError: "حجم الملف كبير جدا اقصى حجم هو {sizeLimit}", minSizeError: "{file} is too small, minimum file size is {minSizeLimit}.", emptyError: "{file} is empty, please select files again without it.", noFilesError: "No files to upload.", tooManyItemsError: "Too many items ({netItems}) would be uploaded. Item limit is {itemLimit}.", maxHeightImageError: "Image is too tall.", maxWidthImageError: "Image is too wide.", minHeightImageError: "Image is not tall enough.", minWidthImageError: "Image is not wide enough.", retryFailTooManyItems: "Retry failed - you have reached your file limit.", onLeave: "The files are being uploaded, if you leave now the upload will be canceled." }, retry: { enableAuto: !1, maxAutoAttempts: 3, autoAttemptDelay: 5, preventRetryResponseProperty: "preventRetry" }, classes: { buttonHover: "qq-upload-button-hover", buttonFocus: "qq-upload-button-focus" }, chunking: { enabled: !1, partSize: 2e6, paramNames: { partIndex: "qqpartindex", partByteOffset: "qqpartbyteoffset", chunkSize: "qqchunksize", totalFileSize: "qqtotalfilesize", totalParts: "qqtotalparts" } }, resume: { enabled: !1, id: null, cookiesExpireIn: 7, paramNames: { resuming: "qqresume" } }, formatFileName: function (a) { return void 0 !== a && a.length > 33 && (a = a.slice(0, 19) + "..." + a.slice(-14)), a }, text: { defaultResponseError: "Upload failure reason unknown", sizeSymbols: ["kB", "MB", "GB", "TB", "PB", "EB"] }, deleteFile: { enabled: !1, method: "DELETE", endpoint: "/server/upload", customHeaders: {}, params: {} }, cors: { expected: !1, sendCredentials: !1, allowXdr: !1 }, blobs: { defaultName: "misc_data" }, paste: { targetElement: null, defaultName: "pasted_image" }, camera: { ios: !1, button: null }, extraButtons: [], session: { endpoint: null, params: {}, customHeaders: {}, refreshOnReset: !0 } }, qq.extend(this._options, a, !0), this._buttons = [], this._extraButtonSpecs = {}, this._buttonIdsForFileIds = [], this._wrapCallbacks(), this._disposeSupport = new qq.DisposeSupport, this._storedIds = [], this._autoRetries = [], this._retryTimeouts = [], this._preventRetries = [], this._thumbnailUrls = [], this._netUploadedOrQueued = 0, this._netUploaded = 0, this._uploadData = this._createUploadDataTracker(), this._paramsStore = this._createParamsStore("request"), this._deleteFileParamsStore = this._createParamsStore("deleteFile"), this._endpointStore = this._createEndpointStore("request"), this._deleteFileEndpointStore = this._createEndpointStore("deleteFile"), this._handler = this._createUploadHandler(), this._deleteHandler = qq.DeleteFileAjaxRequester && this._createDeleteHandler(), this._options.button && (this._defaultButtonId = this._createUploadButton({ element: this._options.button }).getButtonId()), this._generateExtraButtonSpecs(), this._handleCameraAccess(), this._options.paste.targetElement && (qq.PasteSupport ? this._pasteHandler = this._createPasteHandler() : qq.log("Paste support module not found", "info")), this._preventLeaveInProgress(), this._imageGenerator = qq.ImageGenerator && new qq.ImageGenerator(qq.bind(this.log, this)), this._refreshSessionData() }, qq.FineUploaderBasic.prototype = qq.basePublicApi, qq.extend(qq.FineUploaderBasic.prototype, qq.basePrivateApi) }(), qq.AjaxRequester = function (a) { "use strict"; function b() { return qq.indexOf(["GET", "POST", "HEAD"], v.method) >= 0 } function c() { var a = !1; return qq.each(a, function (b, c) { return qq.indexOf(["Accept", "Accept-Language", "Content-Language", "Content-Type"], c) < 0 ? (a = !0, !1) : void 0 }), a } function d(a) { return v.cors.expected && void 0 === a.withCredentials } function e() { var a; return (window.XMLHttpRequest || window.ActiveXObject) && (a = qq.createXhrInstance(), void 0 === a.withCredentials && (a = new XDomainRequest)), a } function f(a, b) { var c = u[a].xhr; return c || b || (c = v.cors.expected ? e() : qq.createXhrInstance(), u[a].xhr = c), c } function g(a) { var b, c = qq.indexOf(t, a), d = v.maxConnections; delete u[a], t.splice(c, 1), t.length >= d && d > c && (b = t[d - 1], j(b)) } function h(a, b) { var c = f(a), e = v.method, h = b === !0; g(a), h ? r(e + " request for " + a + " has failed", "error") : d(c) || p(c.status) || (h = !0, r(e + " request for " + a + " has failed - response code " + c.status, "error")), v.onComplete(a, c, h) } function i(a) { var b, c = u[a].additionalParams, d = v.mandatedParams; return v.paramsStore.getParams && (b = v.paramsStore.getParams(a)), c && qq.each(c, function (a, c) { b = b || {}, b[a] = c }), d && qq.each(d, function (a, c) { b = b || {}, b[a] = c }), b } function j(a) { var b, c = f(a), e = v.method, g = i(a), h = u[a].payload; v.onSend(a), b = k(a, g), d(c) ? (c.onload = m(a), c.onerror = n(a)) : c.onreadystatechange = l(a), c.open(e, b, !0), v.cors.expected && v.cors.sendCredentials && !d(c) && (c.withCredentials = !0), o(a), r("Sending " + e + " request for " + a), h ? c.send(h) : s || !g ? c.send() : c.send(g && v.contentType.toLowerCase().indexOf("application/x-www-form-urlencoded") >= 0 ? qq.obj2url(g, "") : g && v.contentType.toLowerCase().indexOf("application/json") >= 0 ? JSON.stringify(g) : g) } function k(a, b) { var c = v.endpointStore.getEndpoint(a), d = u[a].addToPath; return void 0 != d && (c += "/" + d), s && b ? qq.obj2url(b, c) : c } function l(a) { return function () { 4 === f(a).readyState && h(a) } } function m(a) { return function () { h(a) } } function n(a) { return function () { h(a, !0) } } function o(a) { var e = f(a), g = v.customHeaders, h = u[a].additionalHeaders || {}, i = v.method, j = {}; d(e) || (v.allowXRequestedWithAndCacheControl && (v.cors.expected && b() && !c(g) || (e.setRequestHeader("X-Requested-With", "XMLHttpRequest"), e.setRequestHeader("Cache-Control", "no-cache"))), !v.contentType || "POST" !== i && "PUT" !== i || e.setRequestHeader("Content-Type", v.contentType), qq.extend(j, g), qq.extend(j, h), qq.each(j, function (a, b) { e.setRequestHeader(a, b) })) } function p(a) { return qq.indexOf(v.successfulResponseCodes[v.method], a) >= 0 } function q(a, b, c, d, e) { u[a] = { addToPath: b, additionalParams: c, additionalHeaders: d, payload: e }; var f = t.push(a); f <= v.maxConnections && j(a) } var r, s, t = [], u = [], v = { validMethods: ["POST"], method: "POST", contentType: "application/x-www-form-urlencoded", maxConnections: 3, customHeaders: {}, endpointStore: {}, paramsStore: {}, mandatedParams: {}, allowXRequestedWithAndCacheControl: !0, successfulResponseCodes: { DELETE: [200, 202, 204], POST: [200, 204], GET: [200] }, cors: { expected: !1, sendCredentials: !1 }, log: function () { }, onSend: function () { }, onComplete: function () { } }; if (qq.extend(v, a), r = v.log, qq.indexOf(v.validMethods, v.method) < 0) throw new Error("'" + v.method + "' is not a supported method for this type of request!"); s = "GET" === v.method || "DELETE" === v.method, qq.extend(this, { initTransport: function (a) { var b, c, d, e; return { withPath: function (a) { return b = a, this }, withParams: function (a) { return c = a, this }, withHeaders: function (a) { return d = a, this }, withPayload: function (a) { return e = a, this }, send: function () { q(a, b, c, d, e) } } } }) }, qq.UploadHandler = function (a, b) { "use strict"; function c(a) { var b, c = qq.indexOf(i, a), d = f.maxConnections; c >= 0 && (i.splice(c, 1), i.length >= d && d > c && (b = i[d - 1], h.upload(b))) } function d(a) { g("Cancelling " + a), f.paramsStore.remove(a), c(a) } function e() { var a = b ? qq[b] : qq, d = qq.supportedFeatures.ajaxUploading ? "Xhr" : "Form"; h = new a["UploadHandler" + d](f, { onUploadComplete: c, onUuidChanged: f.onUuidChanged, getName: f.getName, getUuid: f.getUuid, getSize: f.getSize, log: g }) } var f, g, h, i = []; f = { debug: !1, forceMultipart: !0, paramsInBody: !1, paramsStore: {}, endpointStore: {}, filenameParam: "qqfilename", cors: { expected: !1, sendCredentials: !1 }, maxConnections: 3, uuidName: "qquuid", totalFileSizeName: "qqtotalfilesize", chunking: { enabled: !1, partSize: 2e6, paramNames: { partIndex: "qqpartindex", partByteOffset: "qqpartbyteoffset", chunkSize: "qqchunksize", totalParts: "qqtotalparts", filename: "qqfilename" } }, resume: { enabled: !1, id: null, cookiesExpireIn: 7, paramNames: { resuming: "qqresume" } }, log: function () { }, onProgress: function () { }, onComplete: function () { }, onCancel: function () { }, onUpload: function () { }, onUploadChunk: function () { }, onUploadChunkSuccess: function () { }, onAutoRetry: function () { }, onResume: function () { }, onUuidChanged: function () { }, getName: function () { } }, qq.extend(f, a), g = f.log, qq.extend(this, { add: function () { return h.add.apply(this, arguments) }, upload: function (a) { var b = i.push(a); return b <= f.maxConnections ? (h.upload(a), !0) : !1 }, retry: function (a) { var b = qq.indexOf(i, a); return b >= 0 ? h.upload(a, !0) : this.upload(a) }, cancel: function (a) { var b = h.cancel(a); b instanceof qq.Promise ? b.then(function () { d(a) }) : b !== !1 && d(a) }, cancelAll: function () { var a = this, b = []; qq.extend(b, i), qq.each(b, function (b, c) { a.cancel(c) }), i = [] }, getFile: function (a) { return h.getFile ? h.getFile(a) : void 0 }, getInput: function (a) { return h.getInput ? h.getInput(a) : void 0 }, reset: function () { g("Resetting upload handler"), this.cancelAll(), i = [], h.reset() }, expunge: function (a) { return this.isValid(a) ? h.expunge(a) : void 0 }, isValid: function (a) { return h.isValid(a) }, getResumableFilesData: function () { return h.getResumableFilesData ? h.getResumableFilesData() : [] }, getThirdPartyFileId: function (a) { return h.getThirdPartyFileId && this.isValid(a) ? h.getThirdPartyFileId(a) : void 0 }, pause: function (a) { return h.pause && this.isValid(a) && h.pause(a) ? (c(a), !0) : void 0 } }), e() }, qq.UploadHandlerFormApi = function (a, b, c) { "use strict"; function d(b) { delete j[b], delete m[b], l && (clearTimeout(k[b]), delete k[b], t.stopReceivingMessages(b)); var c = document.getElementById(a.getIframeName(b)); c && (c.setAttribute("src", "java" + String.fromCharCode(115) + "cript:false;"), qq(c).remove()) } function e(b, c) { var d = b.id, e = g(d), f = r(e); i[f] = c, j[e] = qq(b).attach("load", function () { m[e].input && (s("Received iframe load event for CORS upload request (iframe name " + d + ")"), k[d] = setTimeout(function () { var a = "No valid message received from loaded iframe for iframe name " + d; s(a, "error"), c({ error: a }) }, 1e3)) }), t.receiveMessage(d, function (b) { s("Received the following window message: '" + b + "'"); var c, e = g(d), f = a.parseJsonResponse(e, b), h = f.uuid; h && i[h] ? (s("Handling response for iframe name " + d), clearTimeout(k[d]), delete k[d], a.detachLoadEvent(d), c = i[h], delete i[h], t.stopReceivingMessages(d), c(f)) : h || s("'" + b + "' does not contain a UUID - ignoring.") }) } function f(a) { var b = qq.toElement("