text: var EG;!function(global){!function(l){"use strict";function s(e){var t,n,i,o,s,r=d(e||{}),a=(t=r,n=c("uploaderType"),i=c("endpointType"),n?(n=n.charAt(0).toUpperCase()+n.slice(1).toLowerCase(),i?new qq[i]["FineUploader"+n](t):new qq["FineUploader"+n](t)):i?new qq[i].FineUploader(t):new qq.FineUploader(t));return u(a),o=a,s=r.callbacks={},l.each(o._options.callbacks,function(e,o){var r,a;r=(r=/^on(\w+)/.exec(e)[1]).substring(0,1).toLowerCase()+r.substring(1),a=f,s[e]=function(){var e,t,n=Array.prototype.slice.call(arguments),i=[];l.each(n,function(e,t){i.push(p(t))}),e=o.apply(this,n);try{t=a.triggerHandler(r,i)}catch(e){qq.log("Caught error in Fine Uploader jQuery event handler: "+e.message,"error")}return null!=e?e:t}}),o._options.callbacks=s,f}function n(e,t){var n=f.data("fineuploader");if(!t)return void 0===n?null:n[e];void 0===n&&(n={}),n[e]=t,f.data("fineuploader",n)}function u(e){return n("uploader",e)}function c(e,t){return n(e,t)}function d(e,t){var n,i;if(n=void 0===t?"basic"!==e.uploaderType?{element:f[0]}:{}:t,l.each(e,function(e,t){0<=l.inArray(e,o)?c(e,t):t instanceof l?n[e]=t[0]:l.isPlainObject(t)?(n[e]={},d(t,n[e])):l.isArray(t)?(i=[],l.each(t,function(e,t){var n={};t instanceof l?l.merge(i,t):l.isPlainObject(t)?(d(t,n),i.push(n)):i.push(t)}),n[e]=i):n[e]=t}),void 0===t)return n}function p(e){var t=e;return null==e||"object"!=typeof e||1!==e.nodeType&&9!==e.nodeType||!e.cloneNode||(t=l(e)),t}var f,o=["uploaderType","endpointType"];l.fn.fineUploader=function(i){var o=this,r=arguments,a=[];return this.each(function(e,t){if(f=l(t),u()&&(n=i,"string"===l.type(n)&&!n.match(/^_/)&&void 0!==u()[n])){if(a.push(function(e){var t=[];return d(Array.prototype.slice.call(arguments,1),t),p(u()[e].apply(u(),t))}.apply(o,r)),1===o.length)return!1}else"object"!=typeof i&&i?l.error("Method "+i+" does not exist on jQuery.fineUploader"):s.apply(o,r);var n}),1===a.length?a[0]:1<a.length?a:this}}(jQuery),function(s){"use strict";function l(e){e||(e={}),e.dropZoneElements=[d];var o,t=c(e);return o=t.callbacks={},s.each(new qq.DragAndDrop.callbacks,function(e,t){var n,i=e;n=d,o[e]=function(){var e=Array.prototype.slice.call(arguments);return n.triggerHandler(i,e)}}),u(new qq.DragAndDrop(t)),d}function u(e){return function(e,t){var n=d.data("fineUploaderDnd");if(!t)return void 0===n?null:n[e];void 0===n&&(n={}),n[e]=t,d.data("fineUploaderDnd",n)}("dndInstance",e)}function c(e,t){var n,i;if(n=void 0===t?{}:t,s.each(e,function(e,t){t instanceof s?n[e]=t[0]:s.isPlainObject(t)?(n[e]={},c(t,n[e])):s.isArray(t)?(i=[],s.each(t,function(e,t){t instanceof s?s.merge(i,t):i.push(t)}),n[e]=i):n[e]=t}),void 0===t)return n}var d;s.fn.fineUploaderDnd=function(i){var o=this,r=arguments,a=[];return this.each(function(e,t){if(d=s(t),u()&&(n=i,"string"===s.type(n)&&"dispose"===n&&void 0!==u()[n])){if(a.push(function(e){var t=[];return c(Array.prototype.slice.call(arguments,1),t),u()[e].apply(u(),t)}.apply(o,r)),1===o.length)return!1}else"object"!=typeof i&&i?s.error("Method "+i+" does not exist in Fine Uploader's DnD module."):l.apply(o,r);var n}),1===a.length?a[0]:1<a.length?a:this}}(jQuery);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)}}},qF;!function(){"use strict";var Pc;qq.canvasToBlob=function(e,t,n){return qq.dataUriToBlob(e.toDataURL(t,n))},qq.dataUriToBlob=function(e){var t,n,i,o,r,a,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)}),r=t,a=o,s=window.BlobBuilder||window.WebKitBlobBuilder||window.MozBlobBuilder||window.MSBlobBuilder,(l=s&&new s)?(l.append(r),l.getBlob(a)):new Blob([r],{type:a})},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),n=e,i=n.indexOf("{}");return qq.each(t,function(e,t){if(n=n.substring(0,i)+t+n.substring(i+2),(i=n.indexOf("{}",i+t.length))<0)return!1}),n},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){var t=function(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,r=new qq.Promise;return o.onload=function(){r.success(qq.arrayBufferToHex(o.result))},o.onerror=r.failure,o.readAsArrayBuffer(i),r},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=(Pc=document.createElement("div"),function(e){Pc.innerHTML=e;var t=Pc.firstChild;return Pc.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){var o=[],n="&",r=function(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))};return!t&&i?(n=/\?/.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){r(t,e)}):null!=e&&"object"==typeof e?qq.each(e,function(e,t){r(t,e)}):o.push(encodeURIComponent(i)+"="+encodeURIComponent(e)),i?o.join(n):o.join(n).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.15.4",qq.supportedFeatures=function(){"use strict";function e(){return!!window.XMLHttpRequest&&void 0!==qq.createXhrInstance().withCredentials}function t(){return void 0!==window.XDomainRequest}var n,i,o,r,a,s,l,u,c,d,p,f,h,m,q,g;return n=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}(),i=(r=n&&qq.isXhrUploadSupported())&&!qq.androidStock(),a=(o=r&&(("draggable"in(g=document.createElement("span"))||"ondragstart"in g&&"ondrop"in g)&&!qq.android()&&!qq.ios()))&&(qq.chrome()||qq.opera())&&void 0!==navigator.userAgent.match(/Chrome\/[2][1-9]|Chrome\/[3-9][0-9]/),s=r&&qq.isFileChunkingSupported(),l=r&&s&&function(){try{return!!window.localStorage&&qq.isFunction(window.localStorage.setItem)}catch(e){return!1}}(),u=r&&(qq.chrome()||qq.opera())&&void 0!==navigator.userAgent.match(/Chrome\/[1][4-9]|Chrome\/[2-9][0-9]/),c=n&&(void 0!==window.postMessage||r),p=e(),d=t(),f=!!e()||t(),h=void 0!==document.createElement("input").webkitdirectory,m=r&&void 0!==window.FileReader,q=!!r&&!qq.androidStock()&&!qq.iosChrome(),{ajaxUploading:r,blobUploading:i,canDetermineSize:r,chunking:s,deleteFileCors:f,deleteFileCorsXdr:d,deleteFileCorsXhr:p,dialogElement:!!window.HTMLDialogElement,fileDrop:o,folderDrop:a,folderSelection:h,imagePreviews:m,imageValidation:m,itemSizeValidation:r,pause:s,progressBar:q,resume:l,scaling:m&&i,tiffPreviews:qq.safari(),unlimitedScaledImageSize:!qq.ios(),uploading:n,uploadCors:c,uploadCustomHeaders:r,uploadNonMultipart:r,uploadViaPaste:u}}(),qq.isGenericPromise=function(e){"use strict";return!!(e&&e.then&&qq.isFunction(e.then))},qq.Promise=function(){"use strict";var n,i,o=[],r=[],t=[],a=0;qq.extend(this,{then:function(e,t){return 0===a?(e&&o.push(e),t&&r.push(t)):-1===a?t&&t.apply(null,i):e&&e.apply(null,n),this},done:function(e){return 0===a?t.push(e):e.apply(null,void 0===i?n:i),this},success:function(){return a=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 a=-1,i=arguments,r.length&&qq.each(r,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";function t(){var e=document.createElement("input");return e.setAttribute(qq.UploadButton.BUTTON_ID_ATTR_NAME,i),e.setAttribute("title",a.title),o.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),r.attach(e,"change",function(){a.onChange(e)}),r.attach(e,"mouseover",function(){qq(a.element).addClass(a.hoverClass)}),r.attach(e,"mouseout",function(){qq(a.element).removeClass(a.hoverClass)}),r.attach(e,"focus",function(){qq(a.element).addClass(a.focusClass)}),r.attach(e,"blur",function(){qq(a.element).removeClass(a.focusClass)}),e}var n,i,o=this,r=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};qq.extend(a,e),i=qq.getUniqueId(),qq(a.element).css({position:"relative",overflow:"hidden",direction:"ltr"}),qq.extend(this,{getInput:function(){return n},getButtonId:function(){return i},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&&n.setAttribute("accept",e)},reset:function(){n.parentNode&&qq(n).remove(),qq(a.element).removeClass(a.focusClass),n=null,n=t()}}),n=t()},qq.UploadButton.BUTTON_ID_ATTR_NAME="qq-button-id",qq.UploadData=function(o){"use strict";var r=[],a={},s={},i={},l={};qq.extend(this,{addFile:function(e){var t=e.status||qq.status.SUBMITTING,n=r.push({name:e.name,originalName:e.name,uuid:e.uuid,size:null==e.size?-1:e.size,status:t})-1;return e.batchId&&(r[n].batchId=e.batchId,void 0===l[e.batchId]&&(l[e.batchId]=[]),l[e.batchId].push(n)),e.proxyGroupId&&(r[n].proxyGroupId=e.proxyGroupId,void 0===i[e.proxyGroupId]&&(i[e.proxyGroupId]=[]),i[e.proxyGroupId].push(n)),r[n].id=n,a[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)&&r.length?void 0!==e.id?function(e){if(qq.isArray(e)){var n=[];return qq.each(e,function(e,t){n.push(r[t])}),n}return r[e]}(e.id):void 0!==e.uuid?function(e){if(qq.isArray(e)){var n=[];return qq.each(e,function(e,t){n.push(r[a[t]])}),n}return r[a[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(r[t])})}),i):void 0:qq.extend([],r,!0);var t,i,n},reset:function(){r=[],a={},s={},l={}},setStatus:function(e,t){var n=r[e].status,i=qq.indexOf(s[n],e);s[n].splice(i,1),r[e].status=t,void 0===s[t]&&(s[t]=[]),s[t].push(e),o.onStatusChange(e,n,t)},uuidChanged:function(e,t){var n=r[e].uuid;r[e].uuid=t,a[t]=e,delete a[n]},updateName:function(e,t){r[e].name=t},updateSize:function(e,t){r[e].size=t},setParentId:function(e,t){r[e].parentId=t},getIdsInProxyGroup:function(e){var t=r[e].proxyGroupId;return t?i[t]:[]},getIdsInBatch:function(e){return l[r[e].batchId]}})},qq.status={SUBMITTING:"submitting",SUBMITTED:"submitted",REJECTED:"rejected",QUEUED:"queued",CANCELED:"canceled",PAUSED:"paused",UPLOADING:"uploading",UPLOAD_RETRYING:"retrying upload",UPLOAD_SUCCESSFUL:"upload successful",UPLOAD_FAILED:"upload failed",DELETE_FAILED:"delete failed",DELETING:"deleting",DELETED:"deleted"},function(){"use strict";qq.basePublicApi={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,c)},this),r=qq.bind(function(e){this._handleNewFile(e,i,c)},this),a=qq.bind(function(e){var t=qq.canvasToBlob(e);this._handleNewFile({blob:t,name:this._options.blobs.defaultName+".png"},i,c)},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,c)},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,c)})}else this._handleNewFile(e,i,c)},this),u=this,c=[];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?r(t):t.canvas&&t.name&&s(t):t.tagName&&"canvas"===t.tagName.toLowerCase()?a(t):u.log(t+" is not a valid file container!  Ignoring!","warn")}),this.log("Received "+c.length+" files."),this._prepareItemsForUpload(c,t,n))},cancel:function(e){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 r,a,s=new qq.Promise;return this._imageGenerator?(r=this._thumbnailUrls[e],a={customResizeFunction:o,maxSize:0<n?n:null,scale:0<n},!i&&qq.supportedFeatures.imagePreviews&&(r=this.getFile(e)),null==r?s.failure({container:t,error:"File or URL not found."}):this._imageGenerator.generate(r,t,a).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){return this._handler.getFile(e)||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},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)},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()},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)},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){var n={},i=e,o={},r=t,a=function(e){return qq.isObject(e)?qq.extend({},e):e},s=function(e,t){r&&qq.isObject(t)&&qq.extend(t,qq.isFunction(r)?r():r),o[e]&&qq.extend(t,o[e])};return{set:function(e,t){null==t?(n={},i=a(e)):n[t]=a(e)},get:function(e){var t;return t=null!=e&&n[e]?n[e]:a(i),s(e,t),a(t)},addReadOnly:function(e,t){qq.isObject(n)&&(null===e?qq.isFunction(t)?r=t:(r=r||{},qq.extend(r,t)):(o[e]=o[e]||{},qq.extend(o[e],t)))},remove:function(e){return delete n[e]},reset:function(){n={},o={},i=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 a=this,s={},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(a.log,a),preventRetryParam:this._options.retry.preventRetryResponseProperty,onProgress:function(e,t,n,i){n<0||i<0||(s[e]&&s[e].loaded===n&&s[e].total===i||(a._onProgress(e,t,n,i),a._options.callbacks.onProgress(e,t,n,i)),s[e]={loaded:n,total:i})},onComplete:function(e,t,n,i){delete s[e];var o,r=a.getUploads({id:e}).status;r!==qq.status.UPLOAD_SUCCESSFUL&&r!==qq.status.UPLOAD_FAILED&&((o=a._onComplete(e,t,n,i))instanceof qq.Promise?o.done(function(){a._options.callbacks.onComplete(e,t,n,i)}):a._options.callbacks.onComplete(e,t,n,i))},onCancel:function(e,t,n){var i=new qq.Promise;return a._handleCheckedCallback({name:"onCancel",callback:qq.bind(a._options.callbacks.onCancel,a,e,t),onFailure:i.failure,onSuccess:function(){n.then(function(){a._onCancel(e,t)}),i.success()},identifier:e}),i},onUploadPrep:qq.bind(this._onUploadPrep,this),onUpload:function(e,t){a._onUpload(e,t),a._options.callbacks.onUpload(e,t)},onUploadChunk:function(e,t,n){a._onUploadChunk(e,n),a._options.callbacks.onUploadChunk(e,t,n)},onUploadChunkSuccess:function(e,t,n,i){a._options.callbacks.onUploadChunkSuccess.apply(a,arguments)},onResume:function(e,t,n){return a._options.callbacks.onResume(e,t,n)},onAutoRetry:function(e,t,n,i){return a._onAutoRetry.apply(a,arguments)},onUuidChanged:function(e,t){a.log("Server requested UUID change from '"+a.getUuid(e)+"' to '"+t+"'"),a.setUuid(e,t)},getName:qq.bind(a.getName,a),getUuid:qq.bind(a.getUuid,a),getSize:qq.bind(a.getSize,a),setSize:qq.bind(a._setSize,a),getDataByUuid:function(e){return a.getUploads({uuid:e})},isQueued:function(e){var t=a.getUploads({id:e}).status;return t===qq.status.QUEUED||t===qq.status.SUBMITTED||t===qq.status.UPLOAD_RETRYING||t===qq.status.PAUSED},getIdsInProxyGroup:a._uploadData.getIdsInProxyGroup,getIdsInBatch:a._uploadData.getIdsInBatch};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 r=this;this._extraButtonSpecs={},qq.each(this._options.extraButtons,function(e,t){var n=t.multiple,i=qq.extend({},r._options.validation,!0),o=qq.extend({},t);void 0===n&&(n=r._options.multiple),o.validation&&qq.extend(i,t.validation,!0),qq.extend(o,{multiple:n,validation:i},!0),r._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)}},_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}:{name:this.getUploads({id:e.id}).name,size:this.getUploads({id:e.id}).size}},_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=this._options.camera.button,n=e?this._getButtonId(e):this._defaultButtonId,i=this._options;n&&n!==this._defaultButtonId&&(i=this._extraButtonSpecs[n]),i.multiple=!1,null===i.validation.acceptFiles?i.validation.acceptFiles="image/*;capture=camera":i.validation.acceptFiles+=",image/*;capture=camera",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(),r=-1,a=qq.getFilename(e),s=e.blob||e,l=this._customNewFileHandler?this._customNewFileHandler:qq.bind(i._handleNewFileGeneric,i);!qq.isInput(s)&&0<=s.size&&(r=s.size),l(s,a,o,r,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,r){var a=this._uploadData.addFile({uuid:n,name:t,size:i,batchId:r});this._handler.add(a,e),this._trackButton(a),this._netUploadedOrQueued++,o.push({id:a,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){function i(e,t){a=a.replace(e,t)}var o,r,a=this._options.messages[e],s=[],l=[].concat(t),u=l[0],c=this._getButtonId(n),d=this._getValidationBase(c);return qq.each(d.allowedExtensions,function(e,t){qq.isString(t)&&s.push(t)}),o=s.join(", ").toLowerCase(),i("{file}",this._options.formatFileName(u)),i("{extensions}",o),i("{sizeLimit}",this._formatSize(d.sizeLimit)),i("{minSizeLimit}",this._formatSize(d.minSizeLimit)),null!==(r=a.match(/(\{\w+\})/g))&&qq.each(r,function(e,t){i(t,l[e])}),this._options.callbacks.onError(null,u,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,r,a){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,r,a),onFailure:qq.bind(s._onValidateCallbackFailure,s,i,o,r,a),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 r=this;if(r._preventRetries[e]=n[r._options.retry.preventRetryResponseProperty],r._shouldAutoRetry(e,t,n)){var a=1e3*r._options.retry.autoAttemptDelay;return r._maybeParseAndSendUploadError.apply(r,arguments),r._options.callbacks.onAutoRetry(e,t,r._autoRetries[e]),r._onBeforeAutoRetry(e,t),r._uploadData.setStatus(e,qq.status.UPLOAD_RETRYING),r._retryTimeouts[e]=setTimeout(function(){r.log("Starting retry for "+t+"..."),o?o(e):r._handler.retry(e)},a),!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){},_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 r,a=this._currentItemLimit,s=this._netUploadedOrQueued;0===a||s<=a?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),r=this._options.messages.tooManyItemsError.replace(/\{netItems\}/g,s).replace(/\{itemLimit\}/g,a),this._batchError(r))},_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,r=t+1,a=this._getValidationDescriptor(e[t]);this._validateFileOrBlobData(e[t],a).then(function(){o._upload(e[t].id,n,i),o._maybeProcessNextItemAfterOnValidateCallback(!0,e,r,n,i)},function(){o._maybeProcessNextItemAfterOnValidateCallback(!1,e,r,n,i)})},_prepareItemsForUpload:function(e,t,n){if(0!==e.length){var i=this._getValidationDescriptors(e),o=this._getButtonId(e[0].file),r=this._getButton(o);this._handleCheckedCallback({name:"onValidateBatch",callback:qq.bind(this._options.callbacks.onValidateBatch,this,i,r),onSuccess:qq.bind(this._onValidateBatchCallbackSuccess,this,i,e,t,n,r),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,t,n){var i=this._uploadData.retrieve({id:e});return!!(!this._preventRetries[e]&&this._options.retry.enableAuto&&i.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),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,r=t.size,a=this._getButtonId(e.file),s=this._getValidationBase(a),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!==r?0<r&&s.sizeLimit&&r>s.sizeLimit?(this._itemError("sizeError",o,i),l.failure()):0<r&&r<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,request:{customHeaders:{},endpoint:"/server/upload",filenameParam:"qqfilename",forceMultipart:!0,inputName:"qqfile",method:"POST",params:{},paramsInBody:!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){},onSubmitted:function(e,t){},onComplete:function(e,t,n,i){},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){},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){}},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:2e6,success:{endpoint:null}},resume:{enabled:!1,recordsExpireIn:7,paramNames:{resuming:"qqresume"}},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._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},qq.FineUploaderBasic.prototype=qq.basePublicApi,qq.extend(qq.FineUploaderBasic.prototype,qq.basePrivateApi)}(),qq.AjaxRequester=function(e){"use strict";function I(e){return A.cors.expected&&void 0===e.withCredentials}function D(e,t){var n,i=U[e].xhr;return i||(i=t||(A.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()),U[e].xhr=i),i}function a(e){var t=qq.indexOf(u,e),n=A.maxConnections;delete U[e],u.splice(t,1),u.length>=n&&t<n&&l(u[n-1])}function P(e,t){var n,i=D(e),o=A.method,r=!0===t;a(e),r?k(o+" request for "+e+" has failed","error"):I(i)||(n=i.status,0<=qq.indexOf(A.successfulResponseCodes[A.method],n))||(r=!0,k(o+" request for "+e+" has failed - response code "+i.status,"error")),A.onComplete(e,i,r)}function l(e,t){var n,i,o,r,a,s,l,u,c,d,p,f,h,m,q,g,_,v,b,y,w,x,S=D(e,t),F=A.method,C=(r=U[i=e].additionalParams,a=A.mandatedParams,A.paramsStore.get&&(o=A.paramsStore.get(i)),r&&qq.each(r,function(e,t){(o=o||{})[e]=t}),a&&qq.each(a,function(e,t){(o=o||{})[e]=t}),o),E=U[e].payload;return A.onSend(e),b=C,y=U[v=e].additionalQueryParams,w=A.endpointStore.get(v),null!=(x=U[v].addToPath)&&(w+="/"+x),T&&b&&(w=qq.obj2url(b,w)),y&&(w=qq.obj2url(y,w)),n=w,I(S)?(S.onload=(_=e,function(){P(_)}),S.onerror=(g=e,function(){P(g,!0)})):S.onreadystatechange=(q=e,function(){4===D(q).readyState&&P(q)}),h=e,(m=A.onProgress)&&(D(h).upload.onprogress=function(e){e.lengthComputable&&m(h,e.loaded,e.total)}),S.open(F,n,!0),A.cors.expected&&A.cors.sendCredentials&&!I(S)&&(S.withCredentials=!0),l=D(s=e),u=A.customHeaders,c=U[s].additionalHeaders||{},d=A.method,p={},I(l)||(A.acceptHeader&&l.setRequestHeader("Accept",A.acceptHeader),A.allowXRequestedWithAndCacheControl&&(A.cors.expected&&0<=qq.indexOf(["GET","POST","HEAD"],A.method)&&(f=!1,qq.each(f,function(e,t){if(qq.indexOf(["Accept","Accept-Language","Content-Language","Content-Type"],t)<0)return!(f=!0)}),!f)||(l.setRequestHeader("X-Requested-With","XMLHttpRequest"),l.setRequestHeader("Cache-Control","no-cache"))),!A.contentType||"POST"!==d&&"PUT"!==d||l.setRequestHeader("Content-Type",A.contentType),qq.extend(p,qq.isFunction(u)?u(s):u),qq.extend(p,c),qq.each(p,function(e,t){l.setRequestHeader(e,t)})),k("Sending "+F+" request for "+e),E?S.send(E):T||!C?S.send():C&&A.contentType&&0<=A.contentType.toLowerCase().indexOf("application/x-www-form-urlencoded")?S.send(qq.obj2url(C,"")):C&&A.contentType&&0<=A.contentType.toLowerCase().indexOf("application/json")?S.send(JSON.stringify(C)):S.send(C),S}var k,T,u=[],U={},A={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(A,e),k=A.log,qq.indexOf(A.validMethods,A.method)<0)throw new Error("'"+A.method+"' is not a supported method for this type of request!");T="GET"===A.method||"DELETE"===A.method,qq.extend(this,{initTransport:function(t){var n,i,o,r,a,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 r=e,this},withCacheBuster:function(){return a=!0,this},send:function(e){return a&&0<=qq.indexOf(["GET","DELETE"],A.method)&&(i.qqtimestamp=(new Date).getTime()),function(e,t,n,i,o,r,a){if(U[e]={addToPath:n,additionalParams:i,additionalQueryParams:o,additionalHeaders:r,payload:a},u.push(e)<=A.maxConnections)return l(e,t)}(t,e,n,i,s,o,r)}}},canceled:function(e){a(e)}})},qq.UploadHandler=function(e){"use strict";var t=e.proxy,i={},o=t.onCancel,r=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,r(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,t){"use strict";var i,s,l,n,o=this,r=!1,u=!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){},onUuidChanged:function(e,t){},getName:function(e){},setSize:function(e,t){},isQueued:function(e){},getIdsInProxyGroup:function(e){},getIdsInBatch:function(e){}},d={done:function(e,t,n,i){var o=l._getChunkData(e,t);l._getFileState(e).attemptingResume=!1,delete l._getFileState(e).temp.chunkProgress[t],l._getFileState(e).loaded+=o.size,c.onUploadChunkSuccess(e,l._getChunkDataForCallback(o),n,i)},finalize:function(i){var o=c.getSize(i),r=c.getName(i);s("All chunks have been uploaded for "+i+" - finalizing...."),l.finalizeChunks(i).then(function(e,t){s("Finalize successful for "+i);var n=f.normalizeResponse(e,!0);c.onProgress(i,r,o,o),l._maybeDeletePersistedChunkData(i),f.cleanup(i,n,t)},function(e,t){var n=f.normalizeResponse(e,!1);s("Problem finalizing chunks for file ID "+i+" - "+n.error,"error"),n.reset&&d.reset(i),c.onAutoRetry(i,r,n,t)||f.cleanup(i,n,t)})},handleFailure:function(e,n,t,i){var o=c.getName(n);s("Chunked upload request failed for "+n+", chunk "+e),l.clearCachedChunk(n,e);var r,a=f.normalizeResponse(t,!1);a.reset?d.reset(n):0<=(r=qq.indexOf(l._getFileState(n).chunking.inProgress,e))&&(l._getFileState(n).chunking.inProgress.splice(r,1),l._getFileState(n).chunking.remaining.unshift(e)),l._getFileState(n).temp.ignoreFailure||(u&&(l._getFileState(n).temp.ignoreFailure=!0,s(qq.format("Going to attempt to abort these chunks: {}. These are currently in-progress: {}.",JSON.stringify(Object.keys(l._getXhrs(n))),JSON.stringify(l._getFileState(n).chunking.inProgress))),qq.each(l._getXhrs(n),function(e,t){s(qq.format("Attempting to abort file {}.{}. XHR readyState {}. ",n,e,t.readyState)),t.abort(),t._cancelled=!0}),l.moveInProgressToRemaining(n),p.free(n,!0)),c.onAutoRetry(n,o,a,i)||f.cleanup(n,a,i))},hasMoreParts:function(e){return!!l._getFileState(e).chunking.remaining.length},nextPart:function(e){var t=l._getFileState(e).chunking.remaining.shift();return t>=l._getTotalChunks(e)&&(t=null),t},reset:function(e){s("Server or callback has ordered chunking effort to be restarted on next attempt for item ID "+e,"error"),l._maybeDeletePersistedChunkData(e),l.reevaluateChunking(e),l._getFileState(e).loaded=0},sendNext:function(r){var e=c.getSize(r),t=c.getName(r),a=d.nextPart(r),n=l._getChunkData(r,a),i=l._getFileState(r).attemptingResume,o=l._getFileState(r).chunking.inProgress||[];null==l._getFileState(r).loaded&&(l._getFileState(r).loaded=0),i&&!1===c.onResume(r,t,n)&&(d.reset(r),a=d.nextPart(r),n=l._getChunkData(r,a),i=!1),null==a&&0===o.length?d.finalize(r):(s(qq.format("Sending chunked upload request for item {}.{}, bytes {}-{} of {}.",r,a,n.start+1,n.end,e)),c.onUploadChunk(r,t,l._getChunkDataForCallback(n)),o.push(a),l._getFileState(r).chunking.inProgress=o,u&&p.open(r,a),u&&p.available()&&l._getFileState(r).chunking.remaining.length&&d.sendNext(r),0===n.blob.size?(s(qq.format("Chunk {} for file {} will not be uploaded, zero sized chunk.",a,r),"error"),d.handleFailure(a,r,"File is no longer available",null)):l.uploadChunk(r,a,i).then(function(e,t){s("Chunked upload request succeeded for "+r+", chunk "+a),l.clearCachedChunk(r,a);var n=l._getFileState(r).chunking.inProgress||[],i=f.normalizeResponse(e,!0),o=qq.indexOf(n,a);s(qq.format("Chunk {} for file {} uploaded successfully.",a,r)),d.done(r,a,i,t),0<=o&&n.splice(o,1),l._maybePersistChunkedState(r),d.hasMoreParts(r)||0!==n.length?d.hasMoreParts(r)?d.sendNext(r):s(qq.format("File ID {} has no more chunks to send and these chunk indexes are still marked as in-progress: {}",r,JSON.stringify(n))):d.finalize(r)},function(e,t){d.handleFailure(a,r,e,t)}).done(function(){l.clearXhr(r,a)}))}},p={_open:[],_openChunks:{},_waiting:[],available:function(){var e=c.maxConnections,n=0,i=0;return qq.each(p._openChunks,function(e,t){n++,i+=t.length}),e-(p._open.length-n+i)},free:function(e,t){var n,i=!t,o=qq.indexOf(p._waiting,e),r=qq.indexOf(p._open,e);delete p._openChunks[e],f.getProxyOrBlob(e)instanceof qq.BlobProxy&&(s("Generated blob upload has ended for "+e+", disposing generated blob."),delete l._getFileState(e).file),0<=o?p._waiting.splice(o,1):i&&0<=r&&(p._open.splice(r,1),0<=(n=p._waiting.shift())&&(p._open.push(n),f.start(n)))},getWaitingOrConnected:function(){var n=[];return qq.each(p._openChunks,function(e,t){t&&t.length&&n.push(parseInt(e))}),qq.each(p._open,function(e,t){p._openChunks[t]||n.push(parseInt(t))}),n=n.concat(p._waiting)},isUsingConnection:function(e){return 0<=qq.indexOf(p._open,e)},open:function(e,t){return null==t&&p._waiting.push(e),!!p.available()&&(null==t?(p._waiting.pop(),p._open.push(e)):((n=p._openChunks[e]||[]).push(t),p._openChunks[e]=n),!0);var n},reset:function(){p._waiting=[],p._open=[]}},a=function(o,r){l._getFileState(o).loaded=0,s("Sending simple upload request for "+o),l.uploadFile(o).then(function(e,t){s("Simple upload request succeeded for "+o);var n=f.normalizeResponse(e,!0),i=c.getSize(o);c.onProgress(o,r,i,i),f.maybeNewUuid(o,n),f.cleanup(o,n,t)},function(e,t){s("Simple upload request failed for "+o);var n=f.normalizeResponse(e,!1);c.onAutoRetry(o,r,n,t)||f.cleanup(o,n,t)})},f={cancel:function(e){s("Cancelling "+e),c.paramsStore.remove(e),p.free(e)},cleanup:function(e,t,n){var i=c.getName(e);c.onComplete(e,i,t,n),l._getFileState(e)&&l._clearXhrs&&l._clearXhrs(e),p.free(e)},getProxyOrBlob:function(e){return l.getProxy&&l.getProxy(e)||l.getFile&&l.getFile(e)},initHandler:function(){(l=new(t?qq[t]:qq.traditional)[(qq.supportedFeatures.ajaxUploading?"Xhr":"Form")+"UploadHandler"](c,{getDataByUuid:c.getDataByUuid,getName:c.getName,getSize:c.getSize,getUuid:c.getUuid,log:s,onCancel:c.onCancel,onProgress:c.onProgress,onUuidChanged:c.onUuidChanged}))._removeExpiredChunkingRecords&&l._removeExpiredChunkingRecords()},isDeferredEligibleForUpload:function(e){return c.isQueued(e)},maybeDefer:function(n,e){return e&&!l.getFile(n)&&e instanceof qq.BlobProxy?(c.onUploadPrep(n),s("Attempting to generate a blob on-demand for "+n),e.create().then(function(e){s("Generated an on-demand blob for "+n),l.updateBlob(n,e),c.setSize(n,e.size),l.reevaluateChunking(n),f.maybeSendDeferredFiles(n)},function(e){var t={};e&&(t.error=e),s(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),p.free(n)}),!1):f.maybeSendDeferredFiles(n)},maybeSendDeferredFiles:function(n){var e=c.getIdsInProxyGroup(n),i=!1;return e&&e.length?(s("Maybe ready to upload proxy group file "+n),qq.each(e,function(e,t){if(f.isDeferredEligibleForUpload(t)&&l.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(e){var t=c.getName(e);if(!o.isValid(e))throw new qq.Error(e+" is not a valid file ID to upload!");c.onUpload(e,t),r&&l._shouldChunkThisFile(e)?d.sendNext(e):a(e,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){l.add.apply(this,arguments)},upload:function(e){return!!p.open(e)&&f.start(e)},retry:function(e){return u&&(l._getFileState(e).temp.ignoreFailure=!1),p.isUsingConnection(e)?f.start(e):o.upload(e)},cancel:function(e){var t=l.cancel(e);qq.isGenericPromise(t)?t.then(function(){f.cancel(e)}):!1!==t&&f.cancel(e)},cancelAll:function(){var e,t=p.getWaitingOrConnected();if(t.length)for(e=t.length-1;0<=e;e--)o.cancel(t[e]);p.reset()},getFile:function(e){return l.getProxy&&l.getProxy(e)?l.getProxy(e).referenceBlob:l.getFile&&l.getFile(e)},isProxied:function(e){return!(!l.getProxy||!l.getProxy(e))},getInput:function(e){if(l.getInput)return l.getInput(e)},reset:function(){s("Resetting upload handler"),o.cancelAll(),p.reset(),l.reset()},expunge:function(e){if(o.isValid(e))return l.expunge(e)},isValid:function(e){return l.isValid(e)},getResumableFilesData:function(){return l.getResumableFilesData?l.getResumableFilesData():[]},getThirdPartyFileId:function(e){if(o.isValid(e))return l.getThirdPartyFileId(e)},pause:function(e){return!!(o.isResumable(e)&&l.pause&&o.isValid(e)&&l.pause(e))&&(p.free(e),l.moveInProgressToRemaining(e),!0)},isResumable:function(e){return!!l.isResumable&&l.isResumable(e)}}),qq.extend(c,e),s=c.log,r=c.chunking.enabled&&qq.supportedFeatures.chunking,u=r&&c.chunking.concurrent.enabled,(n={})[c.preventRetryParam]=!0,i=n,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";function s(e){return e.split("_")[0]}var t=e.options,l=this,n=e.proxy,i=qq.getUniqueId(),u={},c={},d={},p=t.isCors,o=t.inputName,f=n.getUuid,h=n.log,m=new qq.WindowReceiveMessage({log:h});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 c[e],p&&(clearTimeout(d[e]),delete d[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,r,a;p?(o=t,r=(i=e).id,a=s(r),u[f(a)]=o,c[a]=qq(i).attach("load",function(){l.getInput(a)&&(h("Received iframe load event for CORS upload request (iframe name "+r+")"),d[r]=setTimeout(function(){var e="No valid message received from loaded iframe for iframe name "+r;h(e,"error"),o({error:e})},1e3))}),m.receiveMessage(r,function(e){h("Received the following window message: '"+e+"'");var t,n=(s(r),l._parseJsonResponse(e)),i=n.uuid;i&&u[i]?(h("Handling response for iframe name "+r),clearTimeout(d[r]),delete d[r],l._detachLoadEvent(r),t=u[i],delete u[i],m.stopReceivingMessages(r),t(n)):i||h("'"+e+"' does not contain a UUID - ignoring.")})):c[e.id]=qq(e).attach("load",function(){if(h("Received response for "+e.id),e.parentNode){try{if(e.contentDocument&&e.contentDocument.body&&"false"==e.contentDocument.body.innerHTML)return}catch(e){h("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!==c[e]&&(c[e](),delete c[e])},_getIframeName:function(e){return e+"_"+i},_initFormForUpload:function(e){var t=e.method,n=e.endpoint,i=e.params,o=e.paramsInBody,r=e.targetName,a=qq.toElement("<form method='"+t+"' enctype='multipart/form-data'></form>"),s=n;return o?qq.obj2Inputs(i,a):s=qq.obj2url(i,n),a.setAttribute("action",s),a.setAttribute("target",r),a.style.display="none",document.body.appendChild(a),a},_parseJsonResponse:function(e){var t={};try{t=qq.parseJson(e)}catch(e){h("Error when attempting to parse iframe upload response ("+e.message+")","error")}return t}})},qq.XhrUploadHandler=function(e){"use strict";function t(i){qq.each(f._getXhrs(i),function(e,t){var n=f._getAjaxRequester(i,e);t.onreadystatechange=null,t.upload.onprogress=null,t.abort(),n&&n.canceled&&n.canceled(i)})}var f=this,r=e.options.namespace,n=e.proxy,c=e.options.chunking,o=e.options.resume,i=c&&e.options.chunking.enabled&&qq.supportedFeatures.chunking,a=o&&e.options.resume.enabled&&i&&qq.supportedFeatures.resume,s=n.getName,h=n.getSize,l=n.getUuid,u=n.getEndpoint,d=n.getDataByUuid,p=n.onUuidChanged,m=n.onProgress,q=n.log;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})}f._initTempState(e),a&&f._maybePrepareForResume(e)},expunge:function(e){t(e),f._maybeDeletePersistedChunkData(e),f._clearXhrs(e),n.expunge(e)}}}),qq.extend(this,{clearCachedChunk:function(e,t){delete f._getFileState(e).temp.cachedChunks[t]},clearXhr:function(e,t){var n=f._getFileState(e).temp;n.xhrs&&delete n.xhrs[t],n.ajaxRequesters&&delete n.ajaxRequesters[t]},finalizeChunks:function(e,t){var n=f._getTotalChunks(e)-1,i=f._getXhr(e,n);return t?(new qq.Promise).success(t(i),i):(new qq.Promise).success({},i)},getFile:function(e){return f.isValid(e)&&f._getFileState(e).file},getProxy:function(e){return f.isValid(e)&&f._getFileState(e).proxy},getResumableFilesData:function(){var i=[];return f._iterateResumeRecords(function(e,t){f.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),i.push(n)}),i},isResumable:function(e){return!!c&&f.isValid(e)&&!f._getFileState(e).notResumable},moveInProgressToRemaining:function(e,t,n){var i=t||f._getFileState(e).chunking.inProgress,o=n||f._getFileState(e).chunking.remaining;i&&(q(qq.format("Moving these chunks from in-progress {}, to remaining.",JSON.stringify(i))),i.reverse(),qq.each(i,function(e,t){o.unshift(t)}),i.length=0)},pause:function(e){if(f.isValid(e))return q(qq.format("Aborting XHR upload for {} '{}' due to pause instruction.",e,s(e))),f._getFileState(e).paused=!0,t(e),!0},reevaluateChunking:function(e){if(c&&f.isValid(e)){var t,n,i=f._getFileState(e);if(delete i.chunking,i.chunking={},1<(t=f._getTotalChunks(e))||c.mandatory){for(i.chunking.enabled=!0,i.chunking.parts=t,i.chunking.remaining=[],n=0;n<t;n++)i.chunking.remaining.push(n);f._initTempState(e)}else i.chunking.enabled=!1}},updateBlob:function(e,t){f.isValid(e)&&(f._getFileState(e).file=t)},_clearXhrs:function(e){var t=f._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 f._registerXhr(e,t,qq.createXhrInstance())},_getAjaxRequester:function(e,t){var n=null==t?-1:t;return f._getFileState(e).temp.ajaxRequesters[n]},_getChunkData:function(e,t){var n=c.partSize,i=h(e),o=f.getFile(e),r=n*t,a=i<=r+n?i:r+n,s=f._getTotalChunks(e),l=this._getFileState(e).temp.cachedChunks,u=l[t]||qq.sliceBlob(o,r,a);return{part:t,start:r,end:a,count:s,blob:l[t]=u,size:a-r}},_getChunkDataForCallback:function(e){return{partIndex:e.part,startByte:e.start+1,endByte:e.end,totalParts:e.count}},_getLocalStorageId:function(e){var t=s(e),n=h(e),i=c.partSize,o=u(e);return qq.format("qq{}resume{}-{}-{}-{}-{}",r,"5.0",t,n,i,o)},_getMimeType:function(e){return f.getFile(e).type},_getPersistableData:function(e){return f._getFileState(e).chunking},_getTotalChunks:function(e){if(c){var t=h(e),n=c.partSize;return Math.ceil(t/n)}},_getXhr:function(e,t){var n=null==t?-1:t;return f._getFileState(e).temp.xhrs[n]},_getXhrs:function(e){return f._getFileState(e).temp.xhrs},_iterateResumeRecords:function(n){a&&qq.each(localStorage,function(e,t){0===e.indexOf(qq.format("qq{}resume",r))&&n(e,JSON.parse(t))})},_initTempState:function(e){f._getFileState(e).temp={ajaxRequesters:{},chunkProgress:{},xhrs:{},cachedChunks:{}}},_markNotResumable:function(e){f._getFileState(e).notResumable=!0},_maybeDeletePersistedChunkData:function(e){var t;return!!(a&&f.isResumable(e)&&((t=f._getLocalStorageId(e))&&localStorage.getItem(t)))&&(localStorage.removeItem(t),!0)},_maybePrepareForResume:function(e){var t,n,i=f._getFileState(e);a&&void 0===i.key&&(t=f._getLocalStorageId(e),(n=localStorage.getItem(t))&&(n=JSON.parse(n),d(n.uuid)?f._markNotResumable(e):(q(qq.format("Identified file with ID {} and name of {} as resumable.",e,s(e))),p(e,n.uuid),i.key=n.key,i.chunking=n.chunking,i.loaded=n.loaded,i.attemptingResume=!0,f.moveInProgressToRemaining(e))))},_maybePersistChunkedState:function(e){var t,n,i=f._getFileState(e);if(a&&f.isResumable(e)){t=f._getLocalStorageId(e),n={name:s(e),size:h(e),uuid:l(e),key:i.key,chunking:i.chunking,loaded:i.loaded,lastUpdated:Date.now()};try{localStorage.setItem(t,JSON.stringify(n))}catch(t){q(qq.format("Unable to save resume data for '{}' due to error: '{}'.",e,t.toString()),"warn")}}},_registerProgressHandler:function(u,c,d){var e=f._getXhr(u,c),p=s(u),t={simple:function(e,t){var n=h(u);m(u,p,e===t?n:n<=e?n-1:e,n)},chunked:function(e,t){var n=f._getFileState(u).temp.chunkProgress,i=f._getFileState(u).loaded,o=e,r=t,a=h(u),s=o-(r-d),l=i;n[c]=s,qq.each(n,function(e,t){l+=t}),m(u,p,l,a)}};e.upload.onprogress=function(e){e.lengthComputable&&t[null==d?"simple":"chunked"](e.loaded,e.total)}},_registerXhr:function(e,t,n,i){var o=null==t?-1:t,r=f._getFileState(e).temp;return r.xhrs=r.xhrs||{},r.ajaxRequesters=r.ajaxRequesters||{},r.xhrs[o]=n,i&&(r.ajaxRequesters[o]=i),n},_removeExpiredChunkingRecords:function(){var i=o.recordsExpireIn;f._iterateResumeRecords(function(e,t){var n=new Date(t.lastUpdated);n.setDate(n.getDate()+i),n.getTime()<=Date.now()&&(q("Removing expired resume record with key "+e),localStorage.removeItem(e))})},_shouldChunkThisFile:function(e){var t=f._getFileState(e);return t.chunking||f.reevaluateChunking(e),t.chunking.enabled}})},qq.DeleteFileAjaxRequester=function(e){"use strict";var o,r={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(r,e),o=qq.extend(this,new qq.AjaxRequester({acceptHeader:"application/json",validMethods:["POST","DELETE"],method:r.method,endpointStore:r.endpointStore,paramsStore:r.paramsStore,mandatedParams:"POST"===r.method.toUpperCase()?{_method:"DELETE"}:{},maxConnections:r.maxConnections,customHeaders:function(e){return r.customHeaders.get(e)},log:r.log,onSend:r.onDelete,onComplete:r.onDeleteComplete,cors:r.cors})),qq.extend(this,{sendDelete:function(e,t,n){var i=n||{};r.log("Submitting delete file request for "+e),"DELETE"===r.method?o.initTransport(e).withPath(t).withParams(i).send():(i[r.uuidParamName]=t,o.initTransport(e).withParams(i).send())}})},function(){function b(m,e,t,n,q){var i,o,r,a,s,l,u,c,d,p,f,h,g,_,v=m.naturalWidth,b=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:b,imageWidth:v,orientation:n.orientation,resize:n.resize,targetHeight:w,targetWidth:y},r=o.blob,a=o.image,s=o.imageHeight,l=o.imageWidth,u=o.orientation,c=new qq.Promise,d=o.resize,p=document.createElement("canvas"),f=p.getContext("2d"),h=o.canvas,g=o.targetHeight,_=o.targetWidth,F(p,l,s,u),h.height=g,h.width=_,f.drawImage(a,0,0),d({blob:r,height:g,image:a,sourceCanvas:p,targetCanvas:h,width:_}).then(function(){h.qqImageRendered&&h.qqImageRendered(),c.success()},c.failure),c):(qq.supportedFeatures.unlimitedScaledImageSize||(i=function(e){if(!qq.ios())throw new qq.Error("Downsampled dimensions can only be reliably calculated for iOS!");if(5241e3<e.origHeight*e.origWidth)return{newHeight:Math.round(Math.sqrt(e.origHeight/e.origWidth*5241e3)),newWidth:Math.round(Math.sqrt(e.origWidth/e.origHeight*5241e3))}}({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),F(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])&&(v/=2,b/=2);var r,a,s,l=1024,u=document.createElement("canvas"),c=q?function(e,t,n){var i,o,r,a=document.createElement("canvas"),s=0,l=n,u=n;for(a.width=1,a.height=n,(i=a.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==(r=u/n)?1:r}(m,0,b):1,d=Math.ceil(l*y/v),p=Math.ceil(l*w/b/c),f=0,h=0;for(u.width=u.height=l,r=u.getContext("2d");f<b;){for(s=a=0;a<v;)r.clearRect(0,0,l,l),r.drawImage(m,-a,-f),x.drawImage(u,0,0,l,l,s,h,d,p),a+=l,s+=d;f+=l,h+=p}x.restore(),u=r=null}():x.drawImage(m,0,0,y,w),t.qqImageRendered&&t.qqImageRendered(),S.success(),S)}function F(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 e(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}e.prototype.render=function(t,e){e=e||{};var n,i,o,r,a,s,l,u,c,d=this,p=this.srcImage.naturalWidth,f=this.srcImage.naturalHeight,h=e.width,m=e.height,q=e.maxWidth,g=e.maxHeight,_=!this.blob||"image/jpeg"===this.blob.type,v=t.tagName.toLowerCase();this.imageLoadListeners?this.imageLoadListeners.push(function(){d.render(t,e)}):(h&&!m?m=f*h/p<<0:m&&!h?h=p*m/f<<0:(h=p,m=f),q&&q<h&&(m=f*(h=q)/p<<0),g&&g<m&&(h=p*(m=g)/f<<0),n={width:h,height:m},qq.each(e,function(e,t){n[e]=t}),"img"===v?(c=t.src,(i=d.srcImage,o=d.blob,r=n,a=_,s=document.createElement("canvas"),l=r.mime||"image/jpeg",u=new qq.Promise,b(i,o,s,r,a).then(function(){u.success(s.toDataURL(l,r.quality||.8))}),u).then(function(e){t.src=e,c===t.src&&t.onload()})):"canvas"===v&&b(this.srcImage,this.blob,t,n,_),"function"==typeof this.onrender&&this.onrender(t))},qq.MegaPixImage=e}(),qq.ImageGenerator=function(d){"use strict";function s(e){return"img"===e.tagName.toLowerCase()}function l(e){return"canvas"===e.tagName.toLowerCase()}function u(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 c(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 p(e,t){var n,i,o,r,a=s(e)||l(e);return s(e)?(r=t,(o=e).onload=function(){o.onload=null,o.onerror=null,r.success(o)},o.onerror=function(){o.onload=null,o.onerror=null,d("Problem drawing thumbnail!","error"),r.failure(o,"Problem drawing thumbnail!")}):l(e)?(i=t,(n=e).qqImageRendered=function(){i.success(n)}):(t.failure(e),d(qq.format("Element container of type {} is not supported!",e.tagName),"error")),a}function f(e,t,n,i,o){var r=new Image,a=new qq.Promise;p(r,a),c(e)&&(r.crossOrigin="anonymous"),r.src=e,a.then(function(){p(t,n),new qq.MegaPixImage(r).render(t,{maxWidth:i,maxHeight:i,mime:u(e),resize:o})},n.failure)}function h(e,t,n,i){p(t,n),qq(t).css({maxWidth:i+"px",maxHeight:i+"px"}),t.src=e}function m(e,t,n){var i,o=new qq.Promise,r=n.scale,a=r?n.maxSize:null;return r&&s(t)?(i=document.createElement("canvas")).getContext&&i.getContext("2d")?c(e)&&void 0===(new Image).crossOrigin?h(e,t,o,a):f(e,t,o,a):h(e,t,o,a):l(t)?f(e,t,o,a):p(t,o)&&(t.src=e),o}qq.extend(this,{generate:function(e,t,n){return qq.isString(e)?(d("Attempting to update thumbnail based on server response."),m(e,t,n||{})):(d("Attempting to draw client-side image preview."),o=e,r=t,a=n||{},s=new qq.Promise,i=new qq.Identify(o,d),l=a.maxSize,u=null==a.orient||a.orient,c=function(){r.onerror=null,r.onload=null,d("Could not render preview, file may be too large!","error"),s.failure(r,"Browser cannot render image!")},i.isPreviewable().then(function(n){var e={parse:function(){return(new qq.Promise).success()}},t=u?new qq.Exif(o,d):e,i=new qq.MegaPixImage(o,c);p(r,s)&&t.parse().then(function(e){var t=e&&e.Orientation;i.render(r,{maxWidth:l,maxHeight:l,orientation:t,mime:n,resize:a.customResizeFunction})},function(e){d(qq.format("EXIF data could not be parsed ({}).  Assuming orientation = 1.",e)),i.render(r,{maxWidth:l,maxHeight:l,mime:n,resize:a.customResizeFunction})})},function(){d("Not previewable"),s.failure(r,"Not previewable")}),s);var o,r,a,s,i,l,u,c}}),this._testing={},this._testing.isImg=s,this._testing.isCanvas=l,this._testing.isCrossOrigin=c,this._testing.determineMimeOfFileName=u},qq.Exif=function(u,d){"use strict";function p(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}function e(){var t=new qq.Promise;return qq.readBlobToHex(u,0,6).then(function(e){0!==e.indexOf("ffd8")?t.failure("Not a valid JPEG!"):function i(e,t){var o=e,r=t;return void 0===o&&(o=2,r=new qq.Promise),qq.readBlobToHex(u,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,r)):r.success(o):r.failure("No EXIF header to be found!")}),r}().then(function(e){t.success(e)},function(e){t.failure(e)})}),t}var f=[274],h={274:{name:"Orientation",bytes:2}};qq.extend(this,{parse:function(){var s=new qq.Promise,l=function(e){d(qq.format("EXIF header parse failed: '{}' ",e)),s.failure(e)};return e().then(function(a){var e,t;d(qq.format("Moving forward with EXIF header parsing for '{}'",void 0===u.name?"blob":u.name)),(e=a,t=new qq.Promise,qq.readBlobToHex(u,e+10,2).then(function(e){t.success("4949"===e)}),t).then(function(r){var e,t,n;d(qq.format("EXIF Byte order is {} endian",r?"little":"big")),(e=a,t=r,n=new qq.Promise,qq.readBlobToHex(u,e+18,2).then(function(e){if(t)return n.success(p(e));n.success(parseInt(e,16))}),n).then(function(e){var t,n,i,o;d(qq.format("Found {} APP1 directory entries",e)),(t=a,n=e,i=t+20,o=12*n,qq.readBlobToHex(u,i,o)).then(function(e){var l,t,u,c,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=r,t=n,u=qq.extend([],f),c={},qq.each(t,function(e,t){var n,i,o,r=t.slice(0,4),a=l?p(r):parseInt(r,16),s=u.indexOf(a);if(0<=s&&(i=h[a].name,o=h[a].bytes,n=t.slice(16,16+2*o),c[i]=l?p(n):parseInt(n,16),u.splice(s,1)),0===u.length)return!1}),c);d("Successfully parsed some EXIF tags"),s.success(i)},l)},l)},l)},l),s}}),this._testing={},this._testing.parseLittleEndian=p},qq.Identify=function(o,l){"use strict";qq.extend(this,{isPreviewable:function(){var e=this,a=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(r){qq.each(e.PREVIEWABLE_MIME_TYPES,function(e,t){if(n=r,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,a.success(e)),!1;var n,i,o}),l(qq.format("'{}' is {} able to be rendered in this browser",t,s?"":"NOT")),s||a.failure()},function(){l("Error reading file w/ name '"+t+"'.  Not able to be rendered in this browser."),a.failure()})):a.failure(),a},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(r,a){"use strict";this.validate=function(i){var n,e,o,s=new qq.Promise;return a("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(r,a).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(){a("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(r)):(a("No createObjectURL function available to generate image URL!","error"),n.failure())},n.failure),n).then(function(e){var t,r,a,n=(t=i,r=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=r[i];switch(n[1]){case"min":if(o<t)return a=e,!1;break;case"max":if(t<o)return a=e,!1}}}),a);n?s.failure(n):s.success()},s.success):s.success(),s}},qq.Session=function(e){"use strict";function o(e,t,n,i){var o=!1;(t=t&&function(e){if(qq.isArray(e))return!0;r.log("Session response is not an array.","error")}(e))&&qq.each(e,function(e,t){if(null==t.uuid)o=!0,r.log(qq.format("Session response item {} did not include a valid UUID - ignoring.",e),"error");else if(null==t.name)o=!0,r.log(qq.format("Session response item {} did not include a valid name - ignoring.",e),"error");else try{return r.addFileRecord(t),!0}catch(e){o=!0,r.log(e.message,"error")}return!1}),i[t&&!o?"success":"failure"](e,n)}var r={endpoint:null,params:{},customHeaders:{},cors:{},addFileRecord:function(e){},log:function(e,t){}};qq.extend(r,e,!0),this.refresh=function(){var i=new qq.Promise,e=qq.extend({},r);return new qq.SessionAjaxRequester(qq.extend(e,{onComplete:function(e,t,n){o(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,c=e.defaultType,d=e.defaultQuality/100,p=e.failureText,f=e.includeExif,h=this._getSortedSizes(e.sizes);qq.extend(this,{enabled:qq.supportedFeatures.scaling&&0<h.length,getFileRecords:function(e,i,t){var o=this,r=[],a=t.blob?t.blob:t;return new qq.Identify(a,s).isPreviewableSync()?(qq.each(h,function(e,t){var n=o._determineOutputType({defaultType:c,requestedType:t.type,refType:a.type});r.push({uuid:qq.getUniqueId(),name:o._getName(i,{name:t.name,type:n,refType:a.type}),blob:new qq.BlobProxy(a,qq.bind(o._generateScaledImage,o,{customResizeFunction:l,maxSize:t.maxSize,orient:u,type:n,quality:d,failedText:p,includeExif:f,log:s}))})}),r.push({uuid:e,name:i,size:a.size,blob:n?a:null})):r.push({uuid:e,name:i,size:a.size,blob:a}),r},handleNewFile:function(e,t,n,i,o,r,a,s){var l,u=(e.qqButtonId||e.blob&&e.blob.qqButtonId,[]),c=null,d=s.addFileToHandler,p=s.uploadData,f=s.paramsStore,h=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:r,proxyGroupId:h}),t.blob instanceof qq.BlobProxy?u.push(n):c=n,t.blob?(d(n,t.blob),o.push({id:n,file:t.blob})):p.setStatus(n,qq.status.REJECTED)}),null!==c&&(qq.each(u,function(e,t){var n={qqparentuuid:p.retrieve({id:c}).uuid,qqparentsize:p.retrieve({id:c}).size};n[a]=p.retrieve({id:t}).uuid,p.setParentId(t,c),f.addReadOnly(t,n)}),u.length&&((l={})[a]=p.retrieve({id:c}).uuid,f.addReadOnly(c,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,r=n.getFile(t),a=n.uploadData.retrieve({id:t}),s=a&&a.name,l=a&&a.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}]},c=new qq.Scaler(u,o);return qq.Scaler&&qq.supportedFeatures.imagePreviews&&r?qq.bind(function(){var e=c.getFileRecords(l,s,r)[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,r="",a=qq.getExtension(e),s="";return t.name&&t.name.trim().length&&(s=" ("+t.name+")"),0<=n?(r=e.substr(0,n),o!==i&&(a=i.split("/")[1]),r+=s+"."+a):r=e+s,r},_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,r=e.log,n=e.maxSize,a=e.orient,s=e.type,l=e.quality,u=e.failedText,c=e.includeExif&&"image/jpeg"===i.type&&"image/jpeg"===s,d=new qq.Promise,p=new qq.ImageGenerator(r),f=document.createElement("canvas");return r("Attempting to generate scaled version for "+i.name),p.generate(i,f,{maxSize:n,orient:a,customResizeFunction:t}).then(function(){var t=f.toDataURL(s,l),n=function(){r("Success generating scaled version for "+i.name);var e=qq.dataUriToBlob(t);d.success(e)};c?o._insertExifHeader(i,t,r).then(function(e){t=e,n()},function(){r("Problem inserting EXIF header into scaled image.  Using scaled image w/out EXIF data.","error"),n()}):n()},function(){r("Failed attempt to generate scaled version for "+i.name,"error"),d.failure(u)}),d},_insertExifHeader:function(e,t,n){"use strict";var i=new FileReader,o=new qq.Promise,r="";return i.onload=function(){r=i.result,o.success(qq.ExifRestorer.restore(r,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=(qF={KEY_STR:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",encode64:function(e){for(var t,n,i,o,r,a="",s="",l="",u=0;i=(t=e[u++])>>2,o=(3&t)<<4|(n=e[u++])>>4,r=(15&n)<<2|(s=e[u++])>>6,l=63&s,isNaN(n)?r=l=64:isNaN(s)&&(l=64),a=a+this.KEY_STR.charAt(i)+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(r)+this.KEY_STR.charAt(l),t=n=s="",i=o=r=l="",u<e.length;);return a},restore:function(e,t){if(!e.match("data:image/jpeg;base64,"))return t;var n=this.decode64(e.replace("data:image/jpeg;base64,","")),i=this.slice2Segments(n),o=this.exifManipulation(t,i);return"data:image/jpeg;base64,"+this.encode64(o)},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),r=i.slice(0,o),a=i.slice(o),s=r;return(s=s.concat(t)).concat(a)},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,r="",a="",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,r=(3&o)<<6|(a=this.KEY_STR.indexOf(e.charAt(s++))),l.push(t),64!=o&&l.push(n),64!=a&&l.push(r),t=n=r="",i=o=a="",s<e.length;);return l}},qF),qq.TotalProgress=function(n,i){"use strict";var r={},a=0,s=0,o=-1,l=-1,u=function(e,t){e===o&&t===l||n(e,t),o=e,l=t},c=function(e){var t=i(e);0<t&&(d(e,0,t),r[e]={loaded:0,total:t})},d=function(e,t,n){var i=r[e]?r[e].loaded:0,o=r[e]?r[e].total:0;-1===t&&-1===n?(a-=i,s-=o):(t&&(a+=t-i),n&&(s+=n-o)),u(a,s)};qq.extend(this,{onAllComplete:function(e,t,n){var i,o,r;(0===t.length||(i=t,o=n,r=!0,qq.each(i,function(e,t){if(0<=qq.indexOf(o,t))return r=!1}),r))&&(u(s,s),this.reset())},onStatusChange:function(e,t,n){var i;n===qq.status.CANCELED||n===qq.status.REJECTED?(d(i=e,-1,-1),delete r[i]):n===qq.status.SUBMITTING&&c(e)},onIndividualProgress:function(e,t,n){d(e,t,n),r[e]={loaded:t,total:n}},onNewSize:function(e){c(e)},reset:function(){r={},s=a=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";function i(e,t){if(!e.checkValidity||e.checkValidity())return!0;n("Form did not pass validation checks - will not upload.","error"),t()}var o,r,a,s,l=this,u=e.interceptSubmit,c=e.element,d=e.autoUpload;qq.extend(this,{newEndpoint:null,newAutoUpload:d,attachedToForm:!1,getFormInputsAsObject:function(){return null==c?null:l._form2Obj(c)}}),(o=c)&&(qq.isString(o)&&(o=document.getElementById(o)),o&&(n("Attaching to form element."),(s=o).getAttribute("action")&&(l.newEndpoint=s.getAttribute("action")),u&&(a=(r=o).submit,qq(r).attach("submit",function(e){(e=e||window.event).preventDefault?e.preventDefault():e.returnValue=!1,i(r,a)&&t()}),r.submit=function(){i(r,a)&&t()}))),c=o,this.attachedToForm=!!c},qq.extend(qq.FormSupport.prototype,{_form2Obj:function(e){"use strict";var a={},s=function(e){return t=e.type,!(!(0<=qq.indexOf(["checkbox","radio"],t.toLowerCase()))||e.checked)||e.disabled&&"hidden"!==e.type.toLowerCase();var t};return qq.each(e.elements,function(e,t){if((qq.isInput(t,!0)||"textarea"===t.tagName.toLowerCase())&&(r=t.type,qq.indexOf(["button","image","reset","submit"],r.toLowerCase())<0)&&!s(t))a[t.name]=t.value;else if("select"===t.tagName.toLowerCase()&&!s(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&&(a[t.name]=n)}var i,o,r}),a}}),qq.traditional=qq.traditional||{},qq.traditional.FormUploadHandler=function(d,e){"use strict";var p=this,f=e.getName,h=e.getUuid,m=e.log;this.uploadFile=function(n){var e,t,i,o,r,a,s,l=p.getInput(n),u=p._createIframe(n),c=new qq.Promise;return t=n,i=u,o=d.paramsStore.get(t),r="get"===d.method.toLowerCase()?"GET":"POST",a=d.endpointStore.get(t),s=f(t),o[d.uuidName]=h(t),o[d.filenameParam]=s,(e=p._initFormForUpload({method:r,endpoint:a,params:o,paramsInBody:d.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),d.cors.expected||qq(u).remove(),t.success?c.success(t):c.failure(t)}),m("Sending upload request for "+n),e.submit(),qq(e).remove(),c},qq.extend(this,new qq.FormUploadHandler({options:{isCors:d.cors.expected,inputName:d.inputName},proxy:{onCancel:d.onCancel,getName:f,getUuid:h,log:m}}))},qq.traditional=qq.traditional||{},qq.traditional.XhrUploadHandler=function(f,e){"use strict";var h=this,m=e.getName,q=e.getSize,u=e.getUuid,r=e.log,g=f.forceMultipart||f.paramsInBody,a=new qq.traditional.AllChunksDoneAjaxRequester({cors:f.cors,endpoint:f.chunking.success.endpoint,log:r}),_=function(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},o=function(e,t){var n,i,o;return r("xhr - server response received for "+e),r("responseText = "+t.responseText),n=s(!0,t),{success:(i=t,o=n,!(qq.indexOf([200,201,202,203,204],i.status)<0||!o.success||o.reset)),response:n}},s=function(e,t){var n={};try{r(qq.format("Received response status {} with body: {}",t.status,t.responseText)),n=qq.parseJson(t.responseText)}catch(t){e&&r("Error when attempting to parse xhr response text ("+t.message+")","error")}return n},n=function(e){var t,n,i,o,r=new qq.Promise;return a.complete(e,h._createXhr(e),(t=e,n=f.paramsStore.get(t),i=m(t),o=q(t),n[f.uuidName]=u(t),n[f.filenameParam]=i,n[f.totalFileSizeName]=o,n[f.chunking.paramNames.totalParts]=h._getTotalChunks(t),n),f.customHeaders.get(e)).then(function(e){r.success(s(!1,e),e)},function(e){r.failure(s(!1,e),e)}),r},v=function(e,t,n,i){var o=new FormData,r=f.method,a=f.endpointStore.get(i),s=m(i),l=q(i);return e[f.uuidName]=u(i),e[f.filenameParam]=s,g&&(e[f.totalFileSizeName]=l),f.paramsInBody||(g||(e[f.inputName]=s),a=qq.obj2url(e,a)),t.open(r,a,!0),f.cors.expected&&f.cors.sendCredentials&&(t.withCredentials=!0),g?(f.paramsInBody&&qq.obj2FormData(e,o),o.append(f.inputName,n),o):n},b=function(e,n){var t=f.customHeaders.get(e),i=h.getFile(e);n.setRequestHeader("Accept","application/json"),n.setRequestHeader("X-Requested-With","XMLHttpRequest"),n.setRequestHeader("Cache-Control","no-cache"),g||(n.setRequestHeader("Content-Type","application/octet-stream"),n.setRequestHeader("X-Mime-Type",i.type)),qq.each(t,function(e,t){n.setRequestHeader(e,t)})};qq.extend(this,{uploadChunk:function(e,t,n){var i,o,r,a,s,l,u,c,d=h._getChunkData(e,t),p=h._createXhr(e,t);return q(e),i=_(e,p),h._registerProgressHandler(e,t,d.size),r=f.paramsStore.get(e),s=r,l=d,u=q(a=e),c=m(a),s[f.chunking.paramNames.partIndex]=l.part,s[f.chunking.paramNames.partByteOffset]=l.start,s[f.chunking.paramNames.chunkSize]=l.size,s[f.chunking.paramNames.totalParts]=l.count,s[f.totalFileSizeName]=u,g&&(s[f.filenameParam]=c),n&&(r[f.resume.paramNames.resuming]=!0),o=v(r,p,d.blob,e),b(e,p),p.send(o),i},uploadFile:function(e){var t,n,i,o,r=h.getFile(e);return n=h._createXhr(e),h._registerProgressHandler(e),t=_(e,n),i=f.paramsStore.get(e),o=v(i,n,r,e),b(e,n),n.send(o),t}}),qq.extend(this,new qq.XhrUploadHandler({options:qq.extend({namespace:"traditional"},f),proxy:qq.extend({getEndpoint:f.endpointStore.get},e)})),qq.override(this,function(t){return{finalizeChunks:function(e){return f.chunking.success.endpoint?n(e):t.finalizeChunks(e,qq.bind(s,this,!0))}}})},qq.traditional.AllChunksDoneAjaxRequester=function(e){"use strict";var r,a={cors:{allowXdr:!1,expected:!1,sendCredentials:!1},endpoint:null,log:function(e,t){}},s={},t={get:function(e){return a.endpoint}};qq.extend(a,e),r=qq.extend(this,new qq.AjaxRequester({acceptHeader:"application/json",validMethods:["POST"],method:"POST",endpointStore:t,allowXRequestedWithAndCacheControl:!1,cors:a.cors,log:a.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 a.log("Submitting All Chunks Done request for "+e),s[e]=o,r.initTransport(e).withParams(n).withHeaders(i).send(t),o}})},qq.DragAndDrop=function(e){"use strict";function a(o){var r=new qq.Promise;return o.isFile?o.file(function(e){var t=o.name,n=o.fullPath,i=n.indexOf(t);"/"===(n=n.substr(0,i)).charAt(0)&&(n=n.substr(1)),e.qqPath=n,u.push(e),r.success()},function(e){s.callbacks.dropLog("Problem parsing '"+o.fullPath+"'.  FileError code "+e.code+".","error"),r.failure()}):o.isDirectory&&function n(i,e,o,t){var r=t||new qq.Promise,a=e||i.createReader();return a.readEntries(function(e){var t=o?o.concat(e):e;e.length?setTimeout(function(){n(i,a,t,r)},0):r.success(t)},r.failure),r}(o).then(function(e){var n=e.length;qq.each(e,function(e,t){a(t).done(function(){0===(n-=1)&&r.success()})}),e.length||r.success()},function(e){s.callbacks.dropLog("Problem parsing '"+o.fullPath+"'.  FileError code "+e.code+".","error"),r.failure()}),r}function i(t){var r=new qq.UploadDropZone({HIDE_ZONES_EVENT_NAME:"qq-hidezones",element:t,onEnter:function(e){qq(t).addClass(s.classes.dropActive),e.stopPropagation()},onLeaveNotDescendants:function(e){qq(t).removeClass(s.classes.dropActive)},onDrop:function(e){var t,n,i,o;(t=e.dataTransfer,n=r,i=[],o=new qq.Promise,s.callbacks.processingDroppedFiles(),n.dropDisabled(!0),1<t.files.length&&!s.allowMultipleItems?(s.callbacks.processingDroppedFilesComplete([]),s.callbacks.dropError("tooManyFilesError",""),n.dropDisabled(!1),o.failure()):(u=[],qq.isFolderDropSupported(t)?qq.each(t.items,function(e,t){var n=t.webkitGetAsEntry();n&&(n.isFile?u.push(t.getAsFile()):i.push(a(n).done(function(){i.pop(),0===i.length&&o.success()})))}):u=t.files,0===i.length&&o.success()),o).then(function(){var e,t,n;e=u,t=r,n=Array.prototype.slice.call(e),s.callbacks.dropLog("Grabbed "+e.length+" dropped files."),t.dropDisabled(!1),s.callbacks.processingDroppedFilesComplete(n,t.getElement())},function(){s.callbacks.dropLog("Drop event DataTransfer parsing failed.  No files will be uploaded.","error")})}});return c.addDisposer(function(){r.dispose()}),qq(t).hasAttribute("qq-hide-dropzone")&&qq(t).hide(),l.push(r),r}function o(e){var n;return qq.each(e.dataTransfer.types,function(e,t){if("Files"===t)return!(n=!0)}),n}var s,r,n,l=[],u=[],c=new qq.DisposeSupport;s={dropZoneElements:[],allowMultipleItems:!0,classes:{dropActive:null},callbacks:new qq.DragAndDrop.callbacks},qq.extend(s,e,!0),r=s.dropZoneElements,n=function(){setTimeout(function(){qq.each(r,function(e,t){qq(t).hasAttribute("qq-hide-dropzone")&&qq(t).hide(),qq(t).removeClass(s.classes.dropActive)})},10)},qq.each(r,function(e,t){var n=i(t);r.length&&qq.supportedFeatures.fileDrop&&c.attach(document,"dragenter",function(e){!n.dropDisabled()&&o(e)&&qq.each(r,function(e,t){t instanceof HTMLElement&&qq(t).hasAttribute("qq-hide-dropzone")&&qq(t).css({display:"block"})})})}),c.attach(document,"dragleave",function(e){var t;t=e,(qq.safari()?t.x<0||t.y<0:0===t.x&&0===t.y)&&n()}),c.attach(qq(document).children()[0],"mouseenter",function(e){n()}),c.attach(document,"drop",function(e){o(e)&&(e.preventDefault(),n())}),c.attach(document,"qq-hidezones",n),qq.extend(this,{setupExtraDropzone:function(e){s.dropZoneElements.push(e),i(e)},removeDropzone:function(e){var t,n=s.dropZoneElements;for(t in n)if(n[t]===e)return n.splice(t,1)},dispose:function(){c.dispose(),qq.each(l,function(e,t){t.dispose()})}})},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)}}},qq.UploadDropZone=function(e){"use strict";function n(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 t(e){return void 0!==e&&(r=e),r}var i,o,r,a,s=new qq.DisposeSupport;i={element:null,onEnter:function(e){},onLeave:function(e){},onLeaveNotDescendants:function(e){},onDrop:function(e){}},qq.extend(i,e),o=i.element,a||(s.attach(document,"dragover",function(e){e.preventDefault()}),a=!0),s.attach(o,"dragover",function(e){if(n(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()}}),s.attach(o,"dragenter",function(e){if(!t()){if(!n(e))return;i.onEnter(e)}}),s.attach(o,"dragleave",function(e){if(n(e)){i.onLeave(e);var t=document.elementFromPoint(e.clientX,e.clientY);qq(this).contains(t)||i.onLeaveNotDescendants(e)}}),s.attach(o,"drop",function(e){if(!t()){if(!n(e))return;e.preventDefault(),e.stopPropagation(),i.onDrop(e),function(){function e(){(t=document.createEvent("Event")).initEvent(i.HIDE_ZONES_EVENT_NAME,!0,!0)}var t;if(window.CustomEvent)try{t=new CustomEvent(i.HIDE_ZONES_EVENT_NAME)}catch(t){e()}else e();document.dispatchEvent(t)}()}}),qq.extend(this,{dropDisabled:function(e){return t(e)},dispose:function(){s.dispose()},getElement:function(){return o}}),this._testing={},this._testing.isValidFileDrag=n},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)}}})},_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){function o(e){s&&(a.setStatusText(t),qq(s).removeClass(l._classes.retrying),a.hideProgress(t),l.getUploads({id:t}).status!==qq.status.UPLOAD_FAILED&&a.hideCancel(t),a.hideSpinner(t),e.success?l._markFileAsSuccessful(t):(qq(s).addClass(l._classes.fail),a.showCancel(t),a.isRetryPossible()&&!l._preventRetries[t]&&(qq(s).addClass(l._classes.retryable),a.showRetry(t)),l._controlFailureTextDisplay(t,e)))}var r=this._parent.prototype._onComplete.apply(this,arguments),a=this._templating,s=a.getFileContainer(t),l=this;return r instanceof qq.Promise?r.done(function(e){o(e)}):o(n),r},_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),r=this._options.deleteFile.confirmMessage.replace(/\{filename\}/g,o),a=(this.getUuid(e),arguments),s=this;i=this._options.showConfirm(r),qq.isGenericPromise(i)?i.then(function(){s._sendDeleteRequest.apply(s,a)}):!1!==i&&s._sendDeleteRequest.apply(s,a)},_addToList:function(e,t,n){var i,o,r=0,a=this._handler.isProxied(e)&&this._options.scaling.hideScaled;this._options.display.prependFiles&&(1<this._totalFilesInBatch&&0<this._filesInBatchAddedToUi&&(r=this._filesInBatchAddedToUi-1),i={index:r}),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,a),this._templating.updateThumbnail(e,this._thumbnailUrls[e],!0,this._options.thumbnails.customResizer)):(this._templating.addFile(e,this._options.formatFileName(t),i,a),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){function n(e,t){i=i.replace(e,t)}var i=this._options.text.formatProgress;return n("{percent}",Math.round(e/t*100)),n("{total_size}",this._formatSize(t)),i},_controlFailureTextDisplay:function(e,t){var n,i,o;n=this._options.failedUploadTextDisplay.mode,i=this._options.failedUploadTextDisplay.responseProperty,"custom"===n?((o=t[i])||(o=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";var d,p,f,h,m,q,g,_,t,n,i,v={content:document.createDocumentFragment(),map:{}},b=!1,l=0,o=!1,r=[],y=-1,w={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"}},x={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"},u={},a=new qq.Promise,S=new qq.Promise,c=function(t){var n=new qq.Promise;return S.then(function(e){H(e,t),t.src?n.success():(t.src=e.src,t.onload=function(){t.onload=null,V(t),n.success()})},function(){z(t),n.success()}),n},F=function(){if(r.length){o=!0;var e=r.shift();e.update?G(e):M(e)}else o=!1},s=function(e){return N(k(e),x.cancel)},C=function(e){return N(k(e),x.continueButton)},E=function(e){return N(m,x[e+"Dialog"])},I=function(e){return N(k(e),x.deleteButton)},D=function(){return N(m,x.dropProcessing)},P=function(e){return N(k(e),x.editNameIcon)},k=function(e){return v.map[e]||qq(q).getFirstByClass("qq-file-id-"+e)},T=function(e){return N(k(e),x.file)},U=function(e){return N(k(e),x.pause)},A=function(e){return null==e?N(m,x.totalProgressBarContainer)||N(m,x.totalProgressBar):N(k(e),x.progressBarContainer)||N(k(e),x.progressBar)},R=function(e){return N(k(e),x.retry)},B=function(e){return N(k(e),x.size)},O=function(e){return N(k(e),x.spinner)},N=function(e,t){return e&&qq(e).getFirstByClass(t)},L=function(e){return g&&N(k(e),x.thumbnail)},z=function(e){e&&qq(e).addClass(w.classes.hide)},H=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,t){var n=u[e]||(new qq.Promise).failure(),i=new qq.Promise;return a.then(function(e){n.then(function(){i.success()},function(){H(e,t),t.onload=function(){t.onload=null,i.success()},t.src=e.src,V(t)})}),i},M=function(e){var o=e.id,r=e.optFileOrBlob,a=r&&r.qqThumbnailId,t=L(o),s={customResizeFunction:e.customResizeFunction,maxSize:y,orient:!0,scale:!0};qq.supportedFeatures.imagePreviews?t?w.limits.maxThumbs&&w.limits.maxThumbs<=l?(j(o,t),F()):c(t).done(function(){var e,t,n,i;u[o]=new qq.Promise,u[o].done(function(){setTimeout(F,w.limits.timeBetweenThumbs)}),null!=a?X(o,a):(t=r,n=s,i=L(e=o),d("Generating new thumbnail for "+e),t.qqThumbnailId=e,w.imageGenerator.generate(t,i,n).then(function(){l++,V(i),u[e].success()},function(){u[e].failure(),w.placeholders.waitUntilUpdate||j(e,i)}))}):F():t&&(c(t),F())},G=function(e){var t=e.id,n=e.thumbnailUrl,i=e.showWaitingImg,o=L(t),r={customResizeFunction:e.customResizeFunction,scale:_,maxSize:y};if(o)if(n){if(!(w.limits.maxThumbs&&w.limits.maxThumbs<=l))return i&&c(o),w.imageGenerator.generate(n,o,r).then(function(){V(o),l++,setTimeout(F,w.limits.timeBetweenThumbs)},function(){j(t,o),setTimeout(F,w.limits.timeBetweenThumbs)});j(t,o),F()}else j(t,o),F()},$=function(e,t){var n=A(e),i=null==e?x.totalProgressBar:x.progressBar;n&&!qq(n).hasClass(i)&&(n=qq(n).getFirstByClass(i)),n&&(qq(n).css({width:t+"%"}),n.setAttribute("aria-valuenow",t))},V=function(e){e&&qq(e).removeClass(w.classes.hide)},X=function(e,t){var n=L(e),i=L(t);d(qq.format("ID {} is the same file as ID {}.  Will use generated thumbnail from ID {} instead.",e,t,t)),u[t].then(function(){l++,u[e].success(),d(qq.format("Now using previously generated thumbnail created for ID {} on ID {}.",t,e)),n.src=i.src,V(n)},function(){u[e].failure(),w.placeholders.waitUntilUpdate||j(e,n)})};qq.extend(w,e),d=w.log,qq.supportedFeatures.imagePreviews||(w.limits.timeBetweenThumbs=0,w.limits.maxThumbs=0),m=w.containerEl,g=void 0!==w.imageGenerator,h=function(){var e,t,n,i,o,r,a,s,l,u,c;if(d("Parsing template"),null==w.templateIdOrEl)throw new Error("You MUST specify either a template element or ID!");if(qq.isString(w.templateIdOrEl)){if(null===(e=document.getElementById(w.templateIdOrEl)))throw new Error(qq.format("Cannot find template script at ID '{}'!",w.templateIdOrEl));t=e.innerHTML}else{if(void 0===w.templateIdOrEl.innerHTML)throw new Error("You have specified an invalid value for the template option!  It must be an ID or an Element.");t=w.templateIdOrEl.innerHTML}if(t=qq.trimStr(t),(i=document.createElement("div")).appendChild(qq.toElement(t)),c=qq(i).getFirstByClass(x.uploader),w.button&&(r=qq(i).getFirstByClass(x.button))&&qq(r).remove(),qq.DragAndDrop&&qq.supportedFeatures.fileDrop||(l=qq(i).getFirstByClass(x.dropProcessing))&&qq(l).remove(),(a=qq(i).getFirstByClass(x.drop))&&!qq.DragAndDrop&&(d("DnD module unavailable.","info"),qq(a).remove()),qq.supportedFeatures.fileDrop?qq(c).hasAttribute("qq-drop-area-text")&&a&&(u=qq(a).getFirstByClass(x.dropText))&&qq(u).remove():(c.removeAttribute("qq-drop-area-text"),a&&qq(a).hasAttribute("qq-hide-dropzone")&&qq(a).css({display:"none"})),s=qq(i).getFirstByClass(x.thumbnail),g?s&&(y=0<(y=parseInt(s.getAttribute("qq-max-size")))?y:null,_=qq(s).hasAttribute("qq-server-scale")):s&&qq(s).remove(),g=g&&s,p=0<qq(i).getByClass(x.editFilenameInput).length,f=0<qq(i).getByClass(x.retry).length,null==(n=qq(i).getFirstByClass(x.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"),d("Template parsing complete"),{template:i,fileTemplate:o}}(),t=w.placeholders.thumbnailNotAvailable,n=w.placeholders.waitingForThumbnail,i={maxSize:y,scale:_},g&&(t?w.imageGenerator.generate(t,new Image,i).then(function(e){a.success(e)},function(){a.failure(),d("Problem loading 'not available' placeholder image at "+t,"error")}):a.failure(),n?w.imageGenerator.generate(n,new Image,i).then(function(e){S.success(e)},function(){S.failure(),d("Problem loading 'waiting for thumbnail' placeholder image at "+n,"error")}):S.failure()),qq.extend(this,{render:function(){d("Rendering template in DOM."),l=0,m.appendChild(h.template.cloneNode(!0)),z(D()),this.hideTotalProgress(),q=w.fileContainerEl||N(m,x.list),d("Template rendering complete")},renderFailure:function(e){var t=qq.toElement(e);m.innerHTML="",m.appendChild(t)},reset:function(){this.render()},clearFiles:function(){q.innerHTML=""},disableCancel:function(){b=!0},addFile:function(e,t,n,i,o){var r,a,s,l,u,c=h.fileTemplate.cloneNode(!0),d=N(c,x.file),p=N(m,x.uploader),f=o?v.content:q;o&&(v.map[e]=c),qq(c).addClass("qq-file-id-"+e),p.removeAttribute("qq-drop-area-text"),d&&(qq(d).setText(t),d.setAttribute("title",t)),c.setAttribute("qq-file-id",e),n?(a=c,s=n.index,u=(l=f).firstChild,0<s&&(u=qq(l).children()[s].nextSibling),l.insertBefore(a,u)):f.appendChild(c),i?(c.style.display="none",qq(c).addClass("qq-hidden-forever")):(z(A(e)),z(B(e)),z(I(e)),z(R(e)),z(U(e)),z(C(e)),b&&this.hideCancel(e),(r=L(e))&&!r.src&&S.then(function(e){r.src=e.src,e.style.maxHeight&&e.style.maxWidth&&qq(r).css({maxHeight:e.style.maxHeight,maxWidth:e.style.maxWidth}),V(r)}))},addFileToCache:function(e,t,n,i){this.addFile(e,t,n,i,!0)},addCacheToDom:function(){q.appendChild(v.content),v.content=document.createDocumentFragment(),v.map={}},removeFile:function(e){qq(k(e)).remove()},getFileId:function(e){var t=e;if(t){for(;null==t.getAttribute("qq-file-id");)t=t.parentNode;return parseInt(t.getAttribute("qq-file-id"))}},getFileList:function(){return q},markFilenameEditable:function(e){var t=T(e);t&&qq(t).addClass(w.classes.editable)},updateFilename:function(e,t){var n=T(e);n&&(qq(n).setText(t),n.setAttribute("title",t))},hideFilename:function(e){z(T(e))},showFilename:function(e){V(T(e))},isFileName:function(e){return qq(e).hasClass(x.file)},getButton:function(){return w.button||N(m,x.button)},hideDropProcessing:function(){z(D())},showDropProcessing:function(){V(D())},getDropZone:function(){return N(m,x.drop)},isEditFilenamePossible:function(){return p},hideRetry:function(e){z(R(e))},isRetryPossible:function(){return f},showRetry:function(e){V(R(e))},getFileContainer:function(e){return k(e)},showEditIcon:function(e){var t=P(e);t&&qq(t).addClass(w.classes.editable)},isHiddenForever:function(e){return qq(k(e)).hasClass("qq-hidden-forever")},hideEditIcon:function(e){var t=P(e);t&&qq(t).removeClass(w.classes.editable)},isEditIcon:function(e){return qq(e).hasClass(x.editNameIcon,!0)},getEditInput:function(e){return N(k(e),x.editFilenameInput)},isEditInput:function(e){return qq(e).hasClass(x.editFilenameInput,!0)},updateProgress:function(e,t,n){var i,o=A(e);o&&0<n&&(100===(i=Math.round(t/n*100))?z(o):V(o),$(e,i))},updateTotalProgress:function(e,t){this.updateProgress(null,e,t)},hideProgress:function(e){var t=A(e);t&&z(t)},hideTotalProgress:function(){this.hideProgress()},resetProgress:function(e){$(e,0),this.hideTotalProgress(e)},resetTotalProgress:function(){this.resetProgress()},showCancel:function(e){if(!b){var t=s(e);t&&qq(t).removeClass(w.classes.hide)}},hideCancel:function(e){z(s(e))},isCancel:function(e){return qq(e).hasClass(x.cancel,!0)},allowPause:function(e){V(U(e)),z(C(e))},uploadPaused:function(e){this.setStatusText(e,w.text.paused),this.allowContinueButton(e),z(O(e))},hidePause:function(e){z(U(e))},isPause:function(e){return qq(e).hasClass(x.pause,!0)},isContinueButton:function(e){return qq(e).hasClass(x.continueButton,!0)},allowContinueButton:function(e){V(C(e)),z(U(e))},uploadContinued:function(e){this.setStatusText(e,""),this.allowPause(e),V(O(e))},showDeleteButton:function(e){V(I(e))},hideDeleteButton:function(e){z(I(e))},isDeleteButton:function(e){return qq(e).hasClass(x.deleteButton,!0)},isRetry:function(e){return qq(e).hasClass(x.retry,!0)},updateSize:function(e,t){var n=B(e);n&&(V(n),qq(n).setText(t))},setStatusText:function(e,t){var n=N(k(e),x.statusText);n&&(null==t?qq(n).clearText():qq(n).setText(t))},hideSpinner:function(e){qq(k(e)).removeClass("qq-in-progress"),z(O(e))},showSpinner:function(e){qq(k(e)).addClass("qq-in-progress"),V(O(e))},generatePreview:function(e,t,n){this.isHiddenForever(e)||(r.push({id:e,customResizeFunction:n,optFileOrBlob:t}),!o&&F())},updateThumbnail:function(e,t,n,i){this.isHiddenForever(e)||(r.push({customResizeFunction:i,update:!0,id:e,thumbnailUrl:t,showWaitingImg:n}),!o&&F())},hasDialog:function(e){return qq.supportedFeatures.dialogElement&&!!E(e)},showDialog:function(e,t,n){var i=E(e),o=N(i,x.dialogMessage),r=i.getElementsByTagName("INPUT")[0],a=N(i,x.dialogCancelButton),s=N(i,x.dialogOkButton),l=new qq.Promise,u=function(){a.removeEventListener("click",c),s&&s.removeEventListener("click",d),l.failure()},c=function(){a.removeEventListener("click",c),i.close()},d=function(){i.removeEventListener("close",u),s.removeEventListener("click",d),i.close(),l.success(r&&r.value)};return i.addEventListener("close",u),a.addEventListener("click",c),s&&s.addEventListener("click",d),r&&(r.value=n),o.textContent=t,i.showModal(),l}})},qq.UiEventHandler=function(e,t){"use strict";function n(e){i.attach(e,o.eventType,function(e){var t=(e=e||window.event).target||e.srcElement;o.onHandled(t,e)})}var i=new qq.DisposeSupport,o={eventType:"click",attachTo:null,onHandled:function(e,t){}};qq.extend(this,{addHandler:function(e){n(e)},dispose:function(){i.dispose()}}),qq.extend(t,{getFileIdFromItem:function(e){return e.qqFileId},getDisposeSupport:function(){return i}}),qq.extend(o,e),o.attachTo&&n(o.attachTo)},qq.FileButtonsClickHandler=function(e){"use strict";var a={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){a.onCancel(e)},retry:function(e){a.onRetry(e)},deleteButton:function(e){a.onDeleteFile(e)},pause:function(e){a.onPause(e)},continueButton:function(e){a.onContinue(e)}};qq.extend(a,e),a.eventType="click",a.onHandled=function(o,r){qq.each(t,function(e,t){var n,i=e.charAt(0).toUpperCase()+e.slice(1);if(a.templating["is"+i](o))return n=a.templating.getFileId(o),qq.preventDefault(r),a.log(qq.format("Detected valid file button click event on file '{}', ID: {}.",a.onGetName(n),n)),t(n),!1})},a.attachTo=a.templating.getFileList(),qq.extend(this,new qq.UiEventHandler(a,{}))},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,d){"use strict";function p(e,t){var n,i,o,r=e.value;void 0!==r&&0<qq.trimStr(r).length&&(i=t,o=f.onGetName(i),void 0!==(n=qq.getExtension(o))&&(r=r+"."+n),f.onSetName(t,r)),f.onEditingStatusChange(t,!1)}var f={templating:null,log:function(e,t){},onGetUploadStatus:function(e){},onGetName:function(e){},onSetName:function(e,t){},onEditingStatusChange:function(e,t){}};qq.extend(f,e),f.attachTo=f.templating.getFileList(),qq.extend(this,new qq.UiEventHandler(f,d)),qq.extend(d,{handleFilenameEdit:function(e,t,n){var i,o,r,a,s,l,u,c=f.templating.getEditInput(e);f.onEditingStatusChange(e,!0),c.value=(s=e,l=f.onGetName(s),0<(u=l.lastIndexOf("."))&&(l=l.substr(0,u)),l),n&&c.focus(),r=c,a=e,d.getDisposeSupport().attach(r,"blur",function(){p(r,a)}),i=c,o=e,d.getDisposeSupport().attach(i,"keyup",function(e){13===(e.keyCode||e.which)&&p(i,o)})}})}}(window),function(b,y){var w=/[<>&\r\n"']/gm,x={"<":"lt;",">":"gt;","&":"amp;","\r":"#13;","\n":"#10;",'"':"quot;","'":"#39;"};b.extend({fileDownload:function(s,e){function l(e){var t=e[0].contentWindow||e[0].contentDocument;return t.document&&(t=t.document),t}function u(e){setTimeout(function(){f&&(n&&f.close(),t&&f.focus&&(f.focus(),e&&f.close()))},0)}function o(e){return e.replace(w,function(e){return"&"+x[e]})}var t,n,i,c=b.extend({preparingMessageHtml:null,failMessageHtml:null,androidPostUnsupportedMessageHtml:"Unfortunately your Android browser doesn't support this type of file download. Please try again with a different browser.",dialogOptions:{modal:!0},prepareCallback:function(e){},successCallback:function(e){},failCallback:function(e,t,n){},httpMethod:"GET",data:null,checkInterval:100,cookieName:"fileDownload",cookieValue:"true",cookiePath:"/",cookieDomain:null,popupWindowTitle:"Initiating file download...",encodeHTMLEntities:!0},e),r=new b.Deferred,a=(navigator.userAgent||navigator.vendor||y.opera).toLowerCase();/ip(ad|hone|od)/.test(a)?t=!0:-1!==a.indexOf("android")?n=!0:i=/avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|playbook|silk|iemobile|iris|kindle|lge |maemo|midp|mmp|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|symbian|treo|up\.(browser|link)|vodafone|wap|windows (ce|phone)|xda|xiino/i.test(a)||/1207|6310|6590|3gso|4thp|50[1-6]i|770s|802s|a wa|abac|ac(er|oo|s\-)|ai(ko|rn)|al(av|ca|co)|amoi|an(ex|ny|yw)|aptu|ar(ch|go)|as(te|us)|attw|au(di|\-m|r |s )|avan|be(ck|ll|nq)|bi(lb|rd)|bl(ac|az)|br(e|v)w|bumb|bw\-(n|u)|c55\/|capi|ccwa|cdm\-|cell|chtm|cldc|cmd\-|co(mp|nd)|craw|da(it|ll|ng)|dbte|dc\-s|devi|dica|dmob|do(c|p)o|ds(12|\-d)|el(49|ai)|em(l2|ul)|er(ic|k0)|esl8|ez([4-7]0|os|wa|ze)|fetc|fly(\-|_)|g1 u|g560|gene|gf\-5|g\-mo|go(\.w|od)|gr(ad|un)|haie|hcit|hd\-(m|p|t)|hei\-|hi(pt|ta)|hp( i|ip)|hs\-c|ht(c(\-| |_|a|g|p|s|t)|tp)|hu(aw|tc)|i\-(20|go|ma)|i230|iac( |\-|\/)|ibro|idea|ig01|ikom|im1k|inno|ipaq|iris|ja(t|v)a|jbro|jemu|jigs|kddi|keji|kgt( |\/)|klon|kpt |kwc\-|kyo(c|k)|le(no|xi)|lg( g|\/(k|l|u)|50|54|e\-|e\/|\-[a-w])|libw|lynx|m1\-w|m3ga|m50\/|ma(te|ui|xo)|mc(01|21|ca)|m\-cr|me(di|rc|ri)|mi(o8|oa|ts)|mmef|mo(01|02|bi|de|do|t(\-| |o|v)|zz)|mt(50|p1|v )|mwbp|mywa|n10[0-2]|n20[2-3]|n30(0|2)|n50(0|2|5)|n7(0(0|1)|10)|ne((c|m)\-|on|tf|wf|wg|wt)|nok(6|i)|nzph|o2im|op(ti|wv)|oran|owg1|p800|pan(a|d|t)|pdxg|pg(13|\-([1-8]|c))|phil|pire|pl(ay|uc)|pn\-2|po(ck|rt|se)|prox|psio|pt\-g|qa\-a|qc(07|12|21|32|60|\-[2-7]|i\-)|qtek|r380|r600|raks|rim9|ro(ve|zo)|s55\/|sa(ge|ma|mm|ms|ny|va)|sc(01|h\-|oo|p\-)|sdk\/|se(c(\-|0|1)|47|mc|nd|ri)|sgh\-|shar|sie(\-|m)|sk\-0|sl(45|id)|sm(al|ar|b3|it|t5)|so(ft|ny)|sp(01|h\-|v\-|v )|sy(01|mb)|t2(18|50)|t6(00|10|18)|ta(gt|lk)|tcl\-|tdg\-|tel(i|m)|tim\-|t\-mo|to(pl|sh)|ts(70|m\-|m3|m5)|tx\-9|up(\.b|g1|si)|utst|v400|v750|veri|vi(rg|te)|vk(40|5[0-3]|\-v)|vm40|voda|vulc|vx(52|53|60|61|70|80|81|83|85|98)|w3c(\-| )|webc|whit|wi(g |nc|nw)|wmlb|wonu|x700|xda(\-|2|g)|yas\-|your|zeto|zte\-/i.test(a.substr(0,4));var d=c.httpMethod.toUpperCase();if(n&&"GET"!==d&&c.androidPostUnsupportedMessageHtml)return b().dialog?b("<div>").html(c.androidPostUnsupportedMessageHtml).dialog(c.dialogOptions):alert(c.androidPostUnsupportedMessageHtml),r.reject();var p,f,h,m,q=null,g={onPrepare:function(e){c.preparingMessageHtml?q=b("<div>").html(c.preparingMessageHtml).dialog(c.dialogOptions):c.prepareCallback&&c.prepareCallback(e)},onSuccess:function(e){q&&q.dialog("close"),c.successCallback(e),r.resolve(e)},onFail:function(e,t,n){q&&q.dialog("close"),c.failMessageHtml&&b("<div>").html(c.failMessageHtml).dialog(c.dialogOptions),c.failCallback(e,t,n),r.reject(e,t)}};if(g.onPrepare(s),null!==c.data&&"string"!=typeof c.data&&(c.data=b.param(c.data)),"GET"===d){if(null!==c.data)-1!==s.indexOf("?")?"&"!==s.substring(s.length-1)&&(s+="&"):s+="?",s+=c.data;t||n?((f=y.open(s)).document.title=c.popupWindowTitle,y.focus()):i?y.location(s):p=b("<iframe>").hide().prop("src",s).appendTo("body")}else{var _="";null!==c.data&&b.each(c.data.replace(/\+/g," ").split("&"),function(){var e=this.split("="),t=e[0];e.shift(),e=[t,e.join("=")];var n=c.encodeHTMLEntities?o(decodeURIComponent(e[0])):decodeURIComponent(e[0]);if(n){var i=c.encodeHTMLEntities?o(decodeURIComponent(e[1])):decodeURIComponent(e[1]);_+='<input type="hidden" name="'+n+'" value="'+i+'" />'}}),i?(m=b("<form>").appendTo("body")).hide().prop("method",c.httpMethod).prop("action",s).html(_):(t?((f=y.open("about:blank")).document.title=c.popupWindowTitle,h=f.document,y.focus()):h=l(p=b("<iframe style='display: none' src='about:blank'></iframe>").appendTo("body")),h.write("<html><head></head><body><form method='"+c.httpMethod+"' action='"+s+"'>"+_+"</form>"+c.popupWindowTitle+"</body></html>"),m=b(h).find("form")),m.submit()}setTimeout(function e(){var t=c.cookieValue;"string"==typeof t&&(t=t.toLowerCase());var n=c.cookieName.toLowerCase()+"="+t;if(-1<document.cookie.toLowerCase().indexOf(n)){g.onSuccess(s);var i=c.cookieName+"=; path="+c.cookiePath+"; expires="+new Date(0).toUTCString()+";";return c.cookieDomain&&(i+=" domain="+c.cookieDomain+";"),document.cookie=i,void u(!1)}if(f||p)try{var o=f?f.document:l(p);if(o&&null!==o.body&&o.body.innerHTML.length){var r=!0;if(m&&m.length){var a=b(o.body).contents().first();try{a.length&&a[0]===m[0]&&(r=!1)}catch(e){if(!e||-2146828218!=e.number)throw e;r=!0}}if(r)return void setTimeout(function(){g.onFail(o.body.innerHTML,s),u(!0)},100)}}catch(e){return g.onFail("",s,e),void u(!0)}setTimeout(e,c.checkInterval)},c.checkInterval);var v=r.promise();return v.abort=function(){u(),p.remove()},v}})}(jQuery,this),function(){var e=this,t=e._,i=Array.prototype,a=Object.prototype,n=Function.prototype,o=i.push,l=i.slice,d=a.toString,r=a.hasOwnProperty,s=Array.isArray,u=Object.keys,c=n.bind,p=Object.create,f=function(){},h=function(e){return e instanceof h?e:this instanceof h?void(this._wrapped=e):new h(e)};"undefined"!=typeof exports?("undefined"!=typeof module&&module.exports&&(exports=module.exports=h),exports._=h):e._=h,h.VERSION="1.8.3";var m=function(o,r,e){if(void 0===r)return o;switch(null==e?3:e){case 1:return function(e){return o.call(r,e)};case 2:return function(e,t){return o.call(r,e,t)};case 3:return function(e,t,n){return o.call(r,e,t,n)};case 4:return function(e,t,n,i){return o.call(r,e,t,n,i)}}return function(){return o.apply(r,arguments)}},q=function(e,t,n){return null==e?h.identity:h.isFunction(e)?m(e,t,n):h.isObject(e)?h.matcher(e):h.property(e)};h.iteratee=function(e,t){return q(e,t,1/0)};var g=function(l,u){return function(e){var t=arguments.length;if(t<2||null==e)return e;for(var n=1;n<t;n++)for(var i=arguments[n],o=l(i),r=o.length,a=0;a<r;a++){var s=o[a];u&&void 0!==e[s]||(e[s]=i[s])}return e}},_=function(e){if(!h.isObject(e))return{};if(p)return p(e);f.prototype=e;var t=new f;return f.prototype=null,t},v=function(t){return function(e){return null==e?void 0:e[t]}},b=Math.pow(2,53)-1,y=v("length"),w=function(e){var t=y(e);return"number"==typeof t&&0<=t&&t<=b};function x(s){return function(e,t,n,i){t=m(t,i,4);var o=!w(e)&&h.keys(e),r=(o||e).length,a=0<s?0:r-1;return arguments.length<3&&(n=e[o?o[a]:a],a+=s),function(e,t,n,i,o,r){for(;0<=o&&o<r;o+=s){var a=i?i[o]:o;n=t(n,e[a],a,e)}return n}(e,t,n,o,a,r)}}h.each=h.forEach=function(e,t,n){var i,o;if(t=m(t,n),w(e))for(i=0,o=e.length;i<o;i++)t(e[i],i,e);else{var r=h.keys(e);for(i=0,o=r.length;i<o;i++)t(e[r[i]],r[i],e)}return e},h.map=h.collect=function(e,t,n){t=q(t,n);for(var i=!w(e)&&h.keys(e),o=(i||e).length,r=Array(o),a=0;a<o;a++){var s=i?i[a]:a;r[a]=t(e[s],s,e)}return r},h.reduce=h.foldl=h.inject=x(1),h.reduceRight=h.foldr=x(-1),h.find=h.detect=function(e,t,n){var i;if(void 0!==(i=w(e)?h.findIndex(e,t,n):h.findKey(e,t,n))&&-1!==i)return e[i]},h.filter=h.select=function(e,i,t){var o=[];return i=q(i,t),h.each(e,function(e,t,n){i(e,t,n)&&o.push(e)}),o},h.reject=function(e,t,n){return h.filter(e,h.negate(q(t)),n)},h.every=h.all=function(e,t,n){t=q(t,n);for(var i=!w(e)&&h.keys(e),o=(i||e).length,r=0;r<o;r++){var a=i?i[r]:r;if(!t(e[a],a,e))return!1}return!0},h.some=h.any=function(e,t,n){t=q(t,n);for(var i=!w(e)&&h.keys(e),o=(i||e).length,r=0;r<o;r++){var a=i?i[r]:r;if(t(e[a],a,e))return!0}return!1},h.contains=h.includes=h.include=function(e,t,n,i){return w(e)||(e=h.values(e)),("number"!=typeof n||i)&&(n=0),0<=h.indexOf(e,t,n)},h.invoke=function(e,n){var i=l.call(arguments,2),o=h.isFunction(n);return h.map(e,function(e){var t=o?n:e[n];return null==t?t:t.apply(e,i)})},h.pluck=function(e,t){return h.map(e,h.property(t))},h.where=function(e,t){return h.filter(e,h.matcher(t))},h.findWhere=function(e,t){return h.find(e,h.matcher(t))},h.max=function(e,i,t){var n,o,r=-1/0,a=-1/0;if(null==i&&null!=e)for(var s=0,l=(e=w(e)?e:h.values(e)).length;s<l;s++)n=e[s],r<n&&(r=n);else i=q(i,t),h.each(e,function(e,t,n){o=i(e,t,n),(a<o||o===-1/0&&r===-1/0)&&(r=e,a=o)});return r},h.min=function(e,i,t){var n,o,r=1/0,a=1/0;if(null==i&&null!=e)for(var s=0,l=(e=w(e)?e:h.values(e)).length;s<l;s++)(n=e[s])<r&&(r=n);else i=q(i,t),h.each(e,function(e,t,n){((o=i(e,t,n))<a||o===1/0&&r===1/0)&&(r=e,a=o)});return r},h.shuffle=function(e){for(var t,n=w(e)?e:h.values(e),i=n.length,o=Array(i),r=0;r<i;r++)(t=h.random(0,r))!==r&&(o[r]=o[t]),o[t]=n[r];return o},h.sample=function(e,t,n){return null==t||n?(w(e)||(e=h.values(e)),e[h.random(e.length-1)]):h.shuffle(e).slice(0,Math.max(0,t))},h.sortBy=function(e,i,t){return i=q(i,t),h.pluck(h.map(e,function(e,t,n){return{value:e,index:t,criteria:i(e,t,n)}}).sort(function(e,t){var n=e.criteria,i=t.criteria;if(n!==i){if(i<n||void 0===n)return 1;if(n<i||void 0===i)return-1}return e.index-t.index}),"value")};var S=function(a){return function(i,o,e){var r={};return o=q(o,e),h.each(i,function(e,t){var n=o(e,t,i);a(r,e,n)}),r}};h.groupBy=S(function(e,t,n){h.has(e,n)?e[n].push(t):e[n]=[t]}),h.indexBy=S(function(e,t,n){e[n]=t}),h.countBy=S(function(e,t,n){h.has(e,n)?e[n]++:e[n]=1}),h.toArray=function(e){return e?h.isArray(e)?l.call(e):w(e)?h.map(e,h.identity):h.values(e):[]},h.size=function(e){return null==e?0:w(e)?e.length:h.keys(e).length},h.partition=function(e,i,t){i=q(i,t);var o=[],r=[];return h.each(e,function(e,t,n){(i(e,t,n)?o:r).push(e)}),[o,r]},h.first=h.head=h.take=function(e,t,n){if(null!=e)return null==t||n?e[0]:h.initial(e,e.length-t)},h.initial=function(e,t,n){return l.call(e,0,Math.max(0,e.length-(null==t||n?1:t)))},h.last=function(e,t,n){if(null!=e)return null==t||n?e[e.length-1]:h.rest(e,Math.max(0,e.length-t))},h.rest=h.tail=h.drop=function(e,t,n){return l.call(e,null==t||n?1:t)},h.compact=function(e){return h.filter(e,h.identity)};var F=function(e,t,n,i){for(var o=[],r=0,a=i||0,s=y(e);a<s;a++){var l=e[a];if(w(l)&&(h.isArray(l)||h.isArguments(l))){t||(l=F(l,t,n));var u=0,c=l.length;for(o.length+=c;u<c;)o[r++]=l[u++]}else n||(o[r++]=l)}return o};function C(r){return function(e,t,n){t=q(t,n);for(var i=y(e),o=0<r?0:i-1;0<=o&&o<i;o+=r)if(t(e[o],o,e))return o;return-1}}function E(r,a,s){return function(e,t,n){var i=0,o=y(e);if("number"==typeof n)0<r?i=0<=n?n:Math.max(n+o,i):o=0<=n?Math.min(n+1,o):n+o+1;else if(s&&n&&o)return e[n=s(e,t)]===t?n:-1;if(t!=t)return 0<=(n=a(l.call(e,i,o),h.isNaN))?n+i:-1;for(n=0<r?i:o-1;0<=n&&n<o;n+=r)if(e[n]===t)return n;return-1}}h.flatten=function(e,t){return F(e,t,!1)},h.without=function(e){return h.difference(e,l.call(arguments,1))},h.uniq=h.unique=function(e,t,n,i){h.isBoolean(t)||(i=n,n=t,t=!1),null!=n&&(n=q(n,i));for(var o=[],r=[],a=0,s=y(e);a<s;a++){var l=e[a],u=n?n(l,a,e):l;t?(a&&r===u||o.push(l),r=u):n?h.contains(r,u)||(r.push(u),o.push(l)):h.contains(o,l)||o.push(l)}return o},h.union=function(){return h.uniq(F(arguments,!0,!0))},h.intersection=function(e){for(var t=[],n=arguments.length,i=0,o=y(e);i<o;i++){var r=e[i];if(!h.contains(t,r)){for(var a=1;a<n&&h.contains(arguments[a],r);a++);a===n&&t.push(r)}}return t},h.difference=function(e){var t=F(arguments,!0,!0,1);return h.filter(e,function(e){return!h.contains(t,e)})},h.zip=function(){return h.unzip(arguments)},h.unzip=function(e){for(var t=e&&h.max(e,y).length||0,n=Array(t),i=0;i<t;i++)n[i]=h.pluck(e,i);return n},h.object=function(e,t){for(var n={},i=0,o=y(e);i<o;i++)t?n[e[i]]=t[i]:n[e[i][0]]=e[i][1];return n},h.findIndex=C(1),h.findLastIndex=C(-1),h.sortedIndex=function(e,t,n,i){for(var o=(n=q(n,i,1))(t),r=0,a=y(e);r<a;){var s=Math.floor((r+a)/2);n(e[s])<o?r=s+1:a=s}return r},h.indexOf=E(1,h.findIndex,h.sortedIndex),h.lastIndexOf=E(-1,h.findLastIndex),h.range=function(e,t,n){null==t&&(t=e||0,e=0),n=n||1;for(var i=Math.max(Math.ceil((t-e)/n),0),o=Array(i),r=0;r<i;r++,e+=n)o[r]=e;return o};var I=function(e,t,n,i,o){if(!(i instanceof t))return e.apply(n,o);var r=_(e.prototype),a=e.apply(r,o);return h.isObject(a)?a:r};h.bind=function(e,t){if(c&&e.bind===c)return c.apply(e,l.call(arguments,1));if(!h.isFunction(e))throw new TypeError("Bind must be called on a function");var n=l.call(arguments,2),i=function(){return I(e,i,t,this,n.concat(l.call(arguments)))};return i},h.partial=function(o){var r=l.call(arguments,1),a=function(){for(var e=0,t=r.length,n=Array(t),i=0;i<t;i++)n[i]=r[i]===h?arguments[e++]:r[i];for(;e<arguments.length;)n.push(arguments[e++]);return I(o,a,this,this,n)};return a},h.bindAll=function(e){var t,n,i=arguments.length;if(i<=1)throw new Error("bindAll must be passed function names");for(t=1;t<i;t++)e[n=arguments[t]]=h.bind(e[n],e);return e},h.memoize=function(i,o){var r=function(e){var t=r.cache,n=""+(o?o.apply(this,arguments):e);return h.has(t,n)||(t[n]=i.apply(this,arguments)),t[n]};return r.cache={},r},h.delay=function(e,t){var n=l.call(arguments,2);return setTimeout(function(){return e.apply(null,n)},t)},h.defer=h.partial(h.delay,h,1),h.throttle=function(n,i,o){var r,a,s,l=null,u=0;o||(o={});var c=function(){u=!1===o.leading?0:h.now(),l=null,s=n.apply(r,a),l||(r=a=null)};return function(){var e=h.now();u||!1!==o.leading||(u=e);var t=i-(e-u);return r=this,a=arguments,t<=0||i<t?(l&&(clearTimeout(l),l=null),u=e,s=n.apply(r,a),l||(r=a=null)):l||!1===o.trailing||(l=setTimeout(c,t)),s}},h.debounce=function(t,n,i){var o,r,a,s,l,u=function(){var e=h.now()-s;e<n&&0<=e?o=setTimeout(u,n-e):(o=null,i||(l=t.apply(a,r),o||(a=r=null)))};return function(){a=this,r=arguments,s=h.now();var e=i&&!o;return o||(o=setTimeout(u,n)),e&&(l=t.apply(a,r),a=r=null),l}},h.wrap=function(e,t){return h.partial(t,e)},h.negate=function(e){return function(){return!e.apply(this,arguments)}},h.compose=function(){var n=arguments,i=n.length-1;return function(){for(var e=i,t=n[i].apply(this,arguments);e--;)t=n[e].call(this,t);return t}},h.after=function(e,t){return function(){if(--e<1)return t.apply(this,arguments)}},h.before=function(e,t){var n;return function(){return 0<--e&&(n=t.apply(this,arguments)),e<=1&&(t=null),n}},h.once=h.partial(h.before,2);var D=!{toString:null}.propertyIsEnumerable("toString"),P=["valueOf","isPrototypeOf","toString","propertyIsEnumerable","hasOwnProperty","toLocaleString"];function k(e,t){var n=P.length,i=e.constructor,o=h.isFunction(i)&&i.prototype||a,r="constructor";for(h.has(e,r)&&!h.contains(t,r)&&t.push(r);n--;)(r=P[n])in e&&e[r]!==o[r]&&!h.contains(t,r)&&t.push(r)}h.keys=function(e){if(!h.isObject(e))return[];if(u)return u(e);var t=[];for(var n in e)h.has(e,n)&&t.push(n);return D&&k(e,t),t},h.allKeys=function(e){if(!h.isObject(e))return[];var t=[];for(var n in e)t.push(n);return D&&k(e,t),t},h.values=function(e){for(var t=h.keys(e),n=t.length,i=Array(n),o=0;o<n;o++)i[o]=e[t[o]];return i},h.mapObject=function(e,t,n){t=q(t,n);for(var i,o=h.keys(e),r=o.length,a={},s=0;s<r;s++)a[i=o[s]]=t(e[i],i,e);return a},h.pairs=function(e){for(var t=h.keys(e),n=t.length,i=Array(n),o=0;o<n;o++)i[o]=[t[o],e[t[o]]];return i},h.invert=function(e){for(var t={},n=h.keys(e),i=0,o=n.length;i<o;i++)t[e[n[i]]]=n[i];return t},h.functions=h.methods=function(e){var t=[];for(var n in e)h.isFunction(e[n])&&t.push(n);return t.sort()},h.extend=g(h.allKeys),h.extendOwn=h.assign=g(h.keys),h.findKey=function(e,t,n){t=q(t,n);for(var i,o=h.keys(e),r=0,a=o.length;r<a;r++)if(t(e[i=o[r]],i,e))return i},h.pick=function(e,t,n){var i,o,r={},a=e;if(null==a)return r;h.isFunction(t)?(o=h.allKeys(a),i=m(t,n)):(o=F(arguments,!1,!1,1),i=function(e,t,n){return t in n},a=Object(a));for(var s=0,l=o.length;s<l;s++){var u=o[s],c=a[u];i(c,u,a)&&(r[u]=c)}return r},h.omit=function(e,t,n){if(h.isFunction(t))t=h.negate(t);else{var i=h.map(F(arguments,!1,!1,1),String);t=function(e,t){return!h.contains(i,t)}}return h.pick(e,t,n)},h.defaults=g(h.allKeys,!0),h.create=function(e,t){var n=_(e);return t&&h.extendOwn(n,t),n},h.clone=function(e){return h.isObject(e)?h.isArray(e)?e.slice():h.extend({},e):e},h.tap=function(e,t){return t(e),e},h.isMatch=function(e,t){var n=h.keys(t),i=n.length;if(null==e)return!i;for(var o=Object(e),r=0;r<i;r++){var a=n[r];if(t[a]!==o[a]||!(a in o))return!1}return!0};var T=function(e,t,n,i){if(e===t)return 0!==e||1/e==1/t;if(null==e||null==t)return e===t;e instanceof h&&(e=e._wrapped),t instanceof h&&(t=t._wrapped);var o=d.call(e);if(o!==d.call(t))return!1;switch(o){case"[object RegExp]":case"[object String]":return""+e==""+t;case"[object Number]":return+e!=+e?+t!=+t:0==+e?1/+e==1/t:+e==+t;case"[object Date]":case"[object Boolean]":return+e==+t}var r="[object Array]"===o;if(!r){if("object"!=typeof e||"object"!=typeof t)return!1;var a=e.constructor,s=t.constructor;if(a!==s&&!(h.isFunction(a)&&a instanceof a&&h.isFunction(s)&&s instanceof s)&&"constructor"in e&&"constructor"in t)return!1}i=i||[];for(var l=(n=n||[]).length;l--;)if(n[l]===e)return i[l]===t;if(n.push(e),i.push(t),r){if((l=e.length)!==t.length)return!1;for(;l--;)if(!T(e[l],t[l],n,i))return!1}else{var u,c=h.keys(e);if(l=c.length,h.keys(t).length!==l)return!1;for(;l--;)if(u=c[l],!h.has(t,u)||!T(e[u],t[u],n,i))return!1}return n.pop(),i.pop(),!0};h.isEqual=function(e,t){return T(e,t)},h.isEmpty=function(e){return null==e||(w(e)&&(h.isArray(e)||h.isString(e)||h.isArguments(e))?0===e.length:0===h.keys(e).length)},h.isElement=function(e){return!(!e||1!==e.nodeType)},h.isArray=s||function(e){return"[object Array]"===d.call(e)},h.isObject=function(e){var t=typeof e;return"function"===t||"object"===t&&!!e},h.each(["Arguments","Function","String","Number","Date","RegExp","Error"],function(t){h["is"+t]=function(e){return d.call(e)==="[object "+t+"]"}}),h.isArguments(arguments)||(h.isArguments=function(e){return h.has(e,"callee")}),"function"!=typeof/./&&"object"!=typeof Int8Array&&(h.isFunction=function(e){return"function"==typeof e||!1}),h.isFinite=function(e){return isFinite(e)&&!isNaN(parseFloat(e))},h.isNaN=function(e){return h.isNumber(e)&&e!==+e},h.isBoolean=function(e){return!0===e||!1===e||"[object Boolean]"===d.call(e)},h.isNull=function(e){return null===e},h.isUndefined=function(e){return void 0===e},h.has=function(e,t){return null!=e&&r.call(e,t)},h.noConflict=function(){return e._=t,this},h.identity=function(e){return e},h.constant=function(e){return function(){return e}},h.noop=function(){},h.property=v,h.propertyOf=function(t){return null==t?function(){}:function(e){return t[e]}},h.matcher=h.matches=function(t){return t=h.extendOwn({},t),function(e){return h.isMatch(e,t)}},h.times=function(e,t,n){var i=Array(Math.max(0,e));t=m(t,n,1);for(var o=0;o<e;o++)i[o]=t(o);return i},h.random=function(e,t){return null==t&&(t=e,e=0),e+Math.floor(Math.random()*(t-e+1))},h.now=Date.now||function(){return(new Date).getTime()};var U={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},A=h.invert(U),R=function(t){var n=function(e){return t[e]},e="(?:"+h.keys(t).join("|")+")",i=RegExp(e),o=RegExp(e,"g");return function(e){return e=null==e?"":""+e,i.test(e)?e.replace(o,n):e}};h.escape=R(U),h.unescape=R(A),h.result=function(e,t,n){var i=null==e?void 0:e[t];return void 0===i&&(i=n),h.isFunction(i)?i.call(e):i};var B=0;h.uniqueId=function(e){var t=++B+"";return e?e+t:t},h.templateSettings={evaluate:/<%([\s\S]+?)%>/g,interpolate:/<%=([\s\S]+?)%>/g,escape:/<%-([\s\S]+?)%>/g};var O=/(.)^/,N={"'":"'","\\":"\\","\r":"r","\n":"n","\u2028":"u2028","\u2029":"u2029"},L=/\\|'|\r|\n|\u2028|\u2029/g,z=function(e){return"\\"+N[e]};h.template=function(r,e,t){!e&&t&&(e=t),e=h.defaults({},e,h.templateSettings);var n=RegExp([(e.escape||O).source,(e.interpolate||O).source,(e.evaluate||O).source].join("|")+"|$","g"),a=0,s="__p+='";r.replace(n,function(e,t,n,i,o){return s+=r.slice(a,o).replace(L,z),a=o+e.length,t?s+="'+\n((__t=("+t+"))==null?'':_.escape(__t))+\n'":n?s+="'+\n((__t=("+n+"))==null?'':__t)+\n'":i&&(s+="';\n"+i+"\n__p+='"),e}),s+="';\n",e.variable||(s="with(obj||{}){\n"+s+"}\n"),s="var __t,__p='',__j=Array.prototype.join,print=function(){__p+=__j.call(arguments,'');};\n"+s+"return __p;\n";try{var i=new Function(e.variable||"obj","_",s)}catch(e){throw e.source=s,e}var o=function(e){return i.call(this,e,h)},l=e.variable||"obj";return o.source="function("+l+"){\n"+s+"}",o},h.chain=function(e){var t=h(e);return t._chain=!0,t};var H=function(e,t){return e._chain?h(t).chain():t};h.mixin=function(n){h.each(h.functions(n),function(e){var t=h[e]=n[e];h.prototype[e]=function(){var e=[this._wrapped];return o.apply(e,arguments),H(this,t.apply(h,e))}})},h.mixin(h),h.each(["pop","push","reverse","shift","sort","splice","unshift"],function(t){var n=i[t];h.prototype[t]=function(){var e=this._wrapped;return n.apply(e,arguments),"shift"!==t&&"splice"!==t||0!==e.length||delete e[0],H(this,e)}}),h.each(["concat","join","slice"],function(e){var t=i[e];h.prototype[e]=function(){return H(this,t.apply(this._wrapped,arguments))}}),h.prototype.value=function(){return this._wrapped},h.prototype.valueOf=h.prototype.toJSON=h.prototype.value,h.prototype.toString=function(){return""+this._wrapped},"function"==typeof define&&define.amd&&define("underscore",[],function(){return h})}.call(this),EG||(EG={}),EG.initFineUploader=function(){EG.fineUploader=new qq.FineUploader({element:$("#retinal_image_upload_fine_uploader")[0],template:"qq-template-validation",request:{endpoint:"/upload"},thumbnails:{placeholders:{waitingPath:"/assets/img/fine-uploader/placeholders/waiting-generic.png",notAvailablePath:"/assets/img/fine-uploader/placeholders/not_available-generic.png"}},validation:{allowedExtensions:["aai","art","avs","bgr","bmp","braille","cals","caption","cin","cip","clip","cmyk","cur","cut","dcm","dds","djvu","dng","dot","dpx","ept","exr","fax","fits","fts","gif","gradient","gray","hdr","hrz","html","icon","info","inline","ipl","jbig","jnx*","jpeg","jpg","json","label","mac","map","mask","mat","matte","miff","mono","mpc","mpeg","msl","mtv","mvg","null","otb","palm","pango","pattern","pcd","pcl","pcx","pdb","pdf","pes","pfm","pict","pix","plasma","png","pnm","preview","ps","ps2","ps3","psd","pwp","rgb","rgf","rla","rle","scr","sct","sfw","sgi","six","sixel","stegano","sun","svg","tga","tif","tiff","tile","tim","ttf","txt","uil","uyvy","vicar","vid","viff","vips","wbmp","wmf","wmz","wpg","x","xbm","xc","xcf","xpm","xps","xwd","ycbcr","yuv"],itemLimit:500,sizeLimit:7865e4},chunking:{enabled:!0,concurrent:{enabled:!0},success:{endpoint:"/upload_done"}}}),EG.genetic_fineUploader=new qq.FineUploader({element:$("#genetic_upload_fine_uploader")[0],template:"qq-template-validation",request:{endpoint:"/upload"},thumbnails:{placeholders:{waitingPath:"/assets/img/fine-uploader/placeholders/waiting-generic.png",notAvailablePath:"/assets/img/fine-uploader/placeholders/not_available-generic.png"}},validation:{allowedExtensions:["aai","art","avs","bgr","bmp","braille","cals","caption","cin","cip","clip","cmyk","cur","cut","dcm","dds","djvu","dng","dot","dpx","ept","exr","fax","fits","fts","gif","gradient","gray","hdr","hrz","html","icon","info","inline","ipl","jbig","jnx*","jpeg","jpg","json","label","mac","map","mask","mat","matte","miff","mono","mpc","mpeg","msl","mtv","mvg","null","otb","palm","pango","pattern","pcd","pcl","pcx","pdb","pdf","pes","pfm","pict","pix","plasma","png","pnm","preview","ps","ps2","ps3","psd","pwp","rgb","rgf","rla","rle","scr","sct","sfw","sgi","six","sixel","stegano","sun","svg","tga","tif","tiff","tile","tim","ttf","txt","uil","uyvy","vicar","vid","viff","vips","wbmp","wmf","wmz","wpg","x","xbm","xc","xcf","xpm","xps","xwd","ycbcr","yuv"],itemLimit:500,sizeLimit:7865e4},chunking:{enabled:!0,concurrent:{enabled:!0},success:{endpoint:"/upload_done"}}})},EG.initSubmit=function(){$("#analysis_btn").on("click",function(){if($.isEmptyObject(EG.fineUploader.getUploads()))return $(".validation_text").text("Please upload a file first."),!1;if(0!==EG.fineUploader.getInProgress())return $(".validation_text").text("Please wait until all the files have completely uploaded."),!1;$(".validation_text").text(""),$("#loading_modal").modal("open"),$("#modal_header_text").text("Running Analysis"),$("#modal_text").text("This should take a few minutes. Please leave this page open");var e=$("#eye2gene_analysis").serializeArray();e.push({name:"files",value:JSON.stringify(EG.fineUploader.getUploads())}),$.ajax({url:"/analyse",type:"post",data:e,success:function(e){console.log(e),$("#loading_modal").modal("close"),$("#analysis_results").html(e),$("#analysis_results").show(),$(".collapsible").collapsible(),$(".materialboxed").materialbox(),EG.initSlider(),$("html, body").animate({scrollTop:$("#analysis_results").offset().top})},error:function(e){$("#loading_modal").modal("close"),console.log(e)}})})},EG.initSlider=function(){$(".carousel.carousel-slider").carousel({fullWidth:!0,indicators:!0}),$(".moveNextCarousel").click(function(e){e.preventDefault(),e.stopPropagation(),$(".carousel").carousel("next")}),$(".movePrevCarousel").click(function(e){e.preventDefault(),e.stopPropagation(),$(".carousel").carousel("prev")})},EG.initDownloadResultBtn=function(){$("#download-all-results").on("click",function(){return $("#modal_header_text").text("Creating Download Link"),$("#loading_modal").modal({dismissible:!1}),$("#loading_modal").modal("open"),$.fileDownload($(this).data("download"),{successCallback:function(){$("#loading_modal").modal("close")},failCallback:function(){$("#loading_modal").modal("close")}}),$("#loading_modal").modal("close"),!1})},EG.delete_result=function(){$("#analysis_results").on("click","#delete_results",function(){$("#delete_modal").modal("open");var e=$(this).closest(".card").data("result_uuid");$("#delete_modal").attr("data-result_uuid",e)}),$(".delete-results").click(function(){$("#modal_header_text").text("Deleting Result"),$("#loading_modal").modal({dismissible:!1}),$("#loading_modal").modal("open");var e=$("#delete_modal").data("result_uuid");$.ajax({type:"POST",url:"/delete_result",data:{uuid:e},success:function(){location.reload()},error:function(e,t){EG.ajaxError(e,t)}})})},EG.share_result=function(){$("#analysis_results").on("click","#share_btn",function(){var e=$(this).closest(".card").data("share-link");$("#share_the_link_btn").show(),$("#share_btn").hide(),$("#share_link_input").val(e),$("#share_link_input").prop("readonly",!0),$("#share_modal").modal("open"),$("#share_modal").attr("data-share-link",e),$("#share_link_input").select(),$.ajax({type:"POST",url:e,error:function(e,t){EG.ajaxError(e,t)}})}),$("#analysis_results").on("click","#share_the_link_btn",function(){var e=$(this).closest(".card").data("share-link");$("#share_link_input1").val(e),$("#share_link_input1").prop("readonly",!0),$("#share_the_link_modal").modal("open"),$("#share_the_link_modal").attr("data-share-link",e),$("#share_link_input1").select()}),$(".share_link_input").focus(function(){$(this).select(),$(this).mouseup(function(){return $(this).unbind("mouseup"),!1})})},EG.remove_share=function(){$(".remove_link").click(function(){var e=$(this).closest(".modal").data("share-link").replace(/\/sh\//,"/rm/");$("#share_the_link_btn").hide(),$("#share_btn").show(),$("#share_modal").modal("close"),$("#share_the_link_modal").modal("close"),$.ajax({type:"POST",url:e,error:function(e,t){EG.ajaxError(e,t)}})})},EG.ajaxError=function(e,t){var n;500==e.status||400==e.status?(n=e.responseText,$("#analysis_results").show(),$("#analysis_results").html(n)):(n=e.responseText,$("#analysis_results").show(),$("#analysis_results").html('<div class="card red lighten-2" role="alert"><div class="card-content white-text"><h3>Oops! Eye2Gene went wonky!</h3><p style="font-size: 1.5rem"><strong>Apologies, there was an error with your request. Please try again.</strong></p><p>Error Message:'+n+" The server responded with the status code: "+String(e.status)+". Please refresh the page and try again.</p><p>If the error persists, please contact the administrator.</p></div></div>")),$("#loading_modal").modal("close")},EG.addUserDropDown=function(){var e=document.querySelectorAll(".dropdown-trigger");M.Dropdown.init(e,{inDuration:300,outDuration:225,hover:!0,coverTrigger:!1,alignment:"right"})},EG.protocol=function(){return"true"===EG.USING_SLL?"https://":"http://"},function(i){i.fn.imagesLoaded=function(){var e=this.find('img[src!=""]');if(!e.length)return i.Deferred().resolve().promise();var n=[];return e.each(function(){var e=i.Deferred();n.push(e);var t=new Image;t.onload=function(){e.resolve()},t.onerror=function(){e.resolve()},t.src=this.src}),i.when.apply(i,n)},i(function(){i(".modal").modal(),i(".sidenav").sidenav(),EG.addUserDropDown()})}(jQuery);