a&&c').on("focus",function(){o=!0,g="",h.addClass("ui-state-active"),s.trigger("uiresize"),n&&n.slideDown(function(){h.addClass("ui-state-active"),s.toFront(n)})}).on("blur",function(){o=!1,n?n.data("infocus")?n.data("infocus",!1):n.slideUp(function(){h.removeClass("ui-state-active"),s.trigger("uiresize"),s.toHide(n)}):h.removeClass("ui-state-active")}).appendTo(h).on("keypress",function(e){e.stopPropagation()}).on("keydown",function(t){t.stopPropagation(),t.keyCode===e.ui.keyCode.ENTER?f():t.keyCode===e.ui.keyCode.ESCAPE&&(t.preventDefault(),m())});l.enable&&(l.minlen=l.minlen||2,l.wait=l.wait||500,v.attr("title",s.i18n("incSearchOnly")).on("compositionstart",function(){v.data("composing",!0)}).on("compositionend",function(){v.removeData("composing"),v.trigger("input")}).on("input",function(){v.data("composing")||(v.data("inctm")&&clearTimeout(v.data("inctm")),v.data("inctm",setTimeout(function(){var e=v.val();(0===e.length||e.length>=l.minlen)&&(g!==e&&s.trigger("incsearchstart",{query:e}),g=e,""===e&&s.searchStatus.state>1&&s.searchStatus.query&&v.val(s.searchStatus.query).trigger("select"))},l.wait)))}),s.UA.ltIE8&&v.on("keydown",function(e){229===e.keyCode&&(v.data("imetm")&&clearTimeout(v.data("imetm")),v.data("composing",!0),v.data("imetm",setTimeout(function(){v.removeData("composing")},100)))}).on("keyup",function(t){v.data("imetm")&&clearTimeout(v.data("imetm")),v.data("composing")?t.keyCode===e.ui.keyCode.ENTER&&v.trigger("compositionend"):v.trigger("input")})),e('').appendTo(h).on("mousedown",function(e){e.stopPropagation(),e.preventDefault(),h.hasClass("ui-state-active")?f():v.trigger("focus")}),e('').appendTo(h).on("mousedown",function(e){
e.stopPropagation(),e.preventDefault(),""!==v.val()||h.hasClass("ui-state-active")?m():v.trigger("focus")}),s.bind("toolbarload",function(){var e=h.parent();if(e.length&&(p.prepend(h.show()),e.remove(),s.UA.ltIE7)){var t=h.children("ltr"==s.direction?".ui-icon-close":".ui-icon-search");t.css({right:"",left:parseInt(h.width())-t.outerWidth(!0)})}}),s.one("init",function(){s.getUI("cwd").on("touchstart click",function(){o&&v.trigger("blur")})}).one("open",function(){n=s.api<2.1?null:e('').append(e('').append(e('"),e('"),e('")),e('').append(e('"))).hide().appendTo(s.getUI()),n&&(c&&(i=n.find(".elfinder-search-type"),e.each(t.options.searchTypes,function(t,n){i.append(e('"))})),n.find("div.buttonset").buttonset(),e("#"+d("SearchFromAll")).next("label").attr("title",s.i18n("searchTarget",s.i18n("btnAll"))),c&&e.each(c,function(t,n){n.title&&e("#"+d(t)).next("label").attr("title",s.i18n(n.title))}),n.on("mousedown","div.buttonset",function(e){e.stopPropagation(),n.data("infocus",!0)}).on("click","input",function(t){t.stopPropagation(),e.trim(v.val())?f():v.trigger("focus")}).on("close",function(){v.trigger("blur")}))}).bind("searchend",function(){v.val("")}).bind("open parents",function(){var t=[],n=s.file(s.root(s.cwd().hash));n&&(e.each(s.parents(s.cwd().hash),function(e,n){t.push(s.file(n).name)}),e("#"+d("SearchFromCwd")).next("label").attr("title",s.i18n("searchTarget",t.join(s.option("separator")))),e("#"+d("SearchFromVol")).next("label").attr("title",s.i18n("searchTarget",n.name)))}).bind("open",function(){g&&m()}).bind("cwdinit",function(){a=!1}).bind("cwdrender",function(){a=!0}).bind("keydownEsc",function(){g&&"/"===g.substr(0,1)&&(g="",v.val(""),s.trigger("searchend"))}).shortcut({pattern:"ctrl+f f3",description:t.title,callback:function(){v.trigger("select").trigger("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:s.i18n("firstLetterSearch"),callback:function(t){if(a){var n,i=t.originalEvent.keyCode,o=function(){var t=s.selected(),n=e.ui.keyCode[!t.length||e("#"+s.cwdHash2Id(t[0])).next("[id]").length?"RIGHT":"HOME"];e(document).trigger(e.Event("keydown",{keyCode:n,ctrlKey:!1,shiftKey:!1,altKey:!1,metaKey:!1}))};i>=96&&i<=105&&(i-=48),n="/"+String.fromCharCode(i),g!==n?(v.val(n),g=n,s.trigger("incsearchstart",{query:n}).one("cwdrender",o)):o()}}})})},e.fn.elfindersortbutton=function(t){return this.each(function(){var n,i=t.fm,a=t.name,o="class",r=i.res(o,"disabled"),s=i.res(o,"hover"),l="elfinder-button-menu-item",c=l+"-selected",d=c+"-asc",p=c+"-desc",u=e(''+t.title+""),h=e(this).addClass("ui-state-default elfinder-button elfinder-menubutton elfiner-button-"+a).attr("title",t.title).append('',u).on("mouseenter mouseleave",function(e){!h.hasClass(r)&&h.toggleClass(s,"mouseenter"===e.type)}).on("click",function(e){h.hasClass(r)||(e.stopPropagation(),m.is(":hidden")&&i.getUI().click(),m.css(v()).slideToggle({duration:100,done:function(e){i[m.is(":visible")?"toFront":"toHide"](m)}}))}),f=function(){i.toHide(m)},m=e('').hide().appendTo(i.getUI()).on("mouseenter mouseleave","."+l,function(t){e(this).toggleClass(s,"mouseenter"===t.type)}).on("click",function(e){e.preventDefault(),e.stopPropagation()}).on("close",f),g=function(){m.children("[rel]").removeClass(c+" "+d+" "+p).filter('[rel="'+i.sortType+'"]').addClass(c+" "+("asc"==i.sortOrder?d:p)),m.children(".elfinder-sort-stick").toggleClass(c,i.sortStickFolders),m.children(".elfinder-sort-tree").toggleClass(c,i.sortAlsoTreeview)},v=function(){var e=i.getUI().offset(),t=h.offset();return{top:t.top-e.top,left:t.left-e.left}};u.hide(),e.each(i.sortRules,function(t,n){m.append(e(''+i.i18n("sort"+t)+"
").data("type",t))}),m.children().on("click",function(n){t.exec([],e(this).removeClass(s).attr("rel"))}),e(''+i.i18n("sortFoldersFirst")+"
").appendTo(m).on("click",function(){t.exec([],"stick")}),e.fn.elfindertree&&e.inArray("tree",i.options.ui)!==-1&&e(''+i.i18n("sortAlsoTreeview")+"
").appendTo(m).on("click",function(){t.exec([],"tree")}),i.bind("disable select",f).getUI().on("click",f),i.bind("open",function(){m.children("[rel]").each(function(){var t=e(this);t.toggle(i.sorters[t.attr("rel")])})}).bind("sortchange",g),m.children().length>1?t.change(function(){n&&cancelAnimationFrame(n),n=requestAnimationFrame(function(){h.toggleClass(r,t.disabled()),g()})}).change():h.addClass(r)})},e.fn.elfinderstat=function(t){return this.each(function(){var n=e(this).addClass("elfinder-stat-size"),i=e('').on("click","a",function(n){var i=e(this).data("hash");n.preventDefault(),t.exec("opendir",[i])}),a=t.i18n("items"),o=t.i18n("selected"),r=t.i18n("size"),s=function(i){var o=0,r=0,s=t.cwd(),l=!0,c=!0;(s.sizeInfo||s.size)&&(r=s.size,l=!1),e.each(i,function(e,t){o++,l&&(r+=parseInt(t.size)||0,c!==!0||"directory"!==t.mime||t.sizeInfo||(c=!1))}),n.html(a+': '+o+', '+t.i18n(c?"sum":"size")+": "+t.formatSize(r)+"").attr("title",n.text()),t.trigger("uistatchange")},l=function(e){n.find("span.elfinder-stat-incsearch").html(e?e.hashes.length+" / ":""),n.attr("title",n.text()),t.trigger("uistatchange")},c=function(n){var a,s,l=0,c=0,d=[];1===n.length?(s=n[0],l=s.size,2===t.searchStatus.state&&(a=t.escape(s.path?s.path.replace(/\/[^\/]*$/,""):".."),d.push(''+a+"")),d.push(t.escape(s.i18||s.name)),i.html(d.join("/")+(l>0?", "+t.formatSize(l):""))):n.length?(e.each(n,function(e,t){c++,l+=parseInt(t.size)||0}),i.html(c?o+": "+c+", "+r+": "+t.formatSize(l):" ")):i.html(""),i.attr("title",i.text()),t.trigger("uistatchange")};t.getUI("statusbar").prepend(n).append(i).show(),t.UA.Mobile&&e.fn.tooltip&&t.getUI("statusbar").tooltip({classes:{"ui-tooltip":"elfinder-ui-tooltip ui-widget-shadow"},tooltipClass:"elfinder-ui-tooltip ui-widget-shadow",track:!0}),t.bind("cwdhasheschange",function(n){s(e.map(n.data,function(e){return t.file(e)}))}).change(function(i){var a=i.data.changed||[],o=t.cwd().hash;e.each(a,function(){if(this.hash===o)return this.size&&(n.children(".elfinder-stat-size").addClass("elfinder-stat-size-recursive").html(t.i18n("sum")+": "+t.formatSize(this.size)),n.attr("title",n.text())),!1})}).select(function(){c(t.selectedFiles())}).bind("open",function(){c([])}).bind("incsearch",function(e){l(e.data)}).bind("incsearchend",function(){l()})})},e.fn.elfindertoast=function(t,n){var i=Object.assign({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,button:void 0,width:void 0},e.isPlainObject(n.options.uiOptions.toast.defaults)?n.options.uiOptions.toast.defaults:{});return this.each(function(){t=Object.assign({},i,t||{});var a,o=e(this),r=function(e){o.stop(),n.toFront(o),o[t.showMethod]({duration:t.showDuration,easing:t.showEasing,complete:function(){t.onShown&&t.onShown(),!e&&t.timeOut&&(a=setTimeout(s,t.timeOut))}})},s=function(){o[t.hideMethod]({duration:t.hideDuration,easing:t.hideEasing,complete:function(){t.onHidden&&t.onHidden(),o.remove()}})};o.on("click",function(e){e.stopPropagation(),e.preventDefault(),a&&clearTimeout(a),t.onHidden&&t.onHidden(),o.stop().remove()}).on("mouseenter mouseleave",function(e){t.timeOut&&(a&&clearTimeout(a),a=null,"mouseenter"===e.type?r(!0):a=setTimeout(s,t.timeOut))}).hide().addClass("toast-"+t.mode).append(e('').html(t.msg.replace(/%([a-zA-Z0-9]+)%/g,function(e,t){return n.i18n(t)}))),t.extNode&&o.append(t.extNode),t.button&&o.append(e('').append(e('').text(n.i18n(t.button.text))).on("mouseenter mouseleave",function(t){e(this).toggleClass("ui-state-hover","mouseenter"==t.type)}).on("click",t.button.click||function(){})),t.width&&o.css("max-width",t.width),r()})},e.fn.elfindertoolbar=function(t,n){return this.not(".elfinder-toolbar").each(function(){var i,a,o,r,s,l,c,d,p,u=t._commands,h=e(this).addClass("ui-helper-clearfix ui-widget-header elfinder-toolbar"),f={displayTextLabel:!1,labelExcludeUA:["Mobile"],autoHideUA:["Mobile"],showPreferenceButton:"none"},m=function(t){return e.grep(t,function(t){return!e.isPlainObject(t)||(f=Object.assign(f,t),!1)})},g=function(n){var l,c;for(e.each(v,function(e,t){t.detach()}),h.empty(),i=b.length;i--;)if(b[i]){for(r=e(''),a=b[i].length;a--;)l=b[i][a],n&&n[l]||!(o=u[l])||(s="elfinder"+o.options.ui,!v[l]&&e.fn[s]&&(v[l]=e("")[s](o)),v[l]&&(v[l].children(".elfinder-button-text")[d?"show":"hide"](),r.prepend(v[l])));r.children().length&&h.prepend(r),r.children(":gt(0)").before('')}(c=u.preference)&&("always"===f.showPreferenceButton||!h.children().length&&"auto"===f.showPreferenceButton)&&(r=e(''),l="preference",s="elfinder"+o.options.ui,v[l]=e("")[s](c),v[l].children(".elfinder-button-text")[d?"show":"hide"](),r.prepend(v[l]),h.append(r)),!h.data("swipeClose")&&h.children().length?h.show():h.hide(),x=h[0].clientHeight,t.trigger("toolbarload").trigger("uiresize")},v={},b=m(n||[]),y=null,w="",x=0,k=[];f.showPreferenceButton=f.showPreferenceButton.toLowerCase(),"none"!==f.displayTextLabel&&(d=t.storage("toolbarTextLabel"),d=null===d?f.displayTextLabel&&(!f.labelExcludeUA||!f.labelExcludeUA.length||!e.grep(f.labelExcludeUA,function(e){return!!t.UA[e]}).length):1==d,k.push({label:t.i18n("textLabel"),icon:"text",callback:function(){d=!d,h.css("height","").find(".elfinder-button-text")[d?"show":"hide"](),t.trigger("uiresize").storage("toolbarTextLabel",d?"1":"0")}})),f.preferenceInContextmenu&&u.preference&&k.push({label:t.i18n("toolbarPref"),icon:"preference",callback:function(){t.exec("preference",void 0,{tab:"toolbar"})}}),k.length&&h.on("contextmenu",function(e){e.stopPropagation(),e.preventDefault(),t.trigger("contextmenu",{raw:k,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),g(),t.bind("open sync select toolbarpref",function(){var n,i,a,o=Object.assign({},t.option("disabledFlip")),r=t.storage("toolbarhides");if(!r&&Array.isArray(f.defaultHides)&&(r={},e.each(f.defaultHides,function(){r[this]=!0}),t.storage("toolbarhides",r)),"select"===this.type){if(t.searchStatus.state<2)return;i=t.selected(),i.length&&(o=t.getDisabledCmds(i,!0))}e.each(r,function(e){o[e]||(o[e]=!0)}),Object.keys(t.commandMap).length&&e.each(t.commandMap,function(e,t){"hidden"===t&&(o[e]=!0)}),a=Object.keys(o),y&&y.toString()===a.sort().toString()||(g(a.length?o:null),n=!0),y=a.sort(),(n||w!==JSON.stringify(t.commandMap))&&(w=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,o=t._commands[i],r=o?"elfinder"+o.options.ui:null;r&&e.fn[r]&&(a=v[n],a&&(!v[i]&&e.fn[r]&&(v[i]=e("")[r](o),v[i]&&(v[i].children(".elfinder-button-text")[d?"show":"hide"](),o.extendsCmd&&v[i].children("span.elfinder-button-icon").addClass("elfinder-button-icon-"+o.extendsCmd))),v[i]&&(a.after(v[i]),v[i].data("origin",a.detach()))))}))}).bind("resize",function(e){p&&cancelAnimationFrame(p),p=requestAnimationFrame(function(){var e=h[0].clientHeight;x!==e&&(x=e,t.trigger("uiresize"))})}),t.UA.Touch&&(c=t.storage("autoHide")||{},"undefined"==typeof c.toolbar&&(c.toolbar=f.autoHideUA&&f.autoHideUA.length>0&&e.grep(f.autoHideUA,function(e){return!!t.UA[e]}).length,t.storage("autoHide",c)),c.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('').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"),o=i.height(),r=h.height(),s=h.outerHeight(!0),d=s-r,p=Object.assign({step:function(e){i.height(o+(a?(e+d)*-1:r-e)),t.trigger("resize")},always:function(){requestAnimationFrame(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"))),a&&h.scrollTop("0px"),n.init&&t.trigger("uiautohide")})}},n);h.data("swipeClose",!a).stop(!0,!0).animate({height:"toggle"},p),c.toolbar=!a,t.storage("autoHide",Object.assign(t.storage("autoHide"),{toolbar:c.toolbar}))}).on("touchstart",function(e){h.scrollBottom()>5&&(e.originalEvent._preventSwipeY=!0)}))}),this},e.fn.elfindertree=function(t,n){var i=t.res("class","tree");return this.not("."+i).each(function(){var a,o,r,s,l="class",c=t.UA.Mobile,d=t.res(l,"treeroot"),p=n.openRootOnLoad,u=n.openCwdOnOpen,h=u||n.syncTree,f=t.res(l,"navsubtree"),m=t.res(l,"treedir"),g="span."+m,v=t.res(l,"navcollapse"),b=t.res(l,"navexpand"),y="elfinder-subtree-loaded",w="elfinder-subtree-chksubdir",x=t.res(l,"navarrow"),k=t.res(l,"active"),C=t.res(l,"adroppable"),z=t.res(l,"hover"),T=t.res(l,"disabled"),A=t.res(l,"draggable"),I=t.res(l,"droppable"),S="elfinder-navbar-wrapper-root",O="elfinder-navbar-wrapper-pastable",j="elfinder-navbar-wrapper-uploadable",M=function(e){var t=se.offset().left;return t<=e&&e<=t+se.width()},F={},D=[],U=function(n){var i=[];if(e.each(n,function(e,n){F[n]&&i.push(t.navId2Hash(n)),delete F[n]}),i.length)return 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(w),a[i?"addClass":"removeClass"](v)})})},E=null,P=function(){var n=Object.keys(F);n.length&&(E&&E._abort(),a&&clearTimeout(a),D=[],E=t.asyncJob(function(n){return t.isInWindow(e("#"+n))?n:null},n,{numPerOnce:200}).done(function(e){e.length&&(D=e,q())}))},R=0,q=function(){var e,i=n.subdirsMaxConn-R,o=t.maxTargets?Math.min(t.maxTargets,n.subdirsAtOnce):n.subdirsAtOnce;if(a&&cancelAnimationFrame(a),D.length)if(i>0)for(e=0;ed&&(i.on("update."+t.namespace,h),void 0===n&&(u=0,p(),n=f(g.hash),void 0===n&&(n=0)),y=a.slice(n,n+d),B[m]=i,w=n?Math.max(-1,n-d):-1,x=n+d>=a.length?0:n+d,r=Math.ceil(a.length/d),s=Math.ceil(n/d)),e.each(y||a,function(e,t){z.push(V(t)),t.node&&(T[t.hash]=t.node)}),k=w>-1?e('').text(t.i18n("btnPrevious",s,r)).button({icons:{primary:"ui-icon-caret-1-n"}}).on("click",function(e){e.preventDefault(),e.stopPropagation(),v(w,"up")}):e(),C=x?e('').text(t.i18n("btnNext",s+2,r)).button({icons:{primary:"ui-icon-caret-1-s"}}).on("click",function(e){e.preventDefault(),e.stopPropagation(),v(x,"down")}):e(),b(),i.empty()[y?"addClass":"removeClass"]("elfinder-navbar-hasmore").append(k,z.join(""),C),e.each(T,function(n,i){e("#"+t.navHash2Id(n)).parent().replaceWith(i)}),o&&Z(t.navHash2Id(y["up"===o?y.length-1:0].hash)),!c&&t.lazy(function(){ie(null,i)})},b=function(){e.each(i.children(".elfinder-navbar-wrapper"),function(n,i){var o,r,l=e(i),c=l.children("[id]:first");c.hasClass(y)&&(o=t.navId2Hash(c.attr("id")),o&&void 0!==(r=s[o])&&(a[r].node=l.detach()))})};v()},b={},w=[],x=!0;h--;)a=i[h],m[a.hash]||e("#"+t.navHash2Id(a.hash)).length||(m[a.hash]=!0,(o=G(a.phash)).length?a.phash&&((s=!o.children().length)||o.hasClass("elfinder-navbar-hasmore")||(r=J(o,a)).length)?s?(b[a.phash]||(b[a.phash]=[]),b[a.phash].push(a)):r?(d=V(a),r.before(d),!c&&(f=f.add(d))):w.push(a):(d=V(a),o[x||a.phash?"append":"prepend"](d),x=!1,a.phash&&!a.isroot||(l=e("#"+t.navHash2Id(a.hash)).parent()),!c&&ie(null,l)):u.push(a));return Object.keys(b).length&&e.each(b,function(e,t){var n=G(e);t.sort(Q),v(n,t)}),w.length&&o.trigger("update."+t.namespace,{added:w}),u.length&&u.lengthc?r.animate({scrollTop:r.scrollTop()+d-s-l/3},{duration:n.durations.autoScroll,complete:function(){p.resolve()}}):p.resolve()):p.reject()},100),p},ee=function(n){var i,a,o,r=n||t.cwd(),s=r.hash?[r.hash]:[];for(a=t.root(r.hash),o=t.file(a);o&&(i=o.phash)&&(s.unshift(i),a=t.root(i),o=t.file(a),!e("#"+t.navHash2Id(o.hash)).hasClass(y)););return s},te=function(n){var i=n||t.cwd(),a=i.hash,o=e("#"+t.navHash2Id(a));if(!o.length){for(;i&&i.phash;)B[i.phash]&&!e("#"+t.navHash2Id(i.hash)).length&&B[i.phash].trigger("update."+t.namespace,{select:i.hash}),i=t.file(i.phash);o=e("#"+t.navHash2Id(a))}return o},ne=function(n,i){var a,o,s=t.cwd(),l=s.hash,c=void 0===i?h:i,d=function(n){var i,r,s=e.Deferred(),l=[],d=ee(n),p=function(e,n,i){var a={cmd:e,target:n};return i&&(a.until=i),t.request({data:a,preventFail:!0})};return l=e.map(d,function(n){var a,o,r=t.file(n),s=!!r&&t.isRoot(r),l=e("#"+t.navHash2Id(n)),c=function(e,n){var i,a,o=n||1;return a=!!(i=t.file(e))&&i.phash,a&&o>1?c(a,--o):a},d=function(){var i=c(n);for(a=i;i&&!e("#"+t.navHash2Id(i)).hasClass(y);)a=i,i=c(i);return i||(a=void 0,i=t.root(n)),i}();return l.hasClass(y)||!s&&r&&e("#"+t.navHash2Id(r.phash)).hasClass(y)?null:(s||d===c(n)||d===c(n,2)?(a=void 0,o="tree",s||(n=c(n))):o="parents",i||(i="tree"===o?n:d),p(o,n,a))}),l.length?(te(t.file(i)),r=t.navHash2Id(i),c&&Z(r),a=e("#"+r),o=e(t.res("tpl","navspinner")).insertBefore(a.children("."+x)),a.removeClass(v),e.when.apply(e,l).done(function(){var e,t,n,i={};if(t=arguments.length,t>0)for(n=0;n0}).addClass(i)})},oe=e(this).addClass(i).on("mouseenter mouseleave",g,function(n){var i="mouseenter"===n.type;if(!i||!re){var a=e(this);a.hasClass(C+" "+T)||(c||!i||a.data("dragRegisted")||a.hasClass(d+" "+A+" elfinder-na elfinder-wo")||(a.data("dragRegisted",!0),t.isCommandEnabled("copy",t.navId2Hash(a.attr("id")))&&a.draggable(t.draggable)),a.toggleClass(z,i))}}).on("dragenter",g,function(t){if(t.originalEvent.dataTransfer){var n=e(this);n.addClass(z),n.is("."+v+":not(."+b+")")&&n.data("expandTimer",setTimeout(function(){n.is("."+v+"."+z)&&n.children("."+x).trigger("click")},500))}}).on("dragleave",g,function(t){if(t.originalEvent.dataTransfer){var n=e(this);n.data("expandTimer")&&clearTimeout(n.data("expandTimer")),n.removeClass(z)}}).on("click",g,function(n){var i=e(this),a=t.navId2Hash(i.attr("id"));t.file(a);return i.data("longtap")?(i.removeData("longtap"),void n.stopPropagation()):(i.hasClass(k)||(oe.find(g+"."+k).removeClass(k),i.addClass(k)),void(a==t.cwd().hash||i.hasClass(T)?(i.hasClass(v)&&i.children("."+x).trigger("click"),t.select({selected:[a],origin:"navbar"})):t.exec("open",a).done(function(){t.one("opendone",function(){t.select({selected:[a],origin:"navbar"})})})))}).on("touchstart",g,function(n){if(!(n.originalEvent.touches.length>1)){var i,a=n.originalEvent;return"INPUT"===n.target.nodeName?void n.stopPropagation():void(i=e(this).addClass(z).removeData("longtap").data("tmlongtap",setTimeout(function(e){i.data("longtap",!0),t.trigger("contextmenu",{type:"navbar",targets:[t.navId2Hash(i.attr("id"))],x:a.touches[0].pageX,y:a.touches[0].pageY})},500)))}}).on("touchmove touchend",g,function(t){return"INPUT"===t.target.nodeName?void t.stopPropagation():(clearTimeout(e(this).data("tmlongtap")),void("touchmove"==t.type&&e(this).removeClass(z)))}).on("click",g+"."+v+" ."+x,function(i){var a,o=e(this),r=o.parent(g),s=r.next("."+f),l=e.Deferred(),c=30;i.stopPropagation(),r.hasClass(y)?(r.toggleClass(b),t.lazy(function(){a=r.hasClass(b)?s.children().length+s.find("div.elfinder-navbar-subtree[style*=block]").children().length:s.find("div:visible").length,a>c?(s.toggle(),t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1),P()):s.stop(!0,!0)[r.hasClass(b)?"slideDown":"slideUp"](n.durations.slideUpDown,function(){t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1),P()})}).always(function(){l.resolve()})):(N.insertBefore(o),r.removeClass(v),t.request({cmd:"tree",target:t.navId2Hash(r.attr("id"))}).done(function(e){Y(Object.assign([],X(e.tree))),s.children().length&&(r.addClass(v+" "+b),s.children().length>c?(s.show(),t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1),P()):s.stop(!0,!0).slideDown(n.durations.slideUpDown,function(){t.draggingUiHelper&&t.draggingUiHelper.data("refreshPositions",1),P()}))}).always(function(e){N.remove(),r.addClass(y),t.one("treedone",function(){l.resolve()})})),o.data("dfrd",l)}).on("contextmenu",g,function(n){var i=e(this);return i.find("input:text").length?void n.stopPropagation():(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")}),void t.bind("closecontextmenu",function(){i.removeClass("ui-state-hover")}))}).on("scrolltoview",g,function(n,i){var a=e(this);Z(a.attr("id")).done(function(){i&&"undefined"!==i.blink&&!i.blink||t.resources.blink(a,"lookme")})}).on("create."+t.namespace,function(n,i){var a=G(i.phash),o=i.move||!1,r=e(V(i)).addClass("elfinder-navbar-wrapper-tmp"),s=t.selected();o&&s.length&&t.trigger("lockfiles",{files:s}),a.prepend(r)}),re=!1,se=t.getUI("navbar").append(oe).show().on("scroll",function(){re=!0,s&&cancelAnimationFrame(s),s=requestAnimationFrame(function(){re=!1,P()})}),le=t.sortAlsoTreeview;t.open(function(e){var n=e.data,i=X(n.files),a=t.getUI("contextmenu");n.init&&oe.empty(),t.UA.iOS&&se.removeClass("overflow-scrolling-touch").addClass("overflow-scrolling-touch"),i.length?t.lazy(function(){a.data("cmdMaps")||a.data("cmdMaps",{}),Y(i),ae(i,y),ne(i)}):ne()}).add(function(e){var t=X(e.data.added);t.length&&(Y(t),ae(t,v))}).change(function(n){if(!r){var i,a,o,s,l,d,p,u,h,m,v,w,x=X(n.data.changed,!0),k=x.length,C=k;e();for(e.each(B,function(e,n){n.trigger("update."+t.namespace,{change:"prepare"})});C--;)if(i=x[C],a=i.phash,(o=e("#"+t.navHash2Id(i.hash))).length){if(v=o.parent(),a){if(l=o.closest("."+f),d=G(a),p=o.parent().next(),u=J(d,i),!d.length)continue;d[0]===l[0]&&p.get(0)===u.get(0)||(u.length?u.before(v):d.append(v))}h=o.hasClass(b),m=o.hasClass(y),s=e(V(i)),o.replaceWith(s.children(g)),!c&&ie(null,v),i.dirs&&(h||m)&&(o=e("#"+t.navHash2Id(i.hash)))&&o.next("."+f).children().length&&(h&&o.addClass(b),m&&o.addClass(y)),w|=i.dirs==-1}w&&P(),e.each(B,function(e,n){n.trigger("update."+t.namespace,{change:"done"})}),k&&ne(void 0,!1)}}).remove(function(n){var i,a,o,r=n.data.removed,s=r.length;for(e.each(B,function(e,n){n.trigger("update."+t.namespace,{removed:r}),n.trigger("update."+t.namespace,{change:"prepare"})});s--;)(i=e("#"+t.navHash2Id(r[s]))).length&&(o=!0,a=i.closest("."+f),i.parent().detach(),a.children().length||a.hide().prev(g).removeClass(v+" "+b+" "+y));o&&t.getUI("navbar").children(".ui-resizable-handle").trigger("resize"),e.each(B,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"),o=i&&!a?"disable":"enable",r=e.grep(n.data.files||[],function(e){var n=t.file(e);return!(!n||"directory"!=n.mime)});e.each(r,function(n,r){var s=e("#"+t.navHash2Id(r));s.length&&!a&&(s.hasClass(A)&&s.draggable(o),s.hasClass(I)&&s.droppable(o),s[i?"addClass":"removeClass"](T))})}).bind("sortchange",function(){if(t.sortAlsoTreeview||le!==t.sortAlsoTreeview){var n,i,a=[],o={},r={},s="",l=!1;t.lazy(function(){n=X(t.files()),le=t.sortAlsoTreeview,oe.empty(),Y(e.map(t.roots,function(e){var n=t.file(e);return n&&!n.phash?n:null;
})),Object.keys(B).length?(a=ee(),a.length>1?(e.each(a,function(e,n){var i=t.file(t.root(n)).volumeid;0===e&&(s=i),r[i]=n,o[n]=[]}),e.each(n,function(e,t){return t.volumeid?void o[r[t.volumeid]||r[s]].push(t):(l=!0,!1)})):l=!0,l?e.each(a,function(e,a){Y(n),i=te(t.file(a)),ae(n,y)}):e.each(o,function(e,n){Y(n),i=te(t.file(e)),ae(n,y)})):(Y(n),i=te(),ae(n,y)),ne()},100)}})}),this},e.fn.elfinderuploadbutton=function(t){return this.each(function(){var n,i=t.fm,a=e(this).elfinderbutton(t).off("click"),o=e("").appendTo(a),r=e('').on("change",function(){var t=e(this);t.val()&&(i.exec("upload",{input:t.remove()[0]},void 0,i.cwd().hash),r.clone(!0).appendTo(o))}).on("dragover",function(e){e.originalEvent.dataTransfer.dropEffect="copy"});o.append(r.clone(!0)),t.change(function(){n&&cancelAnimationFrame(n),n=requestAnimationFrame(function(){var e=t.disabled();o.is("visible")?!e&&o.hide():e&&o.show()})}).change()})},e.fn.elfinderviewbutton=function(t){return this.each(function(){var n,i=e(this).elfinderbutton(t),a=i.children(".elfinder-button-icon"),o=i.children(".elfinder-button-text");t.change(function(){n&&cancelAnimationFrame(n),n=requestAnimationFrame(function(){var e="icons"==t.value;a.toggleClass("elfinder-button-icon-view-list",e),t.className=e?"view-list":"",t.title=t.fm.i18n(e?"viewlist":"viewicons"),i.attr("title",t.title),o.html(t.title)})})})},e.fn.elfinderworkzone=function(t){var n="elfinder-workzone";return this.not("."+n).each(function(){var i,a=e(this).addClass(n),o=Math.round(a.height()),r=a.parent(),s=function(){i=a.outerHeight(!0)-a.height()},l=function(s){var l=r.height()-i,c=r.attr("style"),d=Math.round(a.height());s&&(s.preventDefault(),s.stopPropagation()),r.css("overflow","hidden").children(":visible:not(."+n+")").each(function(){var t=e(this);"absolute"!=t.css("position")&&"fixed"!=t.css("position")&&(l-=t.outerHeight(!0))}),r.attr("style",c||""),l=Math.max(0,Math.round(l)),o===l&&d===l||(o=Math.round(a.height()),a.height(l),t.trigger("wzresize"))},c=function(){i=a.outerHeight(!0)-a.height(),l()};s(),r.on("resize."+t.namespace,l),t.one("cssloaded",c).bind("uiresize",l).bind("themechange",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 o,r=this.files(n),s=r.length,l=s&&!i.isRoot(r[0])&&(i.file(r[0].phash)||{}).write&&!e.grep(r,function(e){return!e.read}).length;return l&&i.searchStatus.state>1&&(o=i.cwd().volumeid,l=s===e.grep(r,function(e){return!(!e.read||0!==e.hash.indexOf(o))}).length),l&&!this._disabled&&a.length&&(s||t&&"pending"==t.state())?0:-1},this.exec=function(o,r){var s,l,c=this.files(o),d=c.length,p=r||a[0],u=i.file(c[0].phash)||null,h=["errArchive","errPerm","errCreatingTempDir","errFtpDownloadFile","errFtpUploadFile","errFtpMkdir","errArchiveExec","errExtractExec","errRm"];if(t=e.Deferred().fail(function(e){e&&i.error(e)}),!d||!a.length||e.inArray(p,a)===-1)return t.reject();if(!u.write)return t.reject(h);for(s=0;s1?"Archive":c[0].name)+(i.option("archivers").createext?"."+i.option("archivers").createext[p]:""),n.data={targets:n.hashes(o),type:p},i.cwd().hash!==u.hash?l=i.exec("open",u.hash).done(function(){i.one("cwdrender",function(){i.selectfiles({files:o}),t=e.proxy(i.res("mixin","make"),n)()})}):(i.selectfiles({files:o}),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:'{title}
{dataTable}',itemTitle:'{name}{kind}',groupTitle:"{items}: {num}",dataTable:''+i.perm+':
',fieldset:'
").on("click",function(){var t=c.scrollTop();e(this).remove(),c.children("pre").removeClass("prettyprinted").text(h).scrollTop(t),r(c,100)})),c.children("pre").text(s||h),c.on("touchstart",function(t){e(this)["scroll"+("ltr"===n.direction?"Right":"Left")]()>5&&(t.originalEvent._preventSwipeX=!0)}).appendTo(i),r(c,100)}).always(function(){c.remove()}))})}],(i.prototype.commands.reload=function(){"use strict";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("").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(){"use strict";this.alwaysEnabled=!0,this.syncTitleOnChange=!0;var t=this,n=t.fm,i=function(t,i,a,o){var r,s=i?[a.hash].concat(i):[a.hash],l=s.length,c={};if(n.lockfiles({files:s}),n.isRoot(a)){if((r=n.storage("rootNames"))||(r={}),""===o){if(!r[a.hash])return t&&t.reject(),void n.unlockfiles({files:s}).trigger("selectfiles",{files:s});a.name=a._name,a.i18=a._i18,delete r[a.hash],delete a._name,delete a._i18}else"undefined"==typeof a._name&&(a._name=a.name,a._i18=a.i18),a.name=r[a.hash]=o,delete a.i18;return n.storage("rootNames",r),c={changed:[a]},n.updateCache(c),n.change(c),t&&t.resolve(c),void n.unlockfiles({files:s}).trigger("selectfiles",{files:s})}c={cmd:"rename",name:o,target:a.hash},l>1&&(c.targets=i,o.match(/\*/)&&(c.q=o)),n.request({data:c,notify:{type:"rename",cnt:l},navigate:{}}).fail(function(e){var i=n.parseError(e);t&&t.reject(),i&&Array.isArray(i)&&"errRename"===i[0]||n.sync()}).done(function(i){var r;i.added&&i.added.length&&1===l&&(i.undo={cmd:"rename",callback:function(){return n.request({data:{cmd:"rename",target:i.added[0].hash,name:a.name},notify:{type:"undo",cnt:1}})}},i.redo={cmd:"rename",callback:function(){return n.request({data:{cmd:"rename",target:a.hash,name:o},notify:{type:"rename",cnt:1}})}}),t&&t.resolve(i),(r=n.cwd().hash)&&r!==a.hash||n.exec("open",e.map(i.added,function(e){return"directory"===e.mime?e.hash:null})[0])}).always(function(){n.unlockfiles({files:s}).trigger("selectfiles",{files:s})})},a=function(e,t){var i,a,o,r=t||n.selected(),s=n.splitFileExtention(e),l=n.file(r[0]),c=n.file(r[1]);return i=s[1]?"."+s[1]:"",s[1]&&"*"===s[0]?(a='"'+n.splitFileExtention(l.name)[0]+i+'", ',a+='"'+n.splitFileExtention(c.name)[0]+i+'"'):s[0].length>1&&("*"===s[0].substr(-1)?(o=s[0].substr(0,s[0].length-1),a='"'+o+l.name+'", ',a+='"'+o+c.name+'"'):"*"===s[0].substr(0,1)&&(o=s[0].substr(1),a='"'+n.splitFileExtention(l.name)[0]+o+i+'", ',a+='"'+n.splitFileExtention(c.name)[0]+o+i+'"')),a||(a='"'+s[0]+"1"+i+'", "'+s[0]+"2"+i+'"'),r.length>2&&(a+=" ..."),a},o=function(){var o,r=n.selected(),s='',l=function(t,i){return e('").prepend(t)},c=e(''),d=e(s),p=e(s),u=e(s),h=e(s),f=e("").append(l(d,"plusNumber"),l(p,"asPrefix"),l(u,"asSuffix"),l(h,"changeExtention")),m=e(''),g=e('').append(e('').append(c),e('').append(f),m),v={title:n.i18n("batchRename"),modal:!0,destroyOnClose:!0,width:Math.min(380,n.getUI().width()-20),buttons:{},open:function(){c.on("input",y).trigger("focus")}},b=function(){var e=c.val(),t=n.splitFileExtention(n.file(r[0]).name)[1];return(""!==e||d.is(":checked"))&&(p.is(":checked")?e+="*":u.is(":checked")?e="*"+e+"."+t:h.is(":checked")?e="*."+e:t&&(e+="."+t)),e},y=function(){var e=b();""!==e?m.html(n.i18n(["renameMultiple",r.length,a(e)])):m.empty()},w=f.find("input:radio").on("change",y);v.buttons[n.i18n("btnApply")]=function(){var e,t,a=b();""!==a&&(o.elfinderdialog("close"),t=r,e=n.file(t.shift()),i(void 0,t,e,a))},v.buttons[n.i18n("btnCancel")]=function(){o.elfinderdialog("close")},e.fn.checkboxradio?w.checkboxradio({create:function(e,t){this===d.get(0)&&d.prop("checked",!0).change()}}):f.buttonset({create:function(e,t){d.prop("checked",!0).change()}}),o=t.fmDialog(g,v)};this.noChangeDirOnRemovedCwd=!0,this.shortcuts=[{pattern:"f2"+("mac"==n.OS?" enter":"")},{pattern:"shift+f2",description:"batchRename",callback:function(){n.selected().length>1&&o()}}],this.getstate=function(i){var a,r,s,l,c,d,p=this.files(i),u=p.length;return u?(u>1&&p[0].phash&&(a=p[0].phash,r=n.splitFileExtention(p[0].name)[1].toLowerCase(),s=p[0].mime),1===u&&(d=n.isRoot(p[0])),c=1===u&&(d||!p[0].locked)||n.api>2.103&&u===e.grep(p,function(e){return!(l||e.locked||e.phash!==a||n.isRoot(e)||s!==e.mime&&r!==n.splitFileExtention(e.name)[1].toLowerCase())||(l&&(l=!0),!1)}).length?0:-1,!d&&0===c&&n.option("disabledFlip",p[0].hash).rename&&(c=-1),c!==-1&&u>1?t.extra={icon:"preference",node:e("").attr({title:n.i18n("batchRename")}).on("click touchstart",function(e){"touchstart"===e.type&&e.originalEvent.touches.length>1||(e.stopPropagation(),e.preventDefault(),n.getUI().trigger("click"),o())})}:delete t.extra,c):-1},this.exec=function(t,o){var r,s=(n.getUI("cwd"),t||!!n.selected().length&&n.selected()||[n.cwd().hash]),l=s.length,c=n.file(s.shift()),d=".elfinder-cwd-filename",p=o||{},u=n.cwd().hash==c.hash,h="navbar"===p._currentType||"files"===p._currentType?p._currentType:u?"navbar":"files",f="files"!==h,m=e("#"+n[f?"navHash2Id":"cwdHash2Id"](c.hash)),g=!f&&"list"!=n.storage("view"),v=function(){requestAnimationFrame(function(){x&&x.trigger("blur")})},b=function(){T.is(":hidden")||T.elfinderoverlay("hide").off("click close",A),z.removeClass("ui-front").css("position","").off("unselect."+n.namespace,v),g?C&&C.css("max-height",""):f||z.css("width","").parent("td").css("overflow","")},y=e.Deferred().fail(function(e){var t=x.parent(),i=n.escape(c.i18||c.name);x.off(),g&&(i=i.replace(/([_.])/g,"$1")),requestAnimationFrame(function(){f?x.replaceWith(i):t.length?(x.remove(),t.html(i)):m.find(d).html(i)}),e&&n.error(e)}).always(function(){b(),n.unbind("resize",I),n.enable()}),w=function(t){var o=e.trim(x.val()),r=(n.splitFileExtention(o),!0),d=function(){x.off(),b(),f?x.replaceWith(n.escape(o)):C.html(n.escape(o)),i(y,s,c,o)};if(T.is(":hidden")||z.css("z-index",""),""===o){if(!n.isRoot(c))return A();f?x.replaceWith(n.escape(c.name)):C.html(n.escape(c.name))}if(!S&&z.length){if(x.off("blur"),1===l&&o===c.name)return y.reject();if(n.options.validName&&n.options.validName.test)try{r=n.options.validName.test(o)}catch(t){r=!1}if("."===o||".."===o||!r)return S=!0,n.error("directory"===c.mime?"errInvDirname":"errInvName",{modal:!0,close:function(){setTimeout(k,120)}}),!1;if(1===l&&n.fileByName(o,c.phash))return S=!0,n.error(["errExists",o],{modal:!0,close:function(){setTimeout(k,120)}}),!1;1===l?d():(n.confirm({title:"cmdrename",text:["renameMultiple",l,a(o,[c.hash].concat(s))],accept:{label:"btnYes",callback:d},cancel:{label:"btnCancel",callback:function(){setTimeout(function(){S=!0,k()},120)}}}),setTimeout(function(){n.trigger("unselectfiles",{files:n.selected()}).trigger("selectfiles",{files:[c.hash].concat(s)})},120))}},x=e(g?"":'').on("keyup text",function(){g?(this.style.height="1px",this.style.height=this.scrollHeight+"px"):r&&(this.style.width=r+"px",this.scrollWidth>r&&(this.style.width=this.scrollWidth+10+"px"))}).on("keydown",function(t){t.stopImmediatePropagation(),t.keyCode==e.ui.keyCode.ESCAPE?y.reject():t.keyCode==e.ui.keyCode.ENTER&&(t.preventDefault(),x.trigger("blur"))}).on("mousedown click dblclick",function(e){e.stopPropagation(),"dblclick"===e.type&&e.preventDefault()}).on("blur",w).on("dragenter dragleave dragover drop",function(e){e.stopPropagation()}),k=function(){var e=n.splitFileExtention(x.val())[0];S||!n.UA.Mobile||n.UA.iOS||(T.on("click close",A).elfinderoverlay("show"),z.css("z-index",T.css("z-index")+1)),!n.enabled()&&n.enable(),S&&(S=!1,x.on("blur",w)),x.trigger("focus").trigger("select"),x[0].setSelectionRange&&x[0].setSelectionRange(0,e.length)},C=f?m.contents().filter(function(){return 3==this.nodeType&&e(this).parent().attr("id")===n.navHash2Id(c.hash)}):m.find(d),z=C.parent(),T=n.getUI("overlay"),A=function(e){T.is(":hidden")||z.css("z-index",""),S||(y.reject(),e&&(e.stopPropagation(),e.preventDefault()))},I=function(){m.trigger("scrolltoview",{blink:!1})},S=!1;return z.addClass("ui-front").css("position","relative").on("unselect."+n.namespace,v),n.bind("resize",I),f?C.replaceWith(x.val(c.name)):(g?C.css("max-height","none"):f||(r=z.width(),z.width(r-15).parent("td").css("overflow","visible")),C.empty().append(x.val(c.name))),l>1&&n.api<=2.103?y.reject():c&&C.length?c.locked&&!n.isRoot(c)?y.reject(["errLocked",c.name]):(n.one("select",function(){x.parent().length&&c&&e.inArray(c.hash,n.selected())===-1&&x.trigger("blur")}),x.trigger("keyup"),k(),y):y.reject("errCmdParams",this.title)},n.bind("select contextmenucreate closecontextmenu",function(e){var i,a=(e.data?e.data.selected||e.data.targets:null)||n.selected();a&&1===a.length&&(i=n.file(a[0]))&&n.isRoot(i)?t.title=n.i18n("kindAlias")+" ("+n.i18n("preference")+")":t.title=n.i18n("cmdrename"),"closecontextmenu"!==e.type?t.update(void 0,t.title):requestAnimationFrame(function(){t.update(void 0,t.title)})}).remove(function(t){var i;t.data&&t.data.removed&&(i=n.storage("rootNames"))&&(e.each(t.data.removed,function(e,t){i[t]&&delete i[t]}),n.storage("rootNames",i))})},i.prototype.commands.resize=function(){"use strict";var t=0,n=function(t,n,i){var a=[{x:t/2,y:n/2},{x:-t/2,y:n/2},{x:-t/2,y:-n/2},{x:t/2,y:-n/2}],o=[],r={x:Number.MAX_VALUE,y:Number.MAX_VALUE},s={x:Number.MIN_VALUE,y:Number.MIN_VALUE};return e.each(a,function(e,t){o.push({x:t.x*Math.cos(i)-t.y*Math.sin(i),y:t.x*Math.sin(i)+t.y*Math.cos(i)})}),e.each(o,function(e,t){r.x=Math.min(r.x,t.x),r.y=Math.min(r.y,t.y),s.x=Math.max(s.x,t.x),s.y=Math.max(s.y,t.y)}),{width:s.x-r.x,height:s.y-r.y}};this.updateOnSelect=!1,this.getstate=function(){var e=this.fm.selectedFiles();return 1==e.length&&e[0].read&&e[0].write&&e[0].mime.indexOf("image/")!==-1?0:-1},this.resizeRequest=function(t,n,i){var a=this.fm,o=n||a.file(t.target),r=(o?o.tmb:null,a.isCommandEnabled("resize",t.target));if(r&&(!o||o&&o.read&&o.write&&o.mime.indexOf("image/")!==-1))return a.request({data:Object.assign(t,{cmd:"resize"}),notify:{type:"resize",cnt:1}}).fail(function(e){i&&i.reject(e)}).done(function(){t.quality&&a.storage("jpgQuality",t.quality===a.option("jpgQuality")?null:t.quality),i&&i.resolve()});var s;return s=o?o.mime.indexOf("image/")===-1?["errResize",o.name,"errUsupportType"]:["errResize",o.name,"errPerm"]:["errResize",t.target,"errPerm"],i?i.reject(s):a.error(s),e.Deferred().reject(s)},this.exec=function(i){var a,o,r=this,s=this.fm,l=this.files(i),c=e.Deferred(),d=s.api>1,p=this.options,u=650,h=s.getUI(),f=e().controlgroup?"controlgroup":"buttonset",m="undefined"==typeof p.grid8px||"disable"!==p.grid8px,g=Array.isArray(p.presetSize)?p.presetSize:[],v="elfinder-dialog-active",b=s.res("class","editing"),y=function(i,a){var o,l,y,w,x,k="image/jpeg"===i.mime,C=e(''),z='',T='',A='',I=null,S=!1,O=function(){S=!0},j=function(){S&&(S=!1,M.trigger("change"))},M=e('').on("focus","input[type=text],input[type=number]",function(){e(this).trigger("select")}).on("change",function(){I&&cancelAnimationFrame(I),I=requestAnimationFrame(function(){var e,t,i,a,o,r,l,c,d,p,u,h;nt&&!S&&(i=nt.data("canvas"))&&(e=M.children("div.elfinder-resize-control-panel:visible"),t=e.find("input.elfinder-resize-quality"),t.is(":visible")&&(a=nt.data("ctx"),o=nt.get(0),e.hasClass("elfinder-resize-uiresize")?(c=i.width=B.val(),d=i.height=K.val(),a.drawImage(o,0,0,c,d)):e.hasClass("elfinder-resize-uicrop")?(r=V.val(),l=X.val(),c=G.val(),d=J.val(),i.width=c,i.height=d,a.drawImage(o,r,l,c,d,0,0,c,d)):(p=Q.val(),u=Q.val()*Math.PI/180,h=n(pe,ue,u),c=i.width=h.width,d=i.height=h.height,a.save(),p%90!==0&&(a.fillStyle=se.val()||"#FFF",a.fillRect(0,0,c,d)),a.translate(c/2,d/2),a.rotate(u),a.drawImage(o,-o.width/2,-o.height/2,pe,ue),a.restore()),i.toBlob(function(e){e&&t.next("span").text(" ("+s.formatSize(e.size)+")")},"image/jpeg",Math.max(Math.min(t.val(),100),1)/100)))})}).on("mouseup","input",function(t){e(t.target).trigger("change")}),F=e('').on("touchmove",function(t){e(t.target).hasClass("touch-punch")&&(t.stopPropagation(),t.preventDefault())}),D=e(''+s.i18n("ntfloadimg")+"
"),U=e(''),E=e(''),P=e(''),R=e(''),q=e(''),H=e("").attr("title",s.i18n("rotate-cw")).append(e('')),_=e("").attr("title",s.i18n("rotate-ccw")).append(e('')),N=e(""),L=e('