jodit-pro 1.3.29 → 1.3.31

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- ((e,t)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var s=t();for(var i in s)("object"==typeof exports?exports:e)[i]=s[i]}})(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[524],{73377(e,t,s){"use strict";s.r(t),s.d(t,{finder(){return ee}});var i=s(43464),n=s(70655),o=s(33993),a=s(21601),r=s(67101),l=s(34839);o.JO.set("heart",a+""),o.JO.set("home",r+""),o.JO.set("new-folder",l+"");var h=s(47611),c=s(70728),d=s(98422),u=s(93991),g=s(16892);let m=class e extends o.u1{constructor(e,t){super(e),this.item=u.Z.create(t),e.e.on(this.container,"click contextmenu dblclick",(t=>(e.e.fire(t.type+"Item.filebrowser",this.item,(0,g.ctrlKey)(t)||t.shiftKey,t),!1)))}className(){return"UIBrowserItem"}render(){return"<div tabindex='-1'>\n\t\t\t<div class='&__image'></div>\n\t\t\t<div class='&__info'></div>\n\t\t\t<div class='&__heart'>*heart*</div>\n\t\t</div>"}onClickFavorite(){return this.bubble((e=>{this.jodit.e.fire(e,"toggleFavoriteItem",this.item)})),!1}onAction(e){return this.jodit.e.fire(e.type+"Item.filebrowser",this.item,(0,g.ctrlKey)(e)||e.shiftKey,e),!1}update(){const e=this.getElm("image");(0,g.assert)(null!=e,"image element does not exists"),(0,g.css)(e,"backgroundImage",`url(${encodeURI(this.item.imageURL)})`);const{type:t,file:s,time:i,size:n}=this.item;this.setMod("is-file",!1===this.item.isImage).setMod("type",null!=t?t:"file").setElementValue("name",s).setElementValue("time",i).setElementValue("filesize",n),(0,g.attr)(this.container,"title","folder"!==t?`${s} ${i} ${n}`:s),super.update()}setElementValue(e,t){const s=this.getFullElName(e);let i=this.getElm(e);if(!t)return i&&h.Dom.safeRemove(i),this;if(!i){const e=this.getElm("info");(0,g.assert)(null!=e,"wrapper element does not exist"),i=this.j.create.div(s),e.appendChild(i)}return i.innerText=t,this}};(0,n.gn)([(0,d.watch)("heart:click")],m.prototype,"onClickFavorite",null),(0,n.gn)([(0,d.watch)(["container:click","container:contextmenu","container:dblclick"])],m.prototype,"onAction",null),m=(0,n.gn)([d.component],m);var p,f=s(12815),v=s(21714);let w=p=class e extends o.qe{constructor(e,t){super(e),this.stateManager=t,this.syncMod=!0,this.addItemsSelector()}className(){return"UIVirtualScroll"}render(){return"<div>\n\t\t\t\t<div class=\"&__empty-message\">~There are no files~</div>\n\t\t\t\t<div class='&__loader'></div>\n\t\t\t\t<div class='&__drag-area'>~Drop image~</div>\n\t\t\t</div>"}reconcile(e){const t=this.elements.findIndex(((t,s)=>!e[s]||t.item.uniqueHashKey!==u.Z.create(e[s]).uniqueHashKey));if(t>-1){for(let e=t;this.elements.length>e;e+=1)this.elements[e].destruct();this.elements.length=t}return t}build(e){const t=this.reconcile(e);e.slice(t>-1?t:this.elements.length).forEach((e=>{const t=new m(this.jodit,e);Object.keys(this.mods).forEach((e=>{t.setMod(e,this.mods[e])})),this.append(t)})),this.setMod("empty",!this.elements.length)}onScrollLoadChunk(){!this.stateManager.isFavoriteItems&&this.j.o.pixelOffsetLoadNewChunk>this.container.scrollHeight-(this.container.scrollTop+this.container.offsetHeight)&&this.j.loadingManager.loadItemsChunk()}onDragOver(e){e.preventDefault(),this.setMod("dragover",!0)}onDragLeave(e){e.preventDefault(),this.setMod("dragover",!1)}addItemsSelector(){(class e{static remove(e){f.i.safeRemove(e.container.querySelector(".jodit-ui-select-items")),e.j.e.off(e.container,"mousedown.uiselectitems touchstart.uiselectitems")}static install(e){const t=e.j.c.div("jodit-ui-select-items");e.j.e.on(e.container,"mousedown.uiselectitems touchstart.uiselectitems",this.onStartSelect.bind(this,e,t))}static onStartSelect(e,t,s){if(s.target!==e.container)return;(0,v.i)(t,{width:0,height:0}),e.container.appendChild(t);const i={x:s.clientX,y:s.clientY,w:e.container.offsetWidth,h:e.container.offsetHeight},n=e.j.async.throttle(this.onSelect.bind(this,e,t,i),e.j.defaultTimeout/10);e.j.lock(),e.j.e.on(e.j.ow,"mousemove touchmove",n).one(e.j.ow,"mouseup touchend",this.onEndSelect.bind(this,e,t,n)),e.onSelectItems({left:i.x,top:i.y,width:0,height:0})}static onSelect(e,t,s,i){const n={left:s.x>i.clientX?i.clientX:s.x,top:s.y>i.clientY?i.clientY:s.y,width:Math.abs(s.x-i.clientX),height:Math.abs(s.y-i.clientY)};(0,v.i)(t,n),e.onSelectItems(n)}static onEndSelect(e,t,s,i){f.i.safeRemove(t),e.j.e.off(e.j.ow,"mousemove touchmove",s),e.j.unlock()}}).install(this)}static intersectRect(e,t){return!(t.left>e.left+e.width||e.left>t.left+t.width||t.top>e.top+e.height||e.top>t.top+t.height)}onSelectItems(e){const t=[];this.elements.forEach((s=>{const i=(0,g.position)(s.container);p.intersectRect(i,e)&&t.push(s.item)})),this.stateManager.state.activeElements=t}};(0,n.gn)([(0,d.watch)(":afterResize"),(0,d.watch)(":resize"),(0,d.watch)("container:scroll"),(0,d.throttle)()],w.prototype,"onScrollLoadChunk",null),(0,n.gn)([(0,d.watch)("container:dragover")],w.prototype,"onDragOver",null),(0,n.gn)([(0,d.watch)(["container:dragleave","container:drop"])],w.prototype,"onDragLeave",null),w=p=(0,n.gn)([d.component],w);let y=class e extends o.u1{className(){return"UIBrowserMessage"}constructor(e,t){super(e),this.container.innerText=(0,g.isString)(t)?t:t.message}};y=(0,n.gn)([d.component],y);let b=class e extends o.qe{className(){return"UIBrowserMessages"}build(e){this.clear(),e.forEach((e=>{const t=new y(this.jodit,e.message);t.setMod("type",e.type),this.append(t)}))}};b=(0,n.gn)([d.component],b);class C{static remove(e){(0,v.i)(e.container,{width:null,height:null}),e.container.classList.remove("jodit-ui-resize"),f.i.safeRemove(e.container.querySelector(".jodit-ui-resize__handle"))}static install(e,t){e.container.classList.add("jodit-ui-resize"),"static"===(0,v.i)(e.container,"position")&&(0,v.i)(e.container,"position","relative");const s=e.j.c.div("jodit-ui-resize__handle");s.classList.add("jodit-ui-resize__handle_type_"+t),e.container.appendChild(s),e.j.e.on(s,"mousedown touchstart",this.onStartResize.bind(this,e,t))}static onStartResize(e,t,s){const i=e.j.async.throttle(this.onResize.bind(this,e,{x:s.clientX,y:s.clientY,w:e.container.offsetWidth,h:e.container.offsetHeight,direction:t}),e.j.defaultTimeout/10);e.j.lock(),e.j.e.on(e.j.ow,"mousemove touchmove",i).one(e.j.ow,"mouseup touchend",this.onEndResize.bind(this,e,i))}static onResize(e,t,s){const i=["left","right"].includes(t.direction),n=e.container.parentElement;if(!n)return;let o;o=i?(t.w+(s.clientX-t.x)*("right"===t.direction?1:-1))/n.offsetWidth:(t.h+(s.clientY-t.y)*("top"===t.direction?1:-1))/n.offsetHeight,(0,v.i)(e.container,i?"width":"height",100*o+"%")}static onEndResize(e,t,s){e.j.e.off(e.j.ow,"mousemove touchmove",t),e.j.unlock()}}let S=class e extends o.qe{constructor(e,t,s){super(e,t),this.state=s,this.onChangeFavorites()}className(){return"UISidebar"}render(){return"<div>\n\t\t\t<div class='&__hide-btn'>*angle-left*</div>\n\t\t\t<div class='&__favorites'>*heart* ~Favorites~</div>\n\t\t\t<div class='&__box'></div>\n\t\t</div>"}appendChildToContainer(e){const t=this.getElm("box");(0,g.assert)(null!=t,"box element does not exists"),t.appendChild(e)}addResize(){C.remove(this),C.install(this,screen.width>450?"right":"bottom")}onChangeFavorites(){this.setMod("has-favorites",!!this.state.favorites.length)}onClickHideButton(){return this.state.showSideBar=!this.state.showSideBar,!1}onClickFavorites(){return this.state.elements=this.state.favorites,!1}};(0,n.gn)([(0,d.hook)("ready"),(0,d.watch)(":resize",window),(0,d.debounce)()],S.prototype,"addResize",null),(0,n.gn)([(0,d.watch)("state.favorites")],S.prototype,"onChangeFavorites",null),(0,n.gn)([(0,d.watch)("hide-btn:click")],S.prototype,"onClickHideButton",null),(0,n.gn)([(0,d.watch)("favorites:click")],S.prototype,"onClickFavorites",null),S=(0,n.gn)([d.component],S);let x=class e extends o.qe{constructor(e,t){super(e),this.state=t;const s=this.getElm("close");(0,g.assert)(null!=s,"close element does not exists"),e.e.on(s,"click",(()=>{this.state.showSettings=!1}))}className(){return"UIBrowserSettings"}render(){return`<div>\n\t\t\t<div class="${this.getFullElName("close")}">${o.JO.get("cancel")}</div>\n\t\t\t<div class="${this.getFullElName("title")}">${this.j.i18n("Settings")}</div>\n\t\t\t<div class="${this.getFullElName("options")}"></div>\n\t\t</div>`}appendChildToContainer(e){const t=this.getElm("options");(0,g.assert)(null!=t,"options element does not exists"),t.appendChild(e)}afterSetMod(e,t){"hidden"===e&&!1===t&&this.generateSettings(),super.afterSetMod(e,t)}onChangeView(){const e=this.getElm("tile-size");e&&(e.style.display="tiles"===this.state.view?"block":"none")}generateSettings(){this.clear();const{j:e}=this;this.append([new o.BO(e,{label:"Theme",name:"theme",value:this.state.theme,radio:!0,options:[{value:"default",text:"Light"},{value:"dark",text:"Dark"}],onChange:e=>{this.state.theme="default"===this.state.theme||"dark"===this.state.theme?e[0].value:"default"}}),new o.BO(e,{label:"Show favorites",name:"showFavorites",value:this.state.showFavorites,radio:!0,options:[{value:!0,text:"Show"},{value:!1,text:"Hide"}],onChange:e=>{this.state.showFavorites=e[0].value}}),new o.BO(e,{label:"View",name:"view",value:this.state.view,radio:!0,options:[{value:"tiles",text:"Tiles"},{value:"list",text:"List"},{value:"compact",text:"Compact"}],onChange:e=>{this.state.view=e[0].value}}),new o.BO(e,{label:"Folders position",name:"foldersPosition",value:this.state.foldersPosition,radio:!0,options:[{value:"top",text:"Top"},{value:"bottom",text:"Bottom"},{value:"default",text:"Default"}],onChange:e=>{this.state.foldersPosition=e[0].value}}),new o.Cj(e,{label:"Sort by",name:"sort-by",value:this.state.sortBy,options:[{value:"changed-asc",text:e.i18n("Sort by changed")+"(⬆)"},{value:"changed-desc",text:e.i18n("Sort by changed")+"(⬇)"},{value:"name-asc",text:e.i18n("Sort by name")+"(⬆)"},{value:"name-desc",text:e.i18n("Sort by name")+"(⬇)"},{value:"size-asc",text:e.i18n("Sort by size")+"(⬆)"},{value:"size-desc",text:e.i18n("Sort by size")+"(⬇)"}],onChange:e=>{this.state.sortBy=e}}),new o.Cj(e,{label:"Tile size",name:"tile-size",value:this.state.tileSize,options:[{value:"xsmall",text:"Extra small"},{value:"small",text:"Small"},{value:"default",text:"Default"},{value:"large",text:"Large"},{value:"xlarge",text:"Extra large"}],onChange:e=>{this.state.tileSize=e}})]),this.onChangeView()}};(0,n.gn)([(0,d.watch)("state.view")],x.prototype,"onChangeView",null),x=(0,n.gn)([d.component],x);let I=class e extends o.u1{constructor(e,t){super(e),this.item=t,this.syncMod=!0;const s=this.getElm("name");(0,g.assert)(null!=s,"name element does not exists"),s.innerText=t.name,e.e.on(this.container,"click",(()=>(this.getMod("active")||this.setMod("loading",!0),e.e.fire("openFolder",t)))).on(this.container,"contextmenu",(s=>e.e.fire("contextmenuFolder.filebrowser",t,s)))}className(){return"UIBrowserFolder"}render(){return'<div>\n\t\t\t<div class="&__icon">\n\t\t\t\t<div class=\'&__loader\'></div>\n\t\t\t\t<div class="&__icon-wrapper">\n\t\t\t\t\t*folder*\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="&__name"></div>\n\t\t\t<div class="&__arrow">*angle-right*</div>\n\t\t</div>'}};var M;I=(0,n.gn)([d.component],I);let P=M=class e extends o.qe{constructor(e,t){super(e),this.syncMod=!0,this.build(t)}className(){return"UITree"}build(e){this.clear(),e.forEach((e=>{const t=new I(this.jodit,e);this.append(t),e.isActive&&t.setMod("active",!0),e.children.length&&this.append(new M(this.jodit,e.children))}))}};P=M=(0,n.gn)([d.component],P);let j=class e extends o.u1{constructor(e,t){super(e,t),this.data=t,this.tree=new P(this.j,this.data.children),this.syncMod=!0;const s=this.getElm("name");(0,g.assert)(null!=s,"name element does not exists"),s.innerText=t.title||t.name;const i=this.getElm("tree");(0,g.assert)(null!=i,"tree element does not exists"),i.appendChild(this.tree.container),e.e.on(this.container,"contextmenu",(s=>e.e.fire("contextmenuSource.filebrowser",t,s)))}className(){return"UIBrowserSource"}render(){return'<div>\n\t\t\t<div class="&__name"></div>\n\t\t\t<div class="&__tree"></div>\n\t\t</div>'}};j=(0,n.gn)([d.component],j);let F=class e extends o.qe{constructor(){super(...arguments),this.syncMod=!0}className(){return"UIBrowserSources"}build(e){this.clear(),e.forEach((e=>{this.append(new j(this.jodit,e))}))}};F=(0,n.gn)([d.component],F);let _=class e extends o.u1{className(){return"UIBrowserStatusBar"}render(){return"<div>\n\t\t\t<div class='&__slot-left'></div>\n\t\t\t<div class='&__slot-center'></div>\n\t\t\t<div class='&__slot-right'></div>\n\t\t</div>"}value(e,t="left"){const s=this.getElm("slot-"+t);return(0,g.assert)(null!=s,"Slot does not exists"),s.innerText=e,this}};_=(0,n.gn)([d.component],_);var E=s(96582);let k=class e extends o.qe{constructor(e,t){super(e),this.state=t,this.lastLoadPromise=null,this.onChangeMetaInfo()}className(){return"UIPreview"}addResize(){C.remove(this),C.install(this,screen.width>450?"left":"top")}render(){return'<div>\n\t\t\t\t<div class="&__image"></div>\n\t\t\t\t<div class="&__info"></div>\n\t\t\t\t<div class="&__loader"></div>\n\t\t\t\t<div class="&__empty-message">~Select image~</div>\n\t\t\t</div>'}afterSetMod(e,t){"hidden"===e&&!1===t&&this.onChangeMetaInfo(),super.afterSetMod(e,t)}onChangeMetaInfo(){var e,t;if(this.getMod("hidden"))return;const{metaInfo:s}=this.state;this.setMod("empty",!s);const i=this.getElm("info");(0,g.assert)(null!=i,"info element does not exists"),E.i.detach(i);const n=this.getElm("image");(0,g.assert)(null!=n,"image element does not exists"),(0,g.css)(n,{backgroundImage:null}),s&&(this.setMod("is-file",!1===s.isImage).setMod("type",null!==(e=s.type)&&void 0!==e?e:"file"),m.prototype.setElementValue.call(this,"name",s.file),m.prototype.setElementValue.call(this,"time",s.time),m.prototype.setElementValue.call(this,"filesize",s.size),this.setMod("loading",!0),null===(t=this.lastLoadPromise)||void 0===t||t.rejectCallback(),this.lastLoadPromise=(0,g.loadImage)(s.isImage?s.fileURL:s.imageURL,this.j),this.lastLoadPromise.then((e=>{const t=this.getElm("image");(0,g.assert)(null!=t,"image element does not exist"),e&&(0,g.css)(t,{backgroundImage:`url(${e.src})`})})).finally((()=>{this.setMod("loading",!1)})).catch((()=>{})))}};(0,n.gn)([(0,d.hook)("ready"),(0,d.watch)(":resize",window),(0,d.debounce)()],k.prototype,"addResize",null),(0,n.gn)([(0,d.watch)("state.metaInfo")],k.prototype,"onChangeMetaInfo",null),k=(0,n.gn)([d.component],k);let L=class e extends o.qe{constructor(e,t){super(e),this.stateManager=t,this.syncMod=!0,this.sources=new F(this.j),this.sidebar=new S(this.jodit,[this.sources],this.stateManager.state),this.preview=new k(this.jodit,this.stateManager.state),this.statusbar=new _(this.j),this.items=new w(this.j,this.stateManager),this.settings=new x(this.jodit,this.stateManager.state),this.messages=new b(this.j),this.state=t.state,this.append(this.sidebar,"content"),this.append(this.items,"content"),this.append(this.messages,"footer"),this.append(this.settings,"content"),this.append(this.preview,"content"),this.append(this.statusbar,"footer"),this.onChangeElements(),this.onChangeSources(),this.onChangeView(),this.onChangeTileSize(),this.onChangeShowFavorites(),this.onChangeMessages(),this.onChangeActiveElements(),this.onChangeFavorites(),this.onChangeShowSideBar(),this.onChangeShowSettings(),this.onChangeShowPreview(),this.onChangeTheme()}className(){return"UIBrowserPanel"}get countInRow(){if("list"===this.state.view)return 1;const{container:e}=this.items.elements[0],t=(0,g.css)(e,"marginLeft");return Math.floor(this.items.container.offsetWidth/(e.offsetWidth+((0,g.isNumber)(t)?t:0)))}get countInColumn(){const{container:e}=this.items.elements[0],t=(0,g.css)(e,"marginTop");return Math.floor(this.items.container.offsetHeight/(e.offsetHeight+((0,g.isNumber)(t)?t:0)))}render(){return"<div>\n\t\t\t<div class='&__content'></div>\n\t\t\t<div class='&__footer'></div>\n\t\t</div>"}onChangeTheme(){this.setMod("theme",this.stateManager.state.theme)}onChangeElements(){this.items.build(this.stateManager.state.elements)}onChangeActiveElements(){this.state.activeElements.length||(this.state.info="",this.state.metaInfo=null),this.items.elements.forEach((e=>{e.setMod("active",!!this.stateManager.isActive(e.item))})),this.j.e.fire("changeSelection")}onChangeFavorites(){this.items.elements.forEach((e=>{e.setMod("favorite",!!this.stateManager.isFavorite(e.item))}))}onChangeSources(){this.sources.build(this.stateManager.state.tree)}onChangeLastSelectedIndex(){var e;const t=null===(e=this.items.elements[this.stateManager.state.lastSelectedIndex])||void 0===e?void 0:e.container;t&&((0,g.scrollIntoViewIfNeeded)(t,this.items.container,this.j.od),t.focus())}onChangeInfo(){this.statusbar.value(this.state.info,"center")}onChangePathOrSource(){this.statusbar.value(this.state.currentPath?`${this.state.currentPath} (${this.state.currentSource})`:this.i18n("Home"),"left")}onChangeShowSettings(){this.settings.setMod("hidden",!this.stateManager.state.showSettings)}onChangeShowPreview(){this.preview.setMod("hidden",!this.stateManager.state.showPreview)}onChangeShowSideBar(){this.sidebar.setMod("hidden",!this.stateManager.state.showSideBar)}onChangeView(){this.items.setMod("view",this.stateManager.state.view)}onChangeTileSize(){this.items.setMod("size",this.stateManager.state.tileSize)}onChangeShowFavorites(){this.sidebar.setMod("show-favorites",this.stateManager.state.showFavorites),this.items.setMod("show-favorites",this.stateManager.state.showFavorites)}onChangeMessages(){this.messages.build(this.stateManager.state.messages)}onItemDblClick(){return this.j.e.fire("select.filebrowser"),!1}onItemClick(e,t){this.stateManager.addActive(e,t)}onTogglePreview(){return this.state.showPreview=!this.state.showPreview,!1}onToggleFavoriteItem(e){this.stateManager.toggleFavorite(e)}onFolderClick(e){this.stateManager.state.currentSource=e.sourceName,this.stateManager.state.currentPath=e.path||"/",this.j.e.fire("afterOpenFolder.filebrowser")}};(0,n.gn)([(0,d.watch)("state.theme")],L.prototype,"onChangeTheme",null),(0,n.gn)([(0,d.watch)("state.elements")],L.prototype,"onChangeElements",null),(0,n.gn)([(0,d.watch)("state.activeElements")],L.prototype,"onChangeActiveElements",null),(0,n.gn)([(0,d.watch)(["state.favorites","state.elements"])],L.prototype,"onChangeFavorites",null),(0,n.gn)([(0,d.watch)("state.sources")],L.prototype,"onChangeSources",null),(0,n.gn)([(0,d.watch)("state.lastSelectedIndex")],L.prototype,"onChangeLastSelectedIndex",null),(0,n.gn)([(0,d.watch)("state.info")],L.prototype,"onChangeInfo",null),(0,n.gn)([(0,d.watch)(["state.currentPath","state.currentSource"])],L.prototype,"onChangePathOrSource",null),(0,n.gn)([(0,d.watch)("state.showSettings")],L.prototype,"onChangeShowSettings",null),(0,n.gn)([(0,d.watch)("state.showPreview")],L.prototype,"onChangeShowPreview",null),(0,n.gn)([(0,d.watch)("state.showSideBar")],L.prototype,"onChangeShowSideBar",null),(0,n.gn)([(0,d.watch)("state.view")],L.prototype,"onChangeView",null),(0,n.gn)([(0,d.watch)("state.tileSize")],L.prototype,"onChangeTileSize",null),(0,n.gn)([(0,d.watch)("state.showFavorites")],L.prototype,"onChangeShowFavorites",null),(0,n.gn)([(0,d.watch)("state.messages")],L.prototype,"onChangeMessages",null),(0,n.gn)([(0,d.watch)(":dblclickItem.filebrowser")],L.prototype,"onItemDblClick",null),(0,n.gn)([(0,d.watch)(":clickItem.filebrowser")],L.prototype,"onItemClick",null),(0,n.gn)([(0,d.watch)(":togglePreview.filebrowser")],L.prototype,"onTogglePreview",null),(0,n.gn)([(0,d.watch)(":toggleFavoriteItem")],L.prototype,"onToggleFavoriteItem",null),(0,n.gn)([(0,d.watch)(":openFolder")],L.prototype,"onFolderClick",null),L=(0,n.gn)([d.component],L);var R=s(49940);class B{constructor(e){this.state=e}getIndex(e,t=this.state.elements){return t.findIndex((t=>t.uniqueHashKey===e.uniqueHashKey))}isActive(e){return!!this.state.activeElements.find((t=>t.uniqueHashKey===e.uniqueHashKey))}isFavorite(e){return!!this.state.favorites.find((t=>t.uniqueHashKey===e.uniqueHashKey))}addActive(e,t){var s;this.state.metaInfo=e,this.state.info=null!==(s=e.file)&&void 0!==s?s:"",this.state.lastSelectedIndex=this.getIndex(e),this.state.activeElements=t?[...this.state.activeElements,e]:[e]}callSelectHandler(){var e;const t=this.state.activeElements;null===(e=this.state.onSelectCallBack)||void 0===e||e.call(this,{baseurl:"",files:t.map((e=>e.fileURL)),isImages:t.map((e=>!!e.isImage))})}setFilter(e){this.state.filterWord=e}addMessage(e){var t;const s=this.state.messages;(null===(t=s[s.length-1])||void 0===t?void 0:t.message)!==e.message&&(this.state.messages=[...s,e])}removeMessage(e){const t=this.state.messages.indexOf(e);if(-1!==t){const e=[...this.state.messages];e.splice(t,1),this.state.messages=e}}toggleFavorite(e){const t=this.getIndex(e,this.state.favorites),s=[...this.state.favorites];-1===t?s.push(e):s.splice(t,1),this.state.favorites=s}fillSources(e,t){const s=e=>e.filter((e=>"."!==e&&".."!==e));if(this.state.tree.length&&t){const i=(e,t)=>{var s;return null!==(s=e.find((e=>e.name===t)))&&void 0!==s?s:null};this.removeActive(this.state.tree),e.forEach((e=>{const n=i(this.state.tree,e.name);if(n){n.isActive=!0;const o=t.split("/").reduce(((e,t)=>e&&i(e.children,t)),n);o&&(o.isActive=!0,o.children=s(e.folders).map((s=>({type:"directory",name:s,path:t+"/"+s,sourceName:e.name,children:[]}))))}}))}else this.state.tree=e.map((e=>({type:"source",name:e.name,title:e.title,sourceName:e.name,path:"/",children:s(e.folders).map((t=>({type:"directory",name:t,path:t,sourceName:e.name,children:[]})))})))}removeActive(e){e.forEach((e=>{e.isActive=!1,this.removeActive(e.children)}))}get isFavoriteItems(){return this.state.favorites===this.state.elements}}(0,n.gn)([d.autobind],B.prototype,"getIndex",null),(0,n.gn)([d.autobind],B.prototype,"isActive",null),(0,n.gn)([d.autobind],B.prototype,"isFavorite",null);var z=s(75901);let N=class e extends o.qe{constructor(e,t,s){var i;super(e),this.options=t,this.stateManager=s,this.syncMod=!0,this.toolbar=(0,z.R)(this.j),this.filter=new o.u3(this.j,{icon:"search",placeholder:"Filter",clearButton:!0,onChange:e=>{this.stateManager.setFilter(e)}}),this.append(this.toolbar).append(this.filter),this.filter.container.classList.add(this.getFullElName("filter")),this.toolbar.setMod("mode","header").build(null!==(i=this.options.toolbarButtons)&&void 0!==i?i:[])}className(){return"UIBrowserHeader"}};N=(0,n.gn)([d.component],N);var T=s(98842),H=s(733);let O=class e extends o.ko{constructor(e,t){super(e),this.state=t,this.onProgress()}className(){return"UIProgress"}onProgress(){this.state.progress?this.show():this.hide(),this.progress(this.state.progress)}hide(){return this.setMod("hidden",!0),this}progress(e){return this.container.style.width=e.toFixed(2)+"%",98>e||this.j.async.setTimeout((()=>{this.hide()}),{label:"progress",timeout:300}),this}show(){return this.setMod("hidden",!1),this}};(0,n.gn)([(0,d.watch)("state.progress")],O.prototype,"onProgress",null),O=(0,n.gn)([d.component],O);var D=s(74738),U=s(50072),K=s(65927);let A=class e extends K.Hr{constructor(e,t){super(e),this.state=t,this.sortBy="changed-desc",this.view="tiles",this.foldersPosition="top",this.tileSize="default",this.favorites=[],this.showSideBar=!0,this.showPreview=!1,this.showFavorites=!0}className(){return"PersistentStore"}onChangeThemeSetField(){this.theme=this.state.theme}onChangeView(){this.view=this.state.view}onChangeSortBy(){this.sortBy=this.state.sortBy}onChangeTileSize(){this.tileSize=this.state.tileSize}onChangeFavorites(){this.favorites=this.state.favorites}onChangeShowSideBar(){this.showSideBar=this.state.showSideBar}onChangeShowPreview(){this.showPreview=this.state.showPreview}onChangeShowFavorites(){this.showFavorites=this.state.showFavorites}onChangeFoldersPosition(){this.foldersPosition=this.state.foldersPosition}syncWithState(){this.state.tileSize=this.tileSize,this.state.favorites=this.favorites.map((e=>e instanceof u.Z?e:u.Z.create(e))),this.state.view=this.view,this.state.theme=this.theme,this.state.showSideBar=this.showSideBar,this.state.showPreview=this.showPreview,this.state.showFavorites=this.showFavorites,this.state.sortBy=this.sortBy,this.state.foldersPosition=this.foldersPosition}};(0,n.gn)([d.persistent],A.prototype,"theme",void 0),(0,n.gn)([d.persistent],A.prototype,"sortBy",void 0),(0,n.gn)([d.persistent],A.prototype,"view",void 0),(0,n.gn)([d.persistent],A.prototype,"foldersPosition",void 0),(0,n.gn)([d.persistent],A.prototype,"tileSize",void 0),(0,n.gn)([d.persistent],A.prototype,"favorites",void 0),(0,n.gn)([d.persistent],A.prototype,"showSideBar",void 0),(0,n.gn)([d.persistent],A.prototype,"showPreview",void 0),(0,n.gn)([d.persistent],A.prototype,"showFavorites",void 0),(0,n.gn)([(0,d.watch)("state.theme")],A.prototype,"onChangeThemeSetField",null),(0,n.gn)([(0,d.watch)("state.view")],A.prototype,"onChangeView",null),(0,n.gn)([(0,d.watch)("state.sortBy")],A.prototype,"onChangeSortBy",null),(0,n.gn)([(0,d.watch)("state.tileSize")],A.prototype,"onChangeTileSize",null),(0,n.gn)([(0,d.watch)("state.favorites")],A.prototype,"onChangeFavorites",null),(0,n.gn)([(0,d.watch)("state.showSideBar")],A.prototype,"onChangeShowSideBar",null),(0,n.gn)([(0,d.watch)("state.showPreview")],A.prototype,"onChangeShowPreview",null),(0,n.gn)([(0,d.watch)("state.showFavorites")],A.prototype,"onChangeShowFavorites",null),(0,n.gn)([(0,d.watch)("state.foldersPosition")],A.prototype,"onChangeFoldersPosition",null),A=(0,n.gn)([d.component],A);let V=class e extends K.Hr{constructor(e,t){super(e),this.state=t,this.history=[],this.historyIndex=0}className(){return"HistoryManager"}canNext(){return this.history.length-1>this.historyIndex}canPrevious(){return this.historyIndex>0}push(e){let{historyIndex:t}=this;const s=this.history[t];if(s&&s.currentSource===e.currentSource&&s.currentPath===e.currentPath)return;let i=[...this.history];i.length-1!==t&&(i=i.slice(0,t+1)),i.push(e),s&&(t+=1),this.history=i,this.historyIndex=t}next(){this.canNext()&&(this.historyIndex+=1,this.updateState())}previous(){this.canPrevious()&&(this.historyIndex-=1,this.updateState())}updateCurrent(){this.history[this.historyIndex]={currentSource:this.state.currentSource,currentPath:this.state.currentPath,tree:(0,g.fastClone)(this.state.tree),elements:[...this.state.elements]}}onHome(){this.state.currentPath="",this.state.currentSource="",this.j.e.fire("afterOpenFolder.filebrowser update.filebrowser")}onOpenFolder(){this.push({tree:[],elements:[],currentPath:this.state.currentPath,currentSource:this.state.currentSource}),this.j.e.fire("changeSelection")}updateState(){const{tree:e,elements:t,currentSource:s,currentPath:i}=this.history[this.historyIndex];this.state.activeElements=[],this.state.elements=[...t],this.state.tree=[...e],this.state.currentSource=s,this.state.currentPath=i,this.j.e.fire("changeSelection")}};(0,n.gn)([(0,d.watch)(["state.elements","state.tree"])],V.prototype,"updateCurrent",null),(0,n.gn)([(0,d.watch)(":goHome.filebrowser")],V.prototype,"onHome",null),(0,n.gn)([(0,d.watch)(":afterOpenFolder.filebrowser")],V.prototype,"onOpenFolder",null),V=(0,n.gn)([d.component],V);let q=class e extends K.Hr{className(){return"ContextMenuManager"}onFolderContext(e,t){return this.buildContextItemMenu(this.getFolderContextActions(e),t),!1}onItemContext(e,t,s){return this.buildContextItemMenu(this.getItemContextActions(e),s),!1}onSourceContext(e,t){return this.buildContextItemMenu(this.getSourceContextActions(e),t),!1}buildContextItemMenu(e,t){if(!this.j.o.contextMenu)return;const s=(0,D.L)(this.j).setMod("theme",this.j.state.theme);s.show(t.clientX,t.clientY,e.filter((e=>e&&!1!==e.enabled))),this.j.e.on(this.j,"afterClose",(()=>{s.isOpened&&s.close()}))}getItemContextActions(e){if(this.j.stateManager.isActive(e)||this.j.stateManager.addActive(e,this.j.state.activeElements.length>1),"folder"===e.type)return this.getFolderContextActions({type:"directory",children:[],name:e.name||"",path:e.path,sourceName:e.sourceName});const t=this.j.options,s=this.j.dataProvider,i=1===this.j.state.activeElements.length;return[{icon:"pencil",title:"Edit",enabled:!!e.isImage&&t.editImage&&i&&(s.canI("ImageResize")||s.canI("ImageCrop")),exec:()=>{this.j.e.fire("edit.filebrowser")}},{icon:"italic",title:"Rename",enabled:s.canI("FileRename")&&i,exec:()=>this.j.e.fire("fileRename.filebrowser",e)},{icon:"bin",title:"Delete",enabled:s.canI("FileRemove"),exec:()=>this.j.e.fire("fileRemove.filebrowser",e)},{icon:"eye",title:"Preview",enabled:!(!e.isImage&&"file"!==e.type)&&t.preview&&i,exec:()=>this.j.e.fire("openLightBox.filebrowser",e)},{icon:"upload",title:"Download",exec:()=>{e.fileURL&&this.j.ow.open(e.fileURL)}}]}getFolderContextActions(e){const t=this.j.dataProvider;return[{icon:"pencil",title:"Rename",exec:()=>{this.j.e.fire("folderRename.filebrowser",e)},enabled:t.canI("FolderRename")},{icon:"bin",title:"Delete",exec:()=>{this.j.e.fire("folderRemove.filebrowser",e)},enabled:t.canI("FolderRemove")},{icon:"plus",title:"Add folder",exec:()=>{this.j.e.fire("folderCreate.filebrowser",e)},enabled:t.canI("FolderCreate")}]}getSourceContextActions(e){return[{icon:"plus",title:"Create folder",exec:()=>{this.j.e.fire("folderCreate.filebrowser",e)}}]}};(0,n.gn)([(0,d.watch)(":contextmenuFolder.filebrowser")],q.prototype,"onFolderContext",null),(0,n.gn)([(0,d.watch)(":contextmenuItem.filebrowser")],q.prototype,"onItemContext",null),(0,n.gn)([(0,d.watch)(":contextmenuSource.filebrowser")],q.prototype,"onSourceContext",null),q=(0,n.gn)([d.component],q);const W=e=>{const t=e.split("/").filter((e=>e.length));return t.pop(),t.join("/")||"/"};var Y,G=s(62195),$=s(85475);let J=Y=class e extends h.UIElement{constructor(e,t,s){super(e),this.current=t,this.elements=s,this.dialog=new h.Dialog;const{dialog:i}=this;i.setMod("theme",e.state.theme).toolbar.setMod("mode","header"),i.open(this),this.elements=this.elements.filter((e=>e.isImage)),i.e.on(i,"afterClose",(()=>{this.destruct()})),this.addGlobalListeners(),this.onChangeCurrent(),i.toolbar.build([{icon:"check",exec:()=>{e.stateManager.addActive(this.current,!1),e.e.fire("select.filebrowser"),i.close()}},"dialog.close"])}className(){return"UILightBox"}render(){return"<div>\n\t\t\t<div class='&__previous'>*angle-left*</div>\n\t\t\t<div class='&__preview'></div>\n\t\t\t<div class='&__loader'></div>\n\t\t\t<div class='&__next'>*angle-right*</div>\n\t\t</div>"}async onChangeCurrent(){const{current:e}=this;this.setMod("loading",!0);const t=this.getElm("preview");if((0,g.assert)(null!=t,"preview element does not exist"),h.Dom.detach(t),(0,g.css)(t,{backgroundImage:null}),e.isImage){const s=await(0,g.loadImage)(e.fileURL,this.j);this.dialog.setPosition(),(0,g.css)(t,{width:Math.min(this.jodit.ow.innerWidth,s.naturalWidth),height:Math.min(this.jodit.ow.innerHeight-100,s.naturalHeight),backgroundImage:`url(${s.src})`})}else{const s=await this.makeIframe(e.fileURL);t.appendChild(s)}this.dialog.setSize(),this.dialog.setPosition(),this.setMod("loading",!1)}makeIframe(e){const t=this.j.c.element("iframe");return t.classList.add(this.getFullElName("office-iframe")),t.src=/\.pdf/.test(e)?e:this.j.o.previewOfficeURL+encodeURIComponent(e),t}onPreviousClick(){const{current:e}=this;let t=this.j.stateManager.getIndex(e,this.elements);t>0?t-=1:t=this.elements.length-1,this.current=this.elements[t]}onNextClick(){const{current:e}=this;let t=this.j.stateManager.getIndex(e,this.elements);this.elements.length-1>t?t+=1:t=0,this.current=this.elements[t]}static open(e,t,s){return new Y(e,t,s)}addGlobalListeners(){this.j.e.on(this.j.od,"keydown",this.onKeyPress)}onKeyPress(e){if(e.key===R.KEY_LEFT||e.key===R.KEY_RIGHT||e.key===R.KEY_SPACE)return e.key===R.KEY_LEFT?this.onPreviousClick():this.onNextClick(),!1}removeGlobalListeners(){this.j.e.off(this.j.od,"keydown",this.onKeyPress)}destruct(){return this.removeGlobalListeners(),this.dialog.destruct(),super.destruct()}};(0,n.gn)([(0,d.watch)("current")],J.prototype,"onChangeCurrent",null),(0,n.gn)([(0,d.watch)("previous:click")],J.prototype,"onPreviousClick",null),(0,n.gn)([(0,d.watch)("next:click")],J.prototype,"onNextClick",null),(0,n.gn)([d.autobind],J.prototype,"onKeyPress",null),J=Y=(0,n.gn)([d.component],J);let X=class e extends K.Hr{constructor(e,t){super(e),this.state=t,this.offset=0,this.countInOneChunk=20,this.stopLoadingParts=!1,this.__isLoadingPart=!1,this.__callQueueCount=0}className(){return"LoadingManager"}async onUpdateFileBrowser(){this.j.state.activeElements=[],this.j.panel.setMod("loading",!0),await Promise.all([this.loadFolders(),this.loadItems()]),this.j.panel.setMod("loading",!1)}async loadFolders(){if(!this.j.isOpened)return;const{currentPath:e,currentSource:t}=this.j.state;try{const s=await this.j.dataProvider.tree(e,t);this.j.stateManager.fillSources(s,e),this.j.state.sources=s}catch(e){this.j.status(e)}}async loadItems(){if(this.j.isOpened)try{for(this.offset=0,this.stopLoadingParts=!1,this.__callQueueCount=0,this.j.state.elements=await this.loadPartItems(),this.stopLoadingParts=this.countInOneChunk>this.j.state.elements.length;!this.stopLoadingParts&&this.j.panel.countInColumn*this.j.panel.countInRow>=this.j.state.elements.length;)await this.loadItemsChunk()}catch(e){this.j.status(e)}}async __loadItemsChunk(){if(this.__isLoadingPart)this.__callQueueCount+=1;else{if(!this.stopLoadingParts){this.__isLoadingPart=!0,this.j.panel.items.setMod("chunk-loading",!0);try{this.offset+=this.countInOneChunk;const e=await this.loadPartItems();this.stopLoadingParts=this.countInOneChunk>e.length,e.length&&(this.j.state.elements=this.j.state.elements.concat(e))}catch(e){this.j.status(e)}return this.j.panel.items.setMod("chunk-loading",!1),this.__isLoadingPart=!1,this.__callQueueCount>0?(this.__callQueueCount-=1,this.__loadItemsChunk()):void 0}this.__callQueueCount=0}}loadItemsChunk(){return this.__loadItemsChunk()}loadPartItems(){const{currentPath:e,currentSource:t,sortBy:s,withFolders:i,foldersPosition:n,onlyImages:o,filterWord:a}=this.j.state;return this.j.dataProvider.items(e,t,{offset:this.offset,limit:this.countInOneChunk,sortBy:s,withFolders:i,foldersPosition:n,onlyImages:o,filterWord:a})}};(0,n.gn)([(0,d.watch)(":update.filebrowser")],X.prototype,"onUpdateFileBrowser",null),(0,n.gn)([(0,d.watch)(["state.currentPath","state.currentSource"]),(0,d.debounce)((e=>({timeout:e.defaultTimeout,promisify:!0})))],X.prototype,"loadFolders",null),(0,n.gn)([(0,d.watch)(["state.currentPath","state.currentSource","state.sortBy","state.onlyImages","state.foldersPosition","state.filterWord"]),(0,d.debounce)((e=>({timeout:e.defaultTimeout,promisify:!0})))],X.prototype,"loadItems",null),(0,n.gn)([(0,d.debounce)((e=>({timeout:e.defaultTimeout,promisify:!0})))],X.prototype,"loadItemsChunk",null),X=(0,n.gn)([d.component],X);let Z=class e extends c.Vq{constructor(e){super((0,g.ConfigProto)(Object.assign(e||{},{resizable:!0,draggable:!0,toolbarButtons:(null==e?void 0:e.toolbarButtons)||H.D.defaultOptions.filebrowser.buttons,buttons:G.Jodit.atom(["filebrowser.settings","fullsize","dialog.close"])}),H.D.defaultOptions.filebrowser)),this.dataProvider=(0,D.S)(this,this.options),this.state=(0,h.observable)({onSelectCallBack:null,theme:"default",showSideBar:!0,showFavorites:!0,showSettings:!1,showPreview:!1,withFolders:!0,foldersPosition:"bottom",info:"",metaInfo:null,currentPath:"",currentSource:"",currentBaseUrl:"",tree:[],activeElements:[],favorites:[],progress:0,lastSelectedIndex:0,elements:[],messages:[],sources:[],view:"tiles",tileSize:"default",sortBy:"name-asc",filterWord:"",onlyImages:!1}),this.persistent=new A(this,this.state),this.loadingManager=new X(this,this.state),this.stateManager=new B(this.state),this.historyManager=new V(this,this.state),this.contextMenuManager=new q(this),this.header=new N(this,this.options,this.stateManager),this.panel=new L(this,this.stateManager),this.files=this.panel,this.tree=this.panel,this.progressbar=new O(this,this.stateManager.state),$.V.make(this),!this.persistent.theme&&this.options.theme&&(this.persistent.theme=this.options.theme),this.panel.append(this.progressbar),this.toolbar.setMod("mode","header"),this.setSize(Math.min(this.options.width,screen.width),Math.min(this.options.height,screen.height)).setHeader(this.header),this.onResizeWindow(),this.initUploader(),this.onChangeTheme(),this.fullFillOptions(),this.dataProvider.onProgress((e=>{0===e&&(e=30),this.state.progress=e})),this.e.on("beforeClose",this.removeGlobalListeners),this.e.fire("afterInit"),G.Jodit.prototype.afterInitHook.call(this)}className(){return"FileBrowserPro"}lock(e="any"){return this.container.classList.add("jodit_disabled"),super.lock(e)}unlock(){return this.container.classList.remove("jodit_disabled"),super.unlock()}status(e,t=!(e instanceof Error)){if((0,g.isAbort)(e))return;const s={message:(0,g.isString)(e)?e:e.message,type:t?"success":"error"};this.stateManager.addMessage(s),this.async.setTimeout((()=>{this.stateManager.removeMessage(s)}),this.options.howLongShowMsg)}addDisclaimer(e){this.dialog.appendChild(e)}async open(e=this.o.defaultCallback,t){return this.state.onlyImages=!!t,this.prepareOpening(e),super.open(this.panel.container),this.e.fire("update.filebrowser")}onResizeWindow(){(0,g.css)(this.dialog,{maxWidth:screen.width,minHeight:Math.min(this.options.height,screen.height),minWidth:Math.min(this.options.width,screen.width)})}onChangePath(){const{currentPath:e,currentSource:t}=this.state;this.uploader.setPath(e),this.uploader.setSource(t)}onChangeTheme(){this.setMod("theme",this.state.theme),this.header.setMod("theme",this.state.theme),this.panel.setMod("theme",this.state.theme),this.options.theme=this.state.theme}onToggleSettings(){this.state.showSettings=!this.state.showSettings}prepareOpening(e){this.registerGlobalListeners(),e&&(this.state.onSelectCallBack=t=>{this.close(),e(t)}),this.persistent.syncWithState()}registerGlobalListeners(){this.e.on(this.ow,"keydown",this.onKeyPress)}onKeyPress(e){const{activeElement:t}=this.od;if(!this.state.activeElements.length||!t||!h.Dom.isOrContains(this.panel.items.container,t))return;const s=this.state.elements;switch(e.key){case R.KEY_ENTER:return this.onChooseItems();case R.KEY_DELETE:return this.onFileRemove();case R.KEY_RIGHT:case R.KEY_LEFT:case R.KEY_DOWN:case R.KEY_UP:{const t=e.key===R.KEY_RIGHT||e.key===R.KEY_DOWN,i=this.state.lastSelectedIndex;let n;if([R.KEY_RIGHT,R.KEY_LEFT].includes(e.key))n=t?s[i+1]?i+1:0:s[i-1]?i-1:s.length-1;else{const{countInRow:e}=this.panel;n=Math.round(((i+1)/e+(t?1:-1))*e-1)}return s[n]&&this.stateManager.addActive(s[n],e.shiftKey),!1}}}removeGlobalListeners(){this.e.off(this.ow,"keydown",this.onKeyPress)}onFileRemove(){this.state.activeElements.length&&this.confirm("Are you sure?","",(e=>{if(e){const e=[];this.state.activeElements.forEach((t=>{this.stateManager.isFavorite(t)&&this.stateManager.toggleFavorite(t),e.push(this.deleteFile(t.file||t.name||"",t.sourceName))})),this.state.activeElements=[],Promise.all(e).then((()=>{this.loadingManager.loadItems()}))}})).bindDestruct(this)}onFileEdit(){if(1===this.state.activeElements.length){const[e]=this.state.activeElements;T.r.call(this,e.fileURL,e.file||"",e.path,e.sourceName,void 0,this.status)}}onFolderRename(e){this.prompt("Enter new name","Rename",(t=>{if(!(0,g.isValidName)(t)||t===e.name)return this.status(this.i18n("Enter new name")),!1;this.dataProvider.folderRename(W(e.path),e.name,t,e.sourceName).then((s=>{this.state.activeElements=[],this.status(s,!0),this.state.currentPath=W(e.path)+"/"+t,this.state.currentSource=e.sourceName,this.historyManager.updateCurrent(),this.loadingManager.loadFolders()})).catch(this.status)}),this.i18n("type name"),e.name).bindDestruct(this)}onFolderRemove(e){this.confirm("Are you sure?","Delete",(t=>{t&&this.dataProvider.folderRemove(W(e.path),e.name,e.sourceName).then((t=>{this.status(t,!0),this.state.currentPath=W(e.path),this.state.currentSource=e.sourceName,this.loadingManager.loadFolders()})).catch(this.status)})).bindDestruct(this)}onFolderCreate(e){this.prompt("Enter Directory name","Create directory",(t=>{const s=e.path||"/";this.dataProvider.createFolder(t,e.path||"/",e.sourceName).then((()=>{this.state.currentSource===e.sourceName&&this.state.currentPath===s?this.e.fire("update.filebrowser"):(this.state.currentSource=e.sourceName,this.state.currentPath=s),this.historyManager.updateCurrent()}),this.status)}),this.i18n("type name")).bindDestruct(this)}onFileRename(e){const t=e.file||e.name||"";1===this.state.activeElements.length&&t&&this.prompt("Enter new name","Rename",(e=>{if(!(0,g.isValidName)(e))return this.status(this.i18n("Enter new name")),!1;this.dataProvider.fileRename(this.state.currentPath,t,e,this.state.currentSource).then((e=>{this.state.activeElements=[],this.status(e,!0),this.loadingManager.loadItems()})).catch(this.status)}),this.i18n("type name"),t).bindDestruct(this)}onChooseItems(){const e=this.stateManager.state.activeElements;if(e.length){if("folder"===e[0].type)return this.state.currentPath=this.state.currentPath+"/"+e[0].name,this.state.currentSource=e[0].sourceName,void this.e.fire("afterOpenFolder.filebrowser");this.state.onSelectCallBack?this.stateManager.callSelectHandler():this.onOpenLightBox(e[0])}}onOpenLightBox(e){J.open(this,e,this.state.elements)}deleteFile(e,t){return this.dataProvider.fileRemove(this.state.currentPath,e,t).then((t=>{this.status(t||this.i18n('File "%s" was deleted',e),!0)})).catch(this.status)}initUploader(){const e=this,t=(0,g.ConfigProto)(e.o.uploader||{},H.D.defaultOptions.uploader),s=()=>this.loadingManager.loadItems();e.uploader=e.getInstance("Uploader",t),e.uploader.bind(e.panel.container,s,e.status),e.e.on("bindUploader.filebrowser",(t=>{e.uploader.bind(t,s,e.status)}))}destruct(){this.removeGlobalListeners(),this.header.destruct(),this.panel.destruct(),super.destruct()}fullFillOptions(){["getLocalFileByUrl","crop","resize","create","fileMove","folderMove","fileRename","folderRename","fileRemove","folderRemove","folder","items","permissions"].forEach((e=>{null!=this.options[e]&&(this.options[e]=(0,g.ConfigProto)(this.options[e],this.o.ajax))}))}};(0,n.gn)([d.autobind],Z.prototype,"status",null),(0,n.gn)([(0,d.watch)(":resize",window)],Z.prototype,"onResizeWindow",null),(0,n.gn)([(0,d.watch)(["state.currentPath","state.currentSource"])],Z.prototype,"onChangePath",null),(0,n.gn)([(0,d.watch)("state.theme")],Z.prototype,"onChangeTheme",null),(0,n.gn)([(0,d.watch)(":toggleSettings.filebrowser")],Z.prototype,"onToggleSettings",null),(0,n.gn)([d.autobind],Z.prototype,"onKeyPress",null),(0,n.gn)([d.autobind],Z.prototype,"removeGlobalListeners",null),(0,n.gn)([(0,d.watch)(":fileRemove.filebrowser")],Z.prototype,"onFileRemove",null),(0,n.gn)([(0,d.watch)(":edit.filebrowser")],Z.prototype,"onFileEdit",null),(0,n.gn)([(0,d.watch)(":folderRename.filebrowser")],Z.prototype,"onFolderRename",null),(0,n.gn)([(0,d.watch)(":folderRemove.filebrowser")],Z.prototype,"onFolderRemove",null),(0,n.gn)([(0,d.watch)(":folderCreate.filebrowser")],Z.prototype,"onFolderCreate",null),(0,n.gn)([(0,d.watch)(":fileRename.filebrowser")],Z.prototype,"onFileRename",null),(0,n.gn)([(0,d.watch)(":select.filebrowser")],Z.prototype,"onChooseItems",null),(0,n.gn)([(0,d.watch)(":openLightBox.filebrowser")],Z.prototype,"onOpenLightBox",null),Z=(0,n.gn)([d.component,(0,d.derive)(U.lf)],Z),Object.defineProperty(G.Jodit.modules,"FileBrowserPro",{value:Z,writable:!1,enumerable:!0,configurable:!0}),(0,s(58706).xl)(s(91190));const Q=H.D.prototype.controls.filebrowser;Q.settings={icon:"settings",tooltip:"Settings",exec(e){var t;(null!==(t=e.parent)&&void 0!==t?t:e).e.fire("toggleSettings.filebrowser")}},Q.home={icon:"home",tooltip:"Home",exec(e){e.e.fire("goHome.filebrowser")}},Q.preview={icon:"eye",tooltip:"Preview",isDisabled:e=>0===e.state.activeElements.length,exec(e){e.e.fire("togglePreview.filebrowser")}},Q.next={icon:"angle-right",tooltip:"History next",isDisabled(e){return!e.historyManager.canNext()},exec(e){e.historyManager.next()}},Q.previous={icon:"angle-left",tooltip:"History previous",isDisabled(e){return!e.historyManager.canPrevious()},exec(e){e.historyManager.previous()}},Q["new-folder"]={icon:"new-folder",exec(e){e.e.fire("folderCreate.filebrowser",{path:e.state.currentPath,sourceName:e.state.currentSource})},tooltip:"New folder"},Object.assign(H.D.prototype.filebrowser,{buttons:["filebrowser.home","filebrowser.previous","filebrowser.next","|","filebrowser.upload","filebrowser.new-folder","filebrowser.remove","filebrowser.update","filebrowser.select","filebrowser.edit","|","filebrowser.preview","about"],sort:!1,pixelOffsetLoadNewChunk:200,width:780,height:400,previewOfficeURL:"https://view.officeapps.live.com/op/view.aspx?src="});class ee extends i.S{constructor(){super(...arguments),this.requires=["license"],this.hasStyle=!G.Jodit.fatMode}afterInit(e){e.e.on("getInstanceFileBrowser",(e=>(this.__instance||(this.__instance=new Z(e)),this.__instance)))}beforeDestruct(e){var t;e.e.off("getInstanceFileBrowser"),null===(t=this.__instance)||void 0===t||t.destruct()}}G.Jodit.plugins.add("finder",ee)},91190(e,t,s){"use strict";s.r(t),s.d(t,{ru(){return i}});const i=s(99425)},70655(e,t,s){"use strict";function i(e,t,s,i){var n,o=arguments.length,a=3>o?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var r=e.length-1;r>=0;r--)(n=e[r])&&(a=(3>o?n(a):o>3?n(t,s,a):n(t,s))||a);return o>3&&a&&Object.defineProperty(t,s,a),a}s.d(t,{gn(){return i}})},99425(e){e.exports={Favorites:"Избранное",Settings:"Настройки",Light:"Светлая",Dark:"Темная",Theme:"Тема",Show:"Показать",Hide:"Скрыть","Show favorites":"Показывать избранное",Tiles:"Плитка",List:"Список",Compact:"Компактный",View:"Отображение","Folders position":"Позиция папок","Sort by":"Сортировать по","Extra small":"Очень маленькие",Small:"Маленькие",Large:"Большие","Extra large":"Очень большие","Tile size":"Размер плитки"}},21601(e){e.exports='<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"> <path d="M365.4,59.628c60.56,0,109.6,49.03,109.6,109.47c0,109.47-109.6,171.8-219.06,281.271 C146.47,340.898,37,278.568,37,169.099c0-60.44,49.04-109.47,109.47-109.47c54.73,0,82.1,27.37,109.47,82.1 C283.3,86.999,310.67,59.628,365.4,59.628z"/> </svg>'},67101(e){e.exports='<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"> <path d="M28.7,16.3l-12-13c-0.4-0.4-1.1-0.4-1.5,0l-12,13C3,16.6,2.9,17,3.1,17.4C3.2,17.8,3.6,18,4,18h3v10c0,0.6,0.4,1,1,1h16 c0.6,0,1-0.4,1-1V18h3c0.4,0,0.8-0.2,0.9-0.6C29.1,17,29,16.6,28.7,16.3z"/> </svg>'},34839(e){e.exports='<svg viewBox="0 0 252 252" xmlns="http://www.w3.org/2000/svg"> <path d="M0 16C0 7.16344 7.16344 0 16 0H85.6364C86.5205 0 87.3797 0.29288 88.0796 0.832871L120.92 26.1671C121.62 26.7071 122.48 27 123.364 27H227C235.837 27 243 34.1634 243 43V132.335C243 134.779 240.234 136.198 238.25 134.772L233 131L226.5 127L220 124L212.5 122L202.5 120L189 120.5L179.5 122.5L170.5 125.5L161.5 130.5L157 133.5L153 137L146.5 144L141 152L137 160L134 168L132.5 178L132 183.5V189.5L133 197.5L135 205.5L137.5 211.5L139.524 214.996C141.068 217.663 139.144 221 136.062 221H16C7.16344 221 0 213.837 0 205V16Z"/> <circle cx="197" cy="185" r="56"/> <path d="M188.364 215.955V151.591H204.636V215.955H188.364ZM164.318 191.909V175.636H228.682V191.909H164.318Z" fill="white"/> </svg>'}},e=>e(e.s=73377)])}));
1
+ ((e,t)=>{if("object"==typeof exports&&"object"==typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var s=t();for(var i in s)("object"==typeof exports?exports:e)[i]=s[i]}})(self,(function(){return(self.webpackChunkjodit_pro=self.webpackChunkjodit_pro||[]).push([[524],{73377(e,t,s){"use strict";s.r(t),s.d(t,{finder(){return ee}});var i=s(43464),n=s(70655),o=s(33993),a=s(21601),r=s(67101),l=s(34839);o.JO.set("heart",a+""),o.JO.set("home",r+""),o.JO.set("new-folder",l+"");var h=s(47611),c=s(70728),d=s(98422),u=s(93991),g=s(16892);let m=class e extends o.u1{className(){return"UIBrowserItem"}constructor(e,t){super(e),this.item=u.Z.create(t),e.e.on(this.container,"click contextmenu dblclick",(t=>(e.e.fire(t.type+"Item.filebrowser",this.item,(0,g.ctrlKey)(t)||t.shiftKey,t),!1)))}render(){return"<div tabindex='-1'>\n\t\t\t<div class='&__image'></div>\n\t\t\t<div class='&__info'></div>\n\t\t\t<div class='&__heart'>*heart*</div>\n\t\t</div>"}onClickFavorite(){return this.bubble((e=>{this.jodit.e.fire(e,"toggleFavoriteItem",this.item)})),!1}onAction(e){return this.jodit.e.fire(e.type+"Item.filebrowser",this.item,(0,g.ctrlKey)(e)||e.shiftKey,e),!1}update(){const e=this.getElm("image");(0,g.assert)(null!=e,"image element does not exists"),(0,g.css)(e,"backgroundImage",`url(${encodeURI(this.item.imageURL)})`);const{type:t,file:s,time:i,size:n}=this.item;this.setMod("is-file",!1===this.item.isImage).setMod("type",null!=t?t:"file").setElementValue("name",s).setElementValue("time",i).setElementValue("filesize",n),(0,g.attr)(this.container,"title","folder"!==t?`${s} ${i} ${n}`:s),super.update()}setElementValue(e,t){const s=this.getFullElName(e);let i=this.getElm(e);if(!t)return i&&h.Dom.safeRemove(i),this;if(!i){const e=this.getElm("info");(0,g.assert)(null!=e,"wrapper element does not exist"),i=this.j.create.div(s),e.appendChild(i)}return i.innerText=t,this}};(0,n.gn)([(0,d.watch)("heart:click")],m.prototype,"onClickFavorite",null),(0,n.gn)([(0,d.watch)(["container:click","container:contextmenu","container:dblclick"])],m.prototype,"onAction",null),m=(0,n.gn)([d.component],m);var p,f=s(12815),v=s(21714);let w=p=class e extends o.qe{className(){return"UIVirtualScroll"}render(){return"<div>\n\t\t\t\t<div class=\"&__empty-message\">~There are no files~</div>\n\t\t\t\t<div class='&__loader'></div>\n\t\t\t\t<div class='&__drag-area'>~Drop image~</div>\n\t\t\t</div>"}constructor(e,t){super(e),this.stateManager=t,this.syncMod=!0,this.addItemsSelector()}reconcile(e){const t=this.elements.findIndex(((t,s)=>!e[s]||t.item.uniqueHashKey!==u.Z.create(e[s]).uniqueHashKey));if(t>-1){for(let e=t;this.elements.length>e;e+=1)this.elements[e].destruct();this.elements.length=t}return t}build(e){const t=this.reconcile(e);e.slice(t>-1?t:this.elements.length).forEach((e=>{const t=new m(this.jodit,e);Object.keys(this.mods).forEach((e=>{t.setMod(e,this.mods[e])})),this.append(t)})),this.setMod("empty",!this.elements.length)}onScrollLoadChunk(){!this.stateManager.isFavoriteItems&&this.j.o.pixelOffsetLoadNewChunk>this.container.scrollHeight-(this.container.scrollTop+this.container.offsetHeight)&&this.j.loadingManager.loadItemsChunk()}onDragOver(e){e.preventDefault(),this.setMod("dragover",!0)}onDragLeave(e){e.preventDefault(),this.setMod("dragover",!1)}addItemsSelector(){(class e{static remove(e){f.i.safeRemove(e.container.querySelector(".jodit-ui-select-items")),e.j.e.off(e.container,"mousedown.uiselectitems touchstart.uiselectitems")}static install(e){const t=e.j.c.div("jodit-ui-select-items");e.j.e.on(e.container,"mousedown.uiselectitems touchstart.uiselectitems",this.onStartSelect.bind(this,e,t))}static onStartSelect(e,t,s){if(s.target!==e.container)return;(0,v.i)(t,{width:0,height:0}),e.container.appendChild(t);const i={x:s.clientX,y:s.clientY,w:e.container.offsetWidth,h:e.container.offsetHeight},n=e.j.async.throttle(this.onSelect.bind(this,e,t,i),e.j.defaultTimeout/10);e.j.lock(),e.j.e.on(e.j.ow,"mousemove touchmove",n).one(e.j.ow,"mouseup touchend",this.onEndSelect.bind(this,e,t,n)),e.onSelectItems({left:i.x,top:i.y,width:0,height:0})}static onSelect(e,t,s,i){const n={left:s.x>i.clientX?i.clientX:s.x,top:s.y>i.clientY?i.clientY:s.y,width:Math.abs(s.x-i.clientX),height:Math.abs(s.y-i.clientY)};(0,v.i)(t,n),e.onSelectItems(n)}static onEndSelect(e,t,s,i){f.i.safeRemove(t),e.j.e.off(e.j.ow,"mousemove touchmove",s),e.j.unlock()}}).install(this)}static intersectRect(e,t){return!(t.left>e.left+e.width||e.left>t.left+t.width||t.top>e.top+e.height||e.top>t.top+t.height)}onSelectItems(e){const t=[];this.elements.forEach((s=>{const i=(0,g.position)(s.container);p.intersectRect(i,e)&&t.push(s.item)})),this.stateManager.state.activeElements=t}};(0,n.gn)([(0,d.watch)(":afterResize"),(0,d.watch)(":resize"),(0,d.watch)("container:scroll"),(0,d.throttle)()],w.prototype,"onScrollLoadChunk",null),(0,n.gn)([(0,d.watch)("container:dragover")],w.prototype,"onDragOver",null),(0,n.gn)([(0,d.watch)(["container:dragleave","container:drop"])],w.prototype,"onDragLeave",null),w=p=(0,n.gn)([d.component],w);let y=class e extends o.u1{className(){return"UIBrowserMessage"}constructor(e,t){super(e),this.container.innerText=(0,g.isString)(t)?t:t.message}};y=(0,n.gn)([d.component],y);let b=class e extends o.qe{className(){return"UIBrowserMessages"}build(e){this.clear(),e.forEach((e=>{const t=new y(this.jodit,e.message);t.setMod("type",e.type),this.append(t)}))}};b=(0,n.gn)([d.component],b);class C{static remove(e){(0,v.i)(e.container,{width:null,height:null}),e.container.classList.remove("jodit-ui-resize"),f.i.safeRemove(e.container.querySelector(".jodit-ui-resize__handle"))}static install(e,t){e.container.classList.add("jodit-ui-resize"),"static"===(0,v.i)(e.container,"position")&&(0,v.i)(e.container,"position","relative");const s=e.j.c.div("jodit-ui-resize__handle");s.classList.add("jodit-ui-resize__handle_type_"+t),e.container.appendChild(s),e.j.e.on(s,"mousedown touchstart",this.onStartResize.bind(this,e,t))}static onStartResize(e,t,s){const i=e.j.async.throttle(this.onResize.bind(this,e,{x:s.clientX,y:s.clientY,w:e.container.offsetWidth,h:e.container.offsetHeight,direction:t}),e.j.defaultTimeout/10);e.j.lock(),e.j.e.on(e.j.ow,"mousemove touchmove",i).one(e.j.ow,"mouseup touchend",this.onEndResize.bind(this,e,i))}static onResize(e,t,s){const i=["left","right"].includes(t.direction),n=e.container.parentElement;if(!n)return;let o;o=i?(t.w+(s.clientX-t.x)*("right"===t.direction?1:-1))/n.offsetWidth:(t.h+(s.clientY-t.y)*("top"===t.direction?1:-1))/n.offsetHeight,(0,v.i)(e.container,i?"width":"height",100*o+"%")}static onEndResize(e,t,s){e.j.e.off(e.j.ow,"mousemove touchmove",t),e.j.unlock()}}let S=class e extends o.qe{className(){return"UISidebar"}render(){return"<div>\n\t\t\t<div class='&__hide-btn'>*angle-left*</div>\n\t\t\t<div class='&__favorites'>*heart* ~Favorites~</div>\n\t\t\t<div class='&__box'></div>\n\t\t</div>"}appendChildToContainer(e){const t=this.getElm("box");(0,g.assert)(null!=t,"box element does not exists"),t.appendChild(e)}addResize(){C.remove(this),C.install(this,screen.width>450?"right":"bottom")}constructor(e,t,s){super(e,t),this.state=s,this.onChangeFavorites()}onChangeFavorites(){this.setMod("has-favorites",!!this.state.favorites.length)}onClickHideButton(){return this.state.showSideBar=!this.state.showSideBar,!1}onClickFavorites(){return this.state.elements=this.state.favorites,!1}};(0,n.gn)([(0,d.hook)("ready"),(0,d.watch)(":resize",window),(0,d.debounce)()],S.prototype,"addResize",null),(0,n.gn)([(0,d.watch)("state.favorites")],S.prototype,"onChangeFavorites",null),(0,n.gn)([(0,d.watch)("hide-btn:click")],S.prototype,"onClickHideButton",null),(0,n.gn)([(0,d.watch)("favorites:click")],S.prototype,"onClickFavorites",null),S=(0,n.gn)([d.component],S);let x=class e extends o.qe{className(){return"UIBrowserSettings"}render(){return`<div>\n\t\t\t<div class="${this.getFullElName("close")}">${o.JO.get("cancel")}</div>\n\t\t\t<div class="${this.getFullElName("title")}">${this.j.i18n("Settings")}</div>\n\t\t\t<div class="${this.getFullElName("options")}"></div>\n\t\t</div>`}appendChildToContainer(e){const t=this.getElm("options");(0,g.assert)(null!=t,"options element does not exists"),t.appendChild(e)}afterSetMod(e,t){"hidden"===e&&!1===t&&this.generateSettings(),super.afterSetMod(e,t)}constructor(e,t){super(e),this.state=t;const s=this.getElm("close");(0,g.assert)(null!=s,"close element does not exists"),e.e.on(s,"click",(()=>{this.state.showSettings=!1}))}onChangeView(){const e=this.getElm("tile-size");e&&(e.style.display="tiles"===this.state.view?"block":"none")}generateSettings(){this.clear();const{j:e}=this;this.append([new o.BO(e,{label:"Theme",name:"theme",value:this.state.theme,radio:!0,options:[{value:"default",text:"Light"},{value:"dark",text:"Dark"}],onChange:e=>{this.state.theme="default"===this.state.theme||"dark"===this.state.theme?e[0].value:"default"}}),new o.BO(e,{label:"Show favorites",name:"showFavorites",value:this.state.showFavorites,radio:!0,options:[{value:!0,text:"Show"},{value:!1,text:"Hide"}],onChange:e=>{this.state.showFavorites=e[0].value}}),new o.BO(e,{label:"View",name:"view",value:this.state.view,radio:!0,options:[{value:"tiles",text:"Tiles"},{value:"list",text:"List"},{value:"compact",text:"Compact"}],onChange:e=>{this.state.view=e[0].value}}),new o.BO(e,{label:"Folders position",name:"foldersPosition",value:this.state.foldersPosition,radio:!0,options:[{value:"top",text:"Top"},{value:"bottom",text:"Bottom"},{value:"default",text:"Default"}],onChange:e=>{this.state.foldersPosition=e[0].value}}),new o.Cj(e,{label:"Sort by",name:"sort-by",value:this.state.sortBy,options:[{value:"changed-asc",text:e.i18n("Sort by changed")+"(⬆)"},{value:"changed-desc",text:e.i18n("Sort by changed")+"(⬇)"},{value:"name-asc",text:e.i18n("Sort by name")+"(⬆)"},{value:"name-desc",text:e.i18n("Sort by name")+"(⬇)"},{value:"size-asc",text:e.i18n("Sort by size")+"(⬆)"},{value:"size-desc",text:e.i18n("Sort by size")+"(⬇)"}],onChange:e=>{this.state.sortBy=e}}),new o.Cj(e,{label:"Tile size",name:"tile-size",value:this.state.tileSize,options:[{value:"xsmall",text:"Extra small"},{value:"small",text:"Small"},{value:"default",text:"Default"},{value:"large",text:"Large"},{value:"xlarge",text:"Extra large"}],onChange:e=>{this.state.tileSize=e}})]),this.onChangeView()}};(0,n.gn)([(0,d.watch)("state.view")],x.prototype,"onChangeView",null),x=(0,n.gn)([d.component],x);let I=class e extends o.u1{className(){return"UIBrowserFolder"}render(){return'<div>\n\t\t\t<div class="&__icon">\n\t\t\t\t<div class=\'&__loader\'></div>\n\t\t\t\t<div class="&__icon-wrapper">\n\t\t\t\t\t*folder*\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t\t<div class="&__name"></div>\n\t\t\t<div class="&__arrow">*angle-right*</div>\n\t\t</div>'}constructor(e,t){super(e),this.item=t,this.syncMod=!0;const s=this.getElm("name");(0,g.assert)(null!=s,"name element does not exists"),s.innerText=t.name,e.e.on(this.container,"click",(()=>(this.getMod("active")||this.setMod("loading",!0),e.e.fire("openFolder",t)))).on(this.container,"contextmenu",(s=>e.e.fire("contextmenuFolder.filebrowser",t,s)))}};var M;I=(0,n.gn)([d.component],I);let P=M=class e extends o.qe{className(){return"UITree"}constructor(e,t){super(e),this.syncMod=!0,this.build(t)}build(e){this.clear(),e.forEach((e=>{const t=new I(this.jodit,e);this.append(t),e.isActive&&t.setMod("active",!0),e.children.length&&this.append(new M(this.jodit,e.children))}))}};P=M=(0,n.gn)([d.component],P);let j=class e extends o.u1{className(){return"UIBrowserSource"}render(){return'<div>\n\t\t\t<div class="&__name"></div>\n\t\t\t<div class="&__tree"></div>\n\t\t</div>'}constructor(e,t){super(e,t),this.data=t,this.tree=new P(this.j,this.data.children),this.syncMod=!0;const s=this.getElm("name");(0,g.assert)(null!=s,"name element does not exists"),s.innerText=t.title||t.name;const i=this.getElm("tree");(0,g.assert)(null!=i,"tree element does not exists"),i.appendChild(this.tree.container),e.e.on(this.container,"contextmenu",(s=>e.e.fire("contextmenuSource.filebrowser",t,s)))}};j=(0,n.gn)([d.component],j);let F=class e extends o.qe{constructor(){super(...arguments),this.syncMod=!0}className(){return"UIBrowserSources"}build(e){this.clear(),e.forEach((e=>{this.append(new j(this.jodit,e))}))}};F=(0,n.gn)([d.component],F);let _=class e extends o.u1{className(){return"UIBrowserStatusBar"}render(){return"<div>\n\t\t\t<div class='&__slot-left'></div>\n\t\t\t<div class='&__slot-center'></div>\n\t\t\t<div class='&__slot-right'></div>\n\t\t</div>"}value(e,t="left"){const s=this.getElm("slot-"+t);return(0,g.assert)(null!=s,"Slot does not exists"),s.innerText=e,this}};_=(0,n.gn)([d.component],_);var E=s(96582);let k=class e extends o.qe{className(){return"UIPreview"}addResize(){C.remove(this),C.install(this,screen.width>450?"left":"top")}render(){return'<div>\n\t\t\t\t<div class="&__image"></div>\n\t\t\t\t<div class="&__info"></div>\n\t\t\t\t<div class="&__loader"></div>\n\t\t\t\t<div class="&__empty-message">~Select image~</div>\n\t\t\t</div>'}constructor(e,t){super(e),this.state=t,this.lastLoadPromise=null,this.onChangeMetaInfo()}afterSetMod(e,t){"hidden"===e&&!1===t&&this.onChangeMetaInfo(),super.afterSetMod(e,t)}onChangeMetaInfo(){var e,t;if(this.getMod("hidden"))return;const{metaInfo:s}=this.state;this.setMod("empty",!s);const i=this.getElm("info");(0,g.assert)(null!=i,"info element does not exists"),E.i.detach(i);const n=this.getElm("image");(0,g.assert)(null!=n,"image element does not exists"),(0,g.css)(n,{backgroundImage:null}),s&&(this.setMod("is-file",!1===s.isImage).setMod("type",null!==(e=s.type)&&void 0!==e?e:"file"),m.prototype.setElementValue.call(this,"name",s.file),m.prototype.setElementValue.call(this,"time",s.time),m.prototype.setElementValue.call(this,"filesize",s.size),this.setMod("loading",!0),null===(t=this.lastLoadPromise)||void 0===t||t.rejectCallback(),this.lastLoadPromise=(0,g.loadImage)(s.isImage?s.fileURL:s.imageURL,this.j),this.lastLoadPromise.then((e=>{const t=this.getElm("image");(0,g.assert)(null!=t,"image element does not exist"),e&&(0,g.css)(t,{backgroundImage:`url(${e.src})`})})).finally((()=>{this.setMod("loading",!1)})).catch((()=>{})))}};(0,n.gn)([(0,d.hook)("ready"),(0,d.watch)(":resize",window),(0,d.debounce)()],k.prototype,"addResize",null),(0,n.gn)([(0,d.watch)("state.metaInfo")],k.prototype,"onChangeMetaInfo",null),k=(0,n.gn)([d.component],k);let L=class e extends o.qe{className(){return"UIBrowserPanel"}get countInRow(){if("list"===this.state.view)return 1;const{container:e}=this.items.elements[0],t=(0,g.css)(e,"marginLeft");return Math.floor(this.items.container.offsetWidth/(e.offsetWidth+((0,g.isNumber)(t)?t:0)))}get countInColumn(){const{container:e}=this.items.elements[0],t=(0,g.css)(e,"marginTop");return Math.floor(this.items.container.offsetHeight/(e.offsetHeight+((0,g.isNumber)(t)?t:0)))}render(){return"<div>\n\t\t\t<div class='&__content'></div>\n\t\t\t<div class='&__footer'></div>\n\t\t</div>"}constructor(e,t){super(e),this.stateManager=t,this.syncMod=!0,this.sources=new F(this.j),this.sidebar=new S(this.jodit,[this.sources],this.stateManager.state),this.preview=new k(this.jodit,this.stateManager.state),this.statusbar=new _(this.j),this.items=new w(this.j,this.stateManager),this.settings=new x(this.jodit,this.stateManager.state),this.messages=new b(this.j),this.state=t.state,this.append(this.sidebar,"content"),this.append(this.items,"content"),this.append(this.messages,"footer"),this.append(this.settings,"content"),this.append(this.preview,"content"),this.append(this.statusbar,"footer"),this.onChangeElements(),this.onChangeSources(),this.onChangeView(),this.onChangeTileSize(),this.onChangeShowFavorites(),this.onChangeMessages(),this.onChangeActiveElements(),this.onChangeFavorites(),this.onChangeShowSideBar(),this.onChangeShowSettings(),this.onChangeShowPreview(),this.onChangeTheme()}onChangeTheme(){this.setMod("theme",this.stateManager.state.theme)}onChangeElements(){this.items.build(this.stateManager.state.elements)}onChangeActiveElements(){this.state.activeElements.length||(this.state.info="",this.state.metaInfo=null),this.items.elements.forEach((e=>{e.setMod("active",!!this.stateManager.isActive(e.item))})),this.j.e.fire("changeSelection")}onChangeFavorites(){this.items.elements.forEach((e=>{e.setMod("favorite",!!this.stateManager.isFavorite(e.item))}))}onChangeSources(){this.sources.build(this.stateManager.state.tree)}onChangeLastSelectedIndex(){var e;const t=null===(e=this.items.elements[this.stateManager.state.lastSelectedIndex])||void 0===e?void 0:e.container;t&&((0,g.scrollIntoViewIfNeeded)(t,this.items.container,this.j.od),t.focus())}onChangeInfo(){this.statusbar.value(this.state.info,"center")}onChangePathOrSource(){this.statusbar.value(this.state.currentPath?`${this.state.currentPath} (${this.state.currentSource})`:this.i18n("Home"),"left")}onChangeShowSettings(){this.settings.setMod("hidden",!this.stateManager.state.showSettings)}onChangeShowPreview(){this.preview.setMod("hidden",!this.stateManager.state.showPreview)}onChangeShowSideBar(){this.sidebar.setMod("hidden",!this.stateManager.state.showSideBar)}onChangeView(){this.items.setMod("view",this.stateManager.state.view)}onChangeTileSize(){this.items.setMod("size",this.stateManager.state.tileSize)}onChangeShowFavorites(){this.sidebar.setMod("show-favorites",this.stateManager.state.showFavorites),this.items.setMod("show-favorites",this.stateManager.state.showFavorites)}onChangeMessages(){this.messages.build(this.stateManager.state.messages)}onItemDblClick(){return this.j.e.fire("select.filebrowser"),!1}onItemClick(e,t){this.stateManager.addActive(e,t)}onTogglePreview(){return this.state.showPreview=!this.state.showPreview,!1}onToggleFavoriteItem(e){this.stateManager.toggleFavorite(e)}onFolderClick(e){this.stateManager.state.currentSource=e.sourceName,this.stateManager.state.currentPath=e.path||"/",this.j.e.fire("afterOpenFolder.filebrowser")}};(0,n.gn)([(0,d.watch)("state.theme")],L.prototype,"onChangeTheme",null),(0,n.gn)([(0,d.watch)("state.elements")],L.prototype,"onChangeElements",null),(0,n.gn)([(0,d.watch)("state.activeElements")],L.prototype,"onChangeActiveElements",null),(0,n.gn)([(0,d.watch)(["state.favorites","state.elements"])],L.prototype,"onChangeFavorites",null),(0,n.gn)([(0,d.watch)("state.sources")],L.prototype,"onChangeSources",null),(0,n.gn)([(0,d.watch)("state.lastSelectedIndex")],L.prototype,"onChangeLastSelectedIndex",null),(0,n.gn)([(0,d.watch)("state.info")],L.prototype,"onChangeInfo",null),(0,n.gn)([(0,d.watch)(["state.currentPath","state.currentSource"])],L.prototype,"onChangePathOrSource",null),(0,n.gn)([(0,d.watch)("state.showSettings")],L.prototype,"onChangeShowSettings",null),(0,n.gn)([(0,d.watch)("state.showPreview")],L.prototype,"onChangeShowPreview",null),(0,n.gn)([(0,d.watch)("state.showSideBar")],L.prototype,"onChangeShowSideBar",null),(0,n.gn)([(0,d.watch)("state.view")],L.prototype,"onChangeView",null),(0,n.gn)([(0,d.watch)("state.tileSize")],L.prototype,"onChangeTileSize",null),(0,n.gn)([(0,d.watch)("state.showFavorites")],L.prototype,"onChangeShowFavorites",null),(0,n.gn)([(0,d.watch)("state.messages")],L.prototype,"onChangeMessages",null),(0,n.gn)([(0,d.watch)(":dblclickItem.filebrowser")],L.prototype,"onItemDblClick",null),(0,n.gn)([(0,d.watch)(":clickItem.filebrowser")],L.prototype,"onItemClick",null),(0,n.gn)([(0,d.watch)(":togglePreview.filebrowser")],L.prototype,"onTogglePreview",null),(0,n.gn)([(0,d.watch)(":toggleFavoriteItem")],L.prototype,"onToggleFavoriteItem",null),(0,n.gn)([(0,d.watch)(":openFolder")],L.prototype,"onFolderClick",null),L=(0,n.gn)([d.component],L);var R=s(49940);class B{constructor(e){this.state=e}getIndex(e,t=this.state.elements){return t.findIndex((t=>t.uniqueHashKey===e.uniqueHashKey))}isActive(e){return!!this.state.activeElements.find((t=>t.uniqueHashKey===e.uniqueHashKey))}isFavorite(e){return!!this.state.favorites.find((t=>t.uniqueHashKey===e.uniqueHashKey))}addActive(e,t){var s;this.state.metaInfo=e,this.state.info=null!==(s=e.file)&&void 0!==s?s:"",this.state.lastSelectedIndex=this.getIndex(e),this.state.activeElements=t?[...this.state.activeElements,e]:[e]}callSelectHandler(){var e;const t=this.state.activeElements;null===(e=this.state.onSelectCallBack)||void 0===e||e.call(this,{baseurl:"",files:t.map((e=>e.fileURL)),isImages:t.map((e=>!!e.isImage))})}setFilter(e){this.state.filterWord=e}addMessage(e){var t;const s=this.state.messages;(null===(t=s[s.length-1])||void 0===t?void 0:t.message)!==e.message&&(this.state.messages=[...s,e])}removeMessage(e){const t=this.state.messages.indexOf(e);if(-1!==t){const e=[...this.state.messages];e.splice(t,1),this.state.messages=e}}toggleFavorite(e){const t=this.getIndex(e,this.state.favorites),s=[...this.state.favorites];-1===t?s.push(e):s.splice(t,1),this.state.favorites=s}fillSources(e,t){const s=e=>e.filter((e=>"."!==e&&".."!==e));if(this.state.tree.length&&t){const i=(e,t)=>{var s;return null!==(s=e.find((e=>e.name===t)))&&void 0!==s?s:null};this.removeActive(this.state.tree),e.forEach((e=>{const n=i(this.state.tree,e.name);if(n){n.isActive=!0;const o=t.split("/").reduce(((e,t)=>e&&i(e.children,t)),n);o&&(o.isActive=!0,o.children=s(e.folders).map((s=>({type:"directory",name:s,path:t+"/"+s,sourceName:e.name,children:[]}))))}}))}else this.state.tree=e.map((e=>({type:"source",name:e.name,title:e.title,sourceName:e.name,path:"/",children:s(e.folders).map((t=>({type:"directory",name:t,path:t,sourceName:e.name,children:[]})))})))}removeActive(e){e.forEach((e=>{e.isActive=!1,this.removeActive(e.children)}))}get isFavoriteItems(){return this.state.favorites===this.state.elements}}(0,n.gn)([d.autobind],B.prototype,"getIndex",null),(0,n.gn)([d.autobind],B.prototype,"isActive",null),(0,n.gn)([d.autobind],B.prototype,"isFavorite",null);var z=s(75901);let N=class e extends o.qe{className(){return"UIBrowserHeader"}constructor(e,t,s){var i;super(e),this.options=t,this.stateManager=s,this.syncMod=!0,this.toolbar=(0,z.R)(this.j),this.filter=new o.u3(this.j,{icon:"search",placeholder:"Filter",clearButton:!0,onChange:e=>{this.stateManager.setFilter(e)}}),this.append(this.toolbar).append(this.filter),this.filter.container.classList.add(this.getFullElName("filter")),this.toolbar.setMod("mode","header").build(null!==(i=this.options.toolbarButtons)&&void 0!==i?i:[])}};N=(0,n.gn)([d.component],N);var T=s(98842),H=s(733);let O=class e extends o.ko{className(){return"UIProgress"}constructor(e,t){super(e),this.state=t,this.onProgress()}onProgress(){this.state.progress?this.show():this.hide(),this.progress(this.state.progress)}hide(){return this.setMod("hidden",!0),this}progress(e){return this.container.style.width=e.toFixed(2)+"%",98>e||this.j.async.setTimeout((()=>{this.hide()}),{label:"progress",timeout:300}),this}show(){return this.setMod("hidden",!1),this}};(0,n.gn)([(0,d.watch)("state.progress")],O.prototype,"onProgress",null),O=(0,n.gn)([d.component],O);var D=s(74738),U=s(50072),K=s(65927);let A=class e extends K.Hr{className(){return"PersistentStore"}constructor(e,t){super(e),this.state=t,this.sortBy="changed-desc",this.view="tiles",this.foldersPosition="top",this.tileSize="default",this.favorites=[],this.showSideBar=!0,this.showPreview=!1,this.showFavorites=!0}onChangeThemeSetField(){this.theme=this.state.theme}onChangeView(){this.view=this.state.view}onChangeSortBy(){this.sortBy=this.state.sortBy}onChangeTileSize(){this.tileSize=this.state.tileSize}onChangeFavorites(){this.favorites=this.state.favorites}onChangeShowSideBar(){this.showSideBar=this.state.showSideBar}onChangeShowPreview(){this.showPreview=this.state.showPreview}onChangeShowFavorites(){this.showFavorites=this.state.showFavorites}onChangeFoldersPosition(){this.foldersPosition=this.state.foldersPosition}syncWithState(){this.state.tileSize=this.tileSize,this.state.favorites=this.favorites.map((e=>e instanceof u.Z?e:u.Z.create(e))),this.state.view=this.view,this.state.theme=this.theme,this.state.showSideBar=this.showSideBar,this.state.showPreview=this.showPreview,this.state.showFavorites=this.showFavorites,this.state.sortBy=this.sortBy,this.state.foldersPosition=this.foldersPosition}};(0,n.gn)([d.persistent],A.prototype,"theme",void 0),(0,n.gn)([d.persistent],A.prototype,"sortBy",void 0),(0,n.gn)([d.persistent],A.prototype,"view",void 0),(0,n.gn)([d.persistent],A.prototype,"foldersPosition",void 0),(0,n.gn)([d.persistent],A.prototype,"tileSize",void 0),(0,n.gn)([d.persistent],A.prototype,"favorites",void 0),(0,n.gn)([d.persistent],A.prototype,"showSideBar",void 0),(0,n.gn)([d.persistent],A.prototype,"showPreview",void 0),(0,n.gn)([d.persistent],A.prototype,"showFavorites",void 0),(0,n.gn)([(0,d.watch)("state.theme")],A.prototype,"onChangeThemeSetField",null),(0,n.gn)([(0,d.watch)("state.view")],A.prototype,"onChangeView",null),(0,n.gn)([(0,d.watch)("state.sortBy")],A.prototype,"onChangeSortBy",null),(0,n.gn)([(0,d.watch)("state.tileSize")],A.prototype,"onChangeTileSize",null),(0,n.gn)([(0,d.watch)("state.favorites")],A.prototype,"onChangeFavorites",null),(0,n.gn)([(0,d.watch)("state.showSideBar")],A.prototype,"onChangeShowSideBar",null),(0,n.gn)([(0,d.watch)("state.showPreview")],A.prototype,"onChangeShowPreview",null),(0,n.gn)([(0,d.watch)("state.showFavorites")],A.prototype,"onChangeShowFavorites",null),(0,n.gn)([(0,d.watch)("state.foldersPosition")],A.prototype,"onChangeFoldersPosition",null),A=(0,n.gn)([d.component],A);let V=class e extends K.Hr{className(){return"HistoryManager"}constructor(e,t){super(e),this.state=t,this.history=[],this.historyIndex=0}canNext(){return this.history.length-1>this.historyIndex}canPrevious(){return this.historyIndex>0}push(e){let{historyIndex:t}=this;const s=this.history[t];if(s&&s.currentSource===e.currentSource&&s.currentPath===e.currentPath)return;let i=[...this.history];i.length-1!==t&&(i=i.slice(0,t+1)),i.push(e),s&&(t+=1),this.history=i,this.historyIndex=t}next(){this.canNext()&&(this.historyIndex+=1,this.updateState())}previous(){this.canPrevious()&&(this.historyIndex-=1,this.updateState())}updateCurrent(){this.history[this.historyIndex]={currentSource:this.state.currentSource,currentPath:this.state.currentPath,tree:(0,g.fastClone)(this.state.tree),elements:[...this.state.elements]}}onHome(){this.state.currentPath="",this.state.currentSource="",this.j.e.fire("afterOpenFolder.filebrowser update.filebrowser")}onOpenFolder(){this.push({tree:[],elements:[],currentPath:this.state.currentPath,currentSource:this.state.currentSource}),this.j.e.fire("changeSelection")}updateState(){const{tree:e,elements:t,currentSource:s,currentPath:i}=this.history[this.historyIndex];this.state.activeElements=[],this.state.elements=[...t],this.state.tree=[...e],this.state.currentSource=s,this.state.currentPath=i,this.j.e.fire("changeSelection")}};(0,n.gn)([(0,d.watch)(["state.elements","state.tree"])],V.prototype,"updateCurrent",null),(0,n.gn)([(0,d.watch)(":goHome.filebrowser")],V.prototype,"onHome",null),(0,n.gn)([(0,d.watch)(":afterOpenFolder.filebrowser")],V.prototype,"onOpenFolder",null),V=(0,n.gn)([d.component],V);let q=class e extends K.Hr{className(){return"ContextMenuManager"}onFolderContext(e,t){return this.buildContextItemMenu(this.getFolderContextActions(e),t),!1}onItemContext(e,t,s){return this.buildContextItemMenu(this.getItemContextActions(e),s),!1}onSourceContext(e,t){return this.buildContextItemMenu(this.getSourceContextActions(e),t),!1}buildContextItemMenu(e,t){if(!this.j.o.contextMenu)return;const s=(0,D.L)(this.j).setMod("theme",this.j.state.theme);s.show(t.clientX,t.clientY,e.filter((e=>e&&!1!==e.enabled))),this.j.e.on(this.j,"afterClose",(()=>{s.isOpened&&s.close()}))}getItemContextActions(e){if(this.j.stateManager.isActive(e)||this.j.stateManager.addActive(e,this.j.state.activeElements.length>1),"folder"===e.type)return this.getFolderContextActions({type:"directory",children:[],name:e.name||"",path:e.path,sourceName:e.sourceName});const t=this.j.options,s=this.j.dataProvider,i=1===this.j.state.activeElements.length;return[{icon:"pencil",title:"Edit",enabled:!!e.isImage&&t.editImage&&i&&(s.canI("ImageResize")||s.canI("ImageCrop")),exec:()=>{this.j.e.fire("edit.filebrowser")}},{icon:"italic",title:"Rename",enabled:s.canI("FileRename")&&i,exec:()=>this.j.e.fire("fileRename.filebrowser",e)},{icon:"bin",title:"Delete",enabled:s.canI("FileRemove"),exec:()=>this.j.e.fire("fileRemove.filebrowser",e)},{icon:"eye",title:"Preview",enabled:!(!e.isImage&&"file"!==e.type)&&t.preview&&i,exec:()=>this.j.e.fire("openLightBox.filebrowser",e)},{icon:"upload",title:"Download",exec:()=>{e.fileURL&&this.j.ow.open(e.fileURL)}}]}getFolderContextActions(e){const t=this.j.dataProvider;return[{icon:"pencil",title:"Rename",exec:()=>{this.j.e.fire("folderRename.filebrowser",e)},enabled:t.canI("FolderRename")},{icon:"bin",title:"Delete",exec:()=>{this.j.e.fire("folderRemove.filebrowser",e)},enabled:t.canI("FolderRemove")},{icon:"plus",title:"Add folder",exec:()=>{this.j.e.fire("folderCreate.filebrowser",e)},enabled:t.canI("FolderCreate")}]}getSourceContextActions(e){return[{icon:"plus",title:"Create folder",exec:()=>{this.j.e.fire("folderCreate.filebrowser",e)}}]}};(0,n.gn)([(0,d.watch)(":contextmenuFolder.filebrowser")],q.prototype,"onFolderContext",null),(0,n.gn)([(0,d.watch)(":contextmenuItem.filebrowser")],q.prototype,"onItemContext",null),(0,n.gn)([(0,d.watch)(":contextmenuSource.filebrowser")],q.prototype,"onSourceContext",null),q=(0,n.gn)([d.component],q);const W=e=>{const t=e.split("/").filter((e=>e.length));return t.pop(),t.join("/")||"/"};var Y,G=s(62195),$=s(85475);let J=Y=class e extends h.UIElement{className(){return"UILightBox"}render(){return"<div>\n\t\t\t<div class='&__previous'>*angle-left*</div>\n\t\t\t<div class='&__preview'></div>\n\t\t\t<div class='&__loader'></div>\n\t\t\t<div class='&__next'>*angle-right*</div>\n\t\t</div>"}constructor(e,t,s){super(e),this.current=t,this.elements=s,this.dialog=new h.Dialog;const{dialog:i}=this;i.setMod("theme",e.state.theme).toolbar.setMod("mode","header"),i.open(this),this.elements=this.elements.filter((e=>e.isImage)),i.e.on(i,"afterClose",(()=>{this.destruct()})),this.addGlobalListeners(),this.onChangeCurrent(),i.toolbar.build([{icon:"check",exec:()=>{e.stateManager.addActive(this.current,!1),e.e.fire("select.filebrowser"),i.close()}},"dialog.close"])}async onChangeCurrent(){const{current:e}=this;this.setMod("loading",!0);const t=this.getElm("preview");if((0,g.assert)(null!=t,"preview element does not exist"),h.Dom.detach(t),(0,g.css)(t,{backgroundImage:null}),e.isImage){const s=await(0,g.loadImage)(e.fileURL,this.j);this.dialog.setPosition(),(0,g.css)(t,{width:Math.min(this.jodit.ow.innerWidth,s.naturalWidth),height:Math.min(this.jodit.ow.innerHeight-100,s.naturalHeight),backgroundImage:`url(${s.src})`})}else{const s=await this.makeIframe(e.fileURL);t.appendChild(s)}this.dialog.setSize(),this.dialog.setPosition(),this.setMod("loading",!1)}makeIframe(e){const t=this.j.c.element("iframe");return t.classList.add(this.getFullElName("office-iframe")),t.src=/\.pdf/.test(e)?e:this.j.o.previewOfficeURL+encodeURIComponent(e),t}onPreviousClick(){const{current:e}=this;let t=this.j.stateManager.getIndex(e,this.elements);t>0?t-=1:t=this.elements.length-1,this.current=this.elements[t]}onNextClick(){const{current:e}=this;let t=this.j.stateManager.getIndex(e,this.elements);this.elements.length-1>t?t+=1:t=0,this.current=this.elements[t]}static open(e,t,s){return new Y(e,t,s)}addGlobalListeners(){this.j.e.on(this.j.od,"keydown",this.onKeyPress)}onKeyPress(e){if(e.key===R.KEY_LEFT||e.key===R.KEY_RIGHT||e.key===R.KEY_SPACE)return e.key===R.KEY_LEFT?this.onPreviousClick():this.onNextClick(),!1}removeGlobalListeners(){this.j.e.off(this.j.od,"keydown",this.onKeyPress)}destruct(){return this.removeGlobalListeners(),this.dialog.destruct(),super.destruct()}};(0,n.gn)([(0,d.watch)("current")],J.prototype,"onChangeCurrent",null),(0,n.gn)([(0,d.watch)("previous:click")],J.prototype,"onPreviousClick",null),(0,n.gn)([(0,d.watch)("next:click")],J.prototype,"onNextClick",null),(0,n.gn)([d.autobind],J.prototype,"onKeyPress",null),J=Y=(0,n.gn)([d.component],J);let X=class e extends K.Hr{className(){return"LoadingManager"}constructor(e,t){super(e),this.state=t,this.offset=0,this.countInOneChunk=20,this.stopLoadingParts=!1,this.__isLoadingPart=!1,this.__callQueueCount=0}async onUpdateFileBrowser(){this.j.state.activeElements=[],this.j.panel.setMod("loading",!0),await Promise.all([this.loadFolders(),this.loadItems()]),this.j.panel.setMod("loading",!1)}async loadFolders(){if(!this.j.isOpened)return;const{currentPath:e,currentSource:t}=this.j.state;try{const s=await this.j.dataProvider.tree(e,t);this.j.stateManager.fillSources(s,e),this.j.state.sources=s}catch(e){this.j.status(e)}}async loadItems(){if(this.j.isOpened)try{for(this.offset=0,this.stopLoadingParts=!1,this.__callQueueCount=0,this.j.state.elements=await this.loadPartItems(),this.stopLoadingParts=this.countInOneChunk>this.j.state.elements.length;!this.stopLoadingParts&&this.j.panel.countInColumn*this.j.panel.countInRow>=this.j.state.elements.length;)await this.loadItemsChunk()}catch(e){this.j.status(e)}}async __loadItemsChunk(){if(this.__isLoadingPart)this.__callQueueCount+=1;else{if(!this.stopLoadingParts){this.__isLoadingPart=!0,this.j.panel.items.setMod("chunk-loading",!0);try{this.offset+=this.countInOneChunk;const e=await this.loadPartItems();this.stopLoadingParts=this.countInOneChunk>e.length,e.length&&(this.j.state.elements=this.j.state.elements.concat(e))}catch(e){this.j.status(e)}return this.j.panel.items.setMod("chunk-loading",!1),this.__isLoadingPart=!1,this.__callQueueCount>0?(this.__callQueueCount-=1,this.__loadItemsChunk()):void 0}this.__callQueueCount=0}}loadItemsChunk(){return this.__loadItemsChunk()}loadPartItems(){const{currentPath:e,currentSource:t,sortBy:s,withFolders:i,foldersPosition:n,onlyImages:o,filterWord:a}=this.j.state;return this.j.dataProvider.items(e,t,{offset:this.offset,limit:this.countInOneChunk,sortBy:s,withFolders:i,foldersPosition:n,onlyImages:o,filterWord:a})}};(0,n.gn)([(0,d.watch)(":update.filebrowser")],X.prototype,"onUpdateFileBrowser",null),(0,n.gn)([(0,d.watch)(["state.currentPath","state.currentSource"]),(0,d.debounce)((e=>({timeout:e.defaultTimeout,promisify:!0})))],X.prototype,"loadFolders",null),(0,n.gn)([(0,d.watch)(["state.currentPath","state.currentSource","state.sortBy","state.onlyImages","state.foldersPosition","state.filterWord"]),(0,d.debounce)((e=>({timeout:e.defaultTimeout,promisify:!0})))],X.prototype,"loadItems",null),(0,n.gn)([(0,d.debounce)((e=>({timeout:e.defaultTimeout,promisify:!0})))],X.prototype,"loadItemsChunk",null),X=(0,n.gn)([d.component],X);let Z=class e extends c.Vq{className(){return"FileBrowserPro"}lock(e="any"){return this.container.classList.add("jodit_disabled"),super.lock(e)}unlock(){return this.container.classList.remove("jodit_disabled"),super.unlock()}status(e,t=!(e instanceof Error)){if((0,g.isAbort)(e))return;const s={message:(0,g.isString)(e)?e:e.message,type:t?"success":"error"};this.stateManager.addMessage(s),this.async.setTimeout((()=>{this.stateManager.removeMessage(s)}),this.options.howLongShowMsg)}constructor(e){super((0,g.ConfigProto)(Object.assign(e||{},{resizable:!0,draggable:!0,toolbarButtons:(null==e?void 0:e.toolbarButtons)||H.D.defaultOptions.filebrowser.buttons,buttons:G.Jodit.atom(["filebrowser.settings","fullsize","dialog.close"])}),H.D.defaultOptions.filebrowser)),this.dataProvider=(0,D.S)(this,this.options),this.state=(0,h.observable)({onSelectCallBack:null,theme:"default",showSideBar:!0,showFavorites:!0,showSettings:!1,showPreview:!1,withFolders:!0,foldersPosition:"bottom",info:"",metaInfo:null,currentPath:"",currentSource:"",currentBaseUrl:"",tree:[],activeElements:[],favorites:[],progress:0,lastSelectedIndex:0,elements:[],messages:[],sources:[],view:"tiles",tileSize:"default",sortBy:"name-asc",filterWord:"",onlyImages:!1}),this.persistent=new A(this,this.state),this.loadingManager=new X(this,this.state),this.stateManager=new B(this.state),this.historyManager=new V(this,this.state),this.contextMenuManager=new q(this),this.header=new N(this,this.options,this.stateManager),this.panel=new L(this,this.stateManager),this.files=this.panel,this.tree=this.panel,this.progressbar=new O(this,this.stateManager.state),$.V.make(this),!this.persistent.theme&&this.options.theme&&(this.persistent.theme=this.options.theme),this.panel.append(this.progressbar),this.toolbar.setMod("mode","header"),this.setSize(Math.min(this.options.width,screen.width),Math.min(this.options.height,screen.height)).setHeader(this.header),this.onResizeWindow(),this.initUploader(),this.onChangeTheme(),this.fullFillOptions(),this.dataProvider.onProgress((e=>{0===e&&(e=30),this.state.progress=e})),this.e.on("beforeClose",this.removeGlobalListeners),this.e.fire("afterInit"),G.Jodit.prototype.afterInitHook.call(this)}addDisclaimer(e){this.dialog.appendChild(e)}async open(e=this.o.defaultCallback,t){return this.state.onlyImages=!!t,this.prepareOpening(e),super.open(this.panel.container),this.e.fire("update.filebrowser")}onResizeWindow(){(0,g.css)(this.dialog,{maxWidth:screen.width,minHeight:Math.min(this.options.height,screen.height),minWidth:Math.min(this.options.width,screen.width)})}onChangePath(){const{currentPath:e,currentSource:t}=this.state;this.uploader.setPath(e),this.uploader.setSource(t)}onChangeTheme(){this.setMod("theme",this.state.theme),this.header.setMod("theme",this.state.theme),this.panel.setMod("theme",this.state.theme),this.options.theme=this.state.theme}onToggleSettings(){this.state.showSettings=!this.state.showSettings}prepareOpening(e){this.registerGlobalListeners(),e&&(this.state.onSelectCallBack=t=>{this.close(),e(t)}),this.persistent.syncWithState()}registerGlobalListeners(){this.e.on(this.ow,"keydown",this.onKeyPress)}onKeyPress(e){const{activeElement:t}=this.od;if(!this.state.activeElements.length||!t||!h.Dom.isOrContains(this.panel.items.container,t))return;const s=this.state.elements;switch(e.key){case R.KEY_ENTER:return this.onChooseItems();case R.KEY_DELETE:return this.onFileRemove();case R.KEY_RIGHT:case R.KEY_LEFT:case R.KEY_DOWN:case R.KEY_UP:{const t=e.key===R.KEY_RIGHT||e.key===R.KEY_DOWN,i=this.state.lastSelectedIndex;let n;if([R.KEY_RIGHT,R.KEY_LEFT].includes(e.key))n=t?s[i+1]?i+1:0:s[i-1]?i-1:s.length-1;else{const{countInRow:e}=this.panel;n=Math.round(((i+1)/e+(t?1:-1))*e-1)}return s[n]&&this.stateManager.addActive(s[n],e.shiftKey),!1}}}removeGlobalListeners(){this.e.off(this.ow,"keydown",this.onKeyPress)}onFileRemove(){this.state.activeElements.length&&this.confirm("Are you sure?","",(e=>{if(e){const e=[];this.state.activeElements.forEach((t=>{this.stateManager.isFavorite(t)&&this.stateManager.toggleFavorite(t),e.push(this.deleteFile(t.file||t.name||"",t.sourceName))})),this.state.activeElements=[],Promise.all(e).then((()=>{this.loadingManager.loadItems()}))}})).bindDestruct(this)}onFileEdit(){if(1===this.state.activeElements.length){const[e]=this.state.activeElements;T.r.call(this,e.fileURL,e.file||"",e.path,e.sourceName,void 0,this.status)}}onFolderRename(e){this.prompt("Enter new name","Rename",(t=>{if(!(0,g.isValidName)(t)||t===e.name)return this.status(this.i18n("Enter new name")),!1;this.dataProvider.folderRename(W(e.path),e.name,t,e.sourceName).then((s=>{this.state.activeElements=[],this.status(s,!0),this.state.currentPath=W(e.path)+"/"+t,this.state.currentSource=e.sourceName,this.historyManager.updateCurrent(),this.loadingManager.loadFolders()})).catch(this.status)}),this.i18n("type name"),e.name).bindDestruct(this)}onFolderRemove(e){this.confirm("Are you sure?","Delete",(t=>{t&&this.dataProvider.folderRemove(W(e.path),e.name,e.sourceName).then((t=>{this.status(t,!0),this.state.currentPath=W(e.path),this.state.currentSource=e.sourceName,this.loadingManager.loadFolders()})).catch(this.status)})).bindDestruct(this)}onFolderCreate(e){this.prompt("Enter Directory name","Create directory",(t=>{const s=e.path||"/";this.dataProvider.createFolder(t,e.path||"/",e.sourceName).then((()=>{this.state.currentSource===e.sourceName&&this.state.currentPath===s?this.e.fire("update.filebrowser"):(this.state.currentSource=e.sourceName,this.state.currentPath=s),this.historyManager.updateCurrent()}),this.status)}),this.i18n("type name")).bindDestruct(this)}onFileRename(e){const t=e.file||e.name||"";1===this.state.activeElements.length&&t&&this.prompt("Enter new name","Rename",(e=>{if(!(0,g.isValidName)(e))return this.status(this.i18n("Enter new name")),!1;this.dataProvider.fileRename(this.state.currentPath,t,e,this.state.currentSource).then((e=>{this.state.activeElements=[],this.status(e,!0),this.loadingManager.loadItems()})).catch(this.status)}),this.i18n("type name"),t).bindDestruct(this)}onChooseItems(){const e=this.stateManager.state.activeElements;if(e.length){if("folder"===e[0].type)return this.state.currentPath=this.state.currentPath+"/"+e[0].name,this.state.currentSource=e[0].sourceName,void this.e.fire("afterOpenFolder.filebrowser");this.state.onSelectCallBack?this.stateManager.callSelectHandler():this.onOpenLightBox(e[0])}}onOpenLightBox(e){J.open(this,e,this.state.elements)}deleteFile(e,t){return this.dataProvider.fileRemove(this.state.currentPath,e,t).then((t=>{this.status(t||this.i18n('File "%s" was deleted',e),!0)})).catch(this.status)}initUploader(){const e=this,t=(0,g.ConfigProto)(e.o.uploader||{},H.D.defaultOptions.uploader),s=()=>this.loadingManager.loadItems();e.uploader=e.getInstance("Uploader",t),e.uploader.bind(e.panel.container,s,e.status),e.e.on("bindUploader.filebrowser",(t=>{e.uploader.bind(t,s,e.status)}))}destruct(){this.removeGlobalListeners(),this.header.destruct(),this.panel.destruct(),super.destruct()}fullFillOptions(){["getLocalFileByUrl","crop","resize","create","fileMove","folderMove","fileRename","folderRename","fileRemove","folderRemove","folder","items","permissions"].forEach((e=>{null!=this.options[e]&&(this.options[e]=(0,g.ConfigProto)(this.options[e],this.o.ajax))}))}};(0,n.gn)([d.autobind],Z.prototype,"status",null),(0,n.gn)([(0,d.watch)(":resize",window)],Z.prototype,"onResizeWindow",null),(0,n.gn)([(0,d.watch)(["state.currentPath","state.currentSource"])],Z.prototype,"onChangePath",null),(0,n.gn)([(0,d.watch)("state.theme")],Z.prototype,"onChangeTheme",null),(0,n.gn)([(0,d.watch)(":toggleSettings.filebrowser")],Z.prototype,"onToggleSettings",null),(0,n.gn)([d.autobind],Z.prototype,"onKeyPress",null),(0,n.gn)([d.autobind],Z.prototype,"removeGlobalListeners",null),(0,n.gn)([(0,d.watch)(":fileRemove.filebrowser")],Z.prototype,"onFileRemove",null),(0,n.gn)([(0,d.watch)(":edit.filebrowser")],Z.prototype,"onFileEdit",null),(0,n.gn)([(0,d.watch)(":folderRename.filebrowser")],Z.prototype,"onFolderRename",null),(0,n.gn)([(0,d.watch)(":folderRemove.filebrowser")],Z.prototype,"onFolderRemove",null),(0,n.gn)([(0,d.watch)(":folderCreate.filebrowser")],Z.prototype,"onFolderCreate",null),(0,n.gn)([(0,d.watch)(":fileRename.filebrowser")],Z.prototype,"onFileRename",null),(0,n.gn)([(0,d.watch)(":select.filebrowser")],Z.prototype,"onChooseItems",null),(0,n.gn)([(0,d.watch)(":openLightBox.filebrowser")],Z.prototype,"onOpenLightBox",null),Z=(0,n.gn)([d.component,(0,d.derive)(U.lf)],Z),Object.defineProperty(G.Jodit.modules,"FileBrowserPro",{value:Z,writable:!1,enumerable:!0,configurable:!0}),(0,s(58706).xl)(s(91190));const Q=H.D.prototype.controls.filebrowser;Q.settings={icon:"settings",tooltip:"Settings",exec(e){var t;(null!==(t=e.parent)&&void 0!==t?t:e).e.fire("toggleSettings.filebrowser")}},Q.home={icon:"home",tooltip:"Home",exec(e){e.e.fire("goHome.filebrowser")}},Q.preview={icon:"eye",tooltip:"Preview",isDisabled:e=>0===e.state.activeElements.length,exec(e){e.e.fire("togglePreview.filebrowser")}},Q.next={icon:"angle-right",tooltip:"History next",isDisabled(e){return!e.historyManager.canNext()},exec(e){e.historyManager.next()}},Q.previous={icon:"angle-left",tooltip:"History previous",isDisabled(e){return!e.historyManager.canPrevious()},exec(e){e.historyManager.previous()}},Q["new-folder"]={icon:"new-folder",exec(e){e.e.fire("folderCreate.filebrowser",{path:e.state.currentPath,sourceName:e.state.currentSource})},tooltip:"New folder"},Object.assign(H.D.prototype.filebrowser,{buttons:["filebrowser.home","filebrowser.previous","filebrowser.next","|","filebrowser.upload","filebrowser.new-folder","filebrowser.remove","filebrowser.update","filebrowser.select","filebrowser.edit","|","filebrowser.preview","about"],sort:!1,pixelOffsetLoadNewChunk:200,width:780,height:400,previewOfficeURL:"https://view.officeapps.live.com/op/view.aspx?src="});class ee extends i.S{constructor(){super(...arguments),this.requires=["license"],this.hasStyle=!G.Jodit.fatMode}afterInit(e){e.e.on("getInstanceFileBrowser",(e=>(this.__instance||(this.__instance=new Z(e)),this.__instance)))}beforeDestruct(e){var t;e.e.off("getInstanceFileBrowser"),null===(t=this.__instance)||void 0===t||t.destruct()}}G.Jodit.plugins.add("finder",ee)},91190(e,t,s){"use strict";s.r(t),s.d(t,{ru(){return i}});const i=s(99425)},70655(e,t,s){"use strict";function i(e,t,s,i){var n,o=arguments.length,a=3>o?t:null===i?i=Object.getOwnPropertyDescriptor(t,s):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)a=Reflect.decorate(e,t,s,i);else for(var r=e.length-1;r>=0;r--)(n=e[r])&&(a=(3>o?n(a):o>3?n(t,s,a):n(t,s))||a);return o>3&&a&&Object.defineProperty(t,s,a),a}s.d(t,{gn(){return i}})},99425(e){e.exports={Favorites:"Избранное",Settings:"Настройки",Light:"Светлая",Dark:"Темная",Theme:"Тема",Show:"Показать",Hide:"Скрыть","Show favorites":"Показывать избранное",Tiles:"Плитка",List:"Список",Compact:"Компактный",View:"Отображение","Folders position":"Позиция папок","Sort by":"Сортировать по","Extra small":"Очень маленькие",Small:"Маленькие",Large:"Большие","Extra large":"Очень большие","Tile size":"Размер плитки"}},21601(e){e.exports='<svg viewBox="0 0 512 512" xmlns="http://www.w3.org/2000/svg"> <path d="M365.4,59.628c60.56,0,109.6,49.03,109.6,109.47c0,109.47-109.6,171.8-219.06,281.271 C146.47,340.898,37,278.568,37,169.099c0-60.44,49.04-109.47,109.47-109.47c54.73,0,82.1,27.37,109.47,82.1 C283.3,86.999,310.67,59.628,365.4,59.628z"/> </svg>'},67101(e){e.exports='<svg viewBox="0 0 32 32" xmlns="http://www.w3.org/2000/svg"> <path d="M28.7,16.3l-12-13c-0.4-0.4-1.1-0.4-1.5,0l-12,13C3,16.6,2.9,17,3.1,17.4C3.2,17.8,3.6,18,4,18h3v10c0,0.6,0.4,1,1,1h16 c0.6,0,1-0.4,1-1V18h3c0.4,0,0.8-0.2,0.9-0.6C29.1,17,29,16.6,28.7,16.3z"/> </svg>'},34839(e){e.exports='<svg viewBox="0 0 252 252" xmlns="http://www.w3.org/2000/svg"> <path d="M0 16C0 7.16344 7.16344 0 16 0H85.6364C86.5205 0 87.3797 0.29288 88.0796 0.832871L120.92 26.1671C121.62 26.7071 122.48 27 123.364 27H227C235.837 27 243 34.1634 243 43V132.335C243 134.779 240.234 136.198 238.25 134.772L233 131L226.5 127L220 124L212.5 122L202.5 120L189 120.5L179.5 122.5L170.5 125.5L161.5 130.5L157 133.5L153 137L146.5 144L141 152L137 160L134 168L132.5 178L132 183.5V189.5L133 197.5L135 205.5L137.5 211.5L139.524 214.996C141.068 217.663 139.144 221 136.062 221H16C7.16344 221 0 213.837 0 205V16Z"/> <circle cx="197" cy="185" r="56"/> <path d="M188.364 215.955V151.591H204.636V215.955H188.364ZM164.318 191.909V175.636H228.682V191.909H164.318Z" fill="white"/> </svg>'}},e=>e(e.s=73377)])}));