Seditio Source
Root |
./othercms/b2evolution_7.2.3/rsc/js/build/evo_fileuploader_sortable.bmin.js
/* This file includes ALL files that are used for quick file uploader with sortable feature for attachments */

function base64_decode(e){var t,n,i,o,a,r,s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",l=0,u=0,d=[];if(!e)return e;for(e+="";t=(r=s.indexOf(e.charAt(l++))<<18|s.indexOf(e.charAt(l++))<<12|(o=s.indexOf(e.charAt(l++)))<<6|(a=s.indexOf(e.charAt(l++))))>>16&255,n=r>>8&255,i=255&r,d[u++]=64==o?String.fromCharCode(t):64==a?String.fromCharCode(t,n):String.fromCharCode(t,n,i),l<e.length;);return d.join("")}function htmlspecialchars_decode(e,t){var n=0,i=0,o=!1;void 0===t&&(t=2),e=e.toString().replace(/&lt;/g,"<").replace(/&gt;/g,">");var a={ENT_NOQUOTES:0,ENT_HTML_QUOTE_SINGLE:1,ENT_HTML_QUOTE_DOUBLE:2,ENT_COMPAT:2,ENT_QUOTES:3,ENT_IGNORE:4};if(0===t&&(o=!0),"number"!=typeof t){for(t=[].concat(t),i=0;i<t.length;i++)0===a[t[i]]?o=!0:a[t[i]]&&(n|=a[t[i]]);t=n}return t&a.ENT_HTML_QUOTE_SINGLE&&(e=e.replace(/&#0*39;/g,"'")),o||(e=e.replace(/&quot;/g,'"')),e.replace(/&amp;/g,"&")}!function(global){var qq=function(o){"use strict";return{hide:function(){return o.style.display="none",this},attach:function(e,t){return o.addEventListener?o.addEventListener(e,t,!1):o.attachEvent&&o.attachEvent("on"+e,t),function(){qq(o).detach(e,t)}},detach:function(e,t){return o.removeEventListener?o.removeEventListener(e,t,!1):o.attachEvent&&o.detachEvent("on"+e,t),this},contains:function(e){return!!e&&(o===e||(o.contains?o.contains(e):!!(8&e.compareDocumentPosition(o))))},insertBefore:function(e){return e.parentNode.insertBefore(o,e),this},remove:function(){return o.parentNode.removeChild(o),this},css:function(e){if(null==o.style)throw new qq.Error("Can't apply style to node as it is not on the HTMLElement prototype chain!");return null!=e.opacity&&"string"!=typeof o.style.opacity&&void 0!==o.filters&&(e.filter="alpha(opacity="+Math.round(100*e.opacity)+")"),qq.extend(o.style,e),this},hasClass:function(e,t){var n=new RegExp("(^| )"+e+"( |$)");return n.test(o.className)||!(!t||!n.test(o.parentNode.className))},addClass:function(e){return qq(o).hasClass(e)||(o.className+=" "+e),this},removeClass:function(e){var t=new RegExp("(^| )"+e+"( |$)");return o.className=o.className.replace(t," ").replace(/^\s+|\s+$/g,""),this},getByClass:function(n,e){var t,i=[];return e&&o.querySelector?o.querySelector("."+n):o.querySelectorAll?o.querySelectorAll("."+n):(t=o.getElementsByTagName("*"),qq.each(t,function(e,t){qq(t).hasClass(n)&&i.push(t)}),e?i[0]:i)},getFirstByClass:function(e){return qq(o).getByClass(e,!0)},children:function(){for(var e=[],t=o.firstChild;t;)1===t.nodeType&&e.push(t),t=t.nextSibling;return e},setText:function(e){return o.innerText=e,o.textContent=e,this},clearText:function(){return qq(o).setText("")},hasAttribute:function(e){var t;return o.hasAttribute?!!o.hasAttribute(e)&&null==/^false$/i.exec(o.getAttribute(e)):void 0!==(t=o[e])&&null==/^false$/i.exec(t)}}},DF;function Ux(m,e,t,n,q){var i,o,a,r,s,l,u,d,c,p,h,f,g,_,b=m.naturalWidth,v=m.naturalHeight,y=n.width,w=n.height,x=t.getContext("2d"),S=new qq.Promise;return x.save(),n.resize?(o={blob:e,canvas:t,image:m,imageHeight:v,imageWidth:b,orientation:n.orientation,resize:n.resize,targetHeight:w,targetWidth:y},a=o.blob,r=o.image,s=o.imageHeight,l=o.imageWidth,u=o.orientation,d=new qq.Promise,c=o.resize,p=document.createElement("canvas"),h=p.getContext("2d"),f=o.canvas,g=o.targetHeight,_=o.targetWidth,Wx(p,l,s,u),f.height=g,f.width=_,h.drawImage(r,0,0),c({blob:a,height:g,image:r,sourceCanvas:p,targetCanvas:f,width:_}).then(function(){f.qqImageRendered&&f.qqImageRendered(),d.success()},d.failure),d):(qq.supportedFeatures.unlimitedScaledImageSize||(i=function(e){var t=5241e3;if(!qq.ios())throw new qq.Error("Downsampled dimensions can only be reliably calculated for iOS!");if(t<e.origHeight*e.origWidth)return{newHeight:Math.round(Math.sqrt(e.origHeight/e.origWidth*t)),newWidth:Math.round(Math.sqrt(e.origWidth/e.origHeight*t))}}({origWidth:y,origHeight:w}))&&(qq.log(qq.format("Had to reduce dimensions due to device limitations from {}w / {}h to {}w / {}h",y,w,i.newWidth,i.newHeight),"warn"),y=i.newWidth,w=i.newHeight),Wx(t,y,w,n.orientation),qq.ios()?function(){var e,t,n,i,o;n=(e=m).naturalWidth,i=e.naturalHeight,o=document.createElement("canvas"),1048576<n*i&&(o.width=o.height=1,(t=o.getContext("2d")).drawImage(e,1-n,0),0===t.getImageData(0,0,1,1).data[3])&&(b/=2,v/=2);var a,r,s,l=1024,u=document.createElement("canvas"),d=q?function(e,t,n){var i,o,a,r=document.createElement("canvas"),s=0,l=n,u=n;for(r.width=1,r.height=n,(i=r.getContext("2d")).drawImage(e,0,0),o=i.getImageData(0,0,1,n).data;s<u;)0===o[4*(u-1)+3]?l=u:s=u,u=l+s>>1;return 0==(a=u/n)?1:a}(m,0,v):1,c=Math.ceil(l*y/b),p=Math.ceil(l*w/v/d),h=0,f=0;for(u.width=u.height=l,a=u.getContext("2d");h<v;){for(s=r=0;r<b;)a.clearRect(0,0,l,l),a.drawImage(m,-r,-h),x.drawImage(u,0,0,l,l,s,f,c,p),r+=l,s+=c;h+=l,f+=p}x.restore(),u=a=null}():x.drawImage(m,0,0,y,w),t.qqImageRendered&&t.qqImageRendered(),S.success(),S)}function Wx(e,t,n,i){switch(i){case 5:case 6:case 7:case 8:e.width=n,e.height=t;break;default:e.width=t,e.height=n}var o=e.getContext("2d");switch(i){case 2:o.translate(t,0),o.scale(-1,1);break;case 3:o.translate(t,n),o.rotate(Math.PI);break;case 4:o.translate(0,n),o.scale(1,-1);break;case 5:o.rotate(.5*Math.PI),o.scale(1,-1);break;case 6:o.rotate(.5*Math.PI),o.translate(0,-n);break;case 7:o.rotate(.5*Math.PI),o.translate(t,-n),o.scale(-1,1);break;case 8:o.rotate(-.5*Math.PI),o.translate(-t,0)}}function Xx(n,e){var i=this;window.Blob&&n instanceof Blob&&function(){var e=new Image,t=window.URL&&window.URL.createObjectURL?window.URL:window.webkitURL&&window.webkitURL.createObjectURL?window.webkitURL:null;if(!t)throw Error("No createObjectURL function found to create blob url");e.src=t.createObjectURL(n),i.blob=n,n=e}(),n.naturalWidth||n.naturalHeight||(n.onload=function(){var n=i.imageLoadListeners;n&&(i.imageLoadListeners=null,setTimeout(function(){for(var e=0,t=n.length;e<t;e++)n[e]()},0))},n.onerror=e,this.imageLoadListeners=[]),this.srcImage=n}!function(){"use strict";var sb;qq.canvasToBlob=function(e,t,n){return qq.dataUriToBlob(e.toDataURL(t,n))},qq.dataUriToBlob=function(e){var t,n,i,o,a,r,s,l;return n=0<=e.split(",")[0].indexOf("base64")?atob(e.split(",")[1]):decodeURI(e.split(",")[1]),o=e.split(",")[0].split(":")[1].split(";")[0],t=new ArrayBuffer(n.length),i=new Uint8Array(t),qq.each(n,function(e,t){i[e]=t.charCodeAt(0)}),a=t,r=o,(l=(s=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder)&&new s)?(l.append(a),l.getBlob(r)):new Blob([a],{type:r})},qq.log=function(e,t){window.console&&(t&&"info"!==t?window.console[t]?window.console[t](e):window.console.log("<"+t+"> "+e):window.console.log(e))},qq.isObject=function(e){return e&&!e.nodeType&&"[object Object]"===Object.prototype.toString.call(e)},qq.isFunction=function(e){return"function"==typeof e},qq.isArray=function(e){return"[object Array]"===Object.prototype.toString.call(e)||e&&window.ArrayBuffer&&e.buffer&&e.buffer.constructor===ArrayBuffer},qq.isItemList=function(e){return"[object DataTransferItemList]"===Object.prototype.toString.call(e)},qq.isNodeList=function(e){return"[object NodeList]"===Object.prototype.toString.call(e)||e.item&&e.namedItem},qq.isString=function(e){return"[object String]"===Object.prototype.toString.call(e)},qq.trimStr=function(e){return String.prototype.trim?e.trim():e.replace(/^\s+|\s+$/g,"")},qq.format=function(e){var t=Array.prototype.slice.call(arguments,1),o=e,a=o.indexOf("{}");return qq.each(t,function(e,t){var n=o.substring(0,a),i=o.substring(a+2);if((a=(o=n+t+i).indexOf("{}",a+t.length))<0)return!1}),o},qq.isFile=function(e){return window.File&&"[object File]"===Object.prototype.toString.call(e)},qq.isFileList=function(e){return window.FileList&&"[object FileList]"===Object.prototype.toString.call(e)},qq.isFileOrInput=function(e){return qq.isFile(e)||qq.isInput(e)},qq.isInput=function(e,n){function t(e){var t=e.toLowerCase();return n?"file"!==t:"file"===t}return!!(window.HTMLInputElement&&"[object HTMLInputElement]"===Object.prototype.toString.call(e)&&e.type&&t(e.type))||!!(e.tagName&&"input"===e.tagName.toLowerCase()&&e.type&&t(e.type))},qq.isBlob=function(e){if(window.Blob&&"[object Blob]"===Object.prototype.toString.call(e))return!0},qq.isXhrUploadSupported=function(){var e=document.createElement("input");return e.type="file",void 0!==e.multiple&&"undefined"!=typeof File&&"undefined"!=typeof FormData&&void 0!==qq.createXhrInstance().upload},qq.createXhrInstance=function(){if(window.XMLHttpRequest)return new XMLHttpRequest;try{return new ActiveXObject("MSXML2.XMLHTTP.3.0")}catch(e){return qq.log("Neither XHR or ActiveX are supported!","error"),null}},qq.isFolderDropSupported=function(e){return e.items&&0<e.items.length&&e.items[0].webkitGetAsEntry},qq.isFileChunkingSupported=function(){return!qq.androidStock()&&qq.isXhrUploadSupported()&&(void 0!==File.prototype.slice||void 0!==File.prototype.webkitSlice||void 0!==File.prototype.mozSlice)},qq.sliceBlob=function(e,t,n){return(e.slice||e.mozSlice||e.webkitSlice).call(e,t,n)},qq.arrayBufferToHex=function(e){var i="",t=new Uint8Array(e);return qq.each(t,function(e,t){var n=t.toString(16);n.length<2&&(n="0"+n),i+=n}),i},qq.readBlobToHex=function(e,t,n){var i=qq.sliceBlob(e,t,t+n),o=new FileReader,a=new qq.Promise;return o.onload=function(){a.success(qq.arrayBufferToHex(o.result))},o.onerror=a.failure,o.readAsArrayBuffer(i),a},qq.extend=function(n,e,i){return qq.each(e,function(e,t){i&&qq.isObject(t)?(void 0===n[e]&&(n[e]={}),qq.extend(n[e],t,!0)):n[e]=t}),n},qq.override=function(n,e){var i={},t=e(i);return qq.each(t,function(e,t){void 0!==n[e]&&(i[e]=n[e]),n[e]=t}),n},qq.indexOf=function(e,t,n){if(e.indexOf)return e.indexOf(t,n);n=n||0;var i=e.length;for(n<0&&(n+=i);n<i;n+=1)if(e.hasOwnProperty(n)&&e[n]===t)return n;return-1},qq.getUniqueId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,function(e){var t=16*Math.random()|0;return("x"==e?t:3&t|8).toString(16)})},qq.ie=function(){return-1!==navigator.userAgent.indexOf("MSIE")||-1!==navigator.userAgent.indexOf("Trident")},qq.ie7=function(){return-1!==navigator.userAgent.indexOf("MSIE 7")},qq.ie8=function(){return-1!==navigator.userAgent.indexOf("MSIE 8")},qq.ie10=function(){return-1!==navigator.userAgent.indexOf("MSIE 10")},qq.ie11=function(){return qq.ie()&&-1!==navigator.userAgent.indexOf("rv:11")},qq.edge=function(){return 0<=navigator.userAgent.indexOf("Edge")},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.edge()&&!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.androidStock=function(){return qq.android()&&navigator.userAgent.toLowerCase().indexOf("chrome")<0},qq.ios6=function(){return qq.ios()&&-1!==navigator.userAgent.indexOf(" OS 6_")},qq.ios7=function(){return qq.ios()&&-1!==navigator.userAgent.indexOf(" OS 7_")},qq.ios8=function(){return qq.ios()&&-1!==navigator.userAgent.indexOf(" OS 8_")},qq.ios800=function(){return qq.ios()&&-1!==navigator.userAgent.indexOf(" OS 8_0 ")},qq.ios=function(){return-1!==navigator.userAgent.indexOf("iPad")||-1!==navigator.userAgent.indexOf("iPod")||-1!==navigator.userAgent.indexOf("iPhone")},qq.iosChrome=function(){return qq.ios()&&-1!==navigator.userAgent.indexOf("CriOS")},qq.iosSafari=function(){return qq.ios()&&!qq.iosChrome()&&-1!==navigator.userAgent.indexOf("Safari")},qq.iosSafariWebView=function(){return qq.ios()&&!qq.iosChrome()&&!qq.iosSafari()},qq.preventDefault=function(e){e.preventDefault?e.preventDefault():e.returnValue=!1},qq.toElement=(sb=document.createElement("div"),function(e){sb.innerHTML=e;var t=sb.firstChild;return sb.removeChild(t),t}),qq.each=function(e,t){var n;if(e)if(window.Storage&&e.constructor===window.Storage)for(n=0;n<e.length&&!1!==t(e.key(n),e.getItem(e.key(n)));n++);else if(qq.isArray(e)||qq.isItemList(e)||qq.isNodeList(e))for(n=0;n<e.length&&!1!==t(n,e[n]);n++);else if(qq.isString(e))for(n=0;n<e.length&&!1!==t(n,e.charAt(n));n++);else for(n in e)if(Object.prototype.hasOwnProperty.call(e,n)&&!1===t(n,e[n]))break},qq.bind=function(t,n){if(qq.isFunction(t)){var i=Array.prototype.slice.call(arguments,2);return function(){var e=qq.extend([],i);return arguments.length&&(e=e.concat(Array.prototype.slice.call(arguments))),t.apply(n,e)}}throw new Error("first parameter must be a function!")},qq.obj2url=function(e,i,t){function n(e,t){var n=i?/\[\]$/.test(i)?i:i+"["+t+"]":t;"undefined"!==n&&"undefined"!==t&&o.push("object"==typeof e?qq.obj2url(e,n,!0):"[object Function]"===Object.prototype.toString.call(e)?encodeURIComponent(n)+"="+encodeURIComponent(e()):encodeURIComponent(n)+"="+encodeURIComponent(e))}var o=[],a="&";return!t&&i?(a=/\?/.test(i)?/\?$/.test(i)?"":"&":"?",o.push(i),o.push(qq.obj2url(e))):"[object Array]"===Object.prototype.toString.call(e)&&void 0!==e?qq.each(e,function(e,t){n(t,e)}):null!=e&&"object"==typeof e?qq.each(e,function(e,t){n(t,e)}):o.push(encodeURIComponent(i)+"="+encodeURIComponent(e)),i?o.join(a):o.join(a).replace(/^&/,"").replace(/%20/g,"+")},qq.obj2FormData=function(e,n,i){return n=n||new FormData,qq.each(e,function(e,t){e=i?i+"["+e+"]":e,qq.isObject(t)?qq.obj2FormData(t,n,e):qq.isFunction(t)?n.append(e,t()):n.append(e,t)}),n},qq.obj2Inputs=function(e,n){var i;return n=n||document.createElement("form"),qq.obj2FormData(e,{append:function(e,t){(i=document.createElement("input")).setAttribute("name",e),i.setAttribute("value",t),n.appendChild(i)}}),n},qq.parseJson=function(json){return window.JSON&&qq.isFunction(JSON.parse)?JSON.parse(json):eval("("+json+")")},qq.getExtension=function(e){var t=e.lastIndexOf(".")+1;if(0<t)return e.substr(t,e.length-t)},qq.getFilename=function(e){return qq.isInput(e)?e.value.replace(/.*(\/|\\)/,""):qq.isFile(e)&&null!==e.fileName&&void 0!==e.fileName?e.fileName:e.name},qq.DisposeSupport=function(){var t=[];return{dispose:function(){for(var e;(e=t.shift())&&e(),e;);},attach:function(){var e=arguments;this.addDisposer(qq(e[0]).attach.apply(this,Array.prototype.slice.call(arguments,1)))},addDisposer:function(e){t.push(e)}}}}(),function(){"use strict";"function"==typeof define&&define.amd?define(function(){return qq}):"undefined"!=typeof module&&module.exports?module.exports=qq:global.qq=qq}(),function(){"use strict";qq.Error=function(e){this.message="[Fine Uploader "+qq.version+"] "+e},qq.Error.prototype=new Error}(),qq.version="5.16.2",qq.supportedFeatures=function(){"use strict";var e,t,n,i,o,a,r,s,l,u,d,c,p,h,f,m,q;function g(){return!!window.XMLHttpRequest&&void 0!==qq.createXhrInstance().withCredentials}function _(){return void 0!==window.XDomainRequest}return t=(i=(e=function(){var e,t=!0;try{(e=document.createElement("input")).type="file",qq(e).hide(),e.disabled&&(t=!1)}catch(e){t=!1}return t}())&&qq.isXhrUploadSupported())&&!qq.androidStock(),o=(n=i&&("draggable"in(m=document.createElement("span"))||"ondragstart"in m&&"ondrop"in m)&&!qq.android()&&!qq.ios())&&((q=document.createElement("input")).type="file",!!("webkitdirectory"in(q||document.querySelectorAll("input[type=file]")[0]))),a=i&&qq.isFileChunkingSupported(),r=i&&a&&function(){try{return!!window.localStorage&&qq.isFunction(window.localStorage.setItem)}catch(e){return!1}}(),s=i&&(qq.chrome()||qq.opera())&&void 0!==navigator.userAgent.match(/Chrome\/[1][4-9]|Chrome\/[2-9][0-9]/),l=e&&(void 0!==window.postMessage||i),d=g(),u=_(),c=!!g()||_(),p=void 0!==document.createElement("input").webkitdirectory,h=i&&void 0!==window.FileReader,f=!!i&&!qq.androidStock()&&!qq.iosChrome(),{ajaxUploading:i,blobUploading:t,canDetermineSize:i,chunking:a,deleteFileCors:c,deleteFileCorsXdr:u,deleteFileCorsXhr:d,dialogElement:!!window.HTMLDialogElement,fileDrop:n,folderDrop:o,folderSelection:p,imagePreviews:h,imageValidation:h,itemSizeValidation:i,pause:a,progressBar:f,resume:r,scaling:h&&t,tiffPreviews:qq.safari(),unlimitedScaledImageSize:!qq.ios(),uploading:e,uploadCors:l,uploadCustomHeaders:i,uploadNonMultipart:i,uploadViaPaste:s}}(),qq.isGenericPromise=function(e){"use strict";return!!(e&&e.then&&qq.isFunction(e.then))},qq.Promise=function(){"use strict";var n,i,o=[],a=[],t=[],r=0;qq.extend(this,{then:function(e,t){return 0===r?(e&&o.push(e),t&&a.push(t)):-1===r?t&&t.apply(null,i):e&&e.apply(null,n),this},done:function(e){return 0===r?t.push(e):e.apply(null,void 0===i?n:i),this},success:function(){return r=1,n=arguments,o.length&&qq.each(o,function(e,t){t.apply(null,n)}),t.length&&qq.each(t,function(e,t){t.apply(null,n)}),this},failure:function(){return r=-1,i=arguments,a.length&&qq.each(a,function(e,t){t.apply(null,i)}),t.length&&qq.each(t,function(e,t){t.apply(null,i)}),this}})},qq.BlobProxy=function(e,t){"use strict";qq.extend(this,{referenceBlob:e,create:function(){return t(e)}})},qq.UploadButton=function(e){"use strict";var t,n,i=this,o=new qq.DisposeSupport,a={acceptFiles:null,element:null,focusClass:"qq-upload-button-focus",folders:!1,hoverClass:"qq-upload-button-hover",ios8BrowserCrashWorkaround:!1,multiple:!1,name:"qqfile",onChange:function(e){},title:null};function r(){var e=document.createElement("input");return e.setAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME,n),e.setAttribute("title",a.title),i.setMultiple(a.multiple,e),a.folders&&qq.supportedFeatures.folderSelection&&e.setAttribute("webkitdirectory",""),a.acceptFiles&&e.setAttribute("accept",a.acceptFiles),e.setAttribute("type","file"),e.setAttribute("name",a.name),qq(e).css({position:"absolute",right:0,top:0,fontFamily:"Arial",fontSize:qq.ie()&&!qq.ie8()?"3500px":"118px",margin:0,padding:0,cursor:"pointer",opacity:0}),qq.ie7()||qq(e).css({height:"100%"}),a.element.appendChild(e),o.attach(e,"change",function(){a.onChange(e)}),o.attach(e,"mouseover",function(){qq(a.element).addClass(a.hoverClass)}),o.attach(e,"mouseout",function(){qq(a.element).removeClass(a.hoverClass)}),o.attach(e,"focus",function(){qq(a.element).addClass(a.focusClass)}),o.attach(e,"blur",function(){qq(a.element).removeClass(a.focusClass)}),e}qq.extend(a,e),n=qq.getUniqueId(),qq(a.element).css({position:"relative",overflow:"hidden",direction:"ltr"}),qq.extend(this,{getInput:function(){return t},getButtonId:function(){return n},setMultiple:function(e,t){var n=t||this.getInput();a.ios8BrowserCrashWorkaround&&qq.ios8()&&(qq.iosChrome()||qq.iosSafariWebView())?n.setAttribute("multiple",""):e?n.setAttribute("multiple",""):n.removeAttribute("multiple")},setAcceptFiles:function(e){e!==a.acceptFiles&&t.setAttribute("accept",e)},reset:function(){t.parentNode&&qq(t).remove(),qq(a.element).removeClass(a.focusClass),t=null,t=r()}}),t=r()},qq.UploadButton.BUTTON_ID_ATTR_NAME="qq-button-id",qq.UploadData=function(o){"use strict";var a=[],r={},s={},i={},l={};function u(e){if(qq.isArray(e)){var n=[];return qq.each(e,function(e,t){n.push(a[t])}),n}return a[e]}qq.extend(this,{addFile:function(e){var t=e.status||qq.status.SUBMITTING,n=a.push({name:e.name,originalName:e.name,uuid:e.uuid,size:null==e.size?-1:e.size,status:t,file:e.file})-1;return e.batchId&&(a[n].batchId=e.batchId,void 0===l[e.batchId]&&(l[e.batchId]=[]),l[e.batchId].push(n)),e.proxyGroupId&&(a[n].proxyGroupId=e.proxyGroupId,void 0===i[e.proxyGroupId]&&(i[e.proxyGroupId]=[]),i[e.proxyGroupId].push(n)),a[n].id=n,r[e.uuid]=n,void 0===s[t]&&(s[t]=[]),s[t].push(n),e.onBeforeStatusChange&&e.onBeforeStatusChange(n),o.onStatusChange(n,null,t),n},retrieve:function(e){return qq.isObject(e)&&a.length?void 0!==e.id?u(e.id):void 0!==e.uuid?function(e){if(qq.isArray(e)){var n=[];return qq.each(e,function(e,t){n.push(a[r[t]])}),n}return a[r[e]]}(e.uuid):e.status?(t=e.status,i=[],n=[].concat(t),qq.each(n,function(e,t){var n=s[t];void 0!==n&&qq.each(n,function(e,t){i.push(a[t])})}),i):void 0:qq.extend([],a,!0);var t,i,n},removeFileRef:function(e){var t=u(e);t&&delete t.file},reset:function(){a=[],r={},s={},l={}},setStatus:function(e,t){var n=a[e].status,i=qq.indexOf(s[n],e);s[n].splice(i,1),a[e].status=t,void 0===s[t]&&(s[t]=[]),s[t].push(e),o.onStatusChange(e,n,t)},uuidChanged:function(e,t){var n=a[e].uuid;a[e].uuid=t,r[t]=e,delete r[n]},updateName:function(e,t){a[e].name=t},updateSize:function(e,t){a[e].size=t},setParentId:function(e,t){a[e].parentId=t},getIdsInProxyGroup:function(e){var t=a[e].proxyGroupId;return t?i[t]:[]},getIdsInBatch:function(e){var t=a[e].batchId;return l[t]}})},qq.status={SUBMITTING:"submitting",SUBMITTED:"submitted",REJECTED:"rejected",QUEUED:"queued",CANCELED:"canceled",PAUSED:"paused",UPLOADING:"uploading",UPLOAD_FINALIZING:"upload finalizing",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={addBlobs:function(e,t,n){this.addFiles(e,t,n)},addInitialFiles:function(e){var n=this;qq.each(e,function(e,t){n._addCannedFile(t)})},addFiles:function(e,t,n){this._maybeHandleIos8SafariWorkaround();var i=0===this._storedIds.length?qq.getUniqueId():this._currentBatchId,o=qq.bind(function(e){this._handleNewFile({blob:e,name:this._options.blobs.defaultName},i,d)},this),a=qq.bind(function(e){this._handleNewFile(e,i,d)},this),r=qq.bind(function(e){var t=qq.canvasToBlob(e);this._handleNewFile({blob:t,name:this._options.blobs.defaultName+".png"},i,d)},this),s=qq.bind(function(e){var t=e.quality&&e.quality/100,n=qq.canvasToBlob(e.canvas,e.type,t);this._handleNewFile({blob:n,name:e.name},i,d)},this),l=qq.bind(function(e){if(qq.isInput(e)&&qq.supportedFeatures.ajaxUploading){var t=Array.prototype.slice.call(e.files),n=this;qq.each(t,function(e,t){n._handleNewFile(t,i,d)})}else this._handleNewFile(e,i,d)},this),u=this,d=[];this._currentBatchId=i,e&&(qq.isFileList(e)&&(e=Array.prototype.slice.call(e)),e=[].concat(e),qq.each(e,function(e,t){qq.isFileOrInput(t)?l(t):qq.isBlob(t)?o(t):qq.isObject(t)?t.blob&&t.name?a(t):t.canvas&&t.name&&s(t):t.tagName&&"canvas"===t.tagName.toLowerCase()?r(t):u.log(t+" is not a valid file container!  Ignoring!","warn")}),this.log("Received "+d.length+" files."),this._prepareItemsForUpload(d,t,n))},cancel:function(e){var t=this._uploadData.retrieve({id:e});t&&t.status===qq.status.UPLOAD_FINALIZING?this.log(qq.format("Ignoring cancel for file ID {} ({}).  Finalizing upload.",e,this.getName(e)),"error"):this._handler.cancel(e)},cancelAll:function(){var e=[],n=this;qq.extend(e,this._storedIds),qq.each(e,function(e,t){n.cancel(t)}),this._handler.cancelAll()},clearStoredFiles:function(){this._storedIds=[]},continueUpload:function(e){var t=this._uploadData.retrieve({id:e});return!(!qq.supportedFeatures.pause||!this._options.chunking.enabled||(t.status===qq.status.PAUSED?(this.log(qq.format("Paused file ID {} ({}) will be continued.  Not paused.",e,this.getName(e))),this._uploadFile(e),0):(this.log(qq.format("Ignoring continue for file ID {} ({}).  Not paused.",e,this.getName(e)),"error"),1)))},deleteFile:function(e){return this._onSubmitDelete(e)},doesExist:function(e){return this._handler.isValid(e)},drawThumbnail:function(e,t,n,i,o){var a,r,s=new qq.Promise;return this._imageGenerator?(a=this._thumbnailUrls[e],r={customResizeFunction:o,maxSize:0<n?n:null,scale:0<n},!i&&qq.supportedFeatures.imagePreviews&&(a=this.getFile(e)),null==a?s.failure({container:t,error:"File or URL not found."}):this._imageGenerator.generate(a,t,r).then(function(e){s.success(e)},function(e,t){s.failure({container:e,error:t||"Problem generating thumbnail"})})):s.failure({container:t,error:"Missing image generator module"}),s},getButton:function(e){return this._getButton(this._buttonIdsForFileIds[e])},getEndpoint:function(e){return this._endpointStore.get(e)},getFile:function(e){var t,n=this._handler.getFile(e);return n||(t=this._uploadData.retrieve({id:e}))&&(n=t.file),n||null},getInProgress:function(){return this._uploadData.retrieve({status:[qq.status.UPLOADING,qq.status.UPLOAD_RETRYING,qq.status.QUEUED]}).length},getName:function(e){return this._uploadData.retrieve({id:e}).name},getParentId:function(e){var t=this.getUploads({id:e}),n=null;return t&&void 0!==t.parentId&&(n=t.parentId),n},getResumableFilesData:function(){return this._handler.getResumableFilesData()},getSize:function(e){return this._uploadData.retrieve({id:e}).size},getNetUploads:function(){return this._netUploaded},getRemainingAllowedItems:function(){var e=this._currentItemLimit;return 0<e?e-this._netUploadedOrQueued:null},getUploads:function(e){return this._uploadData.retrieve(e)},getUuid:function(e){return this._uploadData.retrieve({id:e}).uuid},isResumable:function(e){return this._handler.hasResumeRecord(e)},log:function(e,t){!this._options.debug||t&&"info"!==t?t&&"info"!==t&&qq.log("[Fine Uploader "+qq.version+"] "+e,t):qq.log("[Fine Uploader "+qq.version+"] "+e)},pauseUpload:function(e){var t=this._uploadData.retrieve({id:e});if(!qq.supportedFeatures.pause||!this._options.chunking.enabled)return!1;if(0<=qq.indexOf([qq.status.UPLOADING,qq.status.UPLOAD_RETRYING],t.status)){if(this._handler.pause(e))return this._uploadData.setStatus(e,qq.status.PAUSED),!0;this.log(qq.format("Unable to pause file ID {} ({}).",e,this.getName(e)),"error")}else this.log(qq.format("Ignoring pause for file ID {} ({}).  Not in progress.",e,this.getName(e)),"error");return!1},removeFileRef:function(e){this._handler.expunge(e),this._uploadData.removeFileRef(e)},reset:function(){this.log("Resetting uploader..."),this._handler.reset(),this._storedIds=[],this._autoRetries=[],this._retryTimeouts=[],this._preventRetries=[],this._thumbnailUrls=[],qq.each(this._buttons,function(e,t){t.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(),this._succeededSinceLastAllComplete=[],this._failedSinceLastAllComplete=[],this._totalProgress&&this._totalProgress.reset(),this._customResumeDataStore.reset()},retry:function(e){return this._manualRetry(e)},scaleImage:function(e,t){var n=this;return qq.Scaler.prototype.scaleImage(e,t,{log:qq.bind(n.log,n),getFile:qq.bind(n.getFile,n),uploadData:n._uploadData})},setCustomHeaders:function(e,t){this._customHeadersStore.set(e,t)},setCustomResumeData:function(e,t){this._customResumeDataStore.set(t,e)},setDeleteFileCustomHeaders:function(e,t){this._deleteFileCustomHeadersStore.set(e,t)},setDeleteFileEndpoint:function(e,t){this._deleteFileEndpointStore.set(e,t)},setDeleteFileParams:function(e,t){this._deleteFileParamsStore.set(e,t)},setEndpoint:function(e,t){this._endpointStore.set(e,t)},setForm:function(e){this._updateFormSupportAndParams(e)},setItemLimit:function(e){this._currentItemLimit=e},setName:function(e,t){this._uploadData.updateName(e,t)},setParams:function(e,t){this._paramsStore.set(e,t)},setUuid:function(e,t){return this._uploadData.uuidChanged(e,t)},setStatus:function(e,t){if(!this.getUploads({id:e}))throw new qq.Error(e+" is not a valid file ID.");switch(t){case qq.status.DELETED:this._onDeleteComplete(e,null,!1);break;case qq.status.DELETE_FAILED:this._onDeleteComplete(e,null,!0);break;default:var n="Method setStatus called on '"+name+"' not implemented yet for "+t;throw this.log(n),new qq.Error(n)}},uploadStoredFiles:function(){0===this._storedIds.length?this._itemError("noFilesError"):this._uploadStoredFiles()}},qq.basePrivateApi={_addCannedFile:function(t){var n=this;return this._uploadData.addFile({uuid:t.uuid,name:t.name,size:t.size,status:qq.status.UPLOAD_SUCCESSFUL,onBeforeStatusChange:function(e){t.deleteFileEndpoint&&n.setDeleteFileEndpoint(t.deleteFileEndpoint,e),t.deleteFileParams&&n.setDeleteFileParams(t.deleteFileParams,e),t.thumbnailUrl&&(n._thumbnailUrls[e]=t.thumbnailUrl),n._netUploaded++,n._netUploadedOrQueued++}})},_annotateWithButtonId:function(e,t){qq.isFile(e)&&(e.qqButtonId=this._getButtonId(t))},_batchError:function(e){this._options.callbacks.onError(null,null,e,void 0)},_createDeleteHandler:function(){var i=this;return new qq.DeleteFileAjaxRequester({method:this._options.deleteFile.method.toUpperCase(),maxConnections:this._options.maxConnections,uuidParamName:this._options.request.uuidName,customHeaders:this._deleteFileCustomHeadersStore,paramsStore:this._deleteFileParamsStore,endpointStore:this._deleteFileEndpointStore,cors:this._options.cors,log:qq.bind(i.log,i),onDelete:function(e){i._onDelete(e),i._options.callbacks.onDelete(e)},onDeleteComplete:function(e,t,n){i._onDeleteComplete(e,t,n),i._options.callbacks.onDeleteComplete(e,t,n)}})},_createPasteHandler:function(){var t=this;return new qq.PasteSupport({targetElement:this._options.paste.targetElement,callbacks:{log:qq.bind(t.log,t),pasteReceived:function(e){t._handleCheckedCallback({name:"onPasteReceived",callback:qq.bind(t._options.callbacks.onPasteReceived,t,e),onSuccess:qq.bind(t._handlePasteSuccess,t,e),identifier:"pasted image"})}}})},_createStore:function(e,t){function n(e){return qq.isObject(e)?qq.extend({},e):e}var i={},o=e,a={},r=t;return{set:function(e,t){null==t?(i={},o=n(e)):i[t]=n(e)},get:function(e){var t;return function(e,t){r&&qq.isObject(t)&&qq.extend(t,qq.isFunction(r)?r():r),a[e]&&qq.extend(t,a[e])}(e,t=null!=e&&i[e]?i[e]:n(o)),n(t)},addReadOnly:function(e,t){qq.isObject(i)&&(null===e?qq.isFunction(t)?r=t:(r=r||{},qq.extend(r,t)):(a[e]=a[e]||{},qq.extend(a[e],t)))},remove:function(e){return delete i[e]},reset:function(){i={},a={},o=e}}},_createUploadDataTracker:function(){var i=this;return new qq.UploadData({getName:function(e){return i.getName(e)},getUuid:function(e){return i.getUuid(e)},getSize:function(e){return i.getSize(e)},onStatusChange:function(e,t,n){i._onUploadStatusChange(e,t,n),i._options.callbacks.onStatusChange(e,t,n),i._maybeAllComplete(e,n),i._totalProgress&&setTimeout(function(){i._totalProgress.onStatusChange(e,t,n)},0)}})},_createUploadButton:function(e){var t,n=this,i=e.accept||this._options.validation.acceptFiles,o=e.allowedExtensions||this._options.validation.allowedExtensions;return t=new qq.UploadButton({acceptFiles:i,element:e.element,focusClass:this._options.classes.buttonFocus,folders:e.folders,hoverClass:this._options.classes.buttonHover,ios8BrowserCrashWorkaround:this._options.workarounds.ios8BrowserCrash,multiple:!!qq.supportedFeatures.ajaxUploading&&!(n._options.workarounds.iosEmptyVideos&&qq.ios()&&!qq.ios6()&&n._isAllowedExtension(o,".mov"))&&(void 0===e.multiple?n._options.multiple:e.multiple),name:this._options.request.inputName,onChange:function(e){n._onInputChange(e)},title:null==e.title?this._options.text.fileInputTitle:e.title}),this._disposeSupport.addDisposer(function(){t.dispose()}),n._buttons.push(t),t},_createUploadHandler:function(e,t){var s=this,l={},n={debug:this._options.debug,maxConnections:this._options.maxConnections,cors:this._options.cors,paramsStore:this._paramsStore,endpointStore:this._endpointStore,chunking:this._options.chunking,resume:this._options.resume,blobs:this._options.blobs,log:qq.bind(s.log,s),preventRetryParam:this._options.retry.preventRetryResponseProperty,onProgress:function(e,t,n,i){n<0||i<0||(l[e]&&l[e].loaded===n&&l[e].total===i||(s._onProgress(e,t,n,i),s._options.callbacks.onProgress(e,t,n,i)),l[e]={loaded:n,total:i})},onComplete:function(e,t,n,i){delete l[e];var o,a=s.getUploads({id:e}).status;if(a!==qq.status.UPLOAD_SUCCESSFUL&&a!==qq.status.UPLOAD_FAILED){o=s._onComplete(e,t,n,i);var r=s.getUploads({id:e}).file.qqDropTarget;o instanceof qq.Promise?o.done(function(){s._options.callbacks.onComplete(e,t,n,i,r)}):s._options.callbacks.onComplete(e,t,n,i,r)}},onCancel:function(e,t,n){var i=new qq.Promise;return s._handleCheckedCallback({name:"onCancel",callback:qq.bind(s._options.callbacks.onCancel,s,e,t),onFailure:i.failure,onSuccess:function(){n.then(function(){s._onCancel(e,t)}),i.success()},identifier:e}),i},onUploadPrep:qq.bind(this._onUploadPrep,this),onUpload:function(e,t){s._onUpload(e,t);var n=s._options.callbacks.onUpload(e,t);return qq.isGenericPromise(n)?(s.log(qq.format("onUpload for {} returned a Promise - waiting for resolution.",e)),n):(new qq.Promise).success()},onUploadChunk:function(e,t,n){s._onUploadChunk(e,n);var i=s._options.callbacks.onUploadChunk(e,t,n);return qq.isGenericPromise(i)?(s.log(qq.format("onUploadChunk for {}.{} returned a Promise - waiting for resolution.",e,n.partIndex)),i):(new qq.Promise).success()},onUploadChunkSuccess:function(e,t,n,i){s._onUploadChunkSuccess(e,t),s._options.callbacks.onUploadChunkSuccess.apply(s,arguments)},onResume:function(e,t,n,i){return s._options.callbacks.onResume(e,t,n,i)},onAutoRetry:function(e,t,n,i){return s._onAutoRetry.apply(s,arguments)},onUuidChanged:function(e,t){s.log("Server requested UUID change from '"+s.getUuid(e)+"' to '"+t+"'"),s.setUuid(e,t)},getName:qq.bind(s.getName,s),getUuid:qq.bind(s.getUuid,s),getSize:qq.bind(s.getSize,s),setSize:qq.bind(s._setSize,s),getDataByUuid:function(e){return s.getUploads({uuid:e})},isQueued:function(e){var t=s.getUploads({id:e}).status;return t===qq.status.QUEUED||t===qq.status.SUBMITTED||t===qq.status.UPLOAD_RETRYING||t===qq.status.PAUSED},getIdsInProxyGroup:s._uploadData.getIdsInProxyGroup,getIdsInBatch:s._uploadData.getIdsInBatch,isInProgress:function(e){return s.getUploads({id:e}).status===qq.status.UPLOADING},getCustomResumeData:qq.bind(s._getCustomResumeData,s),setStatus:function(e,t){s._uploadData.setStatus(e,t)}};return qq.each(this._options.request,function(e,t){n[e]=t}),n.customHeaders=this._customHeadersStore,e&&qq.each(e,function(e,t){n[e]=t}),new qq.UploadHandlerController(n,t)},_fileOrBlobRejected:function(e){this._netUploadedOrQueued--,this._uploadData.setStatus(e,qq.status.REJECTED)},_formatSize:function(e){if(0===e)return e+this._options.text.sizeSymbols[0];for(var t=-1;t++,999<(e/=1e3););return Math.max(e,.1).toFixed(1)+" "+this._options.text.sizeSymbols[t]},_generateExtraButtonSpecs:function(){var a=this;this._extraButtonSpecs={},qq.each(this._options.extraButtons,function(e,t){var n=t.multiple,i=qq.extend({},a._options.validation,!0),o=qq.extend({},t);void 0===n&&(n=a._options.multiple),o.validation&&qq.extend(i,t.validation,!0),qq.extend(o,{multiple:n,validation:i},!0),a._initExtraButton(o)})},_getButton:function(e){var t=this._extraButtonSpecs[e];return t?t.element:e===this._defaultButtonId?this._options.button:void 0},_getButtonId:function(e){var t,n,i=e;if(i instanceof qq.BlobProxy&&(i=i.referenceBlob),i&&!qq.isBlob(i)){if(qq.isFile(i))return i.qqButtonId;if("input"===i.tagName.toLowerCase()&&"file"===i.type.toLowerCase())return i.getAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME);if(t=i.getElementsByTagName("input"),qq.each(t,function(e,t){if("file"===t.getAttribute("type"))return n=t,!1}),n)return n.getAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME)}},_getCustomResumeData:function(e){return this._customResumeDataStore.get(e)},_getNotFinished:function(){return this._uploadData.retrieve({status:[qq.status.UPLOADING,qq.status.UPLOAD_RETRYING,qq.status.QUEUED,qq.status.SUBMITTING,qq.status.SUBMITTED,qq.status.PAUSED]}).length},_getValidationBase:function(e){var t=this._extraButtonSpecs[e];return t?t.validation:this._options.validation},_getValidationDescriptor:function(e){return e.file instanceof qq.BlobProxy?{name:qq.getFilename(e.file.referenceBlob),size:e.file.referenceBlob.size,dropTarget:e.file.qqDropTarget}:{name:this.getUploads({id:e.id}).name,size:this.getUploads({id:e.id}).size,dropTarget:this.getUploads({id:e.id}).file.qqDropTarget}},_getValidationDescriptors:function(e){var n=this,i=[];return qq.each(e,function(e,t){i.push(n._getValidationDescriptor(t))}),i},_handleCameraAccess:function(){if(this._options.camera.ios&&qq.ios()){var e="image/*;capture=camera",t=this._options.camera.button,n=t?this._getButtonId(t):this._defaultButtonId,i=this._options;n&&n!==this._defaultButtonId&&(i=this._extraButtonSpecs[n]),i.multiple=!1,null===i.validation.acceptFiles?i.validation.acceptFiles=e:i.validation.acceptFiles+=","+e,qq.each(this._buttons,function(e,t){if(t.getButtonId()===n)return t.setMultiple(i.multiple),t.setAcceptFiles(i.acceptFiles),!1})}},_handleCheckedCallback:function(t){var n=this,e=t.callback();return qq.isGenericPromise(e)?(this.log(t.name+" - waiting for "+t.name+" promise to be fulfilled for "+t.identifier),e.then(function(e){n.log(t.name+" promise success for "+t.identifier),t.onSuccess(e)},function(){t.onFailure?(n.log(t.name+" promise failure for "+t.identifier),t.onFailure()):n.log(t.name+" promise failure for "+t.identifier)})):(!1!==e?t.onSuccess(e):t.onFailure?(this.log(t.name+" - return value was 'false' for "+t.identifier+".  Invoking failure callback."),t.onFailure()):this.log(t.name+" - return value was 'false' for "+t.identifier+".  Will not proceed."),e)},_handleNewFile:function(e,t,n){var i=this,o=qq.getUniqueId(),a=-1,r=qq.getFilename(e),s=e.blob||e,l=this._customNewFileHandler?this._customNewFileHandler:qq.bind(i._handleNewFileGeneric,i);!qq.isInput(s)&&0<=s.size&&(a=s.size),l(s,r,o,a,n,t,this._options.request.uuidName,{uploadData:i._uploadData,paramsStore:i._paramsStore,addFileToHandler:function(e,t){i._handler.add(e,t),i._netUploadedOrQueued++,i._trackButton(e)}})},_handleNewFileGeneric:function(e,t,n,i,o,a){var r=this._uploadData.addFile({uuid:n,name:t,size:i,batchId:a,file:e});this._handler.add(r,e),this._trackButton(r),this._netUploadedOrQueued++,o.push({id:r,file:e})},_handlePasteSuccess:function(e,t){var n=e.type.split("/")[1],i=t;null==i&&(i=this._options.paste.defaultName),i+="."+n,this.addFiles({name:i,blob:e})},_handleDeleteSuccess:function(e){if(this.getUploads({id:e}).status!==qq.status.DELETED){var t=this.getName(e);this._netUploadedOrQueued--,this._netUploaded--,this._handler.expunge(e),this._uploadData.setStatus(e,qq.status.DELETED),this.log("Delete request for '"+t+"' has succeeded.")}},_handleDeleteFailed:function(e,t){var n=this.getName(e);this._uploadData.setStatus(e,qq.status.DELETE_FAILED),this.log("Delete request for '"+n+"' has failed.","error"),t&&void 0!==t.withCredentials?this._options.callbacks.onError(e,n,"Delete request failed with response code "+t.status,t):this._options.callbacks.onError(e,n,"Delete request failed",t)},_initExtraButton:function(e){var t=this._createUploadButton({accept:e.validation.acceptFiles,allowedExtensions:e.validation.allowedExtensions,element:e.element,folders:e.folders,multiple:e.multiple,title:e.fileInputTitle});this._extraButtonSpecs[t.getButtonId()]=e},_initFormSupportAndParams:function(){this._formSupport=qq.FormSupport&&new qq.FormSupport(this._options.form,qq.bind(this.uploadStoredFiles,this),qq.bind(this.log,this)),this._formSupport&&this._formSupport.attachedToForm?(this._paramsStore=this._createStore(this._options.request.params,this._formSupport.getFormInputsAsObject),this._options.autoUpload=this._formSupport.newAutoUpload,this._formSupport.newEndpoint&&(this._options.request.endpoint=this._formSupport.newEndpoint)):this._paramsStore=this._createStore(this._options.request.params)},_isDeletePossible:function(){return!(!qq.DeleteFileAjaxRequester||!this._options.deleteFile.enabled||this._options.cors.expected&&!qq.supportedFeatures.deleteFileCorsXhr&&(!qq.supportedFeatures.deleteFileCorsXdr||!this._options.cors.allowXdr))},_isAllowedExtension:function(e,i){var o=!1;return!e.length||(qq.each(e,function(e,t){if(qq.isString(t)){var n=new RegExp("\\."+t+"$","i");if(null!=i.match(n))return!(o=!0)}}),o)},_itemError:function(e,t,n){var i,o,a=this._options.messages[e],r=[],s=[].concat(t),l=s[0],u=this._getButtonId(n),d=this._getValidationBase(u);function c(e,t){a=a.replace(e,t)}return qq.each(d.allowedExtensions,function(e,t){qq.isString(t)&&r.push(t)}),i=r.join(", ").toLowerCase(),c("{file}",this._options.formatFileName(l)),c("{extensions}",i),c("{fileSize}",this._formatSize(n.size)),c("{sizeLimit}",this._formatSize(d.sizeLimit)),c("{minSizeLimit}",this._formatSize(d.minSizeLimit)),null!==(o=a.match(/(\{\w+\})/g))&&qq.each(o,function(e,t){c(t,s[e])}),this._options.callbacks.onError(null,l,a,void 0),a},_manualRetry:function(e,t){if(this._onBeforeManualRetry(e))return this._netUploadedOrQueued++,this._uploadData.setStatus(e,qq.status.UPLOAD_RETRYING),t?t(e):this._handler.retry(e),!0},_maybeAllComplete:function(e,t){var n=this,i=this._getNotFinished();t===qq.status.UPLOAD_SUCCESSFUL?this._succeededSinceLastAllComplete.push(e):t===qq.status.UPLOAD_FAILED&&this._failedSinceLastAllComplete.push(e),0===i&&(this._succeededSinceLastAllComplete.length||this._failedSinceLastAllComplete.length)&&setTimeout(function(){n._onAllComplete(n._succeededSinceLastAllComplete,n._failedSinceLastAllComplete)},0)},_maybeHandleIos8SafariWorkaround:function(){var e=this;if(this._options.workarounds.ios8SafariUploads&&qq.ios800()&&qq.iosSafari())throw setTimeout(function(){window.alert(e._options.messages.unsupportedBrowserIos8Safari)},0),new qq.Error(this._options.messages.unsupportedBrowserIos8Safari)},_maybeParseAndSendUploadError:function(e,t,n,i){if(!n.success)if(i&&200!==i.status&&!n.error)this._options.callbacks.onError(e,t,"XHR returned response code "+i.status,i);else{var o=n.error?n.error:this._options.text.defaultResponseError;this._options.callbacks.onError(e,t,o,i)}},_maybeProcessNextItemAfterOnValidateCallback:function(e,i,o,a,r){var s=this;if(i.length>o)if(e||!this._options.validation.stopOnFirstInvalidFile)setTimeout(function(){var e=s._getValidationDescriptor(i[o]),t=s._getButtonId(i[o].file),n=s._getButton(t);s._handleCheckedCallback({name:"onValidate",callback:qq.bind(s._options.callbacks.onValidate,s,e,n),onSuccess:qq.bind(s._onValidateCallbackSuccess,s,i,o,a,r),onFailure:qq.bind(s._onValidateCallbackFailure,s,i,o,a,r),identifier:"Item '"+e.name+"', size: "+e.size})},0);else if(!e)for(;o<i.length;o++)s._fileOrBlobRejected(i[o].id)},_onAllComplete:function(e,t){this._totalProgress&&this._totalProgress.onAllComplete(e,t,this._preventRetries),this._options.callbacks.onAllComplete(qq.extend([],e),qq.extend([],t)),this._succeededSinceLastAllComplete=[],this._failedSinceLastAllComplete=[]},_onAutoRetry:function(e,t,n,i,o){var a=this;if(a._preventRetries[e]=n[a._options.retry.preventRetryResponseProperty],a._shouldAutoRetry(e)){var r=1e3*a._options.retry.autoAttemptDelay;return a._maybeParseAndSendUploadError.apply(a,arguments),a._options.callbacks.onAutoRetry(e,t,a._autoRetries[e]),a._onBeforeAutoRetry(e,t),a._uploadData.setStatus(e,qq.status.UPLOAD_RETRYING),a._retryTimeouts[e]=setTimeout(function(){a.log("Starting retry for "+t+"..."),o?o(e):a._handler.retry(e)},r),!0}},_onBeforeAutoRetry:function(e,t){this.log("Waiting "+this._options.retry.autoAttemptDelay+" seconds before retrying "+t+"...")},_onBeforeManualRetry:function(e){var t,n=this._currentItemLimit;return this._preventRetries[e]?(this.log("Retries are forbidden for id "+e,"warn"),!1):this._handler.isValid(e)?(t=this.getName(e),!1!==this._options.callbacks.onManualRetry(e,t)&&(0<n&&this._netUploadedOrQueued+1>n?(this._itemError("retryFailTooManyItems"),!1):(this.log("Retrying upload for '"+t+"' (id: "+e+")..."),!0))):(this.log("'"+e+"' is not a valid file ID","error"),!1)},_onCancel:function(e,t){this._netUploadedOrQueued--,clearTimeout(this._retryTimeouts[e]);var n=qq.indexOf(this._storedIds,e);!this._options.autoUpload&&0<=n&&this._storedIds.splice(n,1),this._uploadData.setStatus(e,qq.status.CANCELED)},_onComplete:function(e,t,n,i){return n.success?(n.thumbnailUrl&&(this._thumbnailUrls[e]=n.thumbnailUrl),this._netUploaded++,this._uploadData.setStatus(e,qq.status.UPLOAD_SUCCESSFUL)):(this._netUploadedOrQueued--,this._uploadData.setStatus(e,qq.status.UPLOAD_FAILED),!0===n[this._options.retry.preventRetryResponseProperty]&&(this._preventRetries[e]=!0)),this._maybeParseAndSendUploadError(e,t,n,i),!!n.success},_onDelete:function(e){this._uploadData.setStatus(e,qq.status.DELETING)},_onDeleteComplete:function(e,t,n){this.getName(e),n?this._handleDeleteFailed(e,t):this._handleDeleteSuccess(e)},_onInputChange:function(e){var t;if(qq.supportedFeatures.ajaxUploading){for(t=0;t<e.files.length;t++)this._annotateWithButtonId(e.files[t],e);this.addFiles(e.files)}else 0<e.value.length&&this.addFiles(e);qq.each(this._buttons,function(e,t){t.reset()})},_onProgress:function(e,t,n,i){this._totalProgress&&this._totalProgress.onIndividualProgress(e,n,i)},_onSubmit:function(e,t){},_onSubmitCallbackSuccess:function(e,t){this._onSubmit.apply(this,arguments),this._uploadData.setStatus(e,qq.status.SUBMITTED),this._onSubmitted.apply(this,arguments),this._options.autoUpload?(this._options.callbacks.onSubmitted.apply(this,arguments),this._uploadFile(e)):(this._storeForLater(e),this._options.callbacks.onSubmitted.apply(this,arguments))},_onSubmitDelete:function(e,t,n){var i,o=this.getUuid(e);return t&&(i=qq.bind(t,this,e,o,n)),this._isDeletePossible()?(this._handleCheckedCallback({name:"onSubmitDelete",callback:qq.bind(this._options.callbacks.onSubmitDelete,this,e),onSuccess:i||qq.bind(this._deleteHandler.sendDelete,this,e,o,n),identifier:e}),!0):(this.log("Delete request ignored for ID "+e+", delete feature is disabled or request not possible due to CORS on a user agent that does not support pre-flighting.","warn"),!1)},_onSubmitted:function(e){},_onTotalProgress:function(e,t){this._options.callbacks.onTotalProgress(e,t)},_onUploadPrep:function(e){},_onUpload:function(e,t){this._uploadData.setStatus(e,qq.status.UPLOADING)},_onUploadChunk:function(e,t){},_onUploadChunkSuccess:function(e,t){!this._preventRetries[e]&&this._options.retry.enableAuto&&(this._autoRetries[e]=0)},_onUploadStatusChange:function(e,t,n){n===qq.status.PAUSED&&clearTimeout(this._retryTimeouts[e])},_onValidateBatchCallbackFailure:function(e){var n=this;qq.each(e,function(e,t){n._fileOrBlobRejected(t.id)})},_onValidateBatchCallbackSuccess:function(e,t,n,i,o){var a,r=this._currentItemLimit,s=this._netUploadedOrQueued;0===r||s<=r?0<t.length?this._handleCheckedCallback({name:"onValidate",callback:qq.bind(this._options.callbacks.onValidate,this,e[0],o),onSuccess:qq.bind(this._onValidateCallbackSuccess,this,t,0,n,i),onFailure:qq.bind(this._onValidateCallbackFailure,this,t,0,n,i),identifier:"Item '"+t[0].file.name+"', size: "+t[0].file.size}):this._itemError("noFilesError"):(this._onValidateBatchCallbackFailure(t),a=this._options.messages.tooManyItemsError.replace(/\{netItems\}/g,s).replace(/\{itemLimit\}/g,r),this._batchError(a))},_onValidateCallbackFailure:function(e,t,n,i){var o=t+1;this._fileOrBlobRejected(e[t].id,e[t].file.name),this._maybeProcessNextItemAfterOnValidateCallback(!1,e,o,n,i)},_onValidateCallbackSuccess:function(e,t,n,i){var o=this,a=t+1,r=this._getValidationDescriptor(e[t]);this._validateFileOrBlobData(e[t],r).then(function(){o._upload(e[t].id,n,i),o._maybeProcessNextItemAfterOnValidateCallback(!0,e,a,n,i)},function(){o._maybeProcessNextItemAfterOnValidateCallback(!1,e,a,n,i)})},_prepareItemsForUpload:function(e,t,n){if(0!==e.length){var i=this._getValidationDescriptors(e),o=this._getButtonId(e[0].file),a=this._getButton(o);this._handleCheckedCallback({name:"onValidateBatch",callback:qq.bind(this._options.callbacks.onValidateBatch,this,i,a),onSuccess:qq.bind(this._onValidateBatchCallbackSuccess,this,i,e,t,n,a),onFailure:qq.bind(this._onValidateBatchCallbackFailure,this,e),identifier:"batch validation"})}else this._itemError("noFilesError")},_preventLeaveInProgress:function(){var t=this;this._disposeSupport.attach(window,"beforeunload",function(e){if(t.getInProgress())return(e=e||window.event).returnValue=t._options.messages.onLeave,t._options.messages.onLeave})},_refreshSessionData:function(){var n=this,e=this._options.session;qq.Session&&null!=this._options.session.endpoint&&(this._session||(qq.extend(e,{cors:this._options.cors}),e.log=qq.bind(this.log,this),e.addFileRecord=qq.bind(this._addCannedFile,this),this._session=new qq.Session(e)),setTimeout(function(){n._session.refresh().then(function(e,t){n._sessionRequestComplete(),n._options.callbacks.onSessionRequestComplete(e,!0,t)},function(e,t){n._options.callbacks.onSessionRequestComplete(e,!1,t)})},0))},_sessionRequestComplete:function(){},_setSize:function(e,t){this._uploadData.updateSize(e,t),this._totalProgress&&this._totalProgress.onNewSize(e)},_shouldAutoRetry:function(e){var t=this._uploadData.retrieve({id:e});return!!(!this._preventRetries[e]&&this._options.retry.enableAuto&&t.status!==qq.status.PAUSED&&(void 0===this._autoRetries[e]&&(this._autoRetries[e]=0),this._autoRetries[e]<this._options.retry.maxAutoAttempts))&&(this._autoRetries[e]+=1,!0)},_storeForLater:function(e){this._storedIds.push(e)},_trackButton:function(e){var t;(t=qq.supportedFeatures.ajaxUploading?this._handler.getFile(e).qqButtonId:this._getButtonId(this._handler.getInput(e)))&&(this._buttonIdsForFileIds[e]=t)},_updateFormSupportAndParams:function(e){this._options.form.element=e,this._formSupport=qq.FormSupport&&new qq.FormSupport(this._options.form,qq.bind(this.uploadStoredFiles,this),qq.bind(this.log,this)),this._formSupport&&this._formSupport.attachedToForm&&(this._paramsStore.addReadOnly(null,this._formSupport.getFormInputsAsObject),this._options.autoUpload=this._formSupport.newAutoUpload,this._formSupport.newEndpoint&&this.setEndpoint(this._formSupport.newEndpoint))},_upload:function(e,t,n){var i=this.getName(e);t&&this.setParams(t,e),n&&this.setEndpoint(n,e),this._handleCheckedCallback({name:"onSubmit",callback:qq.bind(this._options.callbacks.onSubmit,this,e,i,this.getDropTarget(e)),onSuccess:qq.bind(this._onSubmitCallbackSuccess,this,e,i),onFailure:qq.bind(this._fileOrBlobRejected,this,e,i),identifier:e})},_uploadFile:function(e){this._handler.upload(e)||this._uploadData.setStatus(e,qq.status.QUEUED)},_uploadStoredFiles:function(){for(var e,t,n=this;this._storedIds.length;)e=this._storedIds.shift(),this._uploadFile(e);(t=this.getUploads({status:qq.status.SUBMITTING}).length)&&(qq.log("Still waiting for "+t+" files to clear submit queue. Will re-parse stored IDs array shortly."),setTimeout(function(){n._uploadStoredFiles()},1e3))},_validateFileOrBlobData:function(e,t){var n=this,i=e.file instanceof qq.BlobProxy?e.file.referenceBlob:e.file,o=t.name,a=t.size,r=this._getButtonId(e.file),s=this._getValidationBase(r),l=new qq.Promise;return l.then(function(){},function(){n._fileOrBlobRejected(e.id,o)}),qq.isFileOrInput(i)&&!this._isAllowedExtension(s.allowedExtensions,o)?(this._itemError("typeError",o,i),l.failure()):this._options.validation.allowEmpty||0!==a?0<a&&s.sizeLimit&&a>s.sizeLimit?(this._itemError("sizeError",o,i),l.failure()):0<a&&a<s.minSizeLimit?(this._itemError("minSizeError",o,i),l.failure()):(qq.ImageValidation&&qq.supportedFeatures.imagePreviews&&qq.isFile(i)?new qq.ImageValidation(i,qq.bind(n.log,n)).validate(s.image).then(l.success,function(e){n._itemError(e+"ImageError",o,i),l.failure()}):l.success(),l):(this._itemError("emptyError",o,i),l.failure())},_wrapCallbacks:function(){var o,n,i;for(i in n=function(e,t,n){var i;try{return t.apply(o,n)}catch(t){i=t.message||t.toString(),o.log("Caught exception in '"+e+"' callback - "+i,"error")}},(o=this)._options.callbacks)!function(){var e,t;e=i,t=o._options.callbacks[e],o._options.callbacks[e]=function(){return n(e,t,arguments)}}()}}}(),function(){"use strict";qq.FineUploaderBasic=function(e){var n=this;this._options={debug:!1,button:null,multiple:!0,maxConnections:3,disableCancelForFormUploads:!1,autoUpload:!0,warnBeforeUnload:!0,request:{customHeaders:{},endpoint:"/server/upload",filenameParam:"qqfilename",forceMultipart:!0,inputName:"qqfile",method:"POST",omitDefaultParams:!1,params:{},paramsInBody:!0,requireSuccessJson:!0,totalFileSizeName:"qqtotalfilesize",uuidName:"qquuid"},validation:{allowedExtensions:[],sizeLimit:0,minSizeLimit:0,itemLimit:0,stopOnFirstInvalidFile:!0,acceptFiles:null,image:{maxHeight:0,maxWidth:0,minHeight:0,minWidth:0},allowEmpty:!1},callbacks:{onSubmit:function(e,t,n){},onSubmitted:function(e,t){},onComplete:function(e,t,n,i,o){},onAllComplete:function(e,t){},onCancel:function(e,t){},onUpload:function(e,t){},onUploadChunk:function(e,t,n){},onUploadChunkSuccess:function(e,t,n,i){},onResume:function(e,t,n,i){},onProgress:function(e,t,n,i){},onTotalProgress:function(e,t){},onError:function(e,t,n,i){},onAutoRetry:function(e,t,n){},onManualRetry:function(e,t){},onValidateBatch:function(e){},onValidate:function(e){},onSubmitDelete:function(e){},onDelete:function(e){},onDeleteComplete:function(e,t,n){},onPasteReceived:function(e){},onStatusChange:function(e,t,n){},onSessionRequestComplete:function(e,t,n){},onDropzoneDragOver:function(e){},onDropzoneDragOut:function(e){},onDropzoneDragDrop:function(e){}},messages:{typeError:"{file} has an invalid extension. Valid extension(s): {extensions}.",sizeError:"{file} is too large, maximum file size is {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.",unsupportedBrowserIos8Safari:"Unrecoverable error - this browser does not permit file uploading of any kind due to serious bugs in iOS8 Safari.  Please use iOS8 Chrome until Apple fixes these issues."},retry:{enableAuto:!1,maxAutoAttempts:3,autoAttemptDelay:5,preventRetryResponseProperty:"preventRetry"},classes:{buttonHover:"qq-upload-button-hover",buttonFocus:"qq-upload-button-focus"},chunking:{enabled:!1,concurrent:{enabled:!1},mandatory:!1,paramNames:{partIndex:"qqpartindex",partByteOffset:"qqpartbyteoffset",chunkSize:"qqchunksize",totalFileSize:"qqtotalfilesize",totalParts:"qqtotalparts"},partSize:function(e){return 2e6},success:{endpoint:null,headers:function(e){return null},jsonPayload:!1,method:"POST",params:function(e){return null},resetOnStatus:[]}},resume:{enabled:!1,recordsExpireIn:7,paramNames:{resuming:"qqresume"},customKeys:function(e){return[]}},formatFileName:function(e){return e},text:{defaultResponseError:"Upload failure reason unknown",fileInputTitle:"file input",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},form:{element:"qq-form",autoUpload:!1,interceptSubmit:!0},scaling:{customResizer:null,sendOriginal:!0,orient:!0,defaultType:null,defaultQuality:80,failureText:"Failed to scale",includeExif:!1,sizes:[]},workarounds:{iosEmptyVideos:!0,ios8SafariUploads:!0,ios8BrowserCrash:!1}},qq.extend(this._options,e,!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._initFormSupportAndParams(),this._customHeadersStore=this._createStore(this._options.request.customHeaders),this._deleteFileCustomHeadersStore=this._createStore(this._options.deleteFile.customHeaders),this._deleteFileParamsStore=this._createStore(this._options.deleteFile.params),this._endpointStore=this._createStore(this._options.request.endpoint),this._deleteFileEndpointStore=this._createStore(this._options.deleteFile.endpoint),this._handler=this._createUploadHandler(),this._deleteHandler=qq.DeleteFileAjaxRequester&&this._createDeleteHandler(),this._options.button&&(this._defaultButtonId=this._createUploadButton({element:this._options.button,title:this._options.text.fileInputTitle}).getButtonId()),this._generateExtraButtonSpecs(),this._handleCameraAccess(),this._options.paste.targetElement&&(qq.PasteSupport?this._pasteHandler=this._createPasteHandler():this.log("Paste support module not found","error")),this._options.warnBeforeUnload&&this._preventLeaveInProgress(),this._imageGenerator=qq.ImageGenerator&&new qq.ImageGenerator(qq.bind(this.log,this)),this._refreshSessionData(),this._succeededSinceLastAllComplete=[],this._failedSinceLastAllComplete=[],this._scaler=qq.Scaler&&new qq.Scaler(this._options.scaling,qq.bind(this.log,this))||{},this._scaler.enabled&&(this._customNewFileHandler=qq.bind(this._scaler.handleNewFile,this._scaler)),qq.TotalProgress&&qq.supportedFeatures.progressBar&&(this._totalProgress=new qq.TotalProgress(qq.bind(this._onTotalProgress,this),function(e){var t=n._uploadData.retrieve({id:e});return t&&t.size||0})),this._currentItemLimit=this._options.validation.itemLimit,this._customResumeDataStore=this._createStore()},qq.FineUploaderBasic.prototype=qq.basePublicApi,qq.extend(qq.FineUploaderBasic.prototype,qq.basePrivateApi)}(),qq.AjaxRequester=function(e){"use strict";var I,E,l=[],P={},k={acceptHeader:null,validMethods:["PATCH","POST","PUT"],method:"POST",contentType:"application/x-www-form-urlencoded",maxConnections:3,customHeaders:{},endpointStore:{},paramsStore:{},mandatedParams:{},allowXRequestedWithAndCacheControl:!0,successfulResponseCodes:{DELETE:[200,202,204],PATCH:[200,201,202,203,204],POST:[200,201,202,203,204],PUT:[200,201,202,203,204],GET:[200]},cors:{expected:!1,sendCredentials:!1},log:function(e,t){},onSend:function(e){},onComplete:function(e,t,n){},onProgress:null};if(qq.extend(k,e),I=k.log,qq.indexOf(k.validMethods,k.method)<0)throw new Error("'"+k.method+"' is not a supported method for this type of request!");function T(e){return k.cors.expected&&void 0===e.withCredentials}function U(e,t){var n,i=P[e]&&P[e].xhr;return i||(i=t||(k.cors.expected?((window.XMLHttpRequest||window.ActiveXObject)&&void 0===(n=qq.createXhrInstance()).withCredentials&&((n=new XDomainRequest).onload=function(){},n.onerror=function(){},n.ontimeout=function(){},n.onprogress=function(){}),n):qq.createXhrInstance()),P[e].xhr=i),i}function r(e){var t=qq.indexOf(l,e),n=k.maxConnections;delete P[e],l.splice(t,1),l.length>=n&&t<n&&u(l[n-1])}function R(e,t){var n,i=U(e),o=k.method,a=!0===t;r(e),a?I(o+" request for "+e+" has failed","error"):T(i)||(n=i.status,0<=qq.indexOf(k.successfulResponseCodes[k.method],n))||(a=!0,I(o+" request for "+e+" has failed - response code "+i.status,"error")),k.onComplete(e,i,a)}function u(e,t){var n,i,o,a,r,s,l,u,d,c,p,h,f,m,q,g,_,b,v,y,w,x,S=U(e,t),F=k.method,C=(a=P[i=e].additionalParams,r=k.mandatedParams,k.paramsStore.get&&(o=k.paramsStore.get(i)),a&&qq.each(a,function(e,t){(o=o||{})[e]=t}),r&&qq.each(r,function(e,t){(o=o||{})[e]=t}),o),D=P[e].payload;return k.onSend(e),v=C,y=P[b=e].additionalQueryParams,w=k.endpointStore.get(b),null!=(x=P[b].addToPath)&&(w+="/"+x),E&&v&&(w=qq.obj2url(v,w)),y&&(w=qq.obj2url(y,w)),n=w,T(S)?(S.onload=(_=e,function(){R(_)}),S.onerror=(g=e,function(){R(g,!0)})):S.onreadystatechange=(q=e,function(){4===U(q).readyState&&R(q)}),f=e,(m=k.onProgress)&&(U(f).upload.onprogress=function(e){e.lengthComputable&&m(f,e.loaded,e.total)}),S.open(F,n,!0),k.cors.expected&&k.cors.sendCredentials&&!T(S)&&(S.withCredentials=!0),u=U(s=e),d=k.customHeaders,c=P[s].additionalHeaders||{},p=k.method,h={},T(u)||(k.acceptHeader&&u.setRequestHeader("Accept",k.acceptHeader),k.allowXRequestedWithAndCacheControl&&(k.cors.expected&&0<=qq.indexOf(["GET","POST","HEAD"],k.method)&&(l=!1,qq.each(l,function(e,t){if(qq.indexOf(["Accept","Accept-Language","Content-Language","Content-Type"],t)<0)return!(l=!0)}),!l)||(u.setRequestHeader("X-Requested-With","XMLHttpRequest"),u.setRequestHeader("Cache-Control","no-cache"))),!k.contentType||"POST"!==p&&"PUT"!==p||u.setRequestHeader("Content-Type",k.contentType),qq.extend(h,qq.isFunction(d)?d(s):d),qq.extend(h,c),qq.each(h,function(e,t){u.setRequestHeader(e,t)})),I("Sending "+F+" request for "+e),D?S.send(D):E||!C?S.send():C&&k.contentType&&0<=k.contentType.toLowerCase().indexOf("application/x-www-form-urlencoded")?S.send(qq.obj2url(C,"")):C&&k.contentType&&0<=k.contentType.toLowerCase().indexOf("application/json")?S.send(JSON.stringify(C)):S.send(C),S}E="GET"===k.method||"DELETE"===k.method,qq.extend(this,{initTransport:function(t){var n,i,o,a,r,s;return{withPath:function(e){return n=e,this},withParams:function(e){return i=e,this},withQueryParams:function(e){return s=e,this},withHeaders:function(e){return o=e,this},withPayload:function(e){return a=e,this},withCacheBuster:function(){return r=!0,this},send:function(e){return r&&0<=qq.indexOf(["GET","DELETE"],k.method)&&(i.qqtimestamp=(new Date).getTime()),function(e,t,n,i,o,a,r){if(P[e]={addToPath:n,additionalParams:i,additionalQueryParams:o,additionalHeaders:a,payload:r},l.push(e)<=k.maxConnections)return u(e,t)}(t,e,n,i,s,o,a)}}},canceled:function(e){r(e)}})},qq.UploadHandler=function(e){"use strict";var t=e.proxy,i={},o=t.onCancel,a=t.getName;qq.extend(this,{add:function(e,t){i[e]=t,i[e].temp={}},cancel:function(e){var t=this,n=new qq.Promise;o(e,a(e),n).then(function(){t.isValid(e)&&(i[e].canceled=!0,t.expunge(e)),n.success()})},expunge:function(e){delete i[e]},getThirdPartyFileId:function(e){return i[e].key},isValid:function(e){return void 0!==i[e]},reset:function(){i={}},_getFileState:function(e){return i[e]},_setThirdPartyFileId:function(e,t){i[e].key=t},_wasCanceled:function(e){return!!i[e].canceled}})},qq.UploadHandlerController=function(e,n){"use strict";var i,l,u,t,o=this,a=!1,d=!1,c={paramsStore:{},maxConnections:3,chunking:{enabled:!1,multiple:{enabled:!1}},log:function(e,t){},onProgress:function(e,t,n,i){},onComplete:function(e,t,n,i){},onCancel:function(e,t){},onUploadPrep:function(e){},onUpload:function(e,t){},onUploadChunk:function(e,t,n){},onUploadChunkSuccess:function(e,t,n,i){},onAutoRetry:function(e,t,n,i){},onResume:function(e,t,n,i){},onUuidChanged:function(e,t){},getName:function(e){},setSize:function(e,t){},isQueued:function(e){},getIdsInProxyGroup:function(e){},getIdsInBatch:function(e){},isInProgress:function(e){}},p={done:function(e,t,n,i){var o=u._getChunkData(e,t);u._getFileState(e).attemptingResume=!1,delete u._getFileState(e).temp.chunkProgress[t],u._getFileState(e).loaded+=o.size,c.onUploadChunkSuccess(e,u._getChunkDataForCallback(o),n,i)},finalize:function(i){var o=c.getSize(i),a=c.getName(i);l("All chunks have been uploaded for "+i+" - finalizing...."),u.finalizeChunks(i).then(function(e,t){l("Finalize successful for "+i);var n=f.normalizeResponse(e,!0);c.onProgress(i,a,o,o),u._maybeDeletePersistedChunkData(i),f.cleanup(i,n,t)},function(e,t){var n=f.normalizeResponse(e,!1);l("Problem finalizing chunks for file ID "+i+" - "+n.error,"error"),(n.reset||t&&0<=c.chunking.success.resetOnStatus.indexOf(t.status))&&p.reset(i),c.onAutoRetry(i,a,n,t)||f.cleanup(i,n,t)})},handleFailure:function(e,n,t,i){var o=c.getName(n);l("Chunked upload request failed for "+n+", chunk "+e),u.clearCachedChunk(n,e);var a,r=f.normalizeResponse(t,!1);if(r.reset)p.reset(n);else{var s=u._getFileState(n).chunking.inProgress;0<=(a=s?qq.indexOf(s,e):-1)&&(u._getFileState(n).chunking.inProgress.splice(a,1),u._getFileState(n).chunking.remaining.unshift(e))}u._getFileState(n).temp.ignoreFailure||(d&&(u._getFileState(n).temp.ignoreFailure=!0,l(qq.format("Going to attempt to abort these chunks: {}. These are currently in-progress: {}.",JSON.stringify(Object.keys(u._getXhrs(n))),JSON.stringify(u._getFileState(n).chunking.inProgress))),qq.each(u._getXhrs(n),function(e,t){l(qq.format("Attempting to abort file {}.{}. XHR readyState {}. ",n,e,t.readyState)),t.abort(),t._cancelled=!0}),u.moveInProgressToRemaining(n),h.free(n,!0)),c.onAutoRetry(n,o,r,i)||f.cleanup(n,r,i))},hasMoreParts:function(e){return!!u._getFileState(e).chunking.remaining.length},nextPart:function(e){var t=u._getFileState(e).chunking.remaining.shift();return t>=u._getTotalChunks(e)&&(t=null),t},reset:function(e){l("Server or callback has ordered chunking effort to be restarted on next attempt for item ID "+e,"error"),u._maybeDeletePersistedChunkData(e),u.reevaluateChunking(e),u._getFileState(e).loaded=0,u._getFileState(e).attemptingResume=!1},sendNext:function(a){var n=c.getSize(a),e=c.getName(a),r=p.nextPart(a),i=u._getChunkData(a,r),t=u._getFileState(a),o=t.attemptingResume,s=t.chunking.inProgress||[];null==t.loaded&&(t.loaded=0),o&&!1===c.onResume(a,e,i,t.customResumeData)&&(p.reset(a),r=p.nextPart(a),i=u._getChunkData(a,r),o=!1),null==r&&0===s.length?p.finalize(a):(s.push(r),u._getFileState(a).chunking.inProgress=s,d&&h.open(a,r),d&&h.available()&&u._getFileState(a).chunking.remaining.length&&p.sendNext(a),0===i.blob.size&&(l(qq.format("Chunk {} for file {} will not be uploaded, zero sized chunk.",r,a),"error"),p.handleFailure(r,a,"File is no longer available",null)),c.onUploadChunk(a,e,u._getChunkDataForCallback(i)).then(function(e){if(c.isInProgress(a)){l(qq.format("Sending chunked upload request for item {}.{}, bytes {}-{} of {}.",a,r,i.start+1,i.end,n));var t={chunkIdx:r,id:a,overrides:e,resuming:o};u.uploadChunk(t).then(function(e,t){l("Chunked upload request succeeded for "+a+", chunk "+r),u.clearCachedChunk(a,r);var n=u._getFileState(a).chunking.inProgress||[],i=f.normalizeResponse(e,!0),o=qq.indexOf(n,r);l(qq.format("Chunk {} for file {} uploaded successfully.",r,a)),p.done(a,r,i,t),0<=o&&n.splice(o,1),u._maybePersistChunkedState(a),p.hasMoreParts(a)||0!==n.length?p.hasMoreParts(a)?p.sendNext(a):l(qq.format("File ID {} has no more chunks to send and these chunk indexes are still marked as in-progress: {}",a,JSON.stringify(n))):p.finalize(a)},function(e,t){p.handleFailure(r,a,e,t)}).done(function(){u.clearXhr(a,r)})}else l(qq.format("Not sending chunked upload request for item {}.{} - no longer in progress.",a,r))},function(e){p.handleFailure(r,a,e,null)}))}},h={_open:[],_openChunks:{},_waiting:[],available:function(){var e=c.maxConnections,n=0,i=0;return qq.each(h._openChunks,function(e,t){n++,i+=t.length}),e-(h._open.length-n+i)},free:function(e,t){var n,i=!t,o=qq.indexOf(h._waiting,e),a=qq.indexOf(h._open,e);delete h._openChunks[e],f.getProxyOrBlob(e)instanceof qq.BlobProxy&&(l("Generated blob upload has ended for "+e+", disposing generated blob."),delete u._getFileState(e).file),0<=o?h._waiting.splice(o,1):i&&0<=a&&(h._open.splice(a,1),0<=(n=h._waiting.shift())&&(h._open.push(n),f.start(n)))},getWaitingOrConnected:function(){var n=[];return qq.each(h._openChunks,function(e,t){t&&t.length&&n.push(parseInt(e))}),qq.each(h._open,function(e,t){h._openChunks[t]||n.push(parseInt(t))}),n=n.concat(h._waiting)},isUsingConnection:function(e){return 0<=qq.indexOf(h._open,e)},open:function(e,t){return null==t&&h._waiting.push(e),!!h.available()&&(null==t?(h._waiting.pop(),h._open.push(e)):((n=h._openChunks[e]||[]).push(t),h._openChunks[e]=n),!0);var n},reset:function(){h._waiting=[],h._open=[]}},f={cancel:function(e){l("Cancelling "+e),c.paramsStore.remove(e),h.free(e)},cleanup:function(e,t,n){var i=c.getName(e);c.onComplete(e,i,t,n),u._getFileState(e)&&u._clearXhrs&&u._clearXhrs(e),h.free(e)},getProxyOrBlob:function(e){return u.getProxy&&u.getProxy(e)||u.getFile&&u.getFile(e)},initHandler:function(){var e=n?qq[n]:qq.traditional,t=qq.supportedFeatures.ajaxUploading?"Xhr":"Form";(u=new e[t+"UploadHandler"](c,{getCustomResumeData:c.getCustomResumeData,getDataByUuid:c.getDataByUuid,getName:c.getName,getSize:c.getSize,getUuid:c.getUuid,log:l,onCancel:c.onCancel,onProgress:c.onProgress,onUuidChanged:c.onUuidChanged,onFinalizing:function(e){c.setStatus(e,qq.status.UPLOAD_FINALIZING)}}))._removeExpiredChunkingRecords&&u._removeExpiredChunkingRecords()},isDeferredEligibleForUpload:function(e){return c.isQueued(e)},maybeDefer:function(n,e){return e&&!u.getFile(n)&&e instanceof qq.BlobProxy?(c.onUploadPrep(n),l("Attempting to generate a blob on-demand for "+n),e.create().then(function(e){l("Generated an on-demand blob for "+n),u.updateBlob(n,e),c.setSize(n,e.size),u.reevaluateChunking(n),f.maybeSendDeferredFiles(n)},function(e){var t={};e&&(t.error=e),l(qq.format("Failed to generate blob for ID {}.  Error message: {}.",n,e),"error"),c.onComplete(n,c.getName(n),qq.extend(t,i),null),f.maybeSendDeferredFiles(n),h.free(n)}),!1):f.maybeSendDeferredFiles(n)},maybeSendDeferredFiles:function(n){var e=c.getIdsInProxyGroup(n),i=!1;return e&&e.length?(l("Maybe ready to upload proxy group file "+n),qq.each(e,function(e,t){if(f.isDeferredEligibleForUpload(t)&&u.getFile(t))i=t===n,f.now(t);else if(f.isDeferredEligibleForUpload(t))return!1})):(i=!0,f.now(n)),i},maybeNewUuid:function(e,t){void 0!==t.newUuid&&c.onUuidChanged(e,t.newUuid)},normalizeResponse:function(e,t){var n=e;return qq.isObject(e)||(n={},qq.isString(e)&&!t&&(n.error=e)),n.success=t,n},now:function(n){var i=c.getName(n);if(!o.isValid(n))throw new qq.Error(n+" is not a valid file ID to upload!");c.onUpload(n,i).then(function(e){e&&e.pause?(c.setStatus(n,qq.status.PAUSED),u.pause(n),h.free(n)):a&&u._shouldChunkThisFile(n)?p.sendNext(n):function(o,a){var e=u._getFileState(o);e?(e.loaded=0,l("Sending simple upload request for "+o),u.uploadFile(o).then(function(e,t){l("Simple upload request succeeded for "+o);var n=f.normalizeResponse(e,!0),i=c.getSize(o);c.onProgress(o,a,i,i),f.maybeNewUuid(o,n),f.cleanup(o,n,t)},function(e,t){l("Simple upload request failed for "+o);var n=f.normalizeResponse(e,!1);c.onAutoRetry(o,a,n,t)||f.cleanup(o,n,t)})):l("Ignoring send request as this upload may have been cancelled, File ID "+o,"warn")}(n,i)},function(e){if(l(n+" upload start aborted due to rejected onUpload Promise - details: "+(e=e||{}),"error"),!c.onAutoRetry(n,i,e.responseJSON||{})){var t=f.normalizeResponse(e.responseJSON,!1);f.cleanup(n,t)}})},start:function(e){var t=f.getProxyOrBlob(e);return t?f.maybeDefer(e,t):(f.now(e),!0)}};qq.extend(this,{add:function(e,t){u.add.apply(this,arguments)},upload:function(e){return!!h.open(e)&&f.start(e)},retry:function(e){return d&&(u._getFileState(e).temp.ignoreFailure=!1),h.isUsingConnection(e)?f.start(e):o.upload(e)},cancel:function(e){var t=u.cancel(e);qq.isGenericPromise(t)?t.then(function(){f.cancel(e)}):!1!==t&&f.cancel(e)},cancelAll:function(){var e,t=h.getWaitingOrConnected();if(t.length)for(e=t.length-1;0<=e;e--)o.cancel(t[e]);h.reset()},getFile:function(e){return u.getProxy&&u.getProxy(e)?u.getProxy(e).referenceBlob:u.getFile&&u.getFile(e)},isProxied:function(e){return!(!u.getProxy||!u.getProxy(e))},getInput:function(e){if(u.getInput)return u.getInput(e)},reset:function(){l("Resetting upload handler"),o.cancelAll(),h.reset(),u.reset()},expunge:function(e){if(o.isValid(e))return u.expunge(e)},isValid:function(e){return u.isValid(e)},hasResumeRecord:function(e){var t=u.isValid(e)&&u._getLocalStorageId&&u._getLocalStorageId(e);return!!t&&!!localStorage.getItem(t)},getResumableFilesData:function(){return u.getResumableFilesData?u.getResumableFilesData():[]},getThirdPartyFileId:function(e){if(o.isValid(e))return u.getThirdPartyFileId(e)},pause:function(e){return!!(o.isResumable(e)&&u.pause&&o.isValid(e)&&u.pause(e))&&(h.free(e),u.moveInProgressToRemaining(e),!0)},isAttemptingResume:function(e){return!!u.isAttemptingResume&&u.isAttemptingResume(e)},isResumable:function(e){return!!u.isResumable&&u.isResumable(e)}}),qq.extend(c,e),l=c.log,a=c.chunking.enabled&&qq.supportedFeatures.chunking,d=a&&c.chunking.concurrent.enabled,(t={})[c.preventRetryParam]=!0,i=t,f.initHandler()},qq.WindowReceiveMessage=function(e){"use strict";var n={};qq.extend({log:function(e,t){}},e),qq.extend(this,{receiveMessage:function(e,t){window.postMessage?n[e]=qq(window).attach("message",function(e){t(e.data)}):log("iframe message passing not supported in this browser!","error")},stopReceivingMessages:function(e){if(window.postMessage){var t=n[e];t&&t()}}})},qq.FormUploadHandler=function(e){"use strict";var t=e.options,l=this,n=e.proxy,i=qq.getUniqueId(),u={},d={},c={},p=t.isCors,o=t.inputName,h=n.getUuid,f=n.log,m=new qq.WindowReceiveMessage({log:f});function q(e){return e.split("_")[0]}qq.extend(this,new qq.UploadHandler(e)),qq.override(this,function(n){return{add:function(e,t){n.add(e,{input:t}),t.setAttribute("name",o),t.parentNode&&qq(t).remove()},expunge:function(e){!function(e){delete d[e],p&&(clearTimeout(c[e]),delete c[e],m.stopReceivingMessages(e));var t=document.getElementById(l._getIframeName(e));t&&(t.setAttribute("src","javascript:false;"),qq(t).remove())}(e),n.expunge(e)},isValid:function(e){return n.isValid(e)&&void 0!==l._getFileState(e).input}}}),qq.extend(this,{getInput:function(e){return l._getFileState(e).input},_attachLoadEvent:function(e,t){var n,i,o,a,r,s;p?(o=t,a=(i=e).id,r=q(a),s=h(r),u[s]=o,d[r]=qq(i).attach("load",function(){l.getInput(r)&&(f("Received iframe load event for CORS upload request (iframe name "+a+")"),c[a]=setTimeout(function(){var e="No valid message received from loaded iframe for iframe name "+a;f(e,"error"),o({error:e})},1e3))}),m.receiveMessage(a,function(e){f("Received the following window message: '"+e+"'"),q(a);var t,n=l._parseJsonResponse(e),i=n.uuid;i&&u[i]?(f("Handling response for iframe name "+a),clearTimeout(c[a]),delete c[a],l._detachLoadEvent(a),t=u[i],delete u[i],m.stopReceivingMessages(a),t(n)):i||f("'"+e+"' does not contain a UUID - ignoring.")})):d[e.id]=qq(e).attach("load",function(){if(f("Received response for "+e.id),e.parentNode){try{if(e.contentDocument&&e.contentDocument.body&&"false"==e.contentDocument.body.innerHTML)return}catch(e){f("Error when attempting to access iframe during handling of upload response ("+e.message+")","error"),n={success:!1}}t(n)}})},_createIframe:function(e){return t=l._getIframeName(e),(n=qq.toElement("<iframe src='javascript:false;' name='"+t+"' />")).setAttribute("id",t),n.style.display="none",document.body.appendChild(n),n;var t,n},_detachLoadEvent:function(e){void 0!==d[e]&&(d[e](),delete d[e])},_getIframeName:function(e){return e+"_"+i},_initFormForUpload:function(e){var t=e.method,n=e.endpoint,i=e.params,o=e.paramsInBody,a=e.targetName,r=qq.toElement("<form method='"+t+"' enctype='multipart/form-data'></form>"),s=n;return o?qq.obj2Inputs(i,r):s=qq.obj2url(i,n),r.setAttribute("action",s),r.setAttribute("target",a),r.style.display="none",document.body.appendChild(r),r},_parseJsonResponse:function(e){var t={};try{t=qq.parseJson(e)}catch(e){f("Error when attempting to parse iframe upload response ("+e.message+")","error")}return t}})},qq.XhrUploadHandler=function(e){"use strict";function d(e){var t=h._getFileState(e);if(t.chunkSize)return t.chunkSize;var n=o.partSize;return qq.isFunction(n)&&(n=n(e,m(e))),t.chunkSize=n}var h=this,s=e.options.namespace,t=e.proxy,o=e.options.chunking,l=e.options.resume,n=o&&e.options.chunking.enabled&&qq.supportedFeatures.chunking,a=l&&e.options.resume.enabled&&n&&qq.supportedFeatures.resume,f=t.getName,m=t.getSize,r=t.getUuid,u=t.getEndpoint,c=t.getDataByUuid,p=t.onUuidChanged,q=t.onProgress,g=t.log,_=t.getCustomResumeData;function i(i){qq.each(h._getXhrs(i),function(e,t){var n=h._getAjaxRequester(i,e);t.onreadystatechange=null,t.upload.onprogress=null,t.abort(),n&&n.canceled&&n.canceled(i)})}qq.extend(this,new qq.UploadHandler(e)),qq.override(this,function(n){return{add:function(e,t){if(qq.isFile(t)||qq.isBlob(t))n.add(e,{file:t});else{if(!(t instanceof qq.BlobProxy))throw new Error("Passed obj is not a File, Blob, or proxy");n.add(e,{proxy:t})}h._initTempState(e),a&&h._maybePrepareForResume(e)},expunge:function(e){i(e),h._maybeDeletePersistedChunkData(e),h._clearXhrs(e),n.expunge(e)}}}),qq.extend(this,{clearCachedChunk:function(e,t){var n=h._getFileState(e);n&&delete n.temp.cachedChunks[t]},clearXhr:function(e,t){var n=h._getFileState(e).temp;n.xhrs&&delete n.xhrs[t],n.ajaxRequesters&&delete n.ajaxRequesters[t]},finalizeChunks:function(e,t){var n=h._getTotalChunks(e)-1,i=h._getXhr(e,n);return t?(new qq.Promise).success(t(i),i):(new qq.Promise).success({},i)},getFile:function(e){return h.isValid(e)&&h._getFileState(e).file},getProxy:function(e){return h.isValid(e)&&h._getFileState(e).proxy},getResumableFilesData:function(){var i=[];return h._iterateResumeRecords(function(e,t){h.moveInProgressToRemaining(null,t.chunking.inProgress,t.chunking.remaining);var n={name:t.name,remaining:t.chunking.remaining,size:t.size,uuid:t.uuid};t.key&&(n.key=t.key),t.customResumeData&&(n.customResumeData=t.customResumeData),i.push(n)}),i},isAttemptingResume:function(e){return h._getFileState(e).attemptingResume},isResumable:function(e){return!!o&&h.isValid(e)&&!h._getFileState(e).notResumable},moveInProgressToRemaining:function(e,t,n){var i=(h._getFileState(e)||{}).chunking||{},o=t||i.inProgress,a=n||i.remaining;o&&(g(qq.format("Moving these chunks from in-progress {}, to remaining.",JSON.stringify(o))),o.reverse(),qq.each(o,function(e,t){a.unshift(t)}),o.length=0)},pause:function(e){if(h.isValid(e))return g(qq.format("Aborting XHR upload for {} '{}' due to pause instruction.",e,f(e))),h._getFileState(e).paused=!0,i(e),!0},reevaluateChunking:function(e){if(o&&h.isValid(e)){var t,n,i=h._getFileState(e);if(delete i.chunking,i.chunking={},1<(t=h._getTotalChunks(e))||o.mandatory){for(i.chunking.enabled=!0,i.chunking.parts=t,i.chunking.remaining=[],n=0;n<t;n++)i.chunking.remaining.push(n);h._initTempState(e)}else i.chunking.enabled=!1}},updateBlob:function(e,t){h.isValid(e)&&(h._getFileState(e).file=t)},_clearXhrs:function(e){var t=h._getFileState(e).temp;qq.each(t.ajaxRequesters,function(e){delete t.ajaxRequesters[e]}),qq.each(t.xhrs,function(e){delete t.xhrs[e]})},_createXhr:function(e,t){return h._registerXhr(e,t,qq.createXhrInstance())},_getAjaxRequester:function(e,t){var n=null==t?-1:t;return h._getFileState(e).temp.ajaxRequesters[n]},_getChunkData:function(e,t){var n=d(e),i=m(e),o=h.getFile(e),a=n*t,r=i<=a+n?i:a+n,s=h._getTotalChunks(e),l=this._getFileState(e).temp.cachedChunks,u=l[t]||qq.sliceBlob(o,a,r);return{part:t,start:a,end:r,count:s,blob:l[t]=u,size:r-a}},_getChunkDataForCallback:function(e){return{partIndex:e.part,startByte:e.start+1,endByte:e.end,totalParts:e.count}},_getLocalStorageId:function(e){var t=f(e),n=m(e),i=d(e),o=u(e),a=l.customKeys(e),r=qq.format("qq{}resume{}-{}-{}-{}-{}",s,"5.0",t,n,i,o);return a.forEach(function(e){r+="-"+e}),r},_getMimeType:function(e){return h.getFile(e).type},_getPersistableData:function(e){return h._getFileState(e).chunking},_getTotalChunks:function(e){if(o){var t=m(e),n=d(e);return Math.ceil(t/n)}},_getXhr:function(e,t){var n=null==t?-1:t;return h._getFileState(e).temp.xhrs[n]},_getXhrs:function(e){return h._getFileState(e).temp.xhrs},_iterateResumeRecords:function(i){a&&qq.each(localStorage,function(e,t){if(0===e.indexOf(qq.format("qq{}resume",s))){var n=JSON.parse(t);i(e,n)}})},_initTempState:function(e){h._getFileState(e).temp={ajaxRequesters:{},chunkProgress:{},xhrs:{},cachedChunks:{}}},_markNotResumable:function(e){h._getFileState(e).notResumable=!0},_maybeDeletePersistedChunkData:function(e){var t;return!!(a&&h.isResumable(e)&&(t=h._getLocalStorageId(e))&&localStorage.getItem(t))&&(localStorage.removeItem(t),!0)},_maybePrepareForResume:function(e){var t,n,i=h._getFileState(e);a&&void 0===i.key&&(t=h._getLocalStorageId(e),(n=localStorage.getItem(t))&&(n=JSON.parse(n),c(n.uuid)?h._markNotResumable(e):(g(qq.format("Identified file with ID {} and name of {} as resumable.",e,f(e))),p(e,n.uuid),i.key=n.key,i.chunking=n.chunking,i.loaded=n.loaded,i.customResumeData=n.customResumeData,i.attemptingResume=!0,h.moveInProgressToRemaining(e))))},_maybePersistChunkedState:function(e){var t,n,i=h._getFileState(e);if(a&&h.isResumable(e)){var o=_(e);t=h._getLocalStorageId(e),n={name:f(e),size:m(e),uuid:r(e),key:i.key,chunking:i.chunking,loaded:i.loaded,lastUpdated:Date.now()},o&&(n.customResumeData=o);try{localStorage.setItem(t,JSON.stringify(n))}catch(t){g(qq.format("Unable to save resume data for '{}' due to error: '{}'.",e,t.toString()),"warn")}}},_registerProgressHandler:function(u,d,c){var e=h._getXhr(u,d),p=f(u),t={simple:function(e,t){var n=m(u);q(u,p,e===t?n:n<=e?n-1:e,n)},chunked:function(e,t){var n=h._getFileState(u).temp.chunkProgress,i=h._getFileState(u).loaded,o=e,a=t,r=m(u),s=o-(a-c),l=i;n[d]=s,qq.each(n,function(e,t){l+=t}),q(u,p,l,r)}};e.upload.onprogress=function(e){e.lengthComputable&&t[null==c?"simple":"chunked"](e.loaded,e.total)}},_registerXhr:function(e,t,n,i){var o=null==t?-1:t,a=h._getFileState(e).temp;return a.xhrs=a.xhrs||{},a.ajaxRequesters=a.ajaxRequesters||{},a.xhrs[o]=n,i&&(a.ajaxRequesters[o]=i),n},_removeExpiredChunkingRecords:function(){var i=l.recordsExpireIn;h._iterateResumeRecords(function(e,t){var n=new Date(t.lastUpdated);n.setDate(n.getDate()+i),n.getTime()<=Date.now()&&(g("Removing expired resume record with key "+e),localStorage.removeItem(e))})},_shouldChunkThisFile:function(e){var t=h._getFileState(e);if(t)return t.chunking||h.reevaluateChunking(e),t.chunking.enabled}})},qq.DeleteFileAjaxRequester=function(e){"use strict";var o,a={method:"DELETE",uuidParamName:"qquuid",endpointStore:{},maxConnections:3,customHeaders:function(e){return{}},paramsStore:{},cors:{expected:!1,sendCredentials:!1},log:function(e,t){},onDelete:function(e){},onDeleteComplete:function(e,t,n){}};qq.extend(a,e),o=qq.extend(this,new qq.AjaxRequester({acceptHeader:"application/json",validMethods:["POST","DELETE"],method:a.method,endpointStore:a.endpointStore,paramsStore:a.paramsStore,mandatedParams:"POST"===a.method.toUpperCase()?{_method:"DELETE"}:{},maxConnections:a.maxConnections,customHeaders:function(e){return a.customHeaders.get(e)},log:a.log,onSend:a.onDelete,onComplete:a.onDeleteComplete,cors:a.cors})),qq.extend(this,{sendDelete:function(e,t,n){var i=n||{};a.log("Submitting delete file request for "+e),"DELETE"===a.method?o.initTransport(e).withPath(t).withParams(i).send():(i[a.uuidParamName]=t,o.initTransport(e).withParams(i).send())}})},Xx.prototype.render=function(t,e){e=e||{};var n,i,o,a,r,s,l,u,d,c=this,p=this.srcImage.naturalWidth,h=this.srcImage.naturalHeight,f=e.width,m=e.height,q=e.maxWidth,g=e.maxHeight,_=!this.blob||"image/jpeg"===this.blob.type,b=t.tagName.toLowerCase();this.imageLoadListeners?this.imageLoadListeners.push(function(){c.render(t,e)}):(f&&!m?m=h*f/p<<0:m&&!f?f=p*m/h<<0:(f=p,m=h),q&&q<f&&(m=h*(f=q)/p<<0),g&&g<m&&(f=p*(m=g)/h<<0),n={width:f,height:m},qq.each(e,function(e,t){n[e]=t}),"img"===b?(i=t.src,(o=c.srcImage,a=c.blob,r=n,s=_,l=document.createElement("canvas"),u=r.mime||"image/jpeg",d=new qq.Promise,Ux(o,a,l,r,s).then(function(){d.success(l.toDataURL(u,r.quality||.8))}),d).then(function(e){t.src=e,i===t.src&&t.onload()})):"canvas"===b&&Ux(this.srcImage,this.blob,t,n,_),"function"==typeof this.onrender&&this.onrender(t))},qq.MegaPixImage=Xx,qq.ImageGenerator=function(c){"use strict";function p(e){return"img"===e.tagName.toLowerCase()}function h(e){return"canvas"===e.tagName.toLowerCase()}function s(e){var t=e.split("/"),n=t[t.length-1].split("?")[0],i=qq.getExtension(n);switch(i=i&&i.toLowerCase()){case"jpeg":case"jpg":return"image/jpeg";case"png":return"image/png";case"bmp":return"image/bmp";case"gif":return"image/gif";case"tiff":case"tif":return"image/tiff"}}function f(e){var t,n,i,o=document.createElement("a");return o.href=e,t=o.protocol,i=o.port,n=o.hostname,t.toLowerCase()!==window.location.protocol.toLowerCase()||n.toLowerCase()!==window.location.hostname.toLowerCase()||i!==window.location.port&&!qq.ie()}function m(e,t){var n,i,o,a,r=p(e)||h(e);return p(e)?(a=t,(o=e).onload=function(){o.onload=null,o.onerror=null,a.success(o)},o.onerror=function(){o.onload=null,o.onerror=null,c("Problem drawing thumbnail!","error"),a.failure(o,"Problem drawing thumbnail!")}):h(e)?(i=t,(n=e).qqImageRendered=function(){i.success(n)}):(t.failure(e),c(qq.format("Element container of type {} is not supported!",e.tagName),"error")),r}function q(e,t,n,i,o){var a=new Image,r=new qq.Promise;m(a,r),f(e)&&(a.crossOrigin="anonymous"),a.src=e,r.then(function(){m(t,n),new qq.MegaPixImage(a).render(t,{maxWidth:i,maxHeight:i,mime:s(e),resize:o})},n.failure)}function g(e,t,n,i){m(t,n),qq(t).css({maxWidth:i+"px",maxHeight:i+"px"}),t.src=e}qq.extend(this,{generate:function(e,t,n){return qq.isString(e)?(c("Attempting to update thumbnail based on server response."),function(e,t,n){var i,o=new qq.Promise,a=n.scale,r=a?n.maxSize:null;return a&&p(t)?(i=document.createElement("canvas")).getContext&&i.getContext("2d")?f(e)&&void 0===(new Image).crossOrigin?g(e,t,o,r):q(e,t,o,r):g(e,t,o,r):h(t)?q(e,t,o,r):m(t,o)&&(t.src=e),o}(e,t,n||{})):(c("Attempting to draw client-side image preview."),a=e,r=t,s=n||{},l=new qq.Promise,i=new qq.Identify(a,c),u=s.maxSize,d=null==s.orient||s.orient,i.isPreviewable().then(function(n){var e={parse:function(){return(new qq.Promise).success()}},t=d?new qq.Exif(a,c):e,i=new qq.MegaPixImage(a,o);m(r,l)&&t.parse().then(function(e){var t=e&&e.Orientation;i.render(r,{maxWidth:u,maxHeight:u,orientation:t,mime:n,resize:s.customResizeFunction})},function(e){c(qq.format("EXIF data could not be parsed ({}).  Assuming orientation = 1.",e)),i.render(r,{maxWidth:u,maxHeight:u,mime:n,resize:s.customResizeFunction})})},function(){c("Not previewable"),l.failure(r,"Not previewable")}),l);function o(){r.onerror=null,r.onload=null,c("Could not render preview, file may be too large!","error"),l.failure(r,"Browser cannot render image!")}var a,r,s,l,i,u,d}}),this._testing={},this._testing.isImg=p,this._testing.isCanvas=h,this._testing.isCrossOrigin=f,this._testing.determineMimeOfFileName=s},qq.Exif=function(s,c){"use strict";var p=[274],h={274:{name:"Orientation",bytes:2}};function f(e){for(var t=0,n=0;0<e.length;)t+=parseInt(e.substring(0,2),16)*Math.pow(2,n),e=e.substring(2,e.length),n+=8;return t}qq.extend(this,{parse:function(){function a(e){c(qq.format("EXIF header parse failed: '{}' ",e)),r.failure(e)}var r=new qq.Promise;return function(){var t=new qq.Promise;return qq.readBlobToHex(s,0,6).then(function(e){0!==e.indexOf("ffd8")?t.failure("Not a valid JPEG!"):function i(e,t){var o=e,a=t;return void 0===o&&(o=2,a=new qq.Promise),qq.readBlobToHex(s,o,4).then(function(e){var t,n=/^ffe([0-9])/.exec(e);n?"1"!==n[1]?(t=parseInt(e.slice(4,8),16),i(o+t+2,a)):a.success(o):a.failure("No EXIF header to be found!")}),a}().then(function(e){t.success(e)},function(e){t.failure(e)})}),t}().then(function(i){var e,t;c(qq.format("Moving forward with EXIF header parsing for '{}'",void 0===s.name?"blob":s.name)),(e=i,t=new qq.Promise,qq.readBlobToHex(s,e+10,2).then(function(e){t.success("4949"===e)}),t).then(function(o){var e,t,n;c(qq.format("EXIF Byte order is {} endian",o?"little":"big")),(e=i,t=o,n=new qq.Promise,qq.readBlobToHex(s,e+18,2).then(function(e){if(t)return n.success(f(e));n.success(parseInt(e,16))}),n).then(function(e){var t,n;c(qq.format("Found {} APP1 directory entries",e)),(t=i+20,n=12*e,qq.readBlobToHex(s,t,n)).then(function(e){var l,t,u,d,n=function(e){for(var t=[],n=0;n+24<=e.length;)t.push(e.slice(n,n+24)),n+=24;return t}(e),i=(l=o,t=n,u=qq.extend([],p),d={},qq.each(t,function(e,t){var n,i,o,a=t.slice(0,4),r=l?f(a):parseInt(a,16),s=u.indexOf(r);if(0<=s&&(i=h[r].name,o=h[r].bytes,n=t.slice(16,16+2*o),d[i]=l?f(n):parseInt(n,16),u.splice(s,1)),0===u.length)return!1}),d);c("Successfully parsed some EXIF tags"),r.success(i)},a)},a)},a)},a),r}}),this._testing={},this._testing.parseLittleEndian=f},qq.Identify=function(o,l){"use strict";qq.extend(this,{isPreviewable:function(){var e=this,r=new qq.Promise,s=!1,t=void 0===o.name?"blob":o.name;return l(qq.format("Attempting to determine if {} can be rendered in this browser",t)),l("First pass: check type attribute of blob object."),this.isPreviewableSync()?(l("Second pass: check for magic bytes in file header."),qq.readBlobToHex(o,0,4).then(function(a){qq.each(e.PREVIEWABLE_MIME_TYPES,function(e,t){if(n=a,i=!1,o=[].concat(t),qq.each(o,function(e,t){if(0===n.indexOf(t))return!(i=!0)}),i)return"image/tiff"===e&&!qq.supportedFeatures.tiffPreviews||(s=!0,r.success(e)),!1;var n,i,o}),l(qq.format("'{}' is {} able to be rendered in this browser",t,s?"":"NOT")),s||r.failure()},function(){l("Error reading file w/ name '"+t+"'.  Not able to be rendered in this browser."),r.failure()})):r.failure(),r},isPreviewableSync:function(){var e=o.type,t=0<=qq.indexOf(Object.keys(this.PREVIEWABLE_MIME_TYPES),e),n=!1,i=void 0===o.name?"blob":o.name;return t&&(n="image/tiff"!==e||qq.supportedFeatures.tiffPreviews),n||l(i+" is not previewable in this browser per the blob's type attr"),n}})},qq.Identify.prototype.PREVIEWABLE_MIME_TYPES={"image/jpeg":"ffd8ff","image/gif":"474946","image/png":"89504e","image/bmp":"424d","image/tiff":["49492a00","4d4d002a"]},qq.ImageValidation=function(a,r){"use strict";this.validate=function(i){var n,e,o,s=new qq.Promise;return r("Attempting to validate image."),e=i,o=!1,qq.each(e,function(e,t){if(0<t)return!(o=!0)}),o?(n=new qq.Promise,new qq.Identify(a,r).isPreviewable().then(function(){var e=new Image,t=window.URL&&window.URL.createObjectURL?window.URL:window.webkitURL&&window.webkitURL.createObjectURL?window.webkitURL:null;t?(e.onerror=function(){r("Cannot determine dimensions for image.  May be too large.","error"),n.failure()},e.onload=function(){n.success({width:this.width,height:this.height})},e.src=t.createObjectURL(a)):(r("No createObjectURL function available to generate image URL!","error"),n.failure())},n.failure),n).then(function(e){var t,a,r,n=(t=i,a=e,qq.each(t,function(e,t){if(0<t){var n=/(max|min)(Width|Height)/.exec(e),i=n[2].charAt(0).toLowerCase()+n[2].slice(1),o=a[i];switch(n[1]){case"min":if(o<t)return r=e,!1;break;case"max":if(t<o)return r=e,!1}}}),r);n?s.failure(n):s.success()},s.success):s.success(),s}},qq.Session=function(e){"use strict";var a={endpoint:null,params:{},customHeaders:{},cors:{},addFileRecord:function(e){},log:function(e,t){}};qq.extend(a,e,!0),this.refresh=function(){var i=new qq.Promise,e=qq.extend({},a);return new qq.SessionAjaxRequester(qq.extend(e,{onComplete:function(e,t,n){!function(e,t,n,i){var o=!1;(t=t&&function(e){if(qq.isArray(e))return!0;a.log("Session response is not an array.","error")}(e))&&qq.each(e,function(e,t){if(null==t.uuid)o=!0,a.log(qq.format("Session response item {} did not include a valid UUID - ignoring.",e),"error");else if(null==t.name)o=!0,a.log(qq.format("Session response item {} did not include a valid name - ignoring.",e),"error");else try{return a.addFileRecord(t),!0}catch(e){o=!0,a.log(e.message,"error")}return!1}),i[t&&!o?"success":"failure"](e,n)}(e,t,n,i)}})).queryServer(),i}},qq.SessionAjaxRequester=function(e){"use strict";var t,o={endpoint:null,customHeaders:{},params:{},cors:{expected:!1,sendCredentials:!1},onComplete:function(e,t,n){},log:function(e,t){}};qq.extend(o,e),t=qq.extend(this,new qq.AjaxRequester({acceptHeader:"application/json",validMethods:["GET"],method:"GET",endpointStore:{get:function(){return o.endpoint}},customHeaders:o.customHeaders,log:o.log,onComplete:function(e,t,n){var i=null;if(null!=t.responseText)try{i=qq.parseJson(t.responseText)}catch(e){o.log("Problem parsing session response: "+e.message,"error"),n=!0}o.onComplete(i,!n,t)},cors:o.cors})),qq.extend(this,{queryServer:function(){var e=qq.extend({},o.params);o.log("Session query request."),t.initTransport("sessionRefresh").withParams(e).withCacheBuster().send()}})},qq.Scaler=function(e,s){"use strict";var l=e.customResizer,n=e.sendOriginal,u=e.orient,d=e.defaultType,c=e.defaultQuality/100,p=e.failureText,h=e.includeExif,f=this._getSortedSizes(e.sizes);qq.extend(this,{enabled:qq.supportedFeatures.scaling&&0<f.length,getFileRecords:function(e,i,t){var o=this,a=[],r=t.blob?t.blob:t;return new qq.Identify(r,s).isPreviewableSync()?(qq.each(f,function(e,t){var n=o._determineOutputType({defaultType:d,requestedType:t.type,refType:r.type});a.push({uuid:qq.getUniqueId(),name:o._getName(i,{name:t.name,type:n,refType:r.type}),blob:new qq.BlobProxy(r,qq.bind(o._generateScaledImage,o,{customResizeFunction:l,maxSize:t.maxSize,orient:u,type:n,quality:c,failedText:p,includeExif:h,log:s}))})}),a.push({uuid:e,name:i,size:r.size,blob:n?r:null})):a.push({uuid:e,name:i,size:r.size,blob:r}),a},handleNewFile:function(e,t,n,i,o,a,r,s){e.qqButtonId||e.blob&&e.blob.qqButtonId;var l,u=[],d=null,c=s.addFileToHandler,p=s.uploadData,h=s.paramsStore,f=qq.getUniqueId();qq.each(this.getFileRecords(n,t,e),function(e,t){var n,i=t.size;t.blob instanceof qq.BlobProxy&&(i=-1),n=p.addFile({uuid:t.uuid,name:t.name,size:i,batchId:a,proxyGroupId:f}),t.blob instanceof qq.BlobProxy?u.push(n):d=n,t.blob?(c(n,t.blob),o.push({id:n,file:t.blob})):p.setStatus(n,qq.status.REJECTED)}),null!==d&&(qq.each(u,function(e,t){var n={qqparentuuid:p.retrieve({id:d}).uuid,qqparentsize:p.retrieve({id:d}).size};n[r]=p.retrieve({id:t}).uuid,p.setParentId(t,d),h.addReadOnly(t,n)}),u.length&&((l={})[r]=p.retrieve({id:d}).uuid,h.addReadOnly(d,l)))}})},qq.extend(qq.Scaler.prototype,{scaleImage:function(t,e,n){"use strict";if(!qq.supportedFeatures.scaling)throw new qq.Error("Scaling is not supported in this browser!");var i=new qq.Promise,o=n.log,a=n.getFile(t),r=n.uploadData.retrieve({id:t}),s=r&&r.name,l=r&&r.uuid,u={customResizer:e.customResizer,sendOriginal:!1,orient:e.orient,defaultType:e.type||null,defaultQuality:e.quality,failedToScaleText:"Unable to scale",sizes:[{name:"",maxSize:e.maxSize}]},d=new qq.Scaler(u,o);return qq.Scaler&&qq.supportedFeatures.imagePreviews&&a?qq.bind(function(){var e=d.getFileRecords(l,s,a)[0];e&&e.blob instanceof qq.BlobProxy?e.blob.create().then(i.success,i.failure):(o(t+" is not a scalable image!","error"),i.failure())},this)():(i.failure(),o("Could not generate requested scaled image for "+t+".  Scaling is either not possible in this browser, or the file could not be located.","error")),i},_determineOutputType:function(e){"use strict";var t=e.requestedType,n=e.defaultType,i=e.refType;return n||t?t&&0<=qq.indexOf(Object.keys(qq.Identify.prototype.PREVIEWABLE_MIME_TYPES),t)?"image/tiff"===t?qq.supportedFeatures.tiffPreviews?t:n:t:n:"image/jpeg"!==i?"image/png":i},_getName:function(e,t){"use strict";var n=e.lastIndexOf("."),i=t.type||"image/png",o=t.refType,a="",r=qq.getExtension(e),s="";return t.name&&t.name.trim().length&&(s=" ("+t.name+")"),0<=n?(a=e.substr(0,n),o!==i&&(r=i.split("/")[1]),a+=s+"."+r):a=e+s,a},_getSortedSizes:function(e){"use strict";return(e=qq.extend([],e)).sort(function(e,t){return e.maxSize>t.maxSize?1:e.maxSize<t.maxSize?-1:0})},_generateScaledImage:function(e,i){"use strict";var o=this,t=e.customResizeFunction,a=e.log,n=e.maxSize,r=e.orient,s=e.type,l=e.quality,u=e.failedText,d=e.includeExif&&"image/jpeg"===i.type&&"image/jpeg"===s,c=new qq.Promise,p=new qq.ImageGenerator(a),h=document.createElement("canvas");return a("Attempting to generate scaled version for "+i.name),p.generate(i,h,{maxSize:n,orient:r,customResizeFunction:t}).then(function(){function t(){a("Success generating scaled version for "+i.name);var e=qq.dataUriToBlob(n);c.success(e)}var n=h.toDataURL(s,l);d?o._insertExifHeader(i,n,a).then(function(e){n=e,t()},function(){a("Problem inserting EXIF header into scaled image.  Using scaled image w/out EXIF data.","error"),t()}):t()},function(){a("Failed attempt to generate scaled version for "+i.name,"error"),c.failure(u)}),c},_insertExifHeader:function(e,t,n){"use strict";var i=new FileReader,o=new qq.Promise,a="";return i.onload=function(){a=i.result,o.success(qq.ExifRestorer.restore(a,t))},i.onerror=function(){n("Problem reading "+e.name+" during attempt to transfer EXIF data to scaled version.","error"),o.failure()},i.readAsDataURL(e),o},_dataUriToBlob:function(e){"use strict";var t,n,i,o;return t=0<=e.split(",")[0].indexOf("base64")?atob(e.split(",")[1]):decodeURI(e.split(",")[1]),n=e.split(",")[0].split(":")[1].split(";")[0],i=new ArrayBuffer(t.length),o=new Uint8Array(i),qq.each(t,function(e,t){o[e]=t.charCodeAt(0)}),this._createBlob(i,n)},_createBlob:function(e,t){"use strict";var n=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,i=n&&new n;return i?(i.append(e),i.getBlob(t)):new Blob([e],{type:t})}}),qq.ExifRestorer=(DF={KEY_STR:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode64:function(e){for(var t,n,i,o,a,r="",s="",l="",u=0;i=(t=e[u++])>>2,o=(3&t)<<4|(n=e[u++])>>4,a=(15&n)<<2|(s=e[u++])>>6,l=63&s,isNaN(n)?a=l=64:isNaN(s)&&(l=64),r=r+this.KEY_STR.charAt(i)+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(a)+this.KEY_STR.charAt(l),t=n=s="",i=o=a=l="",u<e.length;);return r},restore:function(e,t){var n="data:image/jpeg;base64,";if(!e.match(n))return t;var i=this.decode64(e.replace(n,"")),o=this.slice2Segments(i),a=this.exifManipulation(t,o);return n+this.encode64(a)},exifManipulation:function(e,t){var n=this.getExifArray(t),i=this.insertExif(e,n);return new Uint8Array(i)},getExifArray:function(e){for(var t,n=0;n<e.length;n++)if(255==(t=e[n])[0]&225==t[1])return t;return[]},insertExif:function(e,t){var n=e.replace("data:image/jpeg;base64,",""),i=this.decode64(n),o=i.indexOf(255,3),a=i.slice(0,o),r=i.slice(o),s=a;return(s=s.concat(t)).concat(r)},slice2Segments:function(e){for(var t=0,n=[];!(255==e[t]&218==e[t+1]);){if(255==e[t]&216==e[t+1])t+=2;else{var i=t+(256*e[t+2]+e[t+3])+2,o=e.slice(t,i);n.push(o),t=i}if(t>e.length)break}return n},decode64:function(e){var t,n,i,o,a="",r="",s=0,l=[];if(/[^A-Za-z0-9\+\/\=]/g.exec(e))throw new Error("There were invalid base64 characters in the input text.  Valid base64 characters are A-Z, a-z, 0-9, '+', '/',and '='");for(e=e.replace(/[^A-Za-z0-9\+\/\=]/g,"");t=this.KEY_STR.indexOf(e.charAt(s++))<<2|(i=this.KEY_STR.indexOf(e.charAt(s++)))>>4,n=(15&i)<<4|(o=this.KEY_STR.indexOf(e.charAt(s++)))>>2,a=(3&o)<<6|(r=this.KEY_STR.indexOf(e.charAt(s++))),l.push(t),64!=o&&l.push(n),64!=r&&l.push(a),t=n=a="",i=o=r="",s<e.length;);return l}},DF),qq.TotalProgress=function(n,i){"use strict";function r(e,t){e===u&&t===d||n(e,t),u=e,d=t}function o(e){var t=i(e);0<t&&(c(e,0,t),a[e]={loaded:0,total:t})}var a={},s=0,l=0,u=-1,d=-1,c=function(e,t,n){var i=a[e]?a[e].loaded:0,o=a[e]?a[e].total:0;-1===t&&-1===n?(s-=i,l-=o):(t&&(s+=t-i),n&&(l+=n-o)),r(s,l)};qq.extend(this,{onAllComplete:function(e,t,n){var i,o,a;0!==t.length&&(i=t,o=n,a=!0,qq.each(i,function(e,t){if(0<=qq.indexOf(o,t))return a=!1}),!a)||(r(l,l),this.reset())},onStatusChange:function(e,t,n){var i;n===qq.status.CANCELED||n===qq.status.REJECTED?(c(i=e,-1,-1),delete a[i]):n===qq.status.SUBMITTING&&o(e)},onIndividualProgress:function(e,t,n){c(e,t,n),a[e]={loaded:t,total:n}},onNewSize:function(e){o(e)},reset:function(){a={},l=s=0}})},qq.PasteSupport=function(e){"use strict";var o,t;o={targetElement:null,callbacks:{log:function(e,t){},pasteReceived:function(e){}}},qq.extend(o,e),t=qq(o.targetElement).attach("paste",function(e){var t=e.clipboardData;t&&qq.each(t.items,function(e,t){if((i=t).type&&0===i.type.indexOf("image/")){var n=t.getAsFile();o.callbacks.pasteReceived(n)}var i})}),qq.extend(this,{reset:function(){t&&t()}})},qq.FormSupport=function(e,t,n){"use strict";var i,o,a,r,s=this,l=e.interceptSubmit,u=e.element,d=e.autoUpload;function c(e,t){if(!e.checkValidity||e.checkValidity())return!0;n("Form did not pass validation checks - will not upload.","error"),t()}qq.extend(this,{newEndpoint:null,newAutoUpload:d,attachedToForm:!1,getFormInputsAsObject:function(){return null==u?null:s._form2Obj(u)}}),(r=u)&&(qq.isString(r)&&(r=document.getElementById(r)),r&&(n("Attaching to form element."),(a=r).getAttribute("action")&&(s.newEndpoint=a.getAttribute("action")),l&&(o=(i=r).submit,qq(i).attach("submit",function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1,c(i,o)&&t()}),i.submit=function(){c(i,o)&&t()}))),u=r,this.attachedToForm=!!u},qq.extend(qq.FormSupport.prototype,{_form2Obj:function(e){"use strict";function r(e){return t=e.type,!(!(0<=qq.indexOf(["checkbox","radio"],t.toLowerCase()))||e.checked)||e.disabled&&"hidden"!==e.type.toLowerCase();var t}var s={};return qq.each(e.elements,function(e,t){if((qq.isInput(t,!0)||"textarea"===t.tagName.toLowerCase())&&(a=t.type,qq.indexOf(["button","image","reset","submit"],a.toLowerCase())<0)&&!r(t))s[t.name]=t.value;else if("select"===t.tagName.toLowerCase()&&!r(t)){var n=(i=t,o=null,qq.each(qq(i).children(),function(e,t){if("option"===t.tagName.toLowerCase()&&t.selected)return o=t.value,!1}),o);null!==n&&(s[t.name]=n)}var i,o,a}),s}}),qq.traditional=qq.traditional||{},qq.traditional.FormUploadHandler=function(c,e){"use strict";var p=this,h=e.getName,f=e.getUuid,m=e.log;this.uploadFile=function(n){var e,t,i,o,a,r,s,l=p.getInput(n),u=p._createIframe(n),d=new qq.Promise;return(t=n,i=u,o=c.paramsStore.get(t),a="get"===c.method.toLowerCase()?"GET":"POST",r=c.endpointStore.get(t),s=h(t),o[c.uuidName]=f(t),o[c.filenameParam]=s,e=p._initFormForUpload({method:a,endpoint:r,params:o,paramsInBody:c.paramsInBody,targetName:i.name})).appendChild(l),p._attachLoadEvent(u,function(e){m("iframe loaded");var t=e||function(e,t){var n,i,o;try{o=(i=t.contentDocument||t.contentWindow.document).body.innerHTML,m("converting iframe's innerHTML to JSON"),m("innerHTML = "+o),o&&o.match(/^<pre/i)&&(o=i.body.firstChild.firstChild.nodeValue),n=p._parseJsonResponse(o)}catch(e){m("Error when attempting to parse form upload response ("+e.message+")","error"),n={success:!1}}return n}(0,u);p._detachLoadEvent(n),c.cors.expected||qq(u).remove(),t.success?d.success(t):d.failure(t)}),m("Sending upload request for "+n),e.submit(),qq(e).remove(),d},qq.extend(this,new qq.FormUploadHandler({options:{isCors:c.cors.expected,inputName:c.inputName},proxy:{onCancel:c.onCancel,getName:h,getUuid:f,log:m}}))},qq.traditional=qq.traditional||{},qq.traditional.XhrUploadHandler=function(q,n){"use strict";function g(t,n){var i=new qq.Promise;return n.onreadystatechange=function(){if(4===n.readyState){var e=o(t,n);e.success?i.success(e.response,n):i.failure(e.response,n)}},i}function _(e){var t,n=e.fileOrBlob,i=e.id,o=e.xhr,a=e.xhrOverrides||{},r=e.customParams||{},s=e.params||{},l=a.params||{},u=x?new FormData:null,d=a.method||q.method,c=a.endpoint||q.endpointStore.get(i),p=y(i),h=w(i);return q.omitDefaultParams?(t=qq.extend({},r),qq.extend(t,l)):(t=qq.extend({},r),qq.extend(t,l),qq.extend(t,s),t[q.uuidName]=f(i),t[q.filenameParam]=p,x?t[q.totalFileSizeName]=h:q.paramsInBody||(t[q.inputName]=p)),q.paramsInBody||(c=qq.obj2url(t,c)),o.open(d,c,!0),q.cors.expected&&q.cors.sendCredentials&&(o.withCredentials=!0),x?(q.paramsInBody&&qq.obj2FormData(t,u),u.append(q.inputName,n),u):n}function b(e){var t=e.headerOverrides,n=e.id,i=e.xhr;if(t)qq.each(t,function(e,t){i.setRequestHeader(e,t)});else{var o=q.customHeaders.get(n),a=v.getFile(n);i.setRequestHeader("Accept","application/json"),i.setRequestHeader("X-Requested-With","XMLHttpRequest"),i.setRequestHeader("Cache-Control","no-cache"),x||(i.setRequestHeader("Content-Type","application/octet-stream"),i.setRequestHeader("X-Mime-Type",a.type)),qq.each(o,function(e,t){i.setRequestHeader(e,t)})}}var v=this,y=n.getName,w=n.getSize,f=n.getUuid,a=n.log,x=q.forceMultipart||q.paramsInBody,r=new qq.traditional.AllChunksDoneAjaxRequester({cors:q.cors,endpoint:q.chunking.success.endpoint,headers:q.chunking.success.headers,jsonPayload:q.chunking.success.jsonPayload,log:a,method:q.chunking.success.method,params:q.chunking.success.params}),o=function(e,t){var n,i,o;return a("xhr - server response received for "+e),a("responseText = "+t.responseText),{success:(i=t,o=n=s(!0,t),!(qq.indexOf([200,201,202,203,204],i.status)<0||q.requireSuccessJson&&!o.success||o.reset)),response:n}},s=function(e,t){var n={};try{a(qq.format("Received response status {} with body: {}",t.status,t.responseText)),n=qq.parseJson(t.responseText)}catch(t){e&&q.requireSuccessJson&&a("Error when attempting to parse xhr response text ("+t.message+")","error")}return n};qq.extend(this,{uploadChunk:function(e){var t,n,i,o,a,r,s,l,u=e.id,d=e.chunkIdx,c=e.overrides||{},p=e.resuming,h=v._getChunkData(u,d),f=v._createXhr(u,d),m={};return t=g(u,f),v._registerProgressHandler(u,d,h.size),i=q.paramsStore.get(u),a=m,r=h,s=w(o=u),l=y(o),q.omitDefaultParams||(a[q.chunking.paramNames.partIndex]=r.part,a[q.chunking.paramNames.partByteOffset]=r.start,a[q.chunking.paramNames.chunkSize]=r.size,a[q.chunking.paramNames.totalParts]=r.count,a[q.totalFileSizeName]=s),x&&!q.omitDefaultParams&&(a[q.filenameParam]=l),p&&(m[q.resume.paramNames.resuming]=!0),n=_({fileOrBlob:h.blob,id:u,customParams:i,params:m,xhr:f,xhrOverrides:c}),b({headerOverrides:c.headers,id:u,xhr:f}),f.send(n),t},uploadFile:function(e){var t,n,i,o=v.getFile(e);return n=v._createXhr(e),v._registerProgressHandler(e),t=g(e,n),i=_({fileOrBlob:o,id:e,customParams:q.paramsStore.get(e),xhr:n}),b({id:e,xhr:n}),n.send(i),t}}),qq.extend(this,new qq.XhrUploadHandler({options:qq.extend({namespace:"traditional"},q),proxy:qq.extend({getEndpoint:q.endpointStore.get},n)})),qq.override(this,function(t){return{finalizeChunks:function(e){return n.onFinalizing(e),q.chunking.success.endpoint?function(e){var t,n,i,o,a=new qq.Promise;return r.complete(e,v._createXhr(e),(t=e,n=q.paramsStore.get(t),i=y(t),o=w(t),n[q.uuidName]=f(t),n[q.filenameParam]=i,n[q.totalFileSizeName]=o,n[q.chunking.paramNames.totalParts]=v._getTotalChunks(t),n),q.customHeaders.get(e)).then(function(e){a.success(s(!1,e),e)},function(e){a.failure(s(!1,e),e)}),a}(e):t.finalizeChunks(e,qq.bind(s,this,!0))}}})},qq.traditional.AllChunksDoneAjaxRequester=function(e){"use strict";var a,r={cors:{allowXdr:!1,expected:!1,sendCredentials:!1},endpoint:null,log:function(e,t){},method:"POST"},s={},t={get:function(e){return qq.isFunction(r.endpoint)?r.endpoint(e):r.endpoint}};qq.extend(r,e),a=qq.extend(this,new qq.AjaxRequester({acceptHeader:"application/json",contentType:r.jsonPayload?"application/json":"application/x-www-form-urlencoded",validMethods:[r.method],method:r.method,endpointStore:t,allowXRequestedWithAndCacheControl:!1,cors:r.cors,log:r.log,onComplete:function(e,t,n){var i=s[e];delete s[e],n?i.failure(t):i.success(t)}})),qq.extend(this,{complete:function(e,t,n,i){var o=new qq.Promise;return r.log("Submitting All Chunks Done request for "+e),s[e]=o,a.initTransport(e).withParams(r.params(e)||n).withHeaders(r.headers(e)||i).send(t),o}})},qq.DragAndDrop=function(e){"use strict";var r,i,n="qq-hidezones",o="qq-hide-dropzone",s=[],l=[],u=new qq.DisposeSupport;function d(e){var t=e.name,n=e.fullPath,i=n.lastIndexOf(t);return"/"===(n=n.substr(0,i)).charAt(0)&&(n=n.substr(1)),n}function a(t){var a=new qq.UploadDropZone({HIDE_ZONES_EVENT_NAME:n,element:t,onEnter:function(e){r.callbacks.handleDragOver(a),qq(t).addClass(r.classes.dropActive),e.stopPropagation()},onLeaveNotDescendants:function(e){r.callbacks.handleDragOut(a),qq(t).removeClass(r.classes.dropActive)},onDrop:function(e){var t,n,i,o;r.callbacks.handleDragDrop(a),(t=e.dataTransfer,n=a,i=[],o=new qq.Promise,r.callbacks.processingDroppedFiles(),n.dropDisabled(!0),1<t.files.length&&!r.allowMultipleItems?(r.callbacks.processingDroppedFilesComplete([]),r.callbacks.dropError("tooManyFilesError",""),n.dropDisabled(!1),o.failure()):(l=[],qq.isFolderDropSupported(t)?qq.each(t.items,function(e,t){var n=t.webkitGetAsEntry();n&&(n.isFile?l.push(t.getAsFile()):i.push(function i(t){var o=new qq.Promise;return t.isFile?t.file(function(e){e.qqPath=d(t),l.push(e),o.success()},function(e){r.callbacks.dropLog("Problem parsing '"+t.fullPath+"'.  FileError code "+e.code+".","error"),o.failure()}):t.isDirectory&&function n(i,e,o,t){var a=t||new qq.Promise,r=e||i.createReader();return r.readEntries(function(e){var t=o?o.concat(e):e;e.length?setTimeout(function(){n(i,r,t,a)},0):a.success(t)},a.failure),a}(t).then(function(e){var n=e.length;qq.each(e,function(e,t){i(t).done(function(){0==(n-=1)&&o.success()})}),e.length||o.success()},function(e){r.callbacks.dropLog("Problem parsing '"+t.fullPath+"'.  FileError code "+e.code+".","error"),o.failure()}),o}(n).done(function(){i.pop(),0===i.length&&o.success()})))}):l=t.files,0===i.length&&o.success()),o).then(function(){var e,t,n;e=l,t=a,n=Array.prototype.slice.call(e),r.callbacks.dropLog("Grabbed "+e.length+" dropped files."),t.dropDisabled(!1),r.callbacks.processingDroppedFilesComplete(n,t.getElement())},function(){r.callbacks.dropLog("Drop event DataTransfer parsing failed.  No files will be uploaded.","error")})}});return u.addDisposer(function(){a.dispose()}),qq(t).hasAttribute(o)&&qq(t).hide(),s.push(a),a}function c(e){var n;return qq.each(e.dataTransfer.types,function(e,t){if("Files"===t)return!(n=!0)}),n}function p(){setTimeout(function(){qq.each(i,function(e,t){qq(t).hasAttribute(o)&&qq(t).hide(),qq(t).removeClass(r.classes.dropActive)})},10)}r={dropZoneElements:[],allowMultipleItems:!0,classes:{dropActive:null},callbacks:new qq.DragAndDrop.callbacks},qq.extend(r,e,!0),i=r.dropZoneElements,qq.each(i,function(e,t){var n=a(t);i.length&&qq.supportedFeatures.fileDrop&&u.attach(document,"dragenter",function(e){!n.dropDisabled()&&c(e)&&qq.each(i,function(e,t){t instanceof HTMLElement&&qq(t).hasAttribute(o)&&qq(t).css({display:"block"})})})}),u.attach(document,"dragleave",function(e){var t;t=e,(qq.safari()?t.x<0||t.y<0:0===t.x&&0===t.y)&&p()}),u.attach(qq(document).children()[0],"mouseenter",function(e){p()}),u.attach(document,"drop",function(e){c(e)&&(e.preventDefault(),p())}),u.attach(document,n,p),qq.extend(this,{setupExtraDropzone:function(e){r.dropZoneElements.push(e),a(e)},removeDropzone:function(e){var t,n=r.dropZoneElements;for(t in n)if(n[t]===e)return n.splice(t,1)},dispose:function(){u.dispose(),qq.each(s,function(e,t){t.dispose()})}}),this._testing={},this._testing.extractDirectoryPath=d},qq.DragAndDrop.callbacks=function(){"use strict";return{processingDroppedFiles:function(){},processingDroppedFilesComplete:function(e,t){},dropError:function(e,t){qq.log("Drag & drop error code '"+e+" with these specifics: '"+t+"'","error")},dropLog:function(e,t){qq.log(e,t)},handleDragOver:function(e){},handleDragOut:function(e){},handleDragDrop:function(e){}}},qq.UploadDropZone=function(e){"use strict";var n,t,i,o,a=new qq.DisposeSupport;function r(e){if(!qq.supportedFeatures.fileDrop)return!1;var t,n=e.dataTransfer,i=qq.safari();return t=!(!qq.ie()||!qq.supportedFeatures.fileDrop)||"none"!==n.effectAllowed,n&&t&&(n.files&&n.files.length||!i&&n.types.contains&&n.types.contains("Files")||n.types.includes&&n.types.includes("Files"))}function s(e){return void 0!==e&&(i=e),i}n={element:null,onEnter:function(e){},onLeave:function(e){},onLeaveNotDescendants:function(e){},onDrop:function(e){}},qq.extend(n,e),t=n.element,o||(a.attach(document,"dragover",function(e){e.preventDefault()}),o=!0),a.attach(t,"dragover",function(e){if(r(e)){var t=qq.ie()&&qq.supportedFeatures.fileDrop?null:e.dataTransfer.effectAllowed;e.dataTransfer.dropEffect="move"===t||"linkMove"===t?"move":"copy",e.stopPropagation(),e.preventDefault()}}),a.attach(t,"dragenter",function(e){if(!s()){if(!r(e))return;n.onEnter(e)}}),a.attach(t,"dragleave",function(e){if(r(e)){n.onLeave(e);var t=document.elementFromPoint(e.clientX,e.clientY);qq(this).contains(t)||n.onLeaveNotDescendants(e)}}),a.attach(t,"drop",function(e){if(!s()){if(!r(e))return;e.preventDefault(),e.stopPropagation(),n.onDrop(e),function(){var e;function t(){(e=document.createEvent("Event")).initEvent(n.HIDE_ZONES_EVENT_NAME,!0,!0)}if(window.CustomEvent)try{e=new CustomEvent(n.HIDE_ZONES_EVENT_NAME)}catch(e){t()}else t();document.dispatchEvent(e)}()}}),qq.extend(this,{dropDisabled:function(e){return s(e)},dispose:function(){a.dispose()},getElement:function(){return t}}),this._testing={},this._testing.isValidFileDrag=r},function(){"use strict";qq.uiPublicApi={addInitialFiles:function(e){this._parent.prototype.addInitialFiles.apply(this,arguments),this._templating.addCacheToDom()},clearStoredFiles:function(){this._parent.prototype.clearStoredFiles.apply(this,arguments),this._templating.clearFiles()},addExtraDropzone:function(e){this._dnd&&this._dnd.setupExtraDropzone(e)},removeExtraDropzone:function(e){if(this._dnd)return this._dnd.removeDropzone(e)},getItemByFileId:function(e){if(!this._templating.isHiddenForever(e))return this._templating.getFileContainer(e)},reset:function(){this._parent.prototype.reset.apply(this,arguments),this._templating.reset(),!this._options.button&&this._templating.getButton()&&(this._defaultButtonId=this._createUploadButton({element:this._templating.getButton(),title:this._options.text.fileInputTitle}).getButtonId()),this._dnd&&(this._dnd.dispose(),this._dnd=this._setupDragAndDrop()),this._totalFilesInBatch=0,this._filesInBatchAddedToUi=0,this._setupClickAndEditEventHandlers()},setName:function(e,t){var n=this._options.formatFileName(t);this._parent.prototype.setName.apply(this,arguments),this._templating.updateFilename(e,n)},pauseUpload:function(e){var t=this._parent.prototype.pauseUpload.apply(this,arguments);return t&&this._templating.uploadPaused(e),t},continueUpload:function(e){var t=this._parent.prototype.continueUpload.apply(this,arguments);return t&&this._templating.uploadContinued(e),t},getId:function(e){return this._templating.getFileId(e)},getDropTarget:function(e){return this.getFile(e).qqDropTarget}},qq.uiPrivateApi={_getButton:function(e){var t=this._parent.prototype._getButton.apply(this,arguments);return t||e===this._defaultButtonId&&(t=this._templating.getButton()),t},_removeFileItem:function(e){this._templating.removeFile(e)},_setupClickAndEditEventHandlers:function(){this._fileButtonsClickHandler=qq.FileButtonsClickHandler&&this._bindFileButtonsClickEvent(),this._focusinEventSupported=!qq.firefox(),this._isEditFilenameEnabled()&&(this._filenameClickHandler=this._bindFilenameClickEvent(),this._filenameInputFocusInHandler=this._bindFilenameInputFocusInEvent(),this._filenameInputFocusHandler=this._bindFilenameInputFocusEvent())},_setupDragAndDrop:function(){var i=this,e=this._options.dragAndDrop.extraDropzones,t=this._templating,n=t.getDropZone();return n&&e.push(n),new qq.DragAndDrop({dropZoneElements:e,allowMultipleItems:this._options.multiple,classes:{dropActive:this._options.classes.dropActive},callbacks:{processingDroppedFiles:function(){t.showDropProcessing()},processingDroppedFilesComplete:function(e,n){t.hideDropProcessing(),qq.each(e,function(e,t){t.qqDropTarget=n}),e.length&&i.addFiles(e,null,null)},dropError:function(e,t){i._itemError(e,t)},dropLog:function(e,t){i.log(e,t)},handleDragOver:function(e){i._options.callbacks.onDropzoneDragOver(e)},handleDragOut:function(e){i._options.callbacks.onDropzoneDragOut(e)},handleDragDrop:function(e){i._options.callbacks.onDropzoneDragDrop(e)}}})},_bindFileButtonsClickEvent:function(){var n=this;return new qq.FileButtonsClickHandler({templating:this._templating,log:function(e,t){n.log(e,t)},onDeleteFile:function(e){n.deleteFile(e)},onCancel:function(e){n.cancel(e)},onRetry:function(e){n.retry(e)},onPause:function(e){n.pauseUpload(e)},onContinue:function(e){n.continueUpload(e)},onGetName:function(e){return n.getName(e)}})},_isEditFilenameEnabled:function(){return this._templating.isEditFilenamePossible()&&!this._options.autoUpload&&qq.FilenameClickHandler&&qq.FilenameInputFocusHandler&&qq.FilenameInputFocusHandler},_filenameEditHandler:function(){var n=this,o=this._templating;return{templating:o,log:function(e,t){n.log(e,t)},onGetUploadStatus:function(e){return n.getUploads({id:e}).status},onGetName:function(e){return n.getName(e)},onSetName:function(e,t){n.setName(e,t)},onEditingStatusChange:function(e,t){var n=qq(o.getEditInput(e)),i=qq(o.getFileContainer(e));t?(n.addClass("qq-editing"),o.hideFilename(e),o.hideEditIcon(e)):(n.removeClass("qq-editing"),o.showFilename(e),o.showEditIcon(e)),i.addClass("qq-temp").removeClass("qq-temp")}}},_onUploadStatusChange:function(e,t,n){this._parent.prototype._onUploadStatusChange.apply(this,arguments),this._isEditFilenameEnabled()&&this._templating.getFileContainer(e)&&n!==qq.status.SUBMITTED&&(this._templating.markFilenameEditable(e),this._templating.hideEditIcon(e)),t===qq.status.UPLOAD_RETRYING&&n===qq.status.UPLOADING?(this._templating.hideRetry(e),this._templating.setStatusText(e),qq(this._templating.getFileContainer(e)).removeClass(this._classes.retrying)):n===qq.status.UPLOAD_FAILED&&this._templating.hidePause(e)},_bindFilenameInputFocusInEvent:function(){var e=qq.extend({},this._filenameEditHandler());return new qq.FilenameInputFocusInHandler(e)},_bindFilenameInputFocusEvent:function(){var e=qq.extend({},this._filenameEditHandler());return new qq.FilenameInputFocusHandler(e)},_bindFilenameClickEvent:function(){var e=qq.extend({},this._filenameEditHandler());return new qq.FilenameClickHandler(e)},_storeForLater:function(e){this._parent.prototype._storeForLater.apply(this,arguments),this._templating.hideSpinner(e)},_onAllComplete:function(e,t){this._parent.prototype._onAllComplete.apply(this,arguments),this._templating.resetTotalProgress()},_onSubmit:function(e,t){var n=this.getFile(e);n&&n.qqPath&&this._options.dragAndDrop.reportDirectoryPaths&&this._paramsStore.addReadOnly(e,{qqpath:n.qqPath}),this._parent.prototype._onSubmit.apply(this,arguments),this._addToList(e,t)},_onSubmitted:function(e){this._isEditFilenameEnabled()&&(this._templating.markFilenameEditable(e),this._templating.showEditIcon(e),this._focusinEventSupported||this._filenameInputFocusHandler.addHandler(this._templating.getEditInput(e)))},_onProgress:function(e,t,n,i){this._parent.prototype._onProgress.apply(this,arguments),this._templating.updateProgress(e,n,i),0===i||100===Math.round(n/i*100)?(this._templating.hideCancel(e),this._templating.hidePause(e),this._templating.hideProgress(e),this._templating.setStatusText(e,this._options.text.waitingForResponse),this._displayFileSize(e)):this._displayFileSize(e,n,i)},_onTotalProgress:function(e,t){this._parent.prototype._onTotalProgress.apply(this,arguments),this._templating.updateTotalProgress(e,t)},_onComplete:function(t,e,n,i){var o=this._parent.prototype._onComplete.apply(this,arguments),a=this._templating,r=a.getFileContainer(t),s=this;function l(e){r&&(a.setStatusText(t),qq(r).removeClass(s._classes.retrying),a.hideProgress(t),s.getUploads({id:t}).status!==qq.status.UPLOAD_FAILED&&a.hideCancel(t),a.hideSpinner(t),e.success?s._markFileAsSuccessful(t):(qq(r).addClass(s._classes.fail),a.showCancel(t),a.isRetryPossible()&&!s._preventRetries[t]&&(qq(r).addClass(s._classes.retryable),a.showRetry(t)),s._controlFailureTextDisplay(t,e)))}return o instanceof qq.Promise?o.done(function(e){l(e)}):l(n),o},_markFileAsSuccessful:function(e){var t=this._templating;this._isDeletePossible()&&t.showDeleteButton(e),qq(t.getFileContainer(e)).addClass(this._classes.success),this._maybeUpdateThumbnail(e)},_onUploadPrep:function(e){this._parent.prototype._onUploadPrep.apply(this,arguments),this._templating.showSpinner(e)},_onUpload:function(e,t){var n=this._parent.prototype._onUpload.apply(this,arguments);return this._templating.showSpinner(e),n},_onUploadChunk:function(e,t){this._parent.prototype._onUploadChunk.apply(this,arguments),0<t.partIndex&&this._handler.isResumable(e)&&this._templating.allowPause(e)},_onCancel:function(e,t){this._parent.prototype._onCancel.apply(this,arguments),this._removeFileItem(e),0===this._getNotFinished()&&this._templating.resetTotalProgress()},_onBeforeAutoRetry:function(e){var t,n,i;this._parent.prototype._onBeforeAutoRetry.apply(this,arguments),this._showCancelLink(e),this._options.retry.showAutoRetryNote&&(t=this._autoRetries[e],n=this._options.retry.maxAutoAttempts,i=(i=this._options.retry.autoRetryNote.replace(/\{retryNum\}/g,t)).replace(/\{maxAuto\}/g,n),this._templating.setStatusText(e,i),qq(this._templating.getFileContainer(e)).addClass(this._classes.retrying))},_onBeforeManualRetry:function(e){return this._parent.prototype._onBeforeManualRetry.apply(this,arguments)?(this._templating.resetProgress(e),qq(this._templating.getFileContainer(e)).removeClass(this._classes.fail),this._templating.setStatusText(e),this._templating.showSpinner(e),this._showCancelLink(e),!0):(qq(this._templating.getFileContainer(e)).addClass(this._classes.retryable),this._templating.showRetry(e),!1)},_onSubmitDelete:function(e){var t=qq.bind(this._onSubmitDeleteSuccess,this);this._parent.prototype._onSubmitDelete.call(this,e,t)},_onSubmitDeleteSuccess:function(e,t,n){this._options.deleteFile.forceConfirm?this._showDeleteConfirm.apply(this,arguments):this._sendDeleteRequest.apply(this,arguments)},_onDeleteComplete:function(e,t,n){this._parent.prototype._onDeleteComplete.apply(this,arguments),this._templating.hideSpinner(e),n?(this._templating.setStatusText(e,this._options.deleteFile.deletingFailedText),this._templating.showDeleteButton(e)):this._removeFileItem(e)},_sendDeleteRequest:function(e,t,n){this._templating.hideDeleteButton(e),this._templating.showSpinner(e),this._templating.setStatusText(e,this._options.deleteFile.deletingStatusText),this._deleteHandler.sendDelete.apply(this,arguments)},_showDeleteConfirm:function(e,t,n){var i,o=this.getName(e),a=this._options.deleteFile.confirmMessage.replace(/\{filename\}/g,o),r=(t=this.getUuid(e),arguments),s=this;i=this._options.showConfirm(a),qq.isGenericPromise(i)?i.then(function(){s._sendDeleteRequest.apply(s,r)}):!1!==i&&s._sendDeleteRequest.apply(s,r)},_addToList:function(e,t,n){var i,o,a=0,r=this._handler.isProxied(e)&&this._options.scaling.hideScaled;this._options.display.prependFiles&&(1<this._totalFilesInBatch&&0<this._filesInBatchAddedToUi&&(a=this._filesInBatchAddedToUi-1),i={index:a}),n||(this._options.disableCancelForFormUploads&&!qq.supportedFeatures.ajaxUploading&&this._templating.disableCancel(),this._options.multiple||(o=this.getUploads({id:e}),this._handledProxyGroup=this._handledProxyGroup||o.proxyGroupId,o.proxyGroupId===this._handledProxyGroup&&o.proxyGroupId||(this._handler.cancelAll(),this._clearList(),this._handledProxyGroup=null))),n?(this._templating.addFileToCache(e,this._options.formatFileName(t),i,r),this._templating.updateThumbnail(e,this._thumbnailUrls[e],!0,this._options.thumbnails.customResizer)):(this._templating.addFile(e,this._options.formatFileName(t),i,r),this._templating.generatePreview(e,this.getFile(e),this._options.thumbnails.customResizer)),this._filesInBatchAddedToUi+=1,(n||this._options.display.fileSizeOnSubmit&&qq.supportedFeatures.ajaxUploading)&&this._displayFileSize(e)},_clearList:function(){this._templating.clearFiles(),this.clearStoredFiles()},_displayFileSize:function(e,t,n){var i=this.getSize(e),o=this._formatSize(i);0<=i&&(void 0!==t&&void 0!==n&&(o=this._formatProgress(t,n)),this._templating.updateSize(e,o))},_formatProgress:function(e,t){var n=this._options.text.formatProgress;function i(e,t){n=n.replace(e,t)}return i("{percent}",Math.round(e/t*100)),i("{total_size}",this._formatSize(t)),n},_controlFailureTextDisplay:function(e,t){var n,i,o;n=this._options.failedUploadTextDisplay.mode,i=this._options.failedUploadTextDisplay.responseProperty,"custom"===n?(o=(o=t[i])||this._options.text.failUpload,this._templating.setStatusText(e,o),this._options.failedUploadTextDisplay.enableTooltip&&this._showTooltip(e,o)):"default"===n?this._templating.setStatusText(e,this._options.text.failUpload):"none"!==n&&this.log("failedUploadTextDisplay.mode value of '"+n+"' is not valid","warn")},_showTooltip:function(e,t){this._templating.getFileContainer(e).title=t},_showCancelLink:function(e){this._options.disableCancelForFormUploads&&!qq.supportedFeatures.ajaxUploading||this._templating.showCancel(e)},_itemError:function(e,t,n){var i=this._parent.prototype._itemError.apply(this,arguments);this._options.showMessage(i)},_batchError:function(e){this._parent.prototype._batchError.apply(this,arguments),this._options.showMessage(e)},_setupPastePrompt:function(){var n=this;this._options.callbacks.onPasteReceived=function(){var e=n._options.paste.namePromptMessage,t=n._options.paste.defaultName;return n._options.showPrompt(e,t)}},_fileOrBlobRejected:function(e,t){this._totalFilesInBatch-=1,this._parent.prototype._fileOrBlobRejected.apply(this,arguments)},_prepareItemsForUpload:function(e,t,n){this._totalFilesInBatch=e.length,this._filesInBatchAddedToUi=0,this._parent.prototype._prepareItemsForUpload.apply(this,arguments)},_maybeUpdateThumbnail:function(e){var t=this._thumbnailUrls[e];this.getUploads({id:e}).status===qq.status.DELETED||!t&&!this._options.thumbnails.placeholders.waitUntilResponse&&qq.supportedFeatures.imagePreviews||this._templating.updateThumbnail(e,t,this._options.thumbnails.customResizer)},_addCannedFile:function(e){var t=this._parent.prototype._addCannedFile.apply(this,arguments);return this._addToList(t,this.getName(t),!0),this._templating.hideSpinner(t),this._templating.hideCancel(t),this._markFileAsSuccessful(t),t},_setSize:function(e,t){this._parent.prototype._setSize.apply(this,arguments),this._templating.updateSize(e,this._formatSize(t))},_sessionRequestComplete:function(){this._templating.addCacheToDom(),this._parent.prototype._sessionRequestComplete.apply(this,arguments)}}}(),qq.FineUploader=function(e,t){"use strict";var n=this;this._parent=t?qq[t].FineUploaderBasic:qq.FineUploaderBasic,this._parent.apply(this,arguments),qq.extend(this._options,{element:null,button:null,listElement:null,dragAndDrop:{extraDropzones:[],reportDirectoryPaths:!1},text:{formatProgress:"{percent}% of {total_size}",failUpload:"Upload failed",waitingForResponse:"Processing...",paused:"Paused"},template:"qq-template",classes:{retrying:"qq-upload-retrying",retryable:"qq-upload-retryable",success:"qq-upload-success",fail:"qq-upload-fail",editable:"qq-editable",hide:"qq-hide",dropActive:"qq-upload-drop-area-active"},failedUploadTextDisplay:{mode:"default",responseProperty:"error",enableTooltip:!0},messages:{tooManyFilesError:"You may only drop one file",unsupportedBrowser:"Unrecoverable error - this browser does not permit file uploading of any kind."},retry:{showAutoRetryNote:!0,autoRetryNote:"Retrying {retryNum}/{maxAuto}..."},deleteFile:{forceConfirm:!1,confirmMessage:"Are you sure you want to delete {filename}?",deletingStatusText:"Deleting...",deletingFailedText:"Delete failed"},display:{fileSizeOnSubmit:!1,prependFiles:!1},paste:{promptForName:!1,namePromptMessage:"Please name this image"},thumbnails:{customResizer:null,maxCount:0,placeholders:{waitUntilResponse:!1,notAvailablePath:null,waitingPath:null},timeBetweenThumbs:750},scaling:{hideScaled:!1},showMessage:function(e){if(n._templating.hasDialog("alert"))return n._templating.showDialog("alert",e);setTimeout(function(){window.alert(e)},0)},showConfirm:function(e){return n._templating.hasDialog("confirm")?n._templating.showDialog("confirm",e):window.confirm(e)},showPrompt:function(e,t){return n._templating.hasDialog("prompt")?n._templating.showDialog("prompt",e,t):window.prompt(e,t)}},!0),qq.extend(this._options,e,!0),this._templating=new qq.Templating({log:qq.bind(this.log,this),templateIdOrEl:this._options.template,containerEl:this._options.element,fileContainerEl:this._options.listElement,button:this._options.button,imageGenerator:this._imageGenerator,classes:{hide:this._options.classes.hide,editable:this._options.classes.editable},limits:{maxThumbs:this._options.thumbnails.maxCount,timeBetweenThumbs:this._options.thumbnails.timeBetweenThumbs},placeholders:{waitUntilUpdate:this._options.thumbnails.placeholders.waitUntilResponse,thumbnailNotAvailable:this._options.thumbnails.placeholders.notAvailablePath,waitingForThumbnail:this._options.thumbnails.placeholders.waitingPath},text:this._options.text}),this._options.workarounds.ios8SafariUploads&&qq.ios800()&&qq.iosSafari()?this._templating.renderFailure(this._options.messages.unsupportedBrowserIos8Safari):!qq.supportedFeatures.uploading||this._options.cors.expected&&!qq.supportedFeatures.uploadCors?this._templating.renderFailure(this._options.messages.unsupportedBrowser):(this._wrapCallbacks(),this._templating.render(),this._classes=this._options.classes,!this._options.button&&this._templating.getButton()&&(this._defaultButtonId=this._createUploadButton({element:this._templating.getButton(),title:this._options.text.fileInputTitle}).getButtonId()),this._setupClickAndEditEventHandlers(),qq.DragAndDrop&&qq.supportedFeatures.fileDrop&&(this._dnd=this._setupDragAndDrop()),this._options.paste.targetElement&&this._options.paste.promptForName&&(qq.PasteSupport?this._setupPastePrompt():this.log("Paste support module not found.","error")),this._totalFilesInBatch=0,this._filesInBatchAddedToUi=0)},qq.extend(qq.FineUploader.prototype,qq.basePublicApi),qq.extend(qq.FineUploader.prototype,qq.basePrivateApi),qq.extend(qq.FineUploader.prototype,qq.uiPublicApi),qq.extend(qq.FineUploader.prototype,qq.uiPrivateApi),qq.Templating=function(e){"use strict";function l(t){var n=new qq.Promise;return G.then(function(e){W(e,t),t.src?n.success():(t.src=e.src,t.onload=function(){t.onload=null,$(t),n.success()})},function(){Q(t),n.success()}),n}function u(){if(N.length){O=!0;var e=N.shift();e.update?Y(e):J(e)}else O=!1}function n(e){return X(V(e),H.cancel)}function f(e){return X(V(e),H.continueButton)}function p(e){return X(x,H[e+"Dialog"])}function m(e){return X(V(e),H.deleteButton)}function t(){return X(x,H.dropProcessing)}function i(e){return X(V(e),H.editNameIcon)}function o(e){return X(V(e),H.file)}function q(e){return X(V(e),H.pause)}function g(e){return null==e?X(x,H.totalProgressBarContainer)||X(x,H.totalProgressBar):X(V(e),H.progressBarContainer)||X(V(e),H.progressBar)}function _(e){return X(V(e),H.retry)}function b(e){return X(V(e),H.size)}function a(e){return X(V(e),H.spinner)}function r(e,t){var n=g(e),i=null==e?H.totalProgressBar:H.progressBar;n&&!qq(n).hasClass(i)&&(n=qq(n).getFirstByClass(i)),n&&(qq(n).css({width:t+"%"}),n.setAttribute("aria-valuenow",t))}function v(e){return F&&X(V(e),H.thumbnail)}function d(e,t){var n=j[e]||(new qq.Promise).failure(),i=new qq.Promise;return M.then(function(e){n.then(function(){i.success()},function(){W(e,t),t.onload=function(){t.onload=null,i.success()},t.src=e.src,$(t)})}),i}var c,h,y,w,x,S,F,C,s,D,I,E="qq-file-id",P="qq-file-id-",k="qq-drop-area-text",T="qq-in-progress",U="qq-hidden-forever",R={content:document.createDocumentFragment(),map:{}},A=!1,B=0,O=!1,N=[],L=-1,z={log:null,limits:{maxThumbs:0,timeBetweenThumbs:750},templateIdOrEl:"qq-template",containerEl:null,fileContainerEl:null,button:null,imageGenerator:null,classes:{hide:"qq-hide",editable:"qq-editable"},placeholders:{waitUntilUpdate:!1,thumbnailNotAvailable:null,waitingForThumbnail:null},text:{paused:"Paused"}},H={button:"qq-upload-button-selector",alertDialog:"qq-alert-dialog-selector",dialogCancelButton:"qq-cancel-button-selector",confirmDialog:"qq-confirm-dialog-selector",dialogMessage:"qq-dialog-message-selector",dialogOkButton:"qq-ok-button-selector",promptDialog:"qq-prompt-dialog-selector",uploader:"qq-uploader-selector",drop:"qq-upload-drop-area-selector",list:"qq-upload-list-selector",progressBarContainer:"qq-progress-bar-container-selector",progressBar:"qq-progress-bar-selector",totalProgressBarContainer:"qq-total-progress-bar-container-selector",totalProgressBar:"qq-total-progress-bar-selector",file:"qq-upload-file-selector",spinner:"qq-upload-spinner-selector",size:"qq-upload-size-selector",cancel:"qq-upload-cancel-selector",pause:"qq-upload-pause-selector",continueButton:"qq-upload-continue-selector",deleteButton:"qq-upload-delete-selector",retry:"qq-upload-retry-selector",statusText:"qq-upload-status-text-selector",editFilenameInput:"qq-edit-filename-selector",editNameIcon:"qq-edit-filename-icon-selector",dropText:"qq-upload-drop-area-text-selector",dropProcessing:"qq-drop-processing-selector",dropProcessingSpinner:"qq-drop-processing-spinner-selector",thumbnail:"qq-thumbnail-selector"},j={},M=new qq.Promise,G=new qq.Promise,V=function(e){return R.map[e]||qq(S).getFirstByClass(P+e)},X=function(e,t){return e&&qq(e).getFirstByClass(t)},Q=function(e){e&&qq(e).addClass(z.classes.hide)},W=function(e,t){var n=e.style.maxWidth,i=e.style.maxHeight;i&&n&&!t.style.maxWidth&&!t.style.maxHeight&&qq(t).css({maxWidth:n,maxHeight:i})},J=function(e){var o=e.id,a=e.optFileOrBlob,r=a&&a.qqThumbnailId,t=v(o),s={customResizeFunction:e.customResizeFunction,maxSize:L,orient:!0,scale:!0};qq.supportedFeatures.imagePreviews?t?z.limits.maxThumbs&&z.limits.maxThumbs<=B?(d(o,t),u()):l(t).done(function(){var e,t,n,i;j[o]=new qq.Promise,j[o].done(function(){setTimeout(u,z.limits.timeBetweenThumbs)}),null!=r?Z(o,r):(t=a,n=s,i=v(e=o),c("Generating new thumbnail for "+e),t.qqThumbnailId=e,z.imageGenerator.generate(t,i,n).then(function(){B++,$(i),j[e].success()},function(){j[e].failure(),z.placeholders.waitUntilUpdate||d(e,i)}))}):u():t&&(l(t),u())},Y=function(e){var t=e.id,n=e.thumbnailUrl,i=e.showWaitingImg,o=v(t),a={customResizeFunction:e.customResizeFunction,scale:C,maxSize:L};if(o)if(n){if(!(z.limits.maxThumbs&&z.limits.maxThumbs<=B))return i&&l(o),z.imageGenerator.generate(n,o,a).then(function(){$(o),B++,setTimeout(u,z.limits.timeBetweenThumbs)},function(){d(t,o),setTimeout(u,z.limits.timeBetweenThumbs)});d(t,o),u()}else d(t,o),u()},$=function(e){e&&qq(e).removeClass(z.classes.hide)},Z=function(e,t){var n=v(e),i=v(t);c(qq.format("ID {} is the same file as ID {}.  Will use generated thumbnail from ID {} instead.",e,t,t)),j[t].then(function(){B++,j[e].success(),c(qq.format("Now using previously generated thumbnail created for ID {} on ID {}.",t,e)),n.src=i.src,$(n)},function(){j[e].failure(),z.placeholders.waitUntilUpdate||d(e,n)})};qq.extend(z,e),c=z.log,qq.supportedFeatures.imagePreviews||(z.limits.timeBetweenThumbs=0,z.limits.maxThumbs=0),x=z.containerEl,F=void 0!==z.imageGenerator,w=function(){var e,t,n,i,o,a,r,s,l,u,d;if(c("Parsing template"),null==z.templateIdOrEl)throw new Error("You MUST specify either a template element or ID!");if(qq.isString(z.templateIdOrEl)){if(null===(e=document.getElementById(z.templateIdOrEl)))throw new Error(qq.format("Cannot find template script at ID '{}'!",z.templateIdOrEl));t=e.innerHTML}else{if(void 0===z.templateIdOrEl.innerHTML)throw new Error("You have specified an invalid value for the template option!  It must be an ID or an Element.");t=z.templateIdOrEl.innerHTML}if(t=qq.trimStr(t),(i=document.createElement("div")).appendChild(qq.toElement(t)),d=qq(i).getFirstByClass(H.uploader),z.button&&(a=qq(i).getFirstByClass(H.button))&&qq(a).remove(),qq.DragAndDrop&&qq.supportedFeatures.fileDrop||(l=qq(i).getFirstByClass(H.dropProcessing))&&qq(l).remove(),(r=qq(i).getFirstByClass(H.drop))&&!qq.DragAndDrop&&(c("DnD module unavailable.","info"),qq(r).remove()),qq.supportedFeatures.fileDrop?qq(d).hasAttribute(k)&&r&&(u=qq(r).getFirstByClass(H.dropText))&&qq(u).remove():(d.removeAttribute(k),r&&qq(r).hasAttribute("qq-hide-dropzone")&&qq(r).css({display:"none"})),s=qq(i).getFirstByClass(H.thumbnail),F?s&&(L=0<(L=parseInt(s.getAttribute("qq-max-size")))?L:null,C=qq(s).hasAttribute("qq-server-scale")):s&&qq(s).remove(),F=F&&s,h=0<qq(i).getByClass(H.editFilenameInput).length,y=0<qq(i).getByClass(H.retry).length,null==(n=qq(i).getFirstByClass(H.list)))throw new Error("Could not find the file list container in the template!");return o=n.children[0].cloneNode(!0),n.innerHTML="",i.getElementsByTagName("DIALOG").length&&document.createElement("dialog"),c("Template parsing complete"),{template:i,fileTemplate:o}}(),s=z.placeholders.thumbnailNotAvailable,D=z.placeholders.waitingForThumbnail,I={maxSize:L,scale:C},F&&(s?z.imageGenerator.generate(s,new Image,I).then(function(e){M.success(e)},function(){M.failure(),c("Problem loading 'not available' placeholder image at "+s,"error")}):M.failure(),D?z.imageGenerator.generate(D,new Image,I).then(function(e){G.success(e)},function(){G.failure(),c("Problem loading 'waiting for thumbnail' placeholder image at "+D,"error")}):G.failure()),qq.extend(this,{render:function(){c("Rendering template in DOM."),B=0,x.appendChild(w.template.cloneNode(!0)),Q(t()),this.hideTotalProgress(),S=z.fileContainerEl||X(x,H.list),c("Template rendering complete")},renderFailure:function(e){var t=qq.toElement(e);x.innerHTML="",x.appendChild(t)},reset:function(){x.innerHTML="",this.render()},clearFiles:function(){S.innerHTML=""},disableCancel:function(){A=!0},addFile:function(e,t,n,i,o){var a,r,s,l,u,d=w.fileTemplate.cloneNode(!0),c=X(d,H.file),p=X(x,H.uploader),h=o?R.content:S;o&&(R.map[e]=d),qq(d).addClass(P+e),p.removeAttribute(k),c&&(qq(c).setText(t),c.setAttribute("title",t)),d.setAttribute(E,e),n?(r=d,s=n.index,u=(l=h).firstChild,0<s&&(u=qq(l).children()[s].nextSibling),l.insertBefore(r,u)):h.appendChild(d),i?(d.style.display="none",qq(d).addClass(U)):(Q(g(e)),Q(b(e)),Q(m(e)),Q(_(e)),Q(q(e)),Q(f(e)),A&&this.hideCancel(e),(a=v(e))&&!a.src&&G.then(function(e){a.src=e.src,e.style.maxHeight&&e.style.maxWidth&&qq(a).css({maxHeight:e.style.maxHeight,maxWidth:e.style.maxWidth}),$(a)}))},addFileToCache:function(e,t,n,i){this.addFile(e,t,n,i,!0)},addCacheToDom:function(){S.appendChild(R.content),R.content=document.createDocumentFragment(),R.map={}},removeFile:function(e){qq(V(e)).remove()},getFileId:function(e){var t=e;if(t){for(;null==t.getAttribute(E);)t=t.parentNode;return parseInt(t.getAttribute(E))}},getFileList:function(){return S},markFilenameEditable:function(e){var t=o(e);t&&qq(t).addClass(z.classes.editable)},updateFilename:function(e,t){var n=o(e);n&&(qq(n).setText(t),n.setAttribute("title",t))},hideFilename:function(e){Q(o(e))},showFilename:function(e){$(o(e))},isFileName:function(e){return qq(e).hasClass(H.file)},getButton:function(){return z.button||X(x,H.button)},hideDropProcessing:function(){Q(t())},showDropProcessing:function(){$(t())},getDropZone:function(){return X(x,H.drop)},isEditFilenamePossible:function(){return h},hideRetry:function(e){Q(_(e))},isRetryPossible:function(){return y},showRetry:function(e){$(_(e))},getFileContainer:function(e){return V(e)},showEditIcon:function(e){var t=i(e);t&&qq(t).addClass(z.classes.editable)},isHiddenForever:function(e){return qq(V(e)).hasClass(U)},hideEditIcon:function(e){var t=i(e);t&&qq(t).removeClass(z.classes.editable)},isEditIcon:function(e){return qq(e).hasClass(H.editNameIcon,!0)},getEditInput:function(e){return X(V(e),H.editFilenameInput)},isEditInput:function(e){return qq(e).hasClass(H.editFilenameInput,!0)},updateProgress:function(e,t,n){var i,o=g(e);o&&0<n&&(100===(i=Math.round(t/n*100))?Q(o):$(o),r(e,i))},updateTotalProgress:function(e,t){this.updateProgress(null,e,t)},hideProgress:function(e){var t=g(e);t&&Q(t)},hideTotalProgress:function(){this.hideProgress()},resetProgress:function(e){r(e,0),this.hideTotalProgress(e)},resetTotalProgress:function(){this.resetProgress()},showCancel:function(e){if(!A){var t=n(e);t&&qq(t).removeClass(z.classes.hide)}},hideCancel:function(e){Q(n(e))},isCancel:function(e){return qq(e).hasClass(H.cancel,!0)},allowPause:function(e){$(q(e)),Q(f(e))},uploadPaused:function(e){this.setStatusText(e,z.text.paused),this.allowContinueButton(e),Q(a(e))},hidePause:function(e){Q(q(e))},isPause:function(e){return qq(e).hasClass(H.pause,!0)},isContinueButton:function(e){return qq(e).hasClass(H.continueButton,!0)},allowContinueButton:function(e){$(f(e)),Q(q(e))},uploadContinued:function(e){this.setStatusText(e,""),this.allowPause(e),$(a(e))},showDeleteButton:function(e){$(m(e))},hideDeleteButton:function(e){Q(m(e))},isDeleteButton:function(e){return qq(e).hasClass(H.deleteButton,!0)},isRetry:function(e){return qq(e).hasClass(H.retry,!0)},updateSize:function(e,t){var n=b(e);n&&($(n),qq(n).setText(t))},setStatusText:function(e,t){var n=X(V(e),H.statusText);n&&(null==t?qq(n).clearText():qq(n).setText(t))},hideSpinner:function(e){qq(V(e)).removeClass(T),Q(a(e))},showSpinner:function(e){qq(V(e)).addClass(T),$(a(e))},generatePreview:function(e,t,n){this.isHiddenForever(e)||(N.push({id:e,customResizeFunction:n,optFileOrBlob:t}),O||u())},updateThumbnail:function(e,t,n,i){this.isHiddenForever(e)||(N.push({customResizeFunction:i,update:!0,id:e,thumbnailUrl:t,showWaitingImg:n}),O||u())},hasDialog:function(e){return qq.supportedFeatures.dialogElement&&!!p(e)},showDialog:function(e,t,n){function i(){s.removeEventListener("click",d),l&&l.removeEventListener("click",c),u.failure()}var o=p(e),a=X(o,H.dialogMessage),r=o.getElementsByTagName("INPUT")[0],s=X(o,H.dialogCancelButton),l=X(o,H.dialogOkButton),u=new qq.Promise,d=function(){s.removeEventListener("click",d),o.close()},c=function(){o.removeEventListener("close",i),l.removeEventListener("click",c),o.close(),u.success(r&&r.value)};return o.addEventListener("close",i),s.addEventListener("click",d),l&&l.addEventListener("click",c),r&&(r.value=n),a.textContent=t,o.showModal(),u}})},qq.UiEventHandler=function(e,t){"use strict";var n=new qq.DisposeSupport,i={eventType:"click",attachTo:null,onHandled:function(e,t){}};function o(e){n.attach(e,i.eventType,function(e){var t=(e=e||window.event).target||e.srcElement;i.onHandled(t,e)})}qq.extend(this,{addHandler:function(e){o(e)},dispose:function(){n.dispose()}}),qq.extend(t,{getFileIdFromItem:function(e){return e.qqFileId},getDisposeSupport:function(){return n}}),qq.extend(i,e),i.attachTo&&o(i.attachTo)},qq.FileButtonsClickHandler=function(e){"use strict";var r={templating:null,log:function(e,t){},onDeleteFile:function(e){},onCancel:function(e){},onRetry:function(e){},onPause:function(e){},onContinue:function(e){},onGetName:function(e){}},t={cancel:function(e){r.onCancel(e)},retry:function(e){r.onRetry(e)},deleteButton:function(e){r.onDeleteFile(e)},pause:function(e){r.onPause(e)},continueButton:function(e){r.onContinue(e)}};qq.extend(r,e),r.eventType="click",r.onHandled=function(o,a){qq.each(t,function(e,t){var n,i=e.charAt(0).toUpperCase()+e.slice(1);if(r.templating["is"+i](o))return n=r.templating.getFileId(o),qq.preventDefault(a),r.log(qq.format("Detected valid file button click event on file '{}', ID: {}.",r.onGetName(n),n)),t(n),!1})},r.attachTo=r.templating.getFileList(),qq.extend(this,new qq.UiEventHandler(r,{}))},qq.FilenameClickHandler=function(e){"use strict";var i={},o={templating:null,log:function(e,t){},classes:{file:"qq-upload-file",editNameIcon:"qq-edit-filename-icon"},onGetUploadStatus:function(e){},onGetName:function(e){}};qq.extend(o,e),o.eventType="click",o.onHandled=function(e,t){if(o.templating.isFileName(e)||o.templating.isEditIcon(e)){var n=o.templating.getFileId(e);o.onGetUploadStatus(n)===qq.status.SUBMITTED&&(o.log(qq.format("Detected valid filename click event on file '{}', ID: {}.",o.onGetName(n),n)),qq.preventDefault(t),i.handleFilenameEdit(n,e,!0))}},qq.extend(this,new qq.FilenameEditHandler(o,i))},qq.FilenameInputFocusInHandler=function(e,i){"use strict";var o={templating:null,onGetUploadStatus:function(e){},log:function(e,t){}};i=i||{},o.eventType="focusin",o.onHandled=function(e,t){if(o.templating.isEditInput(e)){var n=o.templating.getFileId(e);o.onGetUploadStatus(n)===qq.status.SUBMITTED&&(o.log(qq.format("Detected valid filename input focus event on file '{}', ID: {}.",o.onGetName(n),n)),i.handleFilenameEdit(n,e))}},qq.extend(o,e),qq.extend(this,new qq.FilenameEditHandler(o,i))},qq.FilenameInputFocusHandler=function(e){"use strict";e.eventType="focus",e.attachTo=null,qq.extend(this,new qq.FilenameInputFocusInHandler(e,{}))},qq.FilenameEditHandler=function(e,c){"use strict";var p={templating:null,log:function(e,t){},onGetUploadStatus:function(e){},onGetName:function(e){},onSetName:function(e,t){},onEditingStatusChange:function(e,t){}};function h(e,t){var n,i,o,a=e.value;void 0!==a&&0<qq.trimStr(a).length&&(void 0!==(i=t,o=p.onGetName(i),n=qq.getExtension(o))&&(a=a+"."+n),p.onSetName(t,a)),p.onEditingStatusChange(t,!1)}qq.extend(p,e),p.attachTo=p.templating.getFileList(),qq.extend(this,new qq.UiEventHandler(p,c)),qq.extend(c,{handleFilenameEdit:function(e,t,n){var i,o,a,r,s,l,u,d=p.templating.getEditInput(e);p.onEditingStatusChange(e,!0),d.value=(s=e,l=p.onGetName(s),0<(u=l.lastIndexOf("."))&&(l=l.substr(0,u)),l),n&&d.focus(),a=d,r=e,c.getDisposeSupport().attach(a,"blur",function(){h(a,r)}),i=d,o=e,c.getDisposeSupport().attach(i,"keyup",function(e){13===(e.keyCode||e.which)&&h(i,o)})}})}}(window),jQuery(document).ready(function(){if(window.dndb={},window.init_uploader=function init_uploader(config){if("draggable"in document.createElement("span"))var button_text=config.draggable_button_text,file_uploader_note_text=config.draggable_note_text;else var button_text=config.nondraggable_button_text,file_uploader_note_text=config.nondraggable_note_text;window.dndb[config.fieldset_prefix+"url"]=config.quickupload_url,window.dndb[config.fieldset_prefix+"root_and_path"]=config.root_and_path,jQuery("#fm_dirtree input[type=radio]").click(function(){window.dndb[config.fieldset_prefix+"url"]=config.quickupload_url+"&root_and_path="+this.value+"&"+config.crumb_file,window.dndb[config.fieldset_prefix+"root_and_path"]=this.value,window.dndb[config.fieldset_prefix+"uploader"].setParams({root_and_path:window.dndb[config.fieldset_prefix+"root_and_path"]})}),config.link_owner&&(window.dndb[config.fieldset_prefix+"url"]+="&link_owner="+config.link_owner),config.fm_mode&&"file_select"==config.fm_mode&&(window.dndb[config.fieldset_prefix+"url"]+="&fm_mode="+config.fm_mode),window.dndb[config.fieldset_prefix+"uploader"]=new qq.FineUploader({debug:!1,request:{endpoint:window.dndb[config.fieldset_prefix+"url"],params:{root_and_path:window.dndb[config.fieldset_prefix+"root_and_path"]}},template:document.getElementById(config.fieldset_prefix+"qq-template"),element:document.getElementById(config.fieldset_prefix+"file-uploader"),listElement:document.querySelector(config.list_element),dragAndDrop:{extraDropzones:eval(config.extra_dropzones)},list_style:config.list_style,action:window.dndb[config.fieldset_prefix+"url"],sizeLimit:config.size_limit,messages:{typeError:config.msg_type_error,sizeError:config.msg_size_error,minSizeError:config.msg_min_size_error,emptyError:config.msg_empty_error,onLeave:config.msg_on_leave},text:{formatProgress:config.msg_format_progress,sizeSymbols:[config.size_symbol_kb,config.size_symbol_mb,config.size_symbol_gb,config.size_symbol_tb,config.size_symbol_pb,config.size_symbol_eb]},validation:{sizeLimit:config.validation_size_limit,allowedExtensions:config.allowed_extensions},callbacks:{onSubmit:function(e,t,n){var i={root_and_path:window.dndb[config.fieldset_prefix+"root_and_path"]};jQuery(n).hasClass("link_attachment_dropzone")&&qq.extend(i,{link_position:"inline"}),this.setParams(i);var o=jQuery("#"+config.fieldset_prefix+config.table_id+" tr.noresults");o.length&&(""!=config.table_headers&&o.parent().parent().prepend(config.table_headers),o.remove()),setTimeout(function(){evo_link_fix_wrapper_height(config.fieldset_prefix),config.resize_frame&&(window.dndb.update_iframe_height(config.fieldset_prefix),jQuery(document).on("load","#"+config.fieldset_prefix+config.table_id+" img",function(){window.dndb.update_iframe_height(config.fieldset_prefix)}))},10)},onProgress:function(e,t,n,i){var o=jQuery("#"+config.fieldset_prefix+config.table_id+" tr[qq-file-id="+e+"] .progress-bar"),a=Math.round(n/i*100)+"%";o.get(0).style.width=a,o.text(a),config.resize_frame&&window.dndb.update_iframe_height(config.fieldset_prefix)},onDropzoneDragOver:function(e){jQuery(".qq-upload-button").addClass("qq-upload-button-dragover")},onDropzoneDragOut:function(e){jQuery(".qq-upload-button").removeClass("qq-upload-button-dragover")},onDropzoneDragDrop:function(e){jQuery(".qq-upload-button").removeClass("qq-upload-button-dragover")},onComplete:function(e,t,n,i,o){var a;if(null!=n&&(n.data.text&&(a=1==n.specialchars?htmlspecialchars_decode(n.data.text):n.data.text),a=base64_decode(a),"list"==config.list_style&&null!=n.data.status&&"rename"==n.data.status&&jQuery("#"+config.fieldset_prefix+config.table_id+" #saveBtn").show()),"table"==config.list_style){var r=jQuery("#"+config.fieldset_prefix+config.table_id+" tr[qq-file-id="+e+"]");if(null==n||null==n.data||"error"==n.data.status||"fatal"==n.data.status)r.find(".qq-upload-status").html('<span class="red">'+config.msg_upload_error+"</span>"),n.error?a=n.error:void 0!==a&&""!=a||(a=config.msg_dropped_connection),r.find(".qq-upload-file-selector").append(': <span class="text-danger result_error">'+a+"</span>"),r.find(".qq-upload-image-selector, td.size").prepend(config.warning_icon);else{var s=void 0!==n.data.link_ID?"link":"file",l=config.filename_before;""!=l&&(l=l.replace("$file_path$",n.data.path));var u="";n.data.select_link_button&&(u=n.data.select_link_button);var d="";""!=n.data.warning&&(d='<div class="orange">'+n.data.warning+"</div>");var c=void 0!==n.data.link_url?n.data.link_url:n.data.formatted_name;if(r.find(".qq-upload-checkbox").html(n.data.checkbox),"success"==n.data.status)config.display_status_success?r.find(".qq-upload-status-text-selector").html('<span class="green">'+config.msg_upload_ok+"</span>"):r.find(".qq-upload-status-text-selector").html(""),r.find(".qq-upload-image").html(a),r.find(".qq-upload-file-selector").html(l+u+'<input type="hidden" value="'+n.data.newpath+'" /><span class="fname">'+c+"</span>"+d),r.find(".qq-upload-size-selector").html(n.data.filesize),n.data.filetype&&r.find(".qq-upload-file-type").html(n.data.filetype),n.data.creator&&r.find(".qq-upload-file-creator").html(n.data.creator),null!=n.data.downloads&&r.find(".qq-upload-downloads").html(n.data.downloads),n.data.owner&&r.find(".fsowner").html(n.data.owner),n.data.group&&r.find(".fsgroup").html(n.data.group),n.data.file_date&&r.find(".fsdate").html(n.data.file_date),n.data.file_actions&&r.find(".actions").html(n.data.file_actions),jQuery("#evo_multi_file_selector").length&&jQuery("#evo_multi_file_selector").show();else if("rename"==n.data.status){var p='<span class="orange">'+config.msg_upload_confict+"</span>";"default"==config.status_conflict_place?r.find(".qq-upload-status-text-selector").html(p):r.find(".qq-upload-status-text-selector").html(""),r.find(".qq-upload-image").html(n.data.file),r.find(".qq-upload-image-selector").append(htmlspecialchars_decode(n.data.file)),r.find(".qq-upload-file-selector").html(l+u+'<input type="hidden" value="'+n.data.newpath+'" /><span class="fname">'+c+"</span>"+("before_button"==config.status_conflict_place?" - "+p:"")+' - <a href="#" class="'+config.button_class+' roundbutton_text_noicon qq-conflict-replace" old="'+n.data.old_rootrelpath+'" new="'+n.data.new_rootrelpath+'"><div>'+config.msg_replace_file+'</div><div style="display:none">'+config.msg_revert+"</div></a>"+d);var h=jQuery("#"+config.fieldset_prefix+config.table_id+' input[type=hidden][value="'+n.data.oldpath+'"]');0<h.length&&h.parent().append(' <span class="orange">'+config.msg_old_file+"</span>")}"link"==s&&(r.find(".qq-upload-link-id").html('<span data-order="'+n.data.link_order+'">'+n.data.link_ID+"</span>"),r.find(".qq-upload-image").html(n.data.link_preview),r.find(".qq-upload-link-actions").prepend(n.data.link_actions),void 0!==n.data.link_position&&r.find(".qq-upload-link-position").html(n.data.link_position)),init_colorbox(r.find('.qq-upload-image a[rel^="lightbox"]')),evo_link_sort_list(config.fieldset_prefix)}}else jQuery(window.dndb[config.fieldset_prefix+"uploader"].getItemByFileId(e)).append(a),null==n.data&&""!=n&&jQuery(window.dndb[config.fieldset_prefix+"uploader"].getItemByFileId(e)).append(n);if(config.resize_frame&&(window.dndb.update_iframe_height(config.fieldset_prefix),jQuery(document).on("load","#"+config.fieldset_prefix+config.table_id+" img",function(){window.dndb.update_iframe_height(config.fieldset_preifx)})),jQuery(o).hasClass("link_attachment_dropzone"))switch(n.data.filetype){case"image":case"video":case"audio":textarea_wrap_selection(o,"["+n.data.filetype+":"+n.data.link_ID+"]","",0)}},onCancel:function(e,t){"table"==config.list_style&&setTimeout(function(){var e=jQuery("#"+config.fieldset_prefix+config.table_id+" .filelist_tbody");if(!e.find("tr").length){var t=config.no_results;e.append(t)}},10)}}}),jQuery("div.qq-upload-button-selector > div, div.qq-upload-drop-area > div").html(button_text),config.resize_frame&&(window.dndb.update_iframe_height=function(e){var t=jQuery("#"+e+config.table_id).height();jQuery("#"+e+"attachments_fieldset_wrapper").css({height:t,"max-height":t})}),"table"==config.list_style&&jQuery(document).on("click","#"+config.fieldset_prefix+config.table_id+" .qq-conflict-replace",function(){var s=jQuery(this),l=s.children("div:first").is(":visible"),e=s.attr("old"),u=jQuery("#"+config.fieldset_prefix+config.table_id+' input[type=hidden][value="'+e+'"]'),d=0<u.length;s.hide();var c=s.parent().parent().children("td");return d&&(c=c.add(u.parent().parent().children("td"))),c.css("background","#FFFF00"),c.find("span.error").remove(),jQuery.ajax({type:"POST",url:htsrv_url+"async.php",data:{action:"conflict_files",fileroot_ID:config.fileroot_ID,path:config.path,oldfile:e.replace(/^(.+[\/:])?([^\/]+)$/,"$2"),newfile:s.attr("new").replace(/^(.+[\/:])?([^\/]+)$/,"$2"),format:config.conflict_file_format,crumb_conflictfiles:config.crumb_conflictfiles},success:function(e){var t=jQuery.parseJSON(e);if(void 0===t.error){s.show();var n=s.parent().find("span.fname");if(l?(s.children("div:first").hide(),s.children("div:last").show()):(s.children("div:first").show(),s.children("div:last").hide()),d){var i=u.parent().find("span.fname"),o=i.html();i.html(n.html()),n.html(o);var a=i.prev();if(0!=a.length&&"A"==a.get(0).tagName||(a=i.parent().prev()),0<a.length&&"A"==a.get(0).tagName){var r=a.attr("href");a.attr("href",n.prev().attr("href")),n.prev().attr("href",r)}}else n.html(l?t.old:t.new)}else s.show(),s.parent().append('<span class="error"> - '+t.error+"</span>");c.css("background","")}}),!1}),config.display_support_msg&&document.write('<p class="note">'+file_uploader_note_text+"</p>")},"undefined"!=typeof evo_init_dragdrop_button_config)for(var evo_init_dragdrop_button_config_keys=Object.keys(evo_init_dragdrop_button_config),i=0;i<evo_init_dragdrop_button_config_keys.length;i++)window.init_uploader(evo_init_dragdrop_button_config[evo_init_dragdrop_button_config_keys[i]])}),jQuery(document).ready(function(){if("undefined"!=typeof evo_link_initialize_fieldset_config)for(var e=Object.values(evo_link_initialize_fieldset_config),t=0;t<e.length;t++)window.evo_link_initialize_fieldset(e[t].fieldset_prefix)}),function(l,e,o,r){function s(e,t){return Math.max(0,e[0]-t[0],t[0]-e[1])+Math.max(0,e[2]-t[1],t[1]-e[3])}function t(e,t,n,i){var o=e.length;for(i=i?"offset":"position",n=n||0;o--;){var a=e[o].el?e[o].el:l(e[o]),r=a[i]();r.left+=parseInt(a.css("margin-left"),10),r.top+=parseInt(a.css("margin-top"),10),t[o]=[r.left-n,r.left+a.outerWidth()+n,r.top-n,r.top+a.outerHeight()+n]}}function u(e,t){var n=t.offset();return{left:e.left-n.left,top:e.top-n.top}}function d(e,t,n){t=[t.left,t.top],n=n&&[n.left,n.top];for(var i,o=e.length,a=[];o--;)i=e[o],a[o]=[o,s(i,t),n&&s(i,n)];return a.sort(function(e,t){return t[1]-e[1]||t[2]-e[2]||t[0]-e[0]})}function i(e){this.options=l.extend({},p,e),this.containers=[],this.options.rootGroup||(this.scrollProxy=l.proxy(this.scroll,this),this.dragProxy=l.proxy(this.drag,this),this.dropProxy=l.proxy(this.drop,this),this.placeholder=l(this.options.placeholder),e.isValidTarget||(this.options.isValidTarget=r))}function a(e,t){this.el=e,this.options=l.extend({},c,t),this.group=i.get(this.options),this.rootGroup=this.options.rootGroup||this.group,this.handle=this.rootGroup.options.handle||this.rootGroup.options.itemSelector;var n=this.rootGroup.options.itemPath;this.target=n?this.el.find(n):this.el,this.target.on(m.start,this.handle,l.proxy(this.dragInit,this)),this.options.drop&&this.group.containers.push(this)}var c={drag:!0,drop:!0,exclude:"",nested:!0,vertical:!0},p={afterMove:function(e,t,n){},containerPath:"",containerSelector:"ol, ul",distance:0,delay:0,handle:"",itemPath:"",itemSelector:"li",bodyClass:"dragging",draggedClass:"dragged",isValidTarget:function(e,t){return!0},onCancel:function(e,t,n,i){},onDrag:function(e,t,n,i){e.css(t)},onDragStart:function(e,t,n,i){e.css({height:e.outerHeight(),width:e.outerWidth()}),e.addClass(t.group.options.draggedClass),l("body").addClass(t.group.options.bodyClass)},onDrop:function(e,t,n,i){e.removeClass(t.group.options.draggedClass).removeAttr("style"),l("body").removeClass(t.group.options.bodyClass)},onMousedown:function(e,t,n){if(!n.target.nodeName.match(/^(input|select|textarea)$/i))return n.preventDefault(),!0},placeholderClass:"placeholder",placeholder:'<li class="placeholder"></li>',pullPlaceholder:!0,serialize:function(e,t,n){return e=l.extend({},e.data()),n?[t]:(t[0]&&(e.children=t),delete e.subContainers,delete e.sortable,e)},tolerance:0},n={},h=0,f={left:0,top:0,bottom:0,right:0},m={start:"touchstart.sortable mousedown.sortable",drop:"touchend.sortable touchcancel.sortable mouseup.sortable",drag:"touchmove.sortable mousemove.sortable",scroll:"scroll.sortable"};i.get=function(e){return n[e.group]||(e.group===r&&(e.group=h++),n[e.group]=new i(e)),n[e.group]},i.prototype={dragInit:function(e,t){this.$document=l(t.el[0].ownerDocument);var n=l(e.target).closest(this.options.itemSelector);n.length&&(this.item=n,this.itemContainer=t,!this.item.is(this.options.exclude)&&this.options.onMousedown(this.item,p.onMousedown,e)&&(this.setPointer(e),this.toggleListeners("on"),this.setupDelayTimer(),this.dragInitDone=!0))},drag:function(e){if(!this.dragging){if(!this.distanceMet(e)||!this.delayMet)return;this.options.onDragStart(this.item,this.itemContainer,p.onDragStart,e),this.item.before(this.placeholder),this.dragging=!0}this.setPointer(e),this.options.onDrag(this.item,u(this.pointer,this.item.offsetParent()),p.onDrag,e),e=this.getPointer(e);var t=this.sameResultBox,n=this.options.tolerance;(!t||t.top-n>e.top||t.bottom+n<e.top||t.left-n>e.left||t.right+n<e.left)&&!this.searchValidTarget()&&(this.placeholder.detach(),this.lastAppendedItem=r)},drop:function(e){this.toggleListeners("off"),this.dragInitDone=!1,this.dragging&&(this.placeholder.closest("html")[0]?this.placeholder.before(this.item).detach():this.options.onCancel(this.item,this.itemContainer,p.onCancel,e),this.options.onDrop(this.item,this.getContainer(this.item),p.onDrop,e),this.clearDimensions(),this.clearOffsetParent(),this.lastAppendedItem=this.sameResultBox=r,this.dragging=!1)},searchValidTarget:function(e,t){e||(e=this.relativePointer||this.pointer,t=this.lastRelativePointer||this.lastPointer);for(var n=d(this.getContainerDimensions(),e,t),i=n.length;i--;){var o=n[i][0];if((!n[i][1]||this.options.pullPlaceholder)&&!(o=this.containers[o]).disabled){if(!this.$getOffsetParent()){var a=o.getItemOffsetParent();e=u(e,a),t=u(t,a)}if(o.searchValidTarget(e,t))return!0}}this.sameResultBox&&(this.sameResultBox=r)},movePlaceholder:function(e,t,n,i){var o=this.lastAppendedItem;!i&&o&&o[0]===t[0]||(t[n](this.placeholder),this.lastAppendedItem=t,this.sameResultBox=i,this.options.afterMove(this.placeholder,e,t))},getContainerDimensions:function(){return this.containerDimensions||t(this.containers,this.containerDimensions=[],this.options.tolerance,!this.$getOffsetParent()),this.containerDimensions},getContainer:function(e){return e.closest(this.options.containerSelector).data(o)},$getOffsetParent:function(){if(this.offsetParent===r){var e=this.containers.length-1,t=this.containers[e].getItemOffsetParent();if(!this.options.rootGroup)for(;e--;)if(t[0]!=this.containers[e].getItemOffsetParent()[0]){t=!1;break}this.offsetParent=t}return this.offsetParent},setPointer:function(e){if(e=this.getPointer(e),this.$getOffsetParent()){var t=u(e,this.$getOffsetParent());this.lastRelativePointer=this.relativePointer,this.relativePointer=t}this.lastPointer=this.pointer,this.pointer=e},distanceMet:function(e){return e=this.getPointer(e),Math.max(Math.abs(this.pointer.left-e.left),Math.abs(this.pointer.top-e.top))>=this.options.distance},getPointer:function(e){var t=e.originalEvent||e.originalEvent.touches&&e.originalEvent.touches[0];return{left:e.pageX||t.pageX,top:e.pageY||t.pageY}},setupDelayTimer:function(){var e=this;this.delayMet=!this.options.delay,this.delayMet||(clearTimeout(this._mouseDelayTimer),this._mouseDelayTimer=setTimeout(function(){e.delayMet=!0},this.options.delay))},scroll:function(e){this.clearDimensions(),this.clearOffsetParent()},toggleListeners:function(n){var i=this;l.each(["drag","drop","scroll"],function(e,t){i.$document[n](m[t],i[t+"Proxy"])})},clearOffsetParent:function(){this.offsetParent=r},clearDimensions:function(){this.traverse(function(e){e._clearDimensions()})},traverse:function(e){e(this);for(var t=this.containers.length;t--;)this.containers[t].traverse(e)},_clearDimensions:function(){this.containerDimensions=r},_destroy:function(){n[this.options.group]=r}},a.prototype={dragInit:function(e){var t=this.rootGroup;!this.disabled&&!t.dragInitDone&&this.options.drag&&this.isValidDrag(e)&&t.dragInit(e,this)},isValidDrag:function(e){return 1==e.which||"touchstart"==e.type&&1==e.originalEvent.touches.length},searchValidTarget:function(e,t){var n=d(this.getItemDimensions(),e,t),i=n.length,o=this.rootGroup,a=!o.options.isValidTarget||o.options.isValidTarget(o.item,this);if(!i&&a)return o.movePlaceholder(this,this.target,"append"),!0;for(;i--;)if(o=n[i][0],!n[i][1]&&this.hasChildGroup(o)){if(this.getContainerGroup(o).searchValidTarget(e,t))return!0}else if(a)return this.movePlaceholder(o,e),!0},movePlaceholder:function(e,t){var n=l(this.items[e]),i=this.itemDimensions[e],o="after",a=n.outerWidth(),r=n.outerHeight(),s={left:(s=n.offset()).left,right:s.left+a,top:s.top,bottom:s.top+r};this.options.vertical?t.top<=(i[2]+i[3])/2?(o="before",s.bottom-=r/2):s.top+=r/2:t.left<=(i[0]+i[1])/2?(o="before",s.right-=a/2):s.left+=a/2,this.hasChildGroup(e)&&(s=f),this.rootGroup.movePlaceholder(this,n,o,s)},getItemDimensions:function(){return this.itemDimensions||(this.items=this.$getChildren(this.el,"item").filter(":not(."+this.group.options.placeholderClass+", ."+this.group.options.draggedClass+")").get(),t(this.items,this.itemDimensions=[],this.options.tolerance)),this.itemDimensions},getItemOffsetParent:function(){var e=this.el;return"relative"===e.css("position")||"absolute"===e.css("position")||"fixed"===e.css("position")?e:e.offsetParent()},hasChildGroup:function(e){return this.options.nested&&this.getContainerGroup(e)},getContainerGroup:function(e){if((n=l.data(this.items[e],"subContainers"))===r){var t=this.$getChildren(this.items[e],"container"),n=!1;t[0]&&(n=l.extend({},this.options,{rootGroup:this.rootGroup,group:h++}),n=t[o](n).data(o).group),l.data(this.items[e],"subContainers",n)}return n},$getChildren:function(e,t){var n=(i=this.rootGroup.options)[t+"Path"],i=i[t+"Selector"];return e=l(e),n&&(e=e.find(n)),e.children(i)},_serialize:function(e,t){var n=this,i=this.$getChildren(e,t?"item":"container").not(this.options.exclude).map(function(){return n._serialize(l(this),!t)}).get();return this.rootGroup.options.serialize(e,i,t)},traverse:function(t){l.each(this.items||[],function(e){(e=l.data(this,"subContainers"))&&e.traverse(t)}),t(this)},_clearDimensions:function(){this.itemDimensions=r},_destroy:function(){var t=this;this.target.off(m.start,this.handle),this.el.removeData(o),this.options.drop&&(this.group.containers=l.grep(this.group.containers,function(e){return e!=t})),l.each(this.items||[],function(){l.removeData(this,"subContainers")})}};var q={enable:function(){this.traverse(function(e){e.disabled=!1})},disable:function(){this.traverse(function(e){e.disabled=!0})},serialize:function(){return this._serialize(this.el,!0)},refresh:function(){this.traverse(function(e){e._clearDimensions()})},destroy:function(){this.traverse(function(e){e._destroy()})}};l.extend(a.prototype,q),l.fn[o]=function(n){var i=Array.prototype.slice.call(arguments,1);return this.map(function(){var e=l(this),t=e.data(o);return t&&q[n]?q[n].apply(t,i)||this:(t||n!==r&&"object"!=typeof n||e.data(o,new a(e,n)),this)})}}(jQuery,window,"sortable"),window.init_link_sortable=function(o){jQuery("#"+o.fieldset_prefix+"attachments_fieldset_table table").sortable({containerSelector:"table",itemPath:"> tbody",itemSelector:"tr",placeholder:jQuery.parseHTML('<tr class="placeholder"><td colspan="5"></td></tr>'),onMousedown:function(e,t,n){if(!n.target.nodeName.match(/^(a|img|select|span)$/i))return n.preventDefault(),!0},onDrop:function(t,e,n){jQuery("#"+o.fieldset_prefix+"attachments_fieldset_table table tr").removeClass("odd even"),jQuery("#"+o.fieldset_prefix+"attachments_fieldset_table table tr:odd").addClass("even"),jQuery("#"+o.fieldset_prefix+"attachments_fieldset_table table tr:even").addClass("odd");var i="";jQuery("#"+o.fieldset_prefix+"attachments_fieldset_table table tr").each(function(){var e=jQuery(this).find(".link_id_cell > span[data-order]");0<e.length&&(i+=e.html()+",")}),i=i.slice(0,-1),jQuery.ajax({url:htsrv_url+"anon_async.php",type:"POST",data:{action:"update_links_order",links:i,crumb_link:o.crumb_link},success:function(e){link_data=JSON.parse(ajax_debug_clear(e)),jQuery("#"+o.fieldset_prefix+"attachments_fieldset_table table tr").each(function(){var e=jQuery(this).find(".link_id_cell > span[data-order]");0<e.length&&e.attr("data-order",link_data[e.html()])}),evoFadeSuccess(t)}}),t.removeClass(e.group.options.draggedClass).removeAttr("style")}})},jQuery(document).ready(function(){if("undefined"!=typeof evo_link_sortable_js_config)for(var e=Object.keys(evo_link_sortable_js_config),t=0;t<e.length;t++)init_link_sortable(evo_link_sortable_js_config[e[t]])});