text: !function(e,t){if("function"==typeof define&&define.amd)define(["elfinder"],e);else if(t){var i=t.prototype._options.commandsOptions.edit.editors;t.prototype._options.commandsOptions.edit.editors=i.concat(e(t))}}(function(e){"use strict";var t,i=window.location.search.match(/getfile=([a-z]+)/),n=e.prototype.hasRequire,o=function(){var e;try{e=!!new ActiveXObject("ShockwaveFlash.ShockwaveFlash")}catch(t){e=!!("undefined"==typeof window.orientation||navigator&&navigator.mimeTypes["application/x-shockwave-flash"])}return e}(),a={bmp:"image/x-ms-bmp",dng:"image/x-adobe-dng",gif:"image/gif",jpeg:"image/jpeg",jpg:"image/jpeg",pdf:"application/pdf",png:"image/png",ppm:"image/x-portable-pixmap",psd:"image/vnd.adobe.photoshop",pxd:"image/x-pixlr-data",svg:"image/svg+xml",tiff:"image/tiff",webp:"image/webp",xcf:"image/x-xcf",sketch:"application/x-sketch",ico:"image/x-icon",dds:"image/vnd-ms.dds",emf:"application/x-msmetafile"},r=function(e,i,n){t||(t=i.arrayFlip(a));var o=t[e]||i.mimeTypes[e];return n?"jpg"===o&&(o="jpeg"):"jpeg"===o&&(o="jpg"),o},s=function(e,t){var i=$.Deferred();try{var n=document.createElement("canvas"),o=n.getContext("2d"),a=new Image,r=function(){var e,o,a=n.toDataURL(t);e=(o=a.match(/^data:([a-z0-9]+\/[a-z0-9.+-]+)/i))?o[1]:"",e.toLowerCase()===t.toLowerCase()?i.resolve(n.toDataURL(t),n):i.reject()};return a.src=e,$(a).on("load",function(){try{n.width=a.width,n.height=a.height,o.drawImage(a,0,0),r()}catch(e){i.reject()}}).on("error",function(){i.reject()}),i}catch(s){return i.reject()}},c=function(e,t,i,n){var o,a=$(this).children("img:first").data("ext",r(t.mime,n)),s=$('<div class="elfinder-edit-spinner elfinder-edit-image"/>').html('<span class="elfinder-spinner-text">'+n.i18n("ntfloadimg")+'</span><span class="elfinder-spinner"/>').hide().appendTo(this);i.match(/^data:/)||(o=n.openUrl(t.hash),a.attr("_src",i)),a.attr("id",e+"-img").attr("src",o||i).css({height:"","max-width":"100%","max-height":"100%",cursor:"pointer"}).data("loading",function(e){var t=a.closest(".elfinder-dialog").find("button,.elfinder-titlebar-button");return t.prop("disabled",!e)[e?"removeClass":"addClass"]("ui-state-disabled"),a.css("opacity",e?"":"0.3"),s[e?"hide":"show"](),a})},d=function(e,t){var i,n,o,a=e.attr("style");try{e.attr("style",""),i=e.get(0),n=document.createElement("canvas"),n.width=i.width,n.height=i.height,e.attr("style",a),n.getContext("2d").drawImage(i,0,0),o=n.toDataURL(t)}catch(r){o=e.attr("src")}return o},l=function(){if(o&&window.parent!==window){var e,t,i,n,r,s=window.location.search.match(/[?&]pixlr=([^&]+)/),c=window.location.search.match(/[?&]image=([^&]+)/);s&&(e=window.parent,t=e.$("#"+s[1]+"iframe").hide(),n=e.$("#"+s[1]).data("resizeoff")(),"http"===c[1].substr(0,4)?(i=c[1],r=i.replace(/.+\.([^.]+)$/,"$1"),n.data("ext")!==r&&n.closest(".ui-dialog").trigger("changeType",{extention:r,mime:a[r]}),"https:"===window.location.protocol&&(i=i.replace(/^http:/,"https:")),n.on("load error",function(){n.data("loading")(!0)}).attr("src",i).data("loading")()):n.data("loading")(!0),t.trigger("destroy").remove())}},p=function(e,t){o&&!t.UA.ltIE8||(this.disabled=!0)},m=function(e,t){var i,n=this,o=this.fm,a=o.res("class","preventback"),r=$(t).children("img:first").data("loading")().data("resizeoff",function(){return $(window).off("resize."+r.attr("id")),s.addClass(a),r}).on("click",function(){f()}),s=$(t).closest(".ui-dialog"),c=o.getUI(),d=o.getUI("toast"),l=$('<iframe class="ui-front" allowtransparency="true">'),p=this.file,m=15,u=function(e){e?(l.trigger("destroy").remove(),r.data("loading")(!0),o.error(e)):(d.appendTo(s.closest(".ui-dialog")),o.toast({mode:"info",msg:"Can not launch Pixlr yet. Waiting "+m+" seconds.",button:{text:"Abort",click:function(){l.trigger("destroy").remove(),r.data("loading")(!0)}},onHidden:function(){1===d.children().length&&d.appendTo(o.getUI())}}),i=setTimeout(e,1e3*m))},f=function(){var d="https://pixlr.com/"+e+"/?s=c",f=window.location.href.toString().replace(/#.*$/,""),g={};i=setTimeout(u,1e3*m),f+=(f.indexOf("?")===-1?"?":"&")+"pixlr="+r.attr("id"),d+="&referrer=elFinder&locktitle=true",d+="&exit="+encodeURIComponent(f+"&image=0"),d+="&target="+encodeURIComponent(f),d+="&title="+encodeURIComponent(p.name),d+="&image="+encodeURIComponent(r.attr("_src")),g.src=d,g.css={width:"100%",height:$(window).height()+"px",position:"fixed",display:"block",backgroundColor:"transparent",border:"none",top:0,right:0},n.trigger("Prepare",{node:t,editorObj:void 0,instance:l,opts:g}),l.attr("id",r.attr("id")+"iframe").attr("src",g.src).css(g.css).one("load",function(){i&&clearTimeout(i),setTimeout(function(){l.is(":hidden")&&u("Please disable your ad blocker.")},1e3),s.addClass(a),o.toggleMaximize(l,!0),o.toFront(l)}).on("destroy",function(){o.toggleMaximize(l,!1)}).on("error",u).appendTo(c.hasClass("elfinder-fullscreen")?c:"body")};$(t).on("saveAsFail",f),f()},u=function(e){var t,i=$(e),n=$.Deferred().always(function(){i.off("load",r)}),o="about:blank",a=function(){t=setTimeout(function(){var e;try{e=base.contentWindow.location.href}catch(t){e=null}e===o?n.resolve():--s>0?a():n.reject()},500)},r=function(){t&&clearTimeout(t),n.resolve()},s=20;return i.one("load",r),e.src=o,a(),n};return l(),i&&(i=i[1],"ckeditor"===i&&(e.prototype._options.getFileCallback=function(e,t){window.opener.CKEDITOR.tools.callFunction(function(){var e=new RegExp("(?:[?&]|&amp;)CKEditorFuncNum=([^&]+)","i"),t=window.location.search.match(e);return t&&t.length>1?t[1]:""}(),t.convAbsUrl(e.url)),t.destroy(),window.close()})),[{info:{id:"tuiimgedit",name:"TUI Image Editor",iconImg:"img/editor-icons.png 0 -48",dataScheme:!0,schemeContent:!0,openMaximized:!0,canMakeEmpty:!1,integrate:{title:"TOAST UI Image Editor",link:"http://ui.toast.com/tui-image-editor/"}},mimes:["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp"],html:'<div class="elfinder-edit-imageeditor"><canvas></canvas></div>',setup:function(e,t){t.UA.ltIE8||t.UA.Mobile?this.disabled=!0:(this.opts=Object.assign({version:"v3.7.3"},e.extraOptions.tuiImgEditOpts||{},{iconsPath:t.baseUrl+"img/tui-",theme:{}}),t.isSameOrigin(this.opts.iconsPath)||(this.disabled=!0,t.debug("warning","Setting `commandOptions.edit.extraOptions.tuiImgEditOpts.iconsPath` MUST follow the same origin policy.")))},init:function(e,t,i,n){this.data("url",i)},load:function(e){var t,i=this,n=this.fm,o=$.Deferred(),a=n.options.cdns,r=i.confObj.opts.version,s=function(t){var a,r,s,c,d=$(e),l=d.parent(),p=i.confObj.opts,m=p.iconsPath,u=$('<div class="tui-image-editor-container">').appendTo(l),f=[$('<div class="tui-image-editor-submenu"/>').appendTo(u),$('<div class="tui-image-editor-controls"/>').appendTo(u)],g=new t(e,{includeUI:{loadImage:{path:d.data("url"),name:i.file.name},theme:Object.assign(p.theme,{"menu.normalIcon.path":m+"icon-d.svg","menu.normalIcon.name":"icon-d","menu.activeIcon.path":m+"icon-b.svg","menu.activeIcon.name":"icon-b","menu.disabledIcon.path":m+"icon-a.svg","menu.disabledIcon.name":"icon-a","menu.hoverIcon.path":m+"icon-c.svg","menu.hoverIcon.name":"icon-c","submenu.normalIcon.path":m+"icon-d.svg","submenu.normalIcon.name":"icon-d","submenu.activeIcon.path":m+"icon-c.svg","submenu.activeIcon.name":"icon-c"}),initMenu:"filter",menuBarPosition:"bottom"},cssMaxWidth:Math.max(300,l.width()),cssMaxHeight:Math.max(200,l.height()-(f[0].height()+f[1].height()+3)),usageStatistics:!1}),h=d.find("canvas:first").get(0),v=function(e){if("undefined"!=typeof e){var t,i,n=$(h),o=parseInt(n.attr("width")),a=parseInt(n.attr("height")),r=o/a;0===e?(t=o,i=a):(t=parseInt(n.css("max-width"))+Number(e),i=t/r,t>o&&i>a&&(t=o,i=a)),y.text(Math.round(t/o*100)+"%"),g.resizeCanvasDimension({width:t,height:i}),c&&setTimeout(function(){c&&v(e)},50)}},x=$('<span class="ui-icon ui-icon-plusthick"/>').data("val",10),b=$('<span class="ui-icon ui-icon-minusthick"/>').data("val",-10),y=$("<button/>").css("width","4em").text("%").attr("title","100%").data("val",0);u.remove(),d.removeData("url").data("mime",i.file.mime),"image/jpeg"===i.file.mime?(d.data("quality",n.storage("jpgQuality")||n.option("jpgQuality")),a=$('<input type="number" class="ui-corner-all elfinder-resize-quality elfinder-tabstop"/>').attr("min","1").attr("max","100").attr("title","1 - 100").on("change",function(){var e=a.val();d.data("quality",e),r&&cancelAnimationFrame(r),r=requestAnimationFrame(function(){h.toBlob(function(e){e&&a.next("span").text(" ("+n.formatSize(e.size)+")")},"image/jpeg",Math.max(Math.min(e,100),1)/100)})}).val(d.data("quality")),$('<div class="ui-dialog-buttonset elfinder-edit-extras elfinder-edit-extras-quality"/>').append($("<span>").html(n.i18n("quality")+" : "),a,$("<span/>")).prependTo(d.parent().next())):"image/svg+xml"===i.file.mime&&d.closest(".ui-dialog").trigger("changeType",{extention:"png",mime:"image/png",keepEditor:!0}),$('<div class="ui-dialog-buttonset elfinder-edit-extras"/>').append(b,y,x).attr("title",n.i18n("scale")).on("click","span,button",function(){v($(this).data("val"))}).on("mousedown mouseup mouseleave","span",function(e){c=!1,s&&clearTimeout(s),"mousedown"===e.type&&(s=setTimeout(function(){c=!0,v($(e.target).data("val"))},500))}).prependTo(d.parent().next()),setTimeout(function(){o.resolve(g),a&&(a.trigger("change"),g.on("redoStackChanged undoStackChanged",function(){a.trigger("change")})),v(null)},100)};return i.confObj.editor?s(i.confObj.editor):(t=$.Deferred(),n.loadCss([a.tui+"/tui-color-picker/latest/tui-color-picker.css",a.tui+"/tui-image-editor/"+r+"/tui-image-editor.css"]),n.hasRequire?(require.config({paths:{"fabric/dist/fabric.require":a.fabric+"/fabric.require.min",fabric:a.fabric+"/fabric.min","tui-code-snippet":a.tui+"/tui.code-snippet/latest/tui-code-snippet.min","tui-color-picker":a.tui+"/tui-color-picker/latest/tui-color-picker.min","tui-image-editor":a.tui+"/tui-image-editor/"+r+"/tui-image-editor.min"}}),require(["tui-image-editor"],function(e){t.resolve(e)})):n.loadScript([a.fabric+"/fabric.min.js",a.tui+"/tui.code-snippet/latest/tui-code-snippet.min.js"],function(){n.loadScript([a.tui+"/tui-color-picker/latest/tui-color-picker.min.js"],function(){n.loadScript([a.tui+"/tui-image-editor/"+r+"/tui-image-editor.min.js"],function(){t.resolve(window.tui.ImageEditor)},{loadType:"tag"})},{loadType:"tag"})},{loadType:"tag"}),t.done(function(e){i.confObj.editor=e,s(e)})),o},getContent:function(e){var t=this.editor,i=t.fm,n=$(e),o=n.data("quality");if(t.instance)return"image/jpeg"===n.data("mime")&&(o=o||i.storage("jpgQuality")||i.option("jpgQuality"),o=Math.max(.1,Math.min(1,o/100))),t.instance.toDataURL({format:r(n.data("mime"),i,!0),quality:o})},save:function(e){var t,i=$(e),n=i.data("quality"),o=i.data("hash");this.instance.deactivateAll(),"undefined"!=typeof n&&this.fm.storage("jpgQuality",n),o&&(t=this.fm.file(o),i.data("mime",t.mime))}},{info:{id:"pixlreditor",name:"Pixlr Editor",iconImg:"img/editor-icons.png 0 -128",urlAsContent:!0,schemeContent:!0,single:!0,canMakeEmpty:!0,integrate:{title:"PIXLR EDITOR",link:"https://pixlr.com/editor/"}},mimes:["image/jpeg","image/png","image/gif","image/x-ms-bmp","image/x-pixlr-data"],html:'<div class="elfinder-edit-imageeditor"><img/></div>',setup:function(e,t){p.call(this,e,t)},init:function(e,t,i,n){c.call(this,e,t,t.size>0?n.convAbsUrl(i):"",n)},getContent:function(){return $(this).children("img:first").attr("src")},load:function(e){m.call(this,"editor",e)},save:function(e){},close:function(e){}},{info:{id:"pixlrexpress",name:"Pixlr Express",iconImg:"img/editor-icons.png 0 -112",urlAsContent:!0,schemeContent:!0,single:!0,canMakeEmpty:!1,integrate:{title:"PIXLR EXPRESS",link:"https://pixlr.com/express/"}},mimes:["image/jpeg","image/png","image/gif"],html:'<div class="elfinder-edit-imageeditor"><img/></div>',setup:function(e,t){p.call(this,e,t)},init:function(e,t,i,n){c.call(this,e,t,t.size>0?n.convAbsUrl(i):"",n)},getContent:function(){return $(this).children("img:first").attr("src")},load:function(e){m.call(this,"express",e)},save:function(e){},close:function(e){}},{info:{id:"photopea",name:"Photopea",iconImg:"img/editor-icons.png 0 -160",single:!0,noContent:!0,arrayBufferContent:!0,openMaximized:!0,canMakeEmpty:["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp","image/tiff","image/webp","image/vnd.adobe.photoshop","application/pdf","image/x-portable-pixmap","image/x-sketch","image/x-icon","image/vnd-ms.dds"],integrate:{title:"Photopea",link:"https://www.photopea.com/learn/"}},mimes:["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp","image/tiff","image/x-adobe-dng","image/webp","image/x-xcf","image/vnd.adobe.photoshop","application/pdf","image/x-portable-pixmap","image/x-sketch","image/x-icon","image/vnd-ms.dds","application/x-msmetafile"],html:'<iframe style="width:100%;height:100%;border:none;"></iframe>',setup:function(e,t){(t.UA.IE||t.UA.Mobile)&&(this.disabled=!0)},init:function(e,t,i,n){var o,s,c,d="https://www.photopea.com",l=$(this).hide().on("load",function(){l.show()}).on("error",function(){u.remove(),l.show()}),p=this.editor,m=p.confObj,u=$('<div class="elfinder-edit-spinner elfinder-edit-photopea"/>').html('<span class="elfinder-spinner-text">'+n.i18n("nowLoading")+'</span><span class="elfinder-spinner"/>').appendTo(l.parent()),f=n.arrayFlip(m.info.canMakeEmpty),g=function(e){var t=r(e,n),i=a[t];return m.mimesFlip[i]?"jpeg"===t&&(t="jpg"):t="",t&&f[i]||(t="psd",i=a[t],l.closest(".ui-dialog").trigger("changeType",{extention:t,mime:i,keepEditor:!0})),t},h=t.mime;m.mimesFlip||(m.mimesFlip=n.arrayFlip(m.mimes,!0)),m.liveMsg||(m.liveMsg=function(e,t,i){var o=n.openUrl(i.hash);n.isSameOrigin(o)||(o=n.openUrl(i.hash,!0));var a,r=e.get(0).contentWindow,s=0,c=null,l=$.Deferred().done(function(){t.remove(),s=1,r.postMessage(c,d)});this.load=function(){return n.request({data:{cmd:"get"},options:{url:o,type:"get",cache:!0,dataType:"binary",responseType:"arraybuffer",processData:!1}}).done(function(e){c=e})},this.receive=function(t){var i=t.originalEvent;i.origin===d&&i.source===r&&("done"===i.data?0===s?l.resolve():1===s?(s=2,e.trigger("contentsloaded")):a&&"pending"===a.state()&&a.reject("errDataEmpty"):"Save"===i.data?p.doSave():a&&"pending"===a.state()&&("object"==typeof i.data?a.resolve("data:"+h+";base64,"+n.arrayBufferToBase64(i.data)):a.reject("errDataEmpty")))},this.getContent=function(){var t,i;if(s>1)return a&&"pending"===a.state()&&a.reject(),a=null,a=$.Deferred(),2===s?(s=3,a.resolve("data:"+h+";base64,"+n.arrayBufferToBase64(c)),c=null,a):(e.data("mime")&&(h=e.data("mime"),t=g(h)),(i=e.data("quality"))&&(t+=":"+i/100),r.postMessage('app.activeDocument.saveToOE("'+t+'")',d),a)}}),l.parent().css("padding",0),s=g(t.mime),o=p.liveMsg=new m.liveMsg(l,u,t),$(window).on("message."+n.namespace,o.receive),o.load().done(function(){var e=JSON.stringify({files:[],environment:{lang:n.lang.replace(/_/g,"-"),customIO:{save:'app.echoToOE("Save");'}}});l.attr("src",d+"/#"+encodeURI(e))}).fail(function(e){e&&n.error(e),p.initFail=!0}),"image/jpeg"!==t.mime&&"image/webp"!==t.mime||(l.data("quality",n.storage("jpgQuality")||n.option("jpgQuality")),c=$('<input type="number" class="ui-corner-all elfinder-resize-quality elfinder-tabstop"/>').attr("min","1").attr("max","100").attr("title","1 - 100").on("change",function(){var e=c.val();l.data("quality",e)}).val(l.data("quality")),$('<div class="ui-dialog-buttonset elfinder-edit-extras elfinder-edit-extras-quality"/>').append($("<span>").html(n.i18n("quality")+" : "),c,$("<span/>")).prependTo(l.parent().next()))},load:function(e){var t=$.Deferred(),i=this,n=(this.fm,$(e));return i.initFail?t.reject():n.on("contentsloaded",function(){t.resolve(i.liveMsg)}),t},getContent:function(){return this.editor.liveMsg?this.editor.liveMsg.getContent():void 0},save:function(e,t){var i,n=$(e),o=n.data("quality"),a=n.data("hash");"undefined"!=typeof o&&this.fm.storage("jpgQuality",o),a?(i=this.fm.file(a),n.data("mime",i.mime)):n.removeData("mime")},close:function(e,t){$(e).attr("src",""),t&&$(window).off("message."+this.fm.namespace,t.receive)}},{info:{id:"pixo",name:"Pixo Editor",iconImg:"img/editor-icons.png 0 -208",dataScheme:!0,schemeContent:!0,single:!0,canMakeEmpty:!1,integrate:{title:"Pixo Editor",link:"https://pixoeditor.com/privacy-policy/"}},mimes:["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp"],html:'<div class="elfinder-edit-imageeditor"><img/></div>',setup:function(e,t){!t.UA.ltIE8&&e.extraOptions&&e.extraOptions.pixo&&e.extraOptions.pixo.apikey?this.editorOpts=e.extraOptions.pixo:this.disabled=!0},init:function(e,t,i,n){c.call(this,e,t,i,n)},getContent:function(){return $(this).children("img:first").attr("src")},load:function(e){var t,i,n,o,a,c=this,d=this.fm,l=$(e),p=l.children("img:first"),m=l.closest(".ui-dialog"),u=d.getUI(),f=$.Deferred(),g=$("#elfinder-pixo-container"),h=function(n){var h;g.length?g.appendTo(g.parent()):(g=$('<div id="elfinder-pixo-container" class="ui-front"/>').css({position:"fixed",top:0,right:0,width:"100%",height:$(window).height(),overflow:"hidden"}).hide().appendTo(u.hasClass("elfinder-fullscreen")?u:"body"),u.on("resize."+d.namespace,function(e,t){e.preventDefault(),e.stopPropagation(),t&&t.fullscreen&&g.appendTo("on"===t.fullscreen?u:"body")}),d.bind("destroy",function(){a&&a.cancelEditing(),g.remove()})),p.on("click",v),h=Object.assign({type:"child",parent:g.get(0),output:{format:"png"},onSave:function(n){var a=n.toBlob().type,l=r(a,d),u=function(e){p.one("load error",function(){p.data("loading")&&p.data("loading")(!0)}).attr("crossorigin","anonymous").attr("src",e)},f=n.toDataURL();p.data("loading")(),delete e._canvas,p.data("ext")!==l?s(f,c.file.mime).done(function(n,a){a&&(e._canvas=o=a,i.trigger("change"),t&&t.show()),u(n)}).fail(function(){m.trigger("changeType",{extention:l,mime:a}),u(f)}):u(f)},onClose:function(){m.removeClass(d.res("class","preventback")),d.toggleMaximize(g,!1),g.hide(),d.toFront(m)}},c.confObj.editorOpts),c.trigger("Prepare",{node:e,editorObj:Pixo,instance:void 0,opts:h}),a=new Pixo.Bridge(h),f.resolve(a),l.on("saveAsFail",v),n&&n()},v=function(){m.addClass(d.res("class","preventback")),d.toggleMaximize(g,!0),d.toFront(g),g.show().data("curhash",c.file.hash),a.edit(p.get(0)),p.data("loading")(!0)};return p.data("loading")(),"image/jpeg"===c.file.mime&&(i=$('<input type="number" class="ui-corner-all elfinder-resize-quality elfinder-tabstop"/>').attr("min","1").attr("max","100").attr("title","1 - 100").on("change",function(){var e=i.val();n&&cancelAnimationFrame(n),n=requestAnimationFrame(function(){o&&o.toBlob(function(e){e&&i.next("span").text(" ("+d.formatSize(e.size)+")")},"image/jpeg",Math.max(Math.min(e,100),1)/100)})}).val(d.storage("jpgQuality")||d.option("jpgQuality")),t=$('<div class="ui-dialog-buttonset elfinder-edit-extras elfinder-edit-extras-quality"/>').hide().append($("<span>").html(d.i18n("quality")+" : "),i,$("<span/>")).prependTo(l.parent().next()),l.data("quty",i)),"undefined"==typeof Pixo?d.loadScript(["https://pixoeditor.com:8443/editor/scripts/bridge.m.js"],function(){h(v)},{loadType:"tag"}):(h(),v()),f},save:function(e){var t,i=this,n=$(e),o=n.children("img:first");e._canvas?(n.data("quty")&&(t=n.data("quty").val(),t&&this.fm.storage("jpgQuality",t)),o.attr("src",e._canvas.toDataURL(i.file.mime,t?Math.max(Math.min(t,100),1)/100:void 0))):"data:"!==o.attr("src").substr(0,5)&&o.attr("src",d(o,this.file.mime))},close:function(e,t){t&&t.destroy()}},{info:{id:"creativecloud",name:"Creative Cloud",iconImg:"img/editor-icons.png 0 -192",dataScheme:!0,schemeContent:!0,single:!0,canMakeEmpty:!1,integrate:{title:"Adobe Creative Cloud",link:"https://www.adobe.io/apis/creativecloud.html"}},mimes:["image/jpeg","image/png","image/gif","image/svg+xml","image/x-ms-bmp"],html:'<div class="elfinder-edit-imageeditor"><img/></div>',setup:function(e,t){!t.UA.ltIE8&&e.extraOptions&&e.extraOptions.creativeCloudApiKey?this.apiKey=e.extraOptions.creativeCloudApiKey:this.disabled=!0},init:function(e,t,i,n){c.call(this,e,t,i,n)},getContent:function(){return $(this).children("img:first").attr("src")},load:function(e){var t,i,n,o,r=this,s=this.fm,c=$(e),d=c.children("img:first"),l=c.closest(".ui-dialog"),p=s.getUI(),m=$.Deferred(),u=$("#elfinder-aviary-container"),f=function(o){var f,h=function(){var e={zh_TW:"zh_HANT",zh_CN:"zh_HANS"};return e[s.lang]?e[s.lang]:s.lang};u.length?u.appendTo(u.parent()):(u=$('<div id="elfinder-aviary-container" class="ui-front"/>').css({position:"fixed",top:0,right:0,width:"100%",height:$(window).height(),overflow:"auto"}).hide().appendTo(p.hasClass("elfinder-fullscreen")?p:"body"),p.on("resize."+s.namespace,function(e,t){e.preventDefault(),e.stopPropagation(),t&&t.fullscreen&&u.appendTo("on"===t.fullscreen?p:"body")}),s.bind("destroy",function(){u.remove()})),d.on("click",g).data("loading")(),f={apiKey:r.confObj.apiKey,onSave:function(o,r){var c,l=s.arrayFlip(["jpg","png"]);t.showWaitIndicator(),c=r.replace(/.+\.([^.]+)$/,"$1"),l[d.data("ext")]||d.data("ext")===c?d.data("mime",a[d.data("ext")]):(d.closest(".ui-dialog").trigger("changeType",{extention:c,mime:a[c]}),d.data("mime",a[c])),d.on("load error",function(){var t;d.data("loading")(!0),n&&"data:"!==d.attr("src").substr(0,5)&&(t=document.createElement("img"),$(t).attr("crossorigin","anonymous").on("load",function(){i=document.createElement("canvas"),i.width=t.width,i.height=t.height,i.getContext("2d").drawImage(t,0,0),e._canvas=i,n&&n.trigger("change")}),t.src=r)}).attr("crossorigin","anonymous").attr("src",r).data("loading")(),t.close()},onLoad:o||function(){},onClose:function(){l.removeClass(s.res("class","preventback")),s.toggleMaximize(u,!1),$(u).hide()},appendTo:u.get(0),maxSize:2048,language:h(),fileFormat:"png"},r.trigger("Prepare",{node:e,editorObj:Aviary,instance:void 0,opts:f}),t=new Aviary.Feather(f),m.resolve(t),c.on("saveAsFail",g)},g=function(){l.addClass(s.res("class","preventback")),s.toggleMaximize(u,!0),s.toFront(u),$(u).show(),t.launch({image:d.attr("id"),url:d.attr("src")}),d.data("loading")(!0)};return"image/jpeg"===r.file.mime&&(c.data("quality",s.storage("jpgQuality")||s.option("jpgQuality")),n=$('<input type="number" class="ui-corner-all elfinder-resize-quality elfinder-tabstop"/>').attr("min","1").attr("max","100").attr("title","1 - 100").on("change",function(){var e=n.val();c.data("quality",e),o&&cancelAnimationFrame(o),i&&(o=requestAnimationFrame(function(){i.toBlob(function(e){e&&n.next("span").text(" ("+s.formatSize(e.size)+")")},"image/jpeg",Math.max(Math.min(e,100),1)/100)}))}).val(c.data("quality")),$('<div class="ui-dialog-buttonset elfinder-edit-extras elfinder-edit-extras-quality"/>').append($("<span>").html(s.i18n("quality")+" : "),n,$("<span/>")).prependTo(c.parent().next())),"undefined"==typeof Aviary?s.loadScript(["https://dme0ih8comzn4.cloudfront.net/imaging/v3/editor.js"],function(){f(g)},{loadType:"tag"}):(f(),g()),m},save:function(e){var t=$(e).children("img:first"),i=$(e).data("quality");e._canvas?(i&&this.fm.storage("jpgQuality",i),t.attr("src",e._canvas.toDataURL(t.data("mime"),i?Math.max(Math.min(i,100),1)/100:void 0))):"data:"!==t.attr("src").substr(0,5)&&t.attr("src",d(t,t.data("mime")))}},{setup:function(e,t){!t.UA.ltIE8&&t.options.cdns.ace||(this.disabled=!0)},info:{id:"aceeditor",name:"ACE Editor",iconImg:"img/editor-icons.png 0 -96"},load:function(e){var t=this,i=this.fm,n=$.Deferred(),o=i.options.cdns.ace,a=function(){var i,a,r,s=$(e),c=s.parent(),d=c.parent(),l=e.id+"_ace",p=(t.file.name.replace(/^.+\.([^.]+)|(.+)$/,"$1$2").toLowerCase(),{"text/x-php":"php","application/x-php":"php","text/html":"html","application/xhtml+xml":"html","text/javascript":"javascript","application/javascript":"javascript","text/css":"css","text/x-c":"c_cpp","text/x-csrc":"c_cpp","text/x-chdr":"c_cpp","text/x-c++":"c_cpp","text/x-c++src":"c_cpp","text/x-c++hdr":"c_cpp","text/x-shellscript":"sh","application/x-csh":"sh","text/x-python":"python","text/x-java":"java","text/x-java-source":"java","text/x-ruby":"ruby","text/x-perl":"perl","application/x-perl":"perl","text/x-sql":"sql","text/xml":"xml","application/docbook+xml":"xml","application/xml":"xml"});c.height(c.height()),ace.config.set("basePath",o),a=$('<div id="'+l+'" style="width:100%; height:100%;"/>').text(s.val()).insertBefore(s.hide()),s.data("ace",!0),i=ace.edit(l),i.$blockScrolling=1/0,i.setOptions({theme:"ace/theme/monokai",fontSize:"14px",wrap:!0}),ace.config.loadModule("ace/ext/modelist",function(){r=ace.require("ace/ext/modelist").getModeForPath("/"+t.file.name).name,"text"===r&&p[t.file.mime]&&(r=p[t.file.mime]),c.prev().children(".elfinder-dialog-title").append(" ("+t.file.mime+" : "+r.split(/[\/\\]/).pop()+")"),i.setOptions({mode:"ace/mode/"+r}),"resolved"===n.state()&&d.trigger("resize")}),ace.config.loadModule("ace/ext/language_tools",function(){ace.require("ace/ext/language_tools"),i.setOptions({enableBasicAutocompletion:!0,enableSnippets:!0,enableLiveAutocompletion:!1})}),ace.config.loadModule("ace/ext/settings_menu",function(){ace.require("ace/ext/settings_menu").init(i)}),i.commands.addCommand({name:"saveFile",bindKey:{win:"Ctrl-s",mac:"Command-s"},exec:function(e){t.doSave()}}),i.commands.addCommand({name:"closeEditor",bindKey:{win:"Ctrl-w|Ctrl-q",mac:"Command-w|Command-q"},exec:function(e){t.doCancel()}}),i.resize(),$('<div class="ui-dialog-buttonset"/>').css("float","left").append($("<button/>").html(t.fm.i18n("TextArea")).button().on("click",function(){s.data("ace")?(s.removeData("ace"),a.hide(),s.val(i.session.getValue()).show().trigger("focus"),$(this).text("AceEditor")):(s.data("ace",!0),a.show(),i.setValue(s.hide().val(),-1),i.focus(),$(this).html(t.fm.i18n("TextArea")))})).append($("<button>Ace editor setting</button>").button({icons:{primary:"ui-icon-gear",secondary:"ui-icon-triangle-1-e"},text:!1}).on("click",function(){i.showSettingsMenu(),$("#ace_settingsmenu").css("font-size","80%").find('div[contains="setOptions"]').hide().end().parent().appendTo($("#elfinder"))})).prependTo(c.next()),t.trigger("Prepare",{node:e,editorObj:ace,instance:i,opts:{}}),n.resolve(i)};return t.confObj.loader||(t.confObj.loader=$.Deferred(),t.fm.loadScript([o+"/ace.js"],function(){t.confObj.loader.resolve()},void 0,{obj:window,name:"ace"})),t.confObj.loader.done(a),n},close:function(e,t){t&&t.destroy()},save:function(e,t){t&&$(e).data("ace")&&(e.value=t.session.getValue())},focus:function(e,t){t&&$(e).data("ace")&&t.focus()},resize:function(e,t,i,n){t&&t.resize()}},{setup:function(e,t){!t.UA.ltIE10&&t.options.cdns.codemirror||(this.disabled=!0)},info:{id:"codemirror",name:"CodeMirror",iconImg:"img/editor-icons.png 0 -176"},load:function(e){var t=this.fm,i=t.convAbsUrl(t.options.cdns.codemirror),o=$.Deferred(),a=this,r=function(t){var r,s,c,d=$(e),l=d.parent();l.height(l.height()),c={lineNumbers:!0,lineWrapping:!0,extraKeys:{"Ctrl-S":function(){a.doSave()},"Ctrl-Q":function(){a.doCancel()},"Ctrl-W":function(){a.doCancel()}}},a.trigger("Prepare",{node:e,editorObj:t,instance:void 0,opts:c}),r=t.fromTextArea(e,c),o.resolve(r);var p,m,u,f;p||(p=t.findModeByMIME(a.file.mime)),!p&&(m=a.file.name.match(/.+\.([^.]+)$/))&&(p=t.findModeByExtension(m[1])),p&&(t.modeURL=n?"codemirror/mode/%N/%N.min":i+"/mode/%N/%N.min.js",u=p.mode,f=p.mime,r.setOption("mode",f),t.autoLoadMode(r,u),l.prev().children(".elfinder-dialog-title").append(" ("+f+("null"!=u?" : "+u:"")+")")),s=$(r.getWrapperElement()).css({padding:0,border:"none"}),d.data("cm",!0),s.height("100%"),$('<div class="ui-dialog-buttonset"/>').css("float","left").append($("<button/>").html(a.fm.i18n("TextArea")).button().on("click",function(){d.data("cm")?(d.removeData("cm"),s.hide(),d.val(r.getValue()).show().trigger("focus"),$(this).text("CodeMirror")):(d.data("cm",!0),s.show(),r.setValue(d.hide().val()),r.refresh(),r.focus(),$(this).html(a.fm.i18n("TextArea")))})).prependTo(l.next())};return a.confObj.loader||(a.confObj.loader=$.Deferred(),n?(require.config({packages:[{name:"codemirror",location:i,main:"codemirror.min"}],map:{codemirror:{"codemirror/lib/codemirror":"codemirror"}}}),require(["codemirror","codemirror/addon/mode/loadmode.min","codemirror/mode/meta.min"],function(e){a.confObj.loader.resolve(e)})):a.fm.loadScript([i+"/codemirror.min.js"],function(){a.fm.loadScript([i+"/addon/mode/loadmode.min.js",i+"/mode/meta.min.js"],function(){a.confObj.loader.resolve(CodeMirror)})},{loadType:"tag"}),a.fm.loadCss(i+"/codemirror.css")),a.confObj.loader.done(r),o},close:function(e,t){t&&t.toTextArea()},save:function(e,t){t&&$(e).data("cm")&&(e.value=t.getValue())},focus:function(e,t){t&&$(e).data("cm")&&t.focus()},resize:function(e,t,i,n){t&&t.refresh()}},{setup:function(e,t){!t.UA.ltIE10&&t.options.cdns.simplemde||(this.disabled=!0)},info:{id:"simplemde",name:"SimpleMDE",iconImg:"img/editor-icons.png 0 -80"},exts:["md"],load:function(e){var t=this,i=this.fm,o=$(e).parent(),a=$.Deferred(),r=i.options.cdns.simplemde,s=function(i){var n,r,s,c=o.height(),d=o.outerHeight(!0)-c+14;e._setHeight=function(e){var t,i=e||o.height(),a=0;return o.children(".editor-toolbar,.editor-statusbar").each(function(){a+=$(this).outerHeight(!0)}),t=i-a-d,r.height(t),n.codemirror.refresh(),t},o.height(c),s={element:e,autofocus:!0},t.trigger("Prepare",{node:e,editorObj:i,instance:void 0,opts:s}),n=new i(s),a.resolve(n),r=$(n.codemirror.getWrapperElement()),r.css("min-height","50px").children(".CodeMirror-scroll").css("min-height","50px"),e._setHeight(c)};return t.confObj.loader||(t.confObj.loader=$.Deferred(),t.fm.loadCss(r+"/simplemde.min.css"),n?require([r+"/simplemde.min.js"],function(e){t.confObj.loader.resolve(e)}):t.fm.loadScript([r+"/simplemde.min.js"],function(){t.confObj.loader.resolve(SimpleMDE)},{loadType:"tag"})),t.confObj.loader.done(s),a},close:function(e,t){t&&t.toTextArea(),t=null},save:function(e,t){t&&(e.value=t.value())},focus:function(e,t){t&&t.codemirror.focus()},resize:function(e,t,i,n){t&&e._setHeight()}},{info:{id:"ckeditor",name:"CKEditor",iconImg:"img/editor-icons.png 0 0"},exts:["htm","html","xhtml"],setup:function(e,t){var i=this;t.options.cdns.ckeditor?(i.ckeOpts={},e.extraOptions&&(i.ckeOpts=Object.assign({},e.extraOptions.ckeditor||{}),e.extraOptions.managerUrl&&(i.managerUrl=e.extraOptions.managerUrl))):i.disabled=!0},load:function(e){var t=this,i=this.fm,n=$.Deferred(),o=function(){var o,a=$(e).parent(),r=a.closest(".elfinder-dialog"),s=a.height(),c=/([&?]getfile=)[^&]+/,d=t.confObj.managerUrl||window.location.href.replace(/#.*$/,""),l="ckeditor";c.test(d)?d=d.replace(c,"$1"+l):d+="?getfile="+l,a.height(s),o={startupFocus:!0,fullPage:!0,allowedContent:!0,filebrowserBrowseUrl:d,toolbarCanCollapse:!0,toolbarStartupExpanded:!i.UA.Mobile,removePlugins:"resize",extraPlugins:"colorbutton,justify,docprops",on:{instanceReady:function(o){var a=o.editor;a.resize("100%",s),r.one("beforedommove."+i.namespace,function(){a.destroy()}).one("dommove."+i.namespace,function(){t.load(e).done(function(e){t.instance=e})}),n.resolve(o.editor)}}},t.trigger("Prepare",{node:e,editorObj:CKEDITOR,instance:void 0,opts:o}),CKEDITOR.replace(e.id,Object.assign(o,t.confObj.ckeOpts)),CKEDITOR.on("dialogDefinition",function(e){var t=e.data.definition.dialog;t.on("show",function(e){i.getUI().append($(".cke_dialog_background_cover")).append(this.getElement().$)}),t.on("hide",function(e){$("body:first").append($(".cke_dialog_background_cover")).append(this.getElement().$)})})};return t.confObj.loader||(t.confObj.loader=$.Deferred(),window.CKEDITOR_BASEPATH=i.options.cdns.ckeditor+"/",$.getScript(i.options.cdns.ckeditor+"/ckeditor.js",function(){t.confObj.loader.resolve()})),t.confObj.loader.done(o),n},close:function(e,t){t&&t.destroy()},save:function(e,t){t&&(e.value=t.getData())},focus:function(e,t){t&&t.focus()},resize:function(e,t,i,n){t&&"ready"===t.status&&t.resize("100%",$(e).parent().height())}},{info:{id:"ckeditor5",name:"CKEditor5",iconImg:"img/editor-icons.png 0 -16"},exts:["htm","html","xhtml"],html:'<div class="edit-editor-ckeditor5"></div>',setup:function(e,t){var i=this;t.options.cdns.ckeditor5&&"function"==typeof window.Symbol&&"symbol"==typeof Symbol()?(i.ckeOpts={},
  e.extraOptions&&(e.extraOptions.ckeditor5Mode&&(i.ckeditor5Mode=e.extraOptions.ckeditor5Mode),i.ckeOpts=Object.assign({},e.extraOptions.ckeditor5||{}),i.ckeOpts.mode&&(i.ckeditor5Mode=i.ckeOpts.mode,delete i.ckeOpts.mode),e.extraOptions.managerUrl&&(i.managerUrl=e.extraOptions.managerUrl))):i.disabled=!0,t.bind("destroy",function(){i.editor=null})},prepare:function(e,t,i){$(e).height(e.editor.fm.getUI().height()-100)},init:function(e,t,i,n){var o=i.match(/^([\s\S]*<body[^>]*>)([\s\S]+)(<\/body>[\s\S]*)$/i),a="",r="",s="";this.css({width:"100%",height:"100%","box-sizing":"border-box"}),o?(a=o[1],r=o[2],s=o[3]):r=i,this.data("data",{header:a,body:r,footer:s})},load:function(e){var t,i=this,n=this.fm,o=$.Deferred(),a=i.confObj.ckeditor5Mode||"decoupled-document",r=function(){var e=n.lang.toLowerCase().replace("_","-");return"zh"===e.substr(0,2)&&"zh-cn"!==e&&(e="zh"),e}(),s=function(t){var s,d=$(e).parent();d.height(n.getUI().height()-100),s=Object.assign({toolbar:["heading","|","fontSize","fontFamily","|","bold","italic","underline","strikethrough","highlight","|","alignment","|","numberedList","bulletedList","blockQuote","indent","outdent","|","ckfinder","link","imageUpload","insertTable","mediaEmbed","|","undo","redo"],language:r},i.confObj.ckeOpts),i.trigger("Prepare",{node:e,editorObj:t,instance:void 0,opts:s}),t.create(e,s).then(function(t){var i,r,s=t.commands.get("ckfinder"),l=t.plugins.get("FileRepository"),p={};!t.ui.view.toolbar||"classic"!==a&&"decoupled-document"!==a||$(e).closest(".elfinder-dialog").children(".ui-widget-header").append($(t.ui.view.toolbar.element).css({marginRight:"-1em",marginLeft:"-1em"})),"classic"===a&&$(e).closest(".elfinder-edit-editor").css("overflow","auto"),s&&(i=function(e){return e&&e.mime.match(/^image\//i)},r=function(e){var i=t.commands.get("imageUpload");if(!i.isEnabled){var n=t.plugins.get("Notification"),o=t.locale.t;return void n.showWarning(o("Could not insert image at the current position."),{title:o("Inserting image failed"),namespace:"ckfinder"})}t.execute("imageInsert",{source:e})},s.execute=function(){var e=d.closest(".elfinder-dialog"),o=n.getCommand("getfile"),a=function(){p.hasVar&&(e.off("resize close",a),o.callback=p.callback,o.options.folders=p.folders,o.options.multiple=p.multi,n.commandMap.open=p.open,p.hasVar=!1)};e.trigger("togleminimize").one("resize close",a),p.callback=o.callback,p.folders=o.options.folders,p.multi=o.options.multiple,p.open=n.commandMap.open,p.hasVar=!0,o.callback=function(o){var a=[];return 1===o.length&&"directory"===o[0].mime?void n.one("open",function(){n.commandMap.open="getfile"}).getCommand("open").exec(o[0].hash):(n.getUI("cwd").trigger("unselectall"),$.each(o,function(e,o){i(o)?a.push(n.convAbsUrl(o.url)):t.execute("link",n.convAbsUrl(o.url))}),a.length&&r(a),void e.trigger("togleminimize"))},o.options.folders=!0,o.options.multiple=!0,n.commandMap.open="getfile",n.toast({mode:"info",msg:n.i18n("dblclickToSelect")})}),l.createUploadAdapter=function(e){return new c(e)},t.setData($(e).data("data").body),n.getUI().append($("body > div.ck-body")),$("div.ck-balloon-panel").css({"z-index":n.getMaximizeCss().zIndex+1}),o.resolve(t)})["catch"](function(e){n.error(e)})},c=function(e){var t=function(t,i,o){n.exec("upload",{files:[t]},void 0,n.cwd().hash).done(function(e){e.added&&e.added.length?n.url(e.added[0].hash,{async:!0}).done(function(e){i({"default":n.convAbsUrl(e)})}).fail(function(){o("errFileNotFound")}):o(n.i18n(e.error?e.error:"errUpload"))}).fail(function(e){var t=n.parseError(e);o(n.i18n(t?"userabort"===t?"errAbort":t:"errUploadNoFiles"))}).progress(function(t){e.uploadTotal=t.total,e.uploaded=t.progress})};this.upload=function(){return new Promise(function(i,n){e.file instanceof Promise||e.file&&"function"==typeof e.file.then?e.file.then(function(e){t(e,i,n)}):t(e.file,i,n)})},this.abort=function(){n.getUI().trigger("uploadabort")}};return i.confObj.editor?s(i.confObj.editor):(t=$.Deferred(),i.fm.loadScript([n.options.cdns.ckeditor5+"/"+a+"/ckeditor.js"],function(e){e||(e=window.BalloonEditor||window.InlineEditor||window.ClassicEditor||window.DecoupledEditor),"en"!==n.lang?i.fm.loadScript([n.options.cdns.ckeditor5+"/"+a+"/translations/"+r+".js"],function(i){t.resolve(e)},{tryRequire:!0,loadType:"tag",error:function(i){r="en",t.resolve(e)}}):t.resolve(e)},{tryRequire:!0,loadType:"tag"}),t.done(function(e){i.confObj.editor=e,s(e)})),o},getContent:function(){var e=$(this).data("data");return e.header+e.body+e.footer},close:function(e,t){t&&t.destroy()},save:function(e,t){var i=$(e),n=i.data("data");t&&(n.body=t.getData(),i.data("data",n))},focus:function(e,t){$(e).trigger("focus")}},{info:{id:"tinymce",name:"TinyMCE",iconImg:"img/editor-icons.png 0 -64"},exts:["htm","html","xhtml"],setup:function(e,t){var i=this;t.options.cdns.tinymce?(i.mceOpts={},e.extraOptions?(i.uploadOpts=Object.assign({},e.extraOptions.uploadOpts||{}),i.mceOpts=Object.assign({},e.extraOptions.tinymce||{})):i.uploadOpts={}):i.disabled=!0},load:function(e){var t=this,i=this.fm,n=$.Deferred(),o=function(){var o,a,r,s=$(e).show().parent(),c=s.closest(".elfinder-dialog"),d=s.height(),l=s.outerHeight(!0)-d,p=function(){var e;tinymce.activeEditor.windowManager.windows?(e=tinymce.activeEditor.windowManager.windows[0],a=$(e?e.getEl():void 0).hide(),r=$("#mce-modal-block").hide()):a=$(".tox-dialog-wrap").hide()},m=function(){r&&r.show(),a&&a.show()},u=tinymce.majorVersion;s.height(d),e._setHeight=function(e){if(u<5){var t,i=$(this).parent(),n=e||i.innerHeight(),o=0;i.find(".mce-container-body:first").children(".mce-top-part,.mce-statusbar").each(function(){o+=$(this).outerHeight(!0)}),t=n-o-l,i.find(".mce-edit-area iframe:first").height(t)}},o={selector:"#"+e.id,resize:!1,plugins:"print preview fullpage searchreplace autolink directionality visualblocks visualchars fullscreen image link media template codesample table charmap hr pagebreak nonbreaking anchor toc insertdatetime advlist lists wordcount imagetools textpattern help",toolbar:"formatselect | bold italic strikethrough forecolor backcolor | link image media | alignleft aligncenter alignright alignjustify | numlist bullist outdent indent | removeformat",image_advtab:!0,init_instance_callback:function(o){e._setHeight(d),c.one("beforedommove."+i.namespace,function(){tinymce.execCommand("mceRemoveEditor",!1,e.id)}).one("dommove."+i.namespace,function(){t.load(e).done(function(e){t.instance=e})}),n.resolve(o)},file_picker_callback:function(e,t,n){var o=i.getCommand("getfile"),a=function(){r.hasVar&&(o.callback=r.callback,o.options.folders=r.folders,o.options.multiple=r.multi,i.commandMap.open=r.open,r.hasVar=!1),c.off("resize close",a),m()},r={};return r.callback=o.callback,r.folders=o.options.folders,r.multi=o.options.multiple,r.open=i.commandMap.open,r.hasVar=!0,o.callback=function(t){var o,a;return"directory"===t.mime?void i.one("open",function(){i.commandMap.open="getfile"}).getCommand("open").exec(t.hash):(o=i.convAbsUrl(t.url),a=t.name+" ("+i.formatSize(t.size)+")","file"==n.filetype&&e(o,{text:a,title:a}),"image"==n.filetype&&e(o,{alt:a}),"media"==n.filetype&&e(o),void c.trigger("togleminimize"))},o.options.folders=!0,o.options.multiple=!1,i.commandMap.open="getfile",p(),c.trigger("togleminimize").one("resize close",a),i.toast({mode:"info",msg:i.i18n("dblclickToSelect")}),!1},images_upload_handler:function(e,n,o){var a=e.blob(),r=function(e){var t=e.data.dialog||{};(t.hasClass("elfinder-dialog-error")||t.hasClass("elfinder-confirm-upload"))&&(p(),t.trigger("togleminimize").one("resize close",s),i.unbind("dialogopened",r))},s=function(){c.off("resize close",s),m()},d=!0;a.name&&(d=void 0),i.bind("dialogopened",r).exec("upload",Object.assign({files:[a],clipdata:d},t.confObj.uploadOpts),void 0,i.cwd().hash).done(function(e){e.added&&e.added.length?i.url(e.added[0].hash,{async:!0}).done(function(e){m(),n(i.convAbsUrl(e))}).fail(function(){o(i.i18n("errFileNotFound"))}):o(i.i18n(e.error?e.error:"errUpload"))}).fail(function(e){var t=i.parseError(e);t&&("errUnknownCmd"===t?t="errPerm":"userabort"===t&&(t="errAbort")),o(i.i18n(t?t:"errUploadNoFiles"))})}},u>=5&&(o.height="100%"),t.trigger("Prepare",{node:e,editorObj:tinymce,instance:void 0,opts:o}),tinymce.init(Object.assign(o,t.confObj.mceOpts))};return t.confObj.loader||(t.confObj.loader=$.Deferred(),t.fm.loadScript([i.options.cdns.tinymce+(i.options.cdns.tinymce.match(/\.js/)?"":"/tinymce.min.js")],function(){t.confObj.loader.resolve()},{loadType:"tag"})),t.confObj.loader.done(o),n},close:function(e,t){t&&tinymce.execCommand("mceRemoveEditor",!1,e.id)},save:function(e,t){t&&t.save()},focus:function(e,t){t&&t.focus()},resize:function(e,t,i,n){t&&e._setHeight()}},{info:{id:"zohoeditor",name:"Zoho Editor",iconImg:"img/editor-icons.png 0 -32",cmdCheck:"ZohoOffice",preventGet:!0,hideButtons:!0,syncInterval:15e3,canMakeEmpty:!0,integrate:{title:"Zoho Office API",link:"https://www.zoho.com/officeapi/"}},mimes:["application/msword","application/vnd.openxmlformats-officedocument.wordprocessingml.document","application/vnd.oasis.opendocument.text","application/rtf","text/html","application/vnd.ms-excel","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet","application/vnd.oasis.opendocument.spreadsheet","application/vnd.sun.xml.calc","text/csv","text/tab-separated-values","application/vnd.ms-powerpoint","application/vnd.openxmlformats-officedocument.presentationml.presentation","application/vnd.openxmlformats-officedocument.presentationml.slideshow","application/vnd.oasis.opendocument.presentation","application/vnd.sun.xml.impress"],html:'<iframe style="width:100%;max-height:100%;border:none;"></iframe>',setup:function(e,t){(t.UA.Mobile||t.UA.ltIE8)&&(this.disabled=!0)},prepare:function(e,t,i){var n=e.editor.fm.getUI();$(e).height(n.height()),t.width=Math.max(t.width||0,.8*n.width())},init:function(e,t,i,n){var o=this,a=$(this).hide(),r=n.getUI("toast"),s=$('<div class="elfinder-edit-spinner elfinder-edit-zohoeditor"/>').html('<span class="elfinder-spinner-text">'+n.i18n("nowLoading")+'</span><span class="elfinder-spinner"/>').appendTo(a.parent()),c=function(){var e="";return $.each(n.customData,function(t,i){e+="&"+encodeURIComponent(t)+"="+encodeURIComponent(i)}),e};$(o).data("xhr",n.request({data:{cmd:"editor",name:o.editor.confObj.info.cmdCheck,method:"init","args[target]":t.hash,"args[lang]":n.lang,"args[cdata]":c()},preventDefault:!0}).done(function(e){var t;e.zohourl?(t={css:{height:"100%"}},o.editor.trigger("Prepare",{node:o,editorObj:void 0,instance:a,opts:t}),a.attr("src",e.zohourl).show().css(t.css),e.warning&&(r.appendTo(o.closest(".ui-dialog")),n.toast({msg:n.i18n(e.warning),mode:"warning",timeOut:0,onHidden:function(){1===r.children().length&&r.appendTo(n.getUI())},button:{text:"btnYes"}}))):(e.error&&n.error(e.error),o.elfinderdialog("destroy"))}).fail(function(e){e&&n.error(e),o.elfinderdialog("destroy")}).always(function(){s.remove()}))},load:function(){},getContent:function(){},save:function(){},beforeclose:u,close:function(e){var t=(this.fm,$(e).data("xhr"));"pending"===t.state()&&t.reject()}},{info:{id:"ziparchive",name:"btnMount",iconImg:"img/toolbar.png 0 -416",cmdCheck:"ZipArchive",edit:function(e,t){var i=this,n=$.Deferred();return i.request({data:{cmd:"netmount",protocol:"ziparchive",host:e.hash,path:e.phash},notify:{type:"netmount",cnt:1,hideCnt:!0}}).done(function(e){var t;e.added&&e.added.length&&(e.added[0].phash&&(t=i.file(e.added[0].phash))&&(t.dirs||(t.dirs=1,i.change({changed:[t]}))),i.one("netmountdone",function(){i.exec("open",e.added[0].hash),i.one("opendone",function(){e.toast&&i.toast(e.toast)})})),n.resolve()}).fail(function(e){n.reject(e)}),n}},mimes:["application/zip"],load:function(){},save:function(){}},{info:{id:"textarea",name:"TextArea",useTextAreaEvent:!0},load:function(e){this.trigger("Prepare",{node:e,editorObj:void 0,instance:void 0,opts:{}}),e.setSelectionRange&&e.setSelectionRange(0,0),$(e).trigger("focus").show()},save:function(){}},{info:{id:"onlineconvert",name:"Online Convert",iconImg:"img/editor-icons.png 0 -144",cmdCheck:"OnlineConvert",preventGet:!0,hideButtons:!0,single:!0,converter:!0,canMakeEmpty:!1,integrate:{title:"ONLINE-CONVERT.COM",link:"https://online-convert.com"}},mimes:["*"],html:'<div style="width:100%;max-height:100%;"></div>',setup:function(e,t){var i=e.extraOptions.onlineConvert||{maxSize:100,showLink:!0};i.maxSize&&(this.info.maxSize=1048576*i.maxSize),this.set=Object.assign({url:"https://%s.online-convert.com%s?external_url=",conv:{Archive:{"7Z":{},BZ2:{ext:"bz"},GZ:{},ZIP:{}},Audio:{MP3:{},OGG:{ext:"oga"},WAV:{},WMA:{},AAC:{},AIFF:{ext:"aif"},FLAC:{},M4A:{},MMF:{},OPUS:{ext:"oga"}},Document:{DOC:{},DOCX:{},HTML:{},ODT:{},PDF:{},PPT:{},PPTX:{},RTF:{},SWF:{},TXT:{}},eBook:{AZW3:{ext:"azw"},ePub:{},FB2:{ext:"xml"},LIT:{},LRF:{},MOBI:{},PDB:{},PDF:{},"PDF-eBook":{ext:"pdf"},TCR:{}},Hash:{Adler32:{},"Apache-htpasswd":{},Blowfish:{},CRC32:{},CRC32B:{},Gost:{},Haval128:{},MD4:{},MD5:{},RIPEMD128:{},RIPEMD160:{},SHA1:{},SHA256:{},SHA384:{},SHA512:{},Snefru:{},"Std-DES":{},Tiger128:{},"Tiger128-calculator":{},"Tiger128-converter":{},Tiger160:{},Tiger192:{},Whirlpool:{}},Image:{BMP:{},EPS:{ext:"ai"},GIF:{},EXR:{},ICO:{},JPG:{},PNG:{},SVG:{},TGA:{},TIFF:{ext:"tif"},WBMP:{},WebP:{}},Video:{"3G2":{},"3GP":{},AVI:{},FLV:{},HLS:{ext:"m3u8"},MKV:{},MOV:{},MP4:{},"MPEG-1":{ext:"mpeg"},"MPEG-2":{ext:"mpeg"},OGG:{ext:"ogv"},OGV:{},WebM:{},WMV:{},Android:{link:"/convert-video-for-%s",ext:"mp4"},Blackberry:{link:"/convert-video-for-%s",ext:"mp4"},DPG:{link:"/convert-video-for-%s",ext:"avi"},iPad:{link:"/convert-video-for-%s",ext:"mp4"},iPhone:{link:"/convert-video-for-%s",ext:"mp4"},iPod:{link:"/convert-video-for-%s",ext:"mp4"},"Nintendo-3DS":{link:"/convert-video-for-%s",ext:"avi"},"Nintendo-DS":{link:"/convert-video-for-%s",ext:"avi"},PS3:{link:"/convert-video-for-%s",ext:"mp4"},Wii:{link:"/convert-video-for-%s",ext:"avi"},Xbox:{link:"/convert-video-for-%s",ext:"wmv"}}},catExts:{Hash:"txt"},link:'<div class="elfinder-edit-onlineconvert-link"><a href="https://www.online-convert.com" target="_blank"><span class="elfinder-button-icon"></span>ONLINE-CONVERT.COM</a></div>',useTabs:!(!$.fn.tabs||t.UA.iOS)},i)},prepare:function(e,t,i){var n=e.editor.fm.getUI();$(e).height(n.height()),t.width=Math.max(t.width||0,.8*n.width())},init:function(e,t,i,n){var o,r,s=this,c=s.editor.confObj,d=c.set,l=n.getUI("toast"),p={},m=n.uploadMimeCheck("application/zip",t.phash),u=$("base").length?document.location.href.replace(/#.*$/,""):"",f=function(e,t){var i;return d.catExts[e]?d.catExts[e]:d.conv[e]&&(i=d.conv[e][t])?(i.ext||t).toLowerCase():t.toLowerCase()},g=function(e,t){var i,o,a;o="undefined"==typeof c.api?n.request({data:{cmd:"editor",name:"OnlineConvert",method:"init"},preventDefault:!0}):$.Deferred().resolve({api:c.api}),e=e.toLowerCase(),o.done(function(n){c.api=n.api,c.api&&(e?i="?category="+e:(i="",e="all"),c.conversions||(c.conversions={}),a=c.conversions[e]?$.Deferred().resolve(c.conversions[e]):$.getJSON("https://api2.online-convert.com/conversions"+i),a.done(function(i){c.conversions[e]=i,$.each(i,function(e,t){h[d.useTabs?"children":"find"](".onlineconvert-category-"+t.category).children(".onlineconvert-"+t.target).trigger("makeoption",t)}),t&&t()}))})},h=function(){var e=$("<div/>").on("click","button",function(){var e=$(this),t=e.data("opts")||null,i=e.closest(".onlineconvert-category").data("cname"),n=e.data("conv");c.api===!0&&w({category:i,convert:n,options:t})}).on("change",function(e){var t=$(e.target),i=t.parent(),o=t.closest(".elfinder-edit-onlineconvert-button").children("button:first"),a=o.data("opts")||{},r="boolean"===i.data("type")?t.is(":checked"):t.val();if(e.stopPropagation(),r&&("integer"===i.data("type")&&(r=parseInt(r)),i.data("pattern"))){var s=new RegExp(i.data("pattern"));s.test(r)||(requestAnimationFrame(function(){n.error('"'+n.escape(r)+'" is not match to "/'+n.escape(i.data("pattern"))+'/"')}),r=null)}r?a[t.parent().data("optkey")]=r:delete a[i.data("optkey")],o.data("opts",a)}),i=$("<ul/>"),o=function(e,t){var i,o,a,r=$("<p/>").data("optkey",e).data("type",t.type),s="",c="",d=!1;return t.description&&r.attr("title",n.i18n(t.description)),t.pattern&&r.data("pattern",t.pattern),r.append($("<span/>").text(n.i18n(e)+" : ")),"boolean"===t.type?((t["default"]||(d="allow_multiple_outputs"===e&&!m))&&(s=" checked",d&&(c=" disabled"),o=this.children("button:first"),i=o.data("opts")||{},i[e]=!0,o.data("opts",i)),r.append($('<input type="checkbox" value="true"'+s+c+"/>"))):t["enum"]?(a=$("<select/>").append($('<option value=""/>').text("Select...")),$.each(t["enum"],function(e,t){a.append($('<option value="'+t+'"/>').text(t))}),r.append(a)):r.append($('<input type="text" value=""/>')),r},r=function(e){var t=this,i=$('<span class="elfinder-button-icon elfinder-button-icon-preference"/>').on("click",function(){n.toggle()}),n=$('<div class="elfinder-edit-onlinconvert-options"/>').hide();e.options&&$.each(e.options,function(e,i){"download_password"!==e&&n.append(o.call(t,e,i))}),t.append(i,n)},s=+new Date,l=0;return c.ext2mime||(c.ext2mime=Object.assign(n.arrayFlip(n.mimeTypes),a)),$.each(d.conv,function(o,a){var d=o.toLowerCase(),m="elfinder-edit-onlineconvert-"+d+s,g=$('<div id="'+m+'" class="onlineconvert-category onlineconvert-category-'+d+'"/>').data("cname",o);$.each(a,function(e,i){var a=e.toLowerCase(),s=f(o,e);c.ext2mime[s]||("audio"===d||"image"===d||"video"===d?c.ext2mime[s]=d+"/x-"+a:c.ext2mime[s]="application/octet-stream"),n.uploadMimeCheck(c.ext2mime[s],t.phash)&&g.append($('<div class="elfinder-edit-onlineconvert-button onlineconvert-'+a+'"/>').on("makeoption",function(e,t){var i=$(this);i.children(".elfinder-button-icon-preference").length||r.call(i,t)}).append($("<button/>").text(e).data("conv",e)))}),g.children().length&&(i.append($("<li/>").append($("<a/>").attr("href",u+"#"+m).text(o))),e.append(g),p[d]=l++)}),d.useTabs?e.prepend(i).tabs({beforeActivate:function(e,t){g(t.newPanel.data("cname"))}}):$.each(d.conv,function(t){var i=t.toLowerCase();e.append($('<fieldset class="onlineconvert-fieldset-'+i+'"/>').append($("<legend/>").text(t)).append(e.children(".onlineconvert-category-"+i)))}),e}(),v=$(this).append(h,d.showLink?$(d.link):null),x=$('<div class="elfinder-edit-spinner elfinder-edit-onlineconvert"/>').hide().html('<span class="elfinder-spinner-text">'+n.i18n("nowLoading")+'</span><span class="elfinder-spinner"/>').appendTo(v.parent()),b=null,y=function(){return b?$.Deferred().resolve(b):(x.show(),n.forExternalUrl(t.hash).done(function(e){b=e}).fail(function(e){e&&n.error(e),s.elfinderdialog("destroy")}).always(function(){x.hide()}))},w=function(e){$(s).data("dfrd",y().done(function(i){v.fadeOut(),O({info:"Start conversion request."}),n.request({data:{cmd:"editor",name:"OnlineConvert",method:"api","args[category]":e.category.toLowerCase(),"args[convert]":e.convert.toLowerCase(),"args[options]":JSON.stringify(e.options),"args[source]":n.convAbsUrl(i),"args[filename]":n.splitFileExtention(t.name)[0]+"."+f(e.category,e.convert),"args[mime]":t.mime},preventDefault:!0}).done(function(t){k(t.apires,e.category,e.convert)}).fail(function(e){e&&n.error(e),s.elfinderdialog("destroy")})}))},k=function(e,t,i){var o,a=[];e&&e.id?(o=e.status,"failed"===o.code?(x.hide(),e.errors&&e.errors.length&&$.each(e.errors,function(e,t){t.message&&a.push(t.message)}),n.error(a.length?a:o.info),v.fadeIn()):"completed"===o.code?C(e):(O(o),setTimeout(function(){j(e.id)},1e3))):(l.appendTo(s.closest(".ui-dialog")),e.message&&n.toast({msg:n.i18n(e.message),mode:"error",timeOut:5e3,onHidden:function(){1===l.children().length&&l.appendTo(n.getUI())}}),n.toast({msg:n.i18n("editorConvNoApi"),mode:"error",timeOut:3e3,onHidden:function(){1===l.children().length&&l.appendTo(n.getUI())}}),x.hide(),v.show())},O=function(e){x.show().children(".elfinder-spinner-text").text(e.info)},j=function(e){n.request({data:{cmd:"editor",name:"OnlineConvert",method:"api","args[jobid]":e},preventDefault:!0}).done(function(e){k(e.apires)}).fail(function(e){e&&n.error(e),s.elfinderdialog("destroy")})},C=function(e){var i=e.output,o=(e.id,"");x.hide(),i&&i.length&&(s.elfinderdialog("destroy"),$.each(i,function(e,t){t.uri&&(o+=t.uri+"\n")}),n.upload({target:t.phash,files:[o],type:"text",extraData:{contentSaveId:"OnlineConvert-"+e.id}}))},T="document";v.parent().css({overflow:"auto"}).addClass("overflow-scrolling-touch"),(r=t.mime.match(/^(audio|image|video)/))&&(T=r[1]),d.useTabs?p[T]&&h.tabs("option","active",p[T]):(o=Object.keys(d.conv).length,$.each(d.conv,function(e){return e.toLowerCase()===T?(g(e,function(){$.each(d.conv,function(e){e.toLowerCase()!==T&&g(e)})}),!1):void o--}),o||$.each(d.conv,function(e){g(e)}),v.parent().scrollTop(h.children(".onlineconvert-fieldset-"+T).offset().top))},load:function(){},getContent:function(){},save:function(){},close:function(e){var t=(this.fm,$(e).data("dfrd"));t&&"pending"===t.state()&&t.reject()}}]},window.elFinder);