import{V as e}from"./vue.runtime.esm-DO2cz8pp.chunk.mjs";import{c as d}from"./index-BGFdrNqh.chunk.mjs";import{a6 as a}from"./RichText-Bl8j_FW5.chunk.mjs";import{t as r,h as s,a as m}from"./public-BYOpgJit.chunk.mjs";import{P as i}from"./PlainTextReader-LkxnwARb.chunk.mjs";import n from"./MarkdownContentEditor-iRxt5bp4.chunk.mjs";import{g as l}from"./token-DsHNcSTq.chunk.mjs";import{g as u}from"./Editor.singleton-C6k3N5XS.chunk.mjs";import{n as c}from"./_plugin-vue2_normalizer-Ek9LosZJ.chunk.mjs";import"./modulepreload-polyfill-DE-oIJqv.chunk.mjs";import"./emoji-picker-KVqjnXYv.chunk.mjs";import"./index-Ct2iTpP3.chunk.mjs";import"./MediaHandler.provider-DkklcpwC.chunk.mjs";import"./logger-BOSm1sVH.chunk.mjs";import"./index-Bc2S5k6V.chunk.mjs";import"./_plugin-vue2_normalizer-CQ6iBklL-hCHD4uyV.chunk.mjs";import"./index-DfiDB3im.chunk.mjs";import"./BaseReader-B04z_9lh.chunk.mjs";import"./Wrapper-C9JggMep.chunk.mjs";import"./index-DxtbxZeP.chunk.mjs";e.prototype.t=r,e.prototype.n=s;const p={name:"ViewerComponent",components:{NcButton:e.extend(m),PencilIcon:e.extend(a),PlainTextReader:e.extend(i),MarkdownContentEditor:e.extend(n),Editor:u},provide(){return{isEmbedded:this.isEmbedded}},props:{filename:{type:String,default:null},fileid:{type:Number,default:null},active:{type:Boolean,default:!1},autofocus:{type:Boolean,default:!0},shareToken:{type:String,default:()=>l()},mime:{type:String,default:null},showOutlineOutside:{type:Boolean,default:!1},permissions:{type:String,default:""},source:{type:String,default:void 0},isEmbedded:{type:Boolean,default:!1}},data(){return{content:"",hasToggledInteractiveEmbedding:!1}},computed:{useSourceView(){return this.source&&(this.fileVersion||!this.fileid||this.isEmbedded)&&!this.hasToggledInteractiveEmbedding},readerComponent(){return this.mime==="text/markdown"?n:i}},watch:{source(){this.loadFileContent()}},mounted(){this.loadFileContent()},methods:{t:r,async loadFileContent(){if(this.useSourceView){const t=await d.get(this.source);this.content=t.data,this.contentLoaded=!0}this.$emit("update:loaded",!0)},toggleEdit(){this.hasToggledInteractiveEmbedding=!0}}};var f=function(){var t=this,o=t._self._c;return t.useSourceView?o("div",{staticClass:"text-editor source-viewer",attrs:{id:"editor-container","data-text-el":"editor-container"}},[o(t.readerComponent,{tag:"Component",attrs:{content:t.content,"file-id":t.fileid,"read-only":!0,"show-menu-bar":!1}}),t.isEmbedded?o("NcButton",{staticClass:"toggle-interactive",on:{click:t.toggleEdit},scopedSlots:t._u([{key:"icon",fn:function(){return[o("PencilIcon")]},proxy:!0}],null,!1,411976917)},[t._v(" "+t._s(t.t("text","Edit"))+" ")]):t._e()],1):o("Editor",{class:{"text-editor--embedding":t.isEmbedded},attrs:{"file-id":t.fileid,"relative-path":t.filename,active:t.active||t.isEmbedded,autofocus:t.autofocus,"share-token":t.shareToken,mime:t.mime,"show-outline-outside":t.showOutlineOutside}})},h=[],g=c(p,f,h,!1,null,"368f5325");const R=g.exports;export{R as default};
//# sourceMappingURL=ViewerComponent-yEvwhGiQ.chunk.mjs.map
