').appendTo(t)},this.uiAutoHide=[],this.one("open",function(){s.uiAutoHide.length&&setTimeout(function(){s.trigger("uiautohide")},500)}),this.bind("uiautohide",function(){s.uiAutoHide.length&&s.uiAutoHide.shift()()}),e.each(this.options.ui||[],function(n,i){var a="elfinder"+i,r=s.options.uiOptions[i]||{};!s.ui[i]&&e.fn[a]&&(s.ui[i]=e("<"+(r.tag||"div")+"/>").appendTo(t),s.ui[i][a](s,r))}),t[0].elfinder=this,this.options.resizable&&e.fn.resizable&&t.resizable({resize:function(e,t){s.resize(t.size.width,t.size.height)},handles:"se",minWidth:300,minHeight:200}),this.options.width&&(U=this.options.width),this.options.height&&(M=parseInt(this.options.height)),this.options.soundPath&&(O=this.options.soundPath.replace(/\/+$/,"")+"/"),s.resize(U,M),e(document).on("click."+u,function(n){m&&!s.options.enableAlways&&!e(n.target).closest(t).length&&s.disable()}).on(p+" "+f,j),s.options.useBrowserHistory&&e(window).on("popstate."+u,function(t){var n=t.originalEvent.state&&t.originalEvent.state.thash;n&&!e.isEmptyObject(s.files())&&s.request({data:{cmd:"open",target:n,onhistory:1},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0})}),function(){var n;e(window).on("resize."+u,function(e){e.target===this&&(n&&clearTimeout(n),n=setTimeout(function(){s.trigger("resize",{width:t.width(),height:t.height()})},100))}).on("beforeunload."+u,function(n){var i,a;return t.is(":visible")&&(s.ui.notify.children().length&&-1!==e.inArray("hasNotifyDialog",s.options.windowCloseConfirm)?i=s.i18n("ntfsmth"):t.find("."+s.res("class","editing")).length&&-1!==e.inArray("editingFile",s.options.windowCloseConfirm)?i=s.i18n("editingFile"):(a=Object.keys(s.selected()).length)&&-1!==e.inArray("hasSelectedItem",s.options.windowCloseConfirm)?i=s.i18n("hasSelected",""+a):(a=Object.keys(s.clipboard()).length)&&-1!==e.inArray("hasClipboardData",s.options.windowCloseConfirm)&&(i=s.i18n("hasClipboard",""+a)),i)?(n.returnValue=i,i):void s.trigger("unload")})}(),e(window).on("message."+u,function(e){var t,n,i=e.originalEvent||null;if(i&&0===s.uploadURL.indexOf(i.origin))try{t=JSON.parse(i.data),n=t.data||null,n&&(n.error?(t.bind&&s.trigger(t.bind+"fail",n),s.error(n.error)):(n.warning&&s.error(n.warning),n.removed&&n.removed.length&&s.remove(n),n.added&&n.added.length&&s.add(n),n.changed&&n.changed.length&&s.change(n),t.bind&&(s.trigger(t.bind,n),s.trigger(t.bind+"done")),n.sync&&s.sync()))}catch(e){s.sync()}}),s.options.enableAlways?(e(window).on("focus."+u,function(e){e.target===this&&s.enable()}),N&&e(window.top).on("focus."+u,function(){!s.enable()||q&&!q.is(":visible")||setTimeout(function(){e(window).focus()},10)})):N&&e(window).on("blur."+u,function(e){m&&e.target===this&&s.disable()}),function(){var e=s.getUI("navbar"),t=s.getUI("cwd").parent();s.autoScroll={navbarUp:function(t){e.scrollTop(Math.max(0,e.scrollTop()-t))},navbarDown:function(t){e.scrollTop(e.scrollTop()+t)},cwdUp:function(e){t.scrollTop(Math.max(0,t.scrollTop()-e))},cwdDown:function(e){t.scrollTop(t.scrollTop()+e)}}}(),s.dragUpload&&!function(){var n,i,a=function(t){return"TEXTAREA"!==t.target.nodeName&&"INPUT"!==t.target.nodeName&&0===e(t.target).closest("div.ui-dialog-content").length},r="native-drag-enter",o="native-drag-disable",l="class",d=s.res(l,"navdir"),u=(s.res(l,"droppable"),s.res(l,"adroppable"),s.res(l,"navarrow"),s.res(l,"adroppable")),h=s.getUI("workzone"),p="ltr"===s.direction,f=function(){i&&clearTimeout(i),i=null};t.on("dragenter",function(e){f(),a(e)&&(e.preventDefault(),e.stopPropagation(),n=h.data("rectangle"))}).on("dragleave",function(e){f(),a(e)&&(e.preventDefault(),e.stopPropagation())}).on("dragover",function(e){var t;a(e)?(e.preventDefault(),e.stopPropagation(),e.originalEvent.dataTransfer.dropEffect="none",i||(i=setTimeout(function(){var a,r=n.top+n.height;((t=e.pageY
r)&&(a=n.cwdEdge>e.pageX?(p?"navbar":"cwd")+(t?"Up":"Down"):(p?"cwd":"navbar")+(t?"Up":"Down"),s.autoScroll[a](Math.pow(t?n.top-e.pageY:e.pageY-r,1.3))),i=null},20))):f()}).on("drop",function(e){f(),a(e)&&(e.stopPropagation(),e.preventDefault())}),t.on("dragenter",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var n,i=e(t.currentTarget),a=t.currentTarget.id||null,l=null;if(!a){l=s.cwd(),i.data(o,!1);try{e.each(t.originalEvent.dataTransfer.types,function(e,t){"elfinderfrom:"===t.substr(0,13)&&(n=t.substr(13).toLowerCase())})}catch(t){}}l&&(!l.write||n&&n===(window.location.href+l.hash).toLowerCase())?i.data(o,!0):(t.preventDefault(),t.stopPropagation(),i.data(r,!0),i.addClass(u))}}).on("dragleave",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var n=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),n.data(r)?n.data(r,!1):n.removeClass(u)}}).on("dragover",".native-droppable",function(t){if(t.originalEvent.dataTransfer){var n=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),t.originalEvent.dataTransfer.dropEffect=n.data(o)?"none":"copy",n.data(r,!1)}}).on("drop",".native-droppable",function(t){if(t.originalEvent&&t.originalEvent.dataTransfer){var n=e(t.currentTarget);t.preventDefault(),t.stopPropagation(),n.removeClass(u),c=t.currentTarget.id?n.hasClass(d)?s.navId2Hash(t.currentTarget.id):s.cwdId2Hash(t.currentTarget.id):s.cwd().hash,t.originalEvent._target=c,s.exec("upload",{dropEvt:t.originalEvent,target:c},void 0,c)}})}(),s.UA.Touch&&!function(){var n,i,a,r,o,l,d,c,h=s.getUI("navbar"),p=s.getUI("toolbar"),f=function(e){e.preventDefault()},m=function(){e(document).off("touchmove",f)},g=50;t.on("touchstart touchmove touchend",function(v){if("touchend"===v.type)return n=!1,i=!1,void m();var b,y,w,k,x,C,T=v.originalEvent.touches||[{}],z=T[0].pageX||null,A=T[0].pageY||null,I="ltr"===s.direction;null===z||null===A||"touchstart"===v.type&&T.length>1||("touchstart"===v.type?(a=t.offset(),r=t.width(),h&&(n=!1,h.is(":hidden")?(c||(c=Math.max(50,r/10)),(I?z-a.left:r+a.left-z)a.left+r-l&&y+h.scrollLeft()-5<=l,w?(c=Math.max(50,r/10),n=z):n=!1)),p&&(d=p.height(),o=a.top,A-o<(p.is(":hidden")?g:d+30)?(i=A,e(document).on("touchmove."+u,f),setTimeout(function(){m()},500)):i=!1)):(h&&n!==!1&&(b=(I?n>z:z>n)?"navhide":"navshow",k=Math.abs(n-z),("navhide"===b&&k>.6*l||k>("navhide"===b?l/3:45)&&("navshow"===b||(I?za.left+r-20)))&&(s.getUI("navbar").trigger(b,{handleW:c}),n=!1)),p&&i!==!1&&(x=p.offset().top,Math.abs(i-A)>Math.min(45,d/3)&&(C=i>A?"slideUp":"slideDown",("slideDown"===C||x+20>A)&&(p.is("slideDown"===C?":hidden":":visible")&&(p.stop(!0,!0).trigger("toggle",{duration:100,handleH:g}),m()),i=!1)))))})}(),N&&t.on("click",function(t){e(window).focus()}),this.options.enableByMouseOver&&t.on("mouseenter",function(t){N&&e(window).focus(),!s.enabled()&&s.enable()}),this.options.cssAutoLoad||this.trigger("cssloaded"),void this.trigger("init").request({data:{cmd:"open",target:s.startDir(),init:1,tree:this.ui.tree?1:0},preventDone:!0,notify:{type:"open",cnt:1,hideCnt:!0},freeze:!0}).fail(function(){s.trigger("fail").disable().lastDir(""),x={},C={},e(document).add(t).off("."+u),s.trigger=function(){}}).done(function(n){var i=t.css("z-index");i&&"auto"!==i&&"inherit"!==i?s.zIndex=i:t.parents().each(function(t,n){var i=e(n).css("z-index");return"auto"!==i&&"inherit"!==i&&(i=parseInt(i))?(s.zIndex=i,!1):void 0}),s.load().debug("api",s.api),t.trigger("resize"),P(n),s.trigger("open",n),N&&s.options.enableAlways&&e(window).focus()})):alert(this.i18n("errURL")):alert(this.i18n("errNode")):alert(this.i18n("errJqui"))};("undefined"==typeof n||n)&&(window.elFinder=i),i.prototype={uniqueid:0,res:function(e,t){return this.resources[e]&&this.resources[e][t]},OS:-1!==navigator.userAgent.indexOf("Mac")?"mac":-1!==navigator.userAgent.indexOf("Win")?"win":"other",UA:function(){var e=!document.uniqueID&&!window.opera&&!window.sidebar&&window.localStorage&&"WebkitAppearance"in document.documentElement.style;return{ltIE6:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.documentElement.style.maxHeight,ltIE7:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.querySelectorAll,ltIE8:"undefined"==typeof window.addEventListener&&"undefined"==typeof document.getElementsByClassName,IE:document.uniqueID,Firefox:window.sidebar,Opera:window.opera,Webkit:e,Chrome:e&&window.chrome,Safari:e&&!window.chrome,Mobile:"undefined"!=typeof window.orientation,Touch:"undefined"!=typeof window.ontouchstart,iOS:navigator.platform.match(/^iP(?:[ao]d|hone)/),Fullscreen:"undefined"!=typeof(document.exitFullscreen||document.webkitExitFullscreen||document.mozCancelFullScreen||document.msExitFullscreen)}}(),currentReqCmd:"",i18:{en:{translator:"",language:"English",direction:"ltr",dateFormat:"d.m.Y H:i",fancyDateFormat:"$1 H:i",messages:{}},months:["January","February","March","April","May","June","July","August","September","October","November","December"],monthsShort:["msJan","msFeb","msMar","msApr","msMay","msJun","msJul","msAug","msSep","msOct","msNov","msDec"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],daysShort:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"]},kinds:{unknown:"Unknown",directory:"Folder",symlink:"Alias","symlink-broken":"AliasBroken","application/x-empty":"TextPlain","application/postscript":"Postscript","application/vnd.ms-office":"MsOffice","application/msword":"MsWord","application/vnd.ms-word":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.document":"MsWord","application/vnd.ms-word.document.macroEnabled.12":"MsWord","application/vnd.openxmlformats-officedocument.wordprocessingml.template":"MsWord","application/vnd.ms-word.template.macroEnabled.12":"MsWord","application/vnd.ms-excel":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet":"MsExcel","application/vnd.ms-excel.sheet.macroEnabled.12":"MsExcel","application/vnd.openxmlformats-officedocument.spreadsheetml.template":"MsExcel","application/vnd.ms-excel.template.macroEnabled.12":"MsExcel","application/vnd.ms-excel.sheet.binary.macroEnabled.12":"MsExcel","application/vnd.ms-excel.addin.macroEnabled.12":"MsExcel","application/vnd.ms-powerpoint":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.presentation":"MsPP","application/vnd.ms-powerpoint.presentation.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slideshow":"MsPP","application/vnd.ms-powerpoint.slideshow.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.template":"MsPP","application/vnd.ms-powerpoint.template.macroEnabled.12":"MsPP","application/vnd.ms-powerpoint.addin.macroEnabled.12":"MsPP","application/vnd.openxmlformats-officedocument.presentationml.slide":"MsPP","application/vnd.ms-powerpoint.slide.macroEnabled.12":"MsPP","application/pdf":"PDF","application/xml":"XML","application/vnd.oasis.opendocument.text":"OO","application/vnd.oasis.opendocument.text-template":"OO","application/vnd.oasis.opendocument.text-web":"OO","application/vnd.oasis.opendocument.text-master":"OO","application/vnd.oasis.opendocument.graphics":"OO","application/vnd.oasis.opendocument.graphics-template":"OO","application/vnd.oasis.opendocument.presentation":"OO","application/vnd.oasis.opendocument.presentation-template":"OO","application/vnd.oasis.opendocument.spreadsheet":"OO","application/vnd.oasis.opendocument.spreadsheet-template":"OO","application/vnd.oasis.opendocument.chart":"OO","application/vnd.oasis.opendocument.formula":"OO","application/vnd.oasis.opendocument.database":"OO","application/vnd.oasis.opendocument.image":"OO","application/vnd.openofficeorg.extension":"OO","application/x-shockwave-flash":"AppFlash","application/flash-video":"Flash video","application/x-bittorrent":"Torrent","application/javascript":"JS","application/rtf":"RTF","application/rtfd":"RTF","application/x-font-ttf":"TTF","application/x-font-otf":"OTF","application/x-rpm":"RPM","application/x-web-config":"TextPlain","application/xhtml+xml":"HTML","application/docbook+xml":"DOCBOOK","application/x-awk":"AWK","application/x-gzip":"GZIP","application/x-bzip2":"BZIP","application/x-xz":"XZ","application/zip":"ZIP","application/x-zip":"ZIP","application/x-rar":"RAR","application/x-tar":"TAR","application/x-7z-compressed":"7z","application/x-jar":"JAR","text/plain":"TextPlain","text/x-php":"PHP","text/html":"HTML","text/javascript":"JS","text/css":"CSS","text/rtf":"RTF","text/rtfd":"RTF","text/x-c":"C","text/x-csrc":"C","text/x-chdr":"CHeader","text/x-c++":"CPP","text/x-c++src":"CPP","text/x-c++hdr":"CPPHeader","text/x-shellscript":"Shell","application/x-csh":"Shell","text/x-python":"Python","text/x-java":"Java","text/x-java-source":"Java","text/x-ruby":"Ruby","text/x-perl":"Perl","text/x-sql":"SQL","text/xml":"XML","text/x-comma-separated-values":"CSV","text/x-markdown":"Markdown","image/x-ms-bmp":"BMP","image/jpeg":"JPEG","image/gif":"GIF","image/png":"PNG","image/tiff":"TIFF","image/x-targa":"TGA","image/vnd.adobe.photoshop":"PSD","image/xbm":"XBITMAP","image/pxm":"PXM","audio/mpeg":"AudioMPEG","audio/midi":"AudioMIDI","audio/ogg":"AudioOGG","audio/mp4":"AudioMPEG4","audio/x-m4a":"AudioMPEG4","audio/wav":"AudioWAV","audio/x-mp3-playlist":"AudioPlaylist","video/x-dv":"VideoDV","video/mp4":"VideoMPEG4","video/mpeg":"VideoMPEG","video/x-msvideo":"VideoAVI","video/quicktime":"VideoMOV","video/x-ms-wmv":"VideoWM","video/x-flv":"VideoFlash","video/x-matroska":"VideoMKV","video/ogg":"VideoOGG"},rules:{defaults:function(t){return!(!t||t.added&&!e.isArray(t.added)||t.removed&&!e.isArray(t.removed)||t.changed&&!e.isArray(t.changed))},open:function(t){return t&&t.cwd&&t.files&&e.isPlainObject(t.cwd)&&e.isArray(t.files)},tree:function(t){return t&&t.tree&&e.isArray(t.tree)},parents:function(t){return t&&t.tree&&e.isArray(t.tree)},tmb:function(t){return t&&t.images&&(e.isPlainObject(t.images)||e.isArray(t.images))},upload:function(t){return t&&(e.isPlainObject(t.added)||e.isArray(t.added))},search:function(t){return t&&t.files&&e.isArray(t.files)}},commands:{},cmdsToAdd:"archive duplicate extract mkdir mkfile paste rm upload",parseUploadData:function(t){var n;if(!e.trim(t))return{error:["errResponse","errDataEmpty"]};try{n=JSON.parse(t)}catch(i){return{error:["errResponse","errDataNotJSON"]}}return this.validResponse("upload",n)?(n=this.normalize(n),n.removed=e.merge(n.removed||[],e.map(n.added||[],function(e){return e.hash})),n):{error:["errResponse"]}},iframeCnt:0,uploads:{xhrUploading:!1,checkExists:function(t,n,i){var a,r,o=e.Deferred(),s=function(){for(var e=t.length;--e>-1;)t[e]._remove=!0},l=function(){var l=[],d={},c=[],u=[],h=function(e){var n=e==u.length-1,a={title:i.i18n("cmdupload"),text:["errExists",u[e].name,"confirmRepl"],all:!n,accept:{label:"btnYes",callback:function(t){n||t?o.resolve(l,d):h(++e)}},reject:{label:"btnNo",callback:function(i){var a;if(i)for(a=u.length;e0&&delete a.reject,i.confirm(a)};return i.file(n).read?(a=e.map(t,function(e,t){return e.name?{i:t,name:e.name}:null}),r=e.map(a,function(e){return e.name}),void i.request({data:{cmd:"ls",target:n,intersect:r},notify:{type:"preupload",cnt:1,hideCnt:!0},preventFail:!0}).done(function(t){var r,l;t&&(t.error?s():i.options.overwriteUploadConfirm&&!i.UA.iOS&&i.option("uploadOverwrite",n)&&t.list&&(e.isArray(t.list)?c=t.list||[]:(r=[],c=e.map(t.list,function(e){return"string"==typeof e?e:(r=r.concat(e),null)}),r.length&&(c=c.concat(r)),d=t.list),u=e.map(a,function(t){return-1!==e.inArray(t.name,c)?t:null}),c.length&&n==i.cwd().hash&&(l=e.map(i.files(),function(e){return e.phash==n?e.name:null}),e.map(c,function(t){return-1===e.inArray(t,l)?!0:null}).length&&i.sync()))),u.length>0?h(0):o.resolve([])}).fail(function(e){s(),o.resolve([]),e&&i.error(e)})):void o.resolve([])};return i.api>=2.1&&"object"==typeof t[0]?(l(),o):o.resolve([])},checkFile:function(t,n,i){if(t.checked||"files"==t.type)return t.files;if("data"==t.type){var a,r=e.Deferred(),o=[],s=[],l=0,d=[],c=function(e){var t,i,a,r=[],u=function(e){return Array.prototype.slice.call(e||[],0)},h=n.options.folderUploadExclude[n.OS]||null;a=e.length;for(var p=0;a>p;p++)if(i=e[p])if(i.isFile)l++,i.file(function(e){h&&e.name.match(h)||(s.push(i.fullPath||""),o.push(e)),l--});else if(i.isDirectory&&n.api>=2.1){l++,d.push(i.fullPath),t=i.createReader();var r=[],f=function(){t.readEntries(function(e){if(e.length)r=r.concat(u(e)),f();else{for(var t=0;t0?(n.uploads.checkExists(a,i,n).done(function(t,u){var h,p=[];n.options.overwriteUploadConfirm&&!n.UA.iOS&&n.option("uploadOverwrite",i)&&(a=e.map(a,function(a){var r,o,s,l;return a.isDirectory&&(r=e.inArray(a.name,t),-1!==r&&(t.splice(r,1),o=n.uniqueName(a.name+n.options.backupSuffix,null,""),e.each(u,function(e,t){return a.name==t?(s=e,!1):void 0}),s||(s=n.fileByName(a.name,i).hash),n.lockfiles({files:[s]}),l=n.request({data:{cmd:"rename",target:s,name:o},notify:{type:"rename",cnt:1}}).fail(function(e){a._remove=!0,n.sync()}).always(function(){n.unlockfiles({files:[s]})}),p.push(l))),a._remove?null:a})),e.when.apply(e,p).done(function(){a.length>0?(h=setTimeout(function(){n.notify({type:"readdir",cnt:1,hideCnt:!0})},n.options.notifyDelay),c(a),setTimeout(function e(){l>0?setTimeout(e,10):(h&&clearTimeout(h),n.notify({type:"readdir",cnt:-1}),r.resolve([o,s,t,u,d]))},10)):r.reject()})}),r.promise()):r.reject()}var u=[],h=[],p=t.files[0];if("html"==t.type){var f,m=e("").append(e.parseHTML(p.replace(/ src=/gi," _elfsrc=")));e("img[_elfsrc]",m).each(function(){var t,n,i=e(this),a=i.closest("a");a&&a.attr("href")&&a.attr("href").match(/\.(?:jpe?g|gif|bmp|png)/i)&&(n=a.attr("href")),t=i.attr("_elfsrc"),t&&(n?(-1==e.inArray(n,u)&&u.push(n),-1==e.inArray(t,h)&&h.push(t)):-1==e.inArray(t,u)&&u.push(t))}),f=e("a[href]",m),f.each(function(){var t,n=function(e){var t=document.createElement("a");return t.href=e,t};e(this).text()&&(t=n(e(this).attr("href")),!t.href||1!==f.length&&t.pathname.match(/(?:\.html?|\/[^\/.]*)$/i)||-1==e.inArray(t.href,u)&&-1==e.inArray(t.href,h)&&u.push(t.href))})}else{var g,v,b;for(g=/(http[^<>"{}|\\^\[\]`\s]+)/gi;v=g.exec(p);)b=v[1].replace(/&/g,"&"),-1==e.inArray(b,u)&&u.push(b)}return u},xhr:function(t,n){var i=n?n:this,a=i.getUI(),r=new XMLHttpRequest,o=null,s=null,l=t.checked,d=t.isDataType||"data"==t.type,c=t.target||i.cwd().hash,u=t.dropEvt||null,h=-1!=i.option("uploadMaxConn",c),p=Math.min(5,Math.max(1,i.option("uploadMaxConn",c))),f=1e4,m=30,g=0,v=e.Deferred().fail(function(e){if(i.uploads.xhrUploading){setTimeout(function(){i.sync()},5e3);var t=y.length?d?y[0][0]:y[0]:{};t._cid&&(b=new FormData,y=[{_chunkfail:!0}],b.append("chunk",t._chunk),b.append("cid",t._cid),d=!1,R(y))}i.uploads.xhrUploading=!1,y=null,e&&i.error(e)}).done(function(e){r=null,i.uploads.xhrUploading=!1,y=null,e&&(i.currentReqCmd="upload",e.warning&&i.error(e.warning),e.removed&&i.remove(e),e.added&&i.add(e),e.changed&&i.change(e),i.trigger("upload",e),i.trigger("uploaddone"),e.sync&&i.sync(),e.debug&&n.debug("backend-debug",e))}).always(function(){a.off("uploadabort",U),e(window).off("unload",U),o&&clearTimeout(o),s&&clearTimeout(s),l&&!t.multiupload&&S()&&i.notify({type:"upload",cnt:-w,progress:0,size:0}),P&&z.children(".elfinder-notify-chunkmerge").length&&i.notify({type:"chunkmerge",cnt:-1})}),b=new FormData,y=t.input?t.input.files:i.uploads.checkFile(t,i,c),w=t.checked&&d?y[0].length:y.length,k=0,x=0,C=0,T=!1,z=i.ui.notify,A=!0,I=!1,S=function(){return T=T||z.children(".elfinder-notify-upload").length},U=function(){I=!0,r&&(r.quiet=!0,r.abort()),S()&&i.notify({type:"upload",cnt:-1*z.children(".elfinder-notify-upload").data("cnt"),progress:0,size:0})},M=function(e){z.children(".elfinder-notify-upload").children(".elfinder-notify-cancel")[e?"show":"hide"]()},O=function(e){return e||(e=C),setTimeout(function(){T=!0,i.notify({type:"upload",cnt:w,progress:k-x,size:e,cancel:function(){a.trigger("uploadabort"),v.resolve()}}),x=k,t.multiupload?A&&M(!0):M(A&&e>k)},i.options.notifyDelay)},D=function(){g++<=m?(S()&&x&&i.notify({type:"upload",cnt:0,progress:0,size:x}),r.quiet=!0,r.abort(),x=k=0,setTimeout(function(){I||(r.open("POST",i.uploadURL,!0),r.send(b))},f)):(a.trigger("uploadabort"),v.reject(["errAbort","errTimeout"]))},F=t.renames||null,E=t.hashes||null,P=!1;if(a.one("uploadabort",U),e(window).one("unload."+n.namespace,U),!P&&(x=k),!d&&!w)return v.reject(["errUploadNoFiles"]);r.addEventListener("error",function(){0==r.status?I?v.reject():!d&&t.files&&e.map(t.files,function(e){return e.type||e.size!==(i.UA.Safari?1802:0)?null:e}).length?(errors.push("errFolderUpload"),v.reject(["errAbort","errFolderUpload"])):t.input&&e.map(t.input.files,function(e){return e.type||e.size!==(i.UA.Safari?1802:0)?null:e}).length?v.reject(["errUploadNoFiles"]):D():(a.trigger("uploadabort"),v.reject("errConnect"))},!1),r.addEventListener("load",function(e){var n,l=r.status,c=0,u="";if(l>=400?u=l>500?"errResponse":"errConnect":r.responseText||(u=["errResponse","errDataEmpty"]),u){a.trigger("uploadabort");var h=d?y[0][0]:y[0];return v.reject(h._cid?null:u)}if(k=C,S()&&(c=k-x)&&i.notify({type:"upload",cnt:0,progress:c,size:0}),n=i.parseUploadData(r.responseText),n._chunkmerged){b=new FormData;var p=[{_chunkmerged:n._chunkmerged,_name:n._name,_mtime:n._mtime}];return P=!0,a.off("uploadabort",U),s=setTimeout(function(){i.notify({type:"chunkmerge",cnt:1})},i.options.notifyDelay),void(d?R(p,y[1]):R(p))}n._multiupload=!!t.multiupload,n.error?(i.trigger("uploadfail",n),n._chunkfailure||n._multiupload?(I=!0,i.uploads.xhrUploading=!1,o&&clearTimeout(o),z.children(".elfinder-notify-upload").length?(i.notify({type:"upload",cnt:-w,progress:0,size:0}),v.reject(n.error)):v.reject()):v.reject(n.error)):v.resolve(n)},!1),r.upload.addEventListener("loadstart",function(e){!P&&e.lengthComputable&&(k=e.loaded,g&&(k=0),C=e.total,k||(k=parseInt(.05*C)),S()&&(i.notify({type:"upload",cnt:0,progress:k-x,size:t.multiupload?0:C}),x=k))},!1),r.upload.addEventListener("progress",function(e){var n;e.lengthComputable&&!P&&r.readyState<2&&(k=e.loaded,!t.checked&&k>0&&!o&&(o=O(r._totalSize-k)),C||(C=e.total,k||(k=parseInt(.05*C))),n=k-x,S()&&n/e.total>=.05&&(i.notify({type:"upload",cnt:0,progress:n,size:0}),x=k),!t.multiupload&&k>=C&&(A=!1,M(!1)))},!1);var R=function(a,s){var f,m,g,y,k,x,C,T,z,U,D,P,R,j=0,H=1,N=[],q=0,_=w,L=0,W=[],B=(new Date).getTime().toString().substr(-9),V=Math.min((n.uplMaxSize?n.uplMaxSize:2097152)-8190,n.options.uploadMaxChunkSize),$=h?!1:"",K=function(a,r){var s,l,h=[],p=0;if(!I){for(;a.length&&h.lengthf&&!I;f++)s=d?h[f][0][0]._cid||null:h[f][0]._cid||null,R[s]?P--:n.exec("upload",{type:t.type,isDataType:d,files:h[f],checked:!0,target:c,dropEvt:u,renames:F,hashes:E,multiupload:!0},void 0,c).fail(function(e){e&&"No such command"===e&&(I=!0,n.error(["errUpload","errPerm"])),s&&(R[s]=!0)}).always(function(t){t&&t.added&&(U=e.merge(U,t.added)),P<=++D&&(n.trigger("multiupload",{added:U}),o&&clearTimeout(o),S()&&i.notify({type:"upload",cnt:-w,progress:0,size:0})),a.length?K(a,1):--l<=1&&(A=!1,M(!1))})}}(h.length<1||I)&&(I?(o&&clearTimeout(o),s&&(R[s]=!0),v.reject()):(v.resolve(),i.uploads.xhrUploading=!1))},G=function(){i.uploads.xhrUploading?setTimeout(function(){G()},100):(i.uploads.xhrUploading=!0,K(N,p))};if(!l&&(d||"files"==t.type)){for((f=n.option("uploadMaxSize",c))||(f=0),y=0;y=2.1&&("slice"in T?$="slice":"mozSlice"in T?$="mozSlice":"webkitSlice"in T&&($="webkitSlice")))}catch(J){w--,_--;continue}if(f&&m>f||!$&&n.uplMaxSize&&m>n.uplMaxSize)i.error(i.i18n("errUploadFile",T.name)+" "+i.i18n("errUploadFileSize")),w--,_--;else if(!T.type||i.uploadMimeCheck(T.type,c))if($&&m>V){for(k=0,x=V,C=-1,_=Math.floor(m/V),g=T.lastModified?Math.round(T.lastModified/1e3):0,L+=m,W[B]=0;m>=k;)z=T[$](k,x),z._chunk=T.name+"."+ ++C+"_"+_+".part",z._cid=B,z._range=k+","+z.size+","+m,z._mtime=g,W[B]++,j&&q++,"undefined"==typeof N[q]&&(N[q]=[],d&&(N[q][0]=[],N[q][1]=[])),j=V,H=1,d?(N[q][0].push(z),N[q][1].push(s[y])):N[q].push(z),k=x,x=k+V;null==z?(i.error(i.i18n("errUploadFile",T.name)+" "+i.i18n("errUploadFileSize")),w--,_--):(_+=C,j=0,H=1,q++)}else(n.uplMaxSize&&j+m>=n.uplMaxSize||H>n.uplMaxFile)&&(j=0,H=1,q++),"undefined"==typeof N[q]&&(N[q]=[],d&&(N[q][0]=[],N[q][1]=[])),d?(N[q][0].push(T),N[q][1].push(s[y])):N[q].push(T),j+=m,L+=m,H++;else i.error(i.i18n("errUploadFile",T.name)+" "+i.i18n("errUploadMime")+" ("+i.escape(T.type)+")"),w--,_--}if(0==N.length)return t.checked=!0,!1;if(N.length>1)return o=O(L),U=[],D=0,P=N.length,R=[],G(),!0;d?(a=N[0][0],s=N[0][1]):a=N[0]}return l||(n.UA.Safari&&t.files?r._totalSize=L:o=O(L)),l=!0,a.length||v.reject(["errUploadNoFiles"]),r.open("POST",i.uploadURL,!0),n.customHeaders&&e.each(n.customHeaders,function(e){r.setRequestHeader(e,this)}),n.xhrFields&&e.each(n.xhrFields,function(e){e in r&&(r[e]=this)}),b.append("cmd","upload"),b.append(i.newAPI?"target":"current",c),F&&F.length&&(e.each(F,function(e,t){b.append("renames[]",t)}),b.append("suffix",n.options.backupSuffix)),E&&e.each(E,function(e,t){b.append("hashes["+e+"]",t)}),e.each(i.options.customData,function(e,t){b.append(e,t)}),e.each(i.options.onlyMimes,function(e,t){b.append("mimes["+e+"]",t)}),e.each(a,function(e,t){t._chunkmerged?(b.append("chunk",t._chunkmerged),b.append("upload[]",t._name),b.append("mtime[]",t._mtime)):(t._chunkfail?(b.append("upload[]","chunkfail"),b.append("mimes","chunkfail")):b.append("upload[]",t),
t._chunk?(b.append("chunk",t._chunk),b.append("cid",t._cid),b.append("range",t._range),b.append("mtime[]",t._mtime)):b.append("mtime[]",t.lastModified?Math.round(t.lastModified/1e3):0)),n.UA.iOS&&b.append("overwrite",0)}),d&&e.each(s,function(e,t){b.append("upload_path[]",t)}),u&&b.append("dropWith",parseInt((u.altKey?"1":"0")+(u.ctrlKey?"1":"0")+(u.metaKey?"1":"0")+(u.shiftKey?"1":"0"),2)),r.send(b),!0};if(d)l?R(y[0],y[1]):y.done(function(t){if(F=[],w=t[0].length){if(t[4]&&t[4].length)return void n.request({data:{cmd:"mkdir",target:c,dirs:t[4]},notify:{type:"mkdir",cnt:t[4].length}}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?p=1:(p=0,v.reject(e))}).done(function(n){n.hashes&&(t[1]=e.map(t[1],function(e){return e=e.replace(/\/[^\/]*$/,""),""===e?c:n.hashes[e]}))}).always(function(e){p&&(F=t[2],E=t[3],R(t[0],t[1]))});t[1]=e.map(t[1],function(){return c}),F=t[2],E=t[3],R(t[0],t[1])}else v.reject(["errUploadNoFiles"])}).fail(function(){v.reject()});else if(y.length>0)if(null==F){var j=[],H=[],N=n.options.folderUploadExclude[n.OS]||null;e.each(y,function(t,n){var i=n.webkitRelativePath||n.relativePath||"";return i?(N&&n.name.match(N)?(n._remove=!0,i=void 0):(i=i.replace(/\/[^\/]*$/,""),i&&-1===e.inArray(i,j)&&j.push(i)),void H.push(i)):!1}),n.getUI().find("div.elfinder-upload-dialog-wrapper").elfinderdialog("close"),F=[],E={},j.length?!function(){var t=e.map(j,function(e){return-1===e.indexOf("/")?{name:e}:null}),i=[];n.uploads.checkExists(t,c,n).done(function(a,r){var o,s,l,u=[];n.options.overwriteUploadConfirm&&!n.UA.iOS&&n.option("uploadOverwrite",c)&&(i=e.map(t,function(e){return e._remove?e.name:null}),t=e.map(t,function(e){return e._remove?null:e})),i.length&&e.each(H.concat(),function(t,n){0===e.inArray(n,i)&&(y[t]._remove=!0,delete H[t])}),y=e.map(y,function(e){return e._remove?null:e}),H=e.map(H,function(e){return void 0===e?null:e}),t.length?(o=e.Deferred(),a.length?e.each(a,function(t,i){s=n.uniqueName(i+n.options.backupSuffix,null,""),e.each(r,function(e,t){return a[0]==t?(l=e,!1):void 0}),l||(l=n.fileByName(a[0],c).hash),n.lockfiles({files:[l]}),u.push(n.request({data:{cmd:"rename",target:l,name:s},notify:{type:"rename",cnt:1}}).fail(function(e){v.reject(e),n.sync()}).always(function(){n.unlockfiles({files:[l]})}))}):u.push(null),e.when.apply(e,u).done(function(){n.request({data:{cmd:"mkdir",target:c,dirs:j},notify:{type:"mkdir",cnt:j.length}}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?p=1:(p=0,v.reject(e))}).done(function(t){t.hashes&&(H=e.map(H.concat(),function(e){return""===e?c:t.hashes["/"+e]}))}).always(function(e){p&&(d=!0,R(y,H)||v.reject())})})):v.reject()})}():n.uploads.checkExists(y,c,n).done(function(t,i){n.options.overwriteUploadConfirm&&!n.UA.iOS&&n.option("uploadOverwrite",c)&&(F=t,E=i,y=e.map(y,function(e){return e._remove?null:e})),w=y.length,w>0?R(y)||v.reject():v.reject()})}else R(y)||v.reject();else v.reject();return v},iframe:function(t,n){var i,a,r,o,s=n?n:this,l=t.input?t.input:!1,d=l?!1:s.uploads.checkFile(t,s),c=e.Deferred().fail(function(e){e&&s.error(e)}),u="iframe-"+n.namespace+ ++s.iframeCnt,h=e(''),p=this.UA.IE,f=function(){o&&clearTimeout(o),r&&clearTimeout(r),a&&s.notify({type:"upload",cnt:-i}),setTimeout(function(){p&&e('').appendTo(h),h.remove(),m.remove()},100)},m=e('').on("load",function(){m.off("load").on("load",function(){f(),c.resolve()}),r=setTimeout(function(){a=!0,s.notify({type:"upload",cnt:i})},s.options.notifyDelay),s.options.iframeTimeout>0&&(o=setTimeout(function(){f(),c.reject([errors.connect,errors.timeout])},s.options.iframeTimeout)),h.submit()}),g=t.target||s.cwd().hash,v=[],b=[],y=[],w={};if(d&&d.length)e.each(d,function(e,t){h.append('')}),i=1;else{if(!(l&&e(l).is(":file")&&e(l).val()))return c.reject();n.options.overwriteUploadConfirm&&!n.UA.iOS&&n.option("uploadOverwrite",g)&&(v=l.files?l.files:[{name:e(l).val().replace(/^(?:.+[\\\/])?([^\\\/]+)$/,"$1")}],b.push(s.uploads.checkExists(v,g,s).done(function(t,n){y=t,w=n,i=e.map(v,function(e){return e._remove?null:e}).length,i!=v.length&&(i=0)}))),i=l.files?l.files.length:1,h.append(l)}return e.when.apply(e,b).done(function(){return 1>i?c.reject():(h.append('').append('').append('').append(e(l).attr("name","upload[]")),y.length>0&&(e.each(y,function(e,t){h.append('')}),h.append('')),w&&e.each(y,function(e,t){h.append('')}),e.each(s.options.onlyMimes||[],function(e,t){h.append('')}),e.each(s.options.customData,function(e,t){h.append('')}),h.appendTo("body"),void m.appendTo("body"))}),c}},one:function(e,t){var n=this,i=function(a,r){return setTimeout(function(){n.unbind(e,i)},3),t.apply(n.getListeners(a.type),arguments)};return this.bind(e,i)},localStorage:function(e,t){var n,i,a,r=window.localStorage,o="elfinder-"+e+this.id;if(e=window.location.pathname+"-elfinder-"+e+this.id,null===t)return r.removeItem(e);if(void 0===t&&!(n=r.getItem(e))&&(i=r.getItem(o))&&(t=i,r.removeItem(o)),void 0!==t){a=typeof t,"string"!==a&&"number"!==a&&(t=JSON.stringify(t));try{r.setItem(e,t)}catch(s){try{r.clear(),r.setItem(e,t)}catch(s){self.debug("error",s.toString())}}n=r.getItem(e)}if(n&&("{"===n.substr(0,1)||"["===n.substr(0,1)))try{return JSON.parse(n)}catch(s){}return n},cookie:function(t,n){var i,a,r,o,s,l;if(t="elfinder-"+t+this.id,void 0===n){if(document.cookie&&""!=document.cookie)for(r=document.cookie.split(";"),t+="=",o=0;o"),escape:function(e){return this._node.text(e).html().replace(/"/g,""").replace(/'/g,"'")},normalize:function(t){var n,i,a,r,o=this,s=function(t){var s,l;return t&&t.hash&&t.name&&t.mime?("application/x-empty"==t.mime&&(t.mime="text/plain"),t.options&&(o.optionsByHashes[t.hash]=t.options),t.phash&&"directory"!==t.mime||(t.volumeid&&(s=t.volumeid,o.isRoot(t)&&(o.volOptions[s]||(o.volOptions[s]={}),l=o.volOptions[s],t.options&&(l=e.extend(l,t.options)),t.disabled&&(l.disabled=t.disabled),t.tmbUrl&&(l.tmbUrl=t.tmbUrl),e.each(o.optionProperties,function(e,n){l[n]&&(t[n]=l[n])}),o.roots[s]=t.hash),r!==s&&(r=s,a=o.option("i18nFolderName",s))),!t.i18&&o.isRoot(t)&&(n="volume_"+t.name,i=o.i18n(!1,n),n!==i&&(t.i18=i)),a&&!t.i18&&(n="folder_"+t.name,i=o.i18n(!1,n),n!==i&&(t.i18=i)),o.leafRoots[t.hash]&&(t.dirs||(t.dirs=1),e.each(o.leafRoots[t.hash],function(){var e=o.file(this);e&&e.ts&&(t.ts||0)i?1:-1},kind:function(e,t){return i.prototype.naturalCompare(e.mime,t.mime)},date:function(e,t){var n=e.ts||e.date,i=t.ts||t.date;return n===i?0:n>i?1:-1},perm:function(e,t){var n=function(e){return(e.write?2:0)+(e.read?1:0)},i=n(e),a=n(t);return i===a?0:i>a?1:-1},mode:function(e,t){var n=e.mode||e.perm||"",a=t.mode||t.perm||"";return i.prototype.naturalCompare(n,a)},owner:function(e,t){var n=e.owner||"",a=t.owner||"";return i.prototype.naturalCompare(n,a)},group:function(e,t){var n=e.group||"",a=t.group||"";return i.prototype.naturalCompare(n,a)}},sorters:[],naturalCompare:function(e,t){var n=i.prototype.naturalCompare;return"undefined"==typeof n.loc&&(n.loc=navigator.userLanguage||navigator.browserLanguage||navigator.language||"en-US"),"undefined"==typeof n.sort&&("11".localeCompare("2",n.loc,{numeric:!0})>0?window.Intl&&window.Intl.Collator?n.sort=new Intl.Collator(n.loc,{numeric:!0}).compare:n.sort=function(e,t){return e.localeCompare(t,n.loc,{numeric:!0})}:(n.sort=function(e,t){var i,a,r=/(^-?[0-9]+(\.?[0-9]*)[df]?e?[0-9]?$|^0x[0-9a-f]+$|[0-9]+)/gi,o=/(^[ ]*|[ ]*$)/g,s=/(^([\w ]+,?[\w ]+)?[\w ]+,?[\w ]+\d+:\d+(:\d+)?[\w ]?|^\d{1,4}[\/\-]\d{1,4}[\/\-]\d{1,4}|^\w+, \w+ \d+, \d{4})/,l=/^0x[0-9a-f]+$/i,d=/^0/,c=/^[\x01\x21-\x2f\x3a-\x40\x5b-\x60\x7b-\x7e]/,u=function(e){return n.sort.insensitive&&(""+e).toLowerCase()||""+e},h=u(e).replace(o,"").replace(/^_/,"")||"",p=u(t).replace(o,"").replace(/^_/,"")||"",f=h.replace(r,"\x00$1\x00").replace(/\0$/,"").replace(/^\0/,"").split("\x00"),m=p.replace(r,"\x00$1\x00").replace(/\0$/,"").replace(/^\0/,"").split("\x00"),g=parseInt(h.match(l))||1!=f.length&&h.match(s)&&Date.parse(h),v=parseInt(p.match(l))||g&&p.match(s)&&Date.parse(p)||null,b=0;if(v){if(v>g)return-1;if(g>v)return 1}for(var y=0,w=Math.max(f.length,m.length);w>y;y++){if(i=!(f[y]||"").match(d)&&parseFloat(f[y])||f[y]||0,a=!(m[y]||"").match(d)&&parseFloat(m[y])||m[y]||0,isNaN(i)!==isNaN(a)){if(isNaN(i)&&("string"!=typeof i||!i.match(c)))return 1;if("string"!=typeof a||!a.match(c))return-1}if(0===parseInt(i,10)&&(i=0),0===parseInt(a,10)&&(a=0),typeof i!=typeof a&&(i+="",a+=""),n.sort.insensitive&&"string"==typeof i&&"string"==typeof a&&(b=i.localeCompare(a,n.loc),0!==b))return b;if(a>i)return-1;if(i>a)return 1}return 0},n.sort.insensitive=!0)),n.sort(e,t)},compare:function(e,t){var n,i=this,a=i.sortType,r="asc"==i.sortOrder,o=i.sortStickFolders,s=i.sortRules,l=s[a],d="directory"==e.mime,c="directory"==t.mime;if(o){if(d&&!c)return-1;if(!d&&c)return 1}return n=r?l(e,t):l(t,e),"name"!==a&&0===n?n=r?s.name(e,t):s.name(t,e):n},sortFiles:function(e){return e.sort(this.compare)},notify:function(t){var n,i,a,r=t.type,o=this.i18n("undefined"!=typeof t.msg?t.msg:this.messages["ntf"+r]?"ntf"+r:"ntfsmth"),s=this.ui.notify,l=s.children(".elfinder-notify-"+r),d=l.children("div.elfinder-notify-cancel").children("button"),c='',u=t.cnt,h="undefined"!=typeof t.size?parseInt(t.size):null,p="undefined"!=typeof t.progress&&t.progress>=0?t.progress:null,f=t.cancel,m="ui-state-hover",g=function(){l._esc&&e(document).off("keydown",l._esc),l.remove(),!s.children().length&&s.elfinderdialog("close")};return r?(l.length?"undefined"!=typeof t.msg&&l.children("span.elfinder-notify-msg").html(o):(l=e(c.replace(/\{type\}/g,r).replace(/\{msg\}/g,o)).appendTo(s).data("cnt",0),null!=p&&l.data({progress:0,total:0}),f&&(d=e('").hover(function(t){e(this).toggleClass(m,"mouseenter"==t.type)}),l.children("div.elfinder-notify-cancel").append(d))),n=u+parseInt(l.data("cnt")),n>0?(f&&d.length&&(e.isFunction(f)||"object"==typeof f&&f.promise)&&(l._esc=function(t){"keydown"==t.type&&t.keyCode!=e.ui.keyCode.ESCAPE||(t.preventDefault(),t.stopPropagation(),g(),f.promise?(f.xhr&&(f.xhr.quiet=!0,f.xhr.abort()),f.reject()):f(t))},d.on("click",function(e){l._esc(e)}),e(document).on("keydown."+this.namespace,l._esc)),!t.hideCnt&&l.children(".elfinder-notify-cnt").text("("+n+")"),s.is(":hidden")&&s.elfinderdialog("open",this),l.data("cnt",n),null!=p&&(i=l.data("total"))>=0&&(a=l.data("progress"))>=0&&(i+=null!=h?h:u,a+=p,null==h&&0>u&&(a+=100*u),l.data({progress:a,total:i}),null!=h&&(a*=100,i=Math.max(1,i)),p=parseInt(a/i),l.find(".elfinder-notify-progress").animate({width:(100>p?p:100)+"%"},20))):g(),this):this},confirm:function(t){var n,i=this,a=!1,r={cssClass:"elfinder-dialog-confirm",modal:!0,resizable:!1,title:this.i18n(t.title||"confirmReq"),buttons:{},close:function(){!a&&t.cancel.callback(),e(this).elfinderdialog("destroy")}},o=this.i18n("apllyAll");return r.buttons[this.i18n(t.accept.label)]=function(){t.accept.callback(!(!n||!n.prop("checked"))),a=!0,e(this).elfinderdialog("close")},t.reject&&(r.buttons[this.i18n(t.reject.label)]=function(){t.reject.callback(!(!n||!n.prop("checked"))),a=!0,e(this).elfinderdialog("close")}),t.buttons&&t.buttons.length>0&&e.each(t.buttons,function(t,o){r.buttons[i.i18n(o.label)]=function(){o.callback(!(!n||!n.prop("checked"))),a=!0,e(this).elfinderdialog("close")}}),r.buttons[this.i18n(t.cancel.label)]=function(){e(this).elfinderdialog("close")},t.all&&(r.create=function(){var t=e('');n=e(''),e(this).next().find(".ui-dialog-buttonset").prepend(t.append(e("").prepend(n)))}),t.optionsCallback&&e.isFunction(t.optionsCallback)&&t.optionsCallback(r),this.dialog(''+this.i18n(t.text),r)},uniqueName:function(e,t,n){var i,a,r=0,o="";if(e=this.i18n(e),t=t||this.cwd().hash,n="undefined"==typeof n?" ":n,(i=e.match(/^(.+)(\.[^.]+)$/))&&(o=i[2],e=i[1]),a=e+o,!this.fileByName(a,t))return a;for(;1e4>r;)if(a=e+n+ ++r+o,!this.fileByName(a,t))return a;return e+Math.random()+o},i18n:function(){var t,n,i,a,r=this,o=this.messages,s=[],l=[],d=function(e){var t;return 0===e.indexOf("#")&&(t=r.file(e.substr(1)))?t.name:e},c=0;for(arguments.length&&arguments[0]===!1&&(a=function(e){return e},c=1),t=c;t0&&s[n]&&l.push(n),a?a(s[n]):r.escape(s[n])})):i=i.get(0).outerHTML,s[t]=i);return e.map(s,function(t,n){return-1===e.inArray(n,l)?t:null}).join("
")},mime2class:function(e){var t="elfinder-cwd-icon-";return e=e.split("/"),t+e[0]+("image"!=e[0]&&e[1]?" "+t+e[1].replace(/(\.|\+)/g,"-"):"")},mime2kind:function(e){var t,n="object"==typeof e,i=n?e.mime:e;return n&&e.alias&&"symlink-broken"!=i?t="Alias":this.kinds[i]&&(t=!n||"directory"!==i||e.phash&&!e.isroot?this.kinds[i]:"Root"),t||(t=0===i.indexOf("text")?"Text":0===i.indexOf("image")?"Image":0===i.indexOf("audio")?"Audio":0===i.indexOf("video")?"Video":0===i.indexOf("application")?"App":i),this.messages["kind"+t]?this.i18n("kind"+t):i},formatDate:function(e,t){var n,i,a,r,o,s,l,d,c,u,h,p=this,t=t||e.ts,f=p.i18;return p.options.clientFormatDate&&t>0?(n=new Date(1e3*t),d=n[p.getHours](),c=d>12?d-12:d,u=n[p.getMinutes](),h=n[p.getSeconds](),r=n[p.getDate](),o=n[p.getDay](),s=n[p.getMonth]()+1,l=n[p.getFullYear](),i=t>=this.yesterday?this.fancyFormat:this.dateFormat,a=i.replace(/[a-z]/gi,function(e){switch(e){case"d":return r>9?r:"0"+r;case"j":return r;case"D":return p.i18n(f.daysShort[o]);case"l":return p.i18n(f.days[o]);case"m":return s>9?s:"0"+s;case"n":return s;case"M":return p.i18n(f.monthsShort[s-1]);case"F":return p.i18n(f.months[s-1]);case"Y":return l;case"y":return(""+l).substr(2);case"H":return d>9?d:"0"+d;case"G":return d;case"g":return c;case"h":return c>9?c:"0"+c;case"a":return d>=12?"pm":"am";case"A":return d>=12?"PM":"AM";case"i":return u>9?u:"0"+u;case"s":return h>9?h:"0"+h}return e}),t>=this.yesterday?a.replace("$1",this.i18n(t>=this.today?"Today":"Yesterday")):a):e.date?e.date.replace(/([a-z]+)\s/i,function(e,t){return p.i18n(t)+" "}):p.i18n("dateUnknown")},perms2class:function(e){var t="";return e.read||e.write?e.read?e.write||(t="elfinder-ro"):t="elfinder-wo":t="elfinder-na",e.type&&(t+=" elfinder-"+this.escape(e.type)),t},formatPermissions:function(e){var t=[];return e.read&&t.push(this.i18n("read")),e.write&&t.push(this.i18n("write")),t.length?t.join(" "+this.i18n("and")+" "):this.i18n("noaccess")},formatSize:function(e){var t=1,n="b";return"unknown"==e?this.i18n("unknown"):(e>1073741824?(t=1073741824,n="GB"):e>1048576?(t=1048576,n="MB"):e>1024&&(t=1024,n="KB"),e/=t,(e>0?t>=1048576?e.toFixed(2):Math.round(e):0)+" "+n)},formatFileMode:function(t,n){var i,a,r,o,s,l,d,c,u;if(n||(n=this.options.fileModeStyle.toLowerCase()),t=e.trim(t),t.match(/[rwxs-]{9}$/i)){if(c=t=t.substr(-9),"string"==n)return c;for(u="",r=0,i=0;7>i;i+=3)a=t.substr(i,3),o=0,a.match(/[r]/i)&&(o+=4),a.match(/[w]/i)&&(o+=2),a.match(/[xs]/i)&&(a.match(/[xs]/)&&(o+=1),a.match(/[s]/i)&&(0==i?r+=4:3==i&&(r+=2))),u+=o.toString(8);r&&(u=r.toString(8)+u)}else{if(t=parseInt(t,8),u=t?t.toString(8):"",!t||"octal"==n)return u;for(a=t.toString(8),r=0,a.length>3&&(a=a.substr(-4),r=parseInt(a.substr(0,1),8),a=a.substr(1)),s=1==(1&r),d=2==(2&r),l=4==(4&r),c="",i=0;3>i;i++)c+=4==(4&parseInt(a.substr(i,1),8))?"r":"-",c+=2==(2&parseInt(a.substr(i,1),8))?"w":"-",c+=1==(1&parseInt(a.substr(i,1),8))?0==i&&l||1==i&&d?"s":"x":"-"}return"both"==n?c+" ("+u+")":"string"==n?c:u},uploadMimeCheck:function(t,n){n=n||this.cwd().hash;var i,a,r=!0,o=this.option("uploadMime",n),s=function(n){var i=!1;return"string"==typeof n&&"all"===n.toLowerCase()?i=!0:e.isArray(n)&&n.length&&e.each(n,function(e,n){return n=n.toLowerCase(),"all"===n||0===t.indexOf(n)?(i=!0,!1):void 0}),i};return t&&e.isPlainObject(o)&&(t=t.toLowerCase(),i=s(o.allow),a=s(o.deny),"allow"===o.firstOrder?(r=!1,a||i!==!0||(r=!0)):(r=!0,a!==!0||i||(r=!1))),r},sequence:function(e){var t=e.length,n=function(t,i){return++i,e[i]?n(t.then(e[i]),i):t};return t>1?n(e[0](),0):e[0]()},reloadContents:function(t){var n,i=e.Deferred();try{n=e('