!function(){function t(n,t){window.XMLHttpRequest.prototype[n]=t(window.XMLHttpRequest.prototype[n])}function n(n,t,i){try{Object.defineProperty(n,t,{get:i})}catch(r){}}if(window.FileAPI||(window.FileAPI={}),!window.XMLHttpRequest)throw"AJAX is not supported. XMLHttpRequest is not defined.";if(FileAPI.shouldLoad=!window.FormData||FileAPI.forceLoad,FileAPI.shouldLoad){var i=function(n){if(!n.__listeners){n.upload||(n.upload={});n.__listeners=[];var t=n.upload.addEventListener;n.upload.addEventListener=function(i,r){n.__listeners[i]=r;t&&t.apply(this,arguments)}}};t("open",function(n){return function(t,r,u){i(this);this.__url=r;try{n.apply(this,[t,r,u])}catch(f){f.message.indexOf("Access is denied")>-1&&(this.__origError=f,n.apply(this,[t,"_fix_for_ie_crossdomain__",u]))}}});t("getResponseHeader",function(n){return function(t){return this.__fileApiXHR&&this.__fileApiXHR.getResponseHeader?this.__fileApiXHR.getResponseHeader(t):null==n?null:n.apply(this,[t])}});t("getAllResponseHeaders",function(n){return function(){return this.__fileApiXHR&&this.__fileApiXHR.getAllResponseHeaders?this.__fileApiXHR.getAllResponseHeaders():null==n?null:n.apply(this)}});t("abort",function(n){return function(){return this.__fileApiXHR&&this.__fileApiXHR.abort?this.__fileApiXHR.abort():null==n?null:n.apply(this)}});t("setRequestHeader",function(n){return function(t,r){if("__setXHR_"===t){i(this);var u=r(this);u instanceof Function&&u(this)}else this.__requestHeaders=this.__requestHeaders||{},this.__requestHeaders[t]=r,n.apply(this,arguments)}});t("send",function(t){return function(){var i=this,e,u,f,r;if(arguments[0]&&arguments[0].__isFileAPIShim){for(e=arguments[0],u={url:i.__url,jsonp:!1,cache:!0,complete:function(t,r){t&&angular.isString(t)&&-1!==t.indexOf("#2174")&&(t=null);i.__completed=!0;!t&&i.__listeners.load&&i.__listeners.load({type:"load",loaded:i.__loaded,total:i.__total,target:i,lengthComputable:!0});!t&&i.__listeners.loadend&&i.__listeners.loadend({type:"loadend",loaded:i.__loaded,total:i.__total,target:i,lengthComputable:!0});"abort"===t&&i.__listeners.abort&&i.__listeners.abort({type:"abort",loaded:i.__loaded,total:i.__total,target:i,lengthComputable:!0});void 0!==r.status&&n(i,"status",function(){return 0===r.status&&t&&"abort"!==t?500:r.status});void 0!==r.statusText&&n(i,"statusText",function(){return r.statusText});n(i,"readyState",function(){return 4});void 0!==r.response&&n(i,"response",function(){return r.response});var u=r.responseText||(t&&0===r.status&&"abort"!==t?t:void 0);n(i,"responseText",function(){return u});n(i,"response",function(){return u});t&&n(i,"err",function(){return t});i.__fileApiXHR=r;i.onreadystatechange&&i.onreadystatechange();i.onload&&i.onload()},progress:function(n){if(n.target=i,i.__listeners.progress&&i.__listeners.progress(n),i.__total=n.total,i.__loaded=n.loaded,n.total===n.loaded){var t=this;setTimeout(function(){i.__completed||(i.getAllResponseHeaders=function(){},t.complete(null,{status:204,statusText:"No Content"}))},FileAPI.noContentTimeout||1e4)}},headers:i.__requestHeaders},u.data={},u.files={},f=0;f<e.data.length;f++)r=e.data[f],null!=r.val&&null!=r.val.name&&null!=r.val.size&&null!=r.val.type?u.files[r.key]=r.val:u.data[r.key]=r.val;setTimeout(function(){if(!FileAPI.hasFlash)throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';i.__fileApiXHR=FileAPI.upload(u)},1)}else{if(this.__origError)throw this.__origError;t.apply(i,arguments)}}});window.XMLHttpRequest.__isFileAPIShim=!0;window.FormData=FormData=function(){return{append:function(n,t,i){t.__isFileAPIBlobShim&&(t=t.data[0]);this.data.push({key:n,val:t,name:i})},data:[],__isFileAPIShim:!0}};window.Blob=Blob=function(n){return{data:n,__isFileAPIBlobShim:!0}}}}(),function(){function h(n){return"input"===n[0].tagName.toLowerCase()&&n.attr("type")&&"file"===n.attr("type").toLowerCase()}function u(){try{var n=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");if(n)return!0}catch(t){if(void 0!==navigator.mimeTypes["application/x-shockwave-flash"])return!0}return!1}function f(n){var t=0,i=0;if(window.jQuery)return jQuery(n).offset();if(n.offsetParent)do t+=n.offsetLeft-n.scrollLeft,i+=n.offsetTop-n.scrollTop,n=n.offsetParent;while(n);return{left:t,top:i}}if(FileAPI.shouldLoad){if(FileAPI.hasFlash=u(),FileAPI.forceLoad&&(FileAPI.html5=!1),!FileAPI.upload){var e,n,t,i,r,o=document.createElement("script"),s=document.getElementsByTagName("script");if(window.FileAPI.jsUrl)e=window.FileAPI.jsUrl;else if(window.FileAPI.jsPath)n=window.FileAPI.jsPath;else for(t=0;t<s.length;t++)if(r=s[t].src,i=r.search(/\/ng\-file\-upload[\-a-zA-z0-9\.]*\.js/),i>-1){n=r.substring(0,i+1);break}null==FileAPI.staticPath&&(FileAPI.staticPath=n);o.setAttribute("src",e||n+"FileAPI.min.js");document.getElementsByTagName("head")[0].appendChild(o)}FileAPI.ngfFixIE=function(n,t,i){var r,e;if(!u())throw'Adode Flash Player need to be installed. To check ahead use "FileAPI.hasFlash"';r=function(){var r=t.parent();n.attr("disabled")?r&&r.removeClass("js-fileapi-wrapper"):(t.attr("__ngf_flash_")||(t.unbind("change"),t.unbind("click"),t.bind("change",function(n){e.apply(this,[n]);i.apply(this,[n])}),t.attr("__ngf_flash_","true")),r.addClass("js-fileapi-wrapper"),h(n)||(r.css("position","absolute").css("top",f(n[0]).top+"px").css("left",f(n[0]).left+"px").css("width",n[0].offsetWidth+"px").css("height",n[0].offsetHeight+"px").css("filter","alpha(opacity=0)").css("display",n.css("display")).css("overflow","hidden").css("z-index","900000").css("visibility","visible"),t.css("width",n[0].offsetWidth+"px").css("height",n[0].offsetHeight+"px").css("position","absolute").css("top","0px").css("left","0px")))};n.bind("mouseenter",r);e=function(n){for(var t=FileAPI.getFiles(n),i=0;i<t.length;i++)void 0===t[i].size&&(t[i].size=0),void 0===t[i].name&&(t[i].name="file"),void 0===t[i].type&&(t[i].type="undefined");n.target||(n.target={});n.target.files=t;n.target.files!==t&&(n.__files_=t);(n.__files_||n.target.files).item=function(t){return(n.__files_||n.target.files)[t]||null}}};FileAPI.disableFileInput=function(n,t){t?n.removeClass("js-fileapi-wrapper"):n.addClass("js-fileapi-wrapper")}}}();window.FileReader||(window.FileReader=function(){var n=this,r=!1,t,i;this.listeners={};this.addEventListener=function(t,i){n.listeners[t]=n.listeners[t]||[];n.listeners[t].push(i)};this.removeEventListener=function(t,i){n.listeners[t]&&n.listeners[t].splice(n.listeners[t].indexOf(i),1)};this.dispatchEvent=function(t){var r=n.listeners[t.type],i;if(r)for(i=0;i<r.length;i++)r[i].call(n,t)};this.onabort=this.onerror=this.onload=this.onloadstart=this.onloadend=this.onprogress=null;t=function(t,i){var r={type:t,target:n,loaded:i.loaded,total:i.total,error:i.error};return null!=i.result&&(r.target.result=i.result),r};i=function(i){r||(r=!0,n.onloadstart&&n.onloadstart(t("loadstart",i)));var u;"load"===i.type?(n.onloadend&&n.onloadend(t("loadend",i)),u=t("load",i),n.onload&&n.onload(u),n.dispatchEvent(u)):"progress"===i.type?(u=t("progress",i),n.onprogress&&n.onprogress(u),n.dispatchEvent(u)):(u=t("error",i),n.onerror&&n.onerror(u),n.dispatchEvent(u))};this.readAsDataURL=function(n){FileAPI.readAsDataURL(n,i)};this.readAsText=function(n){FileAPI.readAsText(n,i)}});!window.XMLHttpRequest||window.FileAPI&&FileAPI.shouldLoad||(window.XMLHttpRequest.prototype.setRequestHeader=function(n){return function(t,i){if("__setXHR_"===t){var r=i(this);r instanceof Function&&r(this)}else n.apply(this,arguments)}}(window.XMLHttpRequest.prototype.setRequestHeader));var ngFileUpload=angular.module("ngFileUpload",[]);ngFileUpload.version="12.2.13";ngFileUpload.service("UploadBase",["$http","$q","$timeout",function(n,t,i){function f(f){function h(n){o.notify&&o.notify(n);e.progressFunc&&i(function(){e.progressFunc(n)})}function c(n){return null!=f._start&&u?{loaded:n.loaded+f._start,total:f._file&&f._file.size||n.total,type:n.type,config:f,lengthComputable:!0,target:n.target}:n}function s(){n(f).then(function(n){if(u&&f._chunkSize&&!f._finished&&f._file){var t=f._file&&f._file.size||0;h({loaded:Math.min(f._end,t),total:t,config:f,type:"progress"});r.upload(f,!0)}else f._finished&&delete f._finished,o.resolve(n)},function(n){o.reject(n)},function(n){o.notify(n)})}f.method=f.method||"POST";f.headers=f.headers||{};var o=f._deferred=f._deferred||t.defer(),e=o.promise;return f.disableProgress||(f.headers.__setXHR_=function(){return function(n){n&&n.upload&&n.upload.addEventListener&&(f.__XHR=n,f.xhrFn&&f.xhrFn(n),n.upload.addEventListener("progress",function(n){n.config=f;h(c(n))},!1),n.upload.addEventListener("load",function(n){n.lengthComputable&&(n.config=f,h(c(n)))},!1))}}),u?f._chunkSize&&f._end&&!f._finished?(f._start=f._end,f._end+=f._chunkSize,s()):f.resumeSizeUrl?n.get(f.resumeSizeUrl).then(function(n){f._start=f.resumeSizeResponseReader?f.resumeSizeResponseReader(n.data):parseInt((null==n.data.size?n.data:n.data.size).toString());f._chunkSize&&(f._end=f._start+f._chunkSize);s()},function(n){throw n;}):f.resumeSize?f.resumeSize().then(function(n){f._start=n;f._chunkSize&&(f._end=f._start+f._chunkSize);s()},function(n){throw n;}):(f._chunkSize&&(f._start=0,f._end=f._start+f._chunkSize),s()):s(),e.success=function(n){return e.then(function(t){n(t.data,t.status,t.headers,f)}),e},e.error=function(n){return e.then(null,function(t){n(t.data,t.status,t.headers,f)}),e},e.progress=function(n){return e.progressFunc=n,e.then(null,null,function(t){n(t)}),e},e.abort=e.pause=function(){return f.__XHR&&i(function(){f.__XHR.abort()}),e},e.xhr=function(n){return f.xhrFn=function(t){return function(){t&&t.apply(e,arguments);n.apply(e,arguments)}}(f.xhrFn),e},r.promisesCount++,e["finally"]&&e["finally"]instanceof Function&&e["finally"](function(){r.promisesCount--}),e}function e(n){var i={};for(var t in n)n.hasOwnProperty(t)&&(i[t]=n[t]);return i}var r=this,u;r.promisesCount=0;this.isResumeSupported=function(){return window.Blob&&window.Blob.prototype.slice};u=this.isResumeSupported();this.isUploadInProgress=function(){return r.promisesCount>0};this.rename=function(n,t){return n.ngfName=t,n};this.jsonBlob=function(n){null==n||angular.isString(n)||(n=JSON.stringify(n));var t=new window.Blob([n],{type:"application/json"});return t._ngfBlob=!0,t};this.json=function(n){return angular.toJson(n)};this.isFile=function(n){return null!=n&&(n instanceof window.Blob||n.flashId&&n.name&&n.size)};this.upload=function(n,t){function o(t,i){if(t._ngfBlob)return t;if(n._file=n._file||t,null!=n._start&&u){n._end&&n._end>=t.size&&(n._finished=!0,n._end=t.size);var r=t.slice(n._start,n._end||t.size);return r.name=t.name,r.ngfName=t.ngfName,n._chunkSize&&(i.append("_chunkSize",n._chunkSize),i.append("_currentChunkSize",n._end-n._start),i.append("_chunkNumber",Math.floor(n._start/n._chunkSize)),i.append("_totalSize",n._file.size)),r}return t}function i(t,u,f){var s,h,e,c;if(void 0!==u)if(angular.isDate(u)&&(u=u.toISOString()),angular.isString(u))t.append(f,u);else if(r.isFile(u))s=o(u,t),h=f.split(","),h[1]&&(s.ngfName=h[1].replace(/^\s+|\s+$/g,""),f=h[0]),n._fileKey=n._fileKey||f,t.append(f,s,s.ngfName||s.name);else if(angular.isObject(u)){if(u.$$ngfCircularDetection)throw"ngFileUpload: Circular reference in config.data. Make sure specified data for Upload.upload() has no circular reference: "+f;u.$$ngfCircularDetection=!0;try{for(e in u)u.hasOwnProperty(e)&&"$$ngfCircularDetection"!==e&&(c=null==n.objectKey?"[i]":n.objectKey,u.length&&parseInt(e)>-1&&(c=null==n.arrayKey?c:n.arrayKey),i(t,u[e],f+c.replace(/[ik]/g,e)))}finally{delete u.$$ngfCircularDetection}}else t.append(f,u)}function s(){n._chunkSize=r.translateScalars(n.resumeChunkSize);n._chunkSize=n._chunkSize?parseInt(n._chunkSize.toString()):null;n.headers=n.headers||{};n.headers["Content-Type"]=void 0;n.transformRequest=n.transformRequest?angular.isArray(n.transformRequest)?n.transformRequest:[n.transformRequest]:[];n.transformRequest.push(function(t){var r,u=new window.FormData,f;t=t||n.fields||{};n.file&&(t.file=n.file);for(r in t)t.hasOwnProperty(r)&&(f=t[r],n.formDataAppender?n.formDataAppender(u,r,f):i(u,f,r));return u})}return t||(n=e(n)),n._isDigested||(n._isDigested=!0,s()),f(n)};this.http=function(t){return t=e(t),t.transformRequest=t.transformRequest||function(t){return window.ArrayBuffer&&t instanceof window.ArrayBuffer||t instanceof window.Blob?t:n.defaults.transformRequest[0].apply(this,arguments)},t._chunkSize=r.translateScalars(t.resumeChunkSize),t._chunkSize=t._chunkSize?parseInt(t._chunkSize.toString()):null,f(t)};this.translateScalars=function(n){if(angular.isString(n)){if(n.search(/kb/i)===n.length-2)return parseFloat(1024*n.substring(0,n.length-2));if(n.search(/mb/i)===n.length-2)return parseFloat(1048576*n.substring(0,n.length-2));if(n.search(/gb/i)===n.length-2)return parseFloat(1073741824*n.substring(0,n.length-2));if(n.search(/b/i)===n.length-1||n.search(/s/i)===n.length-1)return parseFloat(n.substring(0,n.length-1));if(n.search(/m/i)===n.length-1)return parseFloat(60*n.substring(0,n.length-1));if(n.search(/h/i)===n.length-1)return parseFloat(3600*n.substring(0,n.length-1))}return n};this.urlToBlob=function(i){var r=t.defer();return n({url:i,method:"get",responseType:"arraybuffer"}).then(function(n){var f=new Uint8Array(n.data),e=n.headers("content-type")||"image/WebP",t=new window.Blob([f],{type:e}),u=i.match(/.*\/(.+?)(\?.*)?$/);u.length>1&&(t.name=u[1]);r.resolve(t)},function(n){r.reject(n)}),r.promise};this.setDefaults=function(n){this.defaults=n||{}};this.defaults={};this.version=ngFileUpload.version}]);ngFileUpload.service("Upload",["$parse","$timeout","$compile","$q","UploadExif",function(n,t,i,r,u){function o(n,t,i){var u=[f.emptyPromise()];return angular.forEach(n,function(r,e){0===r.type.indexOf("image/jpeg")&&f.attrGetter("ngfFixOrientation",t,i,{$file:r})&&u.push(f.happyPromise(f.applyExifRotation(r),r).then(function(t){n.splice(e,1,t)}))}),r.all(u)}function s(n,t,i,u){var o=f.attrGetter("ngfResize",t,i),s;return!o||!f.isResizeSupported()||!n.length?f.emptyPromise():o instanceof Function?(s=r.defer(),o(n).then(function(r){e(r,n,t,i,u).then(function(n){s.resolve(n)},function(n){s.reject(n)})},function(n){s.reject(n)})):e(o,n,t,i,u)}function e(n,t,i,u,e){function h(r,o){if(0===r.type.indexOf("image")){if(n.pattern&&!f.validatePattern(r,n.pattern))return;n.resizeIf=function(n,t){return f.attrGetter("ngfResizeIf",i,u,{$width:n,$height:t,$file:r})};var h=f.resize(r,n);s.push(h);h.then(function(n){t.splice(o,1,n)},function(n){r.$error="resize";(r.$errorMessages=r.$errorMessages||{}).resize=!0;r.$errorParam=(n?(n.message?n.message:n)+": ":"")+(r&&r.name);e.$ngfValidations.push({name:"resize",valid:!1});f.applyModelValidation(e,t)})}}for(var s=[f.emptyPromise()],o=0;o<t.length;o++)h(t[o],o);return r.all(s)}var f=u;return f.getAttrWithDefaults=function(n,t){if(null!=n[t])return n[t];var i=f.defaults[t];return null==i?i:angular.isString(i)?i:JSON.stringify(i)},f.attrGetter=function(t,i,r,u){var f=this.getAttrWithDefaults(i,t);if(!r)return f;try{return u?n(f)(r,u):n(f)(r)}catch(e){if(t.search(/min|max|pattern/i))return f;throw e;}},f.shouldUpdateOn=function(n,t,i){var r=f.attrGetter("ngfModelOptions",t,i);return r&&r.updateOn?r.updateOn.split(" ").indexOf(n)>-1:!0},f.emptyPromise=function(){var n=r.defer(),i=arguments;return t(function(){n.resolve.apply(n,i)}),n.promise},f.rejectPromise=function(){var n=r.defer(),i=arguments;return t(function(){n.reject.apply(n,i)}),n.promise},f.happyPromise=function(n,i){var u=r.defer();return n.then(function(n){u.resolve(n)},function(n){t(function(){throw n;});u.resolve(i)}),u.promise},f.updateModel=function(i,r,u,e,h,c,l){function tt(o,s,h,l,a){var v,y,p;r.$$ngfPrevValidFiles=o;r.$$ngfPrevInvalidFiles=s;v=o&&o.length?o[0]:null;y=s&&s.length?s[0]:null;i&&(f.applyModelValidation(i,o),i.$setViewValue(a?v:o));e&&n(e)(u,{$files:o,$file:v,$newFiles:h,$duplicateFiles:l,$invalidFiles:s,$invalidFile:y,$event:c});p=f.attrGetter("ngfModelInvalid",r);p&&t(function(){n(p).assign(u,a?y:s)});t(function(){})}function rt(){function t(n,t){return n.name===t.name&&(n.$ngfOrigSize||n.size)===(t.$ngfOrigSize||t.size)&&n.type===t.type}function i(n){for(var i=0;i<p.length;i++)if(t(n,p[i]))return!0;for(i=0;i<d.length;i++)if(t(n,d[i]))return!0;return!1}if(h){a=[];b=[];for(var n=0;n<h.length;n++)i(h[n])?b.push(h[n]):a.push(h[n])}}function ut(n){return angular.isArray(n)?n:[n]}function it(){function n(){t(function(){tt(y?p.concat(v):v,y?d.concat(k):k,h,b,nt)},w&&w.debounce?w.debounce.change||w.debounce:0)}var e=g?a:v;s(e,r,u,i).then(function(){g?f.validate(a,y?p.length:0,i,r,u).then(function(t){v=t.validsFiles;k=t.invalidsFiles;n()}):n()},function(){for(var i,r,t=0;t<e.length;t++)i=e[t],"resize"===i.$error&&(r=v.indexOf(i),r>-1&&(v.splice(r,1),k.push(i)),n())})}var a,p,d,b=[],k=[],v=[],y,nt,g,w;p=r.$$ngfPrevValidFiles||[];d=r.$$ngfPrevInvalidFiles||[];i&&i.$modelValue&&(p=ut(i.$modelValue));y=f.attrGetter("ngfKeep",r,u);a=(h||[]).slice(0);("distinct"===y||f.attrGetter("ngfKeepDistinct",r,u)===!0)&&rt(r,u);nt=!y&&!f.attrGetter("ngfMultiple",r,u)&&!f.attrGetter("multiple",r);(!y||a.length)&&(f.attrGetter("ngfBeforeModelChange",r,u,{$files:h,$file:h&&h.length?h[0]:null,$newFiles:a,$duplicateFiles:b,$event:c}),g=f.attrGetter("ngfValidateAfterResize",r,u),w=f.attrGetter("ngfModelOptions",r,u),f.validate(a,y?p.length:0,i,r,u).then(function(n){l?tt(a,[],h,b,nt):(w&&w.allowInvalid||g?v=a:(v=n.validFiles,k=n.invalidFiles),f.attrGetter("ngfFixOrientation",r,u)&&f.isExifSupported()?o(v,r,u).then(function(){it()}):it())}))},f}]);ngFileUpload.directive("ngfSelect",["$parse","$timeout","$compile","Upload",function(n,t,i,r){function f(n){var t=n.match(/Android[^\d]*(\d+)\.(\d+)/),i;return t&&t.length>2?(i=r.defaults.androidFixMinorVersion||4,parseInt(t[1])<4||parseInt(t[1])===i&&parseInt(t[2])<i):-1===n.indexOf("Chrome")&&/.*Windows.*Safari.*/.test(n)}function e(n,t,i,r,e,o,s,h){function v(){return"input"===t[0].tagName.toLowerCase()&&i.type&&"file"===i.type.toLowerCase()}function p(){return l("ngfChange")||l("ngfSelect")}function y(t){var u,f,e;if(h.shouldUpdateOn("change",i,n)){if(u=t.__files_||t.target&&t.target.files,f=[],!u)return;for(e=0;e<u.length;e++)f.push(u[e]);h.updateModel(r,i,n,p(),f.length?f:null,t)}}function g(n,r){function e(t){n.attr("id","ngf-"+t);r.attr("id","ngf-label-"+t)}for(var u,f=0;f<t[0].attributes.length;f++)u=t[0].attributes[f],"type"!==u.name&&"class"!==u.name&&"style"!==u.name&&("id"===u.name?(e(u.value),a.push(i.$observe("id",e))):n.attr(u.name,u.value||"required"!==u.name&&"multiple"!==u.name?u.value:u.name))}function nt(){if(v())return t;var i=angular.element('<input type="file">'),n=angular.element("<label>upload<\/label>");return n.css("visibility","hidden").css("position","absolute").css("overflow","hidden").css("width","0px").css("height","0px").css("border","none").css("margin","0px").css("padding","0px").attr("tabindex","-1"),g(i,n),u.push({el:t,ref:n}),document.body.appendChild(n.append(i)[0]),i}function tt(i){if(t.attr("disabled"))return!1;if(!l("ngfSelectDisabled",n)){var r=it(i);if(null!=r)return r;w(i);try{v()||document.body.contains(c[0])||(u.push({el:t,ref:c.parent()}),document.body.appendChild(c.parent()[0]),c.bind("change",y))}catch(e){}return f(navigator.userAgent)?setTimeout(function(){c[0].click()},0):c[0].click(),!1}}function it(n){var t=n.changedTouches||n.originalEvent&&n.originalEvent.changedTouches,i,r;if(t)return"touchstart"===n.type?(d=t[0].clientX,k=t[0].clientY,!0):"touchend"===n.type&&(i=t[0].clientX,r=t[0].clientY,Math.abs(i-d)>20||Math.abs(r-k)>20)?(n.stopPropagation(),n.preventDefault(),!1):!0}function w(t){h.shouldUpdateOn("click",i,n)&&c.val()&&(c.val(null),h.updateModel(r,i,n,p(),null,t,!0))}function b(n){if(c&&!c.attr("__ngf_ie10_Fix_")){if(!c[0].parentNode)return void(c=null);n.preventDefault();n.stopPropagation();c.unbind("click");var t=c.clone();return c.replaceWith(t),c=t,c.attr("__ngf_ie10_Fix_","true"),c.bind("change",y),c.bind("click",b),c[0].click(),!1}c.removeAttr("__ngf_ie10_Fix_")}var l=function(n,t){return h.attrGetter(n,i,t)},a;h.registerModelChangeValidator(r,i,n);a=[];l("ngfMultiple")&&a.push(n.$watch(l("ngfMultiple"),function(){c.attr("multiple",l("ngfMultiple",n))}));l("ngfCapture")&&a.push(n.$watch(l("ngfCapture"),function(){c.attr("capture",l("ngfCapture",n))}));l("ngfAccept")&&a.push(n.$watch(l("ngfAccept"),function(){c.attr("accept",l("ngfAccept",n))}));a.push(i.$observe("accept",function(){c.attr("accept",l("accept"))}));var k=0,d=0,c=t;v()||(c=nt());c.bind("change",y);v()?t.bind("click",w):t.bind("click touchstart touchend",tt);-1!==navigator.appVersion.indexOf("MSIE 10")&&c.bind("click",b);r&&r.$formatters.push(function(n){return(null==n||0===n.length)&&c.val()&&c.val(null),n});n.$on("$destroy",function(){v()||c.parent().remove();angular.forEach(a,function(n){n()})});o(function(){for(var t,n=0;n<u.length;n++)t=u[n],document.body.contains(t.el[0])||(u.splice(n,1),t.ref.remove())});window.FileAPI&&window.FileAPI.ngfFixIE&&window.FileAPI.ngfFixIE(t,c,y)}var u=[];return{restrict:"AEC",require:"?ngModel",link:function(u,f,o,s){e(u,f,o,s,n,t,i,r)}}}]),function(){function t(n){return"img"===n.tagName.toLowerCase()?"image":"audio"===n.tagName.toLowerCase()?"audio":"video"===n.tagName.toLowerCase()?"video":/./}function n(n,i,r,u,f,e,o,s){function h(t){var e=n.attrGetter("ngfNoObjectUrl",f,r);n.dataUrl(t,e)["finally"](function(){i(function(){var n=(e?t.$ngfDataUrl:t.$ngfBlobUrl)||t.$ngfDataUrl;s?u.css("background-image","url('"+(n||"")+"')"):u.attr("src",n);n?u.removeClass("ng-hide"):u.addClass("ng-hide")})})}i(function(){var i=r.$watch(f[e],function(i){var c=o,l;return"ngfThumbnail"===e&&(c||(c={width:u[0].naturalWidth||u[0].clientWidth,height:u[0].naturalHeight||u[0].clientHeight}),0===c.width&&window.getComputedStyle)&&(l=getComputedStyle(u[0]),l.width&&l.width.indexOf("px")>-1&&l.height&&l.height.indexOf("px")>-1&&(c={width:parseInt(l.width.slice(0,-2)),height:parseInt(l.height.slice(0,-2))})),angular.isString(i)?(u.removeClass("ng-hide"),s?u.css("background-image","url('"+i+"')"):u.attr("src",i)):void(!i||!i.type||0!==i.type.search(t(u[0]))||s&&0!==i.type.indexOf("image")?u.addClass("ng-hide"):c&&n.isResizeSupported()?(c.resizeIf=function(t,u){return n.attrGetter("ngfResizeIf",f,r,{$width:t,$height:u,$file:i})},n.resize(i,c).then(function(n){h(n)},function(n){throw n;})):h(i))});r.$on("$destroy",function(){i()})})}ngFileUpload.service("UploadDataUrl",["UploadBase","$timeout","$q",function(n,t,i){var r=n;return r.base64DataUrl=function(n){if(angular.isArray(n)){var t=i.defer(),u=0;return angular.forEach(n,function(i){r.dataUrl(i,!0)["finally"](function(){if(u++,u===n.length){var i=[];angular.forEach(n,function(n){i.push(n.$ngfDataUrl)});t.resolve(i,n)}})}),t.promise}return r.dataUrl(n,!0)},r.dataUrl=function(n,u){var e,f;return n?u&&null!=n.$ngfDataUrl||!u&&null!=n.$ngfBlobUrl?r.emptyPromise(u?n.$ngfDataUrl:n.$ngfBlobUrl,n):(e=u?n.$$ngfDataUrlPromise:n.$$ngfBlobUrlPromise,e)?e:(f=i.defer(),t(function(){var i,e,o;if(window.FileReader&&n&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 8")||n.size<2e4)&&(!window.FileAPI||-1===navigator.userAgent.indexOf("MSIE 9")||n.size<4e6))if(i=window.URL||window.webkitURL,i&&i.createObjectURL&&!u){try{e=i.createObjectURL(n)}catch(s){return void t(function(){n.$ngfBlobUrl="";f.reject()})}t(function(){var u,o,t;if(n.$ngfBlobUrl=e,e)for(f.resolve(e,n),r.blobUrls=r.blobUrls||[],r.blobUrlsTotalSize=r.blobUrlsTotalSize||0,r.blobUrls.push({url:e,size:n.size}),r.blobUrlsTotalSize+=n.size||0,u=r.defaults.blobUrlsMaxMemory||268435456,o=r.defaults.blobUrlsMaxQueueSize||200;(r.blobUrlsTotalSize>u||r.blobUrls.length>o)&&r.blobUrls.length>1;)t=r.blobUrls.splice(0,1)[0],i.revokeObjectURL(t.url),r.blobUrlsTotalSize-=t.size})}else o=new FileReader,o.onload=function(i){t(function(){n.$ngfDataUrl=i.target.result;f.resolve(i.target.result,n);t(function(){delete n.$ngfDataUrl},1e3)})},o.onerror=function(){t(function(){n.$ngfDataUrl="";f.reject()})},o.readAsDataURL(n);else t(function(){n[u?"$ngfDataUrl":"$ngfBlobUrl"]="";f.reject()})}),e=u?n.$$ngfDataUrlPromise=f.promise:n.$$ngfBlobUrlPromise=f.promise,e["finally"](function(){delete n[u?"$$ngfDataUrlPromise":"$$ngfBlobUrlPromise"]}),e):r.emptyPromise(n,n)},r}]);ngFileUpload.directive("ngfSrc",["Upload","$timeout",function(t,i){return{restrict:"AE",link:function(r,u,f){n(t,i,r,u,f,"ngfSrc",t.attrGetter("ngfResize",f,r),!1)}}}]);ngFileUpload.directive("ngfBackground",["Upload","$timeout",function(t,i){return{restrict:"AE",link:function(r,u,f){n(t,i,r,u,f,"ngfBackground",t.attrGetter("ngfResize",f,r),!0)}}}]);ngFileUpload.directive("ngfThumbnail",["Upload","$timeout",function(t,i){return{restrict:"AE",link:function(r,u,f){var e=t.attrGetter("ngfSize",f,r);n(t,i,r,u,f,"ngfThumbnail",e,t.attrGetter("ngfAsBackground",f,r))}}}]);ngFileUpload.config(["$compileProvider",function(n){n.imgSrcSanitizationWhitelist&&n.imgSrcSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/);n.aHrefSanitizationWhitelist&&n.aHrefSanitizationWhitelist(/^\s*(https?|ftp|mailto|tel|webcal|local|file|data|blob):/)}]);ngFileUpload.filter("ngfDataUrl",["UploadDataUrl","$sce",function(n,t){return function(i,r,u){if(angular.isString(i))return t.trustAsResourceUrl(i);var f=i&&((r?i.$ngfDataUrl:i.$ngfBlobUrl)||i.$ngfDataUrl);return i&&!f?(!i.$ngfDataUrlFilterInProgress&&angular.isObject(i)&&(i.$ngfDataUrlFilterInProgress=!0,n.dataUrl(i,r)),""):(i&&delete i.$ngfDataUrlFilterInProgress,(i&&f?u?t.trustAsResourceUrl(f):f:i)||"")}}])}();ngFileUpload.service("UploadValidate",["UploadDataUrl","$q","$timeout",function(n,t,i){function u(n){var t="",f=[],i,r,e;if(n.length>2&&"/"===n[0]&&"/"===n[n.length-1])t=n.substring(1,n.length-1);else if(i=n.split(","),i.length>1)for(r=0;r<i.length;r++)e=u(i[r]),e.regexp?(t+="("+e.regexp+")",r<i.length-1&&(t+="|")):f=f.concat(e.excludes);else 0===n.indexOf("!")?f.push("^((?!"+u(n.substring(1)).regexp+").)*$"):(0===n.indexOf(".")&&(n="*"+n),t="^"+n.replace(new RegExp("[.\\\\+*?\\[\\^\\]$(){}=!<>|:\\-]","g"),"\\$&")+"$",t=t.replace(/\\\*/g,".*").replace(/\\\?/g,"."));return{regexp:t,excludes:f}}function f(n,t){null==t||n.$dirty||(n.$setDirty?n.$setDirty():n.$dirty=!0)}var r=n;return r.validatePattern=function(n,t){var i,r,f,e,o;if(!t)return!0;for(i=u(t),r=!0,i.regexp&&i.regexp.length&&(f=new RegExp(i.regexp,"i"),r=null!=n.type&&f.test(n.type)||null!=n.name&&f.test(n.name)),e=i.excludes.length;e--;)o=new RegExp(i.excludes[e],"i"),r=r&&(null==n.type||o.test(n.type))&&(null==n.name||o.test(n.name));return r},r.ratioToFloat=function(n){var t=n.toString(),i=t.search(/[x:]/i);return i>-1?parseFloat(t.substring(0,i))/parseFloat(t.substring(i+1)):parseFloat(t)},r.registerModelChangeValidator=function(n,t,i){n&&n.$formatters.push(function(u){if(n.$dirty){var f=u;u&&!angular.isArray(u)&&(f=[u]);r.validate(f,0,n,t,i).then(function(){r.applyModelValidation(n,f)})}return u})},r.applyModelValidation=function(n,t){f(n,t);angular.forEach(n.$ngfValidations,function(t){n.$setValidity(t.name,t.valid)})},r.getValidationAttr=function(n,t,i,u,f){var s="ngf"+i[0].toUpperCase()+i.substr(1),e=r.attrGetter(s,n,t,{$file:f}),o;return null==e&&(e=r.attrGetter("ngfValidate",n,t,{$file:f}))&&(o=(u||i).split("."),e=e[o[0]],o.length>1&&(e=e&&e[o[1]])),e},r.validate=function(n,i,u,f,e){function c(t,i,o){var c,a,s,v;if(n){for(c=n.length,a=null;c--;)s=n[c],s&&(v=r.getValidationAttr(f,e,t,i,s),null!=v&&(o(s,v,c)||(-1===p.indexOf(t)?(s.$error=t,(s.$errorMessages=s.$errorMessages||{})[t]=!0,s.$errorParam=v,-1===h.indexOf(s)&&h.push(s),l||n.splice(c,1),a=!1):n.splice(c,1))));null!==a&&u.$ngfValidations.push({name:t,valid:a})}}function s(i,o,s,c,v){function y(t,r,u){function f(f){var e,o;f()?-1===p.indexOf(i)?((r.$error=i,(r.$errorMessages=r.$errorMessages||{})[i]=!0,r.$errorParam=u,-1===h.indexOf(r)&&h.push(r),l)||(e=n.indexOf(r),e>-1&&n.splice(e,1)),t.resolve(!1)):(o=n.indexOf(r),o>-1&&n.splice(o,1),t.resolve(!0)):t.resolve(!0)}null!=u?c(r,u).then(function(n){f(function(){return!v(n,u)})},function(){f(function(){return a("ngfValidateForce",{$file:r})})}):t.resolve(!0)}var b=[r.emptyPromise(!0)],w;return n&&(n=void 0===n.length?[n]:n,angular.forEach(n,function(n){var u=t.defer();return b.push(u.promise),!s||null!=n.type&&0===n.type.search(s)?void("dimensions"===i&&null!=r.attrGetter("ngfDimensions",f)?r.imageDimensions(n).then(function(t){y(u,n,a("ngfDimensions",{$file:n,$width:t.width,$height:t.height}))},function(){u.resolve(!1)}):"duration"===i&&null!=r.attrGetter("ngfDuration",f)?r.mediaDuration(n).then(function(t){y(u,n,a("ngfDuration",{$file:n,$duration:t}))},function(){u.resolve(!1)}):y(u,n,r.getValidationAttr(f,e,i,o,n))):void u.resolve(!0)})),w=t.defer(),t.all(b).then(function(n){for(var t=!0,r=0;r<n.length;r++)if(!n[r]){t=!1;break}u.$ngfValidations.push({name:i,valid:t});w.resolve(t)}),w.promise}var h,v,y,o;u=u||{};u.$ngfValidations=u.$ngfValidations||[];angular.forEach(u.$ngfValidations,function(n){n.valid=!0});var a=function(n,t){return r.attrGetter(n,f,e,t)},p=(r.attrGetter("ngfIgnoreInvalid",f,e)||"").split(" "),l=r.attrGetter("ngfRunAllValidations",f,e);return null==n||0===n.length?r.emptyPromise({validFiles:n,invalidFiles:[]}):(n=void 0===n.length?[n]:n.slice(0),h=[],c("pattern",null,r.validatePattern),c("minSize","size.min",function(n,t){return n.size+.1>=r.translateScalars(t)}),c("maxSize","size.max",function(n,t){return n.size-.1<=r.translateScalars(t)}),v=0,c("maxTotalSize",null,function(t,i){return v+=t.size,v>r.translateScalars(i)?(n.splice(0,n.length),!1):!0}),c("validateFn",null,function(n,t){return t===!0||null===t||""===t}),!n.length)?r.emptyPromise({validFiles:[],invalidFiles:h}):(y=t.defer(),o=[],o.push(s("maxHeight","height.max",/image/,this.imageDimensions,function(n,t){return n.height<=t})),o.push(s("minHeight","height.min",/image/,this.imageDimensions,function(n,t){return n.height>=t})),o.push(s("maxWidth","width.max",/image/,this.imageDimensions,function(n,t){return n.width<=t})),o.push(s("minWidth","width.min",/image/,this.imageDimensions,function(n,t){return n.width>=t})),o.push(s("dimensions",null,/image/,function(n,t){return r.emptyPromise(t)},function(n){return n})),o.push(s("ratio",null,/image/,this.imageDimensions,function(n,t){for(var u=t.toString().split(","),f=!1,i=0;i<u.length;i++)Math.abs(n.width/n.height-r.ratioToFloat(u[i]))<.01&&(f=!0);return f})),o.push(s("maxRatio","ratio.max",/image/,this.imageDimensions,function(n,t){return n.width/n.height-r.ratioToFloat(t)<.0001})),o.push(s("minRatio","ratio.min",/image/,this.imageDimensions,function(n,t){return n.width/n.height-r.ratioToFloat(t)>-.0001})),o.push(s("maxDuration","duration.max",/audio|video/,this.mediaDuration,function(n,t){return n<=r.translateScalars(t)})),o.push(s("minDuration","duration.min",/audio|video/,this.mediaDuration,function(n,t){return n>=r.translateScalars(t)})),o.push(s("duration",null,/audio|video/,function(n,t){return r.emptyPromise(t)},function(n){return n})),o.push(s("validateAsyncFn",null,null,function(n,t){return t},function(n){return n===!0||null===n||""===n})),t.all(o).then(function(){var t,r;if(l)for(t=0;t<n.length;t++)r=n[t],r.$error&&n.splice(t--,1);l=!1;c("maxFiles",null,function(n,t,r){return t>i+r});y.resolve({validFiles:n,invalidFiles:h})}),y.promise)},r.imageDimensions=function(n){var f,u;return n.$ngfWidth&&n.$ngfHeight?(f=t.defer(),i(function(){f.resolve({width:n.$ngfWidth,height:n.$ngfHeight})}),f.promise):n.$ngfDimensionPromise?n.$ngfDimensionPromise:(u=t.defer(),i(function(){return 0!==n.type.indexOf("image")?void u.reject("not image"):void r.dataUrl(n).then(function(t){function f(){var t=r[0].naturalWidth||r[0].clientWidth,i=r[0].naturalHeight||r[0].clientHeight;r.remove();n.$ngfWidth=t;n.$ngfHeight=i;u.resolve({width:t,height:i})}function e(){r.remove();u.reject("load error")}function o(){i(function(){r[0].parentNode&&(r[0].clientWidth?f():s++>10?e():o())},1e3)}var r=angular.element("<img>").attr("src",t).css("visibility","hidden").css("position","fixed").css("max-width","none !important").css("max-height","none !important"),s;r.on("load",f);r.on("error",e);s=0;o();angular.element(document.getElementsByTagName("body")[0]).append(r)},function(){u.reject("load error")})}),n.$ngfDimensionPromise=u.promise,n.$ngfDimensionPromise["finally"](function(){delete n.$ngfDimensionPromise}),n.$ngfDimensionPromise)},r.mediaDuration=function(n){var f,u;return n.$ngfDuration?(f=t.defer(),i(function(){f.resolve(n.$ngfDuration)}),f.promise):n.$ngfDurationPromise?n.$ngfDurationPromise:(u=t.defer(),i(function(){return 0!==n.type.indexOf("audio")&&0!==n.type.indexOf("video")?void u.reject("not media"):void r.dataUrl(n).then(function(t){function f(){var t=r[0].duration;n.$ngfDuration=t;r.remove();u.resolve(t)}function e(){r.remove();u.reject("load error")}function o(){i(function(){r[0].parentNode&&(r[0].duration?f():s>10?e():o())},1e3)}var r=angular.element(0===n.type.indexOf("audio")?"<audio>":"<video>").attr("src",t).css("visibility","none").css("position","fixed"),s;r.on("loadedmetadata",f);r.on("error",e);s=0;o();angular.element(document.body).append(r)},function(){u.reject("load error")})}),n.$ngfDurationPromise=u.promise,n.$ngfDurationPromise["finally"](function(){delete n.$ngfDurationPromise}),n.$ngfDurationPromise)},r}]);ngFileUpload.service("UploadResize",["UploadValidate","$q",function(n,t){var i=n,r=function(n,t,i,r,u){var f=u?Math.max(i/n,r/t):Math.min(i/n,r/t);return{width:n*f,height:t*f,marginX:n*f-i,marginY:t*f-r}},u=function(n,u,f,e,o,s,h,c){var a=t.defer(),v=document.createElement("canvas"),l=document.createElement("img");return l.setAttribute("style","visibility:hidden;position:fixed;z-index:-100000"),document.body.appendChild(l),l.onload=function(){var t=l.width,y=l.height,p,w,n,b;if(l.parentNode.removeChild(l),null!=c&&c(t,y)===!1)return void a.reject("resizeIf");try{s&&(p=i.ratioToFloat(s),w=t/y,p>w?(u=t,f=u/p):(f=y,u=f*p));u||(u=t);f||(f=y);n=r(t,y,u,f,h);v.width=Math.min(n.width,u);v.height=Math.min(n.height,f);b=v.getContext("2d");b.drawImage(l,Math.min(0,-n.marginX/2),Math.min(0,-n.marginY/2),n.width,n.height);a.resolve(v.toDataURL(o||"image/WebP",e||.934))}catch(k){a.reject(k)}},l.onerror=function(){l.parentNode.removeChild(l);a.reject()},l.src=n,a.promise};return i.dataUrltoBlob=function(n,t,i){for(var u,f=n.split(","),s=f[0].match(/:(.*?);/)[1],e=atob(f[1]),r=e.length,o=new Uint8Array(r);r--;)o[r]=e.charCodeAt(r);return u=new window.Blob([o],{type:s}),u.name=t,u.$ngfOrigSize=i,u},i.isResizeSupported=function(){var n=document.createElement("canvas");return window.atob&&n.getContext&&n.getContext("2d")&&window.Blob},i.isResizeSupported()&&Object.defineProperty(window.Blob.prototype,"name",{get:function(){return this.$ngfName},set:function(n){this.$ngfName=n},configurable:!0}),i.resize=function(n,r){if(0!==n.type.indexOf("image"))return i.emptyPromise(n);var f=t.defer();return i.dataUrl(n,!0).then(function(t){u(t,r.width,r.height,r.quality,r.type||n.type,r.ratio,r.centerCrop,r.resizeIf).then(function(u){if("image/jpeg"===n.type&&r.restoreExif!==!1)try{u=i.restoreExif(t,u)}catch(e){setTimeout(function(){throw e;},1)}try{var o=i.dataUrltoBlob(u,n.name,n.size);f.resolve(o)}catch(e){f.reject(e)}},function(t){"resizeIf"===t&&f.resolve(n);f.reject(t)})},function(n){f.reject(n)}),f.promise},i}]),function(){function t(t,i,r,u,f,e,o,s,h,c){function v(){return i.attr("disabled")||l("ngfDropDisabled",t)}function w(n,i,r){if(n){var u;try{u=n&&n.getData&&n.getData("text/html")}catch(f){}tt(n.items,n.files,l("ngfAllowDir",t)!==!1,l("multiple")||l("ngfMultiple",t)).then(function(n){n.length?b(n,i):g(r,u).then(function(n){b(n,i)})})}}function b(n,i){s.updateModel(u,r,t,l("ngfChange")||l("ngfDrop"),n,i)}function g(n,i){var u,e,o,f;return!s.shouldUpdateOn(n,r,t)||"string"!=typeof i?s.rejectPromise([]):(u=[],i.replace(/<(img src|img [^>]* src) *=\"([^\"]*)\"/gi,function(n,t,i){u.push(i)}),e=[],o=[],u.length)?(angular.forEach(u,function(n){e.push(s.urlToBlob(n).then(function(n){o.push(n)}))}),f=c.defer(),c.all(e).then(function(){f.resolve(o)},function(n){f.reject(n)}),f.promise):s.emptyPromise()}function nt(n,t,i,r){var u=l("ngfDragOverClass",n,{$event:i}),f="dragover",e,h,o;if(angular.isString(u))f=u;else if(u&&(u.delay&&(d=u.delay),u.accept||u.reject))if(e=i.dataTransfer.items,null!=e&&e.length)for(h=u.pattern||l("ngfPattern",n,{$event:i}),o=e.length;o--;){if(!s.validatePattern(e[o],h)){f=u.reject;break}f=u.accept}else f=u.accept;r(f)}function tt(n,i,u,f){function nt(n,t){var i=c.defer(),u,r;if(null!=n)if(n.isDirectory){u=[s.emptyPromise()];g&&(r={type:"directory"},r.name=r.path=(t||"")+n.name,e.push(r));var h=n.createReader(),f=[],o=function(){h.readEntries(function(r){try{r.length?(f=f.concat(Array.prototype.slice.call(r||[],0)),o()):(angular.forEach(f.slice(0),function(i){e.length<=y&&a>=v&&u.push(nt(i,(t?t:"")+n.name+"/"))}),c.all(u).then(function(){i.resolve()},function(n){i.reject(n)}))}catch(s){i.reject(s)}},function(n){i.reject(n)})};o()}else n.file(function(n){try{n.path=(t?t:"")+n.name;g&&(n=s.rename(n,n.path));e.push(n);v+=n.size;i.resolve()}catch(r){i.reject(r)}},function(n){i.reject(n)});return i.promise}var y=s.getValidationAttr(r,t,"maxFiles"),a,h,b,k,d,p,w;null==y&&(y=Number.MAX_VALUE);a=s.getValidationAttr(r,t,"maxTotalSize");null==a&&(a=Number.MAX_VALUE);var g=l("ngfIncludeDir",t),e=[],v=0,tt=[s.emptyPromise()];if(n&&n.length>0&&"file:"!==o.location.protocol)for(h=0;h<n.length;h++){if(n[h].webkitGetAsEntry&&n[h].webkitGetAsEntry()&&n[h].webkitGetAsEntry().isDirectory){if(b=n[h].webkitGetAsEntry(),b.isDirectory&&!u)continue;null!=b&&tt.push(nt(b))}else k=n[h].getAsFile(),null!=k&&(e.push(k),v+=k.size);if(e.length>y||v>a||!f&&e.length>0)break}else if(null!=i)for(d=0;d<i.length;d++)if(p=i.item(d),(p.type||p.size>0)&&(e.push(p),v+=p.size),e.length>y||v>a||!f&&e.length>0)break;return w=c.defer(),c.all(tt).then(function(){if(f||g||!e.length)w.resolve(e);else{for(var n=0;e[n]&&"directory"===e[n].type;)n++;w.resolve([e[n]])}},function(n){w.reject(n)}),w.promise}var p=n(),l=function(n,t,i){return s.attrGetter(n,r,t,i)};if(l("dropAvailable")&&e(function(){t[l("dropAvailable")]?t[l("dropAvailable")].value=p:t[l("dropAvailable")]=p}),!p)return void(l("ngfHideOnDropNotAvailable",t)===!0&&i.css("display","none"));null==l("ngfSelect")&&s.registerModelChangeValidator(u,r,t);var a,k=null,y=f(l("ngfStopPropagation")),d=1;i[0].addEventListener("dragover",function(n){if(!v()&&s.shouldUpdateOn("drop",r,t)){if(n.preventDefault(),y(t)&&n.stopPropagation(),navigator.userAgent.indexOf("Chrome")>-1){var u=n.dataTransfer.effectAllowed;n.dataTransfer.dropEffect="move"===u||"linkMove"===u?"move":"copy"}e.cancel(k);a||(a="C",nt(t,r,n,function(r){a=r;i.addClass(a);l("ngfDrag",t,{$isDragging:!0,$class:a,$event:n})}))}},!1);i[0].addEventListener("dragenter",function(n){!v()&&s.shouldUpdateOn("drop",r,t)&&(n.preventDefault(),y(t)&&n.stopPropagation())},!1);i[0].addEventListener("dragleave",function(n){!v()&&s.shouldUpdateOn("drop",r,t)&&(n.preventDefault(),y(t)&&n.stopPropagation(),k=e(function(){a&&i.removeClass(a);a=null;l("ngfDrag",t,{$isDragging:!1,$event:n})},d||100))},!1);i[0].addEventListener("drop",function(n){!v()&&s.shouldUpdateOn("drop",r,t)&&(n.preventDefault(),y(t)&&n.stopPropagation(),a&&i.removeClass(a),a=null,w(n.dataTransfer,n,"dropUrl"))},!1);i[0].addEventListener("paste",function(n){navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&l("ngfEnableFirefoxPaste",t)&&n.preventDefault();!v()&&s.shouldUpdateOn("paste",r,t)&&w(n.clipboardData||n.originalEvent.clipboardData,n,"pasteUrl")},!1);navigator.userAgent.toLowerCase().indexOf("firefox")>-1&&l("ngfEnableFirefoxPaste",t)&&(i.attr("contenteditable",!0),i.on("keypress",function(n){n.metaKey||n.ctrlKey||n.preventDefault()}))}function n(){var n=document.createElement("div");return"draggable"in n&&"ondrop"in n&&!/Edge\/12./i.test(navigator.userAgent)}ngFileUpload.directive("ngfDrop",["$parse","$timeout","$window","Upload","$http","$q",function(n,i,r,u,f,e){return{restrict:"AEC",require:"?ngModel",link:function(o,s,h,c){t(o,s,h,c,n,i,r,u,f,e)}}}]);ngFileUpload.directive("ngfNoFileDrop",function(){return function(t,i){n()&&i.css("display","none")}});ngFileUpload.directive("ngfDropAvailable",["$parse","$timeout","Upload",function(t,i,r){return function(u,f,e){if(n()){var o=t(r.attrGetter("ngfDropAvailable",e));i(function(){o(u);o.assign&&o.assign(u,!0)})}}}])}();ngFileUpload.service("UploadExif",["UploadResize","$q",function(n,t){function r(n,t,i,r){switch(t){case 2:return n.transform(-1,0,0,1,i,0);case 3:return n.transform(-1,0,0,-1,i,r);case 4:return n.transform(1,0,0,-1,0,r);case 5:return n.transform(0,1,1,0,0,0);case 6:return n.transform(0,1,-1,0,r,0);case 7:return n.transform(0,-1,-1,0,r,i);case 8:return n.transform(0,-1,1,0,0,i)}}function u(n){for(var i="",r=new Uint8Array(n),u=r.byteLength,t=0;u>t;t++)i+=String.fromCharCode(r[t]);return window.btoa(i)}var i=n;return i.isExifSupported=function(){return window.FileReader&&(new FileReader).readAsArrayBuffer&&i.isResizeSupported()},i.readOrientation=function(n){var i=t.defer(),r=new FileReader,u=n.slice?n.slice(0,65536):n;return r.readAsArrayBuffer(u),r.onerror=function(n){return i.reject(n)},r.onload=function(n){var u={orientation:1},r=new DataView(this.result),h,t,s,f,c,e,o;if(65496!==r.getUint16(0,!1))return i.resolve(u);for(h=r.byteLength,t=2;h>t;)if(s=r.getUint16(t,!1),t+=2,65505===s){if(1165519206!==r.getUint32(t+=2,!1))return i.resolve(u);for(f=18761===r.getUint16(t+=6,!1),t+=r.getUint32(t+4,f),c=r.getUint16(t,f),t+=2,e=0;c>e;e++)if(274===r.getUint16(t+12*e,f))return o=r.getUint16(t+12*e+8,f),o>=2&&8>=o&&(r.setUint16(t+12*e+8,1,f),u.fixedArrayBuffer=n.target.result),u.orientation=o,i.resolve(u)}else{if(65280!=(65280&s))break;t+=r.getUint16(t,!1)}return i.resolve(u)},i.promise},i.applyExifRotation=function(n){if(0!==n.type.indexOf("image/jpeg"))return i.emptyPromise(n);var f=t.defer();return i.readOrientation(n).then(function(t){return t.orientation<2||t.orientation>8?f.resolve(n):void i.dataUrl(n,!0).then(function(e){var s=document.createElement("canvas"),o=document.createElement("img");o.onload=function(){var h,e,c;try{s.width=t.orientation>4?o.height:o.width;s.height=t.orientation>4?o.width:o.height;h=s.getContext("2d");r(h,t.orientation,o.width,o.height);h.drawImage(o,0,0);e=s.toDataURL(n.type||"image/WebP",.934);e=i.restoreExif(u(t.fixedArrayBuffer),e);c=i.dataUrltoBlob(e,n.name);f.resolve(c)}catch(l){return f.reject(l)}};o.onerror=function(){f.reject()};o.src=e},function(n){f.reject(n)})},function(n){f.reject(n)}),f.promise},i.restoreExif=function(n,t){var i={};return i.KEY_STR="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",i.encode64=function(n){var u,t,o,s,f,h="",i="",r="",e=0;do u=n[e++],t=n[e++],i=n[e++],o=u>>2,s=(3&u)<<4|t>>4,f=(15&t)<<2|i>>6,r=63&i,isNaN(t)?f=r=64:isNaN(i)&&(r=64),h=h+this.KEY_STR.charAt(o)+this.KEY_STR.charAt(s)+this.KEY_STR.charAt(f)+this.KEY_STR.charAt(r),u=t=i="",o=s=f=r="";while(e<n.length);return h},i.restore=function(n,t){n.match("data:image/jpeg;base64,")&&(n=n.replace("data:image/jpeg;base64,",""));var i=this.decode64(n),r=this.slice2Segments(i),u=this.exifManipulation(t,r);return"data:image/jpeg;base64,"+this.encode64(u)},i.exifManipulation=function(n,t){var i=this.getExifArray(t),r=this.insertExif(n,i);return new Uint8Array(r)},i.getExifArray=function(n){for(var t,i=0;i<n.length;i++)if(t=n[i],255===t[0]&225===t[1])return t;return[]},i.insertExif=function(n,t){var f=n.replace("data:image/jpeg;base64,",""),r=this.decode64(f),u=r.indexOf(255,3),e=r.slice(0,u),o=r.slice(u),i=e;return i=i.concat(t),i=i.concat(o)},i.slice2Segments=function(n){for(var t=0,i=[];;){if(255===n[t]&218===n[t+1])break;if(255===n[t]&216===n[t+1])t+=2;else{var u=256*n[t+2]+n[t+3],r=t+u+2,f=n.slice(t,r);i.push(f);t=r}if(t>n.length)break}return i},i.decode64=function(n){var e,o,s,r,t,h="",u="",i=0,f=[];/[^A-Za-z0-9\+\/\=]/g.exec(n)&&console.log("There were invalid base64 characters in the input text.\nValid base64 characters are A-Z, a-z, 0-9, NaNExpect errors in decoding.");n=n.replace(/[^A-Za-z0-9\+\/\=]/g,"");do s=this.KEY_STR.indexOf(n.charAt(i++)),r=this.KEY_STR.indexOf(n.charAt(i++)),t=this.KEY_STR.indexOf(n.charAt(i++)),u=this.KEY_STR.indexOf(n.charAt(i++)),e=s<<2|r>>4,o=(15&r)<<4|t>>2,h=(3&t)<<6|u,f.push(e),64!==t&&f.push(o),64!==u&&f.push(h),e=o=h="",s=r=t=u="";while(i<n.length);return f},i.restore(n,t)},i}])