mirror of
https://github.com/avecms/AVE.cms.git
synced 2025-01-22 15:30:07 +00:00
21 lines
383 KiB
JavaScript
Executable File
21 lines
383 KiB
JavaScript
Executable File
/*!
|
||
* elFinder - file manager for web
|
||
* Version 2.1.25 (2017-06-23)
|
||
* http://elfinder.org
|
||
*
|
||
* Copyright 2009-2017, Studio 42
|
||
* Licensed under a 3-clauses BSD license
|
||
*/
|
||
!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){var a,r,o,s,l=this,d=["button"],t=e(t),c=e("<div/>").append(t.contents()).attr("class",t.attr("class")||"").attr("style",t.attr("style")||""),u=t.attr("id")||"",h="elfinder-"+(u?u:Math.random().toString().substr(2,7)),p="mousedown."+h,f="keydown."+h,m="keypress."+h,g=!0,v=!0,b=["enable","disable","load","open","reload","select","add","remove","change","dblclick","getfile","lockfiles","unlockfiles","selectfiles","unselectfiles","dragstart","dragstop","search","searchend","viewchange"],y="",w={path:"",url:"",tmbUrl:"",disabled:[],separator:"/",archives:[],extract:[],copyOverwrite:!0,uploadOverwrite:!0,uploadMaxSize:0,jpgQuality:100,tmbCrop:!1,tmb:!1},k={},x={},C={},T=[],A={},z={},I=[],O={},S=[],U=[],M=new l.command(l),D="auto",E=400,F=null,P="./sounds/",j=e(document.createElement("audio")).hide().appendTo("body")[0],R=0,H="",N=null,q=function(n){var i,a,r,o,s,d,c={},u={};l.api>=2.1?n.options.uiCmdMap&&(l.commandMap=n.options.uiCmdMap&&Object.keys(n.options.uiCmdMap).length?n.options.uiCmdMap:{},H!==JSON.stringify(l.commandMap)&&(H=JSON.stringify(l.commandMap))):l.options.sync=0,n.init?(x={},C={}):(d=y,i="elfinder-subtree-loaded "+l.res("class","navexpand"),s=l.res("class","navcollapse"),a=Object.keys(x),r=function(t){if(!x[t])return!0;var n="directory"===x[t].mime,a=x[t].phash;!(!n||c[a]||!u[a]&&e("#"+l.navHash2Id(x[t].hash)).is(":hidden")&&e("#"+l.navHash2Id(a)).next(".elfinder-navbar-subtree").children().length>100)||!n&&a===y||O[t]?n&&(u[a]=!0):(n&&!c[a]&&(c[a]=!0,e("#"+l.navHash2Id(a)).removeClass(i).next(".elfinder-navbar-subtree").empty()),$(x[t]))},o=function(){a.length&&(N&&N._abort(),N=l.asyncJob(r,a,{interval:20,numPerOnce:100}))},l.trigger("filesgc").one("filesgc",function(){a=[]}),l.one("opendone",function(){d!==y&&(t.data("lazycnt")?l.one("lazydone",o):o())})),l.sorters=[],y=n.cwd.hash,_(n.files),x[y]||_([n.cwd]),l.lastDir(y),l.autoSync()},_=function(t){var n,i,a={name:!0,perm:!0,date:!0,size:!0,kind:!0},r=0===l.sorters.length,o=t.length,s=function(t){var t=t||{};l.sorters=[],e.each(l.sortRules,function(e){(a[e]||"undefined"!=typeof t[e]||"mode"===e&&"undefined"!=typeof t.perm)&&l.sorters.push(e)})};for(i=0;o>i;i++)n=Object.assign({},t[i]),n.name&&n.hash&&n.mime&&(r&&n.phash===y&&(s(n),r=!1),n.isroot&&n.phash&&(l.leafRoots[n.phash]?-1===e.inArray(n.hash,l.leafRoots[n.phash])&&l.leafRoots[n.phash].push(n.hash):l.leafRoots[n.phash]=[n.hash],x[n.phash]&&(x[n.phash].dirs||(x[n.phash].dirs=1),n.ts&&(x[n.phash].ts||0)<n.ts&&(x[n.phash].ts=n.ts))),x[n.hash]&&$(x[n.hash],!0),x[n.hash]=n,"directory"!==n.mime||C[n.hash]||(C[n.hash]={}),n.phash&&(C[n.phash]||(C[n.phash]={}),C[n.phash][n.hash]=!0));r&&s()},L=function(t){var n=t.length,i={},a=function(t){var n=x[t];n&&("directory"===n.mime&&(i[t]&&delete l.roots[i[t]],l.searchStatus.state<2&&e.each(x,function(e,n){n.phash==t&&a(e)})),$(x[t]))};for(e.each(l.roots,function(e,t){i[t]=e});n--;)a(t[n])},W=function(t){e.each(t,function(t,n){var i=n.hash;x[i]&&e.each(["locked","hidden","width","height"],function(e,t){x[i][t]&&!n[t]&&delete x[i][t]}),x[i]=x[i]?Object.assign(x[i],n):n})},$=function(e,t){var n=e.hash,i=e.phash;i&&C[i]&&delete C[i][n],t||(C[n]&&delete C[n],l.optionsByHashes[n]&&delete l.optionsByHashes[n]),delete x[n]},B=0,V=[],K=!1,G=function(n){var i,a=n.keyCode,r=!(!n.ctrlKey&&!n.metaKey);g&&(e.each(z,function(e,t){t.type==n.type&&t.keyCode==a&&t.shiftKey==n.shiftKey&&t.ctrlKey==r&&t.altKey==n.altKey&&(n.preventDefault(),n.stopPropagation(),t.callback(n,l),l.debug("shortcut-exec",e+" : "+t.description))}),a!=e.ui.keyCode.TAB||e(n.target).is(":input")||n.preventDefault(),"keydown"===n.type&&a==e.ui.keyCode.ESCAPE&&(t.find(".ui-widget:visible").length||l.clipboard().length&&l.clipboard([]),e.ui.ddmanager&&(i=e.ui.ddmanager.current,i&&i.helper&&i.cancel()),t.find(".ui-widget.elfinder-button-menu").hide(),l.trigger("keydownEsc",n)))},J=new Date,Y=window.parent!==window,X=function(){var t,n;if(Y)try{n=e("iframe",window.parent.document),n.length&&e.each(n,function(n,i){return i.contentWindow===window?(t=e(i),!1):void 0})}catch(i){}return t}();return this.api=null,this.newAPI=!1,this.oldAPI=!1,this.netDrivers=[],this.baseUrl="",this.options=e.extend(!0,{},this._options,n||{}),w.dispInlineRegex=this.options.dispInlineRegex,this.options.cssAutoLoad&&!function(n){var i,a,r,o,s,l=e('head > script[src$="js/elfinder.min.js"],script[src$="js/elfinder.full.js"]:first');l.length?(r=e("<style>.elfinder{visibility:hidden;overflow:hidden}</style>"),e("head").append(r),a=l.attr("src").replace(/js\/[^\/]+$/,""),a.match(/^(https?\/\/|\/)/)||(i=e("head > base[href]").attr("href"))&&(a=i.replace(/\/$/,"")+"/"+a),n.loadCss([a+"css/elfinder.min.css",a+"css/theme.css"]),n.baseUrl=a,Array.isArray(n.options.cssAutoLoad)&&n.loadCss(n.options.cssAutoLoad),s=1e3,o=setInterval(function(){--s>0&&"hidden"!==t.css("visibility")&&(clearInterval(o),r.remove(),n.trigger("cssloaded"))},10)):n.options.cssAutoLoad=!1}(this),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),Y||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(l.options.debug,function(){t[this]=!0}),l.options.debug=t}():this.options.debug=!1,this.noConflicts={},this.noConflict=function(){e.each(d,function(t,n){e.fn[n]&&"function"==typeof e.fn[n].noConflict&&(l.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)&&(l.isCORS=!0,e.isPlainObject(l.options.customHeaders)||(l.options.customHeaders={}),e.isPlainObject(l.options.xhrFields)||(l.options.xhrFields={}),l.options.requestType="post",l.options.customHeaders["X-Requested-With"]="XMLHttpRequest",l.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.abortCmdsOnOpen=this.options.abortCmdsOnOpen||["tmb","parents"],this.id=u,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=h,this.lang=this.i18[this.options.lang]&&this.i18[this.options.lang].messages?this.options.lang:"en",s="en"==this.lang?this.i18.en:e.extend(!0,{},this.i18.en,this.i18[this.lang]),this.direction=s.direction,this.messages=s.messages,this.dateFormat=this.options.dateFormat||s.dateFormat,this.fancyFormat=this.options.fancyDateFormat||s.fancyDateFormat,this.nonameDateFormat=(this.options.nonameDateFormat||s.nonameDateFormat).replace(/[\/\\]/g,"_"),this.today=new Date(J.getFullYear(),J.getMonth(),J.getDate()).getTime()/1e3,this.yesterday=this.today-86400,o=this.options.UTCDate?"UTC":"",this.getHours="get"+o+"Hours",this.getMinutes="get"+o+"Minutes",this.getSeconds="get"+o+"Seconds",this.getDate="get"+o+"Date",this.getDay="get"+o+"Day",this.getMonth="get"+o+"Month",this.getFullYear="get"+o+"FullYear",this.cssClass="ui-helper-reset ui-helper-clearfix ui-widget ui-widget-content ui-corner-all elfinder elfinder-"+("rtl"==this.direction?"rtl":"ltr")+(this.UA.Touch?" elfinder-touch"+(this.options.resizable?" touch-punch":""):"")+(this.UA.Mobile?" elfinder-mobile":"")+" "+this.options.cssClass,this.zIndex,this.searchStatus={state:0,query:"",target:"",mime:"",mixed:!1,ininc:!1},this.storage=function(){try{return"localStorage"in window&&null!==window.localStorage?(l.UA.Safari&&(window.localStorage.setItem("elfstoragecheck",1),window.localStorage.removeItem("elfstoragecheck")),l.localStorage):l.cookie}catch(e){return l.cookie}}(),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 l.sortRules[e]}),this.compare=e.proxy(this.compare,this),this.notifyDelay=this.options.notifyDelay>0?parseInt(this.options.notifyDelay):500,this.draggingUiHelper=null,function(){var n,i,a,r,o=f+"draggable keyup."+h+"draggable";l.draggable={appendTo:t,addClasses:!1,distance:4,revert:!0,refreshPositions:!1,cursor:"crosshair",cursorAt:{left:50,top:47},scroll:!1,start:function(o,s){var d,c,u=s.helper,h=e.map(u.data("files")||[],function(e){return e?(O[e]=!0,e):null}),p=!1;for(r=t.attr("style"),t.width(t.width()).height(t.height()),n="ltr"===l.direction,i=l.getUI("workzone").data("rectangle"),a=i.top+i.height,l.draggingUiHelper=u,d=h.length;d--;)if(c=h[d],x[c].locked){p=!0,u.data("locked",!0);break}!p&&l.trigger("lockfiles",{files:h}),u.data("autoScrTm",setInterval(function(){u.data("autoScr")&&l.autoScroll[u.data("autoScr")](u.data("autoScrVal"))},50))},drag:function(t,r){var o,s=r.helper;(o=i.top>t.pageY)||a<t.pageY?(i.cwdEdge>t.pageX?s.data("autoScr",(n?"navbar":"cwd")+(o?"Up":"Down")):s.data("autoScr",(n?"cwd":"navbar")+(o?"Up":"Down")),s.data("autoScrVal",Math.pow(o?i.top-t.pageY:t.pageY-a,1.3))):s.data("autoScr")&&s.data("refreshPositions",1).data("autoScr",null),s.data("refreshPositions")&&e(this).elfUiWidgetInstance("draggable")&&(s.data("refreshPositions")>0?(e(this).draggable("option",{refreshPositions:!0,elfRefresh:!0}),s.data("refreshPositions",-1)):(e(this).draggable("option",{refreshPositions:!1,elfRefresh:!1}),s.data("refreshPositions",null)))},stop:function(n,i){var a,s=i.helper;e(document).off(o),e(this).elfUiWidgetInstance("draggable")&&e(this).draggable("option",{refreshPositions:!1}),l.draggingUiHelper=null,l.trigger("focus").trigger("dragstop"),s.data("droped")||(a=e.map(s.data("files")||[],function(e){return e||null}),l.trigger("unlockfiles",{files:a}),l.trigger("selectfiles",{files:a})),l.enable(),t.attr("style",r),s.data("autoScrTm")&&clearInterval(s.data("autoScrTm"))},helper:function(t,n){var i,a,r,s=this.id?e(this):e(this).parents("[id]:first"),d=e('<div class="elfinder-drag-helper"><span class="elfinder-drag-helper-icon-status"/></div>'),c=function(t){var n,i=t.mime,a=l.tmb(t);return n='<div class="elfinder-cwd-icon '+l.mime2class(i)+' ui-corner-all"/>',a&&(n=e(n).addClass(a.className).css("background-image","url('"+a.url+"')").get(0).outerHTML),n};return l.draggingUiHelper&&l.draggingUiHelper.stop(!0,!0),l.trigger("dragstart",{target:s[0],originalEvent:t}),i=s.hasClass(l.res("class","cwdfile"))?l.selected():[l.navId2Hash(s.attr("id"))],d.append(c(x[i[0]])).data("files",i).data("locked",!1).data("droped",!1).data("namespace",h).data("dropover",0),(a=i.length)>1&&d.append(c(x[i[a-1]])+'<span class="elfinder-drag-num">'+a+"</span>"),e(document).on(o,function(e){var t=e.shiftKey||e.ctrlKey||e.metaKey;r!==t&&(r=t,d.is(":visible")&&d.data("dropover")&&!d.data("droped")&&(d.toggleClass("elfinder-drag-helper-plus",d.data("locked")?!0:r),l.trigger(r?"unlockfiles":"lockfiles",{files:i,helper:d})))}),d}}}(),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,r,o=e(this),s=e.map(n.helper.data("files")||[],function(e){return e||null}),d=[],c=[],u=[],p=n.helper.hasClass("elfinder-drag-helper-plus"),f="class";if("undefined"==typeof t.button||n.helper.data("namespace")!==h||!l.insideWorkzone(t.pageX,t.pageY))return!1;for(a=o.hasClass(l.res(f,"cwdfile"))?l.cwdId2Hash(o.attr("id")):o.hasClass(l.res(f,"navdir"))?l.navId2Hash(o.attr("id")):y,i=s.length;i--;)r=s[i],r!=a&&x[r].phash!=a?d.push(r):(p&&r!==a&&x[a].write?c:u).push(r);return u.length?!1:(n.helper.data("droped",!0),c.length&&(n.helper.hide(),l.exec("duplicate",c)),void(d.length&&(n.helper.hide(),l.clipboard(d,!p),l.exec("paste",a,void 0,a).always(function(){l.clipboard([]),l.trigger("unlockfiles",{files:s})}),l.trigger("drop",{files:s}))))}},this.enabled=function(){return g&&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||y;var i,a;if(!n&&(e.each(l.roots,function(e,n){return 0===t.indexOf(e)?(i=n,!1):void 0}),i))return i;for(i=x[t];i&&i.phash&&(n||!i.isroot);)i=x[i.phash];if(i)return i.hash;for(;a in x&&x.hasOwnProperty(a);)if(i=x[a],!i.phash&&"directory"==!i.mime&&i.read)return i.hash;return""},this.cwd=function(){return x[y]||{}},this.option=function(t,n){var i;return n=n||y,l.optionsByHashes[n]&&"undefined"!=typeof l.optionsByHashes[n][t]?l.optionsByHashes[n][t]:y!==n?(i="",e.each(l.volOptions,function(e,a){return 0===n.indexOf(e)?(i=a[t]||"",!1):void 0}),i):k[t]||""},this.getDisabledCmds=function(t){var n=["hidden"];return Array.isArray(t)||(t=[t]),e.each(t,function(t,i){var a=l.option("disabled",i);a&&e.each(a,function(t,i){-1===e.inArray(i,n)&&n.push(i)})}),n},this.file=function(e){return e?x[e]:void 0},this.files=function(t){var n={};return t?C[t]?(e.each(C[t],function(e){x[e]?n[e]=x[e]:delete C[t][e]}),Object.assign({},n)):{}:Object.assign({},x)},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=x[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=x[t]&&x[t].path?x[t].path:this.path2array(t,n).join(k.separator);if(i&&x[t]){i=Object.assign({notify:{type:"parents",cnt:1,hideCnt:!0}},i);var r,o=e.Deferred(),s=i.notify,d=!1,c=function(){l.request({data:{cmd:"parents",target:x[t].phash},notify:s,preventFail:!0}).done(u).fail(function(){o.reject()})},u=function(){l.one("parentsdone",function(){a=l.path(t,n),""===a&&d?(d=!1,c()):(s&&(clearTimeout(r),s.cnt=-parseInt(s.cnt||0),l.notify(s)),o.resolve(a))})};return a?o.resolve(a):(l.ui.tree?(s&&(r=setTimeout(function(){l.notify(s)},l.notifyDelay)),d=!0,u(!0)):c(),o)}return a},this.url=function(t,n){var i,a=x[t],n=n||{},r=n.async||!1,o=n.temporary||!1,s=r?e.Deferred():null,d=function(n){if(n)return n;if(a.url)return a.url;if(i=0===a.hash.indexOf(l.cwd().volumeid)?k.url:l.option("url",a.hash))return i+e.map(l.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");var r=Object.assign({},l.customData,{cmd:"file",target:a.hash});return l.oldAPI&&(r.cmd="open",r.current=a.phash),l.options.url+(-1===l.options.url.indexOf("?")?"?":"&")+e.param(r,!0)};if(!a||!a.read)return r?s.resolve(""):"";if("1"==a.url)this.request({data:{cmd:"url",target:t,options:{temporary:o?1:0}},preventDefault:!0,options:{async:r},notify:r?{type:o?"file":"url",cnt:1,hideCnt:!0}:{}}).done(function(e){a.url=e.url||""}).fail(function(){a.url=""}).always(function(){var e;return a.url&&o&&(e=a.url,a.url="1"),r?void s.resolve(d(e)):d(e)});else{if(!r)return d();s.resolve(d())}return r?s:void 0},this.openUrl=function(t,n){var i=x[t],a="";if(!i||!i.read)return"";if(!n)if(i.url){if(1!=i.url)return i.url}else if(k.url&&0===i.hash.indexOf(l.cwd().volumeid))return k.url+e.map(this.path2array(t),function(e){return encodeURIComponent(e)}).slice(1).join("/");return a=this.options.url,a=a+(-1===a.indexOf("?")?"?":"&")+(this.oldAPI?"cmd=open¤t="+i.phash:"cmd=file")+"&target="+i.hash,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",r="";return e.isPlainObject(t)&&(l.searchStatus.state&&0!==t.hash.indexOf(l.cwd().volumeid)?(n=l.option("tmbUrl",t.hash),i=l.option("tmbCrop",t.hash)):(n=k.tmbUrl,i=k.tmbCrop),i&&(a+=" elfinder-cwd-bgurl-crop"),"self"===n&&0===t.mime.indexOf("image/")?(r=l.openUrl(t.hash),a+=" elfinder-cwd-bgself"):(l.oldAPI||n)&&t&&t.tmb&&1!=t.tmb&&(r=n+t.tmb),r)?{url:r,className:a}:!1},this.selected=function(){return T.slice(0)},this.selectedFiles=function(){return e.map(T,function(e){return x[e]?Object.assign({},x[e]):null})},this.fileByName=function(e,t){var n;for(n in x)if(x.hasOwnProperty(n)&&x[n].phash==t&&x[n].name==e)return x[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),1>e&&(e=0)),e},this.request=function(t){var n,i,a,o=this,s=this.options,l=e.Deferred(),d=Object.assign({},s.customData,{mimes:s.onlyMimes},t.data||t),c=d.cmd,u=!t.asNotOpen&&"open"===c,h=!(t.preventDefault||t.preventFail),p=!(t.preventDefault||t.preventDone),f=Object.assign({},t.notify),m=!!t.cancel,g=!!t.raw,v=t.syncOnFail,b=!!t.lazy,x=t.prepare,C=t.navigate,T=Object.assign({url:s.url,async:!0,type:this.requestType,dataType:"json",cache:!1,data:d,headers:this.customHeaders,xhrFields:this.xhrFields},t.options||{}),A=function(e){e.warning&&o.error(e.warning),u?q(e):o.updateCache(e),e.changed&&e.changed.length&&W(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(c,e)})}).then(function(){return o.lazy(function(){o.trigger(c+"done")})}).then(function(){e.sync&&o.sync()})},z=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&&(!y||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"===T.type)return T.type="post",void(l.xhr=e=o.transport.send(T).fail(n).done(I));n=e.quiet?"":["errConnect","HTTP error "+e.status]}}o.trigger(c+"done"),l.reject(n,e,t)},I=function(t){var n=o.options.debug;if(o.currentReqCmd=c,!t.debug||n&&("all"===n||n["backend-error"])||(n||(o.options.debug={}),o.options.debug["backend-error"]=!0),g)return 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)})};return u?a("files"):"tree"===c&&a("tree"),t=o.normalize(t),o.validResponse(c,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.options&&(k=Object.assign({},w,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 x&&x(t),C&&(n=C.target||"added",t[n]&&t[n].length&&o.one(c+"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,d=t.action?t.action.data:void 0;return(d||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,d=t.action.data,l=e("<div/>").append(e('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all elfinder-tabstop"><span class="ui-button-text">'+o.i18n(i)+"</span></button>").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type)}).on("click",function(){o.exec(n,d||s,{_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};C.toast||(C.toast={}),!C.noselect&&o.trigger("selectfiles",{files:o.searchStatus.state>1?e.map(i,function(e){return e.hash}):s}),a.length?(C.noscroll||(a.first().trigger("scrolltoview",{blink:!1}),o.resources.blink(a,"lookme")),e.isPlainObject(C.toast.incwd)&&o.toast(l(C.toast.incwd))):e.isPlainObject(C.toast.inbuffer)&&o.toast(l(C.toast.inbuffer))})),l.resolve(t),void(t.debug&&o.debug("backend-debug",t))):l.reject(t.norError||"errResponse",i,t)};b?o.lazy(a):a()},O=function(e){i&&"pending"===i.state()&&(i.quiet=!0,i.abort(),e&&"unload"!=e.type&&"destroy"!=e.type&&o.autoSync())},M=function(e){if(o.trigger(c+"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)},D=function(){if(u){if(K)return l.reject();K=!0}if(B++,l.fail(function(e,t,n){O(),o.trigger(c+"fail",n),e&&(h?o.error(e):o.debug("error",o.i18n(e))),v&&o.sync()}),!c)return v=!1,l.reject("errCmdReq");if(o.maxTargets&&d.targets&&d.targets.length>o.maxTargets)return v=!1,l.reject(["errMaxTargets",o.maxTargets]);if(p&&l.done(A),f.type&&f.cnt&&(m&&(f.cancel=l),n=setTimeout(function(){o.notify(f),l.always(function(){f.cnt=-(parseInt(f.cnt)||0),o.notify(f)})},o.notifyDelay),l.always(function(){clearTimeout(n)})),u){for(;a=S.pop();)"pending"==a.state()&&(a.quiet=!0,a.abort());if(y!==d.target)for(;a=U.pop();)"pending"==a.state()&&(a.quiet=!0,a.abort())}return-1!==e.inArray(c,(o.cmdsToAdd+" autosync").split(" "))&&("autosync"!==c&&(o.autoSync("stop"),l.always(function(){o.autoSync()})),o.trigger("openxhrabort")),delete T.preventFail,l.xhr=i=o.transport.send(T).always(function(){--B,V.length?V.shift()():K=!1}).fail(z).done(I),u||d.compare&&"info"===c?(S.unshift(i),d.compare&&o.bind(o.cmdsToAdd+" autosync openxhrabort",M),l.always(function(){var t=e.inArray(i,S);d.compare&&o.unbind(o.cmdsToAdd+" autosync openxhrabort",M),-1!==t&&S.splice(t,1)})):-1!==e.inArray(c,o.abortCmdsOnOpen)&&(U.unshift(i),l.always(function(){var t=e.inArray(i,U);-1!==t&&U.splice(t,1)})),o.bind("unload destroy",M),l.always(function(){o.unbind("unload destroy",M)}),l},E=function(){return u&&(K=!1),r>B?D():(u?V.unshift(D):V.push(D),l)},F={opts:t,result:!0};return o.trigger("request."+c,F,!0),F.result?"object"==typeof F.result&&F.result.promise?(F.result.done(E).fail(function(){o.trigger(c+"done"),l.reject()}),l):E():(o.trigger(c+"done"),l.reject())},this.cache=function(e){Array.isArray(e)||(e=[e]),_(e)},this.updateCache=function(t){e.isPlainObject(t)&&(t.files&&t.files.length&&_(t.files),t.tree&&t.tree.length&&_(t.tree),t.removed&&t.removed.length&&L(t.removed),t.added&&t.added.length&&_(t.added),t.changed&&t.changed.length&&W(t.changed))},this.diff=function(t,n,i){var a={},r=[],o=[],s=[],l=function(e){for(var t=s.length;t--;)if(s[t].hash==e)return!0};return e.each(t,function(e,t){a[t.hash]=t}),e.each(x,function(e,t){a[e]||n&&t.phash!==n||o.push(e)}),e.each(a,function(t,n){var a=x[t];a?e.each(n,function(t){return i&&-1!==e.inArray(t,i)||n[t]===a[t]?void 0:(s.push(n),!1)}):r.push(n)}),e.each(o,function(t,n){var i=x[n],r=i.phash;r&&"directory"==i.mime&&-1===e.inArray(r,o)&&a[r]&&!l(r)&&s.push(a[r])}),{added:r,removed:o,changed:s}},this.sync=function(t,n){this.autoSync("stop");var i=this,a=function(){var i="",a=0,r=0;return t&&n&&e.each(x,function(e,n){n.phash&&n.phash===t&&(++a,r=Math.max(r,n.ts)),i=a+":"+r}),i},r=a(),o=e.Deferred().done(function(){i.trigger("sync")}),s=[this.request({data:{cmd:"open",reload:1,target:y,tree:!t&&this.ui.tree?1:0,compare:r},preventDefault:!0})],l=function(){for(var e,t=[],n=i.file(i.root(y)),a=n?n.volumeid:null,r=i.cwd().phash;r;)(e=i.file(r))?(0!==r.indexOf(a)&&(t.push({target:r,cmd:"tree"}),i.isRoot(e)||t.push({target:r,cmd:"parents"}),n=i.file(i.root(r)),a=n?n.volumeid:null),r=e.phash):r=null;return t};return!t&&i.api>=2&&(y!==this.root()&&s.push(this.request({data:{cmd:"parents",target:y},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&&-1===e.inArray("errOpen",t)?o.reject(t&&0!=a.status?t:void 0):(o.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&&r===e.cwd.compare)return o.reject();if(n={tree:[]},a=arguments.length,a>1)for(s=1;a>s;s++)arguments[s].tree&&arguments[s].tree.length&&n.tree.push.apply(n.tree,arguments[s].tree);if(i.api<2.1&&(n.tree||(n.tree=[]),n.tree.push(e.cwd)),e=i.normalize(e),!i.validResponse("open",e))return o.reject(e.norError||"errResponse");if(n=i.normalize(n),!i.validResponse("tree",n))return o.reject(n.norError||"errResponse");var l=i.diff(e.files.concat(n&&n.tree?n.tree:[]),t);return l.added.push(e.cwd),i.updateCache(l),l.removed.length&&i.remove(l),l.added.length&&i.add(l),l.changed.length&&i.change(l),o.resolve(l)}).always(function(){i.autoSync()}),o},this.upload=function(e){return this.transport.upload(e,this)},this.toUnbindEvents={},this.bind=function(e,t){var n,i;if("function"==typeof t)for(e=(""+e).toLowerCase().replace(/^\s+|\s+$/g,"").split(/\s+/),i=e.length,n=0;i>n;n++)void 0===A[e[n]]&&(A[e[n]]=[]),A[e[n]].push(t);return this},this.unbind=function(t,n){var i,a,r,o;for(t=(""+t).toLowerCase().split(/\s+/),a=t.length,i=0;a>i;i++)(r=A[t[i]])&&(o=e.inArray(n,r),o>-1&&r.splice(o,1));return n=null,this},this.trigger=function(t,n,i){var a,r,o,s,t=t.toLowerCase(),d="object"==typeof n,c=A[t]||[];if(this.debug("event-"+t,n),i=!0,r=c.length){for(s=e.Event(t),i&&(s.data=n),a=0;r>a;a++)if(c[a]){c[a].length&&(i||(d&&!o&&(o=JSON.stringify(n)),s.data=o?JSON.parse(o):n));try{if(c[a].call(s,s,this)===!1||s.isDefaultPrevented()){this.debug("event-stoped",s.type);break}}catch(u){window.console&&window.console.log&&window.console.log(u)}}this.toUnbindEvents[t]&&this.toUnbindEvents[t].length&&(e.each(this.toUnbindEvents[t],function(e,t){l.unbind(t.type,t.callback)}),delete this.toUnbindEvents[t])}return this},this.getListeners=function(e){return e?A[e.toLowerCase()]:A},this.shortcut=function(t){var n,i,a,r,o;if(this.options.allowShortcuts&&t.pattern&&e.isFunction(t.callback))for(n=t.pattern.toUpperCase().split(/\s+/),r=0;r<n.length;r++)i=n[r],o=i.split("+"),a=1==(a=o.pop()).length?a>0?a:a.charCodeAt(0):a>0?a:e.ui.keyCode[a],a&&!z[i]&&(z[i]={keyCode:a,altKey:-1!=e.inArray("ALT",o),ctrlKey:-1!=e.inArray("CTRL",o),shiftKey:-1!=e.inArray("SHIFT",o),type:t.type||"keydown",callback:t.callback,description:t.description,pattern:i});return this},this.shortcuts=function(){var t=[];return e.each(z,function(e,n){t.push([n.pattern,l.i18n(n.description)])}),t},this.clipboard=function(t,n){var i=function(){return e.map(I,function(e){return e.hash})};return void 0!==t&&(I.length&&this.trigger("unlockfiles",{files:i()}),O={},I=e.map(t||[],function(e){var t=x[e];return t?(O[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:I.slice(0,I.length)}),n&&this.trigger("lockfiles",{files:i()})),I.slice(0,I.length)},this.isCommandEnabled=function(t,n){var i,a=l.cwd().volumeid||"";return!n&&l.searchStatus.state>1&&l.selected().length&&(n=l.selected()[0]),!n||a&&0===n.indexOf(a)?i=k.disabled:(i=l.option("disabled",n),i||(i=[])),this._commands[t]?-1===e.inArray(t,i):!1},this.exec=function(t,n,i,a){return"open"===t&&((this.searchStatus.state||this.searchStatus.ininc)&&this.trigger("searchend",{noupdate:!0}),this.autoSync("stop")),this._commands[t]&&this.isCommandEnabled(t,a)?this._commands[t].exec(n,i):e.Deferred().reject("No such command")},this.dialog=function(n,i){var a=e("<div/>").append(n).appendTo(t).elfinderdialog(i,this),r=a.closest(".ui-dialog"),o=function(){!a.data("draged")&&a.is(":visible")&&a.elfinderdialog("posInit")};return r.length&&(l.bind("resize",o),r.on("remove",function(){l.unbind("resize",o)})),a},this.toast=function(t){return e('<div class="ui-front"/>').appendTo(this.ui.toast).elfindertoast(t||{},this)},this.getUI=function(e){return this.ui[e]||t},this.getCommand=function(e){return void 0===e?this._commands:this._commands[e]},this.resize=function(n,i){var a,r=function(){for(var e=t.outerHeight(!0)-t.innerHeight(),n=t;n.get(0)!==F.get(0)&&(n=n.parent(),e+=n.outerHeight(!0)-n.innerHeight(),n.parent().length););return e},o=!t.hasClass("ui-resizable"),s=t.data("resizeSize")||{w:0,h:0},d={};F&&F.data("resizeTm")&&clearTimeout(F.data("resizeTm")),"string"==typeof i&&(a=i.match(/^([0-9.]+)%$/))&&(F&&F.length||(F=e(window)),F.data("marginToMyNode")||F.data("marginToMyNode",r()),F.data("fitToBaseFunc")||F.data("fitToBaseFunc",function(){var e=F.data("resizeTm");e&&clearTimeout(e),t.hasClass("elfinder-fullscreen")||F.data("resizeTm",setTimeout(function(){l.restoreSize()},100))}),i=F.height()*(a[1]/100)-F.data("marginToMyNode"),F.off("resize."+l.namespace,F.data("fitToBaseFunc")),o&&F.on("resize."+l.namespace,F.data("fitToBaseFunc"))),t.css({width:n,height:parseInt(i)}),d.w=t.width(),d.h=t.height(),t.data("resizeSize",d),d.w===s.w&&d.h===s.h||(t.trigger("resize"),this.trigger("resize",{width:d.w,height:d.h}))},this.restoreSize=function(){this.resize(D,E)},this.show=function(){t.show(),this.enable().trigger("show")},this.hide=function(){this.options.enableAlways&&(v=g,g=!1),this.disable().trigger("hide"),t.hide()},this.lazy=function(n,i,a){var r=function(e){var n,i=t.data("lazycnt");e?(n=t.data("lazyrepaint")?!1: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"),l.trigger("lazydone"))},o=e.Deferred();return i=i||0,a=a||{},r(!0),setTimeout(function(){o.resolve(n.call(o)),r(!1)},i),o},this.destroy=function(){t&&t[0].elfinder&&(this.options.syncStart=!1,this.autoSync("forcestop"),this.trigger("destroy").disable(),I=[],T=[],A={},z={},e(window).off("."+h),e(document).off("."+h),l.trigger=function(){},e(j).remove(),t.off().removeData().empty().append(c.contents()).attr("class",c.attr("class")).attr("style",c.attr("style")),delete t[0].elfinder)},this.autoSync=function(t){var n;if(l.options.sync>=1e3){if(a&&(clearTimeout(a),a=null,l.trigger("autosync",{action:"stop"})),"stop"===t?++R:R=Math.max(0,--R),R||"forcestop"===t||!l.options.syncStart)return;n=function(t){var i;k.syncMinMs&&(t||a)&&(t&&l.trigger("autosync",{action:"start"}),i=Math.max(l.options.sync,k.syncMinMs),a&&clearTimeout(a),a=setTimeout(function(){var t,r=!0,o=y;k.syncChkAsTs&&(t=x[o].ts)?l.request({data:{cmd:"info",targets:[o],compare:t,reload:1},preventDefault:!0}).done(function(e){var i;r=!0,e.compare&&(i=e.compare,i==t&&(r=!1)),r?l.sync(o).always(function(){i&&(x[o].ts=i),n()}):n()}).fail(function(t,r){t&&0!=r.status?(l.error(t),-1!==e.inArray("errOpen",t)&&l.request({data:{cmd:"open",target:l.lastDir("")||l.root(),tree:1,init:1},notify:{type:"open",cnt:1,hideCnt:!0}})):a=setTimeout(function(){n()},i)}):l.sync(y,!0).always(function(){n()})},i))},n(!0)}},this.insideWorkzone=function(e,t,n){var i=this.getUI("workzone").data("rectangle");return n=n||1,!(e<i.left+n||e>i.left+i.width+n||t<i.top+n||t>i.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(l.zIndex?l.zIndex+1:0,1e3)}},function(){Y&&l.UA.Fullscreen&&(l.UA.Fullscreen=!1,X&&"undefined"!=typeof X.attr("allowfullscreen")&&(l.UA.Fullscreen=!0));var n,i,a,r="elfinder-fullscreen",o="elfinder-fullscreen-native",s=function(){var n=0,i=0;e.each(t.children(".ui-dialog,.ui-draggable"),function(t,a){var r=e(a),o=r.position();o.top<0&&(r.css("top",n),n+=20),o.left<0&&(r.css("left",i),i+=20)})},d=l.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():!1}}:{fullElm:function(){var e;return t.hasClass(r)?t.get(0):(e=t.find("."+r),e.length?e.get(0):null)},exitFull:function(){var t;e(window).off("resize."+h,u),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(l.getMaximizeCss()).addClass(r).trigger("resize",{fullscreen:"on"}),s(),e(window).on("resize."+h,u).trigger("resize"),!0}},c=function(t){n&&n.elm==t&&(e(t).removeClass(r+" "+o).attr("style",n.style),n=null)},u=function(t){var n;t.target===window&&(a&&clearTimeout(a),a=setTimeout(function(){(n=d.fullElm())&&e(n).trigger("resize",{fullscreen:"on"})},100))};e(document).on("fullscreenchange."+h+" webkitfullscreenchange."+h+" mozfullscreenchange."+h+" MSFullscreenChange."+h,function(t){if(l.UA.Fullscreen){var i=d.fullElm(),p=e(window);a&&clearTimeout(a),null===i?(p.off("resize."+h,u),n&&(i=n.elm,c(i),e(i).trigger("resize",{fullscreen:"off"}))):(e(i).addClass(r+" "+o).attr("style","width:100%; height:100%; margin:0; padding:0;").trigger("resize",{fullscreen:"on"}),p.on("resize."+h,u),s()),p.trigger("resize")}}),l.toggleFullscreen=function(t,i){var a=e(t).get(0),r=null;if(r=d.fullElm()){if(r==a){if(i===!0)return r}else if(i===!1)return r;return d.exitFull(),null}return i===!1?null:(n={elm:a,style:e(a).attr("style")},d.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."+h,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"})},r=function(t){t.data("bodyOvf",e("body").css("overflow")||"").data("orgStyle",t.attr("style")).addClass(n).css(l.getMaximizeCss()),e("body").css("overflow","hidden"),e(window).on("resize."+h,{elm:t},i).trigger("resize")};l.toggleMaximize=function(t,i){var o=e(t),s=o.hasClass(n);if(s){if(i===!0)return;a(o)}else{if(i===!1)return;r(o)}}}(),e.fn.selectable&&e.fn.draggable&&e.fn.droppable?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=[];n>t;t++)i.push(e.charCodeAt(t));return i},n=function(e){var n,i,a,r=[];for("string"==typeof e&&(e=t(e)),n=0,i=e.length;a=e[n],i>n;n++)a>=55296&&56319>=a?r.push((1023&a)+64<<10|1023&e[++n]):r.push(a);return r},i=function(e){var t,n,i,a,r=String.fromCharCode;for(t=0,n=e.length,a="";i=e[t],n>t;t++)a+=127>=i?r(i):223>=i&&i>=194?r((31&i)<<6|63&e[++t]):239>=i&&i>=224?r((15&i)<<12|(63&e[++t])<<6|63&e[++t]):247>=i&&i>=240?r(55296|((7&i)<<8|(63&e[++t])<<2|e[++t]>>>4&3)-64,56320|(15&e[t++])<<6|63&e[t]):r(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?l.bind("error",e):e===!0?this:l.trigger("error",{error:e,opts:t})},e.each(b,function(t,n){l[n]=function(){var t=arguments[0];return 1==arguments.length&&"function"==typeof t?l.bind(n,t):l.trigger(n,e.isPlainObject(t)?t:{})}}),this.enable(function(){!g&&l.visible()&&l.ui.overlay.is(":hidden")&&!t.children(".elfinder-dialog").find("."+l.res("class","editing")).length&&(g=!0,document.activeElement&&document.activeElement.blur(),t.removeClass("elfinder-disabled"))}).disable(function(){v=g,g=!1,t.addClass("elfinder-disabled")}).open(function(){T=[]}).select(function(t){var n=0,i=[];T=e.map(t.data.selected||t.data.value||[],function(e){return i.length||l.maxTargets&&++n>l.maxTargets?(i.push(e),null):x[e]?e:null}),i.length&&(l.trigger("unselectfiles",{files:i,inselect:!0}),l.toast({mode:"warning",msg:l.i18n(["errMaxTargets",l.maxTargets])}))}).error(function(t){var n={cssClass:"elfinder-dialog-error",title:l.i18n(l.i18n("error")),resizable:!1,destroyOnClose:!0,buttons:{}};n.buttons[l.i18n(l.i18n("btnClose"))]=function(){e(this).elfinderdialog("close")},t.data.opts&&e.isPlainObject(t.data.opts)&&Object.assign(n,t.data.opts),l.dialog('<span class="elfinder-dialog-icon elfinder-dialog-icon-error"/>'+l.i18n(t.data.error),n)}).bind("tmb",function(t){e.each(t.data.images||[],function(e,t){x[e]&&(x[e].tmb=t)})}).bind("searchstart",function(e){Object.assign(l.searchStatus,e.data),l.searchStatus.state=1}).bind("search",function(e){l.searchStatus.state=2}).bind("searchend",function(){l.searchStatus.state=0,l.searchStatus.ininc=!1,l.searchStatus.mixed=!1}),!0===this.options.sound&&this.bind("playsound",function(t){var n=j.canPlayType&&j.canPlayType('audio/wav; codecs="1"'),i=t.data&&t.data.soundFile;n&&i&&""!=n&&"no"!=n&&e(j).html('<source src="'+P+i+'" type="audio/wav">')[0].play()}),e.each(this.options.handlers,function(e,t){l.bind(e,t)}),this.history=new this.history(this),this.commands.getfile&&("function"==typeof this.options.getFileCallback?(this.bind("dblclick",function(e){this.preventDefault(),l.exec("getfile").fail(function(){l.exec("open",e.data&&e.data.file?[e.data.file]:void 0)})}),this.shortcut({pattern:"enter",description:this.i18n("cmdgetfile"),callback:function(){l.exec("getfile").fail(function(){l.exec("mac"==l.OS?"rename":"open")})}}).shortcut({pattern:"ctrl+enter",description:this.i18n("mac"==this.OS?"cmdrename":"cmdopen"),callback:function(){l.exec("mac"==l.OS?"rename":"open")}})):this.options.getFileCallback=null),this.roots={},this.leafRoots={},this._commands={},Array.isArray(this.options.commands)||(this.options.commands=[]),-1!==e.inArray("*",this.options.commands)&&(this.options.commands=Object.keys(this.commands)),e.each(this.commands,function(t,n){var i,a,r=Object.assign({},n.prototype);if(e.isFunction(n)&&!l._commands[t]&&(n.prototype.forceLoad||-1!==e.inArray(t,l.options.commands))){if(i=n.prototype.extendsCmd||""){if(!e.isFunction(l.commands[i]))return!0;n.prototype=Object.assign({},M,new l.commands[i],n.prototype)}else n.prototype=Object.assign({},M,n.prototype);l._commands[t]=new n,n.prototype=r,a=l.options.commandsOptions[t]||{},i&&l.options.commandsOptions[i]&&(a=e.extend(!0,{},l.options.commandsOptions[i],a)),l._commands[t].setup(t,a),l._commands[t].linkedCmds.length&&e.each(l._commands[t].linkedCmds,function(t,n){var i=l.commands[n];e.isFunction(i)&&!l._commands[n]&&(i.prototype=M,l._commands[n]=new i,l._commands[n].setup(n,l.options.commandsOptions[n]||{}))})}}),this.commandMap={},this.volOptions={},this.trashes={},this.optionsByHashes={},t.addClass(this.cssClass).on(p,function(){!g&&l.enable()}),this.ui={workzone:e("<div/>").appendTo(t).elfinderworkzone(this),navbar:e("<div/>").appendTo(t).elfindernavbar(this,this.options.uiOptions.navbar||{}),contextmenu:e("<div/>").appendTo(t).elfindercontextmenu(this),overlay:e("<div/>").appendTo(t).elfinderoverlay({show:function(){l.disable()},hide:function(){v&&l.enable()}}),cwd:e("<div/>").appendTo(t).elfindercwd(this,this.options.uiOptions.cwd||{}),notify:this.dialog("",{cssClass:"elfinder-dialog-notify",position:this.options.notifyDialog.position,absolute:!0,resizable:!1,autoOpen:!1,closeOnEscape:!1,title:" ",width:parseInt(this.options.notifyDialog.width)}),statusbar:e('<div class="ui-widget-header ui-helper-clearfix ui-corner-bottom elfinder-statusbar"/>').hide().appendTo(t),toast:e('<div class="elfinder-toast"/>').appendTo(t),bottomtray:e('<div class="elfinder-bottomtray">').appendTo(t)},this.uiAutoHide=[],this.one("open",function(){l.uiAutoHide.length&&setTimeout(function(){l.trigger("uiautohide")},500)}),this.bind("uiautohide",function(){l.uiAutoHide.length&&l.uiAutoHide.shift()()}),e.each(this.options.ui||[],function(n,i){var a="elfinder"+i,r=l.options.uiOptions[i]||{};!l.ui[i]&&e.fn[a]&&(l.ui[i]=e("<"+(r.tag||"div")+"/>").appendTo(t),l.ui[i][a](l,r))}),t[0].elfinder=this,this.options.resizable&&e.fn.resizable&&t.resizable({resize:function(e,t){l.resize(t.size.width,t.size.height)},handles:"se",minWidth:300,minHeight:200}),this.options.width&&(D=this.options.width),this.options.height&&(E=this.options.height),this.options.heightBase&&(F=e(this.options.heightBase)),this.options.soundPath&&(P=this.options.soundPath.replace(/\/+$/,"")+"/"),l.resize(D,E),e(document).on("click."+h,function(n){g&&!l.options.enableAlways&&!e(n.target).closest(t).length&&l.disable()}).on(f+" "+m,G),l.options.useBrowserHistory&&e(window).on("popstate."+h,function(t){var n=t.originalEvent.state&&t.originalEvent.state.thash;n&&!e.isEmptyObject(l.files())&&l.request({data:{cmd:"open",target:n,onhistory:1},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0})}),function(){var n;e(window).on("resize."+h,function(e){e.target===this&&(n&&clearTimeout(n),n=setTimeout(function(){l.trigger("resize",{width:t.width(),height:t.height()})},100))}).on("beforeunload."+h,function(n){var i,a;return t.is(":visible")&&(l.ui.notify.children().length&&-1!==e.inArray("hasNotifyDialog",l.options.windowCloseConfirm)?i=l.i18n("ntfsmth"):t.find("."+l.res("class","editing")).length&&-1!==e.inArray("editingFile",l.options.windowCloseConfirm)?i=l.i18n("editingFile"):(a=Object.keys(l.selected()).length)&&-1!==e.inArray("hasSelectedItem",l.options.windowCloseConfirm)?i=l.i18n("hasSelected",""+a):(a=Object.keys(l.clipboard()).length)&&-1!==e.inArray("hasClipboardData",l.options.windowCloseConfirm)&&(i=l.i18n("hasClipboard",""+a)),i)?(n.returnValue=i,i):void l.trigger("unload")})}(),e(window).on("message."+h,function(e){var t,n,i=e.originalEvent||null;if(i&&0===l.uploadURL.indexOf(i.origin))try{t=JSON.parse(i.data),n=t.data||null,n&&(n.error?(t.bind&&l.trigger(t.bind+"fail",n),l.error(n.error)):(n.warning&&l.error(n.warning),l.updateCache(n),n.removed&&n.removed.length&&l.remove(n),n.added&&n.added.length&&l.add(n),n.changed&&n.changed.length&&l.change(n),t.bind&&(l.trigger(t.bind,n),l.trigger(t.bind+"done")),n.sync&&l.sync()))}catch(e){l.sync()}}),l.options.enableAlways?(e(window).on("focus."+h,function(e){e.target===this&&l.enable()}),Y&&e(window.top).on("focus."+h,function(){!l.enable()||X&&!X.is(":visible")||setTimeout(function(){e(window).focus()},10)})):Y&&e(window).on("blur."+h,function(e){g&&e.target===this&&l.disable()}),function(){var e=l.getUI("navbar"),t=l.getUI("cwd").parent();l.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)}}}(),l.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",s="class",d=l.res(s,"navdir"),c=(l.res(s,"droppable"),l.res(s,"adroppable"),l.res(s,"navarrow"),l.res(s,"adroppable")),h=l.getUI("workzone"),p="ltr"===l.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<n.top)||e.pageY>r)&&(a=n.cwdEdge>e.pageX?(p?"navbar":"cwd")+(t?"Up":"Down"):(p?"cwd":"navbar")+(t?"Up":"Down"),l.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,s=null;if(!a){s=l.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){}}s&&(!s.write||n&&n===(window.location.href+s.hash).toLowerCase())?i.data(o,!0):(t.preventDefault(),t.stopPropagation(),i.data(r,!0),i.addClass(c))}}).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(c)}}).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(c),u=t.currentTarget.id?n.hasClass(d)?l.navId2Hash(t.currentTarget.id):l.cwdId2Hash(t.currentTarget.id):l.cwd().hash,t.originalEvent._target=u,l.exec("upload",{dropEvt:t.originalEvent,target:u},void 0,u)}})}(),l.UA.Touch&&!function(){var n,i,a,r,o,s,d,c,u,h=l.getUI("navbar"),p=l.getUI("toolbar"),f="touchmove.stopscroll",m=function(e){e.preventDefault(),c&&clearTimeout(c)},g=function(){c=setTimeout(function(){t.off(f)},100)},v=50;t.on("touchstart touchmove touchend",function(c){if("touchend"===c.type)return n=!1,i=!1,void g();var b,y,w,k,x,C,T=c.originalEvent.touches||[{}],A=T[0].pageX||null,z=T[0].pageY||null,I="ltr"===l.direction;null===A||null===z||"touchstart"===c.type&&T.length>1||("touchstart"===c.type?(a=t.offset(),r=t.width(),h&&(n=!1,h.is(":hidden")?(u||(u=Math.max(50,r/10)),(I?A-a.left:r+a.left-A)<u&&(n=A)):(s=h.width(),y=Math.max.apply(Math,e.map(h.children(".elfinder-tree"),function(t){return e(t).width()})),w=I?A<a.left+s&&y-h.scrollLeft()-5<=s:A>a.left+r-s&&y+h.scrollLeft()-5<=s,w?(u=Math.max(50,r/10),n=A):n=!1)),p&&(d=p.height(),o=a.top,z-o<(p.is(":hidden")?v:d+30)?(i=z,t.on(f,m),g()):i=!1)):(h&&n!==!1&&(b=(I?n>A:A>n)?"navhide":"navshow",k=Math.abs(n-A),("navhide"===b&&k>.6*s||k>("navhide"===b?s/3:45)&&("navshow"===b||(I?A<a.left+20:A>a.left+r-20)))&&(l.getUI("navbar").trigger(b,{handleW:u}),n=!1)),p&&i!==!1&&(x=p.offset().top,Math.abs(i-z)>Math.min(45,d/3)&&(C=i>z?"slideUp":"slideDown",("slideDown"===C||x+20>z)&&(p.is("slideDown"===C?":hidden":":visible")&&(p.stop(!0,!0).trigger("toggle",{duration:100,handleH:v}),g()),i=!1)))))})}(),Y&&t.on("click",function(t){e(window).focus()}),this.options.enableByMouseOver&&t.on("mouseenter",function(t){Y&&e(window).focus(),!l.enabled()&&l.enable()}),this.options.cssAutoLoad||this.trigger("cssloaded"),this.zIndexCalc(),void this.trigger("init").request({data:{cmd:"open",target:l.startDir(),init:1,tree:l.ui.tree?1:0},preventDone:!0,notify:{type:"open",cnt:1,hideCnt:!0},freeze:!0}).fail(function(){l.trigger("fail").disable().lastDir(""),A={},z={},e(document).add(t).off("."+h),l.trigger=function(){}}).done(function(n){var i=function(e){var t=l.file(l.trashes[e]);l.options.debug;t&&t.volumeid&&delete l.volOptions[t.volumeid].trashHash,l.trashes[e]=!1,l.debug("backend-error",'Trash hash "'+e+'" was not found or not writable.')},a={};l.zIndexCalc(),l.load().debug("api",l.api),t.trigger("resize"),q(n),l.trigger("open",n),l.trigger("opendone"),Y&&l.options.enableAlways&&e(window).focus(),e.each(l.trashes,function(e){var t=l.file(e);t?"directory"===t.mime&&t.write||i(e):a[e]=!0}),Object.keys(a).length&&l.request({data:{cmd:"info",targets:Object.keys(a)},preventDefault:!0}).done(function(t){t&&t.files&&e.each(t.files,function(e,t){"directory"===t.mime&&t.write&&delete a[t.hash]})}).always(function(){e.each(a,i)})})):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",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",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(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,checkExists:function(t,n,i,a){var r,o=e.Deferred(),s=[],l={},d=function(){for(var e=t.length;--e>-1;)t[e]._remove=!0},c=function(){o.resolve(s,l)},u=function(){var o=[],u=[],h=function(e){var n=e==u.length-1,r={title:i.i18n("cmdupload"),text:["errExists",u[e].name,"confirmRepl"],all:!n,accept:{label:"btnYes",callback:function(t){n||t?c():h(++e)}},reject:{label:"btnNo",callback:function(i){var a;if(i)for(a=u.length;e<a--;)t[u[a].i]._remove=!0;else t[u[e].i]._remove=!0;n||i?c():h(++e)}},cancel:{label:"btnCancel",callback:function(){d(),c()}},buttons:[{label:"btnBackup",callback:function(t){var i;if(t)for(i=u.length;e<i--;)s.push(u[i].name);else s.push(u[e].name);n||t?c():h(++e)}}]};a||r.buttons.push({label:"btnRename"+(n?"":"All"),callback:function(){s=null,c()}}),i.iframeCnt>0&&delete r.reject,i.confirm(r)};return i.file(n).read?(r=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(r,function(e){return e.name})},notify:{type:"preupload",cnt:1,hideCnt:!0},preventFail:!0}).done(function(t){var a,s;t&&(t.error?d():i.options.overwriteUploadConfirm&&i.option("uploadOverwrite",n)&&t.list&&(Array.isArray(t.list)?o=t.list||[]:(a=[],o=e.map(t.list,function(e){return"string"==typeof e?e:(a=a.concat(e),null)}),a.length&&(o=o.concat(a)),l=t.list),u=e.map(r,function(t){return-1!==e.inArray(t.name,o)?t:null}),o.length&&n==i.cwd().hash&&(s=e.map(i.files(n),function(e){return e.name}),e.map(o,function(t){return-1===e.inArray(t,s)?!0:null}).length&&i.sync()))),u.length>0?h(0):c()}).fail(function(e){d(),c(),e&&i.error(e)})):void c()};return i.api>=2.1&&"object"==typeof t[0]?u():c(),o},checkFile:function(t,n,i){if(t.checked||"files"==t.type)return t.files;if("data"==t.type){var a,r,o=e.Deferred(),s=[],l=[],d=0,c=[],u=function(e){var t,i,a,r=[],o=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)d++,i.file(function(e){h&&e.name.match(h)||(l.push(i.fullPath||""),s.push(e)),d--});else if(i.isDirectory&&n.api>=2.1){d++,c.push(i.fullPath),t=i.createReader();var r=[],f=function(){t.readEntries(function(e){if(e.length)r=r.concat(o(e)),f();else{for(var t=0;t<r.length;t++)u([r[t]]);d--}},function(){d--})};f()}};return a=e.map(t.files.items,function(e){return e.getAsEntry?e.getAsEntry():e.webkitGetAsEntry()}),e.each(a,function(e,t){return t.isDirectory?(r=!0,!1):void 0}),a.length>0?(n.uploads.checkExists(a,i,n,r).done(function(r,h){var p,f=[];n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",i)&&(null===r&&(t.overwrite=0,r=[]),a=e.map(a,function(t){var a,o,s,l;return t.isDirectory&&r.length&&(a=e.inArray(t.name,r),-1!==a&&(r.splice(a,1),o=n.uniqueName(t.name+n.options.backupSuffix,null,""),e.each(h,function(e,n){return t.name==n?(s=e,!1):void 0}),s||(s=n.fileByName(t.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){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?(p=setTimeout(function(){n.notify({type:"readdir",cnt:1,hideCnt:!0})},n.options.notifyDelay),u(a),setTimeout(function e(){d>0?setTimeout(e,10):(p&&clearTimeout(p),n.notify({type:"readdir",cnt:-1}),o.resolve([s,l,r,h,c]))},10)):o.reject()})}),o.promise()):o.reject()}var h=[],p=[],f=t.files[0];if("html"==t.type){var m,g=e("<html/>").append(e.parseHTML(f.replace(/ src=/gi," _elfsrc=")));e("img[_elfsrc]",g).each(function(){var n,i,a=e(this),r=a.closest("a");r&&r.attr("href")&&r.attr("href").match(/\.(?:jpe?g|gif|bmp|png)/i)&&(i=r.attr("href")),n=a.attr("_elfsrc"),n&&(i?(-1==e.inArray(i,h)&&h.push(i),-1==e.inArray(n,p)&&p.push(n)):-1==e.inArray(n,h)&&h.push(n)),1===h.length&&h[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)||-1==e.inArray(t.href,h)&&-1==e.inArray(t.href,p)&&h.push(t.href))})}else{var v,b,y;for(v=/(http[^<>"{}|\\^\[\]`\s]+)/gi;b=v.exec(f);)y=b[1].replace(/&/g,"&"),-1==e.inArray(y,h)&&h.push(y)}return h},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=function(t){var n=e.Deferred();return t.promise?t.always(function(e){n.resolve(Array.isArray(e)&&e.length?d?e[0][0]:e[0]:{})}):n.resolve(t.length?d?t[0][0]:t[0]:{}),n},b=e.Deferred().fail(function(e){i.uploads.xhrUploading&&v(w).done(function(e){e._cid&&(setTimeout(function(){i.sync()},5e3),y=new FormData,w=[{_chunkfail:!0}],y.append("chunk",e._chunk),y.append("cid",e._cid),d=!1,R(w))}),i.sync(),i.uploads.xhrUploading=!1,w=null,e&&i.error(e)}).done(function(e){r=null,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),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:-k,progress:0,size:0}),j&&z.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,c),k=t.checked&&d?w[0].length:w.length,x=0,C=0,T=0,A=!1,z=i.ui.notify,I=!0,O=!1,S=function(){return A=A||z.children(".elfinder-notify-upload").length},U=function(){O=!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"]()},D=function(e){return e||(e=T),setTimeout(function(){A=!0,i.notify({type:"upload",cnt:k,progress:x-C,size:e,cancel:function(){a.trigger("uploadabort"),b.resolve()}}),C=x,t.multiupload?I&&M(!0):M(I&&e>x)},i.options.notifyDelay)},E=function(){g++<=m?(S()&&C&&i.notify({type:"upload",cnt:0,progress:0,size:C}),r.quiet=!0,r.abort(),C=x=0,setTimeout(function(){O||(r.open("POST",i.uploadURL,!0),r.send(y))},f)):(a.trigger("uploadabort"),b.reject(["errAbort","errTimeout"]))},F=t.renames||null,P=t.hashes||null,j=!1;if(a.one("uploadabort",U),e(window).one("unload."+n.namespace,U),!j&&(C=x),!d&&!k)return b.reject(["errUploadNoFiles"]);r.addEventListener("error",function(){0==r.status?O?b.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"),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"]):E():(a.trigger("uploadabort"),b.reject("errConnect"))},!1),r.addEventListener("load",function(e){var n,l=r.status,c=0,u="";if(l>=400?u=l>500?"errResponse":["errResponse","errServerError"]:r.responseText||(u=["errResponse","errDataEmpty"]),u&&(a.trigger("uploadabort"),v(w).done(function(e){return b.reject(e._cid?null:u)})),x=T,S()&&(c=x-C)&&i.notify({type:"upload",cnt:0,progress:c,size:0}),n=i.parseUploadData(r.responseText),n._chunkmerged){y=new FormData;var h=[{_chunkmerged:n._chunkmerged,_name:n._name,_mtime:n._mtime}];return j=!0,a.off("uploadabort",U),s=setTimeout(function(){i.notify({type:"chunkmerge",cnt:1})},i.options.notifyDelay),void(d?R(h,w[1]):R(h))}n._multiupload=!!t.multiupload,n.error?(i.trigger("uploadfail",n),n._chunkfailure||n._multiupload?(O=!0,i.uploads.xhrUploading=!1,o&&clearTimeout(o),z.children(".elfinder-notify-upload").length?(i.notify({type:"upload",cnt:-k,progress:0,size:0}),b.reject(n.error)):b.reject()):b.reject(n.error)):b.resolve(n)},!1),r.upload.addEventListener("loadstart",function(e){!j&&e.lengthComputable&&(x=e.loaded,g&&(x=0),T=e.total,x||(x=parseInt(.05*T)),S()&&(i.notify({type:"upload",cnt:0,progress:x-C,size:t.multiupload?0:T}),C=x))},!1),r.upload.addEventListener("progress",function(e){var n;e.lengthComputable&&!j&&r.readyState<2&&(x=e.loaded,!t.checked&&x>0&&!o&&(o=D(r._totalSize-x)),T||(T=e.total,x||(x=parseInt(.05*T))),n=x-C,S()&&n/e.total>=.05&&(i.notify({type:"upload",cnt:0,progress:n,size:0}),C=x),!t.multiupload&&x>=T&&(I=!1,M(!1)))},!1);var R=function(a,s){var f,m,g,v,w,x,C,T,A,z,U,E,j,R=0,H=1,N=[],q=0,_=k,L=0,W=[],$=(new Date).getTime().toString().substr(-9),B=Math.min((n.uplMaxSize?n.uplMaxSize:2097152)-8190,n.options.uploadMaxChunkSize),V=h?!1:"",K=function(a,r){var s,l,h=[],p=0;if(!O){for(;a.length&&h.length<r;)h.push(a.shift());if(p=h.length){l=p;for(var f=0;p>f&&!O;f++)s=d?h[f][0][0]._cid||null:h[f][0]._cid||null,j[s]?E--:n.exec("upload",{type:t.type,isDataType:d,files:h[f],checked:!0,target:c,dropEvt:u,renames:F,hashes:P,multiupload:!0,overwrite:0===t.overwrite?0:void 0},void 0,c).fail(function(e){e&&"No such command"===e&&(O=!0,n.error(["errUpload","errPerm"])),s&&(j[s]=!0)}).always(function(t){t&&t.added&&(z=e.merge(z,t.added)),E<=++U&&(n.trigger("multiupload",{added:z}),o&&clearTimeout(o),S()&&i.notify({type:"upload",cnt:-k,progress:0,size:0})),a.length?K(a,1):--l<=1&&(I=!1,M(!1))})}}(h.length<1||O)&&(O?(o&&clearTimeout(o),s&&(j[s]=!0),b.reject()):(b.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),v=0;v<a.length;v++){try{T=a[v],m=T.size,V===!1&&(V="",i.api>=2.1&&("slice"in T?V="slice":"mozSlice"in T?V="mozSlice":"webkitSlice"in T&&(V="webkitSlice")))}catch(J){k--,_--;continue}if(f&&m>f||!V&&n.uplMaxSize&&m>n.uplMaxSize)i.error(i.i18n("errUploadFile",T.name)+" "+i.i18n("errUploadFileSize")),k--,_--;else if(!T.type||i.uploadMimeCheck(T.type,c))if(V&&m>B){for(w=0,x=B,C=-1,_=Math.floor(m/B),g=T.lastModified?Math.round(T.lastModified/1e3):0,L+=m,W[$]=0;m>=w;)A=T[V](w,x),A._chunk=T.name+"."+ ++C+"_"+_+".part",A._cid=$,A._range=w+","+A.size+","+m,A._mtime=g,W[$]++,R&&q++,"undefined"==typeof N[q]&&(N[q]=[],d&&(N[q][0]=[],N[q][1]=[])),R=B,H=1,d?(N[q][0].push(A),N[q][1].push(s[v])):N[q].push(A),w=x,x=w+B;null==A?(i.error(i.i18n("errUploadFile",T.name)+" "+i.i18n("errUploadFileSize")),k--,_--):(_+=C,R=0,H=1,q++)}else(n.uplMaxSize&&R+m>=n.uplMaxSize||H>n.uplMaxFile)&&(R=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[v])):N[q].push(T),R+=m,L+=m,H++;else i.error(i.i18n("errUploadFile",T.name)+" "+i.i18n("errUploadMime")+" ("+i.escape(T.type)+")"),k--,_--}if(0==N.length)return t.checked=!0,!1;if(N.length>1)return o=D(L),z=[],U=0,E=N.length,j=[],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=D(L)),l=!0,a.length||b.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)}),y.append("cmd","upload"),y.append(i.newAPI?"target":"current",c),F&&F.length&&(e.each(F,function(e,t){y.append("renames[]",t)}),y.append("suffix",n.options.backupSuffix)),P&&e.each(P,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["+e+"]",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))}),d&&e.each(s,function(e,t){y.append("upload_path[]",t)}),0===t.overwrite&&y.append("overwrite",0),u&&y.append("dropWith",parseInt((u.altKey?"1":"0")+(u.ctrlKey?"1":"0")+(u.metaKey?"1":"0")+(u.shiftKey?"1":"0"),2)),r.send(y),!0};if(d)l?R(w[0],w[1]):w.done(function(t){if(F=[],k=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},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?p=1:(p=0,b.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],P=t[3],R(t[0],t[1]))});t[1]=e.map(t[1],function(){return c}),F=t[2],P=t[3],R(t[0],t[1])}else b.reject(["errUploadNoFiles"])}).fail(function(){b.reject()});else if(w.length>0)if(t.clipdata||null!=F)R(w)||b.reject();else{var H=[],N=[],q=n.options.folderUploadExclude[n.OS]||null;e.each(w,function(t,n){var i=n.webkitRelativePath||n.relativePath||"";return i?(q&&n.name.match(q)?(n._remove=!0,i=void 0):(i=i.replace(/\/[^\/]*$/,""),i&&-1===e.inArray(i,H)&&H.push(i)),void N.push(i)):!1}),F=[],P={},H.length?!function(){var t=e.map(H,function(e){return-1===e.indexOf("/")?{name:e}:null}),i=[];n.uploads.checkExists(t,c,n,!0).done(function(a,r){var o,s,l,u=[];n.options.overwriteUploadConfirm&&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(N.concat(),function(t,n){0===e.inArray(n,i)&&(w[t]._remove=!0,delete N[t])}),w=e.map(w,function(e){return e._remove?null:e}),N=e.map(N,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){b.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:H},notify:{type:"mkdir",cnt:H.length},preventFail:!0}).fail(function(e){e=e||["errUnknown"],"errCmdParams"===e[0]?p=1:(p=0,b.reject(e))}).done(function(t){t.hashes&&(N=e.map(N.concat(),function(e){return""===e?c:t.hashes["/"+e]}))}).always(function(e){p&&(d=!0,R(w,N)||b.reject())})})):b.reject()})}():n.uploads.checkExists(w,c,n).done(function(i,a){n.options.overwriteUploadConfirm&&n.option("uploadOverwrite",c)&&(null===i?t.overwrite=0:(F=i,P=a),w=e.map(w,function(e){return e._remove?null:e})),k=w.length,k>0?R(w)||b.reject():b.reject()})}else b.reject();return b},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('<form action="'+s.uploadURL+'" method="post" enctype="multipart/form-data" encoding="multipart/form-data" target="'+u+'" style="display:none"><input type="hidden" name="cmd" value="upload" /></form>'),p=this.UA.IE,f=function(){o&&clearTimeout(o),r&&clearTimeout(r),a&&s.notify({type:"upload",cnt:-i}),setTimeout(function(){p&&e('<iframe src="javascript:false;"/>').appendTo(h),h.remove(),m.remove()},100)},m=e('<iframe src="'+(p?"javascript:false;":"about:blank")+'" name="'+u+'" style="position:absolute;left:-1000px;top:-1000px" />').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('<input type="hidden" name="upload[]" value="'+t+'"/>')}),i=1;else{if(!(l&&e(l).is(":file")&&e(l).val()))return c.reject();n.options.overwriteUploadConfirm&&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(n,a){null===n?t.overwrite=0:(y=n,w=a,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('<input type="hidden" name="'+(s.newAPI?"target":"current")+'" value="'+g+'"/>').append('<input type="hidden" name="html" value="1"/>').append('<input type="hidden" name="node" value="'+s.id+'"/>').append(e(l).attr("name","upload[]")),y.length>0&&(e.each(y,function(e,t){h.append('<input type="hidden" name="renames[]" value="'+s.escape(t)+'"/>')}),h.append('<input type="hidden" name="suffix" value="'+n.options.backupSuffix+'"/>')),w&&e.each(y,function(e,t){h.append('<input type="hidden" name="['+e+']" value="'+s.escape(t)+'"/>')}),0===t.overwrite&&h.append('<input type="hidden" name="overwrite" value="0"/>'),e.each(s.options.onlyMimes||[],function(e,t){h.append('<input type="hidden" name="mimes[]" value="'+s.escape(t)+'"/>')}),e.each(s.options.customData,function(e,t){h.append('<input type="hidden" name="'+e+'" value="'+s.escape(t)+'"/>')}),h.appendTo("body"),void m.appendTo("body"))}),c}},one:function(e,t){var n=this,e=e.toLowerCase(),i=function(a,r){return n.toUnbindEvents[e]||(n.toUnbindEvents[e]=[]),n.toUnbindEvents[e].push({type:e,callback:i}),t.apply(this,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<r.length;o++)if(r[o]=e.trim(r[o]),r[o].substring(0,t.length)==t){if(s=decodeURIComponent(r[o].substring(t.length)),"{"===s.substr(0,1)||"["===s.substr(0,1))try{return JSON.parse(s)}catch(d){}return s}return""}return a=Object.assign({},this.options.cookie),null===n?(n="",a.expires=-1):(l=typeof n,"string"!==l&&"number"!==l&&(n=JSON.stringify(n))),"number"==typeof a.expires&&(i=new Date,i.setTime(i.getTime()+864e5*a.expires),a.expires=i),document.cookie=t+"="+encodeURIComponent(n)+"; expires="+a.expires.toUTCString()+(a.path?"; path="+a.path:"")+(a.domain?"; domain="+a.domain:"")+(a.secure?"; secure":""),n},startDir:function(){var e=window.location.hash;return e&&e.match(/^#elf_/)?e.replace(/^#elf_/,""):this.options.startPathHash?this.options.startPathHash:this.lastDir()},lastDir:function(e){return this.options.rememberLastDir?this.storage("lastdir",e):""},_node:e("<span/>"),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 n;t.uiCmdMap&&(e.isPlainObject(t.uiCmdMap)&&Object.keys(t.uiCmdMap).length?(n=t.disabled,e.each(t.uiCmdMap,function(t,i){"hidden"===i&&-1===e.inArray(t,n)&&n.push(t)})):delete t.uiCmdMap)},l=function(t){var n=function(e){var t=typeof e;return"object"===t&&Array.isArray(e)&&(t="array"),t};return e.each(o.optionProperties,function(e,i){void 0!==i&&t[e]&&n(t[e])!==n(i)&&(t[e]=i)}),t},d=function(t){var d,c,h;if(t&&t.hash&&t.name&&t.mime){if("application/x-empty"==t.mime&&(t.mime="text/plain"),t.options&&(o.optionsByHashes[t.hash]=l(t.options)),h=o.isRoot(t),h&&!t.volumeid&&o.debug("warning","The volume root statuses requires `volumeid` property."),h||"directory"===t.mime){if(t.phash){if(t.phash===t.hash)return u=u.concat(['Parent folder of "$1" is itself.',t.name]),null;if(h&&t.volumeid&&0===t.phash.indexOf(t.volumeid))return u=u.concat(['Parent folder of "$1" is inner itself.',t.name]),null}t.volumeid&&(d=t.volumeid,h&&(o.volOptions[d]||(o.volOptions[d]={dispInlineRegex:o.options.dispInlineRegex}),c=o.volOptions[d],t.options&&Object.assign(c,t.options),t.disabled&&(c.disabled=t.disabled),t.tmbUrl&&(c.tmbUrl=t.tmbUrl),s(c),c.trashHash&&(o.trashes[c.trashHash]===!1?delete c.trashHash:o.trashes[c.trashHash]=t.hash),e.each(o.optionProperties,function(e){c[e]&&(t[e]=c[e])}),o.roots[d]=t.hash),r!==d&&(r=d,a=o.option("i18nFolderName",d))),h&&!t.i18&&(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)<e.ts&&(t.ts=e.ts)})),o.trashes[t.hash]&&(t.locked=!0)}return delete t.options,t}return null},c=function(t){var n=[];return e.each(o.files(),function(i,a){e.each(o.parents(i),function(a,r){return-1!==e.inArray(r,t)&&-1===e.inArray(i,t)?(n.push(i),!1):void 0})}),n},u=[];return t.options&&l(t.options),t.cwd&&(t.cwd.volumeid&&t.options&&Object.keys(t.options).length&&o.isRoot(t.cwd)&&(o.volOptions[t.cwd.volumeid]=t.options),t.cwd=d(t.cwd)),t.files&&(t.files=e.map(t.files,d)),t.tree&&(t.tree=e.map(t.tree,d)),t.added&&(t.added=e.map(t.added,d)),t.changed&&(t.changed=e.map(t.changed,d)),t.removed&&t.removed.length&&2===o.searchStatus.state&&(t.removed=t.removed.concat(c(t.removed))),t.api&&(t.init=!0),t.cwd&&t.cwd.options&&t.options&&Object.assign(t.options,l(t.cwd.options)),u.length&&(t.norError=["errResponse"].concat(u)),t},setSort:function(e,t,n,i){this.storage("sortType",this.sortType=this.sortRules[e]?e:"name"),this.storage("sortOrder",this.sortOrder=/asc|desc/.test(t)?t:"asc"),this.storage("sortStickFolders",(this.sortStickFolders=!!n)?1:""),this.storage("sortAlsoTreeview",(this.sortAlsoTreeview=!!i)?1:""),this.trigger("sortchange")},_sortRules:{name:function(e,t){return i.prototype.naturalCompare(e.i18||e.name,t.i18||t.name)},size:function(e,t){var n=parseInt(e.size)||0,i=parseInt(t.size)||0;return n===i?0:n>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='<div class="elfinder-notify elfinder-notify-{type}"><span class="elfinder-dialog-icon elfinder-dialog-icon-{type}"/><span class="elfinder-notify-msg">{msg}</span> <span class="elfinder-notify-cnt"/><div class="elfinder-notify-progressbar"><div class="elfinder-notify-progress"/></div><div class="elfinder-notify-cancel"/></div>',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('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only"><span class="ui-button-text">'+this.i18n("btnCancel")+"</span></button>").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('<div class="elfinder-dialog-confirm-applyall"/>');n=e('<input type="checkbox" />'),e(this).next().find(".ui-dialog-buttonset").prepend(t.append(e("<label>"+o+"</label>").prepend(n)))}),t.optionsCallback&&e.isFunction(t.optionsCallback)&&t.optionsCallback(r),this.dialog('<span class="elfinder-dialog-icon elfinder-dialog-icon-confirm"/>'+this.i18n(t.text),r)},uniqueName:function(e,t,n){var i,a,r=0,o="";if(e=this.i18n(!1,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;t<arguments.length;t++)if(i=arguments[t],Array.isArray(i))for(n=0;n<i.length;n++)i[n]instanceof jQuery?s.push(i[n]):"undefined"!=typeof i[n]&&s.push(d(""+i[n]));else i instanceof jQuery?s.push(i[n]):"undefined"!=typeof i&&s.push(d(""+i));for(t=0;t<s.length;t++)-1===e.inArray(t,l)&&(i=s[t],"string"==typeof i?(i=o[i]||(a?a(i):r.escape(i)),i=i.replace(/\$(\d+)/g,function(e,n){return n=t+parseInt(n),n>0&&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("<br>")},getIconStyle:function(t,n){var i=this,a={background:"url('{url}') 0 0 no-repeat","background-size":"contain"},r="",o={},s=0;return t.icon&&(r='style="',e.each(a,function(e,a){0===s++&&(a=a.replace("{url}",i.escape(t.icon))),n?o[e]=a:r+=e+":"+a+";"}),r+='"'),n?o:r},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},date:function(e,t){var n,i,a,r,o,s,l,d,c,u=this;return t||(t=new Date),s=t[u.getHours](),l=s>12?s-12:s,d=t[u.getMinutes](),c=t[u.getSeconds](),i=t[u.getDate](),a=t[u.getDay](),r=t[u.getMonth]()+1,o=t[u.getFullYear](),n=e.replace(/[a-z]/gi,function(e){switch(e){case"d":return i>9?i:"0"+i;case"j":return i;case"D":return u.i18n(u.i18.daysShort[a]);case"l":return u.i18n(u.i18.days[a]);case"m":return r>9?r:"0"+r;case"n":return r;case"M":return u.i18n(u.i18.monthsShort[r-1]);case"F":return u.i18n(u.i18.months[r-1]);case"Y":return o;case"y":return(""+o).substr(2);case"H":return s>9?s:"0"+s;case"G":return s;case"g":return l;case"h":return l>9?l:"0"+l;case"a":return s>=12?"pm":"am";case"A":return s>=12?"PM":"AM";case"i":return d>9?d:"0"+d;case"s":return c>9?c:"0"+c}return e})},formatDate:function(e,t){var n,i,a,r=this,t=t||e.ts;r.i18;return r.options.clientFormatDate&&t>0?(n=new Date(1e3*t),i=t>=this.yesterday?this.fancyFormat:this.dateFormat,a=r.date(i,n),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 r.i18n(t)+" "}):r.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:Array.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('<iframe width="1" height="1" scrolling="no" frameborder="no" style="position:absolute; top:-1px; left:-1px" crossorigin="use-credentials">').attr("src",t).one("load",function(){var n=e(this);try{this.contentDocument.location.reload(!0),n.one("load",function(){n.remove(),i.resolve()})}catch(a){n.attr("src","").attr("src",t).one("load",function(){n.remove(),i.resolve()})}}).appendTo("body")}catch(a){n&&n.remove(),i.reject()}return i},makeNetmountOptionOauth:function(t,n,i,a){var r,o="boolean"==typeof a?a:null,a=Object.assign({noOffline:!1,root:"root",pathI18n:"folderId",folders:!0},null===o?a||{}:{noOffline:o}),s=function(n,o,d){var c,u=this,h=Object.keys(e.isPlainObject(d)?d:{}).length;o.next().remove(),h&&(c=e('<select class="ui-corner-all elfinder-tabstop" style="max-width:200px;">').append(e(e.map(d,function(e,t){return'<option value="'+n.escape((t+"").trim())+'">'+n.escape(e)+"</option>"}).join(""))).on("change click",function(o){var d,c=e(this),h=c.val();u.inputs.path.val(h),!a.folders||"change"!==o.type&&c.data("current")===h||(c.next().remove(),c.data("current",h),h!=a.root&&(d=l(),r&&"pending"===r.state()&&(r.quiet=!0,r.abort()),c.after(d),r=n.request({data:{cmd:"netmount",protocol:t,host:i,user:"init",path:h,pass:"folders"},preventDefault:!0}).done(function(e){s.call(u,n,c,e.folders)}).always(function(){r=null,d.remove()}).xhr))}),o.after(e("<div/>").append(c)),c.focus())},l=function(){return e('<div class="elfinder-netmount-spinner"/>').append('<span class="elfinder-info-spinner"/>')};return{vars:{},name:n,inputs:{offline:e('<input type="checkbox"/>').on("change",function(){e(this).parents("table.elfinder-netmount-tb").find("select:first").trigger("change","reset")}),host:e('<span><span class="elfinder-info-spinner"/></span><input type="hidden"/>'),path:e('<input type="text" value="'+a.root+'"/>'),user:e('<input type="hidden"/>'),pass:e('<input type="hidden"/>')},select:function(n,r,o){var s=this.inputs,l=s.offline,d=e(s.host[0]),o=o||null;this.vars.mbtn=s.host.closest(".ui-dialog").children(".ui-dialog-buttonpane:first").find("button.elfinder-btncnt-0"),d.data("inrequest")||!d.find("span.elfinder-info-spinner").length&&"reset"!==o&&("winfocus"!==o||d.siblings("span.elfinder-button-icon-reload").length)?(l.closest("tr")[a.noOffline||s.user.val()?"hide":"show"](),d.data("funcexpup")&&d.data("funcexpup")()):(1===l.parent().children().length&&(s.path.parent().prev().html(n.i18n(a.pathI18n)),l.attr("title",n.i18n("offlineAccess")),l.uniqueId().after(e("<label/>").attr("for",l.attr("id")).html(" "+n.i18n("offlineAccess")))),d.data("inrequest",!0).empty().addClass("elfinder-info-spinner").parent().find("span.elfinder-button-icon").remove(),n.request({data:{cmd:"netmount",protocol:t,host:i,user:"init",options:{id:n.id,offline:l.prop("checked")?1:0,pass:s.host[1].value}},preventDefault:!0}).done(function(e){d.removeClass("elfinder-info-spinner").html(e.body.replace(/\{msg:([^}]+)\}/g,function(e,t){return n.i18n(t,i)}))}),a.noOffline&&l.closest("tr").hide()),this.vars.mbtn[e(s.host[1]).val()?"show":"hide"]()},done:function(n,r){var o=this.inputs,l=this.protocol,d=e(o.host[0]),c=e(o.host[1]),u=" ";if(a.noOffline&&o.offline.closest("tr").hide(),"makebtn"==r.mode)d.removeClass("elfinder-info-spinner").removeData("expires").removeData("funcexpup"),o.host.find("input").hover(function(){e(this).toggleClass("ui-state-hover")}),c.val(""),o.path.val(a.root).next().remove(),o.user.val(""),o.pass.val(""),!a.noOffline&&o.offline.closest("tr").show(),this.vars.mbtn.hide();else if("folders"==r.mode)r.folders&&s.call(this,n,o.path.nextAll(":last"),r.folders);else{if(r.expires&&(u="()",d.data("expires",r.expires)),d.html(i+u).removeClass("elfinder-info-spinner"),r.expires&&(d.data("funcexpup",function(){var e=Math.floor((d.data("expires")-+new Date/1e3)/60);3>e?d.parent().children(".elfinder-button-icon-reload").click():(d.text(d.text().replace(/\(.*\)/,"("+n.i18n(["minsLeft",e])+")")),setTimeout(function(){d.is(":visible")&&d.data("funcexpup")();
|
||
},6e4))}),d.data("funcexpup")()),r.reset)return void l.trigger("change","reset");d.parent().append(e('<span class="elfinder-button-icon elfinder-button-icon-reload" title="'+n.i18n("reAuth")+'">').on("click",function(){c.val("reauth"),l.trigger("change","reset")})),c.val(t),this.vars.mbtn.show(),r.folders&&s.call(this,n,o.path,r.folders),o.user.val("done"),o.pass.val("done"),o.offline.closest("tr").hide()}d.removeData("inrequest")},fail:function(t,n){e(this.inputs.host[0]).removeData("inrequest"),this.protocol.trigger("change","reset")}}},findCwdNodes:function(t,n){var i=this,a=this.getUI("cwd"),r=this.cwd().hash,o=e();return n=n||{},e.each(t,function(e,t){return(t.phash===r||i.searchStatus.state>1)&&(o=o.add(a.find("#"+i.cwdHash2Id(t.hash))),n.firstOnly)?!1:void 0}),o},convAbsUrl:function(e){if(e.match(/^http/i))return e;if("//"===e.substr(0,2))return window.location.protocol+e;var t,n=window.location.protocol+"//"+window.location.host,i=/[^\/]+\/\.\.\//;for(t="/"===e.substr(0,1)?n+e:n+window.location.pathname.replace(/\/[^\/]+$/,"/")+e,t=t.replace("/./","/");i.test(t);)t=t.replace(i,"");return t},navHash2Id:function(e){return this.navPrefix+e},navId2Hash:function(e){return"string"==typeof e?e.substr(this.navPrefix.length):!1},cwdHash2Id:function(e){return this.cwdPrefix+e},cwdId2Hash:function(e){return"string"==typeof e?e.substr(this.cwdPrefix.length):!1},isInWindow:function(e,t){var n,i;return(n=e.get(0))&&(t||null!==n.offsetParent)?(i=n.getBoundingClientRect(),!!document.elementFromPoint(i.left,i.top)):!1},zIndexCalc:function(){var t=this,n=this.getUI(),i=n.css("z-index");i&&"auto"!==i&&"inherit"!==i?t.zIndex=i:n.parents().each(function(n,i){var a=e(i).css("z-index");return"auto"!==a&&"inherit"!==a&&(a=parseInt(a))?(t.zIndex=a,!1):void 0})},loadScript:function(t,n,i,a){var r={dataType:"script",cache:!0},o=null;return e.isFunction(n)&&(o=function(){if(a)if("undefined"==typeof a.obj[a.name])var e=a.timeout?a.timeout/10:1e3,t=setInterval(function(){--e>0&&"undefined"!=typeof a.obj[a.name]&&(clearInterval(t),n())},10);else n();else n()}),i&&"tag"===i.loadType?(e.each(t,function(t,n){e("head").append(e('<script defer="defer">').attr("src",n))}),o()):(i=e.isPlainObject(i)?Object.assign(r,i):r,function s(){e.ajax(Object.assign(i,{url:t.shift(),success:t.length?s:o}))}()),this},loadCss:function(t){var n=this;return"string"==typeof t&&(t=[t]),e.each(t,function(t,i){i=n.convAbsUrl(i).replace(/^https?:/i,""),e("head > link[href='+url+']").length||e("head").append('<link rel="stylesheet" type="text/css" href="'+i+'" />')}),this},asyncJob:function(t,n,i){var a,r,o=e.Deferred().always(function(){o._abort=function(){}}),s=!1,l=Object.assign({interval:0,numPerOnce:1},i||{}),d=[],c=[],u=[];return o._abort=function(e){r&&clearTimeout(r),c=[],s=!0,"pending"===o.state()&&o[e?"resolve":"reject"](d)},"function"==typeof t&&Array.isArray(n)?(c=n.concat(),a=function(){s||(u=c.splice(0,l.numPerOnce),e.each(u,function(e,n){if(s)return!1;var i=t(n);null!==i&&d.push(i)}),s||(c.length?r=setTimeout(a,l.interval):o.resolve(d)))},c.length?r=setTimeout(a,0):o.resolve(d)):o.reject(),o},log:function(e){return window.console&&window.console.log&&window.console.log(e),this},debug:function(e,t){var n=this.options.debug;return n&&("all"===n||n[e])&&window.console&&window.console.log&&window.console.log("elfinder debug: ["+e+"] ["+this.id+"]",t),"backend-error"===e?(!this.cwd().hash||n&&("all"===n||n["backend-error"]))&&(t=Array.isArray(t)?t:[t],this.error(t)):"backend-debug"===e&&this.trigger("backenddebug",t),this},time:function(e){window.console&&window.console.time&&window.console.time(e)},timeEnd:function(e){window.console&&window.console.timeEnd&&window.console.timeEnd(e)}},Object.keys||(Object.keys=function(){var e=Object.prototype.hasOwnProperty,t=!{toString:null}.propertyIsEnumerable("toString"),n=["toString","toLocaleString","valueOf","hasOwnProperty","isPrototypeOf","propertyIsEnumerable","constructor"],i=n.length;return function(a){if("object"!=typeof a&&"function"!=typeof a||null===a)throw new TypeError("Object.keys called on non-object");var r=[];for(var o in a)e.call(a,o)&&r.push(o);if(t)for(var s=0;i>s;s++)e.call(a,n[s])&&r.push(n[s]);return r}}()),Array.isArray||(Array.isArray=function(e){return jQuery.isArray(e)}),Object.assign||(Object.assign=function(){return jQuery.extend.apply(null,arguments)}),i.prototype.version="2.1.25",function(){if(e.ui&&e.ui.ddmanager){var t=e.ui.ddmanager.prepareOffsets;e.ui.ddmanager.prepareOffsets=function(n,i){var a=function(e){if(e.is(":hidden"))return!0;var t=e[0].getBoundingClientRect();return!document.elementFromPoint(t.left,t.top)};if("mousedown"===i.type||n.options.elfRefresh){var r,o,s=e.ui.ddmanager.droppables[n.options.scope]||[],l=s.length;for(r=0;l>r;r++)o=s[r],o.options.autoDisable&&(!o.options.disabled||o.options.autoDisable>1)&&(o.options.disabled=a(o.element),o.options.autoDisable=o.options.disabled?2:1)}return t(n,i)}}}(),function(e){function t(t,n){if(!(t.originalEvent.touches.length>1)){e(t.currentTarget).hasClass("touch-punch-keep-default")||t.preventDefault();var i=t.originalEvent.changedTouches[0],a=document.createEvent("MouseEvents");a.initMouseEvent(n,!0,!0,window,1,i.screenX,i.screenY,i.clientX,i.clientY,!1,!1,!1,!1,0,null),t.target.dispatchEvent(a)}}if(e.support.touch="ontouchend"in document,e.support.touch){var n,i,a,r=e.ui.mouse.prototype,o=r._mouseInit,s=r._mouseDestroy;r._touchStart=function(e){var r=this;!n&&r._mouseCapture(e.originalEvent.changedTouches[0])&&(i=e.originalEvent.changedTouches[0].screenX.toFixed(0),a=e.originalEvent.changedTouches[0].screenY.toFixed(0),n=!0,r._touchMoved=!1,t(e,"mouseover"),t(e,"mousemove"),t(e,"mousedown"))},r._touchMove=function(e){if(n){var r=e.originalEvent.changedTouches[0].screenX.toFixed(0),o=e.originalEvent.changedTouches[0].screenY.toFixed(0);Math.abs(i-r)<=4&&Math.abs(a-o)<=4||(this._touchMoved=!0,t(e,"mousemove"))}},r._touchEnd=function(e){n&&(t(e,"mouseup"),t(e,"mouseout"),this._touchMoved||t(e,"click"),n=!1,this._touchMoved=!1)},r._mouseInit=function(){var t=this;t.element.hasClass("touch-punch")&&t.element.on({touchstart:e.proxy(t,"_touchStart"),touchmove:e.proxy(t,"_touchMove"),touchend:e.proxy(t,"_touchEnd")}),o.call(t)},r._mouseDestroy=function(){var t=this;t.element.hasClass("touch-punch")&&t.element.off({touchstart:e.proxy(t,"_touchStart"),touchmove:e.proxy(t,"_touchMove"),touchend:e.proxy(t,"_touchEnd")}),s.call(t)}}}(jQuery),e.fn.elfinder=function(t,n){return"instance"===t?this.getElFinder():this.each(function(){var a,r="string"==typeof t?t:"";if(this.elfinder)switch(r){case"close":case"hide":this.elfinder.hide();break;case"open":case"show":this.elfinder.show();break;case"destroy":this.elfinder.destroy();break;case"reload":case"restart":this.elfinder&&(a=this.elfinder.options,this.elfinder.destroy(),new i(this,e.extend(!0,a,e.isPlainObject(n)?n:{})))}else e.isPlainObject(t)&&new i(this,t)})},e.fn.getElFinder=function(){var e;return this.each(function(){return this.elfinder?(e=this.elfinder,!1):void 0}),e},e.fn.elfUiWidgetInstance=function(e){try{return this[e]("instance")}catch(t){var n=this.data("ui-"+e);return n&&"object"==typeof n&&n.widgetFullName==="ui-"+e?n:null}},i.prototype._options={url:"",requestType:"get",requestMaxConn:3,transport:{},urlUpload:"",dragUploadAllow:"auto",overwriteUploadConfirm:!0,uploadMaxChunkSize:10485760,folderUploadExclude:{win:/^(?:desktop\.ini|thumbs\.db)$/i,mac:/^\.ds_store$/i},iframeTimeout:0,customData:{},handlers:{},customHeaders:{},xhrFields:{},lang:"en",baseUrl:"./",cssAutoLoad:!0,cssClass:"",commands:["*"],commandsOptions:{getfile:{onlyURL:!1,multiple:!1,folders:!1,oncomplete:"",getPath:!0,getImgSize:!1},open:{method:"post",into:"window"},upload:{ui:"button"},download:{maxRequests:10},quicklook:{autoplay:!0,width:450,height:300,googleDocsMimes:[]},edit:{dialogWidth:void 0,mimes:[],editors:[],encodings:["Big5","Big5-HKSCS","Cp437","Cp737","Cp775","Cp850","Cp852","Cp855","Cp857","Cp858","Cp862","Cp866","Cp874","EUC-CN","EUC-JP","EUC-KR","ISO-2022-CN","ISO-2022-JP","ISO-2022-KR","ISO-8859-1","ISO-8859-2","ISO-8859-3","ISO-8859-4","ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9","ISO-8859-13","ISO-8859-15","KOI8-R","KOI8-U","Shift-JIS","Windows-1250","Windows-1251","Windows-1252","Windows-1253","Windows-1254","Windows-1257"],extraOptions:{}},search:{incsearch:{enable:!0,minlen:1,wait:500}},info:{nullUrlDirLinkSelf:!0,custom:{}},mkdir:{intoNewFolderToolbtn:!1},resize:{grid8px:"enable",presetSize:[[320,240],[400,400],[640,480],[800,600]]},rm:{quickTrash:!0,infoCheckWait:10,toTrashMaxItems:1e3},help:{view:["about","shortcuts","help","debug"],helpSource:""}},getFileCallback:null,defaultView:"icons",startPathHash:"",sound:!0,ui:["toolbar","tree","path","stat"],uiOptions:{toolbar:[["back","forward"],["netmount"],["mkdir","mkfile","upload"],["open","download","getfile"],["info","chmod"],["quicklook"],["copy","cut","paste"],["rm","empty"],["duplicate","rename","edit","resize"],["extract","archive"],["search"],["view","sort"],["help"],["fullscreen"]],toolbarExtra:{displayTextLabel:!1,labelExcludeUA:["Mobile"],autoHideUA:["Mobile"]},tree:{openRootOnLoad:!0,openCwdOnOpen:!0,syncTree:!0,subTreeMax:100,subdirsMaxConn:3,subdirsAtOnce:5},navbar:{minWidth:150,maxWidth:500,autoHideUA:[]},cwd:{oldSchool:!1,showSelectCheckboxUA:["Touch"],listView:{columns:["perm","date","size","kind"],columnsCustomName:{},fixedHeader:!0}}},dispInlineRegex:"^(?:(?:image|video|audio)|(?:text/plain|application/pdf)$)",onlyMimes:[],sortRules:{},sortType:"name",sortOrder:"asc",sortStickFolders:!0,sortAlsoTreeview:!1,clientFormatDate:!0,UTCDate:!1,dateFormat:"",fancyDateFormat:"",fileModeStyle:"both",width:"auto",height:400,heightBase:null,resizable:!0,notifyDelay:500,notifyDialog:{position:{top:"12px",right:"12px"},width:280},allowShortcuts:!0,rememberLastDir:!0,reloadClearHistory:!1,useBrowserHistory:!0,showFiles:50,showThreshold:50,validName:!1,backupSuffix:"~",sync:0,syncStart:!0,loadTmbs:5,cookie:{expires:30,domain:"",path:"/",secure:!1},contextmenu:{navbar:["open","download","|","upload","mkdir","|","copy","cut","paste","duplicate","|","rm","empty","|","rename","|","archive","|","places","info","chmod","netunmount"],cwd:["reload","back","|","upload","mkdir","mkfile","paste","|","empty","|","view","sort","colwidth","|","info","|","fullscreen"],files:["getfile","|","open","download","opendir","quicklook","|","upload","mkdir","|","copy","cut","paste","duplicate","|","rm","empty","|","rename","edit","resize","|","archive","extract","|","places","info","chmod","netunmount"]},enableAlways:!1,enableByMouseOver:!0,windowCloseConfirm:["hasNotifyDialog","editingFile"],rawStringDecoder:"object"==typeof Encoding&&e.isFunction(Encoding.convert)?function(e){return Encoding.convert(e,{to:"UNICODE",type:"string"})}:null,debug:["error","warning","event-destroy"]},i.prototype._options.commandsOptions.netmount={ftp:{name:"FTP",inputs:{host:e('<input type="text"/>'),port:e('<input type="text" placeholder="21"/>'),path:e('<input type="text" value="/"/>'),user:e('<input type="text"/>'),pass:e('<input type="password" autocomplete="new-password"/>'),encoding:e('<input type="text" placeholder="Optional"/>'),locale:e('<input type="text" placeholder="Optional"/>')}},dropbox:{name:"Dropbox.com",inputs:{host:e('<span><span class="elfinder-info-spinner"/></span></span><input type="hidden"/>'),path:e('<input type="text" value="/"/>'),user:e('<input type="hidden"/>'),pass:e('<input type="hidden"/>')},select:function(e){var t=this;t.inputs.host.find("span").length&&e.request({data:{cmd:"netmount",protocol:"dropbox",host:"dropbox.com",user:"init",pass:"init",options:{url:e.uploadURL,id:e.id}},preventDefault:!0}).done(function(n){t.inputs.host.find("span").removeClass("elfinder-info-spinner"),t.inputs.host.find("span").html(n.body.replace(/\{msg:([^}]+)\}/g,function(t,n){return e.i18n(n,"Dropbox.com")}))}).fail(function(){})},done:function(t,n){var i=this;"makebtn"==n.mode?(i.inputs.host.find("span").removeClass("elfinder-info-spinner"),i.inputs.host.find("input").hover(function(){e(this).toggleClass("ui-state-hover")}),i.inputs.host[1].value=""):(i.inputs.host.find("span").removeClass("elfinder-info-spinner"),i.inputs.host.find("span").html("Dropbox.com"),i.inputs.host[1].value="dropbox",i.inputs.user.val("done"),i.inputs.pass.val("done"))}},dropbox2:i.prototype.makeNetmountOptionOauth("dropbox2","Dropbox","Dropbox",{noOffline:!0,root:"/",pathI18n:"path"}),googledrive:i.prototype.makeNetmountOptionOauth("googledrive","Google Drive","Google"),onedrive:i.prototype.makeNetmountOptionOauth("onedrive","One Drive","OneDrive"),box:i.prototype.makeNetmountOptionOauth("box","Box","Box",{noOffline:!0})},i.prototype.history=function(t){var n,i=this,a=!0,r=[],o=function(){r=[t.cwd().hash],n=0,a=!0},s=t.options.useBrowserHistory&&window.history&&window.history.pushState?window.history:null,l=function(s){return s&&i.canForward()||!s&&i.canBack()?(a=!1,t.exec("open",r[s?++n:--n]).fail(o)):e.Deferred().reject()};this.canBack=function(){return n>0},this.canForward=function(){return n<r.length-1},this.back=l,this.forward=function(){return l(!0)},t.open(function(){var e=r.length,i=t.cwd().hash;a&&(n>=0&&e>n+1&&r.splice(n+1),r[r.length-1]!=i&&r.push(i),n=r.length-1),a=!0,s&&(s.state?s.state.thash!=i&&s.pushState({thash:i},null,location.pathname+location.search+"#elf_"+i):s.replaceState({thash:i},null,location.pathname+location.search+"#elf_"+i))}).reload(t.options.reloadClearHistory&&o)},i.prototype.command=function(t){this.fm=t,this.name="",this.className="",this.title="",this.linkedCmds=[],this.state=-1,this.alwaysEnabled=!1,this.noChangeDirOnRemovedCwd=!1,this._disabled=!1,this.disableOnSearch=!1,this.updateOnSelect=!0,this.syncTitleOnChange=!1,this._handlers={enable:function(){this.update(void 0,this.value)},disable:function(){this.update(-1,this.value)},"open reload load sync":function(){this._disabled=!(this.alwaysEnabled||this.fm.isCommandEnabled(this.name)),this.update(void 0,this.value),this.change()}},this.handlers={},this.shortcuts=[],this.options={ui:"button"},this.setup=function(t,n){var i,a,r,o,s=this,l=this.fm;for(this.name=t,this.title=l.messages["cmd"+t]?l.i18n("cmd"+t):this.extendsCmd&&l.messages["cmd"+this.extendsCmd]?l.i18n("cmd"+this.extendsCmd):t,this.options=Object.assign({},this.options,n),this.listeners=[],n.shortcuts&&("function"==typeof n.shortcuts?r=n.shortcuts(this.fm,this.shortcuts):Array.isArray(n.shortcuts)&&(r=n.shortcuts),this.shortcuts=r||[]),this.updateOnSelect&&(this._handlers.select=function(){this.update(void 0,this.value)}),e.each(Object.assign({},s._handlers,s.handlers),function(t,n){l.bind(t,e.proxy(n,s))}),i=0;i<this.shortcuts.length;i++)a=this.shortcuts[i],o=a.callback||s.exec,a.callback=function(t){var n,i={};l.searchStatus.state<2?n=l.isCommandEnabled(s.name):(e.each(l.selected(),function(t,n){l.optionsByHashes[n]?i[n]=!0:e.each(l.volOptions,function(e){return i[e]||0!==n.indexOf(e)?void 0:(i[e]=!0,!1)})}),e.each(i,function(e){return n=l.isCommandEnabled(s.name,e),n?void 0:!1})),n&&(s.event=t,o.call(s),delete s.event)},!a.description&&(a.description=this.title),l.shortcut(a);this.disableOnSearch&&l.bind("search searchend",function(){s._disabled="search"===this.type?!0:!(this.alwaysEnabled||l.isCommandEnabled(t)),s.update(void 0,s.value)}),this.init()},this.init=function(){},this.exec=function(t,n){return e.Deferred().reject()},this.disabled=function(){return this.state<0},this.enabled=function(){return this.state>-1},this.active=function(){return this.state>0},this.getstate=function(){return-1},this.update=function(e,t){var n=this.state,i=this.value;this._disabled&&0===this.fm.searchStatus?this.state=-1:this.state=void 0!==e?e:this.getstate(),this.value=t,n==this.state&&i==this.value||this.change()},this.change=function(e){var t,n;if("function"==typeof e)this.listeners.push(e);else for(n=0;n<this.listeners.length;n++){t=this.listeners[n];try{t(this.state,this.value)}catch(i){this.fm.debug("error",i)}}return this},this.hashes=function(n){return n?e.map(Array.isArray(n)?n:[n],function(e){return t.file(e)?e:null}):t.selected()},this.files=function(t){var n=this.fm;return t?e.map(Array.isArray(t)?t:[t],function(e){return n.file(e)||null}):n.selectedFiles()}},i.prototype.resources={"class":{hover:"ui-state-hover",active:"ui-state-active",disabled:"ui-state-disabled",draggable:"ui-draggable",droppable:"ui-droppable",adroppable:"elfinder-droppable-active",cwdfile:"elfinder-cwd-file",cwd:"elfinder-cwd",tree:"elfinder-tree",treeroot:"elfinder-navbar-root",navdir:"elfinder-navbar-dir",navdirwrap:"elfinder-navbar-dir-wrapper",navarrow:"elfinder-navbar-arrow",navsubtree:"elfinder-navbar-subtree",navcollapse:"elfinder-navbar-collapsed",navexpand:"elfinder-navbar-expanded",treedir:"elfinder-tree-dir",placedir:"elfinder-place-dir",searchbtn:"elfinder-button-search",editing:"elfinder-to-editing"},tpl:{perms:'<span class="elfinder-perms"/>',lock:'<span class="elfinder-lock"/>',symlink:'<span class="elfinder-symlink"/>',navicon:'<span class="elfinder-nav-icon"/>',navspinner:'<span class="elfinder-navbar-spinner"/>',navdir:'<div class="elfinder-navbar-wrapper{root}"><span id="{id}" class="ui-corner-all elfinder-navbar-dir {cssclass}"><span class="elfinder-navbar-arrow"/><span class="elfinder-navbar-icon" {style}/>{symlink}{permissions}{name}</span><div class="elfinder-navbar-subtree" style="display:none"/></div>',placedir:'<div class="elfinder-navbar-wrapper"><span id="{id}" class="ui-corner-all elfinder-navbar-dir {cssclass}" title="{title}"><span class="elfinder-navbar-arrow"/><span class="elfinder-navbar-icon" {style}/>{symlink}{permissions}{name}</span><div class="elfinder-navbar-subtree" style="display:none"/></div>'},mimes:{text:["application/x-empty","application/javascript","application/xhtml+xml","audio/x-mp3-playlist","application/x-web-config","application/docbook+xml","application/x-php","application/x-perl","application/x-awk","application/x-config","application/x-csh","application/xml"]},mixin:{make:function(){var t,n,i,a,r,o,s,l,d,c,u=this,h=this.fm,p=this.name,f=this.requestCmd||p,m=h.getUI("workzone"),g=this.origin&&"navbar"===this.origin?"tree":"cwd",v=h.getUI(g),b="tree"===g,y=b?"navHash2Id":"cwdHash2Id",w=!b&&"list"!=h.storage("view"),k=h.selected(),x=this.move||!1,C=m.hasClass("elfinder-cwd-wrapper-empty"),T=function(){D.is(":hidden")||D.addClass("ui-front").elfinderoverlay("hide").off("click",F),M.removeClass("ui-front").css("position",""),w?n&&n.css("max-height",""):i&&i.css("width","").parent("td").css("overflow","")},A=e.Deferred().fail(function(e){o&&r.attr("class",o),C&&m.addClass("elfinder-cwd-wrapper-empty"),k&&(x&&h.trigger("unlockfiles",{files:k}),h.clipboard([]),h.trigger("selectfiles",{files:k})),e&&h.error(e)}).always(function(){T(),E(),h.enable(),h.trigger("resMixinMake")}),z="tmp_"+parseInt(1e5*Math.random()),I=this.data&&this.data.target?this.data.target:b?h.file(k[0]).hash:h.cwd().hash,O=new Date,S={hash:z,phash:I,name:h.uniqueName(this.prefix,I),mime:this.mime,read:!0,write:!0,date:"Today "+O.getHours()+":"+O.getMinutes(),move:x},U=this.data||{},M=v.trigger("create."+h.namespace,S).find("#"+h[y](z)).on("unselect."+h.namespace,function(){setTimeout(function(){P&&P.blur()},50)}),D=h.getUI("overlay"),E=function(){h.unbind("resize",R),P.remove(),b&&M.closest(".elfinder-navbar-wrapper").remove(),M.remove()},F=function(e){H||(E(),e.stopPropagation(),A.reject())},P=e(w?"<textarea/>":'<input type="text"/>').on("keyup text",function(){w?(this.style.height="1px",this.style.height=this.scrollHeight+"px"):t&&(this.style.width=t+"px",this.scrollWidth>t&&(this.style.width=this.scrollWidth+10+"px"))}).on("keydown",function(t){t.stopImmediatePropagation(),t.keyCode==e.ui.keyCode.ESCAPE?A.reject():t.keyCode==e.ui.keyCode.ENTER&&P.blur()}).on("mousedown click dblclick",function(e){e.stopPropagation(),"dblclick"===e.type&&e.preventDefault()}).on("blur",function(){var t,n=e.trim(P.val()),i=P.parent(),r=!0;if(!H&&i.length){if(h.options.validName&&h.options.validName.test)try{r=h.options.validName.test(n)}catch(o){r=!1}if(!n||"."===n||".."===n||!r)return H=!0,h.error("directory"===S.mime?"errInvDirname":"errInvName",{modal:!0,close:j}),!1;if(h.fileByName(n,I))return H=!0,h.error(["errExists",n],{modal:!0,close:j}),!1;t=k&&x?h.exec("cut",k):null,e.when(t).done(function(){var t={},i={};T(),P.hide().before(e("<span>").text(n)),h.lockfiles({files:[z]}),h.request({data:Object.assign({cmd:f,name:n,target:I},U||{}),notify:{type:p,cnt:1},preventFail:!0,syncOnFail:!0,navigate:{toast:t}}).fail(function(e){h.unlockfiles({files:[z]}),H=!0,P.show().prev().remove(),h.error(e,{modal:!0,close:j})}).done(function(n){if(A.resolve(n),n&&n.added&&n.added[0]){var r=n.added[0],o=r.hash,s=(v.find("#"+h[y](o)),{directory:{cmd:"open",msg:"cmdopendir"},text:{cmd:"edit",msg:"cmdedit"},"default":{cmd:"open",msg:"cmdopen"}});k&&x&&h.one(f+"done",function(){h.exec("paste",o)}),x||(Object.assign(i,a||s[r.mime]||s[r.mime.split("/")[0]]||s[-1!==e.inArray(r.mime,h.resources.mimes.text)?"text":"none"]||s["default"]),Object.assign(t,i.cmd?{incwd:{msg:h.i18n(["complete",h.i18n("cmd"+p)]),action:i},inbuffer:{msg:h.i18n(["complete",h.i18n("cmd"+p)]),action:i}}:{inbuffer:{msg:h.i18n(["complete",h.i18n("cmd"+p)])}}))}})}).fail(function(){A.reject()})}}),j=function(){var e=P.val().replace(/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/gi,"");!H&&h.UA.Mobile&&D.on("click",F).removeClass("ui-front").elfinderoverlay("show"),H=!1,P.select().focus(),P[0].setSelectionRange&&P[0].setSelectionRange(0,e.length)},R=function(){M.trigger("scrolltoview")},H=!1;return h.isCommandEnabled(f,I)&&M.length?(e.isPlainObject(u.nextAction)&&(a=Object.assign({},u.nextAction)),b?(r=e("#"+h[y](I)),s=h.res("class","navcollapse"),l=h.res("class","navexpand"),d=h.res("class","navarrow"),c=h.res("class","navsubtree"),M.closest("."+c).show(),r.hasClass(s)||(o=r.attr("class"),r.addClass(s+" "+l+" elfinder-subtree-loaded")),r.is("."+s+":not(."+l+")")&&r.children("."+d).click().data("dfrd").done(function(){P.val()===S.name&&P.val(h.uniqueName(this.prefix,I)).select().focus()}.bind(this)),n=M.contents().filter(function(){return 3==this.nodeType&&e(this).parent().attr("id")===h.navHash2Id(S.hash)}),n.replaceWith(P.val(S.name))):(C&&m.removeClass("elfinder-cwd-wrapper-empty"),n=M.find(".elfinder-cwd-filename"),i=n.parent(),M.css("position","relative").addClass("ui-front"),w?n.css("max-height","none"):(t=i.width(),i.width(t-15).parent("td").css("overflow","visible")),n.empty("").append(P.val(S.name))),h.bind("resize",R),P.trigger("keyup"),j(),A):A.reject()}},blink:function(e,t){var n,i={slowonce:function(){e.hide().delay(250).fadeIn(750).delay(500).fadeOut(3500)},lookme:function(){e.show().fadeOut(500).fadeIn(750)}};t=t||"slowonce",n=i[t]||i.lookme,e.stop(!0,!0),n()}},e.fn.dialogelfinder=function(t){var n="elfinderPosition",i="elfinderDestroyOnClose";if(this.not(".elfinder").each(function(){var a=(e(document),e('<div class="ui-widget-header dialogelfinder-drag ui-corner-top">'+(t.title||"Files")+"</div>")),r=(e('<a href="#" class="dialogelfinder-drag-close ui-corner-all"><span class="ui-icon ui-icon-closethick"> </span></a>').appendTo(a).click(function(e){e.preventDefault(),r.dialogelfinder("close")}),e(this).addClass("dialogelfinder").css("position","absolute").hide().appendTo("body").draggable({handle:".dialogelfinder-drag",containment:"window",stop:function(){r.trigger("resize"),o.trigger("resize")}}).elfinder(t).prepend(a)),o=r.elfinder("instance");r.width(parseInt(r.width())||840).data(i,!!t.destroyOnClose).find(".elfinder-toolbar").removeClass("ui-corner-top"),t.position&&r.data(n,t.position),t.autoOpen!==!1&&e(this).dialogelfinder("open")}),"open"==t){var a=e(this),r=a.data(n)||{top:parseInt(e(document).scrollTop()+(e(window).height()<a.height()?2:(e(window).height()-a.height())/2)),left:parseInt(e(document).scrollLeft()+(e(window).width()<a.width()?2:(e(window).width()-a.width())/2))};a.is(":hidden")&&(a.addClass("ui-front").css(r).show().trigger("resize"),setTimeout(function(){a.trigger("resize").mousedown()},200))}else if("close"==t){var a=e(this).removeClass("ui-front");a.is(":visible")&&(a.data(i)?a.elfinder("destroy").remove():a.elfinder("close"))}else if("instance"==t)return e(this).getElFinder();return this},"function"==typeof i&&i.prototype.i18&&(i.prototype.i18.en={translator:"Troex Nevelin <troex@fury.scancode.ru>",language:"English",direction:"ltr",dateFormat:"M d, Y h:i A",fancyDateFormat:"$1 h:i A",nonameDateFormat:"ymd-His",messages:{error:"Error",errUnknown:"Unknown error.",errUnknownCmd:"Unknown command.",errJqui:"Invalid jQuery UI configuration. Selectable, draggable and droppable components must be included.",errNode:"elFinder requires DOM Element to be created.",errURL:"Invalid elFinder configuration! URL option is not set.",errAccess:"Access denied.",errConnect:"Unable to connect to backend.",errAbort:"Connection aborted.",errTimeout:"Connection timeout.",errNotFound:"Backend not found.",errResponse:"Invalid backend response.",errConf:"Invalid backend configuration.",errJSON:"PHP JSON module not installed.",errNoVolumes:"Readable volumes not available.",errCmdParams:'Invalid parameters for command "$1".',errDataNotJSON:"Data is not JSON.",errDataEmpty:"Data is empty.",errCmdReq:"Backend request requires command name.",errOpen:'Unable to open "$1".',errNotFolder:"Object is not a folder.",errNotFile:"Object is not a file.",errRead:'Unable to read "$1".',errWrite:'Unable to write into "$1".',errPerm:"Permission denied.",errLocked:'"$1" is locked and can not be renamed, moved or removed.',errExists:'File named "$1" already exists.',errInvName:"Invalid file name.",errInvDirname:"Invalid folder name.",errFolderNotFound:"Folder not found.",errFileNotFound:"File not found.",errTrgFolderNotFound:'Target folder "$1" not found.',errPopup:"Browser prevented opening popup window. To open file enable it in browser options.",errMkdir:'Unable to create folder "$1".',errMkfile:'Unable to create file "$1".',errRename:'Unable to rename "$1".',errCopyFrom:'Copying files from volume "$1" not allowed.',errCopyTo:'Copying files to volume "$1" not allowed.',errMkOutLink:"Unable to create a link to outside the volume root.",errUpload:"Upload error.",errUploadFile:'Unable to upload "$1".',errUploadNoFiles:"No files found for upload.",errUploadTotalSize:"Data exceeds the maximum allowed size.",errUploadFileSize:"File exceeds maximum allowed size.",errUploadMime:"File type not allowed.",errUploadTransfer:'"$1" transfer error.',errUploadTemp:"Unable to make temporary file for upload.",errNotReplace:'Object "$1" already exists at this location and can not be replaced by object with another type.',errReplace:'Unable to replace "$1".',errSave:'Unable to save "$1".',errCopy:'Unable to copy "$1".',errMove:'Unable to move "$1".',errCopyInItself:'Unable to copy "$1" into itself.',errRm:'Unable to remove "$1".',errTrash:"Unable into trash.",errRmSrc:"Unable remove source file(s).",errExtract:'Unable to extract files from "$1".',errArchive:"Unable to create archive.",errArcType:"Unsupported archive type.",errNoArchive:"File is not archive or has unsupported archive type.",errCmdNoSupport:"Backend does not support this command.",errReplByChild:'The folder "$1" can\'t be replaced by an item it contains.',errArcSymlinks:"For security reason denied to unpack archives contains symlinks or files with not allowed names.",errArcMaxSize:"Archive files exceeds maximum allowed size.",errResize:'Unable to resize "$1".',errResizeDegree:"Invalid rotate degree.",errResizeRotate:"Unable to rotate image.",errResizeSize:"Invalid image size.",errResizeNoChange:"Image size not changed.",errUsupportType:"Unsupported file type.",errNotUTF8Content:'File "$1" is not in UTF-8 and cannot be edited.',errNetMount:'Unable to mount "$1".',errNetMountNoDriver:"Unsupported protocol.",errNetMountFailed:"Mount failed.",errNetMountHostReq:"Host required.",errSessionExpires:"Your session has expired due to inactivity.",errCreatingTempDir:'Unable to create temporary directory: "$1"',errFtpDownloadFile:'Unable to download file from FTP: "$1"',errFtpUploadFile:'Unable to upload file to FTP: "$1"',errFtpMkdir:'Unable to create remote directory on FTP: "$1"',errArchiveExec:'Error while archiving files: "$1"',errExtractExec:'Error while extracting files: "$1"',errNetUnMount:"Unable to unmount.",errConvUTF8:"Not convertible to UTF-8",errFolderUpload:"Try the modern browser, If you'd like to upload the folder.",errSearchTimeout:'Timed out while searching "$1". Search result is partial.',errReauthRequire:"Re-authorization is required.",errMaxTargets:"Max number of selectable items is $1.",errRestore:"Unable to restore from the trash. Can't identify the restore destination.",errEditorNotFound:"Editor not found to this file type.",errServerError:"Error occurred on the server side.",errEmpty:'Unable to empty folder "$1".',cmdarchive:"Create archive",cmdback:"Back",cmdcopy:"Copy",cmdcut:"Cut",cmddownload:"Download",cmdduplicate:"Duplicate",cmdedit:"Edit file",cmdextract:"Extract files from archive",cmdforward:"Forward",cmdgetfile:"Select files",cmdhelp:"About this software",cmdhome:"Home",cmdinfo:"Get info",cmdmkdir:"New folder",cmdmkdirin:"Into New Folder",cmdmkfile:"New text file",cmdopen:"Open",cmdpaste:"Paste",cmdquicklook:"Preview",cmdreload:"Reload",cmdrename:"Rename",cmdrm:"Delete",cmdtrash:"Into trash",cmdrestore:"Restore",cmdsearch:"Find files",cmdup:"Go to parent directory",cmdupload:"Upload files",cmdview:"View",cmdresize:"Resize & Rotate",cmdsort:"Sort",cmdnetmount:"Mount network volume",cmdnetunmount:"Unmount",cmdplaces:"To Places",cmdchmod:"Change mode",cmdopendir:"Open a folder",cmdcolwidth:"Reset column width",cmdfullscreen:"Full Screen",cmdmove:"Move",cmdempty:"Empty the folder",btnClose:"Close",btnSave:"Save",btnRm:"Remove",btnApply:"Apply",btnCancel:"Cancel",btnNo:"No",btnYes:"Yes",btnMount:"Mount",btnApprove:"Goto $1 & approve",btnUnmount:"Unmount",btnConv:"Convert",btnCwd:"Here",btnVolume:"Volume",btnAll:"All",btnMime:"MIME Type",btnFileName:"Filename",btnSaveClose:"Save & Close",btnBackup:"Backup",btnRename:"Rename",btnRenameAll:"Rename(All)",btnPrevious:"Prev ($1/$2)",btnNext:"Next ($1/$2)",btnSaveAs:"Save As",ntfopen:"Open folder",ntffile:"Open file",ntfreload:"Reload folder content",ntfmkdir:"Creating folder",ntfmkfile:"Creating files",ntfrm:"Delete files",ntfcopy:"Copy files",ntfmove:"Move files",ntfprepare:"Checking existing items",ntfrename:"Rename files",ntfupload:"Uploading files",ntfdownload:"Downloading files",ntfsave:"Save files",ntfarchive:"Creating archive",ntfextract:"Extracting files from archive",ntfsearch:"Searching files",ntfresize:"Resizing images",ntfsmth:"Doing something",ntfloadimg:"Loading image",ntfnetmount:"Mounting network volume",ntfnetunmount:"Unmounting network volume",ntfdim:"Acquiring image dimension",ntfreaddir:"Reading folder infomation",ntfurl:"Getting URL of link",ntfchmod:"Changing file mode",ntfpreupload:"Verifying upload file name",ntfzipdl:"Creating a file for download",ntfparents:"Getting path infomation",ntfchunkmerge:"Processing the uploaded file",ntftrash:"Doing throw in the trash",ntfrestore:"Doing restore from tha trash",ntfchkdir:"Checking destination folder",volume_Trash:"Trash",dateUnknown:"unknown",Today:"Today",Yesterday:"Yesterday",msJan:"Jan",msFeb:"Feb",msMar:"Mar",msApr:"Apr",msMay:"May",msJun:"Jun",msJul:"Jul",msAug:"Aug",msSep:"Sep",msOct:"Oct",msNov:"Nov",msDec:"Dec",January:"January",February:"February",March:"March",April:"April",May:"May",June:"June",July:"July",August:"August",September:"September",October:"October",November:"November",December:"December",Sunday:"Sunday",Monday:"Monday",Tuesday:"Tuesday",Wednesday:"Wednesday",Thursday:"Thursday",Friday:"Friday",Saturday:"Saturday",Sun:"Sun",Mon:"Mon",Tue:"Tue",Wed:"Wed",Thu:"Thu",Fri:"Fri",Sat:"Sat",sortname:"by name",sortkind:"by kind",sortsize:"by size",
|
||
sortdate:"by date",sortFoldersFirst:"Folders first",sortperm:"by permission",sortmode:"by mode",sortowner:"by owner",sortgroup:"by group",sortAlsoTreeview:"Also Treeview","untitled file.txt":"NewFile.txt","untitled folder":"NewFolder",Archive:"NewArchive",confirmReq:"Confirmation required",confirmRm:"Are you sure you want to permanently remove items?<br/>This cannot be undone!",confirmRepl:"Replace old item with new one?",confirmRest:"Replace existing item with the item in trash?",confirmConvUTF8:"Not in UTF-8<br/>Convert to UTF-8?<br/>Contents become UTF-8 by saving after conversion.",confirmNonUTF8:"Character encoding of this file couldn't be detected. It need to temporarily convert to UTF-8 for editting.<br/>Please select character encoding of this file.",confirmNotSave:"It has been modified.<br/>Losing work if you do not save changes.",confirmTrash:"Are you sure you want to move items to trash bin?",apllyAll:"Apply to all",name:"Name",size:"Size",perms:"Permissions",modify:"Modified",kind:"Kind",read:"read",write:"write",noaccess:"no access",and:"and",unknown:"unknown",selectall:"Select all files",selectfiles:"Select file(s)",selectffile:"Select first file",selectlfile:"Select last file",viewlist:"List view",viewicons:"Icons view",places:"Places",calc:"Calculate",path:"Path",aliasfor:"Alias for",locked:"Locked",dim:"Dimensions",files:"Files",folders:"Folders",items:"Items",yes:"yes",no:"no",link:"Link",searcresult:"Search results",selected:"selected items",about:"About",shortcuts:"Shortcuts",help:"Help",webfm:"Web file manager",ver:"Version",protocolver:"protocol version",homepage:"Project home",docs:"Documentation",github:"Fork us on Github",twitter:"Follow us on twitter",facebook:"Join us on facebook",team:"Team",chiefdev:"chief developer",developer:"developer",contributor:"contributor",maintainer:"maintainer",translator:"translator",icons:"Icons",dontforget:"and don't forget to take your towel",shortcutsof:"Shortcuts disabled",dropFiles:"Drop files here",or:"or",selectForUpload:"Select files",moveFiles:"Move items",copyFiles:"Copy items",restoreFiles:"Restore items",rmFromPlaces:"Remove from places",aspectRatio:"Aspect ratio",scale:"Scale",width:"Width",height:"Height",resize:"Resize",crop:"Crop",rotate:"Rotate","rotate-cw":"Rotate 90 degrees CW","rotate-ccw":"Rotate 90 degrees CCW",degree:"°",netMountDialogTitle:"Mount network volume",protocol:"Protocol",host:"Host",port:"Port",user:"User",pass:"Password",confirmUnmount:"Are you unmount $1?",dropFilesBrowser:"Drop or Paste files from browser",dropPasteFiles:"Drop files, Paste URLs or images(clipboard) here",encoding:"Encoding",locale:"Locale",searchTarget:"Target: $1",searchMime:"Search by input MIME Type",owner:"Owner",group:"Group",other:"Other",execute:"Execute",perm:"Permission",mode:"Mode",emptyFolder:"Folder is empty",emptyFolderDrop:"Folder is empty\\A Drop to add items",emptyFolderLTap:"Folder is empty\\A Long tap to add items",quality:"Quality",autoSync:"Auto sync",moveUp:"Move up",getLink:"Get URL link",selectedItems:"Selected items ($1)",folderId:"Folder ID",offlineAccess:"Allow offline access",reAuth:"To re-authenticate",nowLoading:"Now loading...",openMulti:"Open multiple files",openMultiConfirm:"You are trying to open the $1 files. Are you sure you want to open in browser?",emptySearch:"Search results is empty in search target.",editingFile:"It is editing a file.",hasSelected:"You have selected $1 items.",hasClipboard:"You have $1 items in the clipboard.",incSearchOnly:"Incremental search is only from the current view.",reinstate:"Reinstate",complete:"$1 complete",contextmenu:"Context menu",pageTurning:"Page turning",volumeRoots:"Volume roots",reset:"Reset",bgcolor:"Background color",colorPicker:"Color picker","8pxgrid":"8px Grid",enabled:"Enabled",disabled:"Disabled",emptyIncSearch:"Search results is empty in current view.\\APress [Enter] to expand search target.",emptyLetSearch:"First letter search results is empty in current view.",textLabel:"Text label",minsLeft:"$1 mins left",openAsEncoding:"Reopen with selected encoding",saveAsEncoding:"Save with the selected encoding",selectFolder:"Select folder",firstLetterSearch:"First letter search",presets:"Presets",tooManyToTrash:"It's too many items so it can't into trash.",TextArea:"TextArea",folderToEmpty:'Empty the folder "$1".',filderIsEmpty:'There are no items in a folder "$1".',kindUnknown:"Unknown",kindRoot:"Volume Root",kindFolder:"Folder",kindAlias:"Alias",kindAliasBroken:"Broken alias",kindApp:"Application",kindPostscript:"Postscript document",kindMsOffice:"Microsoft Office document",kindMsWord:"Microsoft Word document",kindMsExcel:"Microsoft Excel document",kindMsPP:"Microsoft Powerpoint presentation",kindOO:"Open Office document",kindAppFlash:"Flash application",kindPDF:"Portable Document Format (PDF)",kindTorrent:"Bittorrent file",kind7z:"7z archive",kindTAR:"TAR archive",kindGZIP:"GZIP archive",kindBZIP:"BZIP archive",kindXZ:"XZ archive",kindZIP:"ZIP archive",kindRAR:"RAR archive",kindJAR:"Java JAR file",kindTTF:"True Type font",kindOTF:"Open Type font",kindRPM:"RPM package",kindText:"Text document",kindTextPlain:"Plain text",kindPHP:"PHP source",kindCSS:"Cascading style sheet",kindHTML:"HTML document",kindJS:"Javascript source",kindRTF:"Rich Text Format",kindC:"C source",kindCHeader:"C header source",kindCPP:"C++ source",kindCPPHeader:"C++ header source",kindShell:"Unix shell script",kindPython:"Python source",kindJava:"Java source",kindRuby:"Ruby source",kindPerl:"Perl script",kindSQL:"SQL source",kindXML:"XML document",kindAWK:"AWK source",kindCSV:"Comma separated values",kindDOCBOOK:"Docbook XML document",kindMarkdown:"Markdown text",kindImage:"Image",kindBMP:"BMP image",kindJPEG:"JPEG image",kindGIF:"GIF Image",kindPNG:"PNG Image",kindTIFF:"TIFF image",kindTGA:"TGA image",kindPSD:"Adobe Photoshop image",kindXBITMAP:"X bitmap image",kindPXM:"Pixelmator image",kindAudio:"Audio media",kindAudioMPEG:"MPEG audio",kindAudioMPEG4:"MPEG-4 audio",kindAudioMIDI:"MIDI audio",kindAudioOGG:"Ogg Vorbis audio",kindAudioWAV:"WAV audio",AudioPlaylist:"MP3 playlist",kindVideo:"Video media",kindVideoDV:"DV movie",kindVideoMPEG:"MPEG movie",kindVideoMPEG4:"MPEG-4 movie",kindVideoAVI:"AVI movie",kindVideoMOV:"Quick Time movie",kindVideoWM:"Windows Media movie",kindVideoFlash:"Flash movie",kindVideoMKV:"Matroska movie",kindVideoOGG:"Ogg movie"}}),e.fn.elfinderbutton=function(t){return this.each(function(){var n,i="class",a=t.fm,r=a.res(i,"disabled"),o=a.res(i,"active"),s=a.res(i,"hover"),l="elfinder-button-menu-item",d="elfinder-button-menu-item-selected",c=e('<span class="elfinder-button-text">'+t.title+"</span>"),u=e(this).addClass("ui-state-default elfinder-button").attr("title",t.title).append('<span class="elfinder-button-icon elfinder-button-icon-'+(t.className?t.className:t.name)+'"/>',c).hover(function(e){!u.hasClass(r)&&u["mouseleave"==e.type?"removeClass":"addClass"](s)}).click(function(e){u.hasClass(r)||(n&&t.variants.length>1?(n.is(":hidden")&&t.fm.getUI().click(),e.stopPropagation(),n.slideToggle(100)):t.exec(void 0,{_currentType:"toolbar",_currentNode:u}))}),h=function(){n.hide()};c.hide(),t.button=u,Array.isArray(t.variants)&&(u.addClass("elfinder-menubutton"),n=e('<div class="ui-front ui-widget ui-widget-content elfinder-button-menu ui-corner-all"/>').hide().appendTo(u).on("mouseenter mouseleave","."+l,function(){e(this).toggleClass(s)}).on("click","."+l,function(i){i.preventDefault(),i.stopPropagation(),u.removeClass(s),n.hide(),t.exec(t.fm.selected(),e(this).data("value"))}),t.fm.bind("disable select",h).getUI().click(h),t.change(function(){n.html(""),e.each(t.variants,function(i,a){n.append(e('<div class="'+l+'">'+a[1]+"</div>").data("value",a[0]).addClass(a[0]==t.value?d:""))})})),t.change(function(){t.disabled()?u.removeClass(o+" "+s).addClass(r):(u.removeClass(r),u[t.active()?"addClass":"removeClass"](o)),t.syncTitleOnChange&&(c.html(t.title),u.attr("title",t.title))}).change()})},e.fn.elfindercontextmenu=function(t){return this.each(function(){var n,i,a,r,o,s,l,d="elfinder-contextmenu-item",c="elfinder-contextsubmenu-item",u="elfinder-contextmenu-extra-icon",h={distance:8,start:function(){p.data("touching")&&p.find(".ui-state-hover").removeClass("ui-state-hover")},stop:function(){p.data("draged",!0)}},p=e(this).addClass("touch-punch ui-helper-reset ui-front ui-widget ui-state-default ui-corner-all elfinder-contextmenu elfinder-contextmenu-"+t.direction).hide().on("touchstart",function(e){p.data("touching",!0)}).on("touchend",function(e){p.removeData("touching")}).on("mouseenter mouseleave","."+d,function(t){e(this).toggleClass("ui-state-hover",!("mouseenter"!==t.type&&(p.data("draged")||!p.data("submenuKeep")))),p.data("draged")&&p.data("submenuKeep")&&p.find(".elfinder-contextmenu-sub:visible").parent().addClass("ui-state-hover")}).on("mouseenter mouseleave","."+u,function(t){e(this).parent().toggleClass("ui-state-hover","mouseleave"===t.type)}).on("mouseenter mouseleave","."+d+",."+c,function(t){var n=function(t,n){e.each(n?o:a,function(e,i){return t[0]===i?((n?o:a)._cur=e,n?s=t:r=t,!1):void 0})};if(t.originalEvent){var i=e(this),l=function(){r&&!r.children("div.elfinder-contextmenu-sub:visible").length&&r.removeClass("ui-state-hover")};"mouseenter"===t.type?i.hasClass(c)?(s&&s.removeClass("ui-state-hover"),o=r.find("div."+c),n(i,!0)):(l(),n(i)):i.hasClass(c)?(s=null,o=null):(l(),function(e){setTimeout(function(){e===r&&(r=null)},250)}(r))}}).on("contextmenu",function(){return!1}).on("mouseup",function(){setTimeout(function(){p.removeData("draged")},100)}).draggable(h),f="ltr"==t.direction?"left":"right",m=Object.assign({},t.options.contextmenu),g='<div class="'+d+'{className}"><span class="elfinder-button-icon {icon} elfinder-contextmenu-icon"{style}/><span>{label}</span></div>',v=function(n,i,a,r){var o="",s="",l="";return r&&(r.className&&(o=" "+r.className),r.iconClass&&(l=r.iconClass,i=""),r.iconImg&&(s=" style=\"background:url('"+t.escape(r.iconImg)+"') 0 0 no-repeat;background-size:contain;\"")),e(g.replace("{icon}",i?"elfinder-button-icon-"+i:l?l:"").replace("{label}",n).replace("{style}",s).replace("{className}",o)).click(function(e){e.stopPropagation(),e.preventDefault(),a()})},b=function(e){return{backgroundImage:'url("'+e+'")',backgroundRepeat:"no-repeat",backgroundSize:"contain"}},y=function(){var n="touchstart.contextmenuAutoToggle";p.data("hideTm")&&clearTimeout(p.data("hideTm")),p.is(":visible")&&p.on("touchstart",function(e){e.originalEvent.touches.length>1||(p.stop().show(),p.data("hideTm")&&clearTimeout(p.data("hideTm")))}).data("hideTm",setTimeout(function(){i.find(".elfinder-cwd-file").off(n),i.find(".elfinder-cwd-file.ui-selected").one(n,function(t){if(!(t.originalEvent.touches.length>1)){var a=e(t.target);return!p.first().length||a.is("input:checkbox")||a.hasClass("elfinder-cwd-select")?void i.find(".elfinder-cwd-file").off(n):(k(t.originalEvent.touches[0].pageX,t.originalEvent.touches[0].pageY),!1)}}).one("unselect."+t.namespace,function(){i.find(".elfinder-cwd-file").off(n)}),p.fadeOut({duration:300,fail:function(){p.css("opacity","1").show()}})},4500))},w=function(n){var i=n.keyCode,l=e.ui.keyCode.ESCAPE,d=e.ui.keyCode.ENTER,u=e.ui.keyCode.LEFT,h=e.ui.keyCode.RIGHT,p=e.ui.keyCode.UP,f=e.ui.keyCode.DOWN,m="ltr"===t.direction?h:u,g=m===h?u:h;-1!==e.inArray(i,[l,d,u,h,p,f])&&(n.preventDefault(),n.stopPropagation(),n.stopImmediatePropagation(),i==l||i===g?r&&o&&s?(s.trigger("mouseleave"),r.addClass("ui-state-hover"),o=null,s=null):i==l&&x():i==p||i==f?o?(s&&s.trigger("mouseleave"),i==f&&(!s||o.length<=++o._cur)?o._cur=0:i==p&&(!s||--o._cur<0)&&(o._cur=o.length-1),s=o.eq(o._cur).trigger("mouseenter")):(o=null,r&&r.trigger("mouseleave"),i==f&&(!r||a.length<=++a._cur)?a._cur=0:i==p&&(!r||--a._cur<0)&&(a._cur=a.length-1),r=a.eq(a._cur).addClass("ui-state-hover")):!r||i!=d&&i!==m||(r.hasClass("elfinder-contextmenu-group")?s?i==d&&s.click():(r.trigger("mouseenter"),o=r.find("div."+c),o._cur=0,s=o.first().addClass("ui-state-hover")):i==d&&r.click()))},k=function(i,a,d){var c,u=p.outerWidth(),h=p.outerHeight(),m=n.attr("style"),g=n.offset(),v=n.width(),b=n.height(),k=t.UA.Mobile?40:2,C=t.UA.Mobile?20:2,i=i-(g?g.left:0),a=a-(g?g.top:0),d=Object.assign(d||{},{top:Math.max(0,b>a+C+h?a+C:a-(a+h-b)),left:Math.max(0,u+k>i||v>i+k+u?i+k:i-k-u),opacity:"1"});l=!0,t.autoSync("stop"),t.toFront(p),n.width(v),p.stop().removeAttr("style").css(d).show(),n.attr("style",m),d[f]=parseInt(p.width()),p.find(".elfinder-contextmenu-sub").css(d),t.UA.iOS&&e("div.elfinder div.overflow-scrolling-touch").css("-webkit-overflow-scrolling","auto"),r=null,o=null,s=null,e(document).on("keydown."+t.namespace,w),c=e._data(document).events,c&&c.keydown&&c.keydown.unshift(c.keydown.pop()),t.UA.Mobile&&y(),setTimeout(function(){t.getUI().one("click."+t.namespace,x)},0)},x=function(){if(t.getUI().off("click."+t.namespace,x),e(document).off("keydown."+t.namespace,w),A=null,p.is(":visible")||p.children().length){p.removeAttr("style").hide().empty().removeData("submenuKeep");try{p.draggable("instance")||p.draggable(h)}catch(n){p.hasClass("ui-draggable")||p.draggable(h)}p.data("prevNode")&&(p.data("prevNode").after(p),p.removeData("prevNode")),t.trigger("closecontextmenu"),t.UA.iOS&&e("div.elfinder div.overflow-scrolling-touch").css("-webkit-overflow-scrolling","touch")}l&&t.searchStatus.state<1&&!t.searchStatus.ininc&&t.autoSync(),l=!1},C=function(i,r){var o,s=!1,l=!1,u=[],h="cwd"===i,g=0;A=i,(o=t.option("uiCmdMap",h?void 0:r[0]))||(o={}),h||(u=t.getDisabledCmds(r)),"navbar"===i&&t.select({selected:r,origin:"navbar"}),g=t.selected().length,g>1&&p.append('<div class="ui-corner-top ui-widget-header elfinder-contextmenu-header"><span>'+t.i18n("selectedItems",""+g)+"</span></div>"),a=e(),e.each(m[i]||[],function(m,g){var y,w,k,C,T,A;if("|"===g)return void(s&&(l=!0));if(o[g]?(w=o[g],k=!0):w=g,y=t.getCommand(w),!y||h||t.searchStatus.state&&y.disableOnSearch||(y.__disabled=y._disabled,y._disabled=!(y.alwaysEnabled||(t._commands[w]?-1===e.inArray(g,u)&&(!k||-1===e.inArray(w,u)):!1)),e.each(y.linkedCmds,function(n,i){var a;(a=t.getCommand(i))&&(a.__disabled=a._disabled,a._disabled=!(a.alwaysEnabled||(t._commands[i]?-1===e.inArray(i,u):!1)))})),y&&!y._disabled&&-1!=y.getstate(r)){if(y.variants){if(!y.variants.length)return;C=v(y.title,y.className?y.className:y.name,function(){}),T=e('<div class="ui-front ui-corner-all elfinder-contextmenu-sub"/>').hide().appendTo(C.append('<span class="elfinder-contextmenu-arrow"/>')),A=function(e){if(e){var i=n.attr("style");n.width(n.width()),T.css({left:"auto",right:"auto"});var a,r,o,s=C.offset(),l=s.left,d=s.top,c=C.outerWidth(),u=T.outerWidth(!0),h=T.outerHeight(!0),m=n.offset(),g=m.left+n.width(),v=m.top+n.height();o=l+c+u-g,a=l>u&&o>0?t.UA.Mobile?10-u:c-o:c,"right"===f&&u>l&&(a=t.UA.Mobile?30-c:c-(u-l)),o=d+5+h-v,r=o>0&&v>d?5-o:o>0?30-h:5,p.find(".elfinder-contextmenu-sub:visible").hide(),T.css({top:r}).css(f,a).show(),n.attr("style",i)}else T.hide()},C.addClass("elfinder-contextmenu-group").on("touchstart",".elfinder-contextmenu-sub",function(e){C.data("touching",!0)}).on("mouseleave",".elfinder-contextmenu-sub",function(e){p.data("draged")||p.removeData("submenuKeep")}).on("click","."+c,function(t){var n,a;t.stopPropagation(),p.data("draged")||(p.hide(),a=e(this),n=a.data("exec"),e.isPlainObject(n)&&(n._currentType=i,n._currentNode=a),x(),y.exec(r,n))}).on("touchend",function(e){p.data("submenuKeep",!0)}).on("mouseenter mouseleave",function(e){C.data("timer")&&(clearTimeout(C.data("timer")),C.removeData("timer")),"mouseleave"===e.type?p.data("submenuKeep")||C.data("timer",setTimeout(function(){C.removeData("timer"),A(!1)},250)):C.data("touching")||C.data("timer",setTimeout(function(){C.removeData("timer"),A(!0)},a.find("div.elfinder-contextmenu-sub:visible").length?250:0)),C.removeData("touching")}),e.each(y.variants,function(t,n){var i,a="|"===n?'<div class="elfinder-contextmenu-separator"/>':e('<div class="'+d+" "+c+'"><span>'+n[1]+"</span></div>").data("exec",n[0]);"undefined"!=typeof n[2]&&(i=e("<span/>").addClass("elfinder-button-icon elfinder-contextmenu-icon"),/\//.test(n[2])?i.css(b(n[2])):i.addClass("elfinder-button-icon-"+n[2]),a.prepend(i).addClass(c+"-icon")),T.append(a)})}else C=v(y.title,y.className?y.className:y.name,function(){p.data("draged")||(x(),y.exec(r,{_currentType:i,_currentNode:C}))}),y.extra&&y.extra.node?(e('<span class="elfinder-button-icon elfinder-button-icon-'+(y.extra.icon||"")+' elfinder-contextmenu-extra-icon"/>').append(y.extra.node).appendTo(C),e(y.extra.node).trigger("ready")):C.remove(".elfinder-contextmenu-extra-icon");y.extendsCmd&&C.children("span.elfinder-button-icon").addClass("elfinder-button-icon-"+y.extendsCmd),l&&p.append('<div class="elfinder-contextmenu-separator"/>'),p.append(C),s=!0,l=!1}y&&"undefined"!=typeof y.__disabled&&(y._disabled=y.__disabled,delete y.__disabled,e.each(y.linkedCmds,function(e,n){var i;(i=t.getCommand(n))&&(i._disabled=i.__disabled,delete i.__disabled)}))}),a=p.children("div."+d)},T=function(t){A="raw",e.each(t,function(e,t){var n;"|"===t?p.append('<div class="elfinder-contextmenu-separator"/>'):t.label&&"function"==typeof t.callback&&(n=v(t.label,t.icon,function(){p.data("draged")||(!t.remain&&x(),t.callback())},t.options||null),p.append(n))}),a=p.children("div."+d)},A=null;t.one("load",function(){n=t.getUI(),i=t.getUI("cwd"),t.bind("contextmenu",function(n){var a,r=n.data,o={};r.type&&"files"===r.type||i.trigger("unselectall"),x(),r.type&&r.targets?C(r.type,r.targets):r.raw&&T(r.raw),p.children().length&&(a=r.prevNode||null,a&&(p.data("prevNode",p.prev()),a.after(p)),r.fitHeight&&(o={maxHeight:Math.min(t.getUI().height(),e(window).height()),overflowY:"auto"},p.draggable("destroy").removeClass("ui-draggable")),k(r.x,r.y,o),r.opened&&"function"==typeof r.opened&&r.opened.call(p))}).one("destroy",function(){p.remove()}).bind("disable",x).bind("select",function(){"files"===A&&x()})}).shortcut({pattern:"mac"===t.OS?"ctrl+m":"contextmenu shift+f10",description:"contextmenu",callback:function(n){n.stopPropagation(),n.preventDefault(),e(document).one("contextmenu."+t.namespace,function(e){e.preventDefault(),e.stopPropagation()});var i,a,r,o,s=t.selected();s.length?(i="files",a=s,o=e("#"+t.cwdHash2Id(s[0]))):(i="cwd",a=[t.cwd().hash],r=t.getUI("workzone").offset()),o&&o.length||(o=t.getUI("workzone")),r=o.offset(),r.top+=o.height()/2,r.left+=o.width()/2,t.trigger("contextmenu",{type:i,targets:a,x:r.left,y:r.top})}})})},e.fn.elfindercwd=function(t,n){return this.not(".elfinder-cwd").each(function(){var i,a=t.UA.Mobile,r="list"==t.viewType,o="select."+t.namespace,s="unselect."+t.namespace,l="disable."+t.namespace,d="enable."+t.namespace,c="class",u=t.res(c,"cwdfile"),h="."+u,p="ui-selected",f=t.res(c,"disabled"),m=t.res(c,"draggable"),g=t.res(c,"droppable"),v=t.res(c,"hover"),b=t.res(c,"adroppable"),y=u+"-tmp",w=t.options.loadTmbs>0?t.options.loadTmbs:5,k="",x={},C=[],T=[],A=void 0,z=[],I="",O=function(){for(var e="",t=0;t<z.length;t++)e+='<td class="elfinder-col-'+z[t]+'">{'+z[t]+"}</td>";return e},S=function(){return'<tr id="{id}" class="'+u+' {permsclass} {dirclass}" title="{tooltip}"{css}><td class="elfinder-col-name"><div class="elfinder-cwd-file-wrapper"><span class="elfinder-cwd-icon {mime}"{style}/>{marker}<span class="elfinder-cwd-filename">{name}</span></div>'+U+"</td>"+O()+"</tr>"},U=e.map(n.showSelectCheckboxUA,function(e){return t.UA[e]||e.match(/^all$/i)?!0:null}).length?'<div class="elfinder-cwd-select"><input type="checkbox"></div>':"",M=!1,D=null,E={icon:'<div id="{id}" class="'+u+' {permsclass} {dirclass} ui-corner-all" title="{tooltip}"><div class="elfinder-cwd-file-wrapper ui-corner-all"><div class="elfinder-cwd-icon {mime} ui-corner-all" unselectable="on"{style}/>{marker}</div><div class="elfinder-cwd-filename" title="{nametitle}">{name}</div>'+U+"</div>",row:""},F=t.res("tpl","perms"),P=t.res("tpl","lock"),j=t.res("tpl","symlink"),R={id:function(e){return t.cwdHash2Id(e.hash)},name:function(e){var n=t.escape(e.i18||e.name);return!r&&(n=n.replace(/([_.])/g,"​$1")),n},nametitle:function(e){return t.escape(e.i18||e.name)},permsclass:function(e){return t.perms2class(e)},perm:function(e){return t.formatPermissions(e)},dirclass:function(e){var i="directory"==e.mime?"directory":"";return e.isroot&&(i+=" isroot"),e.csscls&&(i+=" "+t.escape(e.csscls)),n.getClass&&(i+=" "+n.getClass(e)),i},style:function(e){return e.icon?t.getIconStyle(e):""},mime:function(e){return t.mime2class(e.mime)},size:function(e){return"directory"!==e.mime||e.size?t.formatSize(e.size):"-"},date:function(e){return t.formatDate(e)},kind:function(e){return t.mime2kind(e)},mode:function(e){return e.perm?t.formatFileMode(e.perm):""},modestr:function(e){return e.perm?t.formatFileMode(e.perm,"string"):""},modeoct:function(e){return e.perm?t.formatFileMode(e.perm,"octal"):""},modeboth:function(e){return e.perm?t.formatFileMode(e.perm,"both"):""},marker:function(e){return(e.alias||"symlink-broken"==e.mime?j:"")+(e.read&&e.write?"":F)+(e.locked?P:"")},tooltip:function(e){var n=t.formatDate(e)+(e.size>0?" ("+t.formatSize(e.size)+")":""),i="";return i=k&&e.path?t.escape(e.path.replace(/\/[^\/]*$/,"")):e.tooltip?t.escape(e.tooltip).replace(/\r/g," "):"",r&&(i+=(i?" ":"")+t.escape(e.i18||e.name)),i?i+" "+n:n}},H=function(e){return E[r?"row":"icon"].replace(/\{([a-z0-9_]+)\}/g,function(n,i){return R[i]?R[i](e,t):e[i]?e[i]:""})},N=e(),q=!1,_=function(t,n){function i(e,t){return e[t+"All"]("[id]:not(."+f+"):not(.elfinder-cwd-parent):first")}var a,l,d,c,u,h=e.ui.keyCode,m=t==h.LEFT||t==h.UP,g=ke.find("[id]."+p);if(g.length)if(a=g.filter(m?":first":":last"),d=i(a,m?"prev":"next"),d.length)if(r||t==h.LEFT||t==h.RIGHT)l=d;else if(c=a.position().top,u=a.position().left,l=a,m){do l=l.prev("[id]");while(l.length&&!(l.position().top<c&&l.position().left<=u));l.hasClass(f)&&(l=i(l,"next"))}else{do l=l.next("[id]");while(l.length&&!(l.position().top>c&&l.position().left>=u));l.hasClass(f)&&(l=i(l,"prev")),l.length||(d=ke.find("[id]:not(."+f+"):last"),d.position().top>c&&(l=d))}else l=a;else l=N.length?m?N.prev():N:ke.find("[id]:not(."+f+"):not(.elfinder-cwd-parent):"+(m?"last":"first"));l&&l.length&&!l.hasClass("elfinder-cwd-parent")&&(a&&n?l=a.add(a[m?"prevUntil":"nextUntil"]("#"+l.attr("id"))).add(l):g.trigger(s),l.trigger(o),G(l.filter(m?":first":":last")),K())},L=[],W=function(n){e("#"+t.cwdHash2Id(n)).trigger(o)},$=function(){t.cwd().hash;U&&Te.find("input").prop("checked",!0),t.lazy(function(){var n;ke.find("[id]:not(."+p+"):not(.elfinder-cwd-parent)").trigger(o),t.maxTargets&&(A||T).length>t.maxTargets?(n=e.map(A||T,function(e){return t.file(e)||null}),n=t.sortFiles(n),L=e.map(n,function(e){return e.hash})):L=(A||T).concat(),K(),U&&Te.data("pending",!1)},0,{repaint:!0})},B=function(){U&&Te.find("input").prop("checked",!1),L.length?(q=!1,L=[],ke.find("[id]."+p).trigger(s),U&&ke.find("input:checkbox").prop("checked",!1)):t.select({selected:[]}),K(),U&&Te.data("pending",!1),ke.removeClass("elfinder-cwd-allselected")},V=void 0,K=function(){if(U){var e=L.length===T.length;Te.find("input").prop("checked",e),ke[e?"addClass":"removeClass"]("elfinder-cwd-allselected")}t.trigger("select",{selected:L})},G=function(e,n){if(e.length){var i=e.position().top,a=e.outerHeight(!0),o=xe.scrollTop(),s=xe.get(0).clientHeight,l=se?se.outerHeight(!0):0;i+l+a>o+s?xe.scrollTop(parseInt(i+l+a-s)):o>i&&xe.scrollTop(i),r&&xe.scrollLeft(0),!!n&&t.resources.blink(e,"lookme")}},J=[],Y={},X=function(e){for(var t=J.length;t--;)if(J[t].hash==e)return t;return-1},Z="elfscrstart",Q="elfscrstop",ee=!1,te={disabled:!0,filter:"[id]:first",stop:K,delay:250,appendTo:"body",autoRefresh:!1,selected:function(t,n){e(n.selected).trigger(o)},unselected:function(t,n){e(n.unselected).trigger(s)}},ne={},ie=function(n){var i,a=ke.data("selectable"),o=function(){var n=xe.offset(),i=e(window),a=n.left-i.scrollLeft()+("ltr"===t.direction?30:xe.width()-30),o=n.top-i.scrollTop()+10+(r?Y.itemH||24:0);return{left:Math.max(0,Math.round(a)),top:Math.max(0,Math.round(o))}}(),s=e(document.elementFromPoint(o.left,o.top)),l=[],d={},c=Y.hpi?Math.ceil(Oe.data("rectangle").height/Y.hpi*1.5):re,p=function(){var e,n=s.attr("id");n&&(Y.getTmbs=[],e=t.cwdId2Hash(n),ne[e]=n,Y.attachTmbs[e]&&(d[e]=Y.attachTmbs[e]),a&&l.push(n)),s=s.next()},f=function(){var n;ke.data("selectable")&&(L.length&&(l=l.concat(e.map(L,function(i){return n=t.cwdHash2Id(i),-1===e.inArray(n,l)?n:null}))),l.length&&(te.filter="#"+l.join(", #"),ke.selectable("enable").selectable("option",{filter:te.filter}).selectable("refresh"))),Object.keys(d).length&&(Y.getTmbs=[],he(d))};if(ne={},a&&ke.selectable("option","disabled"),s.length&&(s.hasClass(u)||(s=s.closest(h)),s.attr("id")))if(n){for(var m=0;c>m&&(p(),s.length);m++);f()}else Y.repaintJob&&Y.repaintJob._abort(),i=new Array(c),Y.repaintJob=t.asyncJob(function(){p(),s.length||Y.repaintJob&&Y.repaintJob._abort(!0)},i).done(f)},ae=function(n){var n=t.cwd().phash,i=t.file(n)||null,a=function(n){n&&(Ie=e(H(e.extend(!0,{},n,{name:"..",mime:"directory"}))).addClass("elfinder-cwd-parent").on("mousedown click mouseup touchstart touchmove touchend dblclick mouseenter",function(e){e.preventDefault(),e.stopPropagation()}).on("dblclick",function(){t.exec("open",t.cwdId2Hash(this.id))}),(r?ke.find("tbody"):ke).prepend(Ie))};i?a(i):t.getUI("tree").hasClass("elfinder-tree")?t.one("parents",function(){a(t.file(n)||null)}):t.request({data:{cmd:"parents",target:t.cwd().hash},preventFail:!0}).done(function(e){a(t.file(n)||null)})},re=t.options.showFiles,oe=function(){if(!Y.rendering){var i,s,l=r?ke.children("table").children("tbody"):ke,d=!!e.htmlPrefilter,c=e(d?document.createDocumentFragment():"<div/>"),u=function(n){var i,s,u,h,n=n||null,f=[],m=!1,g={},v="self"===t.option("tmbUrl"),h=!Y.renderd;i=J.splice(0,re+(n||0)/(Y.hpi||1)),Y.renderd+=i.length,J.length||(Ce.hide(),xe.off(Q,oe)),s=[],f=e.map(i,function(e){return e.hash&&e.name?("directory"==e.mime&&(m=!0),(e.tmb||v&&0===e.mime.indexOf("image/"))&&(g[e.hash]=e.tmb),x[e.hash]&&s.push(e.hash),H(e)):null}),c.empty().append(f.join("")),m&&!a&&ue(c),u=[],L.length&&c.find("[id]:not(."+p+"):not(.elfinder-cwd-parent)").each(function(){-1!==e.inArray(t.cwdId2Hash(this.id),L)&&u.push(e(this))}),l.append(d?c:c.children()),u.length&&(e.each(u,function(e,t){t.trigger(o)}),K()),s.length&&t.trigger("lockfiles",{files:s}),!Y.hpi&&be(l,i.length),r&&(ke.find("thead").show(),le({fitWidth:!D})),Object.keys(g).length&&Object.assign(Y.attachTmbs,g),h&&(a||ke.data("selectable")||ke.selectable(te).data("selectable",!0),ie(!0)),!ee&&xe.trigger(Q)};Y.renderd?Y.rendering||(i=xe.height()+xe.scrollTop()+t.options.showThreshold+Y.row-Y.renderd*Y.hpi)>0&&(Y.rendering=!0,t.lazy(function(){u(i),Y.rendering=!1})):(Y.rendering=!0,xe.scrollTop(0),s=t.cwd().phash,u(),n.oldSchool&&s&&!k&&ae(s),r&&(D&&de(),le({fitWidth:!0})),Y.itemH=(r?l.find("tr:first"):l.find("[id]:first")).outerHeight(!0),t.trigger("cwdrender"),Y.rendering=!1)}},se=null,le=function(i){if(n.listView.fixedHeader){var a,r,o,s,l,d,c,u,h,p,f,m,g,v=function(){var e,n;"ltr"===t.direction?(e=-1*xe.scrollLeft(),n="left"):(e=xe.scrollLeft(),n="right"),r.css(n)!==e&&r.css(n,e)},i=i||{};if(l=ke.find("tbody"),u=l.children("tr:first"),u.length){if(o=l.parent(),se?(s=e("#"+t.namespace+"-cwd-thead"),c=s.children("tr:first")):(g=!0,l.addClass("elfinder-cwd-fixheader"),s=ke.find("thead").attr("id",t.namespace+"-cwd-thead"),c=s.children("tr:first"),d=c.outerHeight(!0),ke.css("margin-top",d-parseInt(o.css("padding-top"))),r=e("<div/>").addClass(ke.attr("class")).append(e("<table/>").append(s)),se=e("<div/>").addClass(xe.attr("class")+" elfinder-cwd-fixheader").removeClass("ui-droppable native-droppable").css(xe.position()).css("height",d).append(r),"rtl"===t.direction&&se.css("right",t.getUI().width()-xe.width()+"px"),v(),xe.after(se).on("scroll.fixheader resize.fixheader",function(e){v(),"resize"===e.type&&(e.stopPropagation(),le())})),g||i.fitWidth||Math.abs(u.outerWidth()-c.outerWidth())>2){a=z.length+1;for(var b=0;a>b&&(h=c.children("td:eq("+b+")"),p=u.children("td:eq("+b+")"),f=h.width(),m=p.width(),"undefined"==typeof h.data("delta")&&h.data("delta",h.outerWidth()-f-(p.outerWidth()-m)),m-=h.data("delta"),g||i.fitWidth||f!==m);b++)h.css("width",m+"px")}se.data("widthTimer")&&clearTimeout(se.data("widthTimer")),se.data("widthTimer",setTimeout(function(){se&&("rtl"===t.direction&&se.css("right",t.getUI().width()-xe.width()+"px"),se.css(xe.position()).css("width",ke.outerWidth()+"px"))},10))}}},de=function(){if(r&&D){var t,n="elfinder-cwd-colwidth",i=ke.find("tr[id]:first");i.hasClass(n)||(t=ke.find("tr."+n),t.removeClass(n).find("td").css("width",""),i.addClass(n),ke.find("table:first").css("table-layout","fixed"),e.each(e.merge(["name"],z),function(e,t){var n=D[t]||i.find("td.elfinder-col-"+t).width();i.find("td.elfinder-col-"+t).width(n)}))}},ce=Object.assign({},t.droppable,{over:function(n,i){var a,r,o,s=e(this),l=i.helper,d=n.shiftKey||n.ctrlKey||n.metaKey;return n.stopPropagation(),l.data("dropover",l.data("dropover")+1),s.data("dropover",!0),l.data("namespace")===t.namespace&&t.insideWorkzone(n.pageX,n.pageY)?(s.hasClass(t.res(c,"cwdfile"))?(a=t.cwdId2Hash(s.attr("id")),s.data("dropover",a)):(a=t.cwd().hash,t.cwd().write&&s.data("dropover",a)),o=t.file(l.data("files")[0]).phash===a,s.data("dropover")===a?e.each(l.data("files"),function(e,t){return t===a||o&&!d&&!l.hasClass("elfinder-drag-helper-plus")?(s.removeClass(b),!1):void 0}):s.removeClass(b),l.data("locked")||o?r="elfinder-drag-helper-plus":(r="elfinder-drag-helper-move",d&&(r+=" elfinder-drag-helper-plus")),s.hasClass(b)&&l.addClass(r),void setTimeout(function(){s.hasClass(b)&&l.addClass(r)},20)):(s.removeClass(b),void l.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus"))},out:function(t,n){var i=n.helper;t.stopPropagation(),i.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus").data("dropover",Math.max(i.data("dropover")-1,0)),e(this).removeData("dropover").removeClass(b)},deactivate:function(){e(this).removeData("dropover").removeClass(b)},drop:function(e,n){B(),t.droppable.drop.call(this,e,n)}}),ue=function(n){n=n?n:r?ke.find("tbody"):ke;var i=n.children(".directory:not(."+g+",.elfinder-na,.elfinder-ro)");t.isCommandEnabled("paste")&&i.droppable(ce),t.isCommandEnabled("upload")&&i.addClass("native-droppable"),n.children(".isroot").each(function(n,i){var a=e(i),r=t.cwdId2Hash(i.id);t.isCommandEnabled("paste",r)?a.hasClass(g+",elfinder-na,elfinder-ro")||a.droppable(ce):a.hasClass(g)&&a.droppable("destroy"),t.isCommandEnabled("upload",r)?a.hasClass("native-droppable,elfinder-na,elfinder-ro")||a.addClass("native-droppable"):a.hasClass("native-droppable")&&a.removeClass("native-droppable")})},he=function(n,i){var a=function(t,n){e("<img/>").on("load",function(){t.find(".elfinder-cwd-icon").addClass(n.className).css("background-image","url('"+n.url+"')")}).attr("src",n.url)},r=function(n,r){var o,s,l=e("#"+t.cwdHash2Id(n));l.length&&("1"!=r?(o=t.file(n),o.tmb!==r&&(o.tmb=r),s=t.tmb(o),i?t.reloadContents(s.url).done(function(){l.find(".elfinder-cwd-icon").addClass(s.className).css("background-image","url('"+s.url+"')")}):a(l,s),delete Y.attachTmbs[n]):i?pe([n]):Y.getTmbs.push(n))};e.isPlainObject(n)&&Object.keys(n).length&&(Object.assign(Y.attachTmbs,n),e.each(n,r),!i&&Y.getTmbs.length&&pe())},pe=function(e){var n=[],i=!1;return t.oldAPI?void t.request({data:{cmd:"tmb",current:t.cwd().hash},preventFail:!0}).done(function(e){e.images&&Object.keys(e.images).length&&he(e.images),e.tmb&&pe()}):(e?(i=!0,n=e.splice(0,w)):n=Y.getTmbs.splice(0,w),void(n.length&&(i||ne[n[0]]||ne[n[n.length-1]])&&t.request({data:{cmd:"tmb",targets:n},preventFail:!0}).done(function(t){t.images&&Object.keys(t.images).length&&he(t.images,i),i&&e.length&&pe(e)}).always(function(){!i&&Y.getTmbs.length&&pe()})))},fe=function(n,i){var o,s,l,d,c,u=r?ke.find("tbody"):ke,h=n.length,p={},f=function(e){for(var n,i=ke.find("[id]:first");i.length;){
|
||
if(n=t.file(t.cwdId2Hash(i.attr("id"))),!i.hasClass("elfinder-cwd-parent")&&n&&t.compare(e,n)<0)return i;i=i.next("[id]")}},m=function(e){var n,i=J.length;for(n=0;i>n;n++)if(t.compare(e,J[n])<0)return n;return i||-1},g=!!e.htmlPrefilter,v=e(g?document.createDocumentFragment():"<div/>");if(h>re)we(),L=n.concat(),K();else{for(h&&Oe.removeClass("elfinder-cwd-wrapper-empty");h--;)o=n[h],s=o.hash,e("#"+t.cwdHash2Id(s)).length||((l=f(o))&&!l.length&&(l=null),!l&&(c=m(o))>=0?J.splice(c,0,o):(v.empty().append(H(o)),"directory"===o.mime&&!a&&ue(v),d=g?v:v.children(),l?l.before(d):u.append(d)),e("#"+t.cwdHash2Id(s)).length&&o.tmb&&(p[s]=o.tmb));de(),be(u),Object.keys(p).length&&Object.assign(Y.attachTmbs,p)}},me=function(n){var i,a,r,o,s=n.length,l=t.searchStatus.state>1,d=t.getCommand(t.currentReqCmd)||{};if(!t.cwd().hash&&!d.noChangeDirOnRemovedCwd)return o=t.files(),void e.each(C.reverse(),function(e,n){return o[n]?(t.one(t.currentReqCmd+"done",function(){!t.cwd().hash&&t.exec("open",n)}),!1):void 0});for(;s--;){if(i=n[s],(a=e("#"+t.cwdHash2Id(i))).length)try{a.remove(),--Y.renderd}catch(c){t.debug("error",c)}else-1!==(r=X(i))&&J.splice(r,1);l&&-1!==(r=e.inArray(i,T))&&T.splice(r,1)}l&&t.trigger("cwdhasheschange",T),de()},ge={name:t.i18n("name"),perm:t.i18n("perms"),date:t.i18n("modify"),size:t.i18n("size"),kind:t.i18n("kind"),modestr:t.i18n("mode"),modeoct:t.i18n("mode"),modeboth:t.i18n("mode")},ve=function(){for(var e="",i="",a=Object.assign({},ge,n.listView.columnsCustomName),r=0;r<z.length;r++)e="undefined"!=typeof a[z[r]]?a[z[r]]:t.i18n(z[r]),i+='<td class="elfinder-cwd-view-th-'+z[r]+' sortable-item">'+e+"</td>";return i},be=function(e,t){var n,i=1;e=e||(r?ke.find("tbody"):ke),J.length>0&&(e.css({height:"auto"}),n=e.height(),t&&(r||(i=Math.floor(e.width()/e.find("[id]:first").width()),t=Math.ceil(t/i)*i),Y.hpi=n/t,Y.row=Y.hpi*i),Ce.css({top:Y.hpi*J.length+n+"px"}).show())},ye={contextmenu:function(e){e.preventDefault(),t.trigger("contextmenu",{type:"cwd",targets:[t.cwd().hash],x:e.pageX,y:e.pageY})},touchstart:function(e){e.originalEvent.touches.length>1||(ke.data("longtap",null),xe.data("touching",{x:e.originalEvent.touches[0].pageX,y:e.originalEvent.touches[0].pageY}),e.target!==this&&e.target!==ke.get(0)||ke.data("tmlongtap",setTimeout(function(){ke.data("longtap",!0),t.trigger("contextmenu",{type:"cwd",targets:[t.cwd().hash],x:xe.data("touching").x,y:xe.data("touching").y})},500)))},touchend:function(e){"touchmove"===e.type&&(!xe.data("touching")||Math.abs(xe.data("touching").x-e.originalEvent.touches[0].pageX)+Math.abs(xe.data("touching").y-e.originalEvent.touches[0].pageY)>4)&&xe.data("touching",null),clearTimeout(ke.data("tmlongtap"))},click:function(e){ke.data("longtap")&&(e.preventDefault(),e.stopPropagation())}},we=function(){var n;Oe.append(Te).removeClass("elfinder-cwd-wrapper-empty elfinder-search-result elfinder-incsearch-result elfinder-letsearch-result"),(t.searchStatus.state>1||t.searchStatus.ininc)&&Oe.addClass("elfinder-search-result"+(t.searchStatus.ininc?" elfinder-"+("/"===k.substr(0,1)?"let":"inc")+"search-result":"")),Y.attachThumbJob&&Y.attachThumbJob._abort(),ke.data("selectable")&&ke.selectable("disable").selectable("destroy").removeData("selectable"),t.trigger("cwdinit"),N=e();try{ke.empty()}catch(i){ke.html("")}se&&(xe.off("scroll.fixheader resize.fixheader"),se.remove(),se=null),ke.removeClass("elfinder-cwd-view-icons elfinder-cwd-view-list").addClass("elfinder-cwd-view-"+(r?"list":"icons")).attr("style","").css("height","auto"),Ce.hide(),xe[r?"addClass":"removeClass"]("elfinder-cwd-wrapper-list")._padding=parseInt(xe.css("padding-top"))+parseInt(xe.css("padding-bottom")),t.UA.iOS&&xe.removeClass("overflow-scrolling-touch").addClass("overflow-scrolling-touch"),r&&(ke.html("<table><thead/><tbody/></table>"),n=e('<tr class="ui-state-default"><td class="elfinder-cwd-view-th-name">'+ge.name+"</td>"+ve()+"</tr>"),ke.find("thead").hide().append(n.on("contextmenu."+t.namespace,ye.contextmenu).on("touchstart."+t.namespace,"td",ye.touchstart).on("touchmove."+t.namespace+" touchend."+t.namespace+" mouseup."+t.namespace,"td",ye.touchend).on("click."+t.namespace,"td",ye.click)).find("td:first").append(Te),e.fn.sortable&&n.addClass("touch-punch touch-punch-keep-default").sortable({axis:"x",distance:8,items:"> .sortable-item",start:function(t,n){e(n.item[0]).data("dragging",!0),n.placeholder.width(n.helper.removeClass("ui-state-hover").width()).removeClass("ui-state-active").addClass("ui-state-hover").css("visibility","visible")},update:function(n,i){var a,r,o=e(i.item[0]).attr("class").split(" ")[0].replace("elfinder-cwd-view-th-","");z=e.map(e(this).children(),function(t){var n=e(t).attr("class").split(" ")[0].replace("elfinder-cwd-view-th-","");return r||(o===n?r=!0:a=n),"name"===n?null:n}),E.row=S(),t.storage("cwdCols",z),a=".elfinder-col-"+a+":first",o=".elfinder-col-"+o+":first",t.lazy(function(){ke.find("tbody tr").each(function(){var t=e(this);t.children(a).after(t.children(o))})})},stop:function(t,n){setTimeout(function(){e(n.item[0]).removeData("dragging")},100)}}),e.fn.resizable&&n.find("td").addClass("touch-punch").resizable({handles:"ltr"===t.direction?"e":"w",start:function(t,n){var i=ke.find("td.elfinder-col-"+n.element.attr("class").split(" ")[0].replace("elfinder-cwd-view-th-","")+":first");n.element.data("resizeTarget",i).data("targetWidth",i.width()),M=!0,"fixed"!==ke.find("table").css("table-layout")&&(ke.find("tbody tr:first td").each(function(){e(this).width(e(this).width())}),ke.find("table").css("table-layout","fixed"))},resize:function(e,t){t.element.data("resizeTarget").width(t.element.data("targetWidth")-(t.originalSize.width-t.size.width))},stop:function(){M=!1,le({fitWidth:!0}),D={},ke.find("tbody tr:first td").each(function(){var t=e(this).attr("class").split(" ")[0].replace("elfinder-col-","");D[t]=e(this).width()}),t.storage("cwdColWidth",D)}}).find(".ui-resizable-handle").addClass("ui-icon ui-icon-grip-dotted-vertical")),t.lazy(function(){J=e.map(A||T,function(e){return t.file(e)||null}),J=t.sortFiles(J),Y={renderd:0,attachTmbs:{},getTmbs:[],lazyOpts:{tm:0}},Oe[J.length<1?"addClass":"removeClass"]("elfinder-cwd-wrapper-empty"),xe.off(Q,oe).on(Q,oe).trigger(Q),t.cwd().write?(xe[t.isCommandEnabled("upload")?"addClass":"removeClass"]("native-droppable"),xe.droppable(t.isCommandEnabled("paste")?"enable":"disable")):xe.removeClass("native-droppable").droppable("disable").removeClass("ui-state-disabled")})},ke=e(this).addClass("ui-helper-clearfix elfinder-cwd").attr("unselectable","on").on("click."+t.namespace,h,function(n){var i,a,r,l,d,c=this.id?e(this):e(this).parents("[id]:first"),u=e(n.target);if(U&&(u.is("input:checkbox")||u.hasClass("elfinder-cwd-select")))return n.stopPropagation(),n.preventDefault(),xe.data("touching")||(c.trigger(c.hasClass(p)?s:o),K()),setTimeout(function(){u.prop("checked",c.hasClass(p))},10),!1;if(ke.data("longtap"))return void n.stopPropagation();if(I||(I=c.attr("id"),setTimeout(function(){I=""},500)),n.shiftKey&&(i=c.prevAll(V||"."+p+":first"),a=c.nextAll(V||"."+p+":first"),r=i.length,l=a.length),n.shiftKey&&(r||l))d=r?c.prevUntil("#"+i.attr("id")):c.nextUntil("#"+a.attr("id")),d.add(c).trigger(o);else if(n.ctrlKey||n.metaKey)c.trigger(c.hasClass(p)?s:o);else{if(xe.data("touching")&&c.hasClass(p))return xe.data("touching",null),void t.dblclick({file:t.cwdId2Hash(this.id)});B(),c.trigger(o)}K()}).on("dblclick."+t.namespace,h,function(n){if(I){var i=t.cwdId2Hash(I);n.stopPropagation(),this.id!==I&&(e(this).trigger(s),e("#"+I).trigger(o),K()),t.dblclick({file:i})}}).on("touchstart."+t.namespace,h,function(n){if(!(n.originalEvent.touches.length>1)){var i,a=this.id?e(this):e(this).parents("[id]:first"),r=e(n.target);return xe.data("touching",{x:n.originalEvent.touches[0].pageX,y:n.originalEvent.touches[0].pageY}),U&&(r.is("input:checkbox")||r.hasClass("elfinder-cwd-select"))?void setTimeout(function(){xe.data("touching")&&(a.trigger(a.hasClass(p)?s:o),K())},150):void("INPUT"!=n.target.nodeName&&"TEXTAREA"!=n.target.nodeName&&(i=a.prevAll("."+p+":first").length+a.nextAll("."+p+":first").length,ke.data("longtap",null),a.addClass(v).data("tmlongtap",setTimeout(function(){ke.data("longtap",!0),("TD"!=n.target.nodeName||t.selected().length>0)&&(a.trigger(o),K(),t.trigger("contextmenu",{type:"files",targets:t.selected(),x:n.originalEvent.touches[0].pageX,y:n.originalEvent.touches[0].pageY}))},500))))}}).on("touchmove."+t.namespace+" touchend."+t.namespace,h,function(n){if("INPUT"!=n.target.nodeName&&"TEXTAREA"!=n.target.nodeName&&!e(n.target).hasClass("elfinder-cwd-select")){var i=this.id?e(this):e(this).parents("[id]:first");clearTimeout(i.data("tmlongtap")),"touchmove"===n.type?(xe.data("touching",null),i.removeClass(v)):xe.data("touching")&&!ke.data("longtap")&&i.hasClass(p)&&(n.preventDefault(),xe.data("touching",null),t.dblclick({file:t.cwdId2Hash(this.id)}))}}).on("mouseenter."+t.namespace,h,function(n){if(!ee){var i=e(this),s=null,l=r?i:i.children("div.elfinder-cwd-file-wrapper,div.elfinder-cwd-filename");if(!(a||i.data("dragRegisted")||i.hasClass(y)||l.hasClass(m)||l.hasClass(f))){if(i.data("dragRegisted",!0),!t.isCommandEnabled("copy",t.searchStatus.state>1?t.cwdId2Hash(i.attr("id")):void 0))return;l.on("mousedown",function(n){var i=n.shiftKey||n.altKey;i&&!t.UA.IE&&ke.data("selectable")&&(ke.selectable("disable").selectable("destroy").removeData("selectable"),setTimeout(function(){ke.selectable(te).selectable("option",{disabled:!1}).selectable("refresh").data("selectable",!0)},10)),l.draggable("option","disabled",i).removeClass("ui-state-disabled"),i?l.attr("draggable","true"):l.removeAttr("draggable").draggable("option","cursorAt",{left:50-parseInt(e(n.currentTarget).css("margin-left")),top:47})}).on("dragstart",function(n){var i=n.dataTransfer||n.originalEvent.dataTransfer||null;if(s=null,i&&!t.UA.IE){var a,r=this.id?e(this):e(this).parents("[id]:first"),l=e("<span>"),d="",c=null,u=null,h=[],p=function(n){var i,a=n.mime,r=t.tmb(n);return i='<div class="elfinder-cwd-icon '+t.mime2class(a)+' ui-corner-all"/>',r&&(i=e(i).addClass(r.className).css("background-image","url('"+r.url+"')").get(0).outerHTML),i},f=[];if(r.trigger(o),K(),e.each(L,function(n,i){var a=t.file(i),r=a.url;if(a&&"directory"!==a.mime){if(r){if("1"==r)return f.push(i),!0}else r=t.url(a.hash);r&&(r=t.convAbsUrl(r),h.push(i),e("<a>").attr("href",r).text(r).appendTo(l),d+=r+"\n",c||(c=a.mime+":"+a.name+":"+r),u||(u=r+"\n"+a.name))}}),f.length)return e.each(f,function(e,n){var i=t.file(n);i.url="",t.request({data:{cmd:"url",target:n},notify:{type:"url",cnt:1},preventDefault:!0}).always(function(e){i.url=e.url?e.url:"1"})}),!1;if(!d)return!1;i.setDragImage&&(s=e('<div class="elfinder-drag-helper html5-native"></div>').append(p(t.file(h[0]))).appendTo(e(document.body)),(a=h.length)>1&&s.append(p(t.file(h[a-1]))+'<span class="elfinder-drag-num">'+a+"</span>"),i.setDragImage(s.get(0),50,47)),i.effectAllowed="copyLink",i.setData("DownloadURL",c),i.setData("text/x-moz-url",u),i.setData("text/uri-list",d),i.setData("text/plain",d),i.setData("text/html",l.html()),i.setData("elfinderfrom",window.location.href+t.cwd().hash),i.setData("elfinderfrom:"+i.getData("elfinderfrom"),"")}}).on("dragend",function(e){B(),s&&s.remove()}).draggable(t.draggable)}}}).on(o,h,function(n){var i=e(this),a=t.cwdId2Hash(i.attr("id"));q||i.hasClass(f)||(V="#"+this.id,i.addClass(p).children().addClass(v).find("input:checkbox").prop("checked",!0),-1===e.inArray(a,L)&&L.push(a),N=ke.find("[id]."+p+":last").next())}).on(s,h,function(n){var i,a=e(this),r=t.cwdId2Hash(a.attr("id"));q||(a.removeClass(p).children().removeClass(v).find("input:checkbox").prop("checked",!1),ke.hasClass("elfinder-cwd-allselected")&&(U&&Te.children("input").prop("checked",!1),ke.removeClass("elfinder-cwd-allselected")),i=e.inArray(r,L),-1!==i&&(V=void 0,L.splice(i,1)))}).on(l,h,function(){var t=e(this).removeClass(v+" "+p).addClass(f),n=t.children(),i=r?t:n.find("div.elfinder-cwd-file-wrapper,div.elfinder-cwd-filename");n.removeClass(v+" "+p),t.hasClass(g)&&t.droppable("disable"),i.hasClass(m)&&i.draggable("disable")}).on(d,h,function(){var t=e(this).removeClass(f),n=r?t:t.children("div.elfinder-cwd-file-wrapper,div.elfinder-cwd-filename");t.hasClass(g)&&t.droppable("enable"),n.hasClass(m)&&n.draggable("enable")}).on("scrolltoview",h,function(t,n){G(e(this),n&&"undefined"!=typeof n.blink?n.blink:!0)}).on("mouseenter."+t.namespace+" mouseleave."+t.namespace,h,function(n){var i="mouseenter"===n.type;i&&ee||(t.trigger("hover",{hash:t.cwdId2Hash(e(this).attr("id")),type:n.type}),e(this).toggleClass(v,"mouseenter"==n.type))}).on("contextmenu."+t.namespace,function(n){var i=e(n.target).closest("."+u);i.length&&("TD"!=n.target.nodeName||e.inArray(t.cwdId2Hash(i.get(0).id),t.selected())>-1)&&(n.stopPropagation(),n.preventDefault(),i.hasClass(f)||xe.data("touching")||(i.hasClass(p)||(B(),i.trigger(o),K()),t.trigger("contextmenu",{type:"files",targets:t.selected(),x:n.pageX,y:n.pageY})))}).on("click."+t.namespace,function(e){e.target!==this||ke.data("longtap")||!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&B()}).on("create."+t.namespace,function(n,i){var a=r?ke.find("tbody"):ke,o=a.find(".elfinder-cwd-parent"),s=i.move||!1,i=e(H(i)).addClass(y),l=t.selected();l.length?s&&t.trigger("lockfiles",{files:l}):B(),o.length?o.after(i):a.prepend(i),de(),xe.scrollTop(0).scrollLeft(0)}).on("unselectall",B).on("selectfile",function(n,i){e("#"+t.cwdHash2Id(i)).trigger(o),K()}).on("colwidth",function(){r&&(ke.find("table").css("table-layout","").find("td").css("width",""),le({fitWidth:!0}),t.storage("cwdColWidth",D=null))}),xe=e('<div class="elfinder-cwd-wrapper"/>').droppable(Object.assign({},ce,{autoDisable:!1})).on("contextmenu."+t.namespace,ye.contextmenu).on("touchstart."+t.namespace,ye.touchstart).on("touchmove."+t.namespace+" touchend."+t.namespace,ye.touchend).on("click."+t.namespace,ye.click).on("scroll."+t.namespace,function(){ee||(ke.data("selectable")&&ke.selectable("disable"),xe.trigger(Z)),ee=!0,Y.scrtm&&clearTimeout(Y.scrtm),Y.scrtm&&Math.abs((Y.scrolltop||0)-(Y.scrolltop=this.scrollTop||e(this).scrollTop()))<5&&(Y.scrtm=0,xe.trigger(Q)),Y.scrtm=setTimeout(function(){Y.scrtm=0,xe.trigger(Q)},20)}).on(Q,function(){ee=!1,ie()}),Ce=e("<div> </div>").css({position:"absolute",width:"1px",height:"1px"}).hide(),Te=U?e('<div class="elfinder-cwd-selectall"><input type="checkbox"/></div>').attr("title",t.i18n("selectall")).on("touchstart mousedown click",function(t){return t.stopPropagation(),t.preventDefault(),e(this).data("pending")||"click"===t.type?!1:(Te.data("pending",!0),void(ke.hasClass("elfinder-cwd-allselected")?(Te.find("input").prop("checked",!1),setTimeout(function(){B()},10)):$()))}):e(),Ae=null,ze=function(t){var n=function(){var t=0;xe.siblings("div.elfinder-panel:visible").each(function(){t+=e(this).outerHeight(!0)}),xe.height(Oe.height()-t-xe._padding)};t&&n(),Ae&&clearTimeout(Ae),Ae=setTimeout(function(){!t&&n();var e,i;ke.css("height","auto"),e=xe[0].clientHeight-parseInt(xe.css("padding-top"))-parseInt(xe.css("padding-bottom"))-parseInt(ke.css("margin-top")),i=ke.outerHeight(!0),e>i&&ke.height(e)},20),r&&!M&&le(),ie()},Ie=e(this).parent().resize(ze),Oe=Ie.children(".elfinder-workzone").append(xe.append(this).append(Ce));R=Object.assign(R,n.replacement||{});try{D=t.storage("cwdColWidth")?t.storage("cwdColWidth"):null}catch(Se){D=null}(z=t.storage("cwdCols"))?(z=e.map(z,function(e){return-1!==n.listView.columns.indexOf(e)?e:null}),n.listView.columns.length>z.length&&e.each(n.listView.columns,function(e,t){-1===z.indexOf(t)&&z.push(t)})):z=n.listView.columns,E.row=S(),a&&e("body").on("touchstart touchmove touchend",function(e){}),U&&ke.addClass("elfinder-has-checkbox"),e(window).on("scroll."+t.namespace,function(){i&&clearTimeout(i),i=setTimeout(function(){xe.trigger(Q)},50)}),e(document).on("keydown."+t.namespace,function(n){n.keyCode==e.ui.keyCode.ESCAPE&&(t.getUI().find(".ui-widget:visible").length||B())}),t.one("init",function(){var n,i,r,o=document.createElement("style"),s=0;document.head&&(document.head.appendChild(o),n=o.sheet,n.insertRule('.elfinder-cwd-wrapper-empty .elfinder-cwd:after{ content:"'+t.i18n("emptyFolder")+'" }',s++),n.insertRule('.elfinder-cwd-wrapper-empty .ui-droppable .elfinder-cwd:after{ content:"'+t.i18n("emptyFolder"+(a?"LTap":"Drop"))+'" }',s++),n.insertRule('.elfinder-cwd-wrapper-empty .ui-droppable-disabled .elfinder-cwd:after{ content:"'+t.i18n("emptyFolder")+'" }',s++),n.insertRule('.elfinder-cwd-wrapper-empty.elfinder-search-result .elfinder-cwd:after{ content:"'+t.i18n("emptySearch")+'" }',s++),n.insertRule('.elfinder-cwd-wrapper-empty.elfinder-search-result.elfinder-incsearch-result .elfinder-cwd:after{ content:"'+t.i18n("emptyIncSearch")+'" }',s++),n.insertRule('.elfinder-cwd-wrapper-empty.elfinder-search-result.elfinder-letsearch-result .elfinder-cwd:after{ content:"'+t.i18n("emptyLetSearch")+'" }',s++)),a||(t.one("open",function(){n&&t.zIndex&&n.insertRule(".ui-selectable-helper{z-index:"+t.zIndex+";}",s++)}),r=e('<div style="position:absolute"/>'),i=t.getUI(),i.on("resize",function(e,t){var n;t&&t.fullscreen&&(n=i.offset(),"on"===t.fullscreen?(r.css({top:-1*n.top,left:-1*n.left}).appendTo(i),te.appendTo=r):(r.detach(),te.appendTo="body"),ke.data("selectable")&&ke.selectable("option",{appendTo:te.appendTo}))}))}).bind("enable",function(){ze()}).bind("open add remove searchend",function(){var n=t.cwd().hash,i=this.type;if(("open"===i||"searchend"===i||t.searchStatus.state<2)&&(T=e.map(t.files(n),function(e){return e.hash}),t.trigger("cwdhasheschange",T)),"open"===i){var a=function(){var n=!1;return e.each(C,function(e,i){return t.trashes[i]?(n=!0,!1):void 0}),n};C=t.parents(t.cwd().hash),xe[a()?"addClass":"removeClass"]("elfinder-cwd-wrapper-trash"),A=void 0,B(),we(),ze()}}).bind("search",function(n){T=e.map(n.data.files,function(e){return e.hash}),t.trigger("cwdhasheschange",T),A=void 0,t.searchStatus.ininc=!1,we(),t.autoSync("stop"),ze()}).bind("searchend",function(e){(k||A)&&(k="",A?t.trigger("incsearchend",e.data):e.data&&e.data.noupdate||we()),t.autoSync(),ze()}).bind("searchstart",function(e){B(),k=e.data.query}).bind("incsearchstart",function(n){L=[],t.lazy(function(){var i,a,r="";a=k=n.data.query||"",a?("/"===a.substr(0,1)&&(a=a.substr(1),r="^"),i=new RegExp(r+a.replace(/([\\*\;\.\?\[\]\{\}\(\)\^\$\-\|])/g,"\\$1"),"i"),A=e.map(T,function(e){var n=t.file(e);return n&&(n.name.match(i)||n.i18&&n.i18.match(i))?n.hash:null}),t.trigger("incsearch",{hashes:A,query:a}).searchStatus.ininc=!0,we(),t.autoSync("stop")):t.trigger("incsearchend"),ze()})}).bind("incsearchend",function(e){k="",t.searchStatus.ininc=!1,A=void 0,e.data&&e.data.noupdate||we(),t.autoSync()}).bind("sortchange",function(){var e=xe.scrollLeft();we(),t.one("cwdrender",function(){xe.scrollLeft(e),L.length&&K(),ze()})}).bind("viewchange",function(){var e="list"==t.storage("view"),n=ke.hasClass("elfinder-cwd-allselected");e!=r&&(r=e,t.viewType=r?"list":"icons",we(),n&&(ke.addClass("elfinder-cwd-allselected"),Te.find("input").prop("checked",!0)),L.length&&K()),ze()}).bind("wzresize",function(){var e,n=r?ke.find("tbody"):ke;ze(!0),Y.hpi&&be(n,n.find("[id]").length),e=ke.offset(),Oe.data("rectangle",Object.assign({width:Oe.width(),height:Oe.height(),cwdEdge:"ltr"===t.direction?e.left:e.left+ke.width()},Oe.offset())),Y.itemH=(r?n.find("tr:first"):n.find("[id]:first")).outerHeight(!0)}).bind("changeclipboard",function(t){x={},t.data&&t.data.clipboard&&t.data.clipboard.length&&e.each(t.data.clipboard,function(e,t){t.cut&&(x[t.hash]=!0)})}).bind("resMixinMake",function(){de()}).bind("tmbreload",function(t){var n={},i=t.data&&t.data.files?t.data.files:null;e.each(i,function(e,t){t.tmb&&"1"!=t.tmb&&(n[t.hash]=t.tmb)}),Object.keys(n).length&&he(n,!0)}).add(function(n){var i=k?new RegExp(k.replace(/([\\*\;\.\?\[\]\{\}\(\)\^\$\-\|])/g,"\\$1"),"i"):null,a=t.searchStatus.mime,o=t.searchStatus.state>1,s=o&&t.searchStatus.target?t.searchStatus.target:t.cwd().hash,l=t.path(s),d=function(n){var r,d;return r=n.phash===s,!r&&o&&(d=n.path||t.path(n.hash),r=l&&0===d.indexOf(l),!r&&t.searchStatus.mixed&&(r=!!e.map(t.searchStatus.mixed,function(e){return 0===n.hash.indexOf(e)?!0:null}).length)),r&&o&&(r=a?0===n.mime.indexOf(a):!!(n.name.match(i)||n.i18&&n.i18.match(i))),r},c=e.map(n.data.added||[],function(e){return d(e)?e:null});fe(c),2===t.searchStatus.state&&(e.each(c,function(t,n){-1===e.inArray(n.hash,T)&&T.push(n.hash)}),t.trigger("cwdhasheschange",T)),r&&ze(),xe.trigger(Q)}).change(function(n){var i,a=t.cwd().hash,o=t.selected();k?e.each(n.data.changed||[],function(t,n){me([n.hash]),-1!==n.name.indexOf(k)&&(fe([n],"change"),-1!==e.inArray(n.hash,o)&&W(n.hash),i=!0)}):e.each(e.map(n.data.changed||[],function(e){return e.phash==a?e:null}),function(t,n){me([n.hash]),fe([n],"change"),-1!==e.inArray(n.hash,o)&&W(n.hash),i=!0}),i&&(r&&ze(),xe.trigger(Q)),K()}).remove(function(e){var t=r?ke.find("tbody"):ke;me(e.data.removed||[]),K(),J.length<1&&t.children().length<1?(Oe.addClass("elfinder-cwd-wrapper-empty"),U&&Te.find("input").prop("checked",!1),Ce.hide(),xe.off(Q,oe),ze()):(be(t),xe.trigger(Q))}).dragstart(function(t){var n=e(t.data.target),i=t.data.originalEvent;n.hasClass(h.substr(1))&&(n.hasClass(p)||(!(i.ctrlKey||i.metaKey||i.shiftKey)&&B(),n.trigger(o),K())),ke.removeClass(f).data("selectable")&&ke.selectable("disable"),q=!0}).dragstop(function(){ke.data("selectable")&&ke.selectable("enable"),q=!1}).bind("lockfiles unlockfiles selectfiles unselectfiles",function(n){var i,a,r,c,u={lockfiles:l,unlockfiles:d,selectfiles:o,unselectfiles:s},h=u[n.type],p=n.data.files||[],f=p.length,m=n.data.helper||e();if(f>0&&(i=t.parents(p[0])),h!==o&&h!==s||(r=h===o,c=r?L.concat():L,e.each(p,function(t,n){var i=e.inArray(n,c),a=ke.hasClass("elfinder-cwd-allselected");-1===i?r&&L.push(n):(a&&(U&&Te.children("input").prop("checked",!1),ke.removeClass("elfinder-cwd-allselected"),a=!1),!r&&L.splice(i,1))})),!m.data("locked")){for(;f--;)e("#"+t.cwdHash2Id(p[f])).trigger(h);!n.data.inselect&&K()}xe.data("dropover")&&-1!==i.indexOf(xe.data("dropover"))&&(a="lockfiles"!==n.type,m.toggleClass("elfinder-drag-helper-plus",a),xe.toggleClass(b,a))}).bind("mkdir mkfile duplicate upload rename archive extract paste multiupload",function(n){if("upload"!=n.type||!n.data._multiupload){var i=t.cwd().hash;B(),e.each((n.data.added||[]).concat(n.data.changed||[]),function(e,t){t&&t.phash==i&&W(t.hash)}),K()}}).shortcut({pattern:"ctrl+a",description:"selectall",callback:$}).shortcut({pattern:"left right up down shift+left shift+right shift+up shift+down",description:"selectfiles",type:"keydown",callback:function(e){_(e.keyCode,e.shiftKey)}}).shortcut({pattern:"home",description:"selectffile",callback:function(e){B(),G(ke.find("[id]:first").trigger(o)),K()}}).shortcut({pattern:"end",description:"selectlfile",callback:function(e){B(),G(ke.find("[id]:last").trigger(o)),K()}}).shortcut({pattern:"page_up",description:"pageTurning",callback:function(e){Y.itemH&&xe.scrollTop(Math.round(xe.scrollTop()-Math.floor((xe.height()+(r?-1*Y.itemH:16))/Y.itemH)*Y.itemH))}}).shortcut({pattern:"page_down",description:"pageTurning",callback:function(e){Y.itemH&&xe.scrollTop(Math.round(xe.scrollTop()+Math.floor((xe.height()+(r?-1*Y.itemH:16))/Y.itemH)*Y.itemH))}})}),this},e.fn.elfinderdialog=function(t,n){var i,a,r=-1!=window.navigator.platform.indexOf("Win");return n&&n.ui?a=n.getUI():(a=this.closest(".elfinder"),n||(n=a.elfinder("instance"))),"string"==typeof t?((i=this.closest(".ui-dialog")).length&&("open"==t?"none"==i.css("display")&&i.fadeIn(120,function(){i.trigger("open")}):"close"==t||"destroy"==t?(i.stop(!0),(i.is(":visible")||a.is(":hidden"))&&i.hide().trigger("close"),"destroy"==t&&i.remove()):"toTop"==t?i.trigger("totop"):"posInit"==t?i.trigger("posinit"):"tabstopsInit"==t&&i.trigger("tabstopsInit")),this):(t=Object.assign({},e.fn.elfinderdialog.defaults,t),t.allowMinimize&&"auto"===t.allowMinimize&&(t.allowMinimize=!!this.find("textarea,input").length),t.headerBtnPos&&"auto"===t.headerBtnPos&&(t.headerBtnPos=r?"right":"left"),t.headerBtnOrder&&"auto"===t.headerBtnOrder&&(t.headerBtnOrder=r?"close:maximize:minimize":"close:minimize:maximize"),t.modal&&t.allowMinimize&&(t.allowMinimize=!1),this.filter(":not(.ui-dialog-content)").each(function(){var i=e(this).addClass("ui-dialog-content ui-widget-content"),o="elfinder-dialog-active",s="elfinder-dialog",l="elfinder-dialog-notify",d="ui-state-hover",c="elfinder-tabstop",u="elfinder-focus",h="elfinder-dialog-modal",p=parseInt(1e6*Math.random()),f=e('<div class="ui-dialog-titlebar ui-widget-header ui-corner-all ui-helper-clearfix"><span class="elfinder-dialog-title">'+t.title+"</span></div>"),m=e('<div class="ui-dialog-buttonset"/>'),g=e('<div class=" ui-helper-clearfix ui-dialog-buttonpane ui-widget-content"/>').append(m),v=0,b=0,y=e(),w=function(){y=A.find("."+c),y.length&&(y.attr("tabindex","-1"),y.filter("."+u).length||m.children("."+c+":"+(r?"first":"last")).addClass(u))},k=function(t){var n=y.filter(":visible"),i=t?null:n.filter("."+u+":first");return i&&i.length||(i=n.first()),t&&e.each(n,function(e,a){return a===t&&n[e+1]?(i=n.eq(e+1),!1):void 0}),i},x=function(t){var n=y.filter(":visible"),i=n.last();return e.each(n,function(e,a){return a===t&&n[e-1]?(i=n.eq(e-1),!1):void 0}),i},C=function(){e.each(t.headerBtnOrder.split(":").reverse(),function(e,t){T[t]&&T[t]()}),r&&f.children(".elfinder-titlebar-button").addClass("elfinder-titlebar-button-right")},T={close:function(){f.prepend(e('<span class="ui-widget-header ui-dialog-titlebar-close ui-corner-all elfinder-titlebar-button"><span class="ui-icon ui-icon-closethick"/></span>').on("mousedown",function(e){e.preventDefault(),e.stopPropagation(),i.elfinderdialog("close")}))},maximize:function(){t.allowMaximize&&(A.on("resize",function(e,t){var n,a;if(t&&t.maximize){if(a=f.find(".elfinder-titlebar-full"),n="on"===t.maximize,a.children("span.ui-icon").toggleClass("ui-icon-plusthick",!n).toggleClass("ui-icon-arrowreturnthick-1-s",n),n){try{A.hasClass("ui-draggable")&&A.draggable("disable"),A.hasClass("ui-resizable")&&A.resizable("disable")}catch(e){}"undefined"==typeof a.data("style")&&(i.height(i.height()),a.data("style",i.attr("style")||"")),i.css("width","100%").css("height",A.height()-A.children(".ui-dialog-titlebar").outerHeight(!0)-g.outerHeight(!0))}else{i.attr("style",a.data("style")),a.removeData("style");try{A.hasClass("ui-draggable")&&A.draggable("enable"),A.hasClass("ui-resizable")&&A.resizable("enable")}catch(e){}}A.trigger("resize")}}),f.prepend(e('<span class="ui-widget-header ui-corner-all elfinder-titlebar-button elfinder-titlebar-full"><span class="ui-icon ui-icon-plusthick"/></span>').on("mousedown",function(e){e.preventDefault(),e.stopPropagation(),n.toggleMaximize(A)})))},minimize:function(){t.allowMinimize&&f.on("dblclick",function(t){e(this).children(".elfinder-titlebar-minimize").trigger("mousedown")}).prepend(e('<span class="ui-widget-header ui-corner-all elfinder-titlebar-button elfinder-titlebar-minimize"><span class="ui-icon ui-icon-minusthick"/></span>').on("mousedown",function(t){var i,r=e(this);if(t.preventDefault(),t.stopPropagation(),"undefined"!=typeof r.data("style"))A.trigger("beforedommove").appendTo(a).trigger("dommove").attr("style",r.data("style")).removeClass("elfinder-dialog-minimized").off("mousedown.minimize"),r.removeData("style").show(),f.children(".elfinder-titlebar-full").show(),A.children(".ui-widget-content").slideDown("fast",function(){var e;if(this===A.children(".ui-widget-content:first").get(0)){if(A.find("."+n.res("class","editing"))&&n.disable(),e={minimize:"off"},A.hasClass("elfinder-maximized"))e.maximize="on";else try{A.hasClass("ui-draggable")&&A.draggable("enable"),A.hasClass("ui-resizable")&&A.resizable("enable")}catch(t){}A.trigger("resize",e)}});else{try{A.hasClass("ui-draggable")&&A.draggable("disable"),A.hasClass("ui-resizable")&&A.resizable("disable")}catch(t){}r.data("style",A.attr("style")||"").hide(),f.children(".elfinder-titlebar-full").hide(),i=A.width(),A.children(".ui-widget-content:first").slideUp(200,function(){A.children(".ui-widget-content").hide().end().trigger("resize",{minimize:"on"}).attr("style","").css({maxWidth:i}).addClass("elfinder-dialog-minimized").one("mousedown.minimize",function(e){r.trigger("mousedown")}).trigger("beforedommove").appendTo(n.getUI("bottomtray")).trigger("dommove")})}}))}},A=e('<div class="ui-front ui-dialog ui-widget ui-widget-content ui-corner-all ui-draggable std42-dialog touch-punch '+s+" "+t.cssClass+'"/>').hide().append(i).appendTo(a).draggable({handle:".ui-dialog-titlebar",containment:"document",stop:function(e,n){A.css({height:t.height}),i.data("draged",!0)}}).css({width:t.width,height:t.height}).on("mousedown",function(e){A.hasClass("ui-front")||setTimeout(function(){A.is(":visible:not(.elfinder-dialog-minimized)")&&A.trigger("totop")},10)}).on("open",function(){var r=e(this),d=r.outerWidth()>a.width()-10?a.width()-10:null;d&&r.css({width:d,left:"5px"}),A.hasClass(l)||a.children("."+s+":visible:not(."+l+")").each(function(){var t=e(this),n=parseInt(t.css("top")),i=parseInt(t.css("left")),a=parseInt(A.css("top")),r=parseInt(A.css("left"));t[0]==A[0]||n!=a&&i!=r||A.css({top:n+(d?15:10)+"px",left:(d?5:i+10)+"px"})}),A.data("modal")&&(A.addClass(h),n.getUI("overlay").elfinderoverlay("show")),A.trigger("totop"),"function"==typeof t.open&&e.proxy(t.open,i[0])(),n.UA.Mobile&&k().focus(),t.closeOnEscape&&e(document).on("keyup."+p,function(t){t.keyCode==e.ui.keyCode.ESCAPE&&A.hasClass(o)&&i.elfinderdialog("close")})}).on("close",function(){var r;t.closeOnEscape&&e(document).off("keyup."+p),t.allowMaximize&&n.toggleMaximize(A,!1),A.data("modal")&&n.getUI("overlay").elfinderoverlay("hide"),"function"==typeof t.close?e.proxy(t.close,i[0])():t.destroyOnClose&&A.hide().remove(),r=a.children("."+s+":visible"),r.length?r.filter(":last").trigger("totop"):setTimeout(function(){n.enable()},20)}).on("totop",function(){A.hasClass("elfinder-dialog-minimized")&&f.children(".elfinder-titlebar-minimize").trigger("mousedown"),!A.data("modal")&&n.getUI("overlay").is(":visible")?n.getUI("overlay").before(A):n.toFront(A),a.children("."+s+":not(."+h+")").removeClass(o+" ui-front"),A.addClass(o+" ui-front"),!n.UA.Mobile&&k().focus()}).on("posinit",function(){var e=t.position;e||A.data("resizing")||(e={top:Math.max(0,parseInt((a.height()-A.outerHeight())/2-42))+"px",left:Math.max(0,parseInt((a.width()-A.outerWidth())/2))+"px"}),t.absolute&&(e.position="absolute"),e&&A.css(e)}).on("resize",function(n,a){"function"==typeof t.resize&&e.proxy(t.resize,i[0])(n,a)}).on("tabstopsInit",w).on("focus","."+c,function(){e(this).addClass(d).parent("label").addClass(d),this.id&&e(this).parent().find("label[for="+this.id+"]").addClass(d)}).on("blur","."+c,function(){e(this).removeClass(d).removeData("keepFocus").parent("label").removeClass(d),this.id&&e(this).parent().find("label[for="+this.id+"]").removeClass(d)}).on("mouseenter mouseleave","."+c,function(n){var i=e(this);t.btnHoverFocus?"mouseenter"!=n.type||e(":focus").data("keepFocus")||i.focus():i.toggleClass(d,"mouseenter"==n.type)}).on("keydown","."+c,function(t){var n=e(this);if(n.is(":focus"))if(t.stopPropagation(),t.keyCode==e.ui.keyCode.ENTER)t.preventDefault(),n.click();else if(t.keyCode==e.ui.keyCode.TAB&&t.shiftKey||t.keyCode==e.ui.keyCode.LEFT||t.keyCode==e.ui.keyCode.UP){if(n.is("input:text")&&!t.ctrlKey&&!t.metaKey&&t.keyCode==e.ui.keyCode.LEFT)return;if(n.is("select")&&t.keyCode!=e.ui.keyCode.TAB)return;if(n.is("textarea")&&!t.ctrlKey&&!t.metaKey)return;t.preventDefault(),x(this).focus()}else if(t.keyCode==e.ui.keyCode.TAB||t.keyCode==e.ui.keyCode.RIGHT||t.keyCode==e.ui.keyCode.DOWN){if(n.is("input:text")&&!t.ctrlKey&&!t.metaKey&&t.keyCode==e.ui.keyCode.RIGHT)return;if(n.is("select")&&t.keyCode!=e.ui.keyCode.TAB)return;if(n.is("textarea")&&!t.ctrlKey&&!t.metaKey)return;t.preventDefault(),k(this).focus()}}).data({modal:t.modal});A.prepend(f),C(),
|
||
e.each(t.buttons,function(t,n){var a=e('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only elfinder-btncnt-'+b++ +" "+c+'"><span class="ui-button-text">'+t+"</span></button>").on("click",e.proxy(n,i[0]));r?m.append(a):m.prepend(a)}),m.children().length&&(A.append(g),A.show(),g.find("button").each(function(t,n){v+=e(n).outerWidth(!0)}),A.hide(),v+=20,A.width()<v&&A.width(v)),A.trigger("posinit").data("margin-y",i.outerHeight(!0)-i.height()),t.resizable&&e.fn.resizable&&A.resizable({minWidth:t.minWidth,minHeight:t.minHeight,start:function(){A.data("resizing")!==!0&&A.data("resizing")&&clearTimeout(A.data("resizing")),A.data("resizing",!0)},stop:function(){A.data("resizing",setTimeout(function(){A.data("resizing",!1)},200))},resize:function(t,n){var a=0;A.children(".ui-widget-header,.ui-dialog-buttonpane").each(function(){a+=e(this).outerHeight(!0)}),i.height(n.size.height-a-A.data("margin-y")),A.trigger("resize")}}),"function"==typeof t.create&&e.proxy(t.create,this)(),w(),t.autoOpen&&i.elfinderdialog("open")}),this)},e.fn.elfinderdialog.defaults={cssClass:"",title:"",modal:!1,resizable:!0,autoOpen:!0,closeOnEscape:!0,destroyOnClose:!1,buttons:{},btnHoverFocus:!0,position:null,absolute:!1,width:320,height:"auto",minWidth:200,minHeight:110,allowMinimize:"auto",allowMaximize:!1,headerBtnPos:"auto",headerBtnOrder:"auto"},e.fn.elfinderfullscreenbutton=function(t){return this.each(function(){var n=e(this).elfinderbutton(t),i=n.children(".elfinder-button-icon");t.change(function(){var e=t.value;i.toggleClass("elfinder-button-icon-unfullscreen",e),n.attr("title",e?t.fm.i18n("reinstate"):t.fm.i18n("cmdfullscreen")),t.className=e?"unfullscreen":"",t.title=t.fm.i18n(e?"reinstate":"cmdfullscreen")})})},e.fn.elfindermkdirbutton=function(t){return this.each(function(){var n=e(this).elfinderbutton(t);t.change(function(){n.attr("title",t.value)})})},e.fn.elfindernavbar=function(t,n){return this.not(".elfinder-navbar").each(function(){var i,a,r,o,s=e(this).hide().addClass("ui-state-default elfinder-navbar"),l=s.parent(),d=l.children(".elfinder-workzone").append(s),c=s.outerHeight()-s.height(),u="ltr"==t.direction,h=function(){var e=t.getUI("cwd"),n=t.getUI("workzone"),i=n.data("rectangle"),a=e.offset();n.data("rectangle",Object.assign(i,{cwdEdge:"ltr"===t.direction?a.left:a.left+e.width()}))};t.one("cssloaded",function(){c=s.outerHeight()-s.height()}).bind("wzresize",function(){s.height(d.height()-c)}),t.UA.Touch&&(r=t.storage("autoHide")||{},"undefined"==typeof r.navbar&&(r.navbar=n.autoHideUA&&n.autoHideUA.length>0&&e.map(n.autoHideUA,function(e){return t.UA[e]?!0:null}).length,t.storage("autoHide",r)),r.navbar&&t.one("init",function(){t.uiAutoHide.push(function(){s.stop(!0,!0).trigger("navhide",{duration:"slow",init:!0})})}),t.bind("load",function(){a=e('<div class="elfinder-navbar-swipe-handle"/>').hide().appendTo(d),"none"!==a.css("pointer-events")&&(a.remove(),a=null)}),s.on("navshow navhide",function(e,n){var i="navshow"===e.type?"show":"hide",o=n&&n.duration?n.duration:"fast",l=n&&n.handleW?n.handleW:Math.max(50,t.getUI().width()/10);s.stop(!0,!0)[i](o,function(){"show"===i?a&&a.stop(!0,!0).hide():a&&(a.width(l?l:""),t.resources.blink(a,"slowonce")),t.trigger("navbar"+i).getUI("cwd").trigger("resize"),n.init&&t.trigger("uiautohide"),h()}),r.navbar="show"!==i,t.storage("autoHide",Object.assign(t.storage("autoHide"),{navbar:r.navbar}))})),e.fn.resizable&&!t.UA.Mobile&&(i=s.resizable({handles:u?"e":"w",minWidth:n.minWidth||150,maxWidth:n.maxWidth||500,stop:function(e,n){t.storage("navbarWidth",n.size.width),h()}}).on("resize scroll",function(n){u||"resize"!==n.type||s.css("left",0),clearTimeout(e(this).data("posinit")),e(this).data("posinit",setTimeout(function(){var e=t.UA.Opera&&s.scrollLeft()?20:2;i.css({top:parseInt(s.scrollTop())+"px",left:u?"auto":parseInt(s.scrollLeft()+e),right:u?-1*parseInt(s.scrollLeft()-e):"auto"}),"resize"===n.type&&t.getUI("cwd").trigger("resize")},50))}).find(".ui-resizable-handle").addClass("ui-front"),t.one("open",function(){setTimeout(function(){s.trigger("resize")},150)})),(o=t.storage("navbarWidth"))?s.width(o):t.UA.Mobile&&t.one("cssloaded",function(){s.data("defWidth",s.width()),e(window).on("resize."+t.namespace,function(e){o=s.parent().width()/2,s.data("defWidth")>o?s.width(o):s.width(s.data("defWidth")),s.data("width",s.width())})})}),this},e.fn.elfinderoverlay=function(t){var n=this.parent().elfinder("instance");if(this.filter(":not(.elfinder-overlay)").each(function(){t=Object.assign({},t),e(this).addClass("ui-front ui-widget-overlay elfinder-overlay").hide().mousedown(function(e){e.preventDefault(),e.stopPropagation()}).data({cnt:0,show:"function"==typeof t.show?t.show:function(){},hide:"function"==typeof t.hide?t.hide:function(){}})}),"show"==t){var i=this.eq(0),a=i.data("cnt")+1,r=i.data("show");n.toFront(i),i.data("cnt",a),i.is(":hidden")&&(i.show(),r())}if("hide"==t){var i=this.eq(0),a=i.data("cnt")-1,o=i.data("hide");i.data("cnt",a),0>=a&&(i.hide(),o())}return this},e.fn.elfinderpanel=function(t){return this.each(function(){var n=e(this).addClass("elfinder-panel ui-state-default ui-corner-all"),i="margin-"+("ltr"==t.direction?"left":"right");t.one("load",function(e){var a=t.getUI("navbar");n.css(i,parseInt(a.outerWidth(!0))),a.on("resize",function(){n.is(":visible")&&n.css(i,parseInt(a.outerWidth(!0)))})})})},e.fn.elfinderpath=function(t){return this.each(function(){var n="",a="",r=[],o="statusbar",s=t.res("class","hover"),l="path"+(i.prototype.uniqueid?i.prototype.uniqueid:"")+"-",d=e('<div class="ui-widget-header ui-helper-clearfix elfinder-workzone-path"/>'),c=e(this).addClass("elfinder-path").html(" ").on("mousedown","span.elfinder-path-dir",function(i){var a=e(this).attr("id").substr(l.length);i.preventDefault(),a!=t.cwd().hash&&(e(this).addClass(s),n?t.exec("search",n,{target:a,mime:r.join(" ")}):t.exec("open",a))}).prependTo(t.getUI("statusbar").show()),u=e('<div class="elfinder-path-roots"/>').on("click",function(n){n.stopPropagation(),n.preventDefault();var i=e.map(t.roots,function(e){return t.file(e)}),a=[];e.each(i,function(e,n){n.phash||t.root(t.cwd().hash,!0)===n.hash||a.push({label:t.escape(n.i18||n.name),icon:"home",callback:function(){t.exec("open",n.hash)},options:{iconClass:n.csscls||"",iconImg:n.icon||""}})}),t.trigger("contextmenu",{raw:a,x:n.pageX,y:n.pageY})}).append('<span class="elfinder-button-icon elfinder-button-icon-menu" />').appendTo(d),h=function(n){var i=[];return e.each(t.parents(n),function(e,a){var r=n===a?"elfinder-path-dir elfinder-path-cwd":"elfinder-path-dir",o=t.file(a),s=t.escape(o.i18||o.name);i.push('<span id="'+l+a+'" class="'+r+'" title="'+s+'">'+s+"</span>")}),i.join('<span class="elfinder-path-other">'+t.option("separator")+"</span>")},p=function(){var n;c.children("span.elfinder-path-dir").attr("style",""),n="ltr"===t.direction?e("#"+l+t.cwd().hash).prevAll("span.elfinder-path-dir:first"):e(),c.scrollLeft(n.length?n.position().left:0)},f=function(){var t,n,i=c.children("span.elfinder-path-dir"),a=i.length;return"workzone"===o||2>a?void i.attr("style",""):(c.width(c.css("max-width")),i.css({maxWidth:100/a+"%",display:"inline-block"}),t=c.width()-9,c.children("span.elfinder-path-other").each(function(){t-=e(this).width()}),n=[],i.each(function(i){var a=e(this),r=a.width();t-=r,r<this.scrollWidth&&n.push(i)}),c.width(""),void(n.length?(t>0&&(t/=n.length,e.each(n,function(n,a){var r=e(i[a]);r.css("max-width",r.width()+t)})),i.last().attr("style","")):i.attr("style","")))};t.bind("open searchend parents",function(){n="",a="",r=[],c.html(h(t.cwd().hash)),Object.keys(t.roots).length>1?(c.css("margin",""),u.show()):(c.css("margin",0),u.hide()),f()}).bind("searchstart",function(e){e.data&&(n=e.data.query||"",a=e.data.target||"",r=e.data.mimes||[])}).bind("search",function(e){var n="";n=a?h(a):t.i18n("btnAll"),c.html('<span class="elfinder-path-other">'+t.i18n("searcresult")+": </span>"+n),f()}).bind("navbarshow navbarhide",function(){var e=t.getUI("workzone");"navbarshow"===this.type?(e.height(e.height()+d.outerHeight()),c.prependTo(t.getUI("statusbar")),d.detach(),o="statusbar",t.unbind("open",p)):(d.append(c).insertBefore(e),e.height(e.height()-d.outerHeight()),o="workzone",p(),t.bind("open",p)),t.trigger("uiresize")}).bind("resize",f)})},e.fn.elfinderplaces=function(t,n){return this.each(function(){var i={},a="class",r=t.res(a,"navdir"),o=t.res(a,"navcollapse"),s=t.res(a,"navexpand"),l=t.res(a,"hover"),d=t.res(a,"treeroot"),c=t.res(a,"adroppable"),u=t.res("tpl","placedir"),h=t.res("tpl","perms"),p=e(t.res("tpl","navspinner")),f="places"+(n.suffix?n.suffix:""),m=null,g=function(e){return e.substr(6)},v=function(e){return"place-"+e},b=function(){var n=[],a={};n=e.map(O.children().find("[id]"),function(e){return g(e.id)}),n.length?e.each(n.reverse(),function(e,t){a[t]=i[t]}):a=null,t.storage(f,a)},y=function(n,i){return e(u.replace(/\{id\}/,v(n?n.hash:i)).replace(/\{name\}/,t.escape(n?n.i18||n.name:i)).replace(/\{cssclass\}/,n?t.perms2class(n)+(n.notfound?" elfinder-na":"")+(n.csscls?" "+n.csscls:""):"").replace(/\{permissions\}/,!n||n.read&&n.write&&!n.notfound?"":h).replace(/\{title\}/,n&&n.path?t.escape(n.path):"").replace(/\{symlink\}/,"").replace(/\{style\}/,n&&n.icon?t.getIconStyle(n):""))},w=function(e){var n,a;return"directory"!==e.mime?!1:(a=e.hash,t.files().hasOwnProperty(a)||t.trigger("tree",{tree:[e]}),n=y(e,a),i[a]=e,O.prepend(n),I.addClass(o),A.toggle(O.children().length>1),!0)},k=function(t){var n,a,r=null;return i[t]&&(delete i[t],n=e("#"+v(t)),n.length&&(r=n.text(),n.parent().remove(),a=O.children().length,A.toggle(a>1),a||(I.removeClass(o),S.removeClass(s),O.slideToggle(!1)))),r},x=function(n){var i=e("#"+v(n)),a=i.parent(),r=a.prev("div"),o="ui-state-hover",s=t.getUI("contextmenu");m&&clearTimeout(m),r.length&&(s.find(":first").data("placesHash",n),i.addClass(o),a.insertBefore(r),r=a.prev("div"),m=setTimeout(function(){i.removeClass(o),s.find(":first").data("placesHash")===n&&s.hide().empty()},1500)),r.length||(i.removeClass(o),s.hide().empty())},C=function(t,n){var a=t.hash,r=e("#"+v(n||a)),o=y(t,a);return r.length>0?(r.parent().replaceWith(o),i[a]=t,!0):!1},T=function(){e.each(i,function(n,i){var a=t.file(n)||i,o=y(a,n),s=null;return a||o.hide(),O.children().length&&(e.each(O.children(),function(){var t=e(this);return(a.i18||a.name).localeCompare(t.children("."+r).text())<0?s=!o.insertBefore(t):void 0}),null!==s)?!0:void(!e("#"+v(n)).length&&O.append(o))}),b()},A=e('<span class="elfinder-button-icon elfinder-button-icon-sort elfinder-places-root-icon" title="'+t.i18n("cmdsort")+'"/>').hide().on("click",function(e){e.stopPropagation(),O.empty(),T()}),z=y({hash:"root-"+t.namespace,name:t.i18n(n.name,"places"),read:!0,write:!0}),I=z.children("."+r).addClass(d).click(function(e){e.stopPropagation(),I.hasClass(o)&&(S.toggleClass(s),O.slideToggle(),t.storage("placesState",S.hasClass(s)?1:0))}).append(A),O=z.children("."+t.res(a,"navsubtree")),S=e(this).addClass(t.res(a,"tree")+" elfinder-places ui-corner-all").hide().append(z).appendTo(t.getUI("navbar")).on("mouseenter mouseleave","."+r,function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type)}).on("click","."+r,function(n){var i=e(this);return i.data("longtap")?void n.stopPropagation():void(!i.hasClass("elfinder-na")&&t.exec("open",i.attr("id").substr(6)))}).on("contextmenu","."+r+":not(."+d+")",function(n){var i=e(this),a=i.attr("id").substr(6);n.preventDefault(),t.trigger("contextmenu",{raw:[{label:t.i18n("moveUp"),icon:"up",remain:!0,callback:function(){x(a),b()}},"|",{label:t.i18n("rmFromPlaces"),icon:"rm",callback:function(){k(a),b()}}],x:n.pageX,y:n.pageY}),i.addClass("ui-state-hover"),t.getUI("contextmenu").children().on("mouseenter",function(){i.addClass("ui-state-hover")}),t.bind("closecontextmenu",function(){i.removeClass("ui-state-hover")})}).droppable({tolerance:"pointer",accept:".elfinder-cwd-file-wrapper,.elfinder-tree-dir,.elfinder-cwd-file",hoverClass:t.res("class","adroppable"),classes:{"ui-droppable-hover":t.res("class","adroppable")},over:function(n,a){var r=a.helper,o=e.map(r.data("files"),function(e){return"directory"!==t.file(e).mime||i[e]?null:e});n.stopPropagation(),r.data("dropover",r.data("dropover")+1),t.insideWorkzone(n.pageX,n.pageY)&&(o.length>0?(r.addClass("elfinder-drag-helper-plus"),t.trigger("unlockfiles",{files:r.data("files"),helper:r})):e(this).removeClass(c))},out:function(n,i){var a=i.helper,r=n.shiftKey||n.ctrlKey||n.metaKey;n.stopPropagation(),a.toggleClass("elfinder-drag-helper-move elfinder-drag-helper-plus",a.data("locked")?!0:r).data("dropover",Math.max(a.data("dropover")-1,0)),e(this).removeData("dropover").removeClass(c),t.trigger(r?"unlockfiles":"lockfiles",{files:a.data("files"),helper:a})},drop:function(n,a){var r=a.helper,o=!0;e.each(r.data("files"),function(e,n){var a=t.file(n);a&&"directory"==a.mime&&!i[a.hash]?w(a):o=!1}),b(),o&&r.hide()}}).on("touchstart","."+r+":not(."+d+")",function(n){if(!(n.originalEvent.touches.length>1))var i=e(this).attr("id").substr(6),a=e(this).addClass(l).data("longtap",null).data("tmlongtap",setTimeout(function(){a.data("longtap",!0),t.trigger("contextmenu",{raw:[{label:t.i18n("rmFromPlaces"),icon:"rm",callback:function(){k(i),b()}}],x:n.originalEvent.touches[0].pageX,y:n.originalEvent.touches[0].pageY})},500))}).on("touchmove touchend","."+r+":not(."+d+")",function(t){clearTimeout(e(this).data("tmlongtap")),"touchmove"==t.type&&e(this).removeClass(l)});e.fn.sortable&&O.addClass("touch-punch").sortable({appendTo:t.getUI(),revert:!1,helper:function(n){var i=e(n.target).parent();return i.children().removeClass("ui-state-hover"),e('<div class="ui-widget elfinder-place-drag elfinder-'+t.direction+'"/>').append(e('<div class="elfinder-navbar"/>').show().append(i.clone()))},stop:function(t,n){var i=e(n.item[0]),a=S.offset().top,r=S.offset().left,o=S.width(),s=S.height(),l=t.pageX,d=t.pageY;l>r&&r+o>l&&d>a&&d+s>d||(k(g(i.children(":first").attr("id"))),b())},update:function(e,t){b()}}),e(this).on("regist",function(t,n){var a=!1;e.each(n,function(e,t){t&&"directory"==t.mime&&!i[t.hash]&&w(t)&&(a=!0)}),a&&b()}),t.one("load",function(){var n,a;t.oldAPI||(S.show().parent().show(),i={},n=t.storage(f),"string"==typeof n?(n=e.map(n.split(","),function(e){return e||null}),e.each(n,function(e,t){var n=t.split("#");i[n[0]]=n[1]?n[1]:n[0]})):e.isPlainObject(n)&&(i=n),t.trigger("placesload",{dirs:i,storageKey:f},!0),a=Object.keys(i),a.length&&(I.prepend(p),t.request({data:{cmd:"info",targets:a},preventDefault:!0}).done(function(n){var a={};n.files&&n.files.length&&t.cache(n.files),e.each(n.files,function(e,t){var n=t.hash;a[n]=t}),e.each(i,function(e,t){w(a[e]||Object.assign({notfound:!0},t))}),t.storage("placesState")>0&&I.click()}).always(function(){p.remove()})),t.change(function(t){var n=!1;e.each(t.data.changed,function(e,t){i[t.hash]&&("directory"!==t.mime?k(t.hash)&&(n=!0):C(t)&&(n=!0))}),n&&b()}).bind("rename",function(t){var n=!1;t.data.removed&&e.each(t.data.removed,function(e,i){t.data.added[e]&&C(t.data.added[e],i)&&(n=!0)}),n&&b()}).bind("rm paste",function(t){var n=[],i=!1;t.data.removed&&e.each(t.data.removed,function(e,t){var i=k(t);i&&n.push(i)}),n.length&&(i=!0),t.data.added&&n.length&&e.each(t.data.added,function(t,i){1!==e.inArray(i.name,n)&&"directory"==i.mime&&w(i)}),i&&b()}).bind("sync netmount",function(){var n=Object.keys(i),a=this;n.length&&(I.prepend(p),t.request({data:{cmd:"info",targets:n},preventDefault:!0}).done(function(n){var r={},o=!1,s=t.cwd().hash;e.each(n.files||[],function(e,n){var i=n.hash;r[i]=n,t.files().hasOwnProperty(n.hash)||t.trigger("tree",{tree:[n]})}),e.each(i,function(e,t){!t.notfound!=!!r[e]?t.phash===s&&"netmount"!==a.type||r[e]&&"directory"!==r[e].mime?k(e)&&(o=!0):C(r[e]||Object.assign({notfound:!0},t))&&(o=!0):r[e]&&r[e].phash!=s&&C(r[e])}),o&&b()}).always(function(){p.remove()}))}))})})},e.fn.elfindersearchbutton=function(t){return this.each(function(){var n,i,a=!1,r=t.fm,o=t.options.incsearch||{enable:!1},s=function(e){return r.namespace+e},l=r.getUI("toolbar"),d=r.res("class","searchbtn"),c=e(this).hide().addClass("ui-widget-content elfinder-button "+d),u=function(){f.data("inctm")&&clearTimeout(f.data("inctm")),n&&n.slideUp();var i=e.trim(f.val()),o=!e("#"+s("SearchFromAll")).prop("checked"),l=e("#"+s("SearchMime")).prop("checked");o&&(o=e("#"+s("SearchFromVol")).prop("checked")?r.root(r.cwd().hash):r.cwd().hash),l&&(l=i,i="."),i?t.exec(i,o,l).done(function(){a=!0,f.focus()}).fail(function(){h()}):r.trigger("searchend")},h=function(){f.data("inctm")&&clearTimeout(f.data("inctm")),f.val("").blur(),(a||p)&&(a=!1,p="",r.lazy(function(){r.trigger("searchend")}))},p="",f=e('<input type="text" size="42"/>').on("focus",function(){p="",n&&n.slideDown()}).on("blur",function(){n&&(n.data("infocus")?n.data("infocus",!1):n.slideUp())}).appendTo(c).on("keypress",function(e){e.stopPropagation()}).on("keydown",function(t){t.stopPropagation(),t.keyCode==e.ui.keyCode.ENTER&&u(),t.keyCode==e.ui.keyCode.ESCAPE&&(t.preventDefault(),h())});o.enable&&(o.minlen=o.minlen||2,o.wait=o.wait||500,f.attr("title",r.i18n("incSearchOnly")).on("compositionstart",function(){f.data("composing",!0)}).on("compositionend",function(){f.removeData("composing"),f.trigger("input")}).on("input",function(){f.data("composing")||(f.data("inctm")&&clearTimeout(f.data("inctm")),f.data("inctm",setTimeout(function(){var e=f.val();(0===e.length||e.length>=o.minlen)&&(p!==e&&r.trigger("incsearchstart",{query:e}),p=e,""===e&&r.searchStatus.state>1&&r.searchStatus.query&&f.val(r.searchStatus.query).select())},o.wait)))}),r.UA.ltIE8&&f.on("keydown",function(e){229===e.keyCode&&(f.data("imetm")&&clearTimeout(f.data("imetm")),f.data("composing",!0),f.data("imetm",setTimeout(function(){f.removeData("composing")},100)))}).on("keyup",function(t){f.data("imetm")&&clearTimeout(f.data("imetm")),f.data("composing")?t.keyCode===e.ui.keyCode.ENTER&&f.trigger("compositionend"):f.trigger("input")})),e('<span class="ui-icon ui-icon-search" title="'+t.title+'"/>').appendTo(c).click(u),e('<span class="ui-icon ui-icon-close"/>').appendTo(c).click(h),r.bind("toolbarload",function(){var e=c.parent();if(e.length&&(l.prepend(c.show()),e.remove(),r.UA.ltIE7)){var t=c.children("ltr"==r.direction?".ui-icon-close":".ui-icon-search");t.css({right:"",left:parseInt(c.width())-t.outerWidth(!0)})}}),r.one("open",function(){n=r.api<2.1?null:e('<div class="ui-front ui-widget ui-widget-content elfinder-button-menu ui-corner-all"/>').append(e('<div class="buttonset"/>').append(e('<input id="'+s("SearchFromCwd")+'" name="serchfrom" type="radio" checked="checked"/><label for="'+s("SearchFromCwd")+'">'+r.i18n("btnCwd")+"</label>"),e('<input id="'+s("SearchFromVol")+'" name="serchfrom" type="radio"/><label for="'+s("SearchFromVol")+'">'+r.i18n("btnVolume")+"</label>"),e('<input id="'+s("SearchFromAll")+'" name="serchfrom" type="radio"/><label for="'+s("SearchFromAll")+'">'+r.i18n("btnAll")+"</label>")),e('<div class="buttonset"/>').append(e('<input id="'+s("SearchName")+'" name="serchcol" type="radio" checked="checked"/><label for="'+s("SearchName")+'">'+r.i18n("btnFileName")+"</label>"),e('<input id="'+s("SearchMime")+'" name="serchcol" type="radio"/><label for="'+s("SearchMime")+'">'+r.i18n("btnMime")+"</label>"))).hide().appendTo(c),n&&(n.find("div.buttonset").buttonset(),e("#"+s("SearchFromAll")).next("label").attr("title",r.i18n("searchTarget",r.i18n("btnAll"))),e("#"+s("SearchMime")).next("label").attr("title",r.i18n("searchMime")),n.on("mousedown","div.buttonset",function(e){e.stopPropagation(),n.data("infocus",!0)}).on("click","input",function(t){t.stopPropagation(),e.trim(f.val())&&u()}))}).select(function(){f.blur()}).bind("searchend",function(){f.val("")}).bind("open parents",function(){var t=[],n=r.file(r.root(r.cwd().hash));n&&(e.each(r.parents(r.cwd().hash),function(e,n){t.push(r.file(n).name)}),e("#"+s("SearchFromCwd")).next("label").attr("title",r.i18n("searchTarget",t.join(r.option("separator")))),e("#"+s("SearchFromVol")).next("label").attr("title",r.i18n("searchTarget",n.name)))}).bind("open",function(){p&&h()}).bind("cwdinit",function(){i=!1}).bind("cwdrender",function(){i=!0}).bind("keydownEsc",function(){p&&"/"===p.substr(0,1)&&(p="",f.val(""),r.trigger("searchend"))}).shortcut({pattern:"ctrl+f f3",description:t.title,callback:function(){f.select().focus()}}).shortcut({pattern:"a b c d e f g h i j k l m n o p q r s t u v w x y z dig0 dig1 dig2 dig3 dig4 dig5 dig6 dig7 dig8 dig9 num0 num1 num2 num3 num4 num5 num6 num7 num8 num9",description:r.i18n("firstLetterSearch"),callback:function(t){if(i){var n,a=t.originalEvent.keyCode,o=function(){var t=r.selected(),n=e.ui.keyCode[!t.length||e("#"+r.cwdHash2Id(t[0])).next("[id]").length?"RIGHT":"HOME"];e(document).trigger(e.Event("keydown",{keyCode:n,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))};a>=96&&105>=a&&(a-=48),n="/"+String.fromCharCode(a),p!==n?(f.val(n),p=n,r.trigger("incsearchstart",{query:n}).one("cwdrender",o)):o()}}})})},e.fn.elfindersortbutton=function(t){return this.each(function(){var n=t.fm,i=t.name,a="class",r=n.res(a,"disabled"),o=n.res(a,"hover"),s="elfinder-button-menu-item",l=s+"-selected",d=l+"-asc",c=l+"-desc",u=e('<span class="elfinder-button-text">'+t.title+"</span>"),h=e(this).addClass("ui-state-default elfinder-button elfinder-menubutton elfiner-button-"+i).attr("title",t.title).append('<span class="elfinder-button-icon elfinder-button-icon-'+i+'"/>',u).hover(function(e){!h.hasClass(r)&&h.toggleClass(o)}).click(function(e){h.hasClass(r)||(e.stopPropagation(),p.is(":hidden")&&t.fm.getUI().click(),p.slideToggle(100))}),p=e('<div class="ui-front ui-widget ui-widget-content elfinder-button-menu ui-corner-all"/>').hide().appendTo(h).on("mouseenter mouseleave","."+s,function(){e(this).toggleClass(o)}).on("click","."+s,function(e){e.preventDefault(),e.stopPropagation(),m()}),f=function(){p.children("[rel]").removeClass(l+" "+d+" "+c).filter('[rel="'+n.sortType+'"]').addClass(l+" "+("asc"==n.sortOrder?d:c)),p.children(".elfinder-sort-stick").toggleClass(l,n.sortStickFolders),p.children(".elfinder-sort-tree").toggleClass(l,n.sortAlsoTreeview)},m=function(){p.hide()};u.hide(),e.each(n.sortRules,function(t,i){p.append(e('<div class="'+s+'" rel="'+t+'"><span class="ui-icon ui-icon-arrowthick-1-n"/><span class="ui-icon ui-icon-arrowthick-1-s"/>'+n.i18n("sort"+t)+"</div>").data("type",t))}),p.children().click(function(i){var a=e(this).attr("rel");t.exec([],{type:a,order:a==n.sortType?"asc"==n.sortOrder?"desc":"asc":n.sortOrder,stick:n.sortStickFolders,tree:n.sortAlsoTreeview})}),e('<div class="'+s+" "+s+'-separated elfinder-sort-ext elfinder-sort-stick"><span class="ui-icon ui-icon-check"/>'+n.i18n("sortFoldersFirst")+"</div>").appendTo(p).click(function(){t.exec([],{type:n.sortType,order:n.sortOrder,stick:!n.sortStickFolders,tree:n.sortAlsoTreeview})}),e.fn.elfindertree&&-1!==e.inArray("tree",n.options.ui)&&e('<div class="'+s+" "+s+'-separated elfinder-sort-ext elfinder-sort-tree"><span class="ui-icon ui-icon-check"/>'+n.i18n("sortAlsoTreeview")+"</div>").appendTo(p).click(function(){t.exec([],{type:n.sortType,order:n.sortOrder,stick:n.sortStickFolders,tree:!n.sortAlsoTreeview})}),n.bind("disable select",m).getUI().click(m),n.bind("sortchange",f),p.children().length>1?t.change(function(){h.toggleClass(r,t.disabled()),f()}).change():h.addClass(r)})},e.fn.elfinderstat=function(t){return this.each(function(){var n=e(this).addClass("elfinder-stat-size"),i=e('<div class="elfinder-stat-selected"/>').on("click","a",function(n){var i=e(this).data("hash");n.preventDefault(),t.exec("opendir",[i])}),a=t.i18n("size"),r=t.i18n("items"),o=t.i18n("selected"),s=function(i){var o=0,s=0;e.each(i,function(e,t){o++,s+=parseInt(t.size)||0}),n.html(r+': <span class="elfinder-stat-incsearch"></span>'+o+", "+a+": "+t.formatSize(s))},l=function(e){n.find("span.elfinder-stat-incsearch").html(e?e.hashes.length+" / ":"")};t.getUI("statusbar").prepend(n).append(i).show(),t.bind("cwdhasheschange",function(n){s(e.map(n.data,function(e){return t.file(e)}))}).select(function(){var n,r=0,s=0,l=t.selectedFiles(),d=[];return 1==l.length?(n=l[0],r=n.size,2===t.searchStatus.state&&d.push('<a href="#elf_'+n.phash+'" data-hash="'+n.hash+'">'+(n.path?n.path.replace(/\/[^\/]*$/,""):"..")+"</a>"),d.push(t.escape(n.i18||n.name)),void i.html(d.join("/")+(r>0?", "+t.formatSize(r):""))):(e.each(l,function(e,t){s++,r+=parseInt(t.size)||0}),void i.html(s?o+": "+s+", "+a+": "+t.formatSize(r):" "))}).bind("incsearch",function(e){l(e.data)}).bind("incsearchend",function(){l()})})},e.fn.elfindertoast=function(t,n){var i={mode:"success",msg:"",showMethod:"fadeIn",showDuration:300,showEasing:"swing",onShown:void 0,hideMethod:"fadeOut",hideDuration:1500,hideEasing:"swing",onHidden:void 0,timeOut:3e3,extNode:void 0};return this.each(function(){t=Object.assign({},i,t||{});var n,a=e(this),r=function(e){a.stop(),a[t.showMethod]({duration:t.showDuration,easing:t.showEasing,complete:function(){t.onShown&&t.onShown(),!e&&t.timeOut&&(n=setTimeout(o,t.timeOut))}})},o=function(){a[t.hideMethod]({duration:t.hideDuration,easing:t.hideEasing,complete:function(){t.onHidden&&t.onHidden(),a.remove()}})};a.on("click",function(e){e.stopPropagation(),e.preventDefault(),a.stop().remove()}).on("mouseenter mouseleave",function(e){t.timeOut&&(n&&clearTimeout(n),n=null,"mouseenter"===e.type?r(!0):n=setTimeout(o,t.timeOut))}).hide().addClass("toast-"+t.mode).append(e('<div class="elfinder-toast-msg"/>').html(t.msg)),t.extNode&&a.append(t.extNode),r()})},e.fn.elfindertoolbar=function(t,n){return this.not(".elfinder-toolbar").each(function(){var i,a,r,o,s,l,d,c,u=t._commands,h=e(this).addClass("ui-helper-clearfix ui-widget-header ui-corner-top elfinder-toolbar"),p={displayTextLabel:!1,labelExcludeUA:["Mobile"],autoHideUA:["Mobile"]},f=function(t){return e.map(t,function(t){return e.isPlainObject(t)?(p=Object.assign(p,t),null):[t]})},m=function(n){var l;for(e.each(g,function(e,t){t.detach()}),h.empty(),i=v.length;i--;)if(v[i]){for(o=e('<div class="ui-widget-content ui-corner-all elfinder-buttonset"/>'),a=v[i].length;a--;)l=v[i][a],n&&-1!==e.inArray(l,n)||!(r=u[l])||(s="elfinder"+r.options.ui,!g[l]&&e.fn[s]&&(g[l]=e("<div/>")[s](r)),g[l]&&(c&&g[l].find(".elfinder-button-text").show(),o.prepend(g[l])));o.children().length&&h.prepend(o),o.children(":gt(0)").before('<span class="ui-widget-content elfinder-toolbar-button-separator"/>')}!h.data("swipeClose")&&h.children().length?h.show():h.hide(),t.trigger("toolbarload").trigger("uiresize")},g={},v=f(n||[]),b=null,y="";c=t.storage("toolbarTextLabel"),c=null===c?p.displayTextLabel&&(!p.labelExcludeUA||!p.labelExcludeUA.length||!e.map(p.labelExcludeUA,function(e){return t.UA[e]?!0:null}).length):1==c,h.on("contextmenu",function(e){e.stopPropagation(),e.preventDefault(),t.trigger("contextmenu",{raw:[{label:t.i18n("textLabel"),icon:"accept",callback:function(){c=!c,h.height("").find(".elfinder-button-text")[c?"show":"hide"](),t.trigger("uiresize").storage("toolbarTextLabel",c?"1":"0")}}],x:e.pageX,y:e.pageY})}).on("touchstart",function(e){e.originalEvent.touches.length>1||(h.data("tmlongtap")&&clearTimeout(h.data("tmlongtap")),h.removeData("longtap").data("longtap",{x:e.originalEvent.touches[0].pageX,y:e.originalEvent.touches[0].pageY}).data("tmlongtap",setTimeout(function(){h.removeData("longtapTm").trigger({type:"contextmenu",pageX:h.data("longtap").x,pageY:h.data("longtap").y}).data("longtap",{longtap:!0})},500)))}).on("touchmove touchend",function(e){h.data("tmlongtap")&&(("touchend"===e.type||Math.abs(h.data("longtap").x-e.originalEvent.touches[0].pageX)+Math.abs(h.data("longtap").y-e.originalEvent.touches[0].pageY)>4)&&clearTimeout(h.data("tmlongtap")),h.removeData("longtapTm"))}).on("click",function(e){h.data("longtap")&&h.data("longtap").longtap&&(e.stopImmediatePropagation(),e.preventDefault())}).on("touchend click",".elfinder-button",function(e){h.data("longtap")&&h.data("longtap").longtap&&(e.stopImmediatePropagation(),e.preventDefault())}),h.prev().length&&h.parent().prepend(this),m(),t.bind("open sync select",function(){var n,i,a=t.option("disabled");if("select"===this.type){if(t.searchStatus.state<2)return;i=t.selected(),i.length&&(a=t.getDisabledCmds(i))}Object.keys(t.commandMap).length&&e.each(t.commandMap,function(e,t){"hidden"===t&&a.push(e)}),b&&b.toString()===a.sort().toString()||(m(a&&a.length?a:null),n=!0),b=a.concat().sort(),(n||y!==JSON.stringify(t.commandMap))&&(y=JSON.stringify(t.commandMap),n||e.each(e("div.elfinder-button"),function(){var t=e(this).data("origin");t&&e(this).after(t).detach()}),Object.keys(t.commandMap).length&&e.each(t.commandMap,function(n,i){var a,r=t._commands[i],o=r?"elfinder"+r.options.ui:null;o&&e.fn[o]&&(a=g[n],a&&(!g[i]&&e.fn[o]&&(g[i]=e("<div/>")[o](t._commands[i]),g[i]&&(c&&g[i].find(".elfinder-button-text").show(),r.extendsCmd&&g[i].children("span.elfinder-button-icon").addClass("elfinder-button-icon-"+r.extendsCmd))),g[i]&&(a.after(g[i]),g[i].data("origin",a.detach()))))}))}),t.UA.Touch&&(d=t.storage("autoHide")||{},"undefined"==typeof d.toolbar&&(d.toolbar=p.autoHideUA&&p.autoHideUA.length>0&&e.map(p.autoHideUA,function(e){return t.UA[e]?!0:null}).length,t.storage("autoHide",d)),d.toolbar&&t.one("init",function(){t.uiAutoHide.push(function(){h.stop(!0,!0).trigger("toggle",{duration:500,init:!0})})}),t.bind("load",function(){l=e('<div class="elfinder-toolbar-swipe-handle"/>').hide().appendTo(t.getUI()),"none"!==l.css("pointer-events")&&(l.remove(),l=null)}),h.on("toggle",function(e,n){var i=t.getUI("workzone"),a=h.is(":hidden"),r=i.height(),o=h.height(),s=h.outerHeight(!0),c=s-o,u=Object.assign({step:function(e){i.height(r+(a?-1*(e+c):o-e)),t.trigger("resize")},always:function(){h.css("height",""),t.trigger("uiresize"),l&&(a?l.stop(!0,!0).hide():(l.height(n.handleH?n.handleH:""),t.resources.blink(l,"slowonce"))),n.init&&t.trigger("uiautohide")}},n);h.data("swipeClose",!a).stop(!0,!0).animate({height:"toggle"},u),d.toolbar=!a,t.storage("autoHide",Object.assign(t.storage("autoHide"),{toolbar:d.toolbar}))}))}),this},e.fn.elfindertree=function(t,n){var i=t.res("class","tree");return this.not("."+i).each(function(){var a,r,o="class",s=t.UA.Mobile,l=t.res(o,"treeroot"),d=n.openRootOnLoad,c=n.openCwdOnOpen,u=c||n.syncTree,h=t.res(o,"navsubtree"),p=t.res(o,"treedir"),f="span."+p,m=t.res(o,"navcollapse"),g=t.res(o,"navexpand"),v="elfinder-subtree-loaded",b="elfinder-subtree-chksubdir",y=t.res(o,"navarrow"),w=t.res(o,"active"),k=t.res(o,"adroppable"),x=t.res(o,"hover"),C=t.res(o,"disabled"),T=t.res(o,"draggable"),A=t.res(o,"droppable"),z="elfinder-navbar-wrapper-root",I="elfinder-navbar-wrapper-pastable",O="elfinder-navbar-wrapper-uploadable",S=function(e){var t=re.offset().left;return e>=t&&e<=t+re.width()},U={},M=[],D=function(n){var i=[];return e.each(n,function(e,n){U[n]&&i.push(t.navId2Hash(n)),delete U[n]}),i.length?t.request({data:{cmd:"subdirs",targets:i,preventDefault:!0}}).done(function(n){n&&n.subdirs&&e.each(n.subdirs,function(n,i){var a=e("#"+t.navHash2Id(n));a.removeClass(b),a[i?"addClass":"removeClass"](m)})}):void 0},E=null,F=function(){var n=Object.keys(U);n.length&&(E&&E._abort(),a&&clearTimeout(a),M=[],E=t.asyncJob(function(n){return t.isInWindow(e("#"+n))?n:null},n,{numPerOnce:200}).done(function(e){e.length&&(M=e,j())}))},P=0,j=function(){var e,t=n.subdirsMaxConn-P;if(a&&clearTimeout(a),M.length)if(t>0)for(e=0;t>e;e++)M.length&&(P++,D(M.splice(0,n.subdirsAtOnce)).always(function(){P--,j()}));else a=setTimeout(function(){M.length&&j()},50)},R=t.droppable.drop,H=e.extend(!0,{},t.droppable,{over:function(n,i){var a,r,o=e(this),s=i.helper,l=x+" "+k;return n.stopPropagation(),s.data("dropover",s.data("dropover")+1),o.data("dropover",!0),i.helper.data("namespace")===t.namespace&&S(n.clientX)&&t.insideWorkzone(n.pageX,n.pageY)?(o.addClass(x),o.is("."+m+":not(."+g+")")&&o.data("expandTimer",setTimeout(function(){o.is("."+m+"."+x)&&o.children("."+y).click();
|
||
},500)),o.is(".elfinder-ro,.elfinder-na")?(o.removeClass(k),void s.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus")):(a=t.navId2Hash(o.attr("id")),o.data("dropover",a),e.each(i.helper.data("files"),function(e,n){return n===a||t.file(n).phash===a&&!i.helper.hasClass("elfinder-drag-helper-plus")?(o.removeClass(l),!1):void 0}),s.data("locked")?r="elfinder-drag-helper-plus":(r="elfinder-drag-helper-move",(n.shiftKey||n.ctrlKey||n.metaKey)&&(r+=" elfinder-drag-helper-plus")),o.hasClass(k)&&s.addClass(r),void setTimeout(function(){o.hasClass(k)&&s.addClass(r)},20))):(o.removeClass(l),void s.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus"))},out:function(t,n){var i=e(this),a=n.helper;t.stopPropagation(),a.removeClass("elfinder-drag-helper-move elfinder-drag-helper-plus").data("dropover",Math.max(a.data("dropover")-1,0)),i.data("expandTimer")&&clearTimeout(i.data("expandTimer")),i.removeData("dropover").removeClass(x+" "+k)},deactivate:function(){e(this).removeData("dropover").removeClass(x+" "+k)},drop:function(e,t){S(e.clientX)&&R.call(this,e,t)}}),N=e(t.res("tpl","navspinner")),q=t.res("tpl","navdir"),_=t.res("tpl","perms"),L=(t.res("tpl","lock"),t.res("tpl","symlink")),W={},$={id:function(e){return t.navHash2Id(e.hash)},name:function(e){return t.escape(e.i18||e.name)},cssclass:function(e){var i=(e.phash&&!e.isroot?"":l)+" "+p+" "+t.perms2class(e);return e.dirs&&!e.link&&(i+=" "+m)&&-1==e.dirs&&(i+=" "+b),n.getClass&&(i+=" "+n.getClass(e)),e.csscls&&(i+=" "+t.escape(e.csscls)),i},root:function(t){var n="";return!t.phash||t.isroot?(n+=" "+z,!t.disabled||t.disabled.length<1?n+=" "+I+" "+O:(-1===e.inArray("paste",t.disabled)&&(n+=" "+I),-1===e.inArray("upload",t.disabled)&&(n+=" "+O)),n):""},permissions:function(e){return e.read&&e.write?"":_},symlink:function(e){return e.alias?L:""},style:function(e){return e.icon?t.getIconStyle(e):""}},B=function(e){return q.replace(/(?:\{([a-z]+)\})/gi,function(t,n){var i=$[n]?$[n](e):e[n]||"";return"id"===n&&-1==e.dirs&&(U[i]=i),i})},V=function(t){return e.map(t||[],function(e){return"directory"==e.mime?e:null})},K=function(n){return n?e("#"+t.navHash2Id(n)).next("."+h):ie},G=function(e,n){for(var i,a=e.children(":first");a.length;){if(i=t.file(t.navId2Hash(a.children("[id]").attr("id"))),(i=t.file(t.navId2Hash(a.children("[id]").attr("id"))))&&Y(n,i)<0)return a;a=a.next()}return e.children("button.elfinder-navbar-pager-next")},J=function(i){for(var a,r,o,l,d,c,u=i.length,h=[],p=u,f=e(),m={},g=t.cwd(),b=function(i,a,r,o){var l={},d=0,c=t.newAPI?Math.min(1e4,Math.max(10,n.subTreeMax)):1e4,u=function(){l={},e.each(a,function(e,t){l[t.hash]=e})},h=function(t){"prepare"===t?e.each(a,function(e,t){t.node&&i.append(t.node.hide())}):"done"===t&&e.each(a,function(e,t){t.node&&t.node.detach().show()})},p=function(t,n){var i;return t.stopPropagation(),n.select?void b(f(n.select)):n.change?void h(n.change):(n.removed&&n.removed.length&&(a=e.map(a,function(e){return-1===n.removed.indexOf(e.hash)?e:(i=!0,null)})),n.added&&n.added.length&&(a=a.concat(e.map(n.added,function(e){return void 0===l[e.hash]?(i=!0,e):null}))),void(i&&(a.sort(Y),u(),b(d))))},f=function(e){return void 0!==l[e]?Math.floor(l[e]/c)*c:void 0},m=t.navId2Hash(i.prev("[id]").attr("id")),b=function(n,r){var o,l,h,v,w,k,x,C,T=[],A={};delete W[m],d=n,i.off("update."+t.namespace,p),a.length>c&&(i.on("update."+t.namespace,p),void 0===n&&(h=0,u(),n=f(g.hash),void 0===n&&(n=0)),v=a.slice(n,n+c),W[m]=i,w=n?Math.max(-1,n-c):-1,k=n+c>=a.length?0:n+c,o=Math.ceil(a.length/c),l=Math.ceil(n/c)),e.each(v||a,function(e,t){T.push(B(t)),t.node&&(A[t.hash]=t.node)}),x=w>-1?e('<button class="elfinder-navbar-pager elfinder-navbar-pager-prev"/>').text(t.i18n("btnPrevious",l,o)).button({icons:{primary:"ui-icon-caret-1-n"}}).on("click",function(e){e.preventDefault(),e.stopPropagation(),b(w,"up")}):e(),C=k?e('<button class="elfinder-navbar-pager elfinder-navbar-pager-next"/>').text(t.i18n("btnNext",l+2,o)).button({icons:{primary:"ui-icon-caret-1-s"}}).on("click",function(e){e.preventDefault(),e.stopPropagation(),b(k,"down")}):e(),y(),i.empty()[v?"addClass":"removeClass"]("elfinder-navbar-hasmore").append(x,T.join(""),C),e.each(A,function(n,i){e("#"+t.navHash2Id(n)).parent().replaceWith(i)}),r&&X(t.navHash2Id(v["up"===r?v.length-1:0].hash)),!s&&t.lazy(function(){te(null,i)})},y=function(){e.each(i.children(".elfinder-navbar-wrapper"),function(n,i){var r,o,i=e(i),s=i.children("[id]:first");s.hasClass(v)&&(r=t.navId2Hash(s.attr("id")),r&&void 0!==(o=l[r])&&(a[o].node=i.detach()))})};b()},y={},w=[],k=!0;p--;)a=i[p],m[a.hash]||e("#"+t.navHash2Id(a.hash)).length||(m[a.hash]=!0,(r=K(a.phash)).length?a.phash&&((l=!r.children().length)||r.hasClass("elfinder-navbar-hasmore")||(o=G(r,a)).length)?l?(y[a.phash]||(y[a.phash]=[]),y[a.phash].push(a)):o?(c=B(a),o.before(c),!s&&(f=f.add(c))):w.push(a):(c=B(a),r[k||a.phash?"append":"prepend"](c),k=!1,a.phash&&!a.isroot||(d=e("#"+t.navHash2Id(a.hash)).parent()),!s&&te(null,d)):h.push(a));return Object.keys(y).length&&e.each(y,function(e,t){var n=K(e);t.sort(Y),b(n,t)}),w.length&&r.trigger("update."+t.namespace,{added:w}),h.length&&h.length<u?void J(h):void(!s&&f.length&&t.lazy(function(){te(f)}))},Y=function(e,n){if(t.sortAlsoTreeview){var i,a="asc"==t.sortOrder,r=t.sortType,o=t.sortRules;return i=a?o[t.sortType](e,n):o[t.sortType](n,e),"name"!==r&&0===i?i=a?o.name(e,n):o.name(n,e):i}return t.sortRules.name(e,n)},X=function(n){var i,a,r,o,s,l,d=e(this),u=e.Deferred();return d.data("autoScrTm")&&clearTimeout(d.data("autoScrTm")),d.data("autoScrTm",setTimeout(function(){i=e("#"+(n||t.navHash2Id(t.cwd().hash))),i.length?((c?i:i.parent()).parents(".elfinder-navbar-wrapper").children("."+v).addClass(g).next("."+h).show(),a=ie.parent().stop(!1,!0),r=a.offset().top,o=a.height(),s=r+o-i.outerHeight(),l=i.offset().top,r>l||l>s?a.animate({scrollTop:a.scrollTop()+l-r-o/3},{duration:"fast",complete:function(){u.resolve()}}):u.resolve()):u.reject()},100)),u},Z=function(n){var i,a,n,r=n||t.cwd(),o=[r.hash];for(a=t.root(r.hash),n=t.file(a);(i=n.phash)&&(o.unshift(i),a=t.root(i),n=t.file(a),!e("#"+t.navHash2Id(n.hash)).hasClass(v)););return o},Q=function(n){var n=n||t.cwd(),i=n.hash,a=e("#"+t.navHash2Id(i));if(!a.length){for(;n&&n.phash;)W[n.phash]&&!e("#"+t.navHash2Id(n.hash)).length&&W[n.phash].trigger("update."+t.namespace,{select:n.hash}),n=t.file(n.phash);a=e("#"+t.navHash2Id(i))}return a},ee=function(n,i){var a,r,o=t.cwd(),s=o.hash,i=void 0===i?u:i,l=function(n){var o,s,l=e.Deferred(),d=[],c=Z(n),u=function(e,n,i){var a={cmd:e,target:n};return i&&(a.until=i),t.request({data:a,preventFail:!0})};return d=e.map(c,function(n){var i,a,r=t.file(n),s=r?t.isRoot(r):!1,l=e("#"+t.navHash2Id(n)),d=function(e,n){var i,a,n=n||1;return a=(i=t.file(e))?i.phash:!1,a&&n>1?d(a,--n):a},c=function(){var a=d(n);for(i=a;a&&!e("#"+t.navHash2Id(a)).hasClass(v);)i=a,a=d(a);return a||(i=void 0,a=t.root(n)),a}();return l.hasClass(v)||!s&&r&&e("#"+t.navHash2Id(r.phash)).hasClass(v)?null:(s||c===d(n)||c===d(n,2)?(i=void 0,a="tree",s||(n=d(n))):a="parents",o||(o="tree"===a?n:c),u(a,n,i))}),d.length?(Q(t.file(o)),s=t.navHash2Id(o),i&&X(s),a=e("#"+s),r=e(t.res("tpl","navspinner")).insertBefore(a.children("."+y)),a.removeClass(m),e.when.apply(e,d).done(function(){var e,t,n,i={};if(t=arguments.length,t>0)for(n=0;t>n;n++)e=arguments[n].tree||[],i[c[n]]=Object.assign([],V(e));l.resolve(i)}).fail(function(){l.reject()}),l):l.resolve()},c=function(r,s){var l,c=function(){F(),d&&a&&(K(a.hash).show().prev(f).addClass(g),d=!1),i&&X()};r&&e.each(r,function(e,n){n&&J(n),Q(t.file(e)),n&&ne(n,v)}),n&&(t.api<2.1&&n.push(o),J(n)),l=Q(),l.hasClass(w)||(ie.find(f+"."+w).removeClass(w),l.addClass(w)),l.parents(".elfinder-navbar-wrapper").children("."+p).addClass(v),r?t.lazy(c).done(function(){s.resolve()}):(c(),s.resolve())},h=function(e){a&&(r.remove(),a.addClass(m+(e?"":" "+v)))},b=e.Deferred();return e("#"+t.navHash2Id(s)).length?c(void 0,b):l().done(function(e){c(e,b),h()}).fail(function(){h(!0),b.reject()}),b},te=function(n,i){n||(i&&!i.closest("div."+z).hasClass(O)||(i||ie.find("div."+O)).find(f+":not(.elfinder-ro,.elfinder-na)").addClass("native-droppable"),n=!i||i.closest("div."+z).hasClass(I)?(i||ie.find("div."+I)).find(f+":not(."+A+")"):e(),i&&i.children("div."+z).each(function(){te(null,e(this))})),n.length&&t.asyncJob(function(t){e(t).droppable(H)},e.makeArray(n),{interval:20,numPerOnce:100})},ne=function(n,i){var a=i==v?"."+m+":not(."+v+")":":not(."+m+")";e.each(n,function(n,r){e("#"+t.navHash2Id(r.phash)+a).filter(function(){return e.map(e(this).next("."+h).children(),function(t){return e(t).children().hasClass(l)?null:t}).length>0}).addClass(i)})},ie=e(this).addClass(i).on("mouseenter mouseleave",f,function(n){var i="mouseenter"===n.type;if(!i||!ae){var a=e(this);a.hasClass(k+" "+C)||(s||!i||a.data("dragRegisted")||a.hasClass(l+" "+T+" elfinder-na elfinder-wo")||(a.data("dragRegisted",!0),t.isCommandEnabled("copy",t.navId2Hash(a.attr("id")))&&a.draggable(t.draggable)),a.toggleClass(x,i))}}).on("dragenter",f,function(t){if(t.originalEvent.dataTransfer){var n=e(this);n.addClass(x),n.is("."+m+":not(."+g+")")&&n.data("expandTimer",setTimeout(function(){n.is("."+m+"."+x)&&n.children("."+y).click()},500))}}).on("dragleave",f,function(t){if(t.originalEvent.dataTransfer){var n=e(this);n.data("expandTimer")&&clearTimeout(n.data("expandTimer")),n.removeClass(x)}}).on("click",f,function(n){var i=e(this),a=t.navId2Hash(i.attr("id"));t.file(a);return i.data("longtap")?void n.stopPropagation():void(a==t.cwd().hash||i.hasClass(C)?(i.hasClass(m)&&i.children("."+y).click(),t.select({selected:[a],origin:"tree"})):t.exec("open",a).done(function(){t.select({selected:[a],origin:"tree"})}))}).on("touchstart",f,function(n){if(!(n.originalEvent.touches.length>1))var i=n.originalEvent,a=e(this).addClass(x).data("longtap",null).data("tmlongtap",setTimeout(function(e){a.data("longtap",!0),t.trigger("contextmenu",{type:"navbar",targets:[t.navId2Hash(a.attr("id"))],x:i.touches[0].pageX,y:i.touches[0].pageY})},500))}).on("touchmove touchend",f,function(t){clearTimeout(e(this).data("tmlongtap")),"touchmove"==t.type&&e(this).removeClass(x)}).on("click",f+"."+m+" ."+y,function(n){var i,a=e(this),r=a.parent(f),o=r.next("."+h),s=e.Deferred(),l=30;n.stopPropagation(),r.hasClass(v)?(r.toggleClass(g),t.lazy(function(){i=r.hasClass(g)?o.children().length+o.find("div.elfinder-navbar-subtree[style*=block]").children().length:o.find("div:visible").length,i>l?(o.toggle(),t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1),F()):o.stop(!0,!0).slideToggle("normal",function(){t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1),F()})}).always(function(){s.resolve()})):(N.insertBefore(a),r.removeClass(m),t.request({cmd:"tree",target:t.navId2Hash(r.attr("id"))}).done(function(e){J(Object.assign([],V(e.tree))),o.children().length&&(r.addClass(m+" "+g),o.children().length>l?(o.show(),t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1),F()):o.stop(!0,!0).slideDown("normal",function(){t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1),F()}))}).always(function(e){N.remove(),r.addClass(v),t.one("treedone",function(){s.resolve()})})),a.data("dfrd",s)}).on("contextmenu",f,function(n){var i=e(this);n.preventDefault(),t.trigger("contextmenu",{type:"navbar",targets:[t.navId2Hash(e(this).attr("id"))],x:n.pageX,y:n.pageY}),i.addClass("ui-state-hover"),t.getUI("contextmenu").children().on("mouseenter",function(){i.addClass("ui-state-hover")}),t.bind("closecontextmenu",function(){i.removeClass("ui-state-hover")})}).on("scrolltoview",f,function(){var n=e(this);X(n.attr("id")).done(function(){t.resources.blink(n,"lookme")})}).on("create."+t.namespace,function(n,i){var a=K(i.phash),r=i.move||!1,o=e(B(i)).addClass("elfinder-navbar-wrapper-tmp"),s=t.selected();r&&s.length&&t.trigger("lockfiles",{files:s}),a.prepend(o)}),ae=!1,re=t.getUI("navbar").append(ie).show().on("scroll",function(){ae=!0,r&&clearTimeout(r),r=setTimeout(function(){ae=!1,F()},50)}),oe=t.sortAlsoTreeview;t.open(function(e){var n=e.data,i=V(n.files),a=t.getUI("contextmenu");n.init&&ie.empty(),t.UA.iOS&&re.removeClass("overflow-scrolling-touch").addClass("overflow-scrolling-touch"),i.length?t.lazy(function(){a.data("cmdMaps")||a.data("cmdMaps",{}),J(i),ne(i,v),ee(i)}):ee()}).add(function(e){var t=V(e.data.added);t.length&&(J(t),ne(t,m))}).change(function(n){var i,a,r,o,l,d,c,u,p,m,b,y,w=V(n.data.changed),k=w.length,x=k;e();for(e.each(W,function(e,n){n.trigger("update."+t.namespace,{change:"prepare"})});x--;)if(i=w[x],a=i.phash,(r=e("#"+t.navHash2Id(i.hash))).length){if(b=r.parent(),a){if(l=r.closest("."+h),d=K(a),c=r.parent().next(),u=G(d,i),!d.length)continue;d[0]===l[0]&&c.get(0)===u.get(0)||(u.length?u.before(b):d.append(b))}p=r.hasClass(g),m=r.hasClass(v),o=e(B(i)),r.replaceWith(o.children(f)),!s&&te(null,b),i.dirs&&(p||m)&&(r=e("#"+t.navHash2Id(i.hash)))&&r.next("."+h).children().length&&(p&&r.addClass(g),m&&r.addClass(v)),y|=-1==i.dirs}y&&F(),e.each(W,function(e,n){n.trigger("update."+t.namespace,{change:"done"})}),ee(void 0,!1)}).remove(function(n){var i,a,r=n.data.removed,o=r.length;for(e.each(W,function(e,n){n.trigger("update."+t.namespace,{removed:r}),n.trigger("update."+t.namespace,{change:"prepare"})});o--;)(i=e("#"+t.navHash2Id(r[o]))).length&&(a=i.closest("."+h),i.parent().detach(),a.children().length||a.hide().prev(f).removeClass(m+" "+g+" "+v));e.each(W,function(e,n){n.trigger("update."+t.namespace,{change:"done"})})}).bind("lockfiles unlockfiles",function(n){var i="lockfiles"==n.type,a=n.data.helper?n.data.helper.data("locked"):!1,r=i&&!a?"disable":"enable",o=e.map(n.data.files||[],function(e){var n=t.file(e);return n&&"directory"==n.mime?e:null});e.each(o,function(n,o){var s=e("#"+t.navHash2Id(o));s.length&&!a&&(s.hasClass(T)&&s.draggable(r),s.hasClass(A)&&s.droppable(r),s[i?"addClass":"removeClass"](C))})}).bind("sortchange",function(){if(t.sortAlsoTreeview||oe!==t.sortAlsoTreeview){var n,i,a=[],r={},o={},s="",l=!1;t.lazy(function(){n=V(t.files()),oe=t.sortAlsoTreeview,ie.empty(),J(e.map(t.roots,function(e){var n=t.file(e);return n&&t.isRoot(n)?n:null})),Object.keys(W).length?(a=Z(),a.length>1?(e.each(a,function(e,n){var i=t.file(t.root(n)).volumeid;0===e&&(s=i),o[i]=n,r[n]=[]}),e.each(n,function(e,t){return t.volumeid?void r[o[t.volumeid]||o[s]].push(t):(l=!0,!1)})):l=!0,l?e.each(a,function(e,a){J(n),i=Q(t.file(a)),ne(n,v)}):e.each(r,function(e,n){J(n),i=Q(t.file(e)),ne(n,v)})):(J(n),i=Q(),ne(n,v)),ee()},100)}})}),this},e.fn.elfinderuploadbutton=function(t){return this.each(function(){var n=e(this).elfinderbutton(t).off("click"),i=e("<form/>").appendTo(n),a=e('<input type="file" multiple="true" title="'+t.fm.i18n("selectForUpload")+'"/>').change(function(){var n=e(this);n.val()&&(t.exec({input:n.remove()[0]}),a.clone(!0).appendTo(i))}).on("dragover",function(e){e.originalEvent.dataTransfer.dropEffect="copy"});i.append(a.clone(!0)),t.change(function(){i[t.disabled()?"hide":"show"]()}).change()})},e.fn.elfinderviewbutton=function(t){return this.each(function(){var n=e(this).elfinderbutton(t),i=n.children(".elfinder-button-icon");t.change(function(){var e="icons"==t.value;i.toggleClass("elfinder-button-icon-view-list",e),t.className=e?"view-list":"",t.title=t.fm.i18n(e?"viewlist":"viewicons"),n.attr("title",t.title)})})},e.fn.elfinderworkzone=function(t){var n="elfinder-workzone";return this.not("."+n).each(function(){var i=e(this).addClass(n),a=i.outerHeight(!0)-i.height(),r=Math.round(i.height()),o=i.parent(),s=function(){var s=o.height()-a,l=o.attr("style"),d=Math.round(i.height());o.css("overflow","hidden").children(":visible:not(."+n+")").each(function(){var t=e(this);"absolute"!=t.css("position")&&"fixed"!=t.css("position")&&(s-=t.outerHeight(!0))}),o.attr("style",l||""),s=Math.max(0,Math.round(s)),r===s&&d===s||(r=Math.round(i.height()),i.height(s),t.trigger("wzresize"))};o.add(window).on("resize."+t.namespace,s),t.one("cssloaded",function(){a=i.outerHeight(!0)-i.height(),s()}).bind("uiresize",s)}),this},i.prototype.commands.archive=function(){var t,n=this,i=n.fm,a=[];this.variants=[],this.disableOnSearch=!1,this.nextAction={},i.bind("open reload",function(){n.variants=[],e.each(a=i.option("archivers").create||[],function(e,t){n.variants.push([t,i.mime2kind(t)])}),n.change()}),this.getstate=function(n){var r,n=this.files(n),o=n.length,s=o&&!i.isRoot(n[0])&&(i.file(n[0].phash)||{}).write&&!e.map(n,function(e){return e.read?null:!0}).length;return s&&i.searchStatus.state>1&&(r=i.cwd().volumeid,s=o===e.map(n,function(e){return e.read&&0===e.hash.indexOf(r)?e:null}).length),s&&!this._disabled&&a.length&&(o||t&&"pending"==t.state())?0:-1},this.exec=function(r,o){var s,l,d=this.files(r),c=d.length,u=o||a[0],h=i.file(d[0].phash)||null,p=["errArchive","errPerm","errCreatingTempDir","errFtpDownloadFile","errFtpUploadFile","errFtpMkdir","errArchiveExec","errExtractExec","errRm"];if(t=e.Deferred().fail(function(e){e&&i.error(e)}),!c||!a.length||-1===e.inArray(u,a))return t.reject();if(!h.write)return t.reject(p);for(s=0;c>s;s++)if(!d[s].read)return t.reject(p);return n.mime=u,n.prefix=(c>1?"Archive":d[0].name)+(i.option("archivers").createext?"."+i.option("archivers").createext[u]:""),n.data={targets:n.hashes(r),type:u},i.cwd().hash!==h.hash?l=i.exec("open",h.hash).done(function(){i.one("cwdrender",function(){i.selectfiles({files:r}),t=e.proxy(i.res("mixin","make"),n)()})}):(i.selectfiles({files:r}),t=e.proxy(i.res("mixin","make"),n)()),t}},(i.prototype.commands.back=function(){this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+left backspace"}],this.getstate=function(){return this.fm.history.canBack()?0:-1},this.exec=function(){return this.fm.history.back()}}).prototype={forceLoad:!0},i.prototype.commands.chmod=function(){this.updateOnSelect=!1;var t=this.fm,n={0:"owner",1:"group",2:"other"},i={read:t.i18n("read"),write:t.i18n("write"),execute:t.i18n("execute"),perm:t.i18n("perm"),kind:t.i18n("kind"),files:t.i18n("files")},a=function(e){return!isNaN(parseInt(e,8)&&parseInt(e,8)<=511)||e.match(/^([r-][w-][x-]){3}$/i)};this.tpl={main:'<div class="ui-helper-clearfix elfinder-info-title"><span class="elfinder-cwd-icon {class} ui-corner-all"/>{title}</div>{dataTable}',itemTitle:'<strong>{name}</strong><span id="elfinder-info-kind">{kind}</span>',groupTitle:"<strong>{items}: {num}</strong>",dataTable:'<table id="{id}-table-perm"><tr><td>{0}</td><td>{1}</td><td>{2}</td></tr></table><div class="">'+i.perm+': <input id="{id}-perm" type="text" size="4" maxlength="3" value="{value}"></div>',fieldset:'<fieldset id="{id}-fieldset-{level}"><legend>{f_title}{name}</legend><input type="checkbox" value="4" id="{id}-read-{level}-perm"{checked-r}> <label for="{id}-read-{level}-perm">'+i.read+'</label><br><input type="checkbox" value="6" id="{id}-write-{level}-perm"{checked-w}> <label for="{id}-write-{level}-perm">'+i.write+'</label><br><input type="checkbox" value="5" id="{id}-execute-{level}-perm"{checked-x}> <label for="{id}-execute-{level}-perm">'+i.execute+"</label><br>"},this.shortcuts=[{}],this.getstate=function(e){var t=this.fm;return e=e||t.selected(),0==e.length&&(e=[t.cwd().hash]),this.checkstate(this.files(e))?0:-1},this.checkstate=function(t){var n=t.length;if(!n)return!1;var i=e.map(t,function(e){return e.isowner&&e.perm&&a(e.perm)&&(1==n||"directory"!=e.mime)?e:null}).length;return n==i},this.exec=function(t){var r=this.files(t);r.length||(t=[this.fm.cwd().hash],r=this.files(t));var o,s,l=this.fm,d=e.Deferred().always(function(){l.enable()}),c=this.tpl,t=this.hashes(t),u=r.length,h=r[0],p=l.namespace+"-perm-"+h.hash,f=c.main,m=' checked="checked"',g=function(){var e={};return e[l.i18n("btnApply")]=v,e[l.i18n("btnCancel")]=function(){A.elfinderdialog("close")},e},v=function(){var n=e.trim(e("#"+p+"-perm").val());return a(n)?(A.elfinderdialog("close"),void l.request({data:{cmd:"chmod",targets:t,mode:n},notify:{type:"chmod",cnt:u}}).fail(function(e){d.reject(e)}).done(function(e){d.resolve(e)})):!1},b=function(){for(var t,i="",a=0;3>a;a++)t=0,e("#"+p+"-read-"+n[a]+"-perm").is(":checked")&&(t=4|t),e("#"+p+"-write-"+n[a]+"-perm").is(":checked")&&(t=2|t),e("#"+p+"-execute-"+n[a]+"-perm").is(":checked")&&(t=1|t),i+=t.toString(8);e("#"+p+"-perm").val(i)},y=function(t){for(var i,a=0;3>a;a++)i=parseInt(t.slice(a,a+1),8),e("#"+p+"-read-"+n[a]+"-perm").prop("checked",!1),e("#"+p+"-write-"+n[a]+"-perm").prop("checked",!1),e("#"+p+"-execute-"+n[a]+"-perm").prop("checked",!1),4==(4&i)&&e("#"+p+"-read-"+n[a]+"-perm").prop("checked",!0),2==(2&i)&&e("#"+p+"-write-"+n[a]+"-perm").prop("checked",!0),1==(1&i)&&e("#"+p+"-execute-"+n[a]+"-perm").prop("checked",!0);b()},w=function(e){for(var t,n,i,a="777",r="",o=e.length,s=0;o>s;s++){t=C(e[s].perm),r="";for(var l=0;3>l;l++)n=parseInt(t.slice(l,l+1),8),i=parseInt(a.slice(l,l+1),8),4!=(4&n)&&4==(4&i)&&(i-=4),2!=(2&n)&&2==(2&i)&&(i-=2),1!=(1&n)&&1==(1&i)&&(i-=1),r+=i.toString(8);a=r}return a},k=function(e){return e?":"+e:""},x=function(e,t){for(var a,r,o="",s=c.dataTable,d=0;3>d;d++)a=parseInt(e.slice(d,d+1),8),o+=a.toString(8),r=c.fieldset.replace("{f_title}",l.i18n(n[d])).replace("{name}",k(t[n[d]])).replace(/\{level\}/g,n[d]),s=s.replace("{"+d+"}",r).replace("{checked-r}",4==(4&a)?m:"").replace("{checked-w}",2==(2&a)?m:"").replace("{checked-x}",1==(1&a)?m:"");return s=s.replace("{value}",o).replace("{valueCaption}",i.perm)},C=function(e){if(isNaN(parseInt(e,8))){for(var t=e.split(""),n=[],i=0,a=t.length;a>i;i++)0===i||3===i||6===i?t[i].match(/[r]/i)?n.push(1):t[i].match(/[-]/)&&n.push(0):1===i||4===i||7===i?t[i].match(/[w]/i)?n.push(1):t[i].match(/[-]/)&&n.push(0):t[i].match(/[x]/i)?n.push(1):t[i].match(/[-]/)&&n.push(0);n.splice(3,0,","),n.splice(7,0,",");for(var r=n.join(""),o=r.split(","),s=[],l=0,d=o.length;d>l;l++){var c=parseInt(o[l],2).toString(8);s.push(c)}e=s.join("")}else e=parseInt(e,8).toString(8);return e},T={title:this.title,width:"auto",buttons:g(),close:function(){e(this).elfinderdialog("destroy")}},A=l.getUI().find("#"+p),z="";return A.length?(A.elfinderdialog("toTop"),e.Deferred().resolve()):(f=f.replace("{class}",u>1?"elfinder-cwd-icon-group":l.mime2class(h.mime)),u>1?o=c.groupTitle.replace("{items}",l.i18n("items")).replace("{num}",u):(o=c.itemTitle.replace("{name}",h.name).replace("{kind}",l.mime2kind(h)),z=l.tmb(h)),s=x(w(r),1==r.length?r[0]:{}),f=f.replace("{title}",o).replace("{dataTable}",s).replace(/{id}/g,p),A=l.dialog(f,T),A.attr("id",p),z&&e("<img/>").on("load",function(){A.find(".elfinder-cwd-icon").addClass(z.className).css("background-image","url('"+z.url+"')")}).attr("src",z.url),e("#"+p+"-table-perm :checkbox").on("click",function(){b("perm")}),e("#"+p+"-perm").on("keydown",function(t){var n=t.keyCode;return t.stopPropagation(),n==e.ui.keyCode.ENTER?void v():void 0}).on("focus",function(t){e(this).select()}).on("keyup",function(t){3==e(this).val().length&&(e(this).select(),y(e(this).val()))}),d)}},i.prototype.commands.colwidth=function(){this.alwaysEnabled=!0,this.updateOnSelect=!1,this.getstate=function(){return"fixed"===this.fm.getUI("cwd").find("table").css("table-layout")?0:-1},this.exec=function(){this.fm.getUI("cwd").trigger("colwidth")}},i.prototype.commands.copy=function(){this.shortcuts=[{pattern:"ctrl+c ctrl+insert"}],this.getstate=function(t){var t=this.files(t),n=t.length;return n&&e.map(t,function(e){return e.read?e:null}).length==n?0:-1},this.exec=function(t){var n=this.fm,i=e.Deferred().fail(function(e){n.error(e)});return e.each(this.files(t),function(e,t){return t.read?void 0:!i.reject(["errCopy",t.name,"errPerm"])}),"rejected"==i.state()?i:i.resolve(n.clipboard(this.hashes(t)))}},i.prototype.commands.cut=function(){var t=this.fm;this.shortcuts=[{pattern:"ctrl+x shift+insert"}],this.getstate=function(n){var n=this.files(n),i=n.length;return i&&e.map(n,function(e){return!e.read||e.locked||t.isRoot(e)?null:e}).length==i?0:-1},this.exec=function(n){var i=e.Deferred().fail(function(e){t.error(e)});return e.each(this.files(n),function(e,n){return!n.read||n.locked||t.isRoot(n)?!i.reject(["errCopy",n.name,"errPerm"]):n.locked?!i.reject(["errLocked",n.name]):void 0}),"rejected"==i.state()?i:i.resolve(t.clipboard(this.hashes(n),!0))}},i.prototype.commands.zipdl=function(){},i.prototype.commands.download=function(){var t=this,n=this.fm,i=null,a=!1,r=!1,o=function(o,s){var l,d;if(null!==i&&(n.searchStatus.state>1?r=n.searchStatus.mixed:n.leafRoots[n.cwd().hash]&&(l=n.cwd().volumeid,e.each(o,function(e,t){return 0!==t.indexOf(l)?(r=!0,!1):void 0})),a=n.isCommandEnabled("zipdl",o[0])),r){if(d=i?"zipdl":"download",o=e.map(o,function(t){var a=n.file(t),r=a&&(i||"directory"!==a.mime)&&n.isCommandEnabled(d,t)?t:null;return a&&s&&!r&&e("#"+n.cwdHash2Id(a.hash)).trigger("unselect"),r}),!o.length)return[]}else if(!n.isCommandEnabled("download",o[0]))return[];return e.map(t.files(o),function(t){var i=!t.read||!a&&"directory"==t.mime?null:t;return s&&!i&&e("#"+n.cwdHash2Id(t.hash)).trigger("unselect"),i})};this.linkedCmds=["zipdl"],this.shortcuts=[{pattern:"shift+enter"}],this.getstate=function(e){var e=this.hashes(e),t=e.length,i=this.options.maxRequests||10;return 1>t?-1:(t=o(e).length,t&&(a||i>=t&&(!n.UA.IE&&!n.UA.Mobile||1==t))?0:-1)},n.bind("contextmenu",function(n){var i,a,r=t.fm,o=null,s=function(t){var n=t.url||r.url(t.hash);return{icon:"link",node:e("<a/>").attr({href:n,target:"_blank",title:r.i18n("link")}).text(t.name).on("mousedown click touchstart touchmove touchend contextmenu",function(e){e.stopPropagation()}).on("dragstart",function(n){var i=n.dataTransfer||n.originalEvent.dataTransfer||null;if(o=null,i){var a=function(t){var n,i=t.mime,a=r.tmb(t);return n='<div class="elfinder-cwd-icon '+r.mime2class(i)+' ui-corner-all"/>',a&&(n=e(n).addClass(a.className).css("background-image","url('"+a.url+"')").get(0).outerHTML),n};i.effectAllowed="copyLink",i.setDragImage&&(o=e('<div class="elfinder-drag-helper html5-native">').append(a(t)).appendTo(e(document.body)),i.setDragImage(o.get(0),50,47)),r.UA.IE||(i.setData("elfinderfrom",window.location.href+t.phash),i.setData("elfinderfrom:"+i.getData("elfinderfrom"),""))}}).on("dragend",function(e){o&&o.remove()})}};if(t.extra=null,n.data&&(i=n.data.targets||[],1===i.length&&(a=r.file(i[0]))&&"directory"!==a.mime))if("1"!=a.url)t.extra=s(a);else{var l;t.extra={icon:"link",node:e("<a/>").attr({href:"#",title:r.i18n("getLink"),draggable:"false"}).text(a.name).on("click touchstart",function(e){if(!("touchstart"===e.type&&e.originalEvent.touches.length>1)){var t=l.parent();e.stopPropagation(),e.preventDefault(),t.removeClass("ui-state-disabled").addClass("elfinder-button-icon-spinner"),r.request({data:{cmd:"url",target:a.hash},preventDefault:!0}).always(function(e){if(t.removeClass("elfinder-button-icon-spinner"),e.url){var n=r.file(a.hash);n.url=e.url,l.replaceWith(s(a).node)}else t.addClass("ui-state-disabled")})}})},l=t.extra.node,l.ready(function(){setTimeout(function(){l.parent().addClass("ui-state-disabled").css("pointer-events","auto")},10)})}}).one("open",function(){n.api>2&&(i=n.getCommand("zipdl"))}),this.exec=function(t){var n,i,s,l,t=this.hashes(t),d=this.fm,c=(d.options.url,o(t,!0)),u=e.Deferred(),h="",p={},f=!1,m=function(t){return function(){var n=e.Deferred(),a=d.file(d.root(t[0])),r=a?" ("+(a.i18||a.name)+")":"";return d.request({data:{cmd:"zipdl",targets:t},notify:{type:"zipdl",cnt:1,hideCnt:!0,msg:d.i18n("ntfzipdl")+r},cancel:!0,preventDefault:!0}).done(function(a){var r,o,s,c,u,h={},p="dlw"+ +new Date;a.error?(d.error(a.error),n.resolve()):a.zipdl&&(r=a.zipdl,f||!l&&d.UA.Mobile?(i=d.options.url+(-1===d.options.url.indexOf("?")?"?":"&")+"cmd=zipdl&download=1",e.each([t[0],r.file,r.name,r.mime],function(e,t){i+="&targets%5B%5D="+encodeURIComponent(t)}),e.each(d.options.customData,function(e,t){i+="&"+encodeURIComponent(e)+"="+encodeURIComponent(t)}),i+="&"+encodeURIComponent(r.name),s=e("<a/>").attr("href",i).attr("download",encodeURIComponent(r.name)).attr("target","_blank").on("click",function(){n.resolve(),o.elfinderdialog("destroy")}).append('<span class="elfinder-button-icon elfinder-button-icon-download"></span>'+d.escape(r.name)),h[d.i18n("btnCancel")]=function(){o.elfinderdialog("destroy")},o=d.dialog(s,{title:d.i18n("link"),buttons:h,width:"200px",destroyOnClose:!0,close:function(){"resolved"!==n.state()&&n.resolve()}})):(c=e('<form action="'+d.options.url+'" method="post" target="'+p+'" style="display:none"/>').append('<input type="hidden" name="cmd" value="zipdl"/>').append('<input type="hidden" name="download" value="1"/>'),e.each([t[0],r.file,r.name,r.mime],function(e,t){c.append('<input type="hidden" name="targets[]" value="'+d.escape(t)+'"/>')}),e.each(d.options.customData,function(e,t){c.append('<input type="hidden" name="'+e+'" value="'+d.escape(t)+'"/>')}),c.attr("target",p).appendTo("body"),u=e('<iframe style="display:none" name="'+p+'">').appendTo("body").ready(function(){c.submit().remove(),n.resolve(),setTimeout(function(){u.remove()},2e4)})))}).fail(function(e){e&&d.error(e),n.resolve()}),n.promise()}};if(!c.length)return u.reject();if(s=e("<a>").hide().appendTo(e("body")),l="string"==typeof s.get(0).download,a&&(c.length>1||"directory"===c[0].mime))return s.remove(),r?(f=d.UA.Mobile,p={},e.each(c,function(e,t){var n=t.hash.split("_",2);p[n[0]]?p[n[0]].push(t.hash):p[n[0]]=[t.hash]})):p=[e.map(c,function(e){return e.hash})],u=d.sequence(e.map(p,function(e){return m(e)})).always(function(){d.trigger("download",{files:c})});for(n=0;n<c.length;n++)i=d.openUrl(c[n].hash,!0),l?s.attr("href",i).attr("download",encodeURIComponent(c[n].name)).attr("target","_blank").get(0).click():d.UA.Mobile?setTimeout(function(){window.open(i)||d.error("errPopup")},100):h+='<iframe class="downloader" id="downloader-'+c[n].hash+'" style="display:none" src="'+i+'"/>';return s.remove(),e(h).appendTo("body").ready(function(){setTimeout(function(){e(h).each(function(){e("#"+e(this).attr("id")).remove()})},2e4+1e4*n)}),d.trigger("download",{files:c}),u.resolve()}},i.prototype.commands.duplicate=function(){var t=this.fm;this.getstate=function(n){var n=this.files(n),i=n.length;return i&&t.cwd().write&&e.map(n,function(e){return e.read&&e.phash===t.cwd().hash&&!t.isRoot(e)?e:null}).length==i?0:-1},this.exec=function(t){var n=this.fm,i=this.files(t),a=i.length,r=e.Deferred().fail(function(e){e&&n.error(e)});return a?(e.each(i,function(e,t){return t.read&&n.file(t.phash).write?void 0:!r.reject(["errCopy",t.name,"errPerm"])}),"rejected"==r.state()?r:n.request({data:{cmd:"duplicate",targets:this.hashes(t)},notify:{type:"copy",cnt:a},navigate:{toast:{inbuffer:{msg:n.i18n(["complete",n.i18n("cmdduplicate")])}}}})):r.reject()}},i.prototype.commands.edit=function(){var t=this,n=this.fm,i="elfinder-dialog-edit",a=n.res("mimes","text")||[],r=[],o=[],s=function(e){return e.replace(/\s+$/,"")},l=function(i){var a,r=e('<select class="ui-corner-all"/>');return i&&e.each(i,function(e,t){a=n.escape(t.value),r.append('<option value="'+a+'">'+(t.caption?n.escape(t.caption):a)+"</option>")}),e.each(t.options.encodings,function(e,t){r.append('<option value="'+t+'">'+t+"</option>")}),r},d=function(n){var i,s,l=n.length;return l>1&&(i=n[0].mime,s=n[0].name.replace(/^.*(\.[^.]+)$/,"$1")),e.map(n,function(n){return 0!==n.mime.indexOf("text/")&&-1===e.inArray(n.mime,a)&&-1===e.inArray(n.mime,1===l?r:o)||!n.mime.indexOf("text/rtf")||t.onlyMimes.length&&-1===e.inArray(n.mime,t.onlyMimes)||!n.read||!n.write||1!==l&&(n.mime!==i||n.name.substr(-1*s.length)!==s)?null:n})},c=function(r,o,d,c,h){var p,f,m,g,v,b=e.Deferred(),y=function(){var e,t=g?g.val():void 0;p.editor&&(p.editor.save(p[0],p.editor.instance),e=p.editor.confObj,e.info&&e.info.schemeContent&&(t="scheme")),f=A(),b.notifyWith(p,[t,p.data("hash")])},w=function(){p.elfinderdialog("close")},k=function(){y(),w()},x=function(){var a=f,r=function(){f=a,n.disable(),p.addClass(z)},s=function(){t.mime=o.mime,t.prefix=o.name.replace(/ \d+(\.[^.]+)?$/,"$1"),t.requestCmd="mkfile",
|
||
t.nextAction={cmd:"edit",msg:"cmdedit"},t.data={target:o.phash},e.proxy(n.res("mixin","make"),t)().done(function(e){e.added&&e.added.length?(p.data("hash",e.added[0].hash),y(),m.show(),w()):r()}).fail(r).always(function(){delete t.mime,delete t.prefix,delete t.nextAction,delete t.data,d.fadeIn()}),n.trigger("unselectfiles",{files:[o.hash]})},l=null,d=n.getUI().children("."+i).fadeOut();p.removeClass(z),n.enable(),n.searchStatus.state<2&&o.phash!==n.cwd().hash&&(l=n.exec("open",[o.phash],{thash:o.phash})),e.when([l]).done(function(){l?n.one("cwdrender",s):s()}).fail(r)},C=function(){return p.editor&&p.editor.save(p[0],p.editor.instance),f!==A()},T={title:n.escape(o.name),width:t.options.dialogWidth||Math.min(650,.9*e(window).width()),buttons:{},allowMinimize:!0,allowMaximize:!0,btnHoverFocus:!1,closeOnEscape:!1,close:function(){var i=function(){b.resolve(),p.editor&&p.editor.close(p[0],p.editor.instance),p.elfinderdialog("destroy")};n.toggleMaximize(e(this).closest(".ui-dialog"),!1),C()?n.confirm({title:t.title,text:"confirmNotSave",accept:{label:"btnSaveClose",callback:function(){y(),i()}},cancel:{label:"btnClose",callback:i},buttons:[{label:"btnSaveAs",callback:function(){setTimeout(x,10)}}]}):i()},open:function(){var e;if(p.initEditArea.call(p,r,o,d,n),f=A(),n.disable(),p.editor)if(e=p.editor.load(p[0])||null,e&&e.done)e.done(function(e){p.editor.instance=e,p.editor.focus(p[0],p.editor.instance),f=A()}).fail(function(e){e&&n.error(e),p.elfinderdialog("destroy")});else{if(e&&("string"==typeof e||Array.isArray(e)))return n.error(e),void p.elfinderdialog("destroy");p.editor.instance=e,p.editor.focus(p[0],p.editor.instance),f=A()}},resize:function(e,t){p.editor&&p.editor.resize(p[0],p.editor.instance,e,t||{})}},A=function(){return p.getContent.call(p,p[0])},z=n.res("class","editing");if(h&&(h.html&&(p=e(h.html)),v={init:h.init||null,load:h.load,getContent:h.getContent||null,save:h.save,close:"function"==typeof h.close?h.close:function(){},focus:"function"==typeof h.focus?h.focus:function(){},resize:"function"==typeof h.resize?h.resize:function(){},instance:null,doSave:y,doCancel:w,doClose:k,file:o,fm:n,confObj:h}),!p){if(0!==o.mime.indexOf("text/")&&-1===e.inArray(o.mime,a))return b.reject("errEditorNotFound");!function(){var t=function(){g&&(C()?g.attr("title",n.i18n("saveAsEncoding")).addClass("elfinder-edit-changed"):g.attr("title",n.i18n("openAsEncoding")).removeClass("elfinder-edit-changed"))};p=e('<textarea class="elfinder-file-edit" rows="20" id="'+r+'-ta"></textarea>').on("input propertychange",t),p.editor&&p.editor.info&&!p.editor.info.useTextAreaEvent||p.on("keydown",function(t){var n,i,a=t.keyCode;t.stopPropagation(),a==e.ui.keyCode.TAB&&(t.preventDefault(),this.setSelectionRange&&(n=this.value,i=this.selectionStart,this.value=n.substr(0,i)+" "+n.substr(this.selectionEnd),i+=1,this.setSelectionRange(i,i))),(t.ctrlKey||t.metaKey)&&(a!="Q".charCodeAt(0)&&a!="W".charCodeAt(0)||(t.preventDefault(),w()),a=="S".charCodeAt(0)&&(t.preventDefault(),y()))}).on("mouseenter",function(){this.focus()}),p.initEditArea=function(n,i,a){var r=c&&"unknown"!==c?[{value:c}]:[];p.val(a),""!==a&&c&&"UTF-8"===c||r.push({value:"UTF-8"}),g=l(r).on("touchstart",function(e){e.stopPropagation()}).on("change",function(){C()||""===A()||(w(),u(i,e(this).val(),h))}).on("mouseover",t),p.parent().prev().find(".elfinder-titlebar-button:last").after(e('<span class="elfinder-titlebar-button-right"/>').append(g)),p.focus(),p[0].setSelectionRange&&p[0].setSelectionRange(0,0)}}()}return p.addClass(z).data("hash",o.hash),v&&(p.editor=v,"function"==typeof v.init&&(p.initEditArea=v.init),"function"==typeof v.getContent&&(p.getContent=v.getContent)),p.initEditArea||(p.initEditArea=function(){}),p.getContent||(p.getContent=function(){return s(p.val())}),T.buttons[n.i18n("btnSave")]=y,T.buttons[n.i18n("btnSaveClose")]=k,T.buttons[n.i18n("btnSaveAs")]=x,T.buttons[n.i18n("btnCancel")]=w,m=n.dialog(p,T).attr("id",r).on("keydown keyup keypress",function(e){e.stopPropagation()}).closest(".ui-dialog").addClass(i),b.promise()},u=function(i,a,r){var o,s,d=i.hash,h=(n.options,e.Deferred()),p="edit-"+n.namespace+"-"+i.hash,f=n.getUI().find("#"+p),a=a?a:0;return f.length?(f.elfinderdialog("toTop"),h.resolve()):i.read&&i.write?(r&&r.info&&r.info.urlAsContent?(o=e.Deferred(),n.url(d,{async:!0,temporary:!0}).done(function(e){o.resolve({content:e})})):o=n.request({data:{cmd:"get",target:d,conv:a},notify:{type:"file",cnt:1},preventDefault:!0}),o.done(function(a){var o;a.doconv?n.confirm({title:t.title,text:"unknown"===a.doconv?"confirmNonUTF8":"confirmConvUTF8",accept:{label:"btnConv",callback:function(){h=u(i,o.val(),r)}},cancel:{label:"btnCancel",callback:function(){h.reject()}},optionsCallback:function(t){t.create=function(){var t=e('<div class="elfinder-dialog-confirm-encoding"/>'),i={value:a.doconv};"unknown"===a.doconv&&(i.caption="-"),o=l([i]),e(this).next().find(".ui-dialog-buttonset").prepend(t.append(e("<label>"+n.i18n("encoding")+" </label>").append(o)))}}}):c(p,i,a.content,a.encoding,r).done(function(e){h.resolve(e)}).progress(function(e,t){var i=this;t&&(d=t),n.request({options:{type:"post"},data:{cmd:"put",target:d,encoding:e||a.encoding,content:i.getContent.call(i,i[0])},notify:{type:"save",cnt:1},syncOnFail:!0,navigate:{target:"changed",toast:{inbuffer:{msg:n.i18n(["complete",n.i18n("btnSave")])}}}}).fail(function(e){h.reject(e)}).done(function(e){setTimeout(function(){i.focus(),i.editor&&i.editor.focus(i[0],i.editor.instance)},50)})}).fail(function(e){h.reject(e)})}).fail(function(e){var t=Array.isArray(e)?e[0]:e;"errConvUTF8"!==t&&n.sync(),h.reject(e)}),h.promise()):(s=["errOpen",i.name,"errPerm"],n.error(s),h.reject(s))},h={},p=function(n,i){var r=function(t,n){if(n=n||a.concat("text/"),-1!==e.inArray(t,n))return!0;var i,r;for(r=n.length,i=0;r>i;i++)if(0===t.indexOf(n[i]))return!0;return!1},o=function(e,t){if(!t||!t.length)return!0;var n,i,a=e.replace(/^.+\.([^.]+)|(.+)$/,"$1$2").toLowerCase();for(i=t.length,n=0;i>n;n++)if(a===t[n].toLowerCase())return!0;return!1};h={},e.each(t.options.editors||[],function(e,t){var a;1!==i&&t.info&&t.info.single||!r(n.mime,t.mimes||null)||!o(n.name,t.exts||null)||"function"!=typeof t.load||"function"!=typeof t.save||(a=t.info&&t.info.name?t.info.name:"Editor "+e,h[a]=t)})};this.shortcuts=[{pattern:"ctrl+e"}],this.init=function(){var t=this,n=this.fm,i=this.options;this.onlyMimes=this.options.mimes||[],i.editors&&Array.isArray(i.editors)&&(e.each(i.editors,function(e,t){t.setup&&"function"==typeof t.setup&&t.setup.call(t,i,n),t.disabled||t.mimes&&Array.isArray(t.mimes)&&(r=r.concat(t.mimes),t.info&&t.info.single||(o=o.concat(t.mimes)))}),r=(e.uniqueSort||e.unique)(r),o=(e.uniqueSort||e.unique)(o),i.editors=e.map(i.editors,function(e){return e.disabled?null:e})),n.bind("select",function(){t.enabled()&&(p(n.file(n.selected()[0]),n.selected().length),Object.keys(h).length>1?(t.variants=[],e.each(h,function(e,i){t.variants.push([{editor:i},n.i18n(e),i.info&&i.info.iconImg?n.baseUrl+i.info.iconImg:"edit"])})):delete t.variants)})},this.getstate=function(e){var e=this.files(e),t=e.length;return t&&d(e).length==t?0:-1},this.exec=function(t,n){var i,a=this.fm,r=d(this.files(t)),t=e.map(r,function(e){return e.hash}),o=[],s=n&&n.editor?n.editor:null,l=e(n&&n._currentNode?n._currentNode:e("#"+a.cwdHash2Id(t[0]))),c=function(){var n,i=e.Deferred();return!s&&Object.keys(h).length>1?(n=[],e.each(h,function(e,t){n.push({label:a.escape(e),icon:t.info&&t.info.icon?t.info.icon:"edit",options:{iconImg:t.info&&t.info.iconImg?a.baseUrl+t.info.iconImg:void 0},callback:function(){i.resolve(t)}})}),a.trigger("contextmenu",{raw:n,x:l.offset().left,y:l.offset().top,opened:function(){a.one("closecontextmenu",function(){setTimeout(function(){"pending"===i.state()&&i.reject()},10)})}}),a.trigger("selectfiles",{files:t}),i):i.resolve(s?s:Object.keys(h).length?h[Object.keys(h)[0]]:null)},p=e.Deferred();return l.length||(l=a.getUI("cwd")),c().done(function(t){for(;i=r.shift();)o.push(u(i,void 0,t).fail(function(e){e&&a.error(e)}));o.length?e.when.apply(null,o).done(function(){p.resolve()}).fail(function(){p.reject()}):p.reject()}).fail(function(){p.reject()}),p}},i.prototype.commands.empty=function(){var t=this.fm;this.linkedCmds=["rm"],this.getstate=function(t){var t=this.files(t),n=t.length;return n&&e.map(t,function(e){return e.write&&"directory"===e.mime?e:null}).length==n?0:-1},this.exec=function(n){var i=this.files(n),a=i.length,r=e.Deferred().done(function(){var n={changed:{}};t.toast({msg:t.i18n(['"'+o.join('", ')+'"',"complete",t.i18n("cmdempty")])}),e.each(i,function(e,t){n.changed[t.hash]=t}),t.change(n)}).always(function(){var n=t.cwd().hash;t.trigger("selectfiles",{files:e.map(i,function(e){return n===e.phash?e.hash:null})})}),o=[],s=function(e){"number"==typeof e?(o.push(i[e].name),delete i[e].dirs):e&&t.error(e),--a<1&&r[o.length?"resolve":"reject"]()};return e.each(i,function(n,i){var r;return i.write&&"directory"===i.mime?t.isCommandEnabled("rm",i.hash)?(r=setTimeout(function(){t.notify({type:"search",cnt:1,hideCnt:!(a>1)})},t.notifyDelay),void t.request({data:{cmd:"open",target:i.hash},preventDefault:!0,asNotOpen:!0}).done(function(o){var l=[];r&&clearTimeout(r),t.ui.notify.children(".elfinder-notify-search").length&&t.notify({type:"search",cnt:-1,hideCnt:!(a>1)}),o&&o.files&&o.files.length?o.files.length>t.maxTargets?s(["errEmpty",i.name,"errMaxTargets",t.maxTargets]):(t.updateCache(o),e.each(o.files,function(e,t){return!t.write||t.locked?(s(["errEmpty",i.name,"errRm",t.name,"errPerm"]),l=[],!1):void l.push(t.hash)}),l.length&&t.exec("rm",l,{addTexts:[t.i18n("folderToEmpty",i.name)]}).fail(function(e){t.trigger("unselectfiles",{files:t.selected()}),s(e||"")}).done(function(){s(n)})):(t.toast({mode:"warning",msg:t.i18n("filderIsEmpty",i.name)}),s(""))}).fail(function(e){s(e||"")})):(s(["errCmdNoSupport",'"rm"']),null):(s(["errEmpty",i.name,"errPerm"]),null)}),r}},i.prototype.commands.extract=function(){var t=this,n=t.fm,i=[],a=function(t){return e.map(t,function(t){return t.read&&-1!==e.inArray(t.mime,i)?t:null})};this.variants=[],this.disableOnSearch=!0,n.bind("open reload",function(){i=n.option("archivers").extract||[],n.api>2?t.variants=[["makedir",n.i18n("cmdmkdir")],["intohere",n.i18n("btnCwd")]]:t.variants=[["intohere",n.i18n("btnCwd")]],t.change()}),this.getstate=function(e){var e=this.files(e),t=e.length;return t&&this.fm.cwd().write&&a(e).length==t?0:-1},this.exec=function(t,a){var r,o,s,l=this.files(t),d=e.Deferred(),c=l.length,u="makedir"==a?1:0,h=!1,p=!1,f=0,m=e.map(n.files(t),function(e){return e.name}),g={};e.map(n.files(t),function(e){g[e.name]=e});var v=function(e){switch(e){case"overwrite_all":h=!0;break;case"omit_all":p=!0}},b=function(t){t.read&&n.file(t.phash).write?-1===e.inArray(t.mime,i)?(o=["errExtract",t.name,"errNoArchive"],n.error(o),d.reject(o)):n.request({data:{cmd:"extract",target:t.hash,makedir:u},notify:{type:"extract",cnt:1},syncOnFail:!0,navigate:{toast:u?{incwd:{msg:n.i18n(["complete",n.i18n("cmdextract")]),action:{cmd:"open",msg:"cmdopen"}},inbuffer:{msg:n.i18n(["complete",n.i18n("cmdextract")]),action:{cmd:"open",msg:"cmdopen"}}}:{inbuffer:{msg:n.i18n(["complete",n.i18n("cmdextract")])}}}}).fail(function(e){"rejected"!=d.state()&&d.reject(e)}).done(function(){}):(o=["errExtract",t.name,"errPerm"],n.error(o),d.reject(o))},y=function(t,i){var a=t[i],o=a.name.replace(/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/gi,""),l=e.inArray(o,m)>=0,w=function(){c>i+1?y(t,i+1):d.resolve()};!u&&l&&"directory"!=g[o].mime?n.confirm({title:n.i18n("ntfextract"),text:["errExists",o,"confirmRepl"],accept:{label:"btnYes",callback:function(e){if(s=e?"overwrite_all":"overwrite",v(s),h||p){if(h){for(r=i;c>r;r++)b(t[r]);d.resolve()}}else"overwrite"==s&&b(a),c>i+1?y(t,i+1):d.resolve()}},reject:{label:"btnNo",callback:function(e){s=e?"omit_all":"omit",v(s),!h&&!p&&c>i+1?y(t,i+1):p&&d.resolve()}},cancel:{label:"btnCancel",callback:function(){d.resolve()}},all:c>i+1}):u?(b(a),w()):0==f?n.confirm({title:n.i18n("cmdextract"),text:[n.i18n("cmdextract")+' "'+a.name+'"',"confirmRepl"],accept:{label:"btnYes",callback:function(e){e&&(f=1),b(a),w()}},reject:{label:"btnNo",callback:function(e){e&&(f=-1),w()}},cancel:{label:"btnCancel",callback:function(){d.resolve()}},all:c>i+1}):(f>0&&b(a),w())};return this.enabled()&&c&&i.length?(c>0&&y(l,0),d):d.reject()}},(i.prototype.commands.forward=function(){this.alwaysEnabled=!0,this.updateOnSelect=!0,this.shortcuts=[{pattern:"ctrl+right"}],this.getstate=function(){return this.fm.history.canForward()?0:-1},this.exec=function(){return this.fm.history.forward()}}).prototype={forceLoad:!0},i.prototype.commands.fullscreen=function(){var e=this,t=this.fm,n=function(t,n){n&&n.fullscreen&&e.update(void 0,"on"===n.fullscreen)};this.alwaysEnabled=!0,this.updateOnSelect=!1,this.value=!1,this.options={ui:"fullscreenbutton"},this.getstate=function(){return 0},this.exec=function(){var n=t.getUI().get(0),i=t.toggleFullscreen(n);e.update(void 0,i===n)},t.bind("init",function(){t.getUI().off("resize."+t.namespace,n).on("resize."+t.namespace,n)})},(i.prototype.commands.getfile=function(){var t=this,n=this.fm,i=function(n){var i=t.options;return n=e.map(n,function(e){return("directory"!=e.mime||i.folders)&&e.read?e:null}),i.multiple||1==n.length?n:[]};this.alwaysEnabled=!0,this.callback=n.options.getFileCallback,this._disabled="function"==typeof this.callback,this.getstate=function(e){var e=this.files(e),t=e.length;return this.callback&&t&&i(e).length==t?0:-1},this.exec=function(n){var i,a,r,o=this.fm,s=this.options,l=this.files(n),d=l.length,c=o.option("url"),u=o.option("tmbUrl"),h=e.Deferred().done(function(e){var n,i=function(){"close"==s.oncomplete?o.hide():"destroy"==s.oncomplete&&o.destroy()};o.trigger("getfile",{files:e});try{n=t.callback(e,o)}catch(a){return void o.error(["Error in `getFileCallback`.",a.message])}"object"==typeof n&&"function"==typeof n.done?n.done(i).fail(function(e){e&&o.error(e)}):i()}),p=function(t){return s.onlyURL?s.multiple?e.map(l,function(e){return e.url}):l[0].url:s.multiple?l:l[0]},f=[];for(i=0;d>i;i++){if(a=l[i],"directory"==a.mime&&!s.folders)return h.reject();a.baseUrl=c,"1"==a.url?f.push(o.request({data:{cmd:"url",target:a.hash},notify:{type:"url",cnt:1,hideCnt:!0},preventDefault:!0}).done(function(e){if(e.url){var t=o.file(this.hash);t.url=this.url=e.url}}.bind(a))):a.url=o.url(a.hash),s.onlyURL||(s.getPath&&(a.path=o.path(a.hash),""===a.path&&a.phash&&!function(){var t=e.Deferred();f.push(t),o.path(a.hash,!1,{}).done(function(e){a.path=e}).fail(function(){a.path=""}).always(function(){t.resolve()})}()),a.tmb&&1!=a.tmb&&(a.tmb=u+a.tmb),a.width||a.height||(a.dim?(r=a.dim.split("x"),a.width=r[0],a.height=r[1]):s.getImgSize&&-1!==a.mime.indexOf("image")&&f.push(o.request({data:{cmd:"dim",target:a.hash},notify:{type:"dim",cnt:1,hideCnt:!0},preventDefault:!0}).done(function(e){if(e.dim){var t=e.dim.split("x"),n=o.file(this.hash);n.width=this.width=t[0],n.height=this.height=t[1]}}.bind(a)))))}return f.length?(e.when.apply(null,f).always(function(){h.resolve(p(l))}),h):h.resolve(p(l))}}).prototype={forceLoad:!0},(i.prototype.commands.help=function(){var t,n,i=this.fm,a=this,r='<div class="elfinder-help-link"> <a href="{url}" target="_blank">{link}</a></div>',o='<div class="elfinder-help-team"><div>{author}</div>{work}</div>',s=/\{url\}/,l=/\{link\}/,d=/\{author\}/,c=/\{work\}/,u="replace",h="ui-priority-primary",p="ui-priority-secondary",f="elfinder-help-license",m='<li class="ui-state-default ui-corner-top elfinder-help-tab-{id}"><a href="#'+i.namespace+'-help-{id}">{title}</a></li>',g=['<div class="ui-tabs ui-widget ui-widget-content ui-corner-all elfinder-help">','<ul class="ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all">'],v='<div class="elfinder-help-shortcut"><div class="elfinder-help-shortcut-pattern">{pattern}</div> {descrip}</div>',b='<div class="elfinder-help-separator"/>',y=e("base").length?document.location.href.replace(/#.*$/,""):"",w=function(){g.push('<div id="'+i.namespace+'-help-about" class="ui-tabs-panel ui-widget-content ui-corner-bottom"><div class="elfinder-help-logo"/>'),g.push("<h3>elFinder</h3>"),g.push('<div class="'+h+'">'+i.i18n("webfm")+"</div>"),g.push('<div class="'+p+'">'+i.i18n("ver")+": "+i.version+", "+i.i18n("protocolver")+': <span class="apiver"></span></div>'),g.push('<div class="'+p+'">jQuery/jQuery UI: '+e().jquery+"/"+e.ui.version+"</div>"),g.push(b),g.push(r[u](s,"http://elfinder.org/")[u](l,i.i18n("homepage"))),g.push(r[u](s,"https://github.com/Studio-42/elFinder/wiki")[u](l,i.i18n("docs"))),g.push(r[u](s,"https://github.com/Studio-42/elFinder")[u](l,i.i18n("github"))),g.push(r[u](s,"http://twitter.com/elrte_elfinder")[u](l,i.i18n("twitter"))),g.push(b),g.push('<div class="'+h+'">'+i.i18n("team")+"</div>"),g.push(o[u](d,'Dmitry "dio" Levashov <dio@std42.ru>')[u](c,i.i18n("chiefdev"))),g.push(o[u](d,"Troex Nevelin <troex@fury.scancode.ru>")[u](c,i.i18n("maintainer"))),g.push(o[u](d,"Alexey Sukhotin <strogg@yandex.ru>")[u](c,i.i18n("contributor"))),g.push(o[u](d,"Naoki Sawada <hypweb@gmail.com>")[u](c,i.i18n("contributor"))),i.i18[i.lang].translator&&e.each(i.i18[i.lang].translator.split(", "),function(){g.push(o[u](d,e.trim(this))[u](c,i.i18n("translator")+" ("+i.i18[i.lang].language+")"))}),g.push(b),g.push('<div class="'+f+'">'+i.i18n("icons")+': Pixelmixer, <a href="http://p.yusukekamiyamane.com" target="_blank">Fugue</a></div>'),g.push(b),g.push('<div class="'+f+'">Licence: BSD Licence</div>'),g.push('<div class="'+f+'">Copyright © 2009-2016, Studio 42</div>'),g.push('<div class="'+f+'">„ …'+i.i18n("dontforget")+" ”</div>"),g.push("</div>")},k=function(){var t=i.shortcuts();g.push('<div id="'+i.namespace+'-help-shortcuts" class="ui-tabs-panel ui-widget-content ui-corner-bottom">'),t.length?(g.push('<div class="ui-widget-content elfinder-help-shortcuts">'),e.each(t,function(e,t){g.push(v.replace(/\{pattern\}/,t[0]).replace(/\{descrip\}/,t[1]))}),g.push("</div>")):g.push('<div class="elfinder-help-disabled">'+i.i18n("shortcutsof")+"</div>"),g.push("</div>")},x=function(){g.push('<div id="'+i.namespace+'-help-help" class="ui-tabs-panel ui-widget-content ui-corner-bottom">'),g.push('<a href="https://github.com/Studio-42/elFinder/wiki" target="_blank" class="elfinder-dont-panic"><span>DON\'T PANIC</span></a>'),g.push("</div>")},C=!1,T=function(){C=!0,g.push('<div id="'+i.namespace+'-help-debug" class="ui-tabs-panel ui-widget-content ui-corner-bottom">'),g.push('<div class="ui-widget-content elfinder-help-debug"><ul></ul></div>'),g.push("</div>")},A=function(){var r,o,s,l,d=function(t,n){return e.each(n,function(n,i){t.append(e("<dt/>").text(n)),"undefined"==typeof i?t.append(e("<dd/>").append(e("<span/>").text("undfined"))):"object"!=typeof i||i?"object"==typeof i&&(e.isPlainObject(i)||i.length)?t.append(e("<dd/>").append(d(e("<dl/>"),i))):t.append(e("<dd/>").append(e("<span/>").text(i&&"object"==typeof i?"[]":i?i:'""'))):t.append(e("<dd/>").append(e("<span/>").text("null")))}),t},c=n.children("li").length;(a.debug.options||a.debug.debug)&&(c>=5&&(n.children("li:last").remove(),t.children("div:last").remove()),s=i.namespace+"-help-debug-"+ +new Date,r=e("<li/>").html('<a href="'+y+"#"+s+'">'+a.debug.debug.cmd+"</a>").prependTo(n),o=e('<div id="'+s+'"/>'),a.debug.debug&&(l=e("<fieldset>").append(e("<legend/>").text("debug"),d(e("<dl/>"),a.debug.debug)),o.append(l)),a.debug.options&&(l=e("<fieldset>").append(e("<legend/>").text("options"),d(e("<dl/>"),a.debug.options)),o.append(l)),n.after(o),t.tabs("refresh"),n.find("a:first").trigger("click"))},z="";this.alwaysEnabled=!0,this.updateOnSelect=!1,this.state=-1,this.shortcuts=[{pattern:"f1",description:this.title}],i.one("load",function(){var r,o,s,l=a.options.view||["about","shortcuts","help","debug"];e.fn.tabs||(o=e.inArray(l,"debug"))!==!1&&l.splice(o,1),e.each(l,function(e,t){g.push(m[u](/\{id\}/g,t)[u](/\{title\}/,i.i18n(t)))}),g.push("</ul>"),-1!==e.inArray("about",l)&&w(),-1!==e.inArray("shortcuts",l)&&k(),-1!==e.inArray("help",l)&&(s=i.baseUrl+"js/i18n/help/%s.html",x()),-1!==e.inArray("debug",l)&&T(),g.push("</div>"),z=e(g.join("")),z.find(".ui-tabs-nav li").hover(function(){e(this).toggleClass("ui-state-hover")}).children().on("click",function(t){var n=e(this);t.preventDefault(),t.stopPropagation(),n.hasClass("ui-tabs-selected")||(n.parent().addClass("ui-tabs-selected ui-state-active").siblings().removeClass("ui-tabs-selected").removeClass("ui-state-active"),z.children(".ui-tabs-panel").hide().filter(n.attr("href")).show())}).filter(":first").click(),C&&(r=z.find(".elfinder-help-tab-debug").hide(),t=z.find("#"+i.namespace+"-help-debug").children("div:first").tabs(),n=t.children("ul:first").on("click",function(e){e.preventDefault(),e.stopPropagation()}),a.debug={},i.bind("backenddebug",function(e){e.data&&e.data.debug&&(r.show(),a.debug={options:e.data.options,debug:Object.assign({cmd:i.currentReqCmd},e.data.debug)},a.dialog&&A())})),z.find("#"+i.namespace+"-help-about").find(".apiver").text(i.api),a.dialog=i.dialog(z,{title:a.title,width:530,autoOpen:!1,destroyOnClose:!1}).on("click",function(e){e.stopPropagation()}),s&&a.dialog.one("initContents",function(){e.ajax({url:a.options.helpSource?a.options.helpSource:s.replace("%s",i.lang),dataType:"html"}).done(function(t){e("#"+i.namespace+"-help-help").html(t)}).fail(function(){e.get(s.replace("%s","en"),function(t){e("#"+i.namespace+"-help-help").html(t)})})}),a.state=0}),this.getstate=function(){return 0},this.exec=function(){this.dialog.trigger("initContents").elfinderdialog("open").find(".ui-tabs-nav li a:first").click()}}).prototype={forceLoad:!0},i.prototype.commands.hidden=function(){this.hidden=!0,this.updateOnSelect=!1,this.getstate=function(){return-1}},(i.prototype.commands.home=function(){this.title="Home",this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+home ctrl+shift+up",description:"Home"}],this.getstate=function(){var e=this.fm.root(),t=this.fm.cwd().hash;return e&&t&&e!=t?0:-1},this.exec=function(){return this.fm.exec("open",this.fm.root())}}).prototype={forceLoad:!0},(i.prototype.commands.info=function(){var t=this.fm,n="elfinder-info-spinner",i="elfinder-info-button",a={calc:t.i18n("calc"),size:t.i18n("size"),unknown:t.i18n("unknown"),path:t.i18n("path"),aliasfor:t.i18n("aliasfor"),modify:t.i18n("modify"),perms:t.i18n("perms"),locked:t.i18n("locked"),dim:t.i18n("dim"),kind:t.i18n("kind"),files:t.i18n("files"),folders:t.i18n("folders"),roots:t.i18n("volumeRoots"),items:t.i18n("items"),yes:t.i18n("yes"),no:t.i18n("no"),link:t.i18n("link"),owner:t.i18n("owner"),group:t.i18n("group"),perm:t.i18n("perm"),getlink:t.i18n("getLink")};this.tpl={main:'<div class="ui-helper-clearfix elfinder-info-title {dirclass}"><span class="elfinder-cwd-icon {class} ui-corner-all"{style}/>{title}</div><table class="elfinder-info-tb">{content}</table>',itemTitle:'<strong>{name}</strong><span class="elfinder-info-kind">{kind}</span>',groupTitle:"<strong>{items}: {num}</strong>",row:"<tr><td>{label} : </td><td>{value}</td></tr>",spinner:'<span>{text}</span> <span class="'+n+" "+n+'-{name}"/>'},this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+i"}],this.init=function(){e.each(a,function(e,n){a[e]=t.i18n(n)})},this.getstate=function(){return 0},this.exec=function(t){var r=this.files(t);r.length||(r=this.files([this.fm.cwd().hash]));var o,s,l,d,c,u,h,p=this.fm,f=this.options,m=this.tpl,g=m.row,v=r.length,b=[],y=m.main,w="{label}",k="{value}",x=[],C={title:this.title,width:"auto",close:function(){e(this).elfinderdialog("destroy"),e.each(x,function(e,t){var n=t&&t.xhr?t.xhr:null;n&&"pending"==n.state()&&(n.quiet=!0,n.abort())})}},T=[],A=function(e,t){I.find("."+n+"-"+t).parent().html(e)},z=p.namespace+"-info-"+e.map(r,function(e){return e.hash}).join("-"),I=p.getUI().find("#"+z),O=[],S=function(t){var n=function(t){var n=[];return"directory"===t.mime&&e.each(p.leafRoots,function(e,i){var a;if(e===t.hash)n.push.apply(n,i);else for(a=(p.file(e)||{}).phash;a;)a===t.hash&&n.push.apply(n,i),a=(p.file(a)||{}).phash}),n},i=function(t){var n=e.Deferred(),i=p.file(t),a=i?i.phash:t;return a&&!p.file(a)?p.request({data:{cmd:"parents",target:a},preventFail:!0}).done(function(){p.one("parentsdone",function(){n.resolve()})}).fail(function(){n.resolve()}):n.resolve(),n},r=function(){var t=e.Deferred(),n=Object.keys(p.leafRoots).length;return n>0?e.each(p.leafRoots,function(e){i(e).done(function(){--n,1>n&&t.resolve()})}):t.resolve(),t};p.autoSync("stop"),r().done(function(){var i=[],r={},o=[];e.each(t,function(){i.push.apply(i,n(p.file(this)))}),t.push.apply(t,i),e.each(t,function(){var e=p.root(this);r[e]?r[e].push(this):r[e]=[this]}),e.each(r,function(){o.push(p.request({data:{cmd:"size",targets:this},preventDefault:!0}))}),x.push.apply(x,o),e.when.apply(e,o).fail(function(){A(a.unknown,"size")}).done(function(){var e,t=0,n=0,i=0,r=arguments.length,o=[],s="";for(e=0;r>e;e++)t+=parseInt(arguments[e].size),n!==!1&&("undefined"==typeof arguments[e].fileCnt&&(n=!1),n+=parseInt(arguments[e].fileCnt||0)),i!==!1&&("undefined"==typeof arguments[e].dirCnt&&(i=!1),i+=parseInt(arguments[e].dirCnt||0));i!==!1&&o.push(a.folders+": "+i),n!==!1&&o.push(a.files+": "+n),o.length&&(s="<br>"+o.join(", ")),A((t>=0?p.formatSize(t):a.unknown)+s,"size")}),p.autoSync()})},U="";if(!v)return e.Deferred().reject();if(I.length)return I.elfinderdialog("toTop"),e.Deferred().resolve();if(1==v){if(l=r[0],l.icon&&(U=" "+p.getIconStyle(l)),y=y.replace("{dirclass}",l.csscls?p.escape(l.csscls):"").replace("{class}",p.mime2class(l.mime)).replace("{style}",U),d=m.itemTitle.replace("{name}",p.escape(l.i18||l.name)).replace("{kind}",'<span title="'+p.escape(l.mime)+'">'+p.mime2kind(l)+"</span>"),s=p.tmb(l),l.read?"directory"!=l.mime||l.alias?o=p.formatSize(l.size):(o=m.spinner.replace("{text}",a.calc).replace("{name}","size"),T.push(l.hash)):o=a.unknown,b.push(g.replace(w,a.size).replace(k,o)),l.alias&&b.push(g.replace(w,a.aliasfor).replace(k,l.alias)),(h=p.path(l.hash,!0))?b.push(g.replace(w,a.path).replace(k,p.escape(h))):(b.push(g.replace(w,a.path).replace(k,m.spinner.replace("{text}",a.calc).replace("{name}","path"))),x.push(p.path(l.hash,!0,{notify:null}).fail(function(){A(a.unknown,"path")}).done(function(e){A(e,"path")}))),l.read){var M,D=p.escape(l.name);if("1"==l.url)b.push(g.replace(w,a.link).replace(k,'<button class="'+i+" "+n+'-url">'+a.getlink+"</button>"));else{if(f.nullUrlDirLinkSelf&&"directory"==l.mime&&null===l.url){var E=window.location;M=E.pathname+E.search+"#elf_"+l.hash}else M=p.url(l.hash);b.push(g.replace(w,a.link).replace(k,'<a href="'+M+'" target="_blank">'+D+"</a>"))}}l.dim?b.push(g.replace(w,a.dim).replace(k,l.dim)):-1!==l.mime.indexOf("image")&&(l.width&&l.height?b.push(g.replace(w,a.dim).replace(k,l.width+"x"+l.height)):(b.push(g.replace(w,a.dim).replace(k,m.spinner.replace("{text}",a.calc).replace("{name}","dim"))),x.push(p.request({data:{cmd:"dim",target:l.hash},preventDefault:!0}).fail(function(){A(a.unknown,"dim")}).done(function(e){if(A(e.dim||a.unknown,"dim"),e.dim){var t=e.dim.split("x"),n=p.file(l.hash);n.width=t[0],n.height=t[1]}})))),b.push(g.replace(w,a.modify).replace(k,p.formatDate(l))),b.push(g.replace(w,a.perms).replace(k,p.formatPermissions(l))),b.push(g.replace(w,a.locked).replace(k,l.locked?a.yes:a.no)),l.owner&&b.push(g.replace(w,a.owner).replace(k,l.owner)),l.group&&b.push(g.replace(w,a.group).replace(k,l.group)),l.perm&&b.push(g.replace(w,a.perm).replace(k,p.formatFileMode(l.perm))),f.custom&&e.each(f.custom,function(t,n){n.mimes&&!e.map(n.mimes,function(e){return l.mime===e||0===l.mime.indexOf(e+"/")?!0:null}).length||n.hashRegex&&!l.hash.match(n.hashRegex)||(b.push(g.replace(w,p.i18n(n.label)).replace(k,n.tpl.replace("{id}",z))),n.action&&"function"==typeof n.action&&O.push(n.action))})}else y=y.replace("{class}","elfinder-cwd-icon-group"),d=m.groupTitle.replace("{items}",a.items).replace("{num}",v),c=e.map(r,function(e){return"directory"==e.mime?1:null}).length,c?(u=e.map(r,function(e){return"directory"!==e.mime||e.phash&&!e.isroot?null:1}).length,c-=u,b.push(g.replace(w,a.kind).replace(k,u===v||c===v?a[u?"roots":"folders"]:e.map({roots:u,folders:c,files:v-u-c},function(e,t){return e?a[t]+" "+e:null}).join(", "))),b.push(g.replace(w,a.size).replace(k,m.spinner.replace("{text}",a.calc).replace("{name}","size"))),T=e.map(r,function(e){return e.hash})):(o=0,e.each(r,function(e,t){var n=parseInt(t.size);n>=0&&o>=0?o+=n:o="unknown"}),b.push(g.replace(w,a.kind).replace(k,a.files)),b.push(g.replace(w,a.size).replace(k,p.formatSize(o))));y=y.replace("{title}",d).replace("{content}",b.join("")),I=p.dialog(y,C),I.attr("id",z),l&&"1"==l.url&&I.on("click","."+n+"-url",function(){e(this).parent().html(m.spinner.replace("{text}",p.i18n("ntfurl")).replace("{name}","url")),p.request({data:{cmd:"url",target:l.hash},preventDefault:!0}).fail(function(){A(D,"url")}).done(function(e){if(e.url){A('<a href="'+e.url+'" target="_blank">'+D+"</a>"||D,"url");var t=p.file(l.hash);t.url=e.url}else A(D,"url")})}),s&&e("<img/>").on("load",function(){I.find(".elfinder-cwd-icon").addClass(s.className).css("background-image","url('"+s.url+"')")}).attr("src",s.url),T.length&&S(T),O.length&&e.each(O,function(e,t){try{t(l,p,I)}catch(n){p.debug("error",n)}})}}).prototype={forceLoad:!0},i.prototype.commands.mkdir=function(){var t,n=this.fm,i=this;this.value="",this.disableOnSearch=!0,this.updateOnSelect=!1,this.mime="directory",this.prefix="untitled folder",this.exec=function(a){return this.origin=t?t:"cwd",a||this.options.intoNewFolderToolbtn||n.getUI("cwd").trigger("unselectall"),this.move=!("navbar"===this.origin||!n.selected().length),e.proxy(n.res("mixin","make"),i)()},this.shortcuts=[{pattern:"ctrl+shift+n"}],this.init=function(){this.options.intoNewFolderToolbtn&&(this.options.ui="mkdirbutton")},n.bind("select",function(e){var a=e.data&&e.data.selected?e.data.selected:[];t=a.length?e.data.origin||"":"",i.title=a.length&&"navbar"!==t?n.i18n("cmdmkdirin"):n.i18n("cmdmkdir"),i.update(void 0,i.title)}),this.getstate=function(i){var a=n.cwd(),i="navbar"===t||i&&i[0]!=a.hash?this.files(i||n.selected()):[],r=i.length;return"navbar"===t?r&&i[0].write&&i[0].read?0:-1:!a.write||r&&e.map(i,function(e){return e.read&&!e.locked?e:null}).length!=r?-1:0}},i.prototype.commands.mkfile=function(){this.disableOnSearch=!0,this.updateOnSelect=!1,this.mime="text/plain",this.prefix="untitled file.txt",this.exec=e.proxy(this.fm.res("mixin","make"),this),this.getstate=function(){return this.fm.cwd().write?0:-1}},i.prototype.commands.netmount=function(){var t,n=this;this.alwaysEnabled=!0,this.updateOnSelect=!1,this.drivers=[],this.handlers={load:function(){this.drivers=this.fm.netDrivers}},this.getstate=function(){return this.drivers.length?0:-1},this.exec=function(){var i,a=n.fm,r=e.Deferred(),o=n.options,s=function(){var s,l=function(){d.protocol.trigger("change","winfocus")},d={protocol:e("<select/>").on("click",function(){var t=e(this);t.data("keepFocus")?t.removeData("keepFocus"):t.data("keepFocus",!0)}).on("change",function(e,n){var r=this.value;t.find(".elfinder-netmount-tr").hide(),t.find(".elfinder-netmount-tr-"+r).show(),i.children(".ui-dialog-buttonpane:first").find("button").show(),"function"==typeof o[r].select&&o[r].select(a,e,n),setTimeout(function(){t.find("input:text.elfinder-tabstop:visible:first").focus()},20)}).addClass("ui-corner-all")},c={title:a.i18n("netMountDialogTitle"),resizable:!1,modal:!0,destroyOnClose:!0,open:function(){e(window).on("focus."+a.namespace,l),d.protocol.change()},close:function(){"pending"==r.state()&&r.reject(),e(window).off("focus."+a.namespace,l)},buttons:{}},u=e('<form autocomplete="off"/>'),h=e("<div/>");return t=e('<table class="elfinder-info-tb elfinder-netmount-tb"/>').append(e("<tr/>").append(e("<td>"+a.i18n("protocol")+"</td>")).append(e("<td/>").append(d.protocol))),e.each(n.drivers,function(n,i){
|
||
o[i]&&(d.protocol.append('<option value="'+i+'">'+a.i18n(o[i].name||i)+"</option>"),e.each(o[i].inputs,function(n,r){r.attr("name",n),"hidden"!=r.attr("type")?(r.addClass("ui-corner-all elfinder-netmount-inputs-"+i),t.append(e("<tr/>").addClass("elfinder-netmount-tr elfinder-netmount-tr-"+i).append(e("<td>"+a.i18n(n)+"</td>")).append(e("<td/>").append(r)))):(r.addClass("elfinder-netmount-inputs-"+i),h.append(r))}),o[i].protocol=d.protocol)}),t.append(h),t.find(".elfinder-netmount-tr").hide(),c.buttons[a.i18n("btnMount")]=function(){var i=d.protocol.val(),s={cmd:"netmount",protocol:i},l=o[i];return e.each(t.find("input.elfinder-netmount-inputs-"+i),function(t,n){var i;i="function"==typeof n.val?e.trim(n.val()):e.trim(n.value),i&&(s[n.name]=i)}),s.host?(a.request({data:s,notify:{type:"netmount",cnt:1,hideCnt:!0}}).done(function(e){var t;e.added&&e.added.length&&(e.added[0].phash&&(t=a.file(e.added[0].phash))&&(t.dirs||(t.dirs=1,a.change({changed:[t]}))),a.one("netmountdone",function(){a.exec("open",e.added[0].hash)})),r.resolve()}).fail(function(e){l.fail&&"function"==typeof l.fail&&l.fail(a,e),r.reject(e)}),void n.dialog.elfinderdialog("close")):a.trigger("error",{error:"errNetMountHostReq"})},c.buttons[a.i18n("btnCancel")]=function(){n.dialog.elfinderdialog("close")},t.find("select,input").addClass("elfinder-tabstop"),s=a.dialog(u.append(t),c),i=s.closest(".ui-dialog"),s.ready(function(){d.protocol.change(),s.elfinderdialog("posInit")}),s};return n.dialog?n.dialog.elfinderdialog("open"):n.dialog=s(),r.promise()},n.fm.bind("netmount",function(e){var i=e.data||null,a=n.options;i&&i.protocol&&a[i.protocol]&&"function"==typeof a[i.protocol].done&&(a[i.protocol].done(n.fm,i),t.find("select,input").addClass("elfinder-tabstop"),n.dialog.elfinderdialog("tabstopsInit"))})},i.prototype.commands.netunmount=function(){this.alwaysEnabled=!0,this.updateOnSelect=!1,this.drivers=[],this.handlers={load:function(){this.drivers=this.fm.netDrivers}},this.getstate=function(e){var t=this.fm;return e&&this.drivers.length&&!this._disabled&&t.file(e[0]).netkey?0:-1},this.exec=function(t){var n=this,i=this.fm,a=e.Deferred().fail(function(e){e&&i.error(e)}),r=i.file(t[0]);return this._disabled?a.reject():("pending"==a.state()&&i.confirm({title:n.title,text:i.i18n("confirmUnmount",r.name),accept:{label:"btnUnmount",callback:function(){var t=i.root()==r.hash,n=e("#"+i.navHash2Id(r.hash)).parent(),o=(n.next().length?n.next():n.prev()).find(".elfinder-navbar-root");i.request({data:{cmd:"netmount",protocol:"netunmount",host:r.netkey,user:r.hash,pass:"dum"},notify:{type:"netunmount",cnt:1,hideCnt:!0},preventFail:!0}).fail(function(e){a.reject(e)}).done(function(n){var r=i.root();t&&(o.length?r=i.navId2Hash(o[0].id):e.each(i.files(),function(e,t){return"directory"==t.mime?(r=e,null):void 0}),i.exec("open",r)),a.resolve()})}},cancel:{label:"btnCancel",callback:function(){a.reject()}}}),a)}},(i.prototype.commands.open=function(){this.alwaysEnabled=!0,this.noChangeDirOnRemovedCwd=!0,this._handlers={dblclick:function(e){e.preventDefault(),this.exec(e.data&&e.data.file?[e.data.file]:void 0)},"select enable disable reload":function(e){this.update("disable"==e.type?-1:void 0)}},this.shortcuts=[{pattern:"ctrl+down numpad_enter"+("mac"!=this.fm.OS&&" enter")}],this.getstate=function(t){var t=this.files(t),n=t.length;return 1==n?t[0].read?0:-1:n&&!this.fm.UA.Mobile&&e.map(t,function(e){return"directory"!=e.mime&&e.read?e:null}).length==n?0:-1},this.exec=function(t,n){var i,a,r,o,s,l,d,c,u,h,p,f,m=this.fm,g=e.Deferred().fail(function(e){e&&m.error(e)}),v=this.files(t),b=v.length,y="object"==typeof n?n.thash:!1,n=this.options,w=n.into||"window";if(!b&&!y)return g.reject();if(y||1==b&&(i=v[0])&&"directory"==i.mime)return y||!i||i.read?m.request({data:{cmd:"open",target:y||i.hash},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!0,lazy:!1}):g.reject(["errOpen",i.name,"errPerm"]);if(v=e.map(v,function(e){return"directory"!=e.mime?e:null}),b!=v.length)return g.reject();var k=function(){var y,k;try{u=new RegExp(m.option("dispInlineRegex"))}catch(x){u=!1}for(h=e("<a>").hide().appendTo(e("body")),p="string"==typeof h.get(0).download,b=v.length;b--;){if(k="elf_open_window",i=v[b],!i.read)return g.reject(["errOpen",i.name,"errPerm"]);if(f=u&&i.mime.match(u),a=m.openUrl(i.hash,!f),m.UA.Mobile||!f)if(p)!f&&h.attr("download",i.name),h.attr("href",a).attr("target","_blank").get(0).click();else{var y=window.open(a);if(!y)return g.reject("errPopup")}else{if(0===a.indexOf(m.options.url)&&(a=""),"window"===w?(s=d=Math.round(2*e(window).width()/3),l=c=Math.round(2*e(window).height()/3),parseInt(i.width)&&parseInt(i.height)?(s=parseInt(i.width),l=parseInt(i.height)):i.dim&&(r=i.dim.split("x"),s=parseInt(r[0]),l=parseInt(r[1])),d>=s&&c>=l?(d=s,c=l):s-d>l-c?c=Math.round(l*(d/s)):d=Math.round(s*(c/l)),o="width="+d+",height="+c,y=window.open(a,k,o+",top=50,left=50,scrollbars=yes,resizable=yes")):("tabs"===w&&(k=i.hash),y=window.open("about:blank",k)),!y)return g.reject("errPopup");if(""===a){var C=document.createElement("form");C.action=m.options.url,C.method="string"==typeof n.method&&"get"===n.method.toLowerCase()?"GET":"POST",C.target=k,C.style.display="none";var T=Object.assign({},m.options.customData,{cmd:"file",target:i.hash});e.each(T,function(e,t){var n=document.createElement("input");n.name=e,n.value=t,C.appendChild(n)}),document.body.appendChild(C),C.submit()}else"window"!==w&&(y.location=a);y.focus()}}return h.remove(),g.resolve(t)};return b>1?m.confirm({title:"openMulti",text:["openMultiConfirm",b+""],accept:{label:"cmdopen",callback:function(){k()}},cancel:{label:"btnCancel",callback:function(){g.reject()}},buttons:m.getCommand("zipdl")&&m.isCommandEnabled("zipdl",m.cwd().hash)?[{label:"cmddownload",callback:function(){m.exec("download",t),g.reject()}}]:[]}):k(),g}}).prototype={forceLoad:!0},i.prototype.commands.opendir=function(){this.alwaysEnabled=!0,this.getstate=function(){var e,t=this.fm.selected(),n=t.length;return 1!==n?-1:(e=this.fm.getUI("workzone"),e.hasClass("elfinder-search-result")?0:-1)},this.exec=function(t){var n,i=this.fm,a=e.Deferred(),r=this.files(t),o=r.length;return o&&r[0].phash?(n=r[0].phash,i.trigger("searchend",{noupdate:!0}),i.request({data:{cmd:"open",target:n},notify:{type:"open",cnt:1,hideCnt:!0},syncOnFail:!1}),a):a.reject()}},i.prototype.commands.paste=function(){this.updateOnSelect=!1,this.handlers={changeclipboard:function(){this.update()}},this.shortcuts=[{pattern:"ctrl+v shift+insert"}],this.getstate=function(e){if(this._disabled)return-1;if(e){if(Array.isArray(e)){if(1!=e.length)return-1;e=this.fm.file(e[0])}}else e=this.fm.cwd();return this.fm.clipboard().length&&"directory"==e.mime&&e.write?0:-1},this.exec=function(t,n){var i,a,r=this,o=r.fm,n=n||{},t=t?this.files(t)[0]:o.cwd(),s=o.clipboard(),l=s.length,d=l?s[0].cut:!1,c=n._cmd?n._cmd:d?"move":"copy",u="err"+c.charAt(0).toUpperCase()+c.substr(1),h=[],p=[],f=e.Deferred().fail(function(e){e&&o.error(e)}).always(function(){o.unlockfiles({files:e.map(s,function(e){return e.hash})})}),m=function(t){return t.length&&o._commands.duplicate?o.exec("duplicate",t):e.Deferred().resolve()},g=function(i){var a,s=e.Deferred(),l=[],u={},h=function(t,n){for(var i=[],a=t.length;a--;)-1!==e.inArray(t[a].name,n)&&i.unshift(a);return i},p=function(e){var t=l[e],n=i[t],a=e==l.length-1;n&&o.confirm({title:o.i18n(c+"Files"),text:["errExists",n.name,"restore"===c?"confirmRest":"confirmRepl"],all:!a,accept:{label:"btnYes",callback:function(t){a||t?m(i):p(++e)}},reject:{label:"btnNo",callback:function(t){var n;if(t)for(n=l.length;e<n--;)i[l[n]].remove=!0;else i[l[e]].remove=!0;a||t?m(i):p(++e)}},cancel:{label:"btnCancel",callback:function(){s.resolve()}},buttons:[{label:"btnBackup",callback:function(t){var n;if(t)for(n=l.length;e<n--;)i[l[n]].rename=!0;else i[l[e]].rename=!0;a||t?m(i):p(++e)}}]})},f=function(t){var n,a={};t&&(Array.isArray(t)?t.length&&("string"==typeof t[0]?l=h(i,t):(e.each(t,function(e,t){a[t.name]=t.hash}),l=h(i,e.map(a,function(e,t){return t})),e.each(i,function(e,t){a[t.name]&&(u[a[t.name]]=t.name)}))):(n=[],l=e.map(t,function(e){return"string"==typeof e?e:(n=n.concat(e),null)}),n.length&&(l=l.concat(n)),l=h(i,l),u=t)),l.length?p(0):m(i)},m=function(i){var a,r=[],i=e.map(i,function(e){return e.rename&&r.push(e.name),e.remove?null:e}),l=i.length;return l?(a=i[0].phash,i=e.map(i,function(e){return e.hash}),void o.request({data:{cmd:"paste",dst:t.hash,targets:i,cut:d?1:0,src:a,renames:r,hashes:u,suffix:o.options.backupSuffix},notify:{type:c,cnt:l},navigate:{toast:n.noToast?{}:{inbuffer:{msg:o.i18n(["complete",o.i18n("cmd"+c)]),action:{cmd:"open",msg:"cmdopendir",data:[t.hash],done:"select",cwdNot:t.hash}}}}}).done(function(){s.resolve()}).fail(function(){s.reject()}).always(function(){o.unlockfiles({files:i})})):s.resolve()};return o.isCommandEnabled(r.name,t.hash)&&i.length?(o.oldAPI?m(i):o.option("copyOverwrite",t.hash)?(a=e.map(i,function(e){return e.name}),t.hash==o.cwd().hash?f(e.map(o.files(),function(e){return e.phash==t.hash?{hash:e.hash,name:e.name}:null})):o.request({data:{cmd:"ls",target:t.hash,intersect:a},notify:{type:"prepare",cnt:1,hideCnt:!0},preventFail:!0}).always(function(e){f(e.list)})):m(i),s):s.resolve()};return l&&t&&"directory"==t.mime?t.write?(i=o.parents(t.hash),e.each(s,function(n,r){return r.read?d&&r.locked?!f.reject(["errLocked",r.name]):-1!==e.inArray(r.hash,i)?!f.reject(["errCopyInItself",r.name]):r.mime&&"directory"!==r.mime&&!o.uploadMimeCheck(r.mime,t.hash)?!f.reject([u,r.name,"errUploadMime"]):(a=o.parents(r.hash),a.pop(),-1!==e.inArray(t.hash,a)&&e.map(a,function(e){var n=o.file(e);return n.phash==t.hash&&n.name==r.name?n:null}).length?!f.reject(["errReplByChild",r.name]):void(r.phash==t.hash?p.push(r.hash):h.push({hash:r.hash,phash:r.phash,name:r.name}))):!f.reject([u,r.name,"errPerm"])}),"rejected"==f.state()?f:e.when(m(p),g(h)).always(function(){d&&o.clipboard([])})):f.reject([u,s[0].name,"errPerm"]):f.reject()}},i.prototype.commands.places=function(){var t=this,n=this.fm,i=function(n){return e.map(t.files(n),function(e){return"directory"==e.mime?e:null})},a=null;this.getstate=function(e){var e=this.hashes(e),t=e.length;return a&&t&&t==i(e).length?0:-1},this.exec=function(e){var t=this.files(e);a.trigger("regist",[t])},n.one("load",function(){a=n.ui.places})},(i.prototype.commands.quicklook=function(){var t,n,i,a,r=this,o=r.fm,s=0,l=1,d=2,c=s,u="elfinder-quicklook-navbar-icon",h="elfinder-quicklook-fullscreen",p="elfinder-quicklook-info-wrapper",f=function(t){e(document).trigger(e.Event("keydown",{keyCode:t,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))},m=function(e){var t=o.getUI().offset(),n=e.find(".elfinder-cwd-file-wrapper"),i=n.offset();return{opacity:0,width:n.width(),height:n.height(),top:i.top-t.top,left:i.left-t.left}},g=function(){var i=e(window),a=o.getUI().offset(),r=Math.min(t,e(window).width()-10),s=Math.min(n,e(window).height()-80);return{opacity:1,width:r,height:s,top:parseInt((i.height()-s-60)/2+i.scrollTop()-a.top),left:parseInt((i.width()-r)/2+i.scrollLeft()-a.left)}},v=function(e){var t=document.createElement(e.substr(0,e.indexOf("/"))),n=!1;try{n=t.canPlayType&&t.canPlayType(e)}catch(i){}return n&&""!==n&&"no"!=n},b=!1,y=!1,w=null,k=e.ui.keyCode.LEFT,x=e.ui.keyCode.RIGHT,C="mousemove touchstart "+("onwheel"in document?"wheel":"onmousewheel"in document?"mousewheel":"DOMMouseScroll"),T=e('<div class="elfinder-quicklook-title"/>'),A=e("<div/>"),z=e('<div class="elfinder-quicklook-info"/>'),I=e('<div class="ui-front elfinder-quicklook-cover"/>'),O=e('<div class="'+u+" "+u+'-fullscreen"/>').on("click touchstart",function(t){if(!y){var n=r.window,a=n.hasClass(h),s=e(window),l=function(){r.preview.trigger("changesize")};t.stopPropagation(),t.preventDefault(),a?(F="",S(),n.toggleClass(h).css(n.data("position")),s.trigger(r.resize).off(r.resize,l),E.off("mouseenter mouseleave"),I.off(C)):(n.toggleClass(h).data("position",{left:n.css("left"),top:n.css("top"),width:n.width(),height:n.height(),display:"block"}).removeAttr("style"),e(window).on(r.resize,l).trigger(r.resize),I.on(C,function(e){b||("mousemove"!==e.type&&"touchstart"!==e.type||(S(),w=setTimeout(function(){(o.UA.Mobile||E.parent().find(".elfinder-quicklook-navbar:hover").length<1)&&E.fadeOut("slow",function(){I.show()})},3e3)),I.is(":visible")&&(U(),I.data("tm",setTimeout(function(){I.show()},3e3))))}).show().trigger("mousemove"),E.on("mouseenter mouseleave",function(e){b||("mouseenter"===e.type?S():I.trigger("mousemove"))})),o.zIndex&&n.css("z-index",o.zIndex+1),o.UA.Mobile?E.attr("style",F):E.attr("style",F).draggable(a?"destroy":{start:function(){b=!0,y=!0,I.show(),S()},stop:function(){b=!1,F=r.navbar.attr("style"),setTimeout(function(){y=!1},20)}}),e(this).toggleClass(u+"-fullscreen-off");var d=n;i.is(".ui-resizable")&&(d=d.add(i)),e.fn.resizable&&d.resizable(a?"enable":"disable").removeClass("ui-state-disabled"),n.trigger("viewchange")}}),S=function(){r.window.hasClass(h)&&(w&&clearTimeout(w),w=null,E.stop(!0,!0).css("display","block"),U())},U=function(){I.data("tm")&&clearTimeout(I.data("tm")),I.removeData("tm"),I.hide()},M=e('<div class="'+u+" "+u+'-prev"/>').on("click touchstart",function(e){return!y&&f(k),!1}),D=e('<div class="'+u+" "+u+'-next"/>').on("click touchstart",function(e){return!y&&f(x),!1}),E=e('<div class="elfinder-quicklook-navbar"/>').append(M).append(O).append(D).append('<div class="elfinder-quicklook-navbar-separator"/>').append(e('<div class="'+u+" "+u+'-close"/>').on("click touchstart",function(e){return!y&&r.window.trigger("close"),!1})),F="";(this.navbar=E)._show=S,this.resize="resize."+o.namespace,this.info=e("<div/>").addClass(p).append(A).append(z),this.preview=e('<div class="elfinder-quicklook-preview ui-helper-clearfix"/>').on("change",function(){S(),E.attr("style",F),r.preview.attr("style","").removeClass("elfinder-overflow-auto"),r.info.attr("style","").hide(),A.removeAttr("class").attr("style",""),z.html("")}).on("update",function(t){var n,i,o=r.fm,s=(r.preview,t.file),l='<div class="elfinder-quicklook-info-data">{value}</div>';s&&(t.forceUpdate||r.window.data("hash")!==s.hash)?(i=o.escape(s.i18||s.name),!s.read&&t.stopImmediatePropagation(),r.window.data("hash",s.hash),r.preview.off("changesize").trigger("change").children().remove(),T.html(i),M.css("visibility",""),D.css("visibility",""),s.hash===o.cwdId2Hash(a.find("[id]:first").attr("id"))&&M.css("visibility","hidden"),s.hash===o.cwdId2Hash(a.find("[id]:last").attr("id"))&&D.css("visibility","hidden"),z.html(l.replace(/\{value\}/,i)+l.replace(/\{value\}/,o.mime2kind(s))+("directory"==s.mime?"":l.replace(/\{value\}/,o.formatSize(s.size)))+l.replace(/\{value\}/,o.i18n("modify")+": "+o.formatDate(s))),A.addClass("elfinder-cwd-icon ui-corner-all "+o.mime2class(s.mime)),s.icon&&A.css(o.getIconStyle(s,!0)),r.info.attr("class",p),s.csscls&&r.info.addClass(s.csscls),s.read&&(n=o.tmb(s))&&e("<img/>").hide().appendTo(r.preview).on("load",function(){A.addClass(n.className).css("background-image","url('"+n.url+"')"),e(this).remove()}).attr("src",n.url),r.info.delay(100).fadeIn(10),r.window.hasClass(h)&&I.trigger("mousemove")):t.stopImmediatePropagation()}),this.window=e('<div class="ui-front ui-helper-reset ui-widget elfinder-quicklook touch-punch" style="position:absolute"/>').hide().addClass(o.UA.Touch?"elfinder-touch":"").on("click",function(e){e.stopPropagation()}).append(e('<div class="elfinder-quicklook-titlebar"/>').append(T,e('<span class="ui-icon ui-icon-circle-close"/>').mousedown(function(e){e.stopPropagation(),r.window.trigger("close")})),this.preview,r.info.hide(),I.hide(),E).draggable({handle:"div.elfinder-quicklook-titlebar"}).on("open",function(t){var n,i=r.window,a=r.value;r.closed()&&a&&(n=e("#"+o.cwdHash2Id(a.hash))).length&&(F="",E.attr("style",""),c=l,n.trigger("scrolltoview"),U(),i.css(m(n)).show().animate(g(),550,function(){c=d,r.update(1,r.value),S()}))}).on("close",function(e){var t,n=r.window,i=r.preview.trigger("change"),o=(r.value,n.data("hash")),d=function(){c=s,n.hide(),i.children().remove(),r.update(0,r.value)};n.data("hash",""),r.opened()&&(c=l,n.hasClass(h)&&O.click(),o&&(t=a.find("#"+o)).length?n.animate(m(t),500,d):d())}),this.alwaysEnabled=!0,this.value=null,this.handlers={select:function(){this.update(void 0,this.fm.selectedFiles()[0])},error:function(){r.window.is(":visible")&&r.window.data("hash","").trigger("close")},"searchshow searchhide":function(){this.opened()&&this.window.trigger("close")}},this.shortcuts=[{pattern:"space"}],this.support={audio:{ogg:v('audio/ogg; codecs="vorbis"'),mp3:v("audio/mpeg;"),wav:v('audio/wav; codecs="1"'),m4a:v("audio/mp4;")||v("audio/x-m4a;")||v("audio/aac;")},video:{ogg:v('video/ogg; codecs="theora"'),webm:v('video/webm; codecs="vp8, vorbis"'),mp4:v('video/mp4; codecs="avc1.42E01E"')||v('video/mp4; codecs="avc1.42E01E, mp4a.40.2"')}},this.closed=function(){return c==s},this.opened=function(){return c==d},this.init=function(){var s,l,d=this.options,c=this.window,u=this.preview;t=d.width>0?parseInt(d.width):450,n=d.height>0?parseInt(d.height):300,o.one("load",function(){i=o.getUI(),a=o.getUI("cwd"),o.zIndex&&c.css("z-index",o.zIndex+1),c.appendTo(i),e(document).on("keydown."+o.namespace,function(t){t.keyCode==e.ui.keyCode.ESCAPE&&r.opened()&&c.trigger("close")}),e.fn.resizable&&c.resizable({handles:"se",minWidth:350,minHeight:120,resize:function(){u.trigger("changesize")}}),r.change(function(){r.opened()&&setTimeout(function(){r.value?u.trigger(e.Event("update",{file:r.value})):(f(x),setTimeout(function(){!r.value&&c.trigger("close")},10))},10)}),u.on("update",function(e){var t=e.file.hash,n=o.searchStatus.mixed&&o.searchStatus.state>1;if(r.dispInlineRegex=l,n||o.optionsByHashes[t])try{r.dispInlineRegex=new RegExp(o.option("dispInlineRegex",t))}catch(i){try{r.dispInlineRegex=new RegExp(o.isRoot(e.file)?o.options.dispInlineRegex:o.option("dispInlineRegex",e.file.phash))}catch(i){r.dispInlineRegex=/^$/}}r.info.show()}),e.each(o.commands.quicklook.plugins||[],function(e,t){"function"==typeof t&&new t(r)})}),o.bind("open",function(){var e=s;s=o.cwd().hash,r.opened()&&e!==s&&c.trigger("close");try{l=new RegExp(o.option("dispInlineRegex"))}catch(t){l=/^$/}}),o.bind("destroy",function(){r.window.remove()})},this.getstate=function(){var t=this.fm,n=t.selected(),i=1===n.length&&e("#"+t.cwdHash2Id(n[0])).length;return i?c==d?1:0:-1},this.exec=function(){this.enabled()&&this.window.trigger(this.opened()?"close":"open")},this.hideinfo=function(){this.info.stop(!0,!0).hide()}}).prototype={forceLoad:!0},i.prototype.commands.quicklook.plugins=[function(t){var n=["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp"],i=t.preview;e.each(navigator.mimeTypes,function(t,i){var a=i.type;0===a.indexOf("image/")&&e.inArray(a,n)&&n.push(a)}),i.on("update",function(a){var r,o,s,l,d=t.fm,c=a.file;t.dispInlineRegex.test(c.mime)&&-1!==e.inArray(c.mime,n)&&(a.stopImmediatePropagation(),s=e('<div class="elfinder-quicklook-info-data"> '+d.i18n("nowLoading")+'<span class="elfinder-info-spinner"></div>').appendTo(t.info.find(".elfinder-quicklook-info")),r=d.openUrl(c.hash),r+=-1===r.indexOf("?")?"?_=":(l=r.match(/[\?&](_+)=/))?"&"+"_".repeat(l[1].length+1)+"=":"&_=",r+=c.ts||+new Date,o=e("<img/>").hide().appendTo(i).on("load",function(){setTimeout(function(){var e=(o.width()/o.height()).toFixed(2);i.on("changesize",function(){var t,n,a=parseInt(i.width()),r=parseInt(i.height());e<(a/r).toFixed(2)?(n=r,t=Math.floor(n*e)):(t=a,n=Math.floor(t/e)),o.width(t).height(n).css("margin-top",r>n?Math.floor((r-n)/2):0)}).trigger("changesize"),s.remove(),t.hideinfo(),o.fadeIn(100)},1)}).on("error",function(){s.remove()}).attr("src",r))})},function(t){var n=["text/html","application/xhtml+xml"],i=t.preview,a=t.fm;i.on("update",function(r){var o,s,l=r.file;t.dispInlineRegex.test(l.mime)&&-1!==e.inArray(l.mime,n)&&(r.stopImmediatePropagation(),s=e('<div class="elfinder-quicklook-info-data"> '+a.i18n("nowLoading")+'<span class="elfinder-info-spinner"></div>').appendTo(t.info.find(".elfinder-quicklook-info")),i.one("change",function(){"pending"==o.state()&&o.reject()}).addClass("elfinder-overflow-auto"),o=a.request({data:{cmd:"get",target:l.hash,current:l.phash,conv:1},preventDefault:!0}).done(function(n){t.hideinfo();var a=e('<iframe class="elfinder-quicklook-preview-html"/>').appendTo(i)[0].contentWindow.document;a.open(),a.write(n.content),a.close()}).always(function(){s.remove()}))})},function(t){var n=t.fm,i=n.res("mimes","text"),a=t.preview;a.on("update",function(r){var o,s,l=r.file,d=l.mime;0!==d.indexOf("text/")&&-1===e.inArray(d,i)||(r.stopImmediatePropagation(),s=e('<div class="elfinder-quicklook-info-data"> '+n.i18n("nowLoading")+'<span class="elfinder-info-spinner"></div>').appendTo(t.info.find(".elfinder-quicklook-info")),a.one("change",function(){"pending"==o.state()&&o.reject()}),o=n.request({data:{cmd:"get",target:l.hash,conv:1},preventDefault:!0}).done(function(i){t.hideinfo(),e('<div class="elfinder-quicklook-preview-text-wrapper"><pre class="elfinder-quicklook-preview-text">'+n.escape(i.content)+"</pre></div>").appendTo(a)}).always(function(){s.remove()}))})},function(t){var n=t.fm,i="application/pdf",a=t.preview,r=!1;n.UA.Safari&&("mac"==n.OS||n.UA.iOS)||n.UA.IE?r=!0:e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){return t.type==i?!(r=!0):void 0})}),r&&a.on("update",function(r){var o,s=r.file;t.dispInlineRegex.test(s.mime)&&s.mime==i&&(r.stopImmediatePropagation(),a.one("change",function(){o.off("load").remove()}).addClass("elfinder-overflow-auto"),o=e('<iframe class="elfinder-quicklook-preview-pdf"/>').hide().appendTo(a).on("load",function(){t.hideinfo(),o.show()}).attr("src",n.url(s.hash)))})},function(t){var n=t.fm,i="application/x-shockwave-flash",a=t.preview,r=!1;e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){return t.type==i?!(r=!0):void 0})}),r&&a.on("update",function(r){var o,s=r.file;t.dispInlineRegex.test(s.mime)&&s.mime==i&&(r.stopImmediatePropagation(),t.hideinfo(),o=e('<embed class="elfinder-quicklook-preview-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="'+n.url(s.hash)+'" quality="high" type="application/x-shockwave-flash" wmode="transparent" />').appendTo(a))})},function(t){var n,i=t.preview,a=!!t.options.autoplay,r={"audio/mpeg":"mp3","audio/mpeg3":"mp3","audio/mp3":"mp3","audio/x-mpeg3":"mp3","audio/x-mp3":"mp3","audio/x-wav":"wav","audio/wav":"wav","audio/x-m4a":"m4a","audio/aac":"m4a","audio/mp4":"m4a","audio/x-mp4":"m4a","audio/ogg":"ogg"},o=t.window,s=t.navbar;i.on("update",function(l){var d=l.file,c=r[d.mime],u=function(){s.css("bottom",o.hasClass("elfinder-quicklook-fullscreen")?"50px":"")};t.dispInlineRegex.test(d.mime)&&t.support.audio[c]&&(l.stopImmediatePropagation(),n=e('<audio class="elfinder-quicklook-preview-audio" controls preload="auto" autobuffer><source src="'+t.fm.openUrl(d.hash)+'" /></audio>').on("change",function(e){e.stopPropagation()}).appendTo(i),a&&n[0].play(),o.on("viewchange.audio",u),u())}).on("change",function(){if(n&&n.parent().length){var e=n[0];o.off("viewchange.audio");try{e.pause(),e.src="",e.load()}catch(t){}n.remove(),n=null}})},function(t){var n,i=t.preview,a=!!t.options.autoplay,r={"video/mp4":"mp4","video/x-m4v":"mp4","video/quicktime":"mp4","video/ogg":"ogg","application/ogg":"ogg","video/webm":"webm"},o=t.window,s=t.navbar;i.on("update",function(l){var d=l.file,c=r[d.mime],u=function(){t.fm.UA.iOS?o.hasClass("elfinder-quicklook-fullscreen")?(i.css("height","-webkit-calc(100% - 50px)"),s._show()):i.css("height",""):s.css("bottom",o.hasClass("elfinder-quicklook-fullscreen")?"50px":"")};t.dispInlineRegex.test(d.mime)&&t.support.video[c]&&(l.stopImmediatePropagation(),t.hideinfo(),n=e('<video class="elfinder-quicklook-preview-video" controls preload="auto" autobuffer><source src="'+t.fm.openUrl(d.hash)+'" /></video>').on("change",function(e){e.stopPropagation()}).appendTo(i),a&&n[0].play(),o.on("viewchange.video",u),u())}).on("change",function(){if(n&&n.parent().length){var e=n[0];o.off("viewchange.video");try{e.pause(),e.src="",e.load()}catch(t){}n.remove(),n=null}})},function(t){var n,i=t.preview,a=[],r=t.window,o=t.navbar;e.each(navigator.plugins,function(t,n){e.each(n,function(e,t){(0===t.type.indexOf("audio/")||0===t.type.indexOf("video/"))&&a.push(t.type)})}),i.on("update",function(s){var l,d=s.file,c=d.mime,u=function(){o.css("bottom",r.hasClass("elfinder-quicklook-fullscreen")?"50px":"")};t.dispInlineRegex.test(d.mime)&&-1!==e.inArray(d.mime,a)&&(s.stopImmediatePropagation(),(l=0===c.indexOf("video/"))&&t.hideinfo(),n=e('<embed src="'+t.fm.openUrl(d.hash)+'" type="'+c+'" class="elfinder-quicklook-preview-'+(l?"video":"audio")+'"/>').appendTo(i),r.on("viewchange.embed",u),u())}).on("change",function(){n&&n.parent().length&&(r.off("viewchange.embed"),n.remove(),n=null)})},function(t){var n=["application/zip","application/x-gzip","application/x-tar"],a=t.preview,r=t.fm;"undefined"!=typeof Uint8Array&&i.Zlib&&a.on("update",function(o){var s,l,d,c=o.file;-1!==e.inArray(c.mime,n)&&(o.stopImmediatePropagation(),d=e('<div class="elfinder-quicklook-info-data"> '+r.i18n("nowLoading")+'<span class="elfinder-info-spinner"></div>').appendTo(t.info.find(".elfinder-quicklook-info")),a.one("change",function(){d.remove(),l&&l.readyState<4&&l.abort()}),l=new XMLHttpRequest,l.onload=function(n){var o,u,h,p,f,m,g,v,b,y,w,k=[];4===this.readyState&&this.response?setTimeout(function(){try{if("application/zip"===c.mime)u=new i.Zlib.Unzip(new Uint8Array(l.response)),k=u.getFilenames();else for("application/x-gzip"===c.mime?(u=new i.Zlib.Gunzip(new Uint8Array(l.response)),h=u.decompress()):h=new Uint8Array(l.response),p=h.length,f=0,w=function(e){return String.fromCharCode.apply(null,e).replace(/\0+$/,"")};p>f&&0!==h[f];)m=h.subarray(f,f+512),g=w(m.subarray(0,100)),(v=w(m.subarray(345,500)))&&(g=v+g),b=parseInt(w(m.subarray(124,136)),8),y=512*Math.ceil(b/512),"././@LongLink"===g&&(g=w(h.subarray(f+512,f+512+y))),"pax_global_header"!==g&&k.push(g),f=f+512+y}catch(n){d.remove(),r.debug("error",n)}k&&k.length&&(k=e.map(k,function(e){return r.decodeRawString(e)}),k.sort(),d.remove(),o="<strong>"+r.escape(c.mime)+"</strong> ("+r.formatSize(c.size)+")<hr/>",s=e('<div class="elfinder-quicklook-preview-archive-wrapper">'+o+'<pre class="elfinder-quicklook-preview-text">'+r.escape(k.join("\n"))+"</pre></div>").appendTo(a),t.hideinfo())},70):d.remove()},l.open("GET",r.openUrl(c.hash,r.xhrFields.withCredentials||!1),!0),l.responseType="arraybuffer",r.customHeaders&&e.each(r.customHeaders,function(e){l.setRequestHeader(e,this)}),r.xhrFields&&e.each(r.xhrFields,function(e){e in l&&(l[e]=this)}),l.send())})},function(t){var n,i=t.fm,a=t.options.googleDocsMimes||[],r=t.preview,o=(t.window,t.navbar);r.on("update",function(s){var l,d=t.window,c=s.file,u=function(){o.css("bottom",d.hasClass("elfinder-quicklook-fullscreen")?"56px":"")};-1!==e.inArray(c.mime,a)&&("1"==c.url&&e('<div class="elfinder-quicklook-info-data"><button class="elfinder-info-button">'+i.i18n("getLink")+"</button></div>").appendTo(t.info.find(".elfinder-quicklook-info")).on("click",function(){var t=e(this);t.html('<span class="elfinder-info-spinner">'),i.request({data:{cmd:"url",target:c.hash},preventDefault:!0}).always(function(){t.html("")}).done(function(e){var t=i.file(c.hash);c.url=t.url=e.url||"",c.url&&r.trigger({type:"update",file:c,forceUpdate:!0})})}),""!==c.url&&"1"!=c.url&&(s.stopImmediatePropagation(),r.one("change",function(){d.off("viewchange.googledocs"),l.remove(),n.off("load").remove(),n=null}).addClass("elfinder-overflow-auto"),l=e('<div class="elfinder-quicklook-info-data"> '+i.i18n("nowLoading")+'<span class="elfinder-info-spinner"></div>').appendTo(t.info.find(".elfinder-quicklook-info")),n=e('<iframe class="elfinder-quicklook-preview-iframe"/>').css("background-color","transparent").appendTo(r).on("load",function(){t.hideinfo(),l.remove(),e(this).css("background-color","#fff").show()}).attr("src","//docs.google.com/gview?embedded=true&url="+encodeURIComponent(i.convAbsUrl(i.url(c.hash)))),d.on("viewchange.googledocs",u),u()))})}];try{(function(){(function(){"use strict";function e(e){throw e}function t(e,t){var n=e.split("."),i=m;!(n[0]in i)&&i.execScript&&i.execScript("var "+n[0]);for(var a;n.length&&(a=n.shift());)n.length||t===f?i=i[a]?i[a]:i[a]={}:i[a]=t}function n(e){var t,n,i,a,r,o,s,l,d,c,u=e.length,h=0,p=Number.POSITIVE_INFINITY;for(l=0;u>l;++l)e[l]>h&&(h=e[l]),e[l]<p&&(p=e[l]);for(t=1<<h,n=new(g?Uint32Array:Array)(t),i=1,a=0,r=2;h>=i;){for(l=0;u>l;++l)if(e[l]===i){for(o=0,s=a,d=0;i>d;++d)o=o<<1|1&s,s>>=1;for(c=i<<16|l,d=o;t>d;d+=r)n[d]=c;++a}++i,a<<=1,r<<=1}return[n,h,p]}function i(t,n){switch(this.l=[],this.m=32768,this.d=this.f=this.c=this.t=0,this.input=g?new Uint8Array(t):t,this.u=!1,this.n=z,this.L=!1,!n&&(n={})||(n.index&&(this.c=n.index),n.bufferSize&&(this.m=n.bufferSize),n.bufferType&&(this.n=n.bufferType),n.resize&&(this.L=n.resize)),this.n){case A:this.a=32768,this.b=new(g?Uint8Array:Array)(32768+this.m+258);break;case z:this.a=0,this.b=new(g?Uint8Array:Array)(this.m),this.e=this.X,this.B=this.S,this.q=this.W;break;default:e(Error("invalid inflate mode"))}}function a(t,n){for(var i,a=t.f,r=t.d,o=t.input,s=t.c,l=o.length;n>r;)s>=l&&e(Error("input buffer is broken")),a|=o[s++]<<r,r+=8;return i=a&(1<<n)-1,t.f=a>>>n,t.d=r-n,t.c=s,i}function r(e,t){for(var n,i,a=e.f,r=e.d,o=e.input,s=e.c,l=o.length,d=t[0],c=t[1];c>r&&!(s>=l);)a|=o[s++]<<r,r+=8;return n=d[a&(1<<c)-1],i=n>>>16,e.f=a>>i,e.d=r-i,e.c=s,65535&n}function o(e){function t(e,t,n){var i,o,s,l=this.K;for(s=0;e>s;)switch(i=r(this,t)){case 16:for(o=3+a(this,2);o--;)n[s++]=l;break;case 17:for(o=3+a(this,3);o--;)n[s++]=0;l=0;break;case 18:for(o=11+a(this,7);o--;)n[s++]=0;l=0;break;default:l=n[s++]=i}return this.K=l,n}var i,o,s,l,d=a(e,5)+257,c=a(e,5)+1,u=a(e,4)+4,h=new(g?Uint8Array:Array)(U.length);for(l=0;u>l;++l)h[U[l]]=a(e,3);if(!g)for(l=u,u=h.length;u>l;++l)h[U[l]]=0;i=n(h),o=new(g?Uint8Array:Array)(d),s=new(g?Uint8Array:Array)(c),e.K=0,e.q(n(t.call(e,d,i,o)),n(t.call(e,c,i,s)))}function s(e){e=e||{},this.files=[],this.v=e.comment}function l(e,t){t=t||{},this.input=g&&e instanceof Array?new Uint8Array(e):e,this.c=0,this.ca=t.verify||!1,this.j=t.password}function d(e,t){this.input=e,this.offset=t}function c(e,t){this.input=e,this.offset=t}function u(t){var n,i,a,r,o=[],s={};if(!t.i){if(t.o===f){var l,c=t.input;if(!t.D)e:{var u,h=t.input;for(u=h.length-12;u>0;--u)if(h[u]===G[0]&&h[u+1]===G[1]&&h[u+2]===G[2]&&h[u+3]===G[3]){t.D=u;break e}e(Error("End of Central Directory Record not found"))}l=t.D,(c[l++]!==G[0]||c[l++]!==G[1]||c[l++]!==G[2]||c[l++]!==G[3])&&e(Error("invalid signature")),t.ia=c[l++]|c[l++]<<8,t.ka=c[l++]|c[l++]<<8,t.la=c[l++]|c[l++]<<8,t.ba=c[l++]|c[l++]<<8,t.R=(c[l++]|c[l++]<<8|c[l++]<<16|c[l++]<<24)>>>0,t.o=(c[l++]|c[l++]<<8|c[l++]<<16|c[l++]<<24)>>>0,t.w=c[l++]|c[l++]<<8,t.v=g?c.subarray(l,l+t.w):c.slice(l,l+t.w)}for(n=t.o,a=0,r=t.ba;r>a;++a)i=new d(t.input,n),i.parse(),n+=i.length,o[a]=i,s[i.filename]=a;t.R<n-t.o&&e(Error("invalid file header size")),t.i=o,t.G=s}}function h(e,t,n){return n^=e.s(t),e.k(t,n),n}var p,f=void 0,m=this,g="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;new(g?Uint8Array:Array)(256);var v;for(v=0;256>v;++v)for(var b=v,y=7,b=b>>>1;b;b>>>=1)--y;var w,k=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],x=g?new Uint32Array(k):k,C=[];
|
||
for(w=0;288>w;w++)switch(!0){case 143>=w:C.push([w+48,8]);break;case 255>=w:C.push([w-144+400,9]);break;case 279>=w:C.push([w-256+0,7]);break;case 287>=w:C.push([w-280+192,8]);break;default:e("invalid literal: "+w)}var T=function(){function t(t){switch(!0){case 3===t:return[257,t-3,0];case 4===t:return[258,t-4,0];case 5===t:return[259,t-5,0];case 6===t:return[260,t-6,0];case 7===t:return[261,t-7,0];case 8===t:return[262,t-8,0];case 9===t:return[263,t-9,0];case 10===t:return[264,t-10,0];case 12>=t:return[265,t-11,1];case 14>=t:return[266,t-13,1];case 16>=t:return[267,t-15,1];case 18>=t:return[268,t-17,1];case 22>=t:return[269,t-19,2];case 26>=t:return[270,t-23,2];case 30>=t:return[271,t-27,2];case 34>=t:return[272,t-31,2];case 42>=t:return[273,t-35,3];case 50>=t:return[274,t-43,3];case 58>=t:return[275,t-51,3];case 66>=t:return[276,t-59,3];case 82>=t:return[277,t-67,4];case 98>=t:return[278,t-83,4];case 114>=t:return[279,t-99,4];case 130>=t:return[280,t-115,4];case 162>=t:return[281,t-131,5];case 194>=t:return[282,t-163,5];case 226>=t:return[283,t-195,5];case 257>=t:return[284,t-227,5];case 258===t:return[285,t-258,0];default:e("invalid length: "+t)}}var n,i,a=[];for(n=3;258>=n;n++)i=t(n),a[n]=i[2]<<24|i[1]<<16|i[0];return a}();g&&new Uint32Array(T);var A=0,z=1;i.prototype.r=function(){for(;!this.u;){var t=a(this,3);switch(1&t&&(this.u=!0),t>>>=1){case 0:var n=this.input,i=this.c,r=this.b,s=this.a,l=n.length,d=f,c=f,u=r.length,h=f;switch(this.d=this.f=0,i+1>=l&&e(Error("invalid uncompressed block header: LEN")),d=n[i++]|n[i++]<<8,i+1>=l&&e(Error("invalid uncompressed block header: NLEN")),c=n[i++]|n[i++]<<8,d===~c&&e(Error("invalid uncompressed block header: length verify")),i+d>n.length&&e(Error("input buffer is broken")),this.n){case A:for(;s+d>r.length;){if(h=u-s,d-=h,g)r.set(n.subarray(i,i+h),s),s+=h,i+=h;else for(;h--;)r[s++]=n[i++];this.a=s,r=this.e(),s=this.a}break;case z:for(;s+d>r.length;)r=this.e({H:2});break;default:e(Error("invalid inflate mode"))}if(g)r.set(n.subarray(i,i+d),s),s+=d,i+=d;else for(;d--;)r[s++]=n[i++];this.c=i,this.a=s,this.b=r;break;case 1:this.q(L,$);break;case 2:o(this);break;default:e(Error("unknown BTYPE: "+t))}}return this.B()};var I,O,S=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],U=g?new Uint16Array(S):S,M=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],D=g?new Uint16Array(M):M,E=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],F=g?new Uint8Array(E):E,P=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],j=g?new Uint16Array(P):P,R=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],H=g?new Uint8Array(R):R,N=new(g?Uint8Array:Array)(288);for(I=0,O=N.length;O>I;++I)N[I]=143>=I?8:255>=I?9:279>=I?7:8;var q,_,L=n(N),W=new(g?Uint8Array:Array)(30);for(q=0,_=W.length;_>q;++q)W[q]=5;var $=n(W);p=i.prototype,p.q=function(e,t){var n=this.b,i=this.a;this.C=e;for(var o,s,l,d,c=n.length-258;256!==(o=r(this,e));)if(256>o)i>=c&&(this.a=i,n=this.e(),i=this.a),n[i++]=o;else for(s=o-257,d=D[s],0<F[s]&&(d+=a(this,F[s])),o=r(this,t),l=j[o],0<H[o]&&(l+=a(this,H[o])),i>=c&&(this.a=i,n=this.e(),i=this.a);d--;)n[i]=n[i++-l];for(;8<=this.d;)this.d-=8,this.c--;this.a=i},p.W=function(e,t){var n=this.b,i=this.a;this.C=e;for(var o,s,l,d,c=n.length;256!==(o=r(this,e));)if(256>o)i>=c&&(n=this.e(),c=n.length),n[i++]=o;else for(s=o-257,d=D[s],0<F[s]&&(d+=a(this,F[s])),o=r(this,t),l=j[o],0<H[o]&&(l+=a(this,H[o])),i+d>c&&(n=this.e(),c=n.length);d--;)n[i]=n[i++-l];for(;8<=this.d;)this.d-=8,this.c--;this.a=i},p.e=function(){var e,t,n=new(g?Uint8Array:Array)(this.a-32768),i=this.a-32768,a=this.b;if(g)n.set(a.subarray(32768,n.length));else for(e=0,t=n.length;t>e;++e)n[e]=a[e+32768];if(this.l.push(n),this.t+=n.length,g)a.set(a.subarray(i,i+32768));else for(e=0;32768>e;++e)a[e]=a[i+e];return this.a=32768,a},p.X=function(e){var t,n,i,a,r=this.input.length/this.c+1|0,o=this.input,s=this.b;return e&&("number"==typeof e.H&&(r=e.H),"number"==typeof e.Q&&(r+=e.Q)),2>r?(n=(o.length-this.c)/this.C[2],a=258*(n/2)|0,i=a<s.length?s.length+a:s.length<<1):i=s.length*r,g?(t=new Uint8Array(i),t.set(s)):t=s,this.b=t},p.B=function(){var e,t,n,i,a,r=0,o=this.b,s=this.l,l=new(g?Uint8Array:Array)(this.t+(this.a-32768));if(0===s.length)return g?this.b.subarray(32768,this.a):this.b.slice(32768,this.a);for(t=0,n=s.length;n>t;++t)for(e=s[t],i=0,a=e.length;a>i;++i)l[r++]=e[i];for(t=32768,n=this.a;n>t;++t)l[r++]=o[t];return this.l=[],this.buffer=l},p.S=function(){var e,t=this.a;return g?this.L?(e=new Uint8Array(t),e.set(this.b.subarray(0,t))):e=this.b.subarray(0,t):(this.b.length>t&&(this.b.length=t),e=this.b),this.buffer=e},s.prototype.M=function(e){this.j=e},s.prototype.s=function(e){var t=65535&e[2]|2;return t*(1^t)>>8&255},s.prototype.k=function(e,t){e[0]=(x[255&(e[0]^t)]^e[0]>>>8)>>>0,e[1]=(6681*(20173*(e[1]+(255&e[0]))>>>0)>>>0)+1>>>0,e[2]=(x[255&(e[2]^e[1]>>>24)]^e[2]>>>8)>>>0},s.prototype.U=function(e){var t,n,i=[305419896,591751049,878082192];for(g&&(i=new Uint32Array(i)),t=0,n=e.length;n>t;++t)this.k(i,255&e[t]);return i};var B={P:0,N:8},V=[80,75,1,2],K=[80,75,3,4],G=[80,75,5,6];d.prototype.parse=function(){var t=this.input,n=this.offset;(t[n++]!==V[0]||t[n++]!==V[1]||t[n++]!==V[2]||t[n++]!==V[3])&&e(Error("invalid file header signature")),this.version=t[n++],this.ja=t[n++],this.$=t[n++]|t[n++]<<8,this.I=t[n++]|t[n++]<<8,this.A=t[n++]|t[n++]<<8,this.time=t[n++]|t[n++]<<8,this.V=t[n++]|t[n++]<<8,this.p=(t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)>>>0,this.z=(t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)>>>0,this.J=(t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)>>>0,this.h=t[n++]|t[n++]<<8,this.g=t[n++]|t[n++]<<8,this.F=t[n++]|t[n++]<<8,this.fa=t[n++]|t[n++]<<8,this.ha=t[n++]|t[n++]<<8,this.ga=t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24,this.aa=(t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)>>>0,this.filename=String.fromCharCode.apply(null,g?t.subarray(n,n+=this.h):t.slice(n,n+=this.h)),this.Y=g?t.subarray(n,n+=this.g):t.slice(n,n+=this.g),this.v=g?t.subarray(n,n+this.F):t.slice(n,n+this.F),this.length=n-this.offset};var J={O:1,da:8,ea:2048};c.prototype.parse=function(){var t=this.input,n=this.offset;(t[n++]!==K[0]||t[n++]!==K[1]||t[n++]!==K[2]||t[n++]!==K[3])&&e(Error("invalid local file header signature")),this.$=t[n++]|t[n++]<<8,this.I=t[n++]|t[n++]<<8,this.A=t[n++]|t[n++]<<8,this.time=t[n++]|t[n++]<<8,this.V=t[n++]|t[n++]<<8,this.p=(t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)>>>0,this.z=(t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)>>>0,this.J=(t[n++]|t[n++]<<8|t[n++]<<16|t[n++]<<24)>>>0,this.h=t[n++]|t[n++]<<8,this.g=t[n++]|t[n++]<<8,this.filename=String.fromCharCode.apply(null,g?t.subarray(n,n+=this.h):t.slice(n,n+=this.h)),this.Y=g?t.subarray(n,n+=this.g):t.slice(n,n+=this.g),this.length=n-this.offset},p=l.prototype,p.Z=function(){var e,t,n,i=[];for(this.i||u(this),n=this.i,e=0,t=n.length;t>e;++e)i[e]=n[e].filename;return i},p.r=function(t,n){var a;this.G||u(this),a=this.G[t],a===f&&e(Error(t+" not found"));var r;r=n||{};var o,s,l,d,p,m,v,b,y=this.input,w=this.i;if(w||u(this),w[a]===f&&e(Error("wrong index")),s=w[a].aa,o=new c(this.input,s),o.parse(),s+=o.length,l=o.z,0!==(o.I&J.O)){for(!r.password&&!this.j&&e(Error("please set password")),m=this.T(r.password||this.j),v=s,b=s+12;b>v;++v)h(this,m,y[v]);for(s+=12,l-=12,v=s,b=s+l;b>v;++v)y[v]=h(this,m,y[v])}switch(o.A){case B.P:d=g?this.input.subarray(s,s+l):this.input.slice(s,s+l);break;case B.N:d=new i(this.input,{index:s,bufferSize:o.J}).r();break;default:e(Error("unknown compression type"))}if(this.ca){var k,C=f,T="number"==typeof C?C:C=0,A=d.length;for(k=-1,T=7&A;T--;++C)k=k>>>8^x[255&(k^d[C])];for(T=A>>3;T--;C+=8)k=k>>>8^x[255&(k^d[C])],k=k>>>8^x[255&(k^d[C+1])],k=k>>>8^x[255&(k^d[C+2])],k=k>>>8^x[255&(k^d[C+3])],k=k>>>8^x[255&(k^d[C+4])],k=k>>>8^x[255&(k^d[C+5])],k=k>>>8^x[255&(k^d[C+6])],k=k>>>8^x[255&(k^d[C+7])];p=(4294967295^k)>>>0,o.p!==p&&e(Error("wrong crc: file=0x"+o.p.toString(16)+", data=0x"+p.toString(16)))}return d},p.M=function(e){this.j=e},p.k=s.prototype.k,p.T=s.prototype.U,p.s=s.prototype.s,t("Zlib.Unzip",l),t("Zlib.Unzip.prototype.decompress",l.prototype.r),t("Zlib.Unzip.prototype.getFilenames",l.prototype.Z),t("Zlib.Unzip.prototype.setPassword",l.prototype.M)}).call(this),function(){"use strict";function e(e){throw e}function t(e,t){var n=e.split("."),i=u;!(n[0]in i)&&i.execScript&&i.execScript("var "+n[0]);for(var a;n.length&&(a=n.shift());)n.length||t===c?i=i[a]?i[a]:i[a]={}:i[a]=t}function n(e,t,n){var i,a="number"==typeof t?t:t=0,r="number"==typeof n?n:e.length;for(i=-1,a=7&r;a--;++t)i=i>>>8^v[255&(i^e[t])];for(a=r>>3;a--;t+=8)i=i>>>8^v[255&(i^e[t])],i=i>>>8^v[255&(i^e[t+1])],i=i>>>8^v[255&(i^e[t+2])],i=i>>>8^v[255&(i^e[t+3])],i=i>>>8^v[255&(i^e[t+4])],i=i>>>8^v[255&(i^e[t+5])],i=i>>>8^v[255&(i^e[t+6])],i=i>>>8^v[255&(i^e[t+7])];return(4294967295^i)>>>0}function i(){}function a(e){var t,n,i,a,r,o,s,l,d,c,u=e.length,p=0,f=Number.POSITIVE_INFINITY;for(l=0;u>l;++l)e[l]>p&&(p=e[l]),e[l]<f&&(f=e[l]);for(t=1<<p,n=new(h?Uint32Array:Array)(t),i=1,a=0,r=2;p>=i;){for(l=0;u>l;++l)if(e[l]===i){for(o=0,s=a,d=0;i>d;++d)o=o<<1|1&s,s>>=1;for(c=i<<16|l,d=o;t>d;d+=r)n[d]=c;++a}++i,a<<=1,r<<=1}return[n,p,f]}function r(t,n){switch(this.i=[],this.j=32768,this.d=this.f=this.c=this.n=0,this.input=h?new Uint8Array(t):t,this.o=!1,this.k=x,this.z=!1,!n&&(n={})||(n.index&&(this.c=n.index),n.bufferSize&&(this.j=n.bufferSize),n.bufferType&&(this.k=n.bufferType),n.resize&&(this.z=n.resize)),this.k){case k:this.a=32768,this.b=new(h?Uint8Array:Array)(32768+this.j+258);break;case x:this.a=0,this.b=new(h?Uint8Array:Array)(this.j),this.e=this.F,this.q=this.B,this.l=this.D;break;default:e(Error("invalid inflate mode"))}}function o(t,n){for(var i,a=t.f,r=t.d,o=t.input,s=t.c,l=o.length;n>r;)s>=l&&e(Error("input buffer is broken")),a|=o[s++]<<r,r+=8;return i=a&(1<<n)-1,t.f=a>>>n,t.d=r-n,t.c=s,i}function s(e,t){for(var n,i,a=e.f,r=e.d,o=e.input,s=e.c,l=o.length,d=t[0],c=t[1];c>r&&!(s>=l);)a|=o[s++]<<r,r+=8;return n=d[a&(1<<c)-1],i=n>>>16,e.f=a>>i,e.d=r-i,e.c=s,65535&n}function l(e){function t(e,t,n){var i,a,r,l=this.w;for(r=0;e>r;)switch(i=s(this,t)){case 16:for(a=3+o(this,2);a--;)n[r++]=l;break;case 17:for(a=3+o(this,3);a--;)n[r++]=0;l=0;break;case 18:for(a=11+o(this,7);a--;)n[r++]=0;l=0;break;default:l=n[r++]=i}return this.w=l,n}var n,i,r,l,d=o(e,5)+257,c=o(e,5)+1,u=o(e,4)+4,p=new(h?Uint8Array:Array)(z.length);for(l=0;u>l;++l)p[z[l]]=o(e,3);if(!h)for(l=u,u=p.length;u>l;++l)p[z[l]]=0;n=a(p),i=new(h?Uint8Array:Array)(d),r=new(h?Uint8Array:Array)(c),e.w=0,e.l(a(t.call(e,d,n,i)),a(t.call(e,c,n,r)))}function d(e){this.input=e,this.c=0,this.m=[],this.s=!1}var c=void 0,u=this,h="undefined"!=typeof Uint8Array&&"undefined"!=typeof Uint16Array&&"undefined"!=typeof Uint32Array&&"undefined"!=typeof DataView;new(h?Uint8Array:Array)(256);var p;for(p=0;256>p;++p)for(var f=p,m=7,f=f>>>1;f;f>>>=1)--m;var g=[0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117],v=h?new Uint32Array(g):g;i.prototype.getName=function(){return this.name},i.prototype.getData=function(){return this.data},i.prototype.H=function(){return this.I},t("Zlib.GunzipMember",i),t("Zlib.GunzipMember.prototype.getName",i.prototype.getName),t("Zlib.GunzipMember.prototype.getData",i.prototype.getData),t("Zlib.GunzipMember.prototype.getMtime",i.prototype.H);var b,y=[];for(b=0;288>b;b++)switch(!0){case 143>=b:y.push([b+48,8]);break;case 255>=b:y.push([b-144+400,9]);break;case 279>=b:y.push([b-256+0,7]);break;case 287>=b:y.push([b-280+192,8]);break;default:e("invalid literal: "+b)}var w=function(){function t(t){switch(!0){case 3===t:return[257,t-3,0];case 4===t:return[258,t-4,0];case 5===t:return[259,t-5,0];case 6===t:return[260,t-6,0];case 7===t:return[261,t-7,0];case 8===t:return[262,t-8,0];case 9===t:return[263,t-9,0];case 10===t:return[264,t-10,0];case 12>=t:return[265,t-11,1];case 14>=t:return[266,t-13,1];case 16>=t:return[267,t-15,1];case 18>=t:return[268,t-17,1];case 22>=t:return[269,t-19,2];case 26>=t:return[270,t-23,2];case 30>=t:return[271,t-27,2];case 34>=t:return[272,t-31,2];case 42>=t:return[273,t-35,3];case 50>=t:return[274,t-43,3];case 58>=t:return[275,t-51,3];case 66>=t:return[276,t-59,3];case 82>=t:return[277,t-67,4];case 98>=t:return[278,t-83,4];case 114>=t:return[279,t-99,4];case 130>=t:return[280,t-115,4];case 162>=t:return[281,t-131,5];case 194>=t:return[282,t-163,5];case 226>=t:return[283,t-195,5];case 257>=t:return[284,t-227,5];case 258===t:return[285,t-258,0];default:e("invalid length: "+t)}}var n,i,a=[];for(n=3;258>=n;n++)i=t(n),a[n]=i[2]<<24|i[1]<<16|i[0];return a}();h&&new Uint32Array(w);var k=0,x=1;r.prototype.g=function(){for(;!this.o;){var t=o(this,3);switch(1&t&&(this.o=!0),t>>>=1){case 0:var n=this.input,i=this.c,a=this.b,r=this.a,s=n.length,d=c,u=c,p=a.length,f=c;switch(this.d=this.f=0,i+1>=s&&e(Error("invalid uncompressed block header: LEN")),d=n[i++]|n[i++]<<8,i+1>=s&&e(Error("invalid uncompressed block header: NLEN")),u=n[i++]|n[i++]<<8,d===~u&&e(Error("invalid uncompressed block header: length verify")),i+d>n.length&&e(Error("input buffer is broken")),this.k){case k:for(;r+d>a.length;){if(f=p-r,d-=f,h)a.set(n.subarray(i,i+f),r),r+=f,i+=f;else for(;f--;)a[r++]=n[i++];this.a=r,a=this.e(),r=this.a}break;case x:for(;r+d>a.length;)a=this.e({t:2});break;default:e(Error("invalid inflate mode"))}if(h)a.set(n.subarray(i,i+d),r),r+=d,i+=d;else for(;d--;)a[r++]=n[i++];this.c=i,this.a=r,this.b=a;break;case 1:this.l(H,q);break;case 2:l(this);break;default:e(Error("unknown BTYPE: "+t))}}return this.q()};var C,T,A=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],z=h?new Uint16Array(A):A,I=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258],O=h?new Uint16Array(I):I,S=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],U=h?new Uint8Array(S):S,M=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],D=h?new Uint16Array(M):M,E=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],F=h?new Uint8Array(E):E,P=new(h?Uint8Array:Array)(288);for(C=0,T=P.length;T>C;++C)P[C]=143>=C?8:255>=C?9:279>=C?7:8;var j,R,H=a(P),N=new(h?Uint8Array:Array)(30);for(j=0,R=N.length;R>j;++j)N[j]=5;var q=a(N);r.prototype.l=function(e,t){var n=this.b,i=this.a;this.r=e;for(var a,r,l,d,c=n.length-258;256!==(a=s(this,e));)if(256>a)i>=c&&(this.a=i,n=this.e(),i=this.a),n[i++]=a;else for(r=a-257,d=O[r],0<U[r]&&(d+=o(this,U[r])),a=s(this,t),l=D[a],0<F[a]&&(l+=o(this,F[a])),i>=c&&(this.a=i,n=this.e(),i=this.a);d--;)n[i]=n[i++-l];for(;8<=this.d;)this.d-=8,this.c--;this.a=i},r.prototype.D=function(e,t){var n=this.b,i=this.a;this.r=e;for(var a,r,l,d,c=n.length;256!==(a=s(this,e));)if(256>a)i>=c&&(n=this.e(),c=n.length),n[i++]=a;else for(r=a-257,d=O[r],0<U[r]&&(d+=o(this,U[r])),a=s(this,t),l=D[a],0<F[a]&&(l+=o(this,F[a])),i+d>c&&(n=this.e(),c=n.length);d--;)n[i]=n[i++-l];for(;8<=this.d;)this.d-=8,this.c--;this.a=i},r.prototype.e=function(){var e,t,n=new(h?Uint8Array:Array)(this.a-32768),i=this.a-32768,a=this.b;if(h)n.set(a.subarray(32768,n.length));else for(e=0,t=n.length;t>e;++e)n[e]=a[e+32768];if(this.i.push(n),this.n+=n.length,h)a.set(a.subarray(i,i+32768));else for(e=0;32768>e;++e)a[e]=a[i+e];return this.a=32768,a},r.prototype.F=function(e){var t,n,i,a,r=this.input.length/this.c+1|0,o=this.input,s=this.b;return e&&("number"==typeof e.t&&(r=e.t),"number"==typeof e.A&&(r+=e.A)),2>r?(n=(o.length-this.c)/this.r[2],a=258*(n/2)|0,i=a<s.length?s.length+a:s.length<<1):i=s.length*r,h?(t=new Uint8Array(i),t.set(s)):t=s,this.b=t},r.prototype.q=function(){var e,t,n,i,a,r=0,o=this.b,s=this.i,l=new(h?Uint8Array:Array)(this.n+(this.a-32768));if(0===s.length)return h?this.b.subarray(32768,this.a):this.b.slice(32768,this.a);for(t=0,n=s.length;n>t;++t)for(e=s[t],i=0,a=e.length;a>i;++i)l[r++]=e[i];for(t=32768,n=this.a;n>t;++t)l[r++]=o[t];return this.i=[],this.buffer=l},r.prototype.B=function(){var e,t=this.a;return h?this.z?(e=new Uint8Array(t),e.set(this.b.subarray(0,t))):e=this.b.subarray(0,t):(this.b.length>t&&(this.b.length=t),e=this.b),this.buffer=e},d.prototype.G=function(){return this.s||this.g(),this.m.slice()},d.prototype.g=function(){for(var t=this.input.length;this.c<t;){var a=new i,o=c,s=c,l=c,d=c,u=c,p=c,f=c,m=c,g=c,v=this.input,b=this.c;switch(a.u=v[b++],a.v=v[b++],(31!==a.u||139!==a.v)&&e(Error("invalid file signature:"+a.u+","+a.v)),a.p=v[b++],a.p){case 8:break;default:e(Error("unknown compression method: "+a.p))}if(a.h=v[b++],m=v[b++]|v[b++]<<8|v[b++]<<16|v[b++]<<24,a.I=new Date(1e3*m),a.O=v[b++],a.N=v[b++],0<(4&a.h)&&(a.J=v[b++]|v[b++]<<8,b+=a.J),0<(8&a.h)){for(f=[],p=0;0<(u=v[b++]);)f[p++]=String.fromCharCode(u);a.name=f.join("")}if(0<(16&a.h)){for(f=[],p=0;0<(u=v[b++]);)f[p++]=String.fromCharCode(u);a.K=f.join("")}0<(2&a.h)&&(a.C=65535&n(v,0,b),a.C!==(v[b++]|v[b++]<<8)&&e(Error("invalid header crc16"))),o=v[v.length-4]|v[v.length-3]<<8|v[v.length-2]<<16|v[v.length-1]<<24,v.length-b-4-4<512*o&&(d=o),s=new r(v,{index:b,bufferSize:d}),a.data=l=s.g(),b=s.c,a.L=g=(v[b++]|v[b++]<<8|v[b++]<<16|v[b++]<<24)>>>0,n(l,c,c)!==g&&e(Error("invalid CRC-32 checksum: 0x"+n(l,c,c).toString(16)+" / 0x"+g.toString(16))),a.M=o=(v[b++]|v[b++]<<8|v[b++]<<16|v[b++]<<24)>>>0,(4294967295&l.length)!==o&&e(Error("invalid input size: "+(4294967295&l.length)+" / "+o)),this.m.push(a),this.c=b}this.s=!0;var y,w,k,x=this.m,C=0,T=0;for(y=0,w=x.length;w>y;++y)T+=x[y].data.length;if(h)for(k=new Uint8Array(T),y=0;w>y;++y)k.set(x[y].data,C),C+=x[y].data.length;else{for(k=[],y=0;w>y;++y)k[y]=x[y].data;k=Array.prototype.concat.apply([],k)}return k},t("Zlib.Gunzip",d),t("Zlib.Gunzip.prototype.decompress",d.prototype.g),t("Zlib.Gunzip.prototype.getMembers",d.prototype.G)}.call(this)}).bind(i)()}catch(a){}return(i.prototype.commands.reload=function(){var t=this,n=!1;this.alwaysEnabled=!0,this.updateOnSelect=!0,this.shortcuts=[{pattern:"ctrl+shift+r f5"}],this.getstate=function(){return 0},this.init=function(){this.fm.bind("search searchend",function(){n="search"==this.type})},this.fm.bind("contextmenu",function(){var n=t.fm;n.options.sync>=1e3&&(t.extra={icon:"accept",node:e("<span/>").attr({title:n.i18n("autoSync")}).on("click touchstart",function(t){"touchstart"===t.type&&t.originalEvent.touches.length>1||(t.stopPropagation(),t.preventDefault(),e(this).parent().toggleClass("ui-state-disabled",n.options.syncStart).parent().removeClass("ui-state-hover"),n.options.syncStart=!n.options.syncStart,n.autoSync(n.options.syncStart?null:"stop"))}).on("ready",function(){e(this).parent().toggleClass("ui-state-disabled",!n.options.syncStart).css("pointer-events","auto")})})}),this.exec=function(){var t=this.fm;if(!n){var i=t.sync(),a=setTimeout(function(){t.notify({type:"reload",cnt:1,hideCnt:!0}),i.always(function(){t.notify({type:"reload",cnt:-1})})},t.notifyDelay);return i.always(function(){clearTimeout(a),t.trigger("reload")})}e("div.elfinder-toolbar > div."+t.res("class","searchbtn")+" > span.ui-icon-search").click()}}).prototype={forceLoad:!0},i.prototype.commands.rename=function(){this.noChangeDirOnRemovedCwd=!0,this.shortcuts=[{pattern:"f2"+("mac"==this.fm.OS?" enter":"")}],this.getstate=function(e){var e=this.files(e);return 1==e.length&&e[0].phash&&!e[0].locked?0:-1},this.exec=function(t,n){var i,a=this.fm,r=a.getUI("cwd"),o=t||(a.selected().length?a.selected():!1)||[a.cwd().hash],s=o.length,l=a.file(o.shift()),d=".elfinder-cwd-filename",n=n||{},c=a.cwd().hash==l.hash,u=n._currentType?n._currentType:c?"navbar":"files",h="navbar"===u,p=e("#"+a[h?"navHash2Id":"cwdHash2Id"](l.hash)),f="files"===u&&"list"!=a.storage("view"),m=function(){setTimeout(function(){y&&y.blur()},50)},g=function(){C.is(":hidden")||C.addClass("ui-front").elfinderoverlay("hide").off("click",T),x.removeClass("ui-front").css("position","").off("unselect."+a.namespace,m),f?k&&k.css("max-height",""):h||x.css("width","").parent("td").css("overflow","")},v=e.Deferred().fail(function(e){var t=y.parent(),n=a.escape(l.i18||l.name);f&&(n=n.replace(/([_.])/g,"​$1")),h?y.replaceWith(n):t.length?(y.remove(),t.html(n)):(p.find(d).html(n),setTimeout(function(){r.find("#"+a.cwdHash2Id(l.hash)).click()},50)),e&&a.error(e)}).always(function(){g(),a.unbind("resize",A),a.enable()}),b=function(){var t=e.trim(y.val()),n=(y.parent(),!0);if(!z&&x.length){if(y.off("blur"),y[0].setSelectionRange&&y[0].setSelectionRange(0,0),t==l.name)return v.reject();if(a.options.validName&&a.options.validName.test)try{n=a.options.validName.test(t)}catch(i){n=!1}if(!t||"."===t||".."===t||!n)return z=!0,a.error("directory"===l.mime?"errInvDirname":"errInvName",{modal:!0,close:w}),!1;if(a.fileByName(t,l.phash))return z=!0,a.error(["errExists",t],{modal:!0,close:w}),!1;g(),(h?y:k).html(a.escape(t)),a.lockfiles({files:[l.hash]}),a.request({data:{cmd:"rename",target:l.hash,name:t},notify:{type:"rename",cnt:1},navigate:{}}).fail(function(e){v.reject(),e&&Array.isArray(e)&&"errRename"===e[0]||a.sync()}).done(function(e){v.resolve(),c&&a.exec("open",e.added[0].hash)}).always(function(){a.unlockfiles({files:[l.hash]})})}},y=e(f?"<textarea/>":'<input type="text"/>').on("keyup text",function(){f?(this.style.height="1px",this.style.height=this.scrollHeight+"px"):i&&(this.style.width=i+"px",this.scrollWidth>i&&(this.style.width=this.scrollWidth+10+"px"))}).on("keydown",function(t){t.stopImmediatePropagation(),t.keyCode==e.ui.keyCode.ESCAPE?v.reject():t.keyCode==e.ui.keyCode.ENTER&&(t.preventDefault(),y.blur())}).on("mousedown click dblclick",function(e){e.stopPropagation(),"dblclick"===e.type&&e.preventDefault()}).on("blur",b),w=function(){var e=y.val().replace(/\.((tar\.(gz|bz|bz2|z|lzo))|cpio\.gz|ps\.gz|xcf\.(gz|bz2)|[a-z0-9]{1,4})$/gi,"");!z&&a.UA.Mobile&&C.on("click",T).removeClass("ui-front").elfinderoverlay("show"),z&&(z=!1,y.on("blur",b)),y.select().focus(),y[0].setSelectionRange&&y[0].setSelectionRange(0,e.length)},k=h?p.contents().filter(function(){return 3==this.nodeType&&e(this).parent().attr("id")===a.navHash2Id(l.hash)}):p.find(d),x=k.parent(),C=a.getUI("overlay"),T=function(e){z||(e.stopPropagation(),v.reject())},A=function(){p.trigger("scrolltoview")},z=!1;return x.addClass("ui-front").css("position","relative").on("unselect."+a.namespace,m),a.bind("resize",A),h?k.replaceWith(y.val(l.name)):(f?k.css("max-height","none"):h||(i=x.width(),x.width(i-15).parent("td").css("overflow","visible")),k.empty().append(y.val(l.name))),s>1?v.reject():l&&k.length?l.locked?v.reject(["errLocked",l.name]):(a.one("select",function(){y.parent().length&&l&&-1===e.inArray(l.hash,a.selected())&&y.blur()}),y.trigger("keyup"),w(),v):v.reject("errCmdParams",this.title)}},i.prototype.commands.resize=function(){this.updateOnSelect=!1,this.getstate=function(){var e=this.fm.selectedFiles();return 1==e.length&&e[0].read&&e[0].write&&-1!==e[0].mime.indexOf("image/")?0:-1},this.resizeRequest=function(t,n,i){var a=this.fm,n=n||a.file(t.target),r=n?a.openUrl(n.hash):null,o=n?n.tmb:null,s=a.isCommandEnabled("resize",t.target);if(s&&(!n||n&&n.read&&n.write&&-1!==n.mime.indexOf("image/")))return a.request({data:Object.assign(t,{cmd:"resize"}),notify:{type:"resize",cnt:1},prepare:function(e){var t;return e&&(e.added&&e.added.length&&e.added[0].tmb?t=e.added[0]:e.changed&&e.changed.length&&e.changed[0].tmb&&(t=e.changed[0]),t&&(n=t,r=a.openUrl(n.hash),n.tmb&&"1"!=n.tmb&&n.tmb===o))?void(n.tmb=""):void(o="")}}).fail(function(e){i&&i.reject(e)}).done(function(){var e="1"!=n.url?a.url(n.hash):"";o&&a.one("resizedone",function(){a.reloadContents(a.tmb(n).url).done(function(){a.trigger("tmbreload",{files:[{hash:n.hash,tmb:o}]})})}),a.reloadContents(r),e&&e!==r&&a.reloadContents(e),i&&i.resolve()});var l;return l=n?-1===n.mime.indexOf("image/")?["errResize",n.name,"errUsupportType"]:["errResize",n.name,"errPerm"]:["errResize",t.target,"errPerm"],i?i.reject(l):a.error(l),e.Deferred().reject(l)},this.exec=function(t){var n,i,a=this,r=this.fm,o=this.files(t),s=e.Deferred(),l=r.api>1,d=650,c=r.getUI(),u=e().controlgroup?"controlgroup":"buttonset",h="undefind"==typeof this.options.grid8px||"disable"!==this.options.grid8px,p=Array.isArray(this.options.presetSize)?this.options.presetSize:[],f="elfinder-dialog-resize",m="elfinder-dialog-active",g=function(t,n){var i,o,g,v,b="image/jpeg"===t.mime,y=e('<div class="elfinder-dialog-resize '+r.res("class","editing")+'"/>'),w='<input type="text" size="5"/>',k='<div class="elfinder-resize-row"/>',x='<div class="elfinder-resize-label"/>',C=e('<div class="elfinder-resize-control"/>').on("focus","input[type=text]",function(){e(this).select()}),T=e('<div class="elfinder-resize-preview"/>').on("touchmove",function(e){e.stopPropagation(),e.preventDefault()}),A=e('<div class="elfinder-resize-spinner">'+r.i18n("ntfloadimg")+"</div>"),z=e('<div class="elfinder-resize-handle touch-punch"/>'),I=e('<div class="elfinder-resize-handle touch-punch"/>'),O=e('<div class="elfinder-resize-uiresize"/>'),S=e('<div class="elfinder-resize-uicrop"/>'),U=e('<div class="elfinder-resize-rotate"/>'),M=e("<button/>").attr("title",r.i18n("rotate-cw")).append(e('<span class="elfinder-button-icon elfinder-button-icon-rotate-l"/>')),D=e("<button/>").attr("title",r.i18n("rotate-ccw")).append(e('<span class="elfinder-button-icon elfinder-button-icon-rotate-r"/>')),E=e("<span />"),F=e('<button class="elfinder-resize-reset">').text(r.i18n("reset")).on("click",function(){Ie()}).button({icons:{primary:"ui-icon-arrowrefresh-1-n"},text:!1}),P=e('<div class="elfinder-resize-type"/>').append('<input class="" type="radio" name="type" id="'+n+'-resize" value="resize" checked="checked" /><label for="'+n+'-resize">'+r.i18n("resize")+"</label>",'<input class="api2" type="radio" name="type" id="'+n+'-crop" value="crop" /><label class="api2" for="'+n+'-crop">'+r.i18n("crop")+"</label>",'<input class="api2" type="radio" name="type" id="'+n+'-rotate" value="rotate" /><label class="api2" for="'+n+'-rotate">'+r.i18n("rotate")+"</label>"),j="resize",R=(P[u]()[u]("disable").find("input").change(function(){j=e(this).val(),Ie(),Me(!0),De(!0),Ee(!0),"resize"==j?(O.show(),U.hide(),S.hide(),Me(),b&&me.insertAfter(O.find(".elfinder-resize-grid8"))):"crop"==j?(U.hide(),O.hide(),S.show(),De(),b&&me.insertAfter(S.find(".elfinder-resize-grid8"))):"rotate"==j&&(O.hide(),S.hide(),U.show(),Ee())}),e(w).change(function(){var e=parseInt(R.val()),t=parseInt(re?Math.round(e/te):H.val());e>0&&t>0&&(Oe.updateView(e,t),H.val(t))})),H=e(w).change(function(){var e=parseInt(H.val()),t=parseInt(re?Math.round(e*te):R.val());t>0&&e>0&&(Oe.updateView(t,e),R.val(t))}),N=e(w).change(function(){Se.updateView()}),q=e(w).change(function(){Se.updateView()}),_=e(w).change(function(){Se.updateView("w")}),L=e(w).change(function(){Se.updateView("h")}),W=b&&l?e(w).val(r.option("jpgQuality")).addClass("quality").on("blur",function(){var e=Math.min(100,Math.max(1,parseInt(this.value)));y.find("input.quality").val(e)}):null,$=e('<input type="text" size="3" maxlength="3" value="0" />').change(function(){Ue.update()}),B=e('<div class="elfinder-resize-rotate-slider touch-punch"/>').slider({min:0,max:360,value:$.val(),animate:!0,change:function(e,t){t.value!=B.slider("value")&&Ue.update(t.value)},slide:function(e,t){Ue.update(t.value,!1)}}).find(".ui-slider-handle").addClass("elfinder-tabstop").off("keydown").on("keydown",function(t){t.keyCode!=e.ui.keyCode.LEFT&&t.keyCode!=e.ui.keyCode.RIGHT||(t.stopPropagation(),t.preventDefault(),Ue.update(Number($.val())+(t.keyCode==e.ui.keyCode.RIGHT?1:-1),!1))}).end(),V={},K=function(e){var t,n,i,a,r,o,s;try{t=V[Math.round(e.offsetX)][Math.round(e.offsetY)]}catch(e){}t&&(n=t[0],i=t[1],a=t[2],r=t[3],o=t[4],s=t[5],J(n,i,a,"click"===e.type))},G=function(t){J(e(this).css("backgroundColor"),"","","click"===t.type)},J=function(t,n,i,a){var r,o,s;"string"==typeof t&&(n="",t&&(r=e("<span>").css("backgroundColor",t).css("backgroundColor"))&&(o=r.match(/rgb\s*\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*\)/i))&&(t=Number(o[1]),n=Number(o[2]),i=Number(o[3]))),s=""===n?t:"#"+Y(t,n,i),Q.val(s).css({backgroundColor:s,backgroundImage:"none",color:384>t+n+i?"#fff":"#000"}),T.css("backgroundColor",s),a&&(Ae.off(".picker").removeClass("elfinder-resize-picking"),ee.off(".picker").removeClass("elfinder-resize-picking"))},Y=function(t,n,i){return e.map([t,n,i],function(e){return("0"+parseInt(e).toString(16)).slice(-2)}).join("")},X=e("<button>").text(r.i18n("colorPicker")).on("click",function(){Ae.on("mousemove.picker click.picker",K).addClass("elfinder-resize-picking"),ee.on("mousemove.picker click.picker","span",G).addClass("elfinder-resize-picking")}).button({icons:{primary:"ui-icon-pin-s"},text:!1}),Z=e("<button>").text(r.i18n("reset")).on("click",function(){J("","","",!0)}).button({icons:{primary:"ui-icon-arrowrefresh-1-n"},text:!1}),Q=e('<input class="elfinder-resize-bg" type="text">').on("focus",function(){e(this).attr("style","")}).on("blur",function(){J(e(this).val())}),ee=e('<div class="elfinder-resize-pallet">').on("click","span",function(){J(e(this).css("backgroundColor"))}),te=1,ne=1,ie=0,ae=0,re=!0,oe=!1,se=0,le=0,de=0,ce=0,ue=0,he=b?h:!1,pe=e("<button>").html(r.i18n("aspectRatio")).on("click",function(){re=!re,pe.button("option",{icons:{primary:re?"ui-icon-locked":"ui-icon-unlocked"}}),Oe.fixHeight(),z.resizable("option","aspectRatio",re).data("uiResizable")._aspectRatio=re;
|
||
}).button({icons:{primary:re?"ui-icon-locked":"ui-icon-unlocked"},text:!1}),fe=e("<button>").html(r.i18n("aspectRatio")).on("click",function(){oe=!oe,fe.button("option",{icons:{primary:oe?"ui-icon-locked":"ui-icon-unlocked"}}),I.resizable("option","aspectRatio",oe).data("uiResizable")._aspectRatio=oe}).button({icons:{primary:oe?"ui-icon-locked":"ui-icon-unlocked"},text:!1}),me=e("<button>").html(r.i18n(he?"enabled":"disabled")).toggleClass("ui-state-active",he).on("click",function(){he=!he,me.html(r.i18n(he?"enabled":"disabled")).toggleClass("ui-state-active",he),he&&(R.val(ze(R.val())),H.val(ze(H.val())),_.val(ze(_.val())),L.val(ze(L.val())),N.val(ze(N.val())),q.val(ze(q.val())),O.is(":visible")?Oe.updateView(R.val(),H.val()):S.is(":visible")&&Se.updateView())}).button(),ge=function(){var e;e=Math.min(se,le)/Math.sqrt(Math.pow(ie,2)+Math.pow(ae,2)),de=Math.ceil(ie*e),ce=Math.ceil(ae*e),Ae.width(de).height(ce).css("margin-top",(le-ce)/2+"px").css("margin-left",(se-de)/2+"px"),Ae.is(":visible")&&Q.is(":visible")&&("image/png"!==t.mime?(T.css("backgroundColor",Q.val()),setTimeout(function(){i&&i.width!==de&&be()},0)):(Q.parent().hide(),ee.hide()))},ve=function(){Oe.updateView(ie,ae),ge(),xe.width(ke.width()).height(ke.height()),Ce.width(ke.width()).height(ke.height()),Se.updateView()},be=function(){if(o){var t,n,a,r,s,l,d,c,u,h,p,f,m,g,v,b,y,w,k,x={},C=[],T=function(e,t,n){var i,a,r,o=Math.max(Math.max(e,t),n),s=Math.min(Math.min(e,t),n);return o===s?i=0:e===o?i=((t-n)/(o-s)*60+360)%360:t===o?i=(n-e)/(o-s)*60+120:n===o&&(i=(e-t)/(o-s)*60+240),a=(o-s)/o,r=(.3*e+.59*t+.11*n)/255,[i,a,r,"hsl"]};e:try{n=i.width=Ae.width(),a=i.height=Ae.height(),m=n/ie,o.scale(m,m),o.drawImage(Ae.get(0),0,0),f=o.getImageData(0,0,n,a).data,g=.1*n,v=.9*n,b=.1*a,y=.9*a;for(var A=0;a-1>A;A++)for(var z=0;n-1>z;z++){if(t=4*z+A*n*4,r=f[t],s=f[t+1],l=f[t+2],d=f[t+3],255!==d){Q.parent().hide(),ee.hide();break e}h=T(r,s,l),p=Math.round(h[0]),c=Math.round(100*h[1]),u=Math.round(100*h[2]),V[z]||(V[z]={}),V[z][A]=[r,s,l,p,c,u],(g>z||z>v)&&(b>A||A>y)&&(w=r+","+s+","+l,x[w]?++x[w]:x[w]=1)}ee.children(":first").length||(k=1,e.each(x,function(e,t){C.push({c:e,v:t})}),e.each(C.sort(function(e,t){return e.v>t.v?-1:1}),function(){return this.v<2||k>10?!1:(ee.append(e('<span style="width:20px;height:20px;display:inline-block;background-color:rgb('+this.c+');">')),void++k)}))}catch(I){X.hide(),ee.hide()}}},ye=function(){try{i=document.createElement("canvas"),o=i.getContext("2d")}catch(e){X.hide(),ee.hide()}},we=function(){We.on("click","span.elfinder-resize-preset",function(){var t=e(this),n=t.data("s")[0],i=t.data("s")[1],a=ie/ae;ie>n||ae>i?n>=ie?n=ze(i*a):i>=ae?i=ze(n/a):ie-n>ae-i?i=ze(n/a):n=ze(i*a):(n=ie,i=ae),R.val(n),H.val(i),Oe.updateView(n,i)}),$e.on("click","span.elfinder-resize-preset",function(){var t=e(this),n=t.data("s")[0],i=t.data("s")[1],a=N.val(),r=q.val();ie>=n&&ae>=i&&(0>ie-n-a&&(a=ie-n),0>ae-i-r&&(r=ae-i),N.val(a),q.val(r),_.val(n),L.val(i),Se.updateView())}),$e.children("span.elfinder-resize-preset").each(function(){var t=e(this),n=t.data("s")[0],i=t.data("s")[1];t[ie>=n&&ae>=i?"show":"hide"]()})},ke=e("<img/>").on("load",function(){var t=ke.get(0),n=t.naturalWidth?null:{w:ke.width(),h:ke.height()};n&&ke.removeAttr("width").removeAttr("height"),ie=t.naturalWidth||t.width||ke.width(),ae=t.naturalHeight||t.height||ke.height(),n&&ke.width(n.w).height(n.h),g.show();var i,a=ae/ie;1>a&&T.height()>T.width()*a&&T.height(T.width()*a),T.height()>ke.height()+20&&T.height(ke.height()+20),le=T.height()-(z.outerHeight()-z.height()),A.remove(),te=ie/ae,z.append(ke.show()).show(),R.val(ie),H.val(ae),ye(),we(),ve(),P[u]("enable"),i=C.find("input,select").prop("disabled",!1).filter(":text").on("keydown",function(t){return t.keyCode==e.ui.keyCode.ENTER?(t.stopPropagation(),t.preventDefault(),void r.confirm({title:e("input:checked",P).val(),text:"confirmReq",accept:{label:"btnApply",callback:function(){Pe()}},cancel:{label:"btnCancel",callback:function(){e(this).focus()}},buttons:[{label:"btnSaveAs",callback:function(){setTimeout(je,10)}}]})):void 0}).on("keyup",function(){var t=e(this);t.hasClass("elfinder-resize-bg")||setTimeout(function(){t.val(t.val().replace(/[^0-9]/g,""))},10)}).filter(":first"),!r.UA.Mobile&&i.focus(),Me()}).on("error",function(){A.text("Unable to load image").css("background","transparent")}),xe=e("<div/>"),Ce=e("<img/>"),Te=e("<div/>"),Ae=e('<img class="elfinder-resize-imgrotate" />'),ze=function(e,t){return e=he?8*Math.round(e/8):Math.round(e),e=Math.max(0,e),t&&e>t&&(e=he?8*Math.floor(t/8):t),e},Ie=function(){R.val(ie),H.val(ae),Oe.updateView(ie,ae),N.val(0),q.val(0),_.val(ie),L.val(ae),Se.updateView()},Oe={update:function(){R.val(ze(ke.width()/ne)),H.val(ze(ke.height()/ne))},updateView:function(e,t){e>se||t>le?e/se>t/le?(ne=se/e,ke.width(se).height(Math.ceil(t*ne))):(ne=le/t,ke.height(le).width(Math.ceil(e*ne))):ke.width(e).height(t),ne=ke.width()/e,E.text("1 : "+(1/ne).toFixed(2)),Oe.updateHandle()},updateHandle:function(){z.width(ke.width()).height(ke.height())},fixHeight:function(){var e,t;re&&(e=R.val(),t=ze(e/te),Oe.updateView(e,t),H.val(t))}},Se={update:function(e){N.val(ze((I.data("x")||I.position().left)/ne,ie)),q.val(ze((I.data("y")||I.position().top)/ne,ae)),"xy"!==e&&(_.val(ze((I.data("w")||I.width())/ne,ie-N.val())),L.val(ze((I.data("h")||I.height())/ne,ae-q.val())))},updateView:function(e){var t,n,i,a,r;N.val(ze(N.val(),ie-(he?8:1))),q.val(ze(q.val(),ae-(he?8:1))),_.val(ze(_.val(),ie-N.val())),L.val(ze(L.val(),ae-q.val())),oe&&(t=Te.width()/Te.height(),"w"===e?L.val(ze(parseInt(_.val())/t)):"h"===e&&_.val(ze(parseInt(L.val())*t))),n=Math.round(parseInt(N.val())*ne),i=Math.round(parseInt(q.val())*ne),"xy"!==e?(a=Math.round(parseInt(_.val())*ne),r=Math.round(parseInt(L.val())*ne)):(a=I.data("w"),r=I.data("h")),I.data({x:n,y:i,w:a,h:r}).width(a).height(r).css({left:n,top:i}),Te.width(a).height(r)},resize_update:function(e,t){I.data({x:t.position.left,y:t.position.top,w:t.size.width,h:t.size.height}),Se.update(),Se.updateView()},drag_update:function(e,t){I.data({x:t.position.left,y:t.position.top}),Se.update("xy")}},Ue={mouseStartAngle:0,imageStartAngle:0,imageBeingRotated:!1,update:function(e,t){"undefined"==typeof e&&(ue=e=parseInt($.val())),"undefined"==typeof t&&(t=!0),!t||r.UA.Opera||r.UA.ltIE8?Ae.rotate(e):Ae.animate({rotate:e+"deg"}),e%=360,0>e&&(e+=360),$.val(parseInt(e)),B.slider("value",$.val())},execute:function(e){if(Ue.imageBeingRotated){var t=Ue.getCenter(Ae),n=e.pageX-t[0],i=e.pageY-t[1],a=Math.atan2(i,n),r=a-Ue.mouseStartAngle+Ue.imageStartAngle;return r=Math.round(180*parseFloat(r)/Math.PI),e.shiftKey&&(r=15*Math.round((r+6)/15)),Ae.rotate(r),r%=360,0>r&&(r+=360),$.val(r),B.slider("value",$.val()),!1}},start:function(t){Ue.imageBeingRotated=!0;var n=Ue.getCenter(Ae),i=t.pageX-n[0],a=t.pageY-n[1];return Ue.mouseStartAngle=Math.atan2(a,i),Ue.imageStartAngle=parseFloat(Ae.rotate())*Math.PI/180,e(document).mousemove(Ue.execute),!1},stop:function(t){return Ue.imageBeingRotated?(e(document).unbind("mousemove",Ue.execute),setTimeout(function(){Ue.imageBeingRotated=!1},10),!1):void 0},getCenter:function(e){var t=Ae.rotate();Ae.rotate(0);var n=Ae.offset(),i=n.left+Ae.width()/2,a=n.top+Ae.height()/2;return Ae.rotate(t),Array(i,a)}},Me=function(t){e.fn.resizable&&(t?(z.filter(":ui-resizable").resizable("destroy"),z.hide()):(z.show(),z.resizable({alsoResize:ke,aspectRatio:re,resize:Oe.update,stop:Oe.fixHeight}),Le()))},De=function(t){e.fn.draggable&&e.fn.resizable&&(t?(I.filter(":ui-resizable").resizable("destroy").filter(":ui-draggable").draggable("destroy"),xe.hide()):(xe.show(),I.resizable({containment:xe,aspectRatio:oe,resize:Se.resize_update,handles:"all"}).draggable({handle:Te,containment:Ce,drag:Se.drag_update,stop:function(){Se.updateView("xy")}}),Le(),Se.update()))},Ee=function(t){e.fn.draggable&&e.fn.resizable&&(t?Ae.hide():(Ae.show(),Le()))},Fe=function(){var e,t,n,i,a,o,s="";if("resize"==j)e=parseInt(R.val())||0,t=parseInt(H.val())||0;else if("crop"==j)e=parseInt(_.val())||0,t=parseInt(L.val())||0,n=parseInt(N.val())||0,i=parseInt(q.val())||0;else if("rotate"==j){if(e=ie,t=ae,a=parseInt($.val())||0,0>a||a>360)return r.error("Invalid rotate degree"),!1;if(0==a||360==a)return r.error("errResizeNoChange"),!1;s=Q.val()}if(o=W?parseInt(W.val()):0,"rotate"!=j){if(0>=e||0>=t)return r.error("Invalid image size"),!1;if(e==ie&&t==ae)return r.error("errResizeNoChange"),!1}return{w:e,h:t,x:n,y:i,d:a,q:o,b:s}},Pe=function(){var e;(e=Fe())&&(y.elfinderdialog("close"),a.resizeRequest({target:t.hash,width:e.w,height:e.h,x:e.x,y:e.y,degree:e.d,quality:e.q,bg:e.b,mode:j},t,s))},je=function(){var n,i=function(){n.fadeIn(function(){v.addClass(m)})},o=function(){a.mime=t.mime,a.prefix=t.name.replace(/ \d+(\.[^.]+)?$/,"$1"),a.requestCmd="mkfile",a.nextAction={},a.data={target:t.phash},e.proxy(r.res("mixin","make"),a)().done(function(e){var a;e.added&&e.added.length?(a=e.added[0].hash,r.url(t.hash,{async:!0,temporary:!0}).done(function(e){r.request({options:{type:"post"},data:{cmd:"put",target:a,content:r.convAbsUrl(e)},notify:{type:"save",cnt:1},syncOnFail:!0}).fail(i).done(function(e){e=r.normalize(e),r.updateCache(e),t=r.file(a),e.changed&&e.changed.length&&r.change(e),v.show().find(".elfinder-dialog-title").html(r.escape(t.name)),Pe(),n.fadeIn()})}).fail(i)):i()}).fail(i).always(function(){delete a.mime,delete a.prefix,delete a.nextAction,delete a.data}),r.trigger("unselectfiles",{files:[t.hash]})},s=null;Fe()&&(n=r.getUI().children("."+f).fadeOut(),v.removeClass(m),r.searchStatus.state<2&&t.phash!==r.cwd().hash&&(s=r.exec("open",[t.phash],{thash:t.phash})),e.when([s]).done(function(){s?r.one("cwdrender",o):o()}).fail(i))},Re={},He="elfinder-resize-handle-hline",Ne="elfinder-resize-handle-vline",qe="elfinder-resize-handle-point",_e=r.openUrl(t.hash,!!r.isCORS),Le=function(){if(!v.hasClass("elfinder-dialog-minimized")){We.hide(),$e.hide();var t,n=e(window).height(),i=e(window).width(),a=y.find("div.elfinder-resize-control").width(),r=T.width(),o=(v.width(),"auto");v.width(Math.min(d,i-30)),T.attr("style",""),ie&&ae&&(se=T.width()-(z.outerWidth()-z.width()),le=T.height()-(z.outerHeight()-z.height()),Oe.updateView(ie,ae)),r=T.width(),t=y.width()-20,r>t?T.width(t):a>t-r?i>n?T.width(t-a-20):T.css({"float":"none",marginLeft:"auto",marginRight:"auto"}):o=a,se=T.width()-(z.outerWidth()-z.width()),c.hasClass("elfinder-fullscreen")?v.height()>n&&(n-=2,T.height(n-v.height()+T.height()),v.css("top",0-c.offset().top)):(n-=30,T.height()>n&&T.height(n)),le=T.height()-(z.outerHeight()-z.height()),ie&&ae&&ve(),ke.height()&&T.height()>ke.height()+20&&(T.height(ke.height()+20),le=T.height()-(z.outerHeight()-z.height()),ge()),We.css("width",o).show(),$e.css("width",o).show(),$e.children("span.elfinder-resize-preset:visible").length||$e.hide()}},We=function(){var t,n=e('<fieldset class="elfinder-resize-preset-container">').append(e("<legend>").html(r.i18n("presets"))).hide();return e.each(p,function(i,a){2===a.length&&(t=!0,n.append(e('<span class="elfinder-resize-preset"/>').data("s",a).text(a[0]+"x"+a[1]).button()))}),t?n:e()}(),$e=We.clone(!0);r.isCORS&&(ke.attr("crossorigin","use-credentials"),Ce.attr("crossorigin","use-credentials"),Ae.attr("crossorigin","use-credentials")),Ae.mousedown(Ue.start),e(document).mouseup(Ue.stop),O.append(e(k).append(e(x).text(r.i18n("width")),R),e(k).append(e(x).text(r.i18n("height")),H,e('<div class="elfinder-resize-whctrls">').append(pe,F)),W?e(k).append(e(x).text(r.i18n("quality")),W,e("<span/>").text(" (1-100)")):e(),b?e(k).append(e(x).text(r.i18n("8pxgrid")).addClass("elfinder-resize-grid8"),me):e(),e(k).append(e(x).text(r.i18n("scale")),E),e(k).append(We)),l&&(S.append(e(k).append(e(x).text("X"),N),e(k).append(e(x).text("Y")).append(q),e(k).append(e(x).text(r.i18n("width")),_),e(k).append(e(x).text(r.i18n("height")),L,e('<div class="elfinder-resize-whctrls">').append(fe,F.clone(!0))),W?e(k).append(e(x).text(r.i18n("quality")),W.clone(!0),e("<span/>").text(" (1-100)")):e(),b?e(k).append(e(x).text(r.i18n("8pxgrid")).addClass("elfinder-resize-grid8")):e(),e(k).append($e)),U.append(e(k).addClass("elfinder-resize-degree").append(e(x).text(r.i18n("rotate")),$,e("<span/>").text(r.i18n("degree")),e("<div/>").append(M,D)[u]()),e(k).css("height","20px").append(B),W?e(k).addClass("elfinder-resize-quality").append(e(x).text(r.i18n("quality")),W.clone(!0),e("<span/>").text(" (1-100)")):e(),e(k).append(e(x).text(r.i18n("bgcolor")),Q,X,Z),e(k).css("height","20px").append(ee)),M.on("click",function(){ue-=90,Ue.update(ue)}),D.on("click",function(){ue+=90,Ue.update(ue)})),y.append(P).on("resize",function(e){e.stopPropagation()}),l?C.append(e(k),O,S.hide(),U.hide()):C.append(e(k),O),z.append('<div class="'+He+" "+He+'-top"/>','<div class="'+He+" "+He+'-bottom"/>','<div class="'+Ne+" "+Ne+'-left"/>','<div class="'+Ne+" "+Ne+'-right"/>','<div class="'+qe+" "+qe+'-e"/>','<div class="'+qe+" "+qe+'-se"/>','<div class="'+qe+" "+qe+'-s"/>'),T.append(A).append(z.hide()).append(ke.hide()),l&&(I.css("position","absolute").append('<div class="'+He+" "+He+'-top"/>','<div class="'+He+" "+He+'-bottom"/>','<div class="'+Ne+" "+Ne+'-left"/>','<div class="'+Ne+" "+Ne+'-right"/>','<div class="'+qe+" "+qe+'-n"/>','<div class="'+qe+" "+qe+'-e"/>','<div class="'+qe+" "+qe+'-s"/>','<div class="'+qe+" "+qe+'-w"/>','<div class="'+qe+" "+qe+'-ne"/>','<div class="'+qe+" "+qe+'-se"/>','<div class="'+qe+" "+qe+'-sw"/>','<div class="'+qe+" "+qe+'-nw"/>'),T.append(xe.css("position","absolute").hide().append(Ce,I.append(Te))),T.append(Ae.hide())),T.css("overflow","hidden"),y.append(T,C),Re[r.i18n("btnApply")]=Pe,Re[r.i18n("btnSaveAs")]=function(){setTimeout(je,10)},Re[r.i18n("btnCancel")]=function(){y.elfinderdialog("close")},y.find("input,button").addClass("elfinder-tabstop"),v=r.dialog(y,{title:r.escape(t.name),width:d,resizable:!1,buttons:Re,open:function(){g=v.find(".ui-dialog-titlebar .elfinder-titlebar-minimize").hide(),r.bind("resize",Le),ke.attr("src",_e+(-1===_e.indexOf("?")?"?":"&")+"_="+Math.random()),Ce.attr("src",ke.attr("src")),Ae.attr("src",ke.attr("src"))},close:function(){r.unbind("resize",Le),e(this).elfinderdialog("destroy")},resize:function(e,t){t&&"off"===t.minimize&&Le()}}).attr("id",n).closest(".ui-dialog").addClass(f),r.UA.ltIE8&&e(".elfinder-dialog").css("filter",""),Te.css({opacity:.2,"background-color":"#fff",position:"absolute"}),I.css("cursor","move"),I.find(".elfinder-resize-handle-point").css({"background-color":"#fff",opacity:.5,"border-color":"#000"}),l||P.find(".api2").remove(),C.find("input,select").prop("disabled",!0)};return o.length&&-1!==o[0].mime.indexOf("image/")?(n="resize-"+r.namespace+"-"+o[0].hash,i=r.getUI().find("#"+n),i.length?(i.elfinderdialog("toTop"),s.resolve()):(g(o[0],n),s)):s.reject()}},function(e){var t=function(e,t){var n=0;for(n in t)if("undefined"!=typeof e[t[n]])return t[n];return e[t[n]]="",t[n]};if(e.cssHooks.rotate={get:function(t,n,i){return e(t).rotate()},set:function(t,n){return e(t).rotate(n),n}},e.cssHooks.transform={get:function(e,n,i){var a=t(e.style,["WebkitTransform","MozTransform","OTransform","msTransform","transform"]);return e.style[a]},set:function(e,n){var i=t(e.style,["WebkitTransform","MozTransform","OTransform","msTransform","transform"]);return e.style[i]=n,n}},e.fn.rotate=function(e){if("undefined"==typeof e){if(window.opera){var t=this.css("transform").match(/rotate\((.*?)\)/);return t&&t[1]?Math.round(180*parseFloat(t[1])/Math.PI):0}var t=this.css("transform").match(/rotate\((.*?)\)/);return t&&t[1]?parseInt(t[1]):0}return this.css("transform",this.css("transform").replace(/none|rotate\(.*?\)/,"")+"rotate("+parseInt(e)+"deg)"),this},e.fx.step.rotate=function(t){0==t.state&&(t.start=e(t.elem).rotate(),t.now=t.start),e(t.elem).rotate(t.now)},"undefined"==typeof window.addEventListener&&"undefined"==typeof document.getElementsByClassName){var n=function(e){for(var t=e,n=t.offsetLeft,i=t.offsetTop;t.offsetParent&&(t=t.offsetParent,t==document.body||"static"==t.currentStyle.position);)t!=document.body&&t!=document.documentElement&&(n-=t.scrollLeft,i-=t.scrollTop),n+=t.offsetLeft,i+=t.offsetTop;return{x:n,y:i}},i=function(e){if("static"==e.currentStyle.position){var t=n(e);e.style.position="absolute",e.style.left=t.x+"px",e.style.top=t.y+"px"}},a=function(e,t){var n,a=1,r=1,o=1,s=1;if("undefined"!=typeof e.style.msTransform)return!0;i(e),n=t.match(/rotate\((.*?)\)/);var l=n&&n[1]?parseInt(n[1]):0;l%=360,0>l&&(l=360+l);var d=l*Math.PI/180,c=Math.cos(d),u=Math.sin(d);a*=c,r*=-u,o*=u,s*=c,e.style.filter=(e.style.filter||"").replace(/progid:DXImageTransform\.Microsoft\.Matrix\([^)]*\)/,"")+("progid:DXImageTransform.Microsoft.Matrix(M11="+a+",M12="+r+",M21="+o+",M22="+s+",FilterType='bilinear',sizingMethod='auto expand')");var h=parseInt(e.style.width||e.width||0),p=parseInt(e.style.height||e.height||0),d=l*Math.PI/180,f=Math.abs(Math.cos(d)),m=Math.abs(Math.sin(d)),g=(h-(h*f+p*m))/2,v=(p-(h*m+p*f))/2;return e.style.marginLeft=Math.floor(g)+"px",e.style.marginTop=Math.floor(v)+"px",!0},r=e.cssHooks.transform.set;e.cssHooks.transform.set=function(e,t){return r.apply(this,[e,t]),a(e,t),t}}}(jQuery),(i.prototype.commands.restore=function(){var t=this,n=this.fm,i=0,a=function(t){var r=e.Deferred(),o=[],s=[],l=[],d=[];return e.each(t,function(e,t){"directory"===t.mime?o.push(t):s.push(t)}),o.length?(e.each(o,function(e,t){l.push(n.request({data:{cmd:"open",target:t.hash},preventDefault:!0,asNotOpen:!0})),d[e]=t.hash}),e.when.apply(e,l).fail(function(){r.reject()}).done(function(){var t=[];e.each(arguments,function(e,n){n.files&&(n.files.length?t=t.concat(n.files):t.push({hash:"fakefile_"+i++,phash:d[e],mime:"fakefile",name:"fakefile",ts:0}))}),n.cache(t),a(t).done(function(e){s=s.concat(e),r.resolve(s)})})):r.resolve(s),r.promise()},r=function(t,r,o){var s,l={},d=[],c=!1,u=[];n.lockfiles({files:o}),u=e.map(r,function(e){return"directory"===e.mime?e.hash:null}),t.done(function(){u&&n.exec("rm",u,{forceRm:!0,quiet:!0})}).always(function(){n.unlockfiles({files:o})}),s=setTimeout(function(){n.notify({type:"search",cnt:1,hideCnt:!0})},n.notifyDelay),i=0,a(r).always(function(){s&&clearTimeout(s),n.notify({type:"search",cnt:-1,hideCnt:!0})}).fail(function(){t.reject("errRestore","errFileNotFound")}).done(function(i){var a=["errRestore","errFolderNotFound"],r="";i.length?(e.each(i,function(t,i){for(var a,o,s,u=i.phash;u;){if(o=n.trashes[u]){if(!l[o]){if(c)return d.push(i.hash),null;l[o]={},c=!0}s=n.path(i.hash).substr(n.path(u).length).replace(/\\/g,"/"),s=s.replace(/\/[^\/]+?$/,""),""===s&&(s="/"),l[o][s]||(l[o][s]=[]),"fakefile"===i.mime?n.updateCache({removed:[i.hash]}):l[o][s].push(i.hash),(!r||r.length>s.length)&&(r=s);break}a=n.file(u),a?u=a.phash:(u=!1,e.each(n.trashes,function(e){var t=n.file(e),a=n.path(e);return t.volumeid&&0!==i.hash.indexOf(t.volumeid)||0!==n.path(i.hash).indexOf(a)?void 0:(u=e,!1)}))}}),c?e.each(l,function(i,s){var l=Object.keys(s),c=l.length;n.request({data:{cmd:"mkdir",target:i,dirs:l},notify:{type:"chkdir",cnt:c},preventFail:!0}).fail(function(e){t.reject(e),n.unlockfiles({files:o})}).done(function(i){var o,l;(l=i.hashes)?(o=n.getCommand("paste"),o?n.one("mkdirdone",function(){var i=!1;e.each(s,function(e,s){l[e]&&(s.length?n.file(l[e])?(n.clipboard(s,!0),o.exec([l[e]],{_cmd:"restore",noToast:e!==r}).done(function(e){e&&(e.error||e.warning)&&(i=!0)}).fail(function(){i=!0}).always(function(){--c<1&&(t[i?"reject":"resolve"](),d.length&&n.exec("restore",d))})):t.reject(a):--c<1&&(t.resolve(),d.length&&n.exec("restore",d)))})}):t.reject(["errRestore","errCmdNoSupport","(paste)"])):t.reject(a)})}):t.reject(a)):(t.reject("errFileNotFound"),u&&n.exec("rm",u,{forceRm:!0,quiet:!0}))})};this.linkedCmds=["copy","paste","mkdir","rm"],this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+z"}],this.getstate=function(t,i){return t=t||n.selected(),t.length&&e.map(t,function(e){var t=n.file(e);return!t||t.locked||n.isRoot(t)?null:e}).length==t.length?0:-1},this.exec=function(i){var a=e.Deferred().fail(function(e){e&&n.error(e)}),o=t.files(i);return o.length?(e.each(o,function(e,t){return n.isRoot(t)?!a.reject(["errRestore",t.name]):t.locked?!a.reject(["errLocked",t.name]):void 0}),"pending"===a.state()&&r(a,o,i),a):a.reject()}}).prototype={forceLoad:!0},i.prototype.commands.rm=function(){var t=this,n=this.fm,i='<div class="ui-helper-clearfix elfinder-rm-title"><span class="elfinder-cwd-icon {class} ui-corner-all"/>{title}<div class="elfinder-rm-desc">{desc}</div></div>',a=function(a,s,l,d,c){var u,h,p,f,m,g,v=s.length,b=n.cwd().hash,y=[];v>1?(e.map(l,function(e){return"directory"==e.mime?1:null}).length||(f=0,e.each(l,function(e,t){if(!t.size||"unknown"==t.size)return f="unknown",!1;var n=parseInt(t.size);n>=0&&f>=0&&(f+=n)}),y.push(n.i18n("size")+": "+n.formatSize(f))),h=[e(i.replace("{class}","elfinder-cwd-icon-group").replace("{title}","<strong>"+n.i18n("items")+": "+v+"</strong>").replace("{desc}",y.join("<br>")))]):(m=l[0],p=n.tmb(m),m.size&&y.push(n.i18n("size")+": "+n.formatSize(m.size)),y.push(n.i18n("modify")+": "+n.formatDate(m)),g=n.escape(m.i18||m.name).replace(/([_.])/g,"​$1"),h=[e(i.replace("{class}",n.mime2class(m.mime)).replace("{title}","<strong>"+g+"</strong>").replace("{desc}",y.join("<br>")))]),c&&(h=h.concat(c)),h.push(d?"confirmTrash":"confirmRm"),u=n.confirm({title:t.title,text:h,accept:{label:"btnRm",callback:function(){d?r(a,s,d):o(a,s)}},cancel:{label:"btnCancel",callback:function(){n.unlockfiles({files:s}),1===s.length&&n.file(s[0]).phash!==b?n.select({selected:s}):n.selectfiles({files:s}),a.reject()}}}),p&&e("<img/>").on("load",function(){u.find(".elfinder-cwd-icon").addClass(p.className).css("background-image","url('"+p.url+"')")}).attr("src",p.url)},r=function(i,r,o){var s,l,d,c={},u=r.length,h=t.options.toTrashMaxItems,p=[],f=e.Deferred();return u>h?void a(i,r,t.files(r),null,[n.i18n("tooManyToTrash")]):(e.each(r,function(e,t){var i=n.file(t),a=n.path(t).replace(/\\/g,"/"),r=a.match(/^[^\/]+?(\/(?:[^\/]+?\/)*)[^\/]+?$/);i&&(r&&(r[1]=r[1].replace(/(^\/.*?)\/?$/,"$1"),c[r[1]]||(c[r[1]]=[]),c[r[1]].push(t)),"directory"===i.mime&&p.push(t))}),p.length?(s=n.request({data:{cmd:"size",targets:p},notify:{type:"readdir",cnt:1,hideCnt:!0},preventDefault:!0}).done(function(e){var t=0;e.fileCnt&&(t+=parseInt(e.fileCnt)),e.dirCnt&&(t+=parseInt(e.dirCnt)),f[t>h?"reject":"resolve"]()}).fail(function(){f.reject()}),setTimeout(function(){var e=s&&s.xhr?s.xhr:null;e&&"pending"==e.state()&&(e.quiet=!0,e.abort(),f.reject())},1e3*t.options.infoCheckWait)):f.resolve(),void f.done(function(){l=Object.keys(c),d=l.length,d?n.request({data:{cmd:"mkdir",target:o,dirs:l},notify:{type:"chkdir",cnt:d},preventFail:!0}).fail(function(e){i.reject(e),n.unlockfiles({files:r})}).done(function(a){var o,s,l,u,h,p=function(t){e.each(t,function(e,t){Array.isArray(t)&&(m[e]?m[e]=m[e].concat(t):m[e]=t)}),t.sync&&(m.sync=1)},f=["errTrash"],m={},s=function(){return n.ui.notify.children(".elfinder-notify-trash").length};(o=a.hashes)?(u=1/d*100,h=1===d?100:5,l=setTimeout(function(){n.notify({type:"trash",cnt:1,hideCnt:!0,progress:h})},n.notifyDelay),e.each(c,function(a,c){o[a]&&n.request({data:{cmd:"paste",dst:o[a],targets:c,cut:1},preventDefault:!0}).fail(function(e){e&&(f=f.concat(e))}).done(function(e){e=n.normalize(e),n.updateCache(e),p(e),e.warning&&(f=f.concat(e.warning),delete e.warning),e.removed&&e.removed.length&&n.remove(e),e.added&&e.added.length&&n.add(e),e.changed&&e.changed.length&&n.change(e),n.trigger("paste",e),n.trigger("pastedone"),e.sync&&n.sync()}).always(function(){var a,o=2;s()?n.notify({type:"trash",cnt:0,hideCnt:!0,progress:u}):h+=u,--d<1&&(l&&clearTimeout(l),s()&&n.notify({type:"trash",cnt:-1}),n.unlockfiles({files:r}),Object.keys(m).length?(f.length>1&&((m.removed||m.removed.length)&&(a=e.map(r,function(t){return-1===e.inArray(t,m.removed)?t:null})),a.length?(f>o&&(o=-1===(n.messages[f[o-1]]||"").indexOf("$")?o:o+1),t.exec(a,{addTexts:f.slice(0,o),forceRm:!0})):n.error(f)),m._noSound=!0,i.resolve(m)):i.reject(f))})})):(i.reject("errFolderNotFound"),n.unlockfiles({files:r}))}):(i.reject(["error","The folder hierarchy to be deleting can not be determined."]),n.unlockfiles({files:r}))}).fail(function(){a(i,r,t.files(r),null,[n.i18n("tooManyToTrash")])}))},o=function(e,t,i){var a=i?{}:{type:"rm",cnt:t.length};n.request({data:{cmd:"rm",targets:t},notify:a,preventFail:!0}).fail(function(t){e.reject(t)}).done(function(t){(t.error||t.warning)&&(t.sync=!0),e.resolve(t)}).always(function(){n.unlockfiles({files:t})})},s=function(t){var i,a=null;return t&&t.length&&(t.length>1&&2===n.searchStatus.state?(i=n.file(n.root(t[0])).volumeid,e.map(t,function(e){return 0!==e.indexOf(i)?1:null}).length||(a=n.option("trashHash",t[0]))):a=n.option("trashHash",t[0])),a};n.bind("contextmenu",function(e){t.update(void 0,s(e.data.targets)?"trash":"rm")}),this.syncTitleOnChange=!0,this.updateOnSelect=!0,this.shortcuts=[{pattern:"delete ctrl+backspace shift+delete"}],this.handlers={open:function(){t.update(void 0,n.i18n(t.fm.option("trashHash")?"trash":"rm"))}},this.init=function(){t.change(function(){delete t.extra,t.title=n.i18n("cmd"+t.value),t.className=t.value,t.button.children("span.elfinder-button-icon")["trash"===t.value?"addClass":"removeClass"]("elfinder-button-icon-trash"),"trash"===t.value&&(t.extra={icon:"rm",node:e("<span/>").attr({title:n.i18n("cmdrm")}).on("click touchstart",function(e){"touchstart"===e.type&&e.originalEvent.touches.length>1||(e.stopPropagation(),e.preventDefault(),t.exec(void 0,{forceRm:!0}))})})})},this.getstate=function(i){var a;return i=i||n.selected(),a=i.length&&e.map(i,function(e){var t=n.file(e);return!t||t.locked||n.isRoot(t)?null:e}).length==i.length?0:-1,i&&i.length&&n.searchStatus.state>1&&setTimeout(function(){t.update(a,s(i)?"trash":"rm")},0),a},this.exec=function(i,l){var d,l=l||{},c=e.Deferred().fail(function(e){e&&n.error(e)}).done(function(e){!l.quiet&&!e._noSound&&e.removed&&e.removed.length&&n.trigger("playsound",{soundFile:"rm.wav"})}),u=t.files(i),h=u.length,p=null,f=l.addTexts?l.addTexts:null,m=l.forceRm,g=l.quiet;return h?(e.each(u,function(e,t){return n.isRoot(t)?!c.reject(["errRm",t.name,"errPerm"]):t.locked?!c.reject(["errLocked",t.name]):void 0}),"pending"===c.state()&&(d=t.hashes(i),h=u.length,(m||t.event&&t.event.originalEvent&&t.event.originalEvent.shiftKey)&&(p="",t.title=n.i18n("cmdrm")),null===p&&(p=s(d)),n.lockfiles({files:d}),p&&t.options.quickTrash?r(c,d,p):g?o(c,d,g):a(c,d,u,p,f)),c):c.reject()}},i.prototype.commands.search=function(){this.title="Find files",this.options={ui:"searchbutton"},this.alwaysEnabled=!0,this.updateOnSelect=!1,this.getstate=function(){return 0},this.exec=function(t,n,i){var a,r=this.fm,o=[],s=r.options.onlyMimes,l=[];return"string"==typeof t&&t?("object"==typeof n&&(i=n.mime||"",n=n.target||""),n=n?n:"",i?(i=e.trim(i).replace(","," ").split(" "),s.length&&(i=e.map(i,function(t){return t=e.trim(t),t&&(-1!==e.inArray(t,s)||e.map(s,function(e){return 0===t.indexOf(e)?!0:null}).length)?t:null}))):i=[].concat(s),r.trigger("searchstart",{query:t,target:n,mimes:i}),!s.length||i.length?""===n&&r.api>=2.1?e.each(r.roots,function(e,n){o.push(r.request({data:{cmd:"search",q:t,target:n,mimes:i},notify:{type:"search",cnt:1,hideCnt:!o.length},cancel:!0,preventDone:!0}))}):(o.push(r.request({data:{cmd:"search",q:t,target:n,mimes:i},notify:{type:"search",cnt:1,hideCnt:!0},cancel:!0,preventDone:!0})),""!==n&&r.api>=2.1&&Object.keys(r.leafRoots).length&&e.each(r.leafRoots,function(s,d){for(a=s;a;)n===a&&e.each(d,function(){var e=r.file(this);e&&e.volumeid&&l.push(e.volumeid),o.push(r.request({data:{cmd:"search",q:t,target:this,mimes:i},notify:{type:"search",cnt:1,hideCnt:!1},cancel:!0,preventDone:!0}))}),a=(r.file(a)||{}).phash})):o=[e.Deferred().resolve({files:[]})],r.searchStatus.mixed=o.length>1?l:!1,e.when.apply(e,o).done(function(e){var t,n=arguments.length;if(e.warning&&r.error(e.warning),n>1)for(e.files=e.files||[],t=1;n>t;t++)arguments[t].warning&&r.error(arguments[t].warning),arguments[t].files&&e.files.push.apply(e.files,arguments[t].files);e.files&&e.files.length&&r.cache(e.files),r.lazy(function(){r.trigger("search",e)}).then(function(){return r.lazy(function(){r.trigger("searchdone")})}).then(function(){e.sync&&r.sync()})})):(r.getUI("toolbar").find("."+r.res("class","searchbtn")+" :text").focus(),e.Deferred().reject())}},i.prototype.commands.sort=function(){var t=this,n=t.fm,i=function(){t.variants=[],e.each(n.sortRules,function(i,a){var r={type:i,order:i==n.sortType?"asc"==n.sortOrder?"desc":"asc":n.sortOrder};if(-1!==e.inArray(i,n.sorters)){var o=i==n.sortType?"asc"==r.order?"s":"n":"";t.variants.push([r,(o?'<span class="ui-icon ui-icon-arrowthick-1-'+o+'"></span>':"")+" "+n.i18n("sort"+i)])}}),t.variants.push("|"),t.variants.push([{type:n.sortType,order:n.sortOrder,stick:!n.sortStickFolders,tree:n.sortAlsoTreeview},(n.sortStickFolders?'<span class="ui-icon ui-icon-check"/>':"")+" "+n.i18n("sortFoldersFirst")]),n.ui.tree&&(t.variants.push("|"),t.variants.push([{type:n.sortType,order:n.sortOrder,stick:n.sortStickFolders,tree:!n.sortAlsoTreeview},(n.sortAlsoTreeview?'<span class="ui-icon ui-icon-check"/>':"")+" "+n.i18n("sortAlsoTreeview")]))};this.options={ui:"sortbutton"},n.bind("open sortchange",i).bind("open",function(){n.unbind("add",i).one("add",i),n.getUI("toolbar").find(".elfiner-button-sort .elfinder-button-menu .elfinder-button-menu-item").each(function(){var t=e(this),i=t.attr("rel");t.toggle(!i||-1!==e.inArray(i,n.sorters))})}).bind("cwdrender",function(){var i=e(n.cwd).find("div.elfinder-cwd-wrapper-list table");i.length&&e.each(n.sortRules,function(a,r){var o=i.find("thead tr td.elfinder-cwd-view-th-"+a);if(o.length){var s,l=a==n.sortType,d={type:a,order:l?"asc"==n.sortOrder?"desc":"asc":n.sortOrder};l&&(o.addClass("ui-state-active"),s="asc"==n.sortOrder?"n":"s",e('<span class="ui-icon ui-icon-triangle-1-'+s+'"/>').appendTo(o)),e(o).on("click",function(i){e(this).data("dragging")||(i.stopPropagation(),n.getUI("cwd").data("longtap")||t.exec([],d))}).hover(function(){e(this).addClass("ui-state-hover")},function(){e(this).removeClass("ui-state-hover")})}})}),this.getstate=function(){return 0},this.exec=function(e,t){var n=this.fm,i=Object.assign({type:n.sortType,order:n.sortOrder,stick:n.sortStickFolders,tree:n.sortAlsoTreeview},t);return n.lazy(function(){n.setSort(i.type,i.order,i.stick,i.tree),this.resolve()})}},(i.prototype.commands.up=function(){this.alwaysEnabled=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+up"}],this.getstate=function(){return this.fm.cwd().phash?0:-1},this.exec=function(){var t=this.fm,n=t.cwd().hash;return this.fm.cwd().phash?this.fm.exec("open",this.fm.cwd().phash).done(function(){t.one("opendone",function(){t.selectfiles({files:[n]})})}):e.Deferred().reject()}}).prototype={forceLoad:!0},i.prototype.commands.upload=function(){var t=this.fm.res("class","hover");this.disableOnSearch=!0,this.updateOnSelect=!1,this.shortcuts=[{pattern:"ctrl+u"}],this.getstate=function(e){var t,n=this.fm,e=e||[n.cwd().hash];return this._disabled||1!=e.length||(t=n.file(e[0])),t&&"directory"==t.mime&&t.write?0:-1},this.exec=function(n){var i,a,r,o,s,l,d,c=this.fm,u=c.cwd().hash,h=function(){var e,t=n&&n instanceof Array?n:null;return n||(t=t||1!==(e=c.selected()).length||"directory"!==c.file(e[0]).mime?[u]:e),t},p=h(),f=p?p[0]:n&&n.target?n.target:null,m=f?c.file(f):c.cwd(),g=function(t){c.upload(t).fail(function(e){w.reject(e)}).done(function(t){var n;c.getUI("cwd");if(w.resolve(t),t&&t.added&&t.added[0]&&!c.ui.notify.children(".elfinder-notify-upload").length){var i=c.findCwdNodes(t.added);i.length?i.trigger("scrolltoview"):(m.hash!==u?n=e("<div/>").append(e('<button type="button" class="ui-button ui-widget ui-state-default ui-corner-all elfinder-tabstop"><span class="ui-button-text">'+c.i18n("cmdopendir")+"</span></button>").on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type);
|
||
}).on("click",function(){c.exec("open",f).done(function(){c.one("opendone",function(){c.trigger("selectfiles",{files:e.map(t.added,function(e){return e.hash})})})})})):c.trigger("selectfiles",{files:e.map(t.added,function(e){return e.hash})}),c.toast({msg:c.i18n(["complete",c.i18n("cmdupload")]),extNode:n}))}})},v=function(e){i.elfinderdialog("close"),p&&(e.target=p[0]),g(e)},b=function(){var t=m.hash,n=e.map(c.files(t),function(e){return"directory"===e.mime&&e.write?e:null});return n.length?e('<div class="elfinder-upload-dirselect elfinder-tabstop" title="'+c.i18n("folders")+'"/>').on("click",function(t){t.stopPropagation(),t.preventDefault(),n=c.sortFiles(n);var a=e(this),r=(c.cwd(),i.closest("div.ui-dialog")),o=function(e,t){return{label:c.escape(e.i18||e.name),icon:t,remain:!1,callback:function(){var t=r.children(".ui-dialog-titlebar:first").find("span.elfinder-upload-target");p=[e.hash],t.html(" - "+c.escape(e.i18||e.name)),a.focus()},options:{className:p&&p.length&&e.hash===p[0]?"ui-state-active":"",iconClass:e.csscls||"",iconImg:e.icon||""}}},s=[o(m,"opendir"),"|"];e.each(n,function(e,t){s.push(o(t,"dir"))}),a.blur(),c.trigger("contextmenu",{raw:s,x:t.pageX||e(this).offset().left,y:t.pageY||e(this).offset().top,prevNode:r,fitHeight:!0})}).append('<span class="elfinder-button-icon elfinder-button-icon-dir" />'):e()},y=function(n,i){var a=e('<input type="file" '+n+"/>").change(function(){v({input:a.get(0),type:"files"})}).on("dragover",function(e){e.originalEvent.dataTransfer.dropEffect="copy"});return e('<div class="ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only elfinder-tabstop elfinder-focus"><span class="ui-button-text">'+c.i18n(i)+"</span></div>").append(e("<form/>").append(a)).on("click",function(e){e.target===this&&(e.stopPropagation(),e.preventDefault(),a.click())}).hover(function(){e(this).toggleClass(t)})},w=e.Deferred();return o=function(t){t.stopPropagation(),t.preventDefault();var n,i=!1,a="",r=null,o="",s=null,l=t._target||null,d=t.dataTransfer||null,u=d.items&&d.items.length&&d.items[0].kind?d.items[0].kind:"";if(d){try{if(r=d.getData("elfinderfrom"),r&&(o=window.location.href+c.cwd().hash,!l&&r===o||l===o))return void w.reject()}catch(t){}if("file"===u&&(d.items[0].getAsEntry||d.items[0].webkitGetAsEntry))i=d,a="data";else if("string"!==u&&d.files&&d.files.length&&-1===e.inArray("Text",d.types))i=d.files,a="files";else{try{(s=d.getData("text/html"))&&s.match(/<(?:img|a)/i)&&(i=[s],a="html")}catch(t){}!i&&(s=d.getData("text"))&&(i=[s],a="text")}}i?g({files:i,type:a,target:l,dropEvt:t}):(n=["errUploadNoFiles"],"file"===u&&n.push("errFolderUpload"),c.error(n),w.reject())},!p&&n?(n.input||n.files?(n.type="files",g(n)):n.dropEvt&&o(n.dropEvt),w):(s=function(t){var n,t=t.originalEvent||t,i=[],a=[];if(t.clipboardData){if(t.clipboardData.items&&t.clipboardData.items.length){a=t.clipboardData.items;for(var r=0;r<a.length;r++)"file"==t.clipboardData.items[r].kind&&(n=t.clipboardData.items[r].getAsFile(),i.push(n))}else t.clipboardData.files&&t.clipboardData.files.length&&(i=t.clipboardData.files);if(i.length)return void v({files:i,type:"files",clipdata:!0})}var o=t.target||t.srcElement;setTimeout(function(){var t,n="text";o.innerHTML&&(e(o).find("img").each(function(t,n){n.src.match(/^webkit-fake-url:\/\//)&&e(n).remove()}),e(o).find("a,img").length&&(n="html"),t=o.innerHTML,o.innerHTML="",v({files:[t],type:n}))},1)},i=e('<div class="elfinder-upload-dialog-wrapper"/>').append(y("multiple","selectForUpload")),!c.UA.Mobile&&function(e){return"undefined"!=typeof e.webkitdirectory||"undefined"!=typeof e.directory}(document.createElement("input"))&&i.append(y("multiple webkitdirectory directory","selectFolder")),m.dirs&&(m.hash===u||e("#"+c.navHash2Id(m.hash)).hasClass("elfinder-subtree-loaded")?b().appendTo(i):(l=e('<div class="elfinder-upload-dirselect" title="'+c.i18n("nowLoading")+'"/>').append('<span class="elfinder-button-icon elfinder-button-icon-spinner" />').appendTo(i),c.request({cmd:"tree",target:m.hash}).done(function(){c.one("treedone",function(){l.replaceWith(b()),d.elfinderdialog("tabstopsInit")})}).fail(function(){l.remove()}))),c.dragUpload?a=e('<div class="ui-corner-all elfinder-upload-dropbox elfinder-tabstop" contenteditable="true" data-ph="'+c.i18n("dropPasteFiles")+'"></div>').on("paste",function(e){s(e)}).on("mousedown click",function(){e(this).focus()}).on("focus",function(){this.innerHTML=""}).on("mouseover",function(){e(this).addClass(t)}).on("mouseout",function(){e(this).removeClass(t)}).on("dragenter",function(n){n.stopPropagation(),n.preventDefault(),e(this).addClass(t)}).on("dragleave",function(n){n.stopPropagation(),n.preventDefault(),e(this).removeClass(t)}).on("dragover",function(n){n.stopPropagation(),n.preventDefault(),n.originalEvent.dataTransfer.dropEffect="copy",e(this).addClass(t)}).on("drop",function(e){i.elfinderdialog("close"),p&&(e.originalEvent._target=p[0]),o(e.originalEvent)}).prependTo(i).after('<div class="elfinder-upload-dialog-or">'+c.i18n("or")+"</div>")[0]:r=e('<div class="ui-corner-all elfinder-upload-dropbox" contenteditable="true">'+c.i18n("dropFilesBrowser")+"</div>").on("paste drop",function(e){s(e)}).on("mousedown click",function(){e(this).focus()}).on("focus",function(){this.innerHTML=""}).on("dragenter mouseover",function(){e(this).addClass(t)}).on("dragleave mouseout",function(){e(this).removeClass(t)}).prependTo(i).after('<div class="elfinder-upload-dialog-or">'+c.i18n("or")+"</div>")[0],d=c.dialog(i,{title:this.title+'<span class="elfinder-upload-target">'+(m?" - "+c.escape(m.i18||m.name):"")+"</span>",modal:!0,resizable:!1,destroyOnClose:!0}),w)}},i.prototype.commands.view=function(){var e=this.fm;this.value=e.viewType,this.alwaysEnabled=!0,this.updateOnSelect=!1,this.options={ui:"viewbutton"},this.getstate=function(){return 0},this.exec=function(){var t=this,n=e.storage("view","list"==this.value?"icons":"list");return e.lazy(function(){e.viewchange(),t.update(void 0,n),this.resolve()})}},i}); |