const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=[window.OC.filePath('text', '', 'js/PublicFilesEditor-MrIl9mGT.chunk.mjs'),window.OC.filePath('text', '', 'js/modulepreload-polyfill-Pz2ckkzf.chunk.mjs'),window.OC.filePath('text', '', 'js/emoji-picker-DlAAdvrL.chunk.mjs'),window.OC.filePath('text', '', 'js/NcNoteCard-ChweF_5Q-B9TcuHH8.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DfiDB3im.chunk.mjs'),window.OC.filePath('text', '', 'js/NcLoadingIcon-CHw5fok5.chunk.mjs'),window.OC.filePath('text', '', 'css/NcLoadingIcon-CFe6qyTF.chunk.css'),window.OC.filePath('text', '', 'js/vue.runtime.esm-C7aVrvtW.chunk.mjs'),window.OC.filePath('text', '', 'css/NcNoteCard-ChweF_5Q-DY8mPymx.chunk.css'),window.OC.filePath('text', '', 'js/_plugin-vue2_normalizer-wd1ZAbRr.chunk.mjs'),window.OC.filePath('text', '', 'js/RichWorkspace-njgtG9r7.chunk.mjs'),window.OC.filePath('text', '', 'js/index-y0wjO9Xi.chunk.mjs'),window.OC.filePath('text', '', 'js/Editor.singleton-CTpcNxyY.chunk.mjs'),window.OC.filePath('text', '', 'js/RichTextReader-DFvGjyUi.chunk.mjs'),window.OC.filePath('text', '', 'js/BaseReader-M0e0Vc2N.chunk.mjs'),window.OC.filePath('text', '', 'js/NcColorPicker-XDaKLzO9.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DawQzGlC.chunk.mjs'),window.OC.filePath('text', '', 'js/NcCheckboxRadioSwitch-ip_mRd2T-kNk9kCSa.chunk.mjs'),window.OC.filePath('text', '', 'css/NcCheckboxRadioSwitch-ip_mRd2T-Bebqso8K.chunk.css'),window.OC.filePath('text', '', 'js/MediaHandler.provider-_u2LRYyP.chunk.mjs'),window.OC.filePath('text', '', 'js/logger-Bvti-6nU.chunk.mjs'),window.OC.filePath('text', '', 'js/index-DJ2hczD-.chunk.mjs'),window.OC.filePath('text', '', 'css/NcColorPicker-DdkqwxF4.chunk.css'),window.OC.filePath('text', '', 'css/BaseReader-CsLFhfbT.chunk.css'),window.OC.filePath('text', '', 'css/RichTextReader-Bg06MJVH.chunk.css'),window.OC.filePath('text', '', 'css/RichWorkspace-Dn8GlGXa.chunk.css')])))=>i.map(i=>d[i]);
import{_ as f,g as w,e as h}from"./modulepreload-polyfill-Pz2ckkzf.chunk.mjs";import{g as y,s as A,a as F}from"./NcNoteCard-ChweF_5Q-B9TcuHH8.chunk.mjs";import{H as R,b as g,N as O,P as _,F as C}from"./index-D86mgGtX.chunk.mjs";import{h as D,c as H}from"./index-y0wjO9Xi.chunk.mjs";import{l as P}from"./index-DfiDB3im.chunk.mjs";import{V as T}from"./vue.runtime.esm-C7aVrvtW.chunk.mjs";import{b as m}from"./mime-CuxkK4Yj.chunk.mjs";import{s as V}from"./index-DawQzGlC.chunk.mjs";import"./emoji-picker-DlAAdvrL.chunk.mjs";import"./NcLoadingIcon-CHw5fok5.chunk.mjs";import"./index-DJ2hczD-.chunk.mjs";const N='<svg xmlns="http://www.w3.org/2000/svg" id="mdi-text" viewBox="0 0 24 24"><path d="M21,6V8H3V6H21M3,18H12V16H3V18M3,13H21V11H3V13Z" /></svg>',b="Edit with text app",G=()=>{const e=y(),r=document.querySelector("#preview table.files-filestable");if(!e||!r){const i=document.createElement("div");i.id="text-viewer-fallback",document.body.appendChild(i);const n=o=>OCA.Files.fileActions.register(o,b,OC.PERMISSION_UPDATE|OC.PERMISSION_READ,D("core","actions/rename"),c=>{const d=window.FileList.findFile(c);Promise.all([f(()=>import("./vue.runtime.esm-C7aVrvtW.chunk.mjs").then(a=>a.z),[],import.meta.url),f(()=>import("./PublicFilesEditor-MrIl9mGT.chunk.mjs"),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9]),import.meta.url)]).then(a=>{const x=window.FileList.getCurrentDirectory()+"/"+c,p=a[0].default;p.prototype.t=window.t,p.prototype.n=window.n,p.prototype.OCA=window.OCA;const E=a[1].default;new p({render:function(I){const v=this;return I(E,{props:{fileId:d?d.id:null,active:!0,shareToken:e,relativePath:x,mimeType:d.mimetype},on:{close:function(){v.$destroy()}}})}}).$mount(i)})},t("text","Edit"));for(let o=0;o<m.length;o++)n(m[o]),OCA.Files.fileActions.setDefault(m[o],b)}},J=()=>{const e=t("text","Readme")+"."+P("text","default_file_extension");g({id:"rich-workspace-init",displayName:t("text","Add folder description"),category:O.Other,enabled(r){return Number(r.attributes["rich-workspace-file"])?!1:(r.permissions&_.CREATE)!==0},iconSvgInline:N,async handler(r,i){if(i.map(a=>a.basename).includes(e)){A(t("text",'"{name}" already exist!',{name:e}));return}const n=r.encodedSource+"/"+encodeURIComponent(e),o=await H({method:"PUT",url:n,headers:{Overwrite:"F"}}),c=parseInt(o.headers["oc-fileid"]),d=new C({source:r.source+"/"+e,id:c,mtime:new Date,mime:"text/markdown",owner:w()?.uid||null,permissions:_.ALL,root:r?.root||"/files/"+w()?.uid});F(t("text",'Created "{name}"',{name:e})),r.attributes["rich-workspace-file"]=c,r.attributes["rich-workspace"]="",h("files:node:created",d),h("files:node:updated",r)}})};let u,s,l;const k=(e,r)=>["files","favorites","public-share"].includes(r.id),K=new R({id:"workspace",order:10,enabled:k,render:async(e,r)=>{l=r,u||(u=(await f(()=>import("./RichWorkspace-njgtG9r7.chunk.mjs"),__vite__mapDeps([10,11,1,2,7,3,4,5,6,8,12,13,14,15,9,16,17,18,19,20,21,22,23,24,25]),import.meta.url)).default),s&&(s.$destroy(),console.debug("Destroying existing FilesHeaderRichWorkspaceInstance"));const i=!!l.attributes["rich-workspace-file"],n=l.attributes["rich-workspace"]||"",o=l.path||"";s=new T({extends:u,propsData:{content:n,hasRichWorkspace:i,path:o},store:V}).$mount(e),window.FilesHeaderRichWorkspaceInstance=s},updated(e,r){if(l=e,!s){console.error("No vue instance found for FilesWorkspaceHeader");return}const i=!!e.attributes["rich-workspace-file"]&&k(e,r);s.hasRichWorkspace=i,s.content=e.attributes["rich-workspace"]||"",s.path=e.path||""}});export{b as FILE_ACTION_IDENTIFIER,K as FilesWorkspaceHeader,J as addMenuRichWorkspace,G as registerFileActionFallback};
//# sourceMappingURL=files-BpToyS6e.chunk.mjs.map
