From fd4ce61a54c910da8a36f2573d35bc910d1df0a4 Mon Sep 17 00:00:00 2001 From: nao-pon Date: Sat, 7 Oct 2017 21:19:28 +0900 Subject: [PATCH] release elFinder version 2.1.29 --- css/elfinder.full.css | 2 +- css/elfinder.min.css | 2 +- js/elfinder.full.js | 4 ++-- js/elfinder.min.js | 10 +++++----- package.json | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/css/elfinder.full.css b/css/elfinder.full.css index 4474571f63..e51bbe5f3a 100644 --- a/css/elfinder.full.css +++ b/css/elfinder.full.css @@ -1,6 +1,6 @@ /*! * elFinder - file manager for web - * Version 2.1.29 (2.1-src Nightly: 664a06a) (2017-10-07) + * Version 2.1.29 (2017-10-07) * http://elfinder.org * * Copyright 2009-2017, Studio 42 diff --git a/css/elfinder.min.css b/css/elfinder.min.css index 3752adca8c..1a636462c3 100644 --- a/css/elfinder.min.css +++ b/css/elfinder.min.css @@ -1,6 +1,6 @@ /*! * elFinder - file manager for web - * Version 2.1.29 (2.1-src Nightly: 664a06a) (2017-10-07) + * Version 2.1.29 (2017-10-07) * http://elfinder.org * * Copyright 2009-2017, Studio 42 diff --git a/js/elfinder.full.js b/js/elfinder.full.js index 7f0aa402a3..ad0cc4e718 100644 --- a/js/elfinder.full.js +++ b/js/elfinder.full.js @@ -1,6 +1,6 @@ /*! * elFinder - file manager for web - * Version 2.1.29 (2.1-src Nightly: 664a06a) (2017-10-07) + * Version 2.1.29 (2017-10-07) * http://elfinder.org * * Copyright 2009-2017, Studio 42 @@ -8627,7 +8627,7 @@ if (!String.prototype.repeat) { * * @type String **/ -elFinder.prototype.version = '2.1.29 (2.1-src Nightly: 664a06a)'; +elFinder.prototype.version = '2.1.29'; diff --git a/js/elfinder.min.js b/js/elfinder.min.js index 21f03fa455..c4088a397a 100644 --- a/js/elfinder.min.js +++ b/js/elfinder.min.js @@ -1,6 +1,6 @@ /*! * elFinder - file manager for web - * Version 2.1.29 (2.1-src Nightly: 664a06a) (2017-10-07) + * Version 2.1.29 (2017-10-07) * http://elfinder.org * * Copyright 2009-2017, Studio 42 @@ -9,10 +9,10 @@ !function(e,t){if("function"==typeof define&&define.amd)define(["jquery","jquery-ui"],t);else if("undefined"!=typeof exports){var n,i;try{n=require("jquery"),i=require("jquery-ui")}catch(a){}module.exports=t(n,i)}else t(e.jQuery,e.jQuery.ui,!0)}(this,function(e,t,n){n=n||!1;var i=function(t,n,a){var o,r,s,l,c,d,p=this,u=[],h=["button"],t=e(t),f=e.extend(!0,{},e._data(t.get(0),"events")),m=e("
").append(t.contents()).attr("class",t.attr("class")||"").attr("style",t.attr("style")||""),g=t.attr("id")||"",v="elfinder-"+(g?g:Math.random().toString().substr(2,7)),b="mousedown."+v,y="keydown."+v,w="keypress."+v,x=!0,k=!0,C=["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","selectfiles","unselectfiles","dragstart","dragstop","search","searchend","viewchange"],z="",T={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,uploadOverwrite:!0,uploadMaxSize:0,jpgQuality:100,tmbCrop:!1,tmb:!1},I={},A={},S={},O=[],M={},U={},j=[],D={},E=[],F=[],P=new p.command(p),R="auto",H=400,q=null,N="./sounds/",_=e(document.createElement("audio")).hide().appendTo("body")[0],L=0,W="",$=null,B=function(n){var i,a,o,r,s,l,c={},d={};p.api>=2.1?(p.commandMap=n.options.uiCmdMap&&Object.keys(n.options.uiCmdMap).length?n.options.uiCmdMap:{},W!==JSON.stringify(p.commandMap)&&(W=JSON.stringify(p.commandMap))):p.options.sync=0,n.init?(A={},S={}):(l=z,i="elfinder-subtree-loaded "+p.res("class","navexpand"),s=p.res("class","navcollapse"),a=Object.keys(A),o=function(t){if(!A[t])return!0;var n="directory"===A[t].mime,a=A[t].phash;!(!n||c[a]||!d[a]&&e("#"+p.navHash2Id(A[t].hash)).is(":hidden")&&e("#"+p.navHash2Id(a)).next(".elfinder-navbar-subtree").children().length>100)||!n&&a===z||D[t]?n&&(d[a]=!0):(n&&!c[a]&&(c[a]=!0,e("#"+p.navHash2Id(a)).removeClass(i).next(".elfinder-navbar-subtree").empty()),G(A[t]))},r=function(){a.length&&($&&$._abort(),$=p.asyncJob(o,a,{interval:20,numPerOnce:100}))},p.trigger("filesgc").one("filesgc",function(){a=[]}),p.one("opendone",function(){l!==z&&(t.data("lazycnt")?p.one("lazydone",r):r())})),p.sorters=[],z=n.cwd.hash,V(n.files),A[z]||V([n.cwd]),p.lastDir(z),p.autoSync()},V=function(t,n){var i,a,o,r={name:!0,perm:!0,date:!0,size:!0,kind:!0},s=0===p.sorters.length,l=t.length,c=function(t){var t=t||{};p.sorters=[],e.each(p.sortRules,function(e){(r[e]||"undefined"!=typeof t[e]||"mode"===e&&"undefined"!=typeof t.perm)&&p.sorters.push(e)})},d=["sizeInfo"],u={};for(a=0;a script[src$="js/elfinder.min.js"],script[src$="js/elfinder.full.js"]:first'),t.length&&(n=e('head > link[href$="css/elfinder.min.css"],link[href$="css/elfinder.full.css"]:first').length,n||(p.cssloaded=null),a=t.attr("src").replace(/js\/[^\/]+$/,""),a.match(/^(https?\/\/|\/)/)||(i=e("head > base[href]").attr("href"))&&(a=i.replace(/\/$/,"")+"/"+a)),""!==a?p.options.baseUrl=a:(p.options.baseUrl||(p.options.baseUrl="./"),a=p.options.baseUrl),a)}(),T.dispInlineRegex=this.options.dispInlineRegex,this.options.cssAutoLoad&&!function(){var n=p.baseUrl;null===p.cssloaded&&(t.data("cssautoloadHide",e("")),e("head").append(t.data("cssautoloadHide")),p.loadCss([n+"css/elfinder.min.css",n+"css/theme.css"]),Array.isArray(p.options.cssAutoLoad)&&p.loadCss(p.options.cssAutoLoad)),p.options.cssAutoLoad=!1}(),this.optionProperties={icon:void 0,csscls:void 0,tmbUrl:void 0,uiCmdMap:{},netkey:void 0,disabled:[]},n.ui&&(this.options.ui=n.ui),n.commands&&(this.options.commands=n.commands),n.uiOptions&&(n.uiOptions.toolbar&&Array.isArray(n.uiOptions.toolbar)&&(e.isPlainObject(n.uiOptions.toolbar[n.uiOptions.toolbar.length-1])&&Object.assign(this.options.uiOptions.toolbarExtra,n.uiOptions.toolbar.pop()),this.options.uiOptions.toolbar=n.uiOptions.toolbar),n.uiOptions.toolbarExtra&&e.isPlainObject(n.uiOptions.toolbarExtra)&&Object.assign(this.options.uiOptions.toolbarExtra,n.uiOptions.toolbarExtra),n.uiOptions.cwd&&n.uiOptions.cwd.listView&&(n.uiOptions.cwd.listView.columns&&(this.options.uiOptions.cwd.listView.columns=n.uiOptions.cwd.listView.columns),n.uiOptions.cwd.listView.columnsCustomName&&(this.options.uiOptions.cwd.listView.columnsCustomName=n.uiOptions.cwd.listView.columnsCustomName))),this.options.uiOptions.toolbar.push(this.options.uiOptions.toolbarExtra),delete this.options.uiOptions.toolbarExtra,n.contextmenu&&Object.assign(this.options.contextmenu,n.contextmenu),te||this.options.enableAlways||2!==e("body").children().length||(this.options.enableAlways=!0),""===this.baseUrl&&(this.baseUrl=this.options.baseUrl?this.options.baseUrl:""),this.options.debug===!0?this.options.debug="all":Array.isArray(this.options.debug)?!function(){var t={};e.each(p.options.debug,function(){t[this]=!0}),p.options.debug=t}():this.options.debug=!1,this.noConflicts={},this.noConflict=function(){e.each(h,function(t,n){e.fn[n]&&"function"==typeof e.fn[n].noConflict&&(p.noConflicts[n]=e.fn[n].noConflict())})},this.noConflict(),this.isCORS=!1,function(){var t,i=document.createElement("a");i.href=n.url,n.urlUpload&&n.urlUpload!==n.url&&(t=document.createElement("a"),t.href=n.urlUpload),(window.location.host!==i.host||t&&window.location.host!==t.host)&&(p.isCORS=!0,e.isPlainObject(p.options.customHeaders)||(p.options.customHeaders={}),e.isPlainObject(p.options.xhrFields)||(p.options.xhrFields={}),p.options.requestType="post",p.options.customHeaders["X-Requested-With"]="XMLHttpRequest",p.options.xhrFields.withCredentials=!0)}(),this.requestType=/^(get|post)$/i.test(this.options.requestType)?this.options.requestType.toLowerCase():"get",r=Math.max(parseInt(this.options.requestMaxConn),1),this.customData=e.isPlainObject(this.options.customData)?this.options.customData:{},this.customHeaders=e.isPlainObject(this.options.customHeaders)?this.options.customHeaders:{},this.xhrFields=e.isPlainObject(this.options.xhrFields)?this.options.xhrFields:{},this.replaceXhrSend=function(){d||(d=XMLHttpRequest.prototype.send),XMLHttpRequest.prototype.send=function(){var t=this;return p.customHeaders&&e.each(p.customHeaders,function(e){t.setRequestHeader(e,this)}),p.xhrFields&&e.each(p.xhrFields,function(e){e in t&&(t[e]=this)}),d.apply(this,arguments)}},this.restoreXhrSend=function(){XMLHttpRequest.prototype.send=d},this.abortCmdsOnOpen=this.options.abortCmdsOnOpen||["tmb","parents"],this.id=g,this.navPrefix="nav"+(i.prototype.uniqueid?i.prototype.uniqueid:"")+"-",this.cwdPrefix=i.prototype.uniqueid?"cwd"+i.prototype.uniqueid+"-":"",++i.prototype.uniqueid,this.uploadURL=n.urlUpload||n.url,this.namespace=v,this.today=new Date(ee.getFullYear(),ee.getMonth(),ee.getDate()).getTime()/1e3,this.yesterday=this.today-86400,s=this.options.UTCDate?"UTC":"",this.getHours="get"+s+"Hours",this.getMinutes="get"+s+"Minutes",this.getSeconds="get"+s+"Seconds",this.getDate="get"+s+"Date",this.getDay="get"+s+"Day",this.getMonth="get"+s+"Month",this.getFullYear="get"+s+"FullYear",this.zIndex,this.searchStatus={state:0,query:"",target:"",mime:"",mixed:!1,ininc:!1},this.storage=function(){try{return"localStorage"in window&&null!==window.localStorage?(p.UA.Safari&&(window.localStorage.setItem("elfstoragecheck",1),window.localStorage.removeItem("elfstoragecheck")),p.localStorage):p.cookie}catch(e){return p.cookie}}(),this.lang=this.storage("lang")||this.options.lang,this.viewType=this.storage("view")||this.options.defaultView||"icons",this.sortType=this.storage("sortType")||this.options.sortType||"name",this.sortOrder=this.storage("sortOrder")||this.options.sortOrder||"asc",this.sortStickFolders=this.storage("sortStickFolders"),null===this.sortStickFolders?this.sortStickFolders=!!this.options.sortStickFolders:this.sortStickFolders=!!this.sortStickFolders,this.sortAlsoTreeview=this.storage("sortAlsoTreeview"),null===this.sortAlsoTreeview?this.sortAlsoTreeview=!!this.options.sortAlsoTreeview:this.sortAlsoTreeview=!!this.sortAlsoTreeview,this.sortRules=e.extend(!0,{},this._sortRules,this.options.sortRules),e.each(this.sortRules,function(e,t){"function"!=typeof t&&delete p.sortRules[e]}),this.compare=e.proxy(this.compare,this),this.notifyDelay=this.options.notifyDelay>0?parseInt(this.options.notifyDelay):500,this.draggingUiHelper=null,this.droppable={greedy:!0,tolerance:"pointer",accept:".elfinder-cwd-file-wrapper,.elfinder-navbar-dir,.elfinder-cwd-file,.elfinder-cwd-filename",hoverClass:this.res("class","adroppable"),classes:{"ui-droppable-hover":this.res("class","adroppable")},autoDisable:!0,drop:function(t,n){var i,a,o,r=e(this),s=e.map(n.helper.data("files")||[],function(e){return e||null}),l=[],c=[],d=[],u=n.helper.hasClass("elfinder-drag-helper-plus"),h="class";if("undefined"==typeof t.button||n.helper.data("namespace")!==v||!p.insideWorkzone(t.pageX,t.pageY))return!1;for(a=r.hasClass(p.res(h,"cwdfile"))?p.cwdId2Hash(r.attr("id")):r.hasClass(p.res(h,"navdir"))?p.navId2Hash(r.attr("id")):z,i=s.length;i--;)o=s[i],o!=a&&A[o].phash!=a?l.push(o):(u&&o!==a&&A[a].write?c:d).push(o);return!d.length&&(n.helper.data("droped",!0),c.length&&(n.helper.hide(),p.exec("duplicate",c,{_userAction:!0})),void(l.length&&(n.helper.hide(),p.clipboard(l,!u),p.exec("paste",a,{_userAction:!0},a).always(function(){p.clipboard([]),p.trigger("unlockfiles",{files:s})}),p.trigger("drop",{files:s}))))}},this.enabled=function(){return x&&this.visible()},this.visible=function(){return t[0].elfinder&&t.is(":visible")},this.isRoot=function(e){return!(!e.isroot&&e.phash)},this.root=function(t,n){t=t||z;var i,a;if(!n&&(e.each(p.roots,function(e,n){if(0===t.indexOf(e))return i=n,!1}),i))return i;for(i=A[t];i&&i.phash&&(n||!i.isroot);)i=A[i.phash];if(i)return i.hash;for(;a in A&&A.hasOwnProperty(a);)if(i=A[a],!i.phash&&"directory"==!i.mime&&i.read)return i.hash;return""},this.cwd=function(){return A[z]||{}},this.option=function(t,n){var i;return n=n||z,p.optionsByHashes[n]&&"undefined"!=typeof p.optionsByHashes[n][t]?p.optionsByHashes[n][t]:z!==n?(i="",e.each(p.volOptions,function(e,a){if(0===n.indexOf(e))return i=a[t]||"",!1}),i):I[t]||""},this.getDisabledCmds=function(t){var n=["hidden"];return Array.isArray(t)||(t=[t]),e.each(t,function(t,i){var a=p.option("disabled",i);a&&e.each(a,function(t,i){e.inArray(i,n)===-1&&n.push(i)})}),n},this.file=function(e){return e?A[e]:void 0},this.files=function(t){var n={};return t?S[t]?(e.each(S[t],function(e){A[e]?n[e]=A[e]:delete S[t][e]}),Object.assign({},n)):{}:Object.assign({},A)},this.parents=function(e){for(var t,n=[];t=this.file(e);)n.unshift(t.hash),e=t.phash;return n},this.path2array=function(e,t){for(var n,i=[];e;){if(!(n=A[e])||!n.hash){i=[];break}i.unshift(t&&n.i18?n.i18:n.name),e=n.isroot?null:n.phash}return i},this.path=function(t,n,i){var a=A[t]&&A[t].path?A[t].path:this.path2array(t,n).join(I.separator);if(i&&A[t]){i=Object.assign({notify:{type:"parents",cnt:1,hideCnt:!0}},i);var o,r=e.Deferred(),s=i.notify,l=!1,c=function(){p.request({data:{cmd:"parents",target:A[t].phash},notify:s,preventFail:!0}).done(d).fail(function(){r.reject()})},d=function(){p.one("parentsdone",function(){a=p.path(t,n),""===a&&l?(l=!1,c()):(s&&(clearTimeout(o),s.cnt=-parseInt(s.cnt||0),p.notify(s)),r.resolve(a))})};return a?r.resolve(a):(p.ui.tree?(s&&(o=setTimeout(function(){p.notify(s)},p.notifyDelay)),l=!0,d(!0)):c(),r)}return a},this.url=function(t,n){var i,a=A[t],n=n||{},o=n.async||!1,r=n.temporary||!1,s=o?e.Deferred():null,l=function(n){if(n)return n;if(a.url)return a.url;if(i=0===a.hash.indexOf(p.cwd().volumeid)?I.url:p.option("url",a.hash))return i+e.map(p.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");var o=Object.assign({},p.customData,{cmd:"file",target:a.hash});return p.oldAPI&&(o.cmd="open",o.current=a.phash),p.options.url+(p.options.url.indexOf("?")===-1?"?":"&")+e.param(o,!0)};if(!a||!a.read)return o?s.resolve(""):"";if("1"==a.url)this.request({data:{cmd:"url",target:t,options:{temporary:r?1:0}},preventDefault:!0,options:{async:o},notify:o?{type:r?"file":"url",cnt:1,hideCnt:!0}:{}}).done(function(e){a.url=e.url||""}).fail(function(){a.url=""}).always(function(){var e;return a.url&&r&&(e=a.url,a.url="1"),o?void s.resolve(l(e)):l(e)});else{if(!o)return l();s.resolve(l())}return o?s:void 0},this.openUrl=function(t,n){var i=A[t],a="";return i&&i.read?!n&&(i.url?1!=i.url&&(a=i.url):I.url&&0===i.hash.indexOf(p.cwd().volumeid)&&(a=I.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/")),a)?a+=(a.match(/\?/)?"&":"?")+"_".repeat((a.match(/[\?&](_+)t=/g)||["&t="]).sort().shift().match(/[\?&](_*)t=/)[1].length+1)+"t="+(i.ts||parseInt(+new Date/1e3)):(a=this.options.url,a=a+(a.indexOf("?")===-1?"?":"&")+(this.oldAPI?"cmd=open¤t="+i.phash:"cmd=file")+"&target="+i.hash+"&_t="+(i.ts||parseInt(+new Date/1e3)),n&&(a+="&download=1"),e.each(this.options.customData,function(e,t){a+="&"+encodeURIComponent(e)+"="+encodeURIComponent(t)}),a):""},this.tmb=function(t){var n,i,a="elfinder-cwd-bgurl",o="";return!(!e.isPlainObject(t)||(p.searchStatus.state&&0!==t.hash.indexOf(p.cwd().volumeid)?(n=p.option("tmbUrl",t.hash),i=p.option("tmbCrop",t.hash)):(n=I.tmbUrl,i=I.tmbCrop),i&&(a+=" elfinder-cwd-bgurl-crop"),"self"===n&&0===t.mime.indexOf("image/")?(o=p.openUrl(t.hash),a+=" elfinder-cwd-bgself"):(p.oldAPI||n)&&t&&t.tmb&&1!=t.tmb&&(o=n+t.tmb),!o))&&(t.ts&&(o+=(o.match(/\?/)?"&":"?")+"_t="+t.ts),{url:o,className:a})},this.selected=function(){return O.slice(0)},this.selectedFiles=function(){return e.map(O,function(e){return A[e]?Object.assign({},A[e]):null})},this.fileByName=function(e,t){var n;for(n in A)if(A.hasOwnProperty(n)&&A[n].phash==t&&A[n].name==e)return A[n]},this.validResponse=function(e,t){return t.error||this.rules[this.rules[e]?e:"defaults"](t)},this.returnBytes=function(e){var t;return isNaN(e)?(e||(e=""),e=e.replace(/b$/i,""),t=e.charAt(e.length-1).toLowerCase(),e=e.replace(/[tgmk]$/i,""),"t"==t?e=1024*e*1024*1024*1024:"g"==t?e=1024*e*1024*1024:"m"==t?e=1024*e*1024:"k"==t&&(e=1024*e),e=isNaN(e)?0:parseInt(e)):(e=parseInt(e),e<1&&(e=0)),e},this.request=function(t){var n,i,a,o=this,s=this.options,l=e.Deferred(),c=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),d=Object.assign({},s.customData,{mimes:s.onlyMimes},t.data||t),p=d.cmd,u=!t.asNotOpen&&"open"===p,h=!(t.preventDefault||t.preventFail),f=!(t.preventDefault||t.preventDone),m=Object.assign({},t.notify),g=!!t.cancel,v=!!t.raw,b=t.syncOnFail,y=!!t.lazy,w=t.prepare,x=t.navigate,k=Object.assign({url:s.url,async:!0,type:this.requestType,dataType:"json",cache:o.api>=2.1029,data:d,headers:this.customHeaders,xhrFields:this.xhrFields},t.options||{}),C=function(e){e.warning&&o.error(e.warning),u?B(e):o.updateCache(e),e.changed&&e.changed.length&&X(e.changed),o.lazy(function(){e.removed&&e.removed.length&&o.remove(e),e.added&&e.added.length&&o.add(e),e.changed&&e.changed.length&&o.change(e)}).then(function(){return o.lazy(function(){o.trigger(p,e,!1)})}).then(function(){return o.lazy(function(){o.trigger(p+"done")})}).then(function(){e.sync&&o.sync()})},A=function(e,t){var n,i,a=o.options.debug;switch(t){case"abort":n=e.quiet?"":["errConnect","errAbort"];break;case"timeout":n=["errConnect","errTimeout"];break;case"parsererror":n=["errResponse","errDataNotJSON"],e.responseText&&(!z||a&&("all"===a||a["backend-error"]))&&n.push(e.responseText);break;default:if(e.responseText)try{i=JSON.parse(e.responseText),i&&i.error&&(n=i.error)}catch(r){}if(!n)if(403==e.status)n=["errConnect","errAccess","HTTP error "+e.status];else if(404==e.status)n=["errConnect","errNotFound","HTTP error "+e.status];else if(e.status>=500)n=["errResponse","errServerError","HTTP error "+e.status];else{if(414==e.status&&"get"===k.type)return k.type="post",o.abortXHR(e),void(l.xhr=e=o.transport.send(k).fail(n).done(S));n=e.quiet?"":["errConnect","HTTP error "+e.status]}}o.trigger(p+"done"),l.reject(n,e,t)},S=function(t){var n=o.options.debug;if(o.currentReqCmd=p,!t.debug||n&&("all"===n||n["backend-error"])||(n||(o.options.debug={}),o.options.debug["backend-error"]=!0),v)return o.abortXHR(i),t&&t.debug&&o.debug("backend-debug",t),l.resolve(t);if(!t)return l.reject(["errResponse","errDataEmpty"],i,t);if(!e.isPlainObject(t))return l.reject(["errResponse","errDataNotJSON"],i,t);if(t.error)return l.reject(t.error,i,t);var a=function(){var n,a=function(n){o.leafRoots[d.target]&&t[n]&&e.each(o.leafRoots[d.target],function(e,i){var a;(a=o.file(i))&&t[n].push(a)})},r=function(){o.textMimes={},e.each(o.resources.mimes.text,function(){o.textMimes[this]=!0})};return u?a("files"):"tree"===p&&a("tree"),t=o.normalize(t),o.validResponse(p,t)?(o.api||(o.api=t.api||1,"2.0"==o.api&&"undefined"!=typeof t.options.uploadMaxSize&&(o.api="2.1"),o.newAPI=o.api>=2,o.oldAPI=!o.newAPI),t.textMimes&&Array.isArray(t.textMimes)&&(o.resources.mimes.text=t.textMimes,r()),!o.textMimes&&r(),t.options&&(I=Object.assign({},T,t.options)),t.netDrivers&&(o.netDrivers=t.netDrivers),t.maxTargets&&(o.maxTargets=t.maxTargets),u&&d.init&&(o.uplMaxSize=o.returnBytes(t.uplMaxSize),o.uplMaxFile=t.uplMaxFile?parseInt(t.uplMaxFile):20),"function"==typeof w&&w(t),x&&(n=x.target||"added",t[n]&&t[n].length&&o.one(p+"done",function(){var i=t[n],a=o.findCwdNodes(i),r=function(){var t=o.cwd().hash;return e.map(i,function(e){return e.phash&&t===e.phash?e.hash:null})},s=r(),l=function(t){var n,i,a,l=void 0,c=t.action?t.action.data:void 0;return(c||s.length)&&t.action&&(i=t.action.msg)&&(n=t.action.cmd)&&(!t.action.cwdNot||t.action.cwdNot!==o.cwd().hash)&&(a=t.action.done,c=t.action.data,l=e("
").append(e('").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type)}).on("click",function(){o.exec(n,c||s,{_userAction:!0,_currentType:"toast",_currentNode:e(this)}),a&&o.one(n+"done",function(){"function"==typeof a?a():"select"===a&&o.trigger("selectfiles",{files:r()})})}))),delete t.action,t.extNode=l,t};x.toast||(x.toast={}),!x.noselect&&o.trigger("selectfiles",{files:o.searchStatus.state>1?e.map(i,function(e){return e.hash}):s}),a.length?(x.noscroll||(a.first().trigger("scrolltoview",{blink:!1}),o.resources.blink(a,"lookme")),e.isPlainObject(x.toast.incwd)&&o.toast(l(x.toast.incwd))):e.isPlainObject(x.toast.inbuffer)&&o.toast(l(x.toast.inbuffer))})),l.resolve(t),void(t.debug&&o.debug("backend-debug",t))):l.reject(t.norError||"errResponse",i,t)};o.abortXHR(i),y?o.lazy(a):a()},O=function(e){i&&"pending"===i.state()&&(o.abortXHR(i,{quiet:!0,abort:!0}),(!e||"unload"!==e.type&&"destroy"!==e.type)&&o.autoSync())},M=function(e){if(o.trigger(p+"done"),"autosync"==e.type){if("stop"!=e.data.action)return}else if(!("unload"==e.type||"destroy"==e.type||"openxhrabort"==e.type||e.data.added&&e.data.added.length))return;O(e)},U=function(t){var n=function(){b=!1,l.reject()};if(t&&"cmd"===t)return p;if(u){if(Z)return l.reject();Z=!0}if(J++,l.fail(function(t,n,i){0===t&&Y.length&&(Y=e.map(Y,function(e){return e("cmd")===p?null:e})),O(),o.trigger(p+"fail",i),t&&(h?o.error(t):o.debug("error",o.i18n(t))),b&&o.sync()}),!p)return b=!1,l.reject("errCmdReq");if(o.maxTargets&&d.targets&&d.targets.length>o.maxTargets)return b=!1,l.reject(["errMaxTargets",o.maxTargets]);if(f&&l.done(C),u){for(;a=E.pop();)a.queueAbort();if(z!==d.target)for(;a=F.pop();)a.queueAbort()}return e.inArray(p,(o.cmdsToAdd+" autosync").split(" "))!==-1&&("autosync"!==p&&(o.autoSync("stop"),l.always(function(){o.autoSync()})),o.trigger("openxhrabort")),delete k.preventFail,o.api>=2.1029&&Object.assign(k.data,{reqid:c}),l.xhr=i=o.transport.send(k).always(function(){--J,Y.length?Y.shift()():Z=!1}).fail(A).done(S),o.api>=2.1029&&(i._requestId=c),l.syncOnFail=function(e){b=!!e},u||d.compare&&"info"===p?(i.queueAbort=n,E.unshift(i),d.compare&&o.bind(o.cmdsToAdd+" autosync openxhrabort",M),l.always(function(){var t=e.inArray(i,E);d.compare&&o.unbind(o.cmdsToAdd+" autosync openxhrabort",M),t!==-1&&E.splice(t,1)})):e.inArray(p,o.abortCmdsOnOpen)!==-1&&(i.queueAbort=n,F.unshift(i),l.always(function(){var t=e.inArray(i,F);t!==-1&&F.splice(t,1)})),o.bind("unload destroy",M),l.always(function(){o.unbind("unload destroy",M)}),l},j=function(){return m.type&&m.cnt&&(g&&(m.cancel=l),n=setTimeout(function(){o.notify(m),l.always(function(){m.cnt=-(parseInt(m.cnt)||0),o.notify(m)})},o.notifyDelay),l.always(function(){clearTimeout(n)})),u&&(Z=!1),J=2&&(z!==this.root()&&s.push(this.request({data:{cmd:"parents",target:z},preventDefault:!0})),e.each(l(),function(e,t){s.push(i.request({data:{cmd:t.cmd,target:t.target},preventDefault:!0}))})),e.when.apply(e,s).fail(function(t,a){n&&e.inArray("errOpen",t)===-1?r.reject(t&&0!=a.status?t:void 0):(r.reject(t),t&&i.request({data:{cmd:"open",target:i.lastDir("")||i.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}}))}).done(function(e){var n,a,s;if(e.cwd.compare&&o===e.cwd.compare)return r.reject();if(n={tree:[]},a=arguments.length,a>1)for(s=1;s-1&&o.splice(r,1));return n=null,this},this.trigger=function(t,n,i){var a,o,r,s,t=t.toLowerCase(),l="object"==typeof n,c=M[t]||[];if(this.debug("event-"+t,n),l&&"undefined"!=typeof i||(i=!0),o=c.length){for(s=e.Event(t),i&&(s.data=n),a=0;a0?a:a.charCodeAt(0):a>0?a:e.ui.keyCode[a],a&&!U[i]&&(U[i]={keyCode:a,altKey:e.inArray("ALT",r)!=-1,ctrlKey:e.inArray("CTRL",r)!=-1,shiftKey:e.inArray("SHIFT",r)!=-1,type:t.type||"keydown",callback:t.callback,description:t.description,pattern:i});return this},this.shortcuts=function(){var t=[];return e.each(U,function(e,n){t.push([n.pattern,p.i18n(n.description)])}),t},this.clipboard=function(t,n){var i=function(){return e.map(j,function(e){return e.hash})};return void 0!==t&&(j.length&&this.trigger("unlockfiles",{files:i()}),D={},j=e.map(t||[],function(e){var t=A[e];return t?(D[e]=!0,{hash:e,phash:t.phash,name:t.name,mime:t.mime,read:t.read,locked:t.locked,cut:!!n}):null}),this.trigger("changeclipboard",{clipboard:j.slice(0,j.length)}),n&&this.trigger("lockfiles",{files:i()})),j.slice(0,j.length)},this.isCommandEnabled=function(t,n){var i,a=p.cwd().volumeid||"";return!n&&p.searchStatus.state>1&&p.selected().length&&(n=p.selected()[0]),!n||a&&0===n.indexOf(a)?i=I.disabled:(i=p.option("disabled",n),i||(i=[])),!!this._commands[t]&&e.inArray(t,i)===-1},this.exec=function(t,n,i,a){var o,r;return"open"===t&&((this.searchStatus.state||this.searchStatus.ininc)&&this.trigger("searchend",{noupdate:!0}),this.autoSync("stop")),!a&&n&&(e.isArray(n)?n.length&&(a=n[0]):a=n),o=this._commands[t]&&this.isCommandEnabled(t,a)?this._commands[t].exec(n,i):e.Deferred().reject("No such command"),r=typeof o,("object"!==r||!o instanceof e.Deferred)&&(p.debug("warning",'"cmd.exec()" should be returned "$.Deferred" but cmd "'+t+'" returned "'+r+'"'),o=e.Deferred().resolve()),this.trigger("exec",{dfrd:o,cmd:t,files:n,opts:i,dstHash:a}),o},this.dialog=function(n,i){var a=e("
").append(n).appendTo(t).elfinderdialog(i,this),o=a.closest(".ui-dialog"),r=function(){!a.data("draged")&&a.is(":visible")&&a.elfinderdialog("posInit")};return o.length&&(p.bind("resize",r),o.on("remove",function(){p.unbind("resize",r)})),a},this.toast=function(t){return e('
').appendTo(this.ui.toast).elfindertoast(t||{},this)},this.getUI=function(n){return this.ui[n]||(n?e():t)},this.getCommand=function(e){return void 0===e?this._commands:this._commands[e]},this.resize=function(n,i){var a,o=function(){for(var e=t.outerHeight(!0)-t.innerHeight(),n=t;n.get(0)!==q.get(0)&&(n=n.parent(),e+=n.outerHeight(!0)-n.innerHeight(),n.parent().length););return e},r=!t.hasClass("ui-resizable"),s=t.data("resizeSize")||{w:0,h:0},l={};q&&q.data("resizeTm")&&clearTimeout(q.data("resizeTm")),"string"==typeof i&&(a=i.match(/^([0-9.]+)%$/))&&(q&&q.length||(q=e(window)),q.data("marginToMyNode")||q.data("marginToMyNode",o()),q.data("fitToBaseFunc")||q.data("fitToBaseFunc",function(e){var n=q.data("resizeTm");e.preventDefault(),e.stopPropagation(),n&&clearTimeout(n),t.hasClass("elfinder-fullscreen")||q.data("resizeTm",setTimeout(function(){p.restoreSize()},50))}),i=q.height()*(a[1]/100)-q.data("marginToMyNode"),q.off("resize."+p.namespace,q.data("fitToBaseFunc")),r&&q.on("resize."+p.namespace,q.data("fitToBaseFunc"))),t.css({width:n,height:parseInt(i)}),l.w=t.width(),l.h=t.height(),t.data("resizeSize",l),l.w===s.w&&l.h===s.h||(t.trigger("resize"),this.trigger("resize",{width:l.w,height:l.h}))},this.restoreSize=function(){this.resize(R,H)},this.show=function(){t.show(),this.enable().trigger("show")},this.hide=function(){this.options.enableAlways&&(k=x,x=!1),this.disable().trigger("hide"),t.hide()},this.lazy=function(n,i,a){var o=function(e){var n,i=t.data("lazycnt");e?(n=!t.data("lazyrepaint")&&a.repaint,i?t.data("lazycnt",++i):t.data("lazycnt",1).addClass("elfinder-processing"),n&&t.data("lazyrepaint",!0).css("display")):i&&i>1?t.data("lazycnt",--i):(n=t.data("lazyrepaint"),t.data("lazycnt",0).removeData("lazyrepaint").removeClass("elfinder-processing"),n&&t.css("display"),p.trigger("lazydone"))},r=e.Deferred();return i=i||0,a=a||{},o(!0),setTimeout(function(){r.resolve(n.call(r)),o(!1)},i),r},this.destroy=function(){t&&t[0].elfinder&&(t.hasClass("elfinder-fullscreen")&&p.toggleFullscreen(t),this.options.syncStart=!1,this.autoSync("forcestop"),this.trigger("destroy").disable(),j=[],O=[],M={},U={},e(window).off("."+v),e(document).off("."+v),p.trigger=function(){},e(_).remove(),t.off().removeData().empty().append(m.contents()).attr("class",m.attr("class")).attr("style",m.attr("style")),delete t[0].elfinder, e.each(f,function(n,i){e.each(i,function(e,n){t.on(n.type+(n.namespace?"."+n.namespace:""),n.selector,n.handler)})}))},this.autoSync=function(t){var n;if(p.options.sync>=1e3){if(o&&(clearTimeout(o),o=null,p.trigger("autosync",{action:"stop"})),"stop"===t?++L:L=Math.max(0,--L),L||"forcestop"===t||!p.options.syncStart)return;n=function(t){var i;I.syncMinMs&&(t||o)&&(t&&p.trigger("autosync",{action:"start"}),i=Math.max(p.options.sync,I.syncMinMs),o&&clearTimeout(o),o=setTimeout(function(){var t,a=!0,r=z;I.syncChkAsTs&&A[r]&&(t=A[r].ts)?p.request({data:{cmd:"info",targets:[r],compare:t,reload:1},preventDefault:!0}).done(function(e){var i;a=!0,e.compare&&(i=e.compare,i==t&&(a=!1)),a?p.sync(r).always(function(){i&&(A[r].ts=i),n()}):n()}).fail(function(t,a){t&&0!=a.status?(p.error(t),e.inArray("errOpen",t)!==-1&&p.request({data:{cmd:"open",target:p.lastDir("")||p.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}})):o=setTimeout(function(){n()},i)}):p.sync(z,!0).always(function(){n()})},i))},n(!0)}},this.insideWorkzone=function(e,t,n){var i=this.getUI("workzone").data("rectangle");return n=n||1,!(ei.left+i.width+n||ti.top+i.height+n)},this.toFront=function(n){var i=t.children(":last");n=e(n),i.get(0)!==n.get(0)&&n.trigger("beforedommove").insertAfter(i).trigger("dommove")},this.getMaximizeCss=function(){return{width:"100%",height:"100%",margin:0,padding:0,top:0,left:0,display:"block",position:"fixed",zIndex:Math.max(p.zIndex?p.zIndex+1:0,1e3),maxWidth:"",maxHeight:""}},function(){te&&p.UA.Fullscreen&&(p.UA.Fullscreen=!1,ne&&"undefined"!=typeof ne.attr("allowfullscreen")&&(p.UA.Fullscreen=!0));var n,i,a,o="elfinder-fullscreen",r="elfinder-fullscreen-native",s=function(){var n=0,i=0;e.each(t.children(".ui-dialog,.ui-draggable"),function(t,a){var o=e(a),r=o.position();r.top<0&&(o.css("top",n),n+=20),r.left<0&&(o.css("left",i),i+=20)})},l=p.UA.Fullscreen?{fullElm:function(){return document.fullscreenElement||document.webkitFullscreenElement||document.mozFullScreenElement||document.msFullscreenElement||null},exitFull:function(){return document.exitFullscreen?document.exitFullscreen():document.webkitExitFullscreen?document.webkitExitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.msExitFullscreen?document.msExitFullscreen():void 0},toFull:function(e){return e.requestFullscreen?e.requestFullscreen():e.webkitRequestFullscreen?e.webkitRequestFullscreen():e.mozRequestFullScreen?e.mozRequestFullScreen():!!e.msRequestFullscreen&&e.msRequestFullscreen()}}:{fullElm:function(){var e;return t.hasClass(o)?t.get(0):(e=t.find("."+o),e.length?e.get(0):null)},exitFull:function(){var t;e(window).off("resize."+v,d),void 0!==i&&e("body").css("overflow",i),i=void 0,n&&(t=n.elm,c(t),e(t).trigger("resize",{fullscreen:"off"})),e(window).trigger("resize")},toFull:function(t){return i=e("body").css("overflow")||"",e("body").css("overflow","hidden"),e(t).css(p.getMaximizeCss()).addClass(o).trigger("resize",{fullscreen:"on"}),s(),e(window).on("resize."+v,d).trigger("resize"),!0}},c=function(t){n&&n.elm==t&&(e(t).removeClass(o+" "+r).attr("style",n.style),n=null)},d=function(t){var n;t.target===window&&(a&&clearTimeout(a),a=setTimeout(function(){(n=l.fullElm())&&e(n).trigger("resize",{fullscreen:"on"})},100))};e(document).on("fullscreenchange."+v+" webkitfullscreenchange."+v+" mozfullscreenchange."+v+" MSFullscreenChange."+v,function(t){if(p.UA.Fullscreen){var i=l.fullElm(),u=e(window);a&&clearTimeout(a),null===i?(u.off("resize."+v,d),n&&(i=n.elm,c(i),e(i).trigger("resize",{fullscreen:"off"}))):(e(i).addClass(o+" "+r).attr("style","width:100%; height:100%; margin:0; padding:0;").trigger("resize",{fullscreen:"on"}),u.on("resize."+v,d),s()),u.trigger("resize")}}),p.toggleFullscreen=function(t,i){var a=e(t).get(0),o=null;if(o=l.fullElm()){if(o==a){if(i===!0)return o}else if(i===!1)return o;return l.exitFull(),null}return i===!1?null:(n={elm:a,style:e(a).attr("style")},l.toFull(a)!==!1?a:(n=null,null))}}(),function(){var t,n="elfinder-maximized",i=function(e){if(e.target===window&&e.data&&e.data.elm){var n=e.data.elm;t&&clearTimeout(t),t=setTimeout(function(){n.trigger("resize",{maximize:"on"})},100)}},a=function(t){e(window).off("resize."+v,i),e("body").css("overflow",t.data("bodyOvf")),t.removeClass(n).attr("style",t.data("orgStyle")).removeData("bodyOvf").removeData("orgStyle"),t.trigger("resize",{maximize:"off"})},o=function(t){t.data("bodyOvf",e("body").css("overflow")||"").data("orgStyle",t.attr("style")).addClass(n).css(p.getMaximizeCss()),e("body").css("overflow","hidden"),e(window).on("resize."+v,{elm:t},i),t.trigger("resize",{maximize:"on"})};p.toggleMaximize=function(t,i){var r=e(t),s=r.hasClass(n);if(s){if(i===!0)return;a(r)}else{if(i===!1)return;o(r)}}}(),e.fn.selectable&&e.fn.draggable&&e.fn.droppable&&e.fn.resizable?t.length?this.options.url?(Object.assign(e.ui.keyCode,{F1:112,F2:113,F3:114,F4:115,F5:116,F6:117,F7:118,F8:119,F9:120,F10:121,F11:122,F12:123,DIG0:48,DIG1:49,DIG2:50,DIG3:51,DIG4:52,DIG5:53,DIG6:54,DIG7:55,DIG8:56,DIG9:57,NUM0:96,NUM1:97,NUM2:98,NUM3:99,NUM4:100,NUM5:101,NUM6:102,NUM7:103,NUM8:104,NUM9:105,CONTEXTMENU:93}),this.dragUpload=!1,this.xhrUpload=("undefined"!=typeof XMLHttpRequestUpload||"undefined"!=typeof XMLHttpRequestEventTarget)&&"undefined"!=typeof File&&"undefined"!=typeof FormData,this.transport={},"object"==typeof this.options.transport&&(this.transport=this.options.transport,"function"==typeof this.transport.init&&this.transport.init(this)),"function"!=typeof this.transport.send&&(this.transport.send=function(t){return e.ajax(t)}),"iframe"==this.transport.upload?this.transport.upload=e.proxy(this.uploads.iframe,this):"function"==typeof this.transport.upload?this.dragUpload=!!this.options.dragUploadAllow:this.xhrUpload&&this.options.dragUploadAllow?(this.transport.upload=e.proxy(this.uploads.xhr,this),this.dragUpload=!0):this.transport.upload=e.proxy(this.uploads.iframe,this),this.decodeRawString=e.isFunction(this.options.rawStringDecoder)?this.options.rawStringDecoder:function(e){var t=function(e){var t,n,i;for(t=0,n=e.length,i=[];t=55296&&a<=56319?o.push((1023&a)+64<<10|1023&e[++n]):o.push(a);return o},i=function(e){var t,n,i,a,o=String.fromCharCode;for(t=0,n=e.length,a="";i=e[t],t=194?o((31&i)<<6|63&e[++t]):i<=239&&i>=224?o((15&i)<<12|(63&e[++t])<<6|63&e[++t]):i<=247&&i>=240?o(55296|((7&i)<<8|(63&e[++t])<<2|e[++t]>>>4&3)-64,56320|(15&e[t++])<<6|63&e[t]):o(65533);return a};return i(n(e))},this.error=function(){var e=arguments[0],t=arguments[1]||null;return 1==arguments.length&&"function"==typeof e?p.bind("error",e):e===!0?this:p.trigger("error",{error:e,opts:t})},e.each(C,function(t,n){p[n]=function(){var t=arguments[0];return 1==arguments.length&&"function"==typeof t?p.bind(n,t):p.trigger(n,e.isPlainObject(t)?t:{})}}),this.enable(function(){!x&&p.visible()&&p.ui.overlay.is(":hidden")&&!t.children(".elfinder-dialog").find("."+p.res("class","editing")).length&&(x=!0,document.activeElement&&document.activeElement.blur(),t.removeClass("elfinder-disabled"))}).disable(function(){k=x,x=!1,t.addClass("elfinder-disabled")}).open(function(){O=[]}).select(function(t){var n=0,i=[];O=e.map(t.data.selected||t.data.value||[],function(e){return i.length||p.maxTargets&&++n>p.maxTargets?(i.push(e),null):A[e]?e:null}),i.length&&(p.trigger("unselectfiles",{files:i,inselect:!0}),p.toast({mode:"warning",msg:p.i18n(["errMaxTargets",p.maxTargets])}))}).error(function(t){var n={cssClass:"elfinder-dialog-error",title:p.i18n(p.i18n("error")),resizable:!1,destroyOnClose:!0,buttons:{}};n.buttons[p.i18n(p.i18n("btnClose"))]=function(){e(this).elfinderdialog("close")},t.data.opts&&e.isPlainObject(t.data.opts)&&Object.assign(n,t.data.opts),p.dialog(''+p.i18n(t.data.error),n)}).bind("tmb",function(t){e.each(t.data.images||[],function(e,t){A[e]&&(A[e].tmb=t)})}).bind("searchstart",function(e){Object.assign(p.searchStatus,e.data),p.searchStatus.state=1}).bind("search",function(e){p.searchStatus.state=2}).bind("searchend",function(){p.searchStatus.state=0,p.searchStatus.ininc=!1,p.searchStatus.mixed=!1}),!0===this.options.sound&&this.bind("playsound",function(t){var n=_.canPlayType&&_.canPlayType('audio/wav; codecs="1"'),i=t.data&&t.data.soundFile;n&&i&&""!=n&&"no"!=n&&e(_).html('')[0].play()}),e.each(this.options.handlers,function(e,t){p.bind(e,t)}),this.history=new this.history(this),this.roots={},this.leafRoots={},this._commands={},Array.isArray(this.options.commands)||(this.options.commands=[]),e.inArray("*",this.options.commands)!==-1&&(this.options.commands=Object.keys(this.commands)),this.commandMap={},this.volOptions={},this.trashes={},this.optionsByHashes={},this.uiAutoHide=[],this.one("open",function(){p.uiAutoHide.length&&setTimeout(function(){p.trigger("uiautohide")},500)}),this.bind("uiautohide",function(){p.uiAutoHide.length&&p.uiAutoHide.shift()()}),this.options.width&&(R=this.options.width),this.options.height&&(H=this.options.height),this.options.heightBase&&(q=e(this.options.heightBase)),this.options.soundPath&&(N=this.options.soundPath.replace(/\/+$/,"")+"/"),e(document).on("click."+v,function(n){x&&!p.options.enableAlways&&!e(n.target).closest(t).length&&p.disable()}).on(y+" "+w,Q),p.options.useBrowserHistory&&e(window).on("popstate."+v,function(t){var n=t.originalEvent.state&&t.originalEvent.state.thash;n&&!e.isEmptyObject(p.files())&&p.request({data:{cmd:"open",target:n,onhistory:1},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0})}),function(){var n;e(window).on("resize."+v,function(e){e.target===this&&(n&&clearTimeout(n),n=setTimeout(function(){p.trigger("resize",{width:t.width(),height:t.height()})},100))}).on("beforeunload."+v,function(n){var i,a;return t.is(":visible")&&(p.ui.notify.children().length&&e.inArray("hasNotifyDialog",p.options.windowCloseConfirm)!==-1?i=p.i18n("ntfsmth"):t.find("."+p.res("class","editing")).length&&e.inArray("editingFile",p.options.windowCloseConfirm)!==-1?i=p.i18n("editingFile"):(a=Object.keys(p.selected()).length)&&e.inArray("hasSelectedItem",p.options.windowCloseConfirm)!==-1?i=p.i18n("hasSelected",""+a):(a=Object.keys(p.clipboard()).length)&&e.inArray("hasClipboardData",p.options.windowCloseConfirm)!==-1&&(i=p.i18n("hasClipboard",""+a)),i)?(n.returnValue=i,i):void p.trigger("unload")})}(),e(window).on("message."+v,function(e){var t,n,i=e.originalEvent||null;if(i&&0===p.uploadURL.indexOf(i.origin))try{t=JSON.parse(i.data),n=t.data||null,n&&(n.error?(t.bind&&p.trigger(t.bind+"fail",n),p.error(n.error)):(n.warning&&p.error(n.warning),p.updateCache(n),n.removed&&n.removed.length&&p.remove(n),n.added&&n.added.length&&p.add(n),n.changed&&n.changed.length&&p.change(n),t.bind&&(p.trigger(t.bind,n),p.trigger(t.bind+"done")),n.sync&&p.sync()))}catch(e){p.sync()}}),p.options.enableAlways?(e(window).on("focus."+v,function(e){e.target===this&&p.enable()}),te&&e(window.top).on("focus."+v,function(){!p.enable()||ne&&!ne.is(":visible")||setTimeout(function(){e(window).focus()},10)})):te&&e(window).on("blur."+v,function(e){x&&e.target===this&&p.disable()}),te&&t.on("click",function(t){e(window).focus()}),this.options.enableByMouseOver&&t.on("mouseenter",function(t){te&&e(window).focus(),!p.enabled()&&p.enable()}),t[0].elfinder=this,u.push(function(){var t=p.lang,n=p.baseUrl+"js/i18n/elfinder."+t+".js",i=e.Deferred().done(function(){p.i18[t]&&(p.lang=t),p.trigger("i18load"),l="en"===p.lang?p.i18.en:e.extend(!0,{},p.i18.en,p.i18[p.lang])});return p.i18[t]?i.resolve():(p.lang="en","function"==typeof define&&define.amd?require([n],function(){i.resolve()},function(){i.resolve()}):p.loadScript([n],function(){i.resolve()},{loadType:"tag",error:function(){i.resolve()}})),i}()),c=function(){p.direction=l.direction,p.messages=l.messages,p.dateFormat=p.options.dateFormat||l.dateFormat,p.fancyFormat=p.options.fancyDateFormat||l.fancyDateFormat,p.nonameDateFormat=(p.options.nonameDateFormat||l.nonameDateFormat).replace(/[\/\\]/g,"_"),p.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-"+("rtl"==p.direction?"rtl":"ltr")+(p.UA.Touch?" elfinder-touch"+(p.options.resizable?" touch-punch":""):"")+(p.UA.Mobile?" elfinder-mobile":"")+" "+p.options.cssClass,t.addClass(p.cssClass).on(b,function(){!x&&p.enable()}),function(){var n,i,a,o,r,s=y+"draggable keyup."+v+"draggable";p.draggable={appendTo:t,addClasses:!1,distance:4,revert:!0,refreshPositions:!1,cursor:"crosshair",cursorAt:{left:50,top:47},scroll:!1,start:function(s,l){var c,d,u=l.helper,h=e.map(u.data("files")||[],function(e){return e?(D[e]=!0,e):null}),f=!1;for(r=t.attr("style"),t.width(t.width()).height(t.height()),n="ltr"===p.direction,i=p.getUI("workzone").data("rectangle"),a=i.top+i.height,o=a-p.getUI("navdock").outerHeight(!0),p.draggingUiHelper=u,c=h.length;c--;)if(d=h[c],A[d].locked){f=!0,u.data("locked",!0);break}!f&&p.trigger("lockfiles",{files:h}),u.data("autoScrTm",setInterval(function(){u.data("autoScr")&&p.autoScroll[u.data("autoScr")](u.data("autoScrVal"))},50))},drag:function(t,r){var s,l,c,d=r.helper;((l=i.top>t.pageY)||ot.pageX?(n?"navbar":"cwd")+(l?"Up":"Down"):(n?"cwd":"navbar")+(l?"Up":"Down"),l||("cwd"===s.substr(0,3)?a0?(e(this).draggable("option",{refreshPositions:!0,elfRefresh:!0}),d.data("refreshPositions",-1)):(e(this).draggable("option",{refreshPositions:!1,elfRefresh:!1}),d.data("refreshPositions",null)))},stop:function(n,i){var a,o=i.helper;e(document).off(s),e(this).elfUiWidgetInstance("draggable")&&e(this).draggable("option",{refreshPositions:!1}),p.draggingUiHelper=null,p.trigger("focus").trigger("dragstop"),o.data("droped")||(a=e.map(o.data("files")||[],function(e){return e||null}),p.trigger("unlockfiles",{files:a}),p.trigger("selectfiles",{files:a})),p.enable(),t.attr("style",r),o.data("autoScrTm")&&clearInterval(o.data("autoScrTm"))},helper:function(t,n){var i,a,o,r=this.id?e(this):e(this).parents("[id]:first"),l=e('
'),c=function(t){var n,i=t.mime,a=p.tmb(t);return n='
',a&&(n=e(n).addClass(a.className).css("background-image","url('"+a.url+"')").get(0).outerHTML),n};return p.draggingUiHelper&&p.draggingUiHelper.stop(!0,!0),p.trigger("dragstart",{target:r[0],originalEvent:t},!0),i=r.hasClass(p.res("class","cwdfile"))?p.selected():[p.navId2Hash(r.attr("id"))],l.append(c(A[i[0]])).data("files",i).data("locked",!1).data("droped",!1).data("namespace",v).data("dropover",0),(a=i.length)>1&&l.append(c(A[i[a-1]])+''+a+""),e(document).on(s,function(e){var t=e.shiftKey||e.ctrlKey||e.metaKey;o!==t&&(o=t,l.is(":visible")&&l.data("dropover")&&!l.data("droped")&&(l.toggleClass("elfinder-drag-helper-plus",!!l.data("locked")||o),p.trigger(o?"unlockfiles":"lockfiles",{files:i,helper:l})))}),l}}}(),p.commands.getfile&&("function"==typeof p.options.getFileCallback?(p.bind("dblclick",function(e){e.preventDefault(),p.exec("getfile").fail(function(){p.exec("open",e.data&&e.data.file?[e.data.file]:void 0)})}),p.shortcut({pattern:"enter",description:p.i18n("cmdgetfile"),callback:function(){p.exec("getfile").fail(function(){p.exec("mac"==p.OS?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:p.i18n("mac"==p.OS?"cmdrename":"cmdopen"),callback:function(){p.exec("mac"==p.OS?"rename":"open")}})):p.options.getFileCallback=null),e.each(p.commands,function(t,n){var i,a,o=Object.assign({},n.prototype);if(e.isFunction(n)&&!p._commands[t]&&(n.prototype.forceLoad||e.inArray(t,p.options.commands)!==-1)){if(i=n.prototype.extendsCmd||""){if(!e.isFunction(p.commands[i]))return!0;n.prototype=Object.assign({},P,new p.commands[i],n.prototype)}else n.prototype=Object.assign({},P,n.prototype);p._commands[t]=new n,n.prototype=o,a=p.options.commandsOptions[t]||{},i&&p.options.commandsOptions[i]&&(a=e.extend(!0,{},p.options.commandsOptions[i],a)),p._commands[t].setup(t,a),p._commands[t].linkedCmds.length&&e.each(p._commands[t].linkedCmds,function(t,n){var i=p.commands[n];e.isFunction(i)&&!p._commands[n]&&(i.prototype=P,p._commands[n]=new i,p._commands[n].setup(n,p.options.commandsOptions[n]||{}))})}}),p.ui={workzone:e("
").appendTo(t).elfinderworkzone(p),navbar:e("
").appendTo(t).elfindernavbar(p,p.options.uiOptions.navbar||{}),navdock:e("
").appendTo(t).elfindernavdock(p,p.options.uiOptions.navdock||{}),contextmenu:e("
").appendTo(t).elfindercontextmenu(p),overlay:e("
").appendTo(t).elfinderoverlay({show:function(){p.disable()},hide:function(){k&&p.enable()}}),cwd:e("
").appendTo(t).elfindercwd(p,p.options.uiOptions.cwd||{}),notify:p.dialog("",{cssClass:"elfinder-dialog-notify",position:p.options.notifyDialog.position,absolute:!0,resizable:!1,autoOpen:!1,closeOnEscape:!1,title:" ",width:parseInt(p.options.notifyDialog.width)}),statusbar:e('
').hide().appendTo(t),toast:e('
').appendTo(t),bottomtray:e('
').appendTo(t)},e.each(p.options.ui||[],function(n,i){var a="elfinder"+i,o=p.options.uiOptions[i]||{};!p.ui[i]&&e.fn[a]&&(p.ui[i]=e("<"+(o.tag||"div")+"/>").appendTo(t),p.ui[i][a](p,o))}),p.resize(R,H),p.options.resizable&&(t.resizable({resize:function(e,t){p.resize(t.size.width,t.size.height)},handles:"se",minWidth:300,minHeight:200}),p.UA.Touch&&t.addClass("touch-punch")),function(){var e=p.getUI("navbar"),t=p.getUI("cwd").parent();p.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)}}}(),p.UA.Touch&&!function(){var e,n,i,a,o,r,s,l,c,d=p.getUI("navbar"),u=p.getUI("toolbar"),h="touchmove.stopscroll",f=function(e){e.preventDefault(),l&&clearTimeout(l)},m=function(){l=setTimeout(function(){t.off(h)},100)},g=50;d=d.children().length?d:null,u=u.length?u:null,t.on("touchstart touchmove touchend",function(l){if("touchend"===l.type)return e=!1,n=!1,void m();var v,b,y,w,x,k=l.originalEvent.touches||[{}],C=k[0].pageX||null,z=k[0].pageY||null,T="ltr"===p.direction;null===C||null===z||"touchstart"===l.type&&k.length>1||("touchstart"===l.type?(i=t.offset(),a=t.width(),d&&(e=!1,d.is(":hidden")?(c||(c=Math.max(50,a/10)),(T?C-i.left:a+i.left-C)i.left+a-r,b?(c=Math.max(50,a/10),e=C):e=!1)),u&&(s=u.height(),o=i.top,z-o<(u.is(":hidden")?g:s+30)?(n=z,t.on(h,f),m()):n=!1)):(d&&e!==!1&&(v=(T?e>C:e.6*r||y>("navhide"===v?r/3:45)&&("navshow"===v||(T?Ci.left+a-20)))&&(p.getUI("navbar").trigger(v,{handleW:c}),e=!1)),u&&n!==!1&&(w=u.offset().top,Math.abs(n-z)>Math.min(45,s/3)&&(x=n>z?"slideUp":"slideDown",("slideDown"===x||w+20>z)&&(u.is("slideDown"===x?":hidden":":visible")&&(u.stop(!0,!0).trigger("toggle",{duration:100,handleH:g}),m()),n=!1)))))})}(),p.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},o="native-drag-enter",r="native-drag-disable",s="class",l=p.res(s,"navdir"),c=(p.res(s,"droppable"),p.res(s,"adroppable"),p.res(s,"navarrow"),p.res(s,"adroppable")),d=p.getUI("workzone"),u="ltr"===p.direction,h=function(){i&&clearTimeout(i),i=null};t.on("dragenter",function(e){h(),a(e)&&(e.preventDefault(),e.stopPropagation(),n=d.data("rectangle"))}).on("dragleave",function(e){h(),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,o=n.top+n.height,r=o-p.getUI("navdock").outerHeight(!0);((t=e.pageYr)&&(a=n.cwdEdge>e.pageX?(u?"navbar":"cwd")+(t?"Up":"Down"):(u?"cwd":"navbar")+(t?"Up":"Down"),t||"cwd"===a.substr(0,3)&&(o=11,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",nonameDateFormat:"ymd-His",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",group:"Selects",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"},mimeTypes:{},rules:{defaults:function(e){return!(!e||e.added&&!Array.isArray(e.added)||e.removed&&!Array.isArray(e.removed)||e.changed&&!Array.isArray(e.changed))},open:function(t){return t&&t.cwd&&t.files&&e.isPlainObject(t.cwd)&&Array.isArray(t.files)},tree:function(e){return e&&e.tree&&Array.isArray(e.tree)},parents:function(e){return e&&e.tree&&Array.isArray(e.tree)},tmb:function(t){return t&&t.images&&(e.isPlainObject(t.images)||Array.isArray(t.images))},upload:function(t){return t&&(e.isPlainObject(t.added)||Array.isArray(t.added))},search:function(e){return e&&e.files&&Array.isArray(e.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 n=this.normalize(n),this.validResponse("upload",n)?(n.removed=e.merge(n.removed||[],e.map(n.added||[],function(e){return e.hash})),n):{error:response.norError||["errResponse"]}},iframeCnt:0,uploads:{xhrUploading:!1,failSyncTm:null,chunkfailReq:{},checkExists:function(t,n,i,a){var o,r=e.Deferred(),s=[],l={},c=function(){for(var e=t.length;--e>-1;)t[e]._remove=!0},d=function(){r.resolve(s,l)},p=function(){var r=[],p=[],u=n!==i.cwd().hash?i.path(n,!0)+i.option("separator",n):"",h=function(e){var n=e==p.length-1,o={title:i.i18n("cmdupload"),text:["errExists",u+p[e].name,"confirmRepl"],all:!n,accept:{label:"btnYes",callback:function(t){n||t?d():h(++e)}},reject:{label:"btnNo",callback:function(i){var a;if(i)for(a=p.length;e0&&delete o.reject,i.confirm(o)};return i.file(n).read?(o=e.map(t,function(e,t){return!e.name||i.UA.iOS&&"image.jpg"===e.name?null:{i:t,name:e.name}}),void i.request({data:{cmd:"ls",target:n,intersect:e.map(o,function(e){return e.name})},notify:{type:"preupload", cnt:1,hideCnt:!0},preventFail:!0}).done(function(t){var a,s;t&&(t.error?c():i.options.overwriteUploadConfirm&&i.option("uploadOverwrite",n)&&t.list&&(Array.isArray(t.list)?r=t.list||[]:(a=[],r=e.map(t.list,function(e){return"string"==typeof e?e:(a=a.concat(e),null)}),a.length&&(r=r.concat(a)),l=t.list),p=e.map(o,function(t){return e.inArray(t.name,r)!==-1?t:null}),p.length&&r.length&&n==i.cwd().hash&&(s=e.map(i.files(n),function(e){return e.name}),e.map(r,function(t){return e.inArray(t,s)===-1||null}).length&&i.sync()))),p.length>0?h(0):d()}).fail(function(e){c(),d(),e&&i.error(e)})):void d()};return i.api>=2.1&&"object"==typeof t[0]?p():d(),r},checkFile:function(t,n,i){if(t.checked||"files"==t.type)return t.files;if("data"==t.type){var a,o,r=e.Deferred(),s=[],l=[],c=0,d=[],p=function(e){var t,i,a,o=[],r=function(e){return Array.prototype.slice.call(e||[],0)},u=n.options.folderUploadExclude[n.OS]||null;a=e.length;for(var h=0;h=2.1){c++,d.push(i.fullPath),t=i.createReader();var o=[],f=function(){t.readEntries(function(e){if(e.length)o=o.concat(r(e)),f();else{for(var t=0;t0?(n.uploads.checkExists(a,i,n,o).done(function(o,u){var h,f=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",i)&&(null===o&&(t.overwrite=0,o=[]),a=e.map(a,function(t){var a,r,s,l;return t.isDirectory&&o.length&&(a=e.inArray(t.name,o),a!==-1&&(o.splice(a,1),r=n.uniqueName(t.name+n.options.backupSuffix,null,""),e.each(u,function(e,n){if(t.name==n)return s=e,!1}),s||(s=n.fileByName(t.name,i).hash),n.lockfiles({files:[s]}),l=n.request({data:{cmd:"rename",target:s,name:r},notify:{type:"rename",cnt:1}}).fail(function(e){t._remove=!0,n.sync()}).always(function(){n.unlockfiles({files:[s]})}),f.push(l))),t._remove?null:t})),e.when.apply(e,f).done(function(){a.length>0?(h=setTimeout(function(){n.notify({type:"readdir",cnt:1,hideCnt:!0})},n.options.notifyDelay),p(a),setTimeout(function e(){c>0?setTimeout(e,10):(h&&clearTimeout(h),n.notify({type:"readdir",cnt:-1}),r.resolve([s,l,o,u,d]))},10)):r.reject()})}),r.promise()):r.reject()}var u=[],h=[],f=t.files[0];if("html"==t.type){var m,g=e("").append(e.parseHTML(f.replace(/ src=/gi," _elfsrc=")));e("img[_elfsrc]",g).each(function(){var n,i,a=e(this),o=a.closest("a");o&&o.attr("href")&&o.attr("href").match(/\.(?:jpe?g|gif|bmp|png)/i)&&(i=o.attr("href")),n=a.attr("_elfsrc"),n&&(i?(e.inArray(i,u)==-1&&u.push(i),e.inArray(n,h)==-1&&h.push(n)):e.inArray(n,u)==-1&&u.push(n)),1===u.length&&u[0].match(/^data:image\/png/)&&(t.clipdata=!0)}),m=e("a[href]",g),m.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!==m.length&&t.pathname.match(/(?:\.html?|\/[^\/.]*)$/i)||e.inArray(t.href,u)==-1&&e.inArray(t.href,h)==-1&&u.push(t.href))})}else{var v,b,y;for(v=/(http[^<>"{}|\\^\[\]`\s]+)/gi;b=v.exec(f);)y=b[1].replace(/&/g,"&"),e.inArray(y,u)==-1&&u.push(y)}return u},xhr:function(t,n){var i=n?n:this,a=i.getUI(),o=new XMLHttpRequest,r=null,s=null,l=t.checked,c=t.isDataType||"data"==t.type,d=t.target||i.cwd().hash,p=t.dropEvt||null,u=i.option("uploadMaxConn",d)!=-1,h=Math.min(5,Math.max(1,i.option("uploadMaxConn",d))),f=1e4,m=30,g=0,v=function(t){var n=e.Deferred();return t.promise?t.always(function(e){n.resolve(Array.isArray(e)&&e.length?c?e[0][0]:e[0]:{})}):n.resolve(t.length?c?t[0][0]:t[0]:{}),n},b=e.Deferred().fail(function(e){var t;"userabort"===e&&(t=!0,e=void 0),w&&(i.uploads.xhrUploading||t)&&v(w).done(function(e){e._cid?i.uploads.chunkfailReq[e._cid]||(i.uploads.chunkfailReq[e._cid]=!0,setTimeout(function(){n.request({data:{cmd:"upload",target:d,chunk:e._chunk,cid:e._cid,upload:["chunkfail"],mimes:"chunkfail"},options:{type:"post",url:i.uploadURL},preventDefault:!0}).always(function(){delete i.uploads.chunkfailReq[e._chunk]})},1e3)):(i.uploads.failSyncTm&&clearTimeout(i.uploads.failSyncTm),i.uploads.failSyncTm=setTimeout(function(){i.sync(d)},1e3))}),!t&&i.sync(),i.uploads.xhrUploading=!1,w=null,e&&i.error(e)}).done(function(e){i.uploads.xhrUploading=!1,w=null,e&&(i.currentReqCmd="upload",e.warning&&i.error(e.warning),i.updateCache(e),e.removed&&i.remove(e),e.added&&i.add(e),e.changed&&i.change(e),i.trigger("upload",e,!1),i.trigger("uploaddone"),e.sync&&i.sync(),e.debug&&n.debug("backend-debug",e))}).always(function(){i.abortXHR(o),a.off("uploadabort",M),e(window).off("unload",M),r&&clearTimeout(r),s&&clearTimeout(s),l&&!t.multiupload&&O()&&i.notify({type:"upload",cnt:-x,progress:0,size:0}),P&&I.children(".elfinder-notify-chunkmerge").length&&i.notify({type:"chunkmerge",cnt:-1})}),y=new FormData,w=t.input?t.input.files:i.uploads.checkFile(t,i,d),x=t.checked&&c?w[0].length:w.length,k=0,C=0,z=0,T=!1,I=i.ui.notify,A=!0,S=!1,O=function(){return T=T||I.children(".elfinder-notify-upload").length},M=function(e,t){S=!0,i.abortXHR(o,{quiet:!0,abort:!0}),b.reject(t),O()&&i.notify({type:"upload",cnt:I.children(".elfinder-notify-upload").data("cnt")*-1,progress:0,size:0})},U=function(e){I.children(".elfinder-notify-upload").children(".elfinder-notify-cancel")[e?"show":"hide"]()},j=function(e){return e||(e=z),setTimeout(function(){T=!0,i.notify({type:"upload",cnt:x,progress:k-C,size:e,cancel:function(){a.trigger("uploadabort","userabort")}}),C=k,t.multiupload?A&&U(!0):U(A&&k=2.1029&&(e=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),"function"==typeof y["delete"]&&y["delete"]("reqid"),y.append("reqid",e),o._requestId=e),o.send(y))},f)):a.trigger("uploadabort",["errAbort","errTimeout"])},E=t.renames||null,F=t.hashes||null,P=!1;if(a.one("uploadabort",M),e(window).one("unload."+n.namespace,M),!P&&(C=k),!c&&!x)return b.reject(["errUploadNoFiles"]);o.addEventListener("error",function(){0==o.status?S?b.reject():!c&&t.files&&e.map(t.files,function(e){return e.type||e.size!==(i.UA.Safari?1802:0)?null:e}).length?(errors.push("errFolderUpload"),b.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?b.reject(["errUploadNoFiles"]):D():a.trigger("uploadabort","errConnect")},!1),o.addEventListener("load",function(e){var n,l=o.status,d=0,p="";if(l>=400?p=l>500?"errResponse":["errResponse","errServerError"]:o.responseText||(p=["errResponse","errDataEmpty"]),p&&(a.trigger("uploadabort"),v(w).done(function(e){return b.reject(e._cid?null:p)})),k=z,O()&&(d=k-C)&&i.notify({type:"upload",cnt:0,progress:d,size:0}),n=i.parseUploadData(o.responseText),n._chunkmerged){y=new FormData;var u=[{_chunkmerged:n._chunkmerged,_name:n._name,_mtime:n._mtime}];return P=!0,a.off("uploadabort",M),s=setTimeout(function(){i.notify({type:"chunkmerge",cnt:1})},i.options.notifyDelay),void(c?R(u,w[1]):R(u))}n._multiupload=!!t.multiupload,n.error?(i.trigger("uploadfail",n),n._chunkfailure||n._multiupload?(S=!0,i.uploads.xhrUploading=!1,r&&clearTimeout(r),I.children(".elfinder-notify-upload").length?(i.notify({type:"upload",cnt:-x,progress:0,size:0}),b.reject(n.error)):b.reject()):b.reject(n.error)):b.resolve(n)},!1),o.upload.addEventListener("loadstart",function(e){!P&&e.lengthComputable&&(k=e.loaded,g&&(k=0),z=e.total,k||(k=parseInt(.05*z)),O()&&(i.notify({type:"upload",cnt:0,progress:k-C,size:t.multiupload?0:z}),C=k))},!1),o.upload.addEventListener("progress",function(e){var n;e.lengthComputable&&!P&&o.readyState<2&&(k=e.loaded,!t.checked&&k>0&&!r&&(r=j(o._totalSize-k)),z||(z=e.total,k||(k=parseInt(.05*z))),n=k-C,O()&&n/e.total>=.05&&(i.notify({type:"upload",cnt:0,progress:n,size:0}),C=k),!t.multiupload&&k>=z&&(A=!1,U(!1)))},!1);var R=function(a,s){var f,m,g,v,w,k,C,z,T,I,M,D,P,R,H=0,q=1,N=[],_=0,L=x,W=0,$=[],B=(new Date).getTime().toString().substr(-9),V=Math.min((n.uplMaxSize?n.uplMaxSize:2097152)-8190,n.options.uploadMaxChunkSize),K=!u&&"",X=function(a,o){var s,l,u=[],h=0;if(!S){for(;a.length&&u.length=2.1&&("slice"in z?K="slice":"mozSlice"in z?K="mozSlice":"webkitSlice"in z&&(K="webkitSlice")))}catch(J){x--,L--;continue}if(f&&m>f||!K&&n.uplMaxSize&&m>n.uplMaxSize)i.error(i.i18n("errUploadFile",z.name)+" "+i.i18n("errUploadFileSize")),x--,L--;else if(!z.type||i.uploadMimeCheck(z.type,d))if(K&&m>V){for(w=0,k=V,C=-1,L=Math.floor(m/V),g=z.lastModified?Math.round(z.lastModified/1e3):0,W+=m,$[B]=0;w<=m;)T=z[K](w,k),T._chunk=z.name+"."+ ++C+"_"+L+".part",T._cid=B,T._range=w+","+T.size+","+m,T._mtime=g,$[B]++,H&&_++,"undefined"==typeof N[_]&&(N[_]=[],c&&(N[_][0]=[],N[_][1]=[])),H=V,q=1,c?(N[_][0].push(T),N[_][1].push(s[v])):N[_].push(T),w=k,k=w+V;null==T?(i.error(i.i18n("errUploadFile",z.name)+" "+i.i18n("errUploadFileSize")),x--,L--):(L+=C,H=0,q=1,_++)}else(n.uplMaxSize&&H+m>=n.uplMaxSize||q>n.uplMaxFile)&&(H=0,q=1,_++),"undefined"==typeof N[_]&&(N[_]=[],c&&(N[_][0]=[],N[_][1]=[])),c?(N[_][0].push(z),N[_][1].push(s[v])):N[_].push(z),H+=m,W+=m,q++;else i.error(i.i18n("errUploadFile",z.name)+" "+i.i18n("errUploadMime")+" ("+i.escape(z.type)+")"),x--,L--}if(0==N.length)return t.checked=!0,!1;if(N.length>1)return r=j(W),I=[],M=0,D=N.length,P=[],G(),!0;c?(a=N[0][0],s=N[0][1]):a=N[0]}return l||(n.UA.Safari&&t.files?o._totalSize=W:r=j(W)),l=!0,a.length||b.reject(["errUploadNoFiles"]),o.open("POST",i.uploadURL,!0),n.customHeaders&&e.each(n.customHeaders,function(e){o.setRequestHeader(e,this)}),n.xhrFields&&e.each(n.xhrFields,function(e){e in o&&(o[e]=this)}),i.api>=2.1029&&(R=(+new Date).toString(16)+Math.floor(1e3*Math.random()).toString(16),y.append("reqid",R),o._requestId=R),y.append("cmd","upload"),y.append(i.newAPI?"target":"current",d),E&&E.length&&(e.each(E,function(e,t){y.append("renames[]",t)}),y.append("suffix",n.options.backupSuffix)),F&&e.each(F,function(e,t){y.append("hashes["+e+"]",t)}),e.each(i.options.customData,function(e,t){y.append(e,t)}),e.each(i.options.onlyMimes,function(e,t){y.append("mimes[]",t)}),e.each(a,function(e,i){i._chunkmerged?(y.append("chunk",i._chunkmerged),y.append("upload[]",i._name),y.append("mtime[]",i._mtime)):(i._chunkfail?(y.append("upload[]","chunkfail"),y.append("mimes","chunkfail")):(y.append("upload[]",i),t.clipdata&&(t.overwrite=0,y.append("name[]",n.date(n.nonameDateFormat)+".png")),n.UA.iOS&&"image.jpg"===i.name&&(t.overwrite=0,y.append("name[]",n.date(n.nonameDateFormat)+".jpg"))),i._chunk?(y.append("chunk",i._chunk),y.append("cid",i._cid),y.append("range",i._range),y.append("mtime[]",i._mtime)):y.append("mtime[]",i.lastModified?Math.round(i.lastModified/1e3):0))}),c&&e.each(s,function(e,t){y.append("upload_path[]",t)}),0===t.overwrite&&y.append("overwrite",0),p&&y.append("dropWith",parseInt((p.altKey?"1":"0")+(p.ctrlKey?"1":"0")+(p.metaKey?"1":"0")+(p.shiftKey?"1":"0"),2)),o.send(y),!0};if(c)l?R(w[0],w[1]):w.done(function(t){if(E=[],x=t[0].length){if(t[4]&&t[4].length)return void n.request({data:{cmd:"mkdir",target:d,dirs:t[4]},notify:{type:"mkdir",cnt:t[4].length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?h=1:(h=0,b.reject(e))}).done(function(n){n.hashes&&(t[1]=e.map(t[1],function(e){return e=e.replace(/\/[^\/]*$/,""),""===e?d:n.hashes[e]}))}).always(function(e){h&&(E=t[2],F=t[3],R(t[0],t[1]))});t[1]=e.map(t[1],function(){return d}),E=t[2],F=t[3],R(t[0],t[1])}else b.reject(["errUploadNoFiles"])}).fail(function(){b.reject()});else if(w.length>0)if(t.clipdata||null!=E)R(w)||b.reject();else{var H=[],q=[],N=n.options.folderUploadExclude[n.OS]||null;e.each(w,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&&e.inArray(i,H)===-1&&H.push(i)),void q.push(i))}),E=[],F={},H.length?!function(){var t=e.map(H,function(e){return e.indexOf("/")===-1?{name:e}:null}),i=[];n.uploads.checkExists(t,d,n,!0).done(function(a,o){var r,s,l,p=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",d)&&(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(q.concat(),function(t,n){0===e.inArray(n,i)&&(w[t]._remove=!0,delete q[t])}),w=e.map(w,function(e){return e._remove?null:e}),q=e.map(q,function(e){return void 0===e?null:e}),t.length?(r=e.Deferred(),a.length?e.each(a,function(t,i){s=n.uniqueName(i+n.options.backupSuffix,null,""),e.each(o,function(e,t){if(a[0]==t)return l=e,!1}),l||(l=n.fileByName(a[0],d).hash),n.lockfiles({files:[l]}),p.push(n.request({data:{cmd:"rename",target:l,name:s},notify:{type:"rename",cnt:1}}).fail(function(e){b.reject(e),n.sync()}).always(function(){n.unlockfiles({files:[l]})}))}):p.push(null),e.when.apply(e,p).done(function(){n.request({data:{cmd:"mkdir",target:d,dirs:H},notify:{type:"mkdir",cnt:H.length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?h=1:(h=0,b.reject(e))}).done(function(t){t.hashes&&(q=e.map(q.concat(),function(e){return""===e?d:t.hashes["/"+e]}))}).always(function(e){h&&(c=!0,R(w,q)||b.reject())})})):b.reject()})}():n.uploads.checkExists(w,d,n).done(function(i,a){n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",d)&&(null===i?t.overwrite=0:(E=i,F=a),w=e.map(w,function(e){return e._remove?null:e})),x=w.length,x>0?R(w)||b.reject():b.reject()})}else b.reject();return b},iframe:function(t,n){var i,a,o,r,s=n?n:this,l=!!t.input&&t.input,c=!l&&s.uploads.checkFile(t,s),d=e.Deferred().fail(function(e){e&&s.error(e)}),p="iframe-"+n.namespace+ ++s.iframeCnt,u=e('
'),h=this.UA.IE,f=function(){r&&clearTimeout(r),o&&clearTimeout(o),a&&s.notify({type:"upload",cnt:-i}),setTimeout(function(){h&&e('