(self.webpackChunkrichdocuments=self.webpackChunkrichdocuments||[]).push([["src_view_Viewer_vue"],{55901:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var s=i(71354),o=i.n(s),n=i(76314),a=i.n(n)()(o());a.push([e.id,".confirmation-dialog[data-v-59370936]{display:flex;flex-direction:column;align-items:flex-start;margin:24px}.confirmation-dialog h1[data-v-59370936]{font-size:120%;font-weight:bold;margin-bottom:12px}.confirmation-dialog--buttons[data-v-59370936]{display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%;margin-top:24px}","",{version:3,sources:["webpack://./src/components/Modal/Confirmation.vue"],names:[],mappings:"AACA,sCACI,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,WAAA,CACA,yCACI,cAAA,CACA,gBAAA,CACA,kBAAA,CAGJ,+CACI,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,6BAAA,CACA,UAAA,CACA,eAAA",sourceRoot:""}]);const r=a},98109:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var s=i(71354),o=i.n(s),n=i(76314),a=i.n(n)()(o());a.push([e.id,".saveas-dialog[data-v-36c6412a]{display:flex;flex-direction:column;align-items:flex-start;margin:24px}.saveas-dialog h1[data-v-36c6412a]{font-size:120%;font-weight:bold;margin-bottom:12px}.saveas-dialog p[data-v-36c6412a]{margin-bottom:12px}.saveas-dialog--buttons[data-v-36c6412a]{display:flex;flex-direction:row;align-items:center;justify-content:space-between;width:100%;margin-top:24px}","",{version:3,sources:["webpack://./src/components/Modal/SaveAs.vue"],names:[],mappings:"AACA,gCACI,YAAA,CACA,qBAAA,CACA,sBAAA,CACA,WAAA,CAEH,mCACO,cAAA,CACA,gBAAA,CACA,kBAAA,CAGP,kCACC,kBAAA,CAGE,yCACI,YAAA,CACA,kBAAA,CACA,kBAAA,CACA,6BAAA,CACA,UAAA,CACA,eAAA",sourceRoot:""}]);const r=a},72281:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var s=i(71354),o=i.n(s),n=i(76314),a=i.n(n)()(o());a.push([e.id,".zotero-hint[data-v-f3a018ec]{margin:24px}.zotero-hint form[data-v-f3a018ec],.zotero-hint .input-field[data-v-f3a018ec]{margin-top:24px}.zotero-hint div.submit[data-v-f3a018ec]{margin-top:12px;display:flex;justify-content:end}","",{version:3,sources:["webpack://./src/components/Modal/ZoteroHint.vue"],names:[],mappings:"AACA,8BACC,WAAA,CAEA,8EACC,eAAA,CAGD,yCACC,eAAA,CACA,YAAA,CACA,mBAAA",sourceRoot:""}]);const r=a},2889:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var s=i(71354),o=i.n(s),n=i(76314),a=i.n(n)()(o());a.push([e.id,".office-viewer[data-v-c4f5812c]{z-index:100000;max-width:100%;display:flex;flex-direction:column;background-color:var(--color-main-background)}.office-viewer__loading-overlay[data-v-c4f5812c]:not(.viewer__file--hidden){border-top:3px solid var(--color-primary-element);display:flex;height:100%;width:100%;z-index:1;top:0;left:0;background-color:var(--color-main-background)}.office-viewer__loading-overlay:not(.viewer__file--hidden).debug[data-v-c4f5812c]{opacity:.5}.office-viewer__loading-overlay[data-v-c4f5812c]:not(.viewer__file--hidden) .empty-content p{text-align:center}.office-viewer__loading-overlay:not(.viewer__file--hidden) .empty-content[data-v-c4f5812c]{align-self:center;flex-grow:1}.office-viewer__embedding[data-v-c4f5812c]{min-height:400px}.office-viewer__embedding .toggle-interactive[data-v-c4f5812c]{position:sticky;bottom:12px;right:12px;z-index:1;margin-left:auto;margin-right:0}.office-viewer__iframe[data-v-c4f5812c]{width:100%;flex-grow:1}","",{version:3,sources:["webpack://./src/view/Office.vue"],names:[],mappings:"AACA,gCACC,cAAA,CACA,cAAA,CACA,YAAA,CACA,qBAAA,CACA,6CAAA,CAEA,4EACC,iDAAA,CACA,YAAA,CACA,WAAA,CACA,UAAA,CACA,SAAA,CACA,KAAA,CACA,MAAA,CACA,6CAAA,CACA,kFACC,UAAA,CAGD,6FACC,iBAAA,CAGD,2FACC,iBAAA,CACA,WAAA,CAIF,2CACC,gBAAA,CAEA,+DACC,eAAA,CACA,WAAA,CACA,UAAA,CACA,SAAA,CACA,gBAAA,CACA,cAAA,CAIF,wCACC,UAAA,CACA,WAAA",sourceRoot:""}]);const r=a},33705:(e,t,i)=>{"use strict";i.d(t,{A:()=>r});var s=i(71354),o=i.n(s),n=i(76314),a=i.n(n)()(o());a.push([e.id,".viewer__content:not(.viewer--split) .office-viewer:not(.viewer__file--hidden):not(.widget-file){width:100%;height:100vh;height:100dvh;top:-50px;position:absolute}[data-handler=richdocuments] .modal-container{bottom:0}.viewer__content.viewer--split .office-viewer{height:100%;width:100%}","",{version:3,sources:["webpack://./src/view/Office.vue"],names:[],mappings:"AACA,iGACC,UAAA,CACA,YAAA,CACA,aAAA,CACA,SAAA,CACA,iBAAA,CAGD,8CACC,QAAA,CAGD,8CACC,WAAA,CACA,UAAA",sourceRoot:""}]);const r=a},11015:(e,i,s)=>{"use strict";s.r(i),s.d(i,{default:()=>Ge});var o=s(85471),a=s(16502),r=s(74095),l=s(42507),c=s(88289),d=s(73076),h=s(81222),u=s(46787),m=s(42486),p=s(82182),g=s(10867),f=s(66802),A=s(63814);const v={name:"ZoteroHint",components:{BookOpenPageVariantOutline:g.A,NcModal:m.A,NcButton:r.A,NcTextField:p.A},props:{show:{type:Boolean,default:!1}},emits:["submit"],data:()=>({apiKey:""}),methods:{async submit(){try{await(e={zoteroAPIKeyInput:this.apiKey},f.Ay.post((0,A.fg)("richdocuments","ajax","personal.php"),e))}catch(e){console.error("Failed to set zotero api key",e),(0,u.Qg)(t("richdocuments","Failed to set Zotero API key"))}var e;this.$emit("submit"),this.close()},close(){this.$emit("update:show",!1)}}};var y=s(85072),w=s.n(y),C=s(97825),_=s.n(C),b=s(77659),k=s.n(b),F=s(55056),I=s.n(F),M=s(10540),x=s.n(M),P=s(41113),S=s.n(P),N=s(72281),L={};L.styleTagTransform=S(),L.setAttributes=I(),L.insert=k().bind(null,"head"),L.domAPI=_(),L.insertStyleElement=x();w()(N.A,L);N.A&&N.A.locals&&N.A.locals;var T=s(14486);const O=(0,T.A)(v,(function(){var e=this,t=e._self._c;return t("NcModal",{attrs:{show:e.show,name:e.t("richdocument","Link to your Zotero library")},on:{close:e.close}},[t("div",{staticClass:"zotero-hint"},[t("h2",[e._v(e._s(e.t("richdocument","Link to your Zotero library")))]),e._v(" "),t("BookOpenPageVariantOutline",{attrs:{size:96}}),e._v(" "),t("p",[e._v(e._s(e.t("richdocuments","Connect your Zotero account to make use of references within Office.")))]),e._v(" "),t("p",[e._v("\n\t\t\t"+e._s(e.t("richdocuments","You can generate an account key here:"))+"\n\t\t\t"),t("a",{staticClass:"external",attrs:{href:"https://www.zotero.org/settings/keys/new",target:"_blank"}},[e._v("\n\t\t\t\t"+e._s(e.t("richdocuments","Zotero account settings"))+"\n\t\t\t")])]),e._v(" "),t("form",{on:{submit:function(t){return t.preventDefault(),e.submit.apply(null,arguments)}}},[t("NcTextField",{attrs:{value:e.apiKey,label:e.t("richdocuments","Zotero API key"),placeholder:e.t("richdocuments","Zotero API key")},on:{"update:value":function(t){e.apiKey=t}}}),e._v(" "),t("div",{staticClass:"submit"},[t("NcButton",{attrs:{"aria-label":e.t("richdocuments","Submit"),type:"primary"},on:{click:e.submit}},[e._v("\n\t\t\t\t\t"+e._s(e.t("richdocuments","Submit"))+"\n\t\t\t\t")])],1)],1)],1)])}),[],!1,null,"f3a018ec",null).exports;var E=s(57975),R=s(53334),D=s(69058);(0,D.F)().mimetypes;const U=(e=5)=>Math.random().toString(36).replace(/[^a-z]+/g,"").slice(0,e||5);var B=function(){return B=Object.assign||function(e){for(var t,i=1,s=arguments.length;iH.get("wopi_callback_url")||window.location.protocol+"//"+window.location.host+(0,A.aU)(),W=({fileId:e,readOnly:t,closeButton:i,revisionHistory:s,target:o,startPresentation:n=!1})=>(s=s&&window?.oc_appswebroots?.files_versions,H.get("urlsrc")+"WOPISrc="+encodeURIComponent((e=>{const t=V()+"/index.php/apps/richdocuments/wopi/files/"+e;return console.debug("[getWopiUrl] "+t),t})(e))+"&lang="+(()=>{let e=(0,R.Z0)().replace(/_/g,"-");const t=(0,R.JK)();"de-DE"===e&&(e="de"),"es-419"===e&&(e="es-MX"),"en-GB"===e&&"en_AU"===t&&(e="en-AU");const i={de:{de_CH:"de-CH",gsw:"de-CH",gsw_CH:"de-CH"},fr:{fr_CH:"fr-CH"},it:{it_CH:"it-CH"}}[e];return void 0!==i&&void 0!==i[t]?i[t]:e})()+(i?"&closebutton=1":"")+(s?"&revisionhistory=1":"")+(t?"&permission=readonly":"")+(o?"&target="+encodeURIComponent(o):"")+(n?"&startPresentation=1":"")),G=()=>window.location.host;var z=s(53537);const q=function(){function e(e){var t=this;this.postMessageHandlers=[],this.targets=e,window.addEventListener("message",(function(e){t.handlePostMessage(e.data)}),!1)}return e.prototype.sendPostMessage=function(e,t,i){void 0===i&&(i="*"),("function"==typeof this.targets[e]?this.targets[e]():this.targets[e]).postMessage(t,i),console.debug("PostMessageService.sendPostMessage",e,t)},e.prototype.sendWOPIPostMessage=function(e,t,i){void 0===i&&(i={});var s={MessageId:t,SendTime:Date.now(),Values:i};this.sendPostMessage(e,JSON.stringify(s))},e.parsePostMessage=function(e){var t,i,s;try{var o=JSON.parse(e);t=o.MessageId,i=o.Values,s=!!o.Values.Deprecated}catch(i){t=e}return{msgId:t,args:i,deprecated:s}},e.prototype.registerPostMessageHandler=function(e){this.postMessageHandlers.push(e)},e.prototype.unregisterPostMessageHandler=function(e){var t=this.postMessageHandlers.findIndex((function(t){return t===e}));delete this.postMessageHandlers[t]},e.prototype.handlePostMessage=function(t){var i=e.parsePostMessage(t);if(null!=i){try{var s=JSON.parse(t);"object"==typeof s&&null!==s&&(0,z.Ic)("richdocuments:wopi-post",s)}catch(e){}this.postMessageHandlers.forEach((function(e){if(i.deprecated)console.debug("PostMessageService.handlePostMessage","Ignoring deprecated post message",i.msgId);else try{e({data:t,parsed:i})}catch(e){console.error("Error during post message handler",i,e)}}))}},e}();var Z=s(21777),j=s(32505);var K=s(35810),J=s(77815);const Y={name:"SaveAs",components:{NcModal:m.A,NcButton:r.A,NcTextField:p.A},props:{name:{type:String,default:(0,R.Tl)("richdocuments","Save As")},description:{type:String,default:""},buttonText:{type:String,default:(0,R.Tl)("richdocuments","Save")},path:{type:String,default:""},format:{type:String,default:""}},emits:["close"],data:()=>({selectedPath:""}),computed:{newFileName:{get(){if(""!==this.selectedPath)return this.selectedPath;const e=this.path,t=e.split(".").pop();return e.substring(0,e.length-t.length-1)+"."+(""!==this.format?this.format:t)},set(e){this.selectedPath=e}}},mounted(){const e=this.path,t=e.split(".").pop(),i=e.substring(0,e.length-t.length-1);this.$nextTick((()=>{const e=this.$refs.nameInput.$refs.inputField.$el.querySelector("input");e.setSelectionRange(0,i.length),e.focus()}))},methods:{t:R.Tl,close(){this.$emit("close",this.newFileName)},cancel(){this.$emit("close",null)}}};var Q=s(98109),X={};X.styleTagTransform=S(),X.setAttributes=I(),X.insert=k().bind(null,"head"),X.domAPI=_(),X.insertStyleElement=x();w()(Q.A,X);Q.A&&Q.A.locals&&Q.A.locals;const ee=(0,T.A)(Y,(function(){var e=this,t=e._self._c;return t("NcModal",{attrs:{name:e.t("richdocuments","Save as")}},[t("div",{staticClass:"saveas-dialog"},[t("h1",[e._v(e._s(e.name))]),e._v(" "),t("p",[e._v(e._s(e.description))]),e._v(" "),t("NcTextField",{ref:"nameInput",attrs:{"label-visible":!0,label:e.t("richdocuments","Path to save"),placeholder:"/path/to/save"},model:{value:e.newFileName,callback:function(t){e.newFileName=t},expression:"newFileName"}}),e._v(" "),t("div",{staticClass:"saveas-dialog--buttons"},[t("NcButton",{attrs:{type:"secondary"},on:{click:e.cancel}},[e._v("\n\t\t\t\t"+e._s(e.t("richdocuments","Cancel"))+"\n\t\t\t")]),e._v(" "),t("NcButton",{attrs:{type:"primary"},on:{click:e.close}},[e._v("\n\t\t\t\t"+e._s(e.t("richdocuments","Save"))+"\n\t\t\t")])],1)],1)])}),[],!1,null,"36c6412a",null).exports,te={fileNode:void 0,fileModel:null,fileList:void 0,filePath:void 0,views:{},followingEditor:!1,following:null,handlers:{},startLoading(){this.getFileList()&&(this.getFileList().setViewerMode&&this.getFileList().setViewerMode(!0),this.getFileList().showMask&&this.getFileList().showMask())},init({fileName:e,fileId:t,filePath:i,sendPostMessage:s,fileList:o,fileModel:n}){this.fileNode=void 0,this.fileName=e,this.fileId=t,this.fileList=o,this.filePath=i,this.fileModel=n,this.sendPostMessage=s,this.fileModel&&this.fileModel.on&&this.fileModel.on("change",(()=>{this._addHeaderFileActions()})),this.getFileNode(!0)},registerHandler(e,t){this.handlers[e]=t},initAfterReady(){this.handlers.initAfterReady&&this.handlers.initAfterReady(this)||this.getFileList()&&(this.getFileModel(),this.getFileList().hideMask&&this.getFileList().hideMask(),this.getFileList().setPageTitle&&this.getFileList().setPageTitle(this.fileName))},close(){this.handlers.close&&this.handlers.close(this)||(this.fileModel=null,$("#richdocuments-header").remove())},async saveAs(e){const t=this.getFileModel();if(this.handlers.saveAs&&this.handlers.saveAs(this))return;e&&(this.fileName=e);const i=await this.getFileNode(!0);if(i&&(this.changeFilesRoute(i.fileid),(0,K.dC)()?.close(),this.getFileList())){const s=t.clone();s.set("id",i.fileid),s.set("name",e),s.set("mtime",Date.now()),this.getFileList().add(s.toJSON())}},async share(){if(this.handlers.share&&this.handlers.share(this))return;if((0,j.f)())return void console.error("[FilesAppIntegration] Sharing is not supported");const e=await this.getFileNode(),t=(0,K.dC)();t?.open(e),t?.setActiveTab("sharing")},rename(e){this.updateFileInfo(e,Date.now()),this.fileName=e,this.handlers.rename&&this.handlers.rename(this)||this.getFileList()&&(0,K.dC)()?.close()},insertFile_impl(e,i,s){(0,j.f)()&&console.error("[FilesAppIntegration] insertFile is not supported");const o=async e=>{const t=e.substring(e.lastIndexOf("/")+1),{data:s}=await f.Ay.post((0,A.Jv)("apps/richdocuments/assets"),{path:e});i(t,s.url)};s&&s(this,e,{insertFileFromPath:o})||(0,u.a1)(t("richdocuments","Insert file from {name}",{name:OC.theme.name})).setMimeTypeFilter(e).setFilter((e=>{const t=JSON.parse(e.attributes["share-attributes"]).find((e=>"download"===e.key)),i=void 0===t||(t.enabled||t.value);return e.permissions&OC.PERMISSION_READ&&i})).addButton({label:t("richdocuments","Insert file"),callback:e=>{e&&e.length&&o(e[0].path)}}).build().pick()},insertGraphic(e){this.insertFile_impl(["image/png","image/gif","image/jpeg","image/svg"],e,((e,t,{insertFileFromPath:i})=>this.handlers.insertGraphic&&this.handlers.insertGraphic(e,{insertFileFromPath:i})))},insertFile(e,t){this.insertFile_impl(e,t,this.handlers.insertFile)},getFileList(){return this.fileList?this.fileList:OCA.Files&&OCA.Files.App?OCA.Files.App.fileList:OCA.Sharing&&OCA.Sharing.PublicApp?OCA.Sharing.PublicApp.fileList:null},getFileModel(){if(this.fileModel)return this.fileModel;if(!this.getFileList()||!this.getFileList().getModelForFile||!this.getFileList()._updateDetailsView)return null;try{this.getFileList()._updateDetailsView(this.fileName,!1),this.fileModel=this.getFileList().getModelForFile(this.fileName),this.fileModel&&this.fileModel.on&&this.fileModel.on("change",(()=>{this._addHeaderFileActions()}))}catch(e){return null}return this.fileModel},setViews(e){this.views={},e.forEach((e=>{this.views[e.ViewId]=e})),this.renderAvatars()},followReset(e){this.sendPostMessage("Action_FollowUser",{Follow:!1}),this.following=null,this.followingEditor=!1,this.renderAvatars()},followCurrentEditor(e){this.sendPostMessage("Action_FollowUser",{Follow:!0}),this.following=null,this.followingEditor=!0,this.renderAvatars()},followView(e){this.sendPostMessage("Action_FollowUser",{ViewId:e.ViewId,Follow:!0}),this.following=e.ViewId,this.followingEditor=!1,this.renderAvatars()},_addHeaderFileActions(){console.debug("[FilesAppIntegration] Adding header file actions"),OC.unregisterMenu($("#richdocuments-actions .icon-more"),$("#richdocuments-actions-menu")),$("#richdocuments-actions").remove();const e=Boolean(window?.OCA?.Theming?.inverted),i=$('
'),s=i.find("#richdocuments-actions-menu").empty(),o=()=>({$file:this.getFileList().$el?this.getFileList().$el.find("[data-id="+this.fileId+"]").first():null,fileActions:this.getFileList().fileActions,fileList:this.getFileList(),fileInfoModel:this.getFileModel()}),n=$("
  • ").click((e=>{n.find("a").removeClass("icon-starred").removeClass("icon-star-dark").addClass("icon-loading-small"),this.handlers.actionFavorite&&this.handlers.actionFavorite(this)||(this.getFileList().fileActions.triggerAction("Favorite",this.getFileModel(),this.getFileList()),this.getFileModel().trigger("change",this.getFileModel()))}));var a;(a=this.getFileModel()).get("tags")&&a.get("tags").indexOf(OC.TAG_FAVORITE)>=0?(n.find("a").text(t("files","Remove from favorites")),n.find("a").addClass("icon-starred")):(n.find("a").text(t("files","Add to favorites")),n.find("a").addClass("icon-star-dark"));const r=$('
  • ').click((()=>{this.handlers.actionDetails&&this.handlers.actionDetails(this)||(this.getFileList().fileActions.actions.all.Details.action(this.fileName,o()),OC.hideMenus())}));r.find("a").text(t("files","Details"));const l=$('
  • Download
  • ').click((()=>{this.handlers.actionDownload&&this.handlers.actionDownload(this)||(this.getFileList().fileActions.actions.all.Download.action(this.fileName,o()),OC.hideMenus())}));l.find("a").text(t("files","Download")),s.append(n).append(r).append(l),$("#richdocuments-header").append(i),OC.registerMenu($("#richdocuments-actions .icon-more"),$("#richdocuments-actions-menu"),!1,!0)},_userEntry(e){const i=$("
  • ");i.append(this._avatarForView(e));const s=$('
    ');s.text(e.UserName),"1"===e.ReadOnly&&s.text(e.UserName+" "+t("richdocuments","(read only)")),s.click((t=>{t.stopPropagation(),this.followView(e)})),this.following===e.ViewId&&($("#editors-menu").find("li").removeClass("active"),i.addClass("active")),i.append(s);const o=!(0,j.f)()&&this.getFileModel()&&void 0===this.getFileModel().get("shareOwner"),n=this.getFileModel()&&!!(this.getFileModel().get("permissions")&OC.PERMISSION_UPDATE);if(o&&n&&!e.IsCurrentView){const s=$('
    ');s.click((()=>{this.sendPostMessage("Action_RemoveView",{ViewId:e.ViewId})})),i.append(s)}return i},_avatarForView(e){const i=""===e.UserId?e.UserName:e.UserId,s=$('
    '),o=s.find(".avatar");return o.css({borderColor:"#"+("000000"+Number(e.Color).toString(16)).slice(-6),borderWidth:"2px",borderStyle:"solid"}),"1"===e.ReadOnly?(s.addClass("read-only"),$(o).attr("title",e.UserName+" "+t("richdocuments","(read only)"))):$(o).attr("title",e.UserName),$(o).avatar(i,32,void 0,!0,void 0,e.UserName),s},renderAvatars(){const e=$("#header .header-right #richdocuments-avatars");e.empty();const i=$('
      '),s=[];let o=0;for(const n in this.views){const a=this.views[n];a.UserName=""!==a.UserName?a.UserName:t("richdocuments","Guest"),i.find("ul").append(this._userEntry(a)),a.UserId!==(0,Z.HW)()?.uid&&(""!==a.UserId&&s.indexOf(a.UserId)>-1||(s.push(a.UserId),o++<4&&e.append(this._avatarForView(a))))}const n=$('
    • ");n.find("label").click((e=>{e.stopPropagation(),this.followingEditor?this.followReset():this.followCurrentEditor()})),n.find(".checkbox").prop("checked",this.followingEditor),i.find("ul").append(n),e.append(i)},async showRevHistory(){if(this.handlers.showRevHistory&&this.handlers.showRevHistory(this))return;if((0,j.f)())return void console.error("[FilesAppIntegration] Versions are not supported");const e=await this.getFileNode(),t=(0,K.dC)();t?.open(e),t?.setActiveTab("files_versions")},createNewFile(e){this.handlers.createNewFile&&this.handlers.createNewFile(this,{type:e})||(0,u.Ss)(ee,{name:t("richdocuments","New file"),description:t("richdocuments","Please enter the filename for the new file"),buttonText:t("richdocuments","Create")},(t=>{if(t){"text"===e&&(e="document");const i=(0,A.Jv)("/apps/files/?dir="+(OCA.Sharing?.PublicApp?OCA.Sharing.PublicApp.fileList.getCurrentDirectory():OCA.Files.App.currentFileList.getCurrentDirectory())+"&richdocuments_create="+e+"&richdocuments_filename="+encodeURI(t));window.open(i,"_blank")}}))},loggingContext(){return{currentUser:(0,Z.HW)()?.uid,file:{sharingToken:document.getElementById("sharingToken")?.value,fileId:this.fileId,filePath:(this.filePath??"")+"/"+this.fileName}}},async updateFileInfo(e,t){const i=await this.getFileNode();i&&(e&&(i.rename(e),(0,z.Ic)("files:node:renamed",this.source)),t&&(i._data.mtime=new Date(t)),(0,z.Ic)("files:node:updated",i));const s=this.getFileModel();s&&(e&&s.set("name",e),t&&s.set("mtime",t),s.trigger("change",this.getFileModel()))},async getFileNode(e=!1){if(!(0,j.f)()){if(void 0!==this.fileNode&&!e)return this.fileNode;try{const e=this.filePath+"/"+this.fileName,t=(0,J.KU)(),i=(await t.getDirectoryContents(`${J.VA}${e}`,{details:!0,data:(0,J.aN)()})).data.map((e=>(0,J.pO)(e)));this.fileNode=i[0]??null}catch(e){console.error("Failed to fetch file metadata from webdav",e),this.fileNode=null}return this.fileNode}},async createNodeForNewFile(e){if(!(0,j.f)())try{const t=`${this.filePath}/${e}`,i=(0,J.KU)(),s=(await i.getDirectoryContents(`${J.VA}${t}`,{details:!0,data:(0,J.aN)()})).data.map((e=>(0,J.pO)(e)));s[0]?(console.debug("[FilesAppIntegration] Emitting files:node:created for",e),(0,z.Ic)("files:node:created",s[0])):console.warn("[FilesAppIntegration] New file not found:",e)}catch(e){console.error("Failed to fetch new file metadata from webdav",e)}},changeFilesRoute(e){OCP?.Files?.Router?.goToRoute(OCP.Files.Router.name,{...OCP.Files.Router.params,fileid:e},OCP.Files.Router.query,!0)}},ie=1,se=2;let oe=0;const ne=async(e,i)=>{const s=(0,D.F)()?.config?.wopi_url;if(-1===s.indexOf("proxy.php"))return!0;const o=s.slice(0,s.indexOf("proxy.php")+9)+"?status",n=async(e,i)=>{const s=await f.Ay.get(o);return s&&s?.data?.status||i("Failed to contact status endpoint"),"OK"===s.data.status?e(!0):"error"===s.data.status?i(t("richdocuments","Built-in CODE server failed to start")):void(oe<3&&("starting"===s.data.status||"stopped"===s.data.status||"restarting"===s.data.status)?setTimeout((()=>{oe++,ne(e,i)})):i("Maximum retries reached"))};return i&&e?n(i,e):new Promise(n)};let ae,re=!1;const le=()=>{re&&(document.documentElement.scrollTop=0,document.scrollingElement.scrollTop=0,(()=>{const e=window.visualViewport.height??document.documentElement.clientHeight,t=document.getElementsByClassName("office-viewer__iframe");for(const i of t)i.style.maxHeight=e+"px";const i=document.querySelector(".office-viewer");i&&(i.style.height=e+"px")})())},ce=e=>e.preventDefault(),de=()=>{let e="TextRuler=false;";return e+="TextSidebar=false;TextStatusbar=true;",e+="PresentationSidebar=false;PresentationStatusbar=true;",e+="SpreadsheetSidebar=false;SpreadsheetStatusbar=true;",e+="UIMode="+((0,h.C)("richdocuments","uiDefaults",{}).UIMode??"notebookbar")+";",e+="UITheme="+he()+";",e+="SaveAsMode=group;",e},he=()=>{const e=window.matchMedia&&window.matchMedia("(prefers-color-scheme: dark)").matches;let t={};try{t=(document.body.dataset.themes?document.body.dataset:parent?.document.body.dataset)??{}}catch(e){}const i=""===t?.themeDark||""===t?.themeDarkHighcontrast;return(t?.themes&&""!==t?.themes&&""!==t?.themeDefault?i:e)?"dark":"light"},ue=(e,t)=>{const i=document.createElement(e);return i.setAttribute("id","cool-var-source-"+t),i.setAttribute("data-theme-"+t,""),document.body.appendChild(i),i},me=(e=!1)=>{const t={"--color-primary-element-text":"--co-primary-text:--co-settings-btn-primary-text","--color-primary-element":"--co-primary-element:--co-text-accent:--co-settings-btn-primary","--color-primary-element-light":"--co-primary-light:--co-primary-element-light:--co-settings-btn-light","--color-error":"--co-color-error","--color-warning":"--co-color-warning","--color-success":"--co-color-success","--border-radius":"--co-border-radius","--border-radius-large":"--co-border-radius-large","--color-loading-light":"--co-loading-light","--color-loading-dark":"--co-loading-dark","--color-box-shadow":"--co-box-shadow","--color-border":"--co-border:--co-settings-border","--color-border-dark":"--co-border-dark:--co--settings-border-contrast","--border-radius-pill":"--co-border-radius-pill","--color-primary-element-light-text":"--co-settings-btn-light-text","--color-main-text":"--co-settings-text","--color-text-maxcontrast":"--co-settings-text-maxcontrast","--color-main-background":"--co-settings-background","--color-background-hover":"--co-settings-background-hover"};let i="";const s=ue("div","light"),o=ue("div","dark");let n=s;e&&(n="dark"===he()?o:s);try{for(const e in t){let s=window.getComputedStyle(n).getPropertyValue(e);if(s||(s=window.getComputedStyle(n).getPropertyValue(e+"-dark")),!s)continue;const o=t[e].split(":");for(let e=0;e({autoLogoutInterval:null,autoLogoutRegistered:!1}),mounted(){(0,Z.HW)()&&(!pe?.auto_logout&&pe?.session_keepalive||(this.autoLogoutInterval=setInterval(this.registerCheck,1e4)))},beforeDestroy(){this.autoLogoutInterval&&clearInterval(this.autoLogoutInterval)},methods:{extendAutoLogout(){const e=localStorage.getItem("lastActive"),t=Date.now().toString();localStorage.setItem("lastActive",t);const i=new StorageEvent("storage",{key:"lastActive",oldValue:e,newValue:t});window.dispatchEvent(i)},registerCheck(){!this.autoLogoutRegistered&&this.postMessage&&(this.postMessage.registerPostMessageHandler(this.handleGetUserStateResponse),this.autoLogoutRegistered=!0),this.autoLogoutRegistered&&this.postMessage&&this.sendPostMessage("Get_User_State")},handleGetUserStateResponse({parsed:{msgId:e,args:t}}){if("Get_User_State_Resp"!==e)return;const i=t.Elapsed,s=Number(localStorage.getItem("lastActive")),o=Date.now()-s,n=1e3*(()=>{const e=pe.session_lifetime?Math.floor(pe.session_lifetime/2):900;return Math.min(86400,Math.max(60,e))})();!pe.session_keepalive&&o>n&&f.Ay.get((0,A.Jv)("/apps/richdocuments/heartbeat")),i<30&&(console.debug("[richdocuments] Extending auto logout timeout, office idle since "+i,o,n,o>n),this.extendAutoLogout())}}};var fe=s(71225);const Ae={name:"Confirmation",components:{NcButton:r.A,NcModal:m.A},props:{name:{type:String,default:""},description:{type:String,default:""},confirmButtonText:{type:String,default:(0,R.Tl)("richdocuments","Confirm")},cancelButtonText:{type:String,default:(0,R.Tl)("richdocuments","Cancel")}},emits:["close"],methods:{t:R.Tl,close(e){this.$emit("close",e)}}};var ve=s(55901),ye={};ye.styleTagTransform=S(),ye.setAttributes=I(),ye.insert=k().bind(null,"head"),ye.domAPI=_(),ye.insertStyleElement=x();w()(ve.A,ye);ve.A&&ve.A.locals&&ve.A.locals;const we=(0,T.A)(Ae,(function(){var e=this,t=e._self._c;return t("NcModal",[t("div",{staticClass:"confirmation-dialog"},[t("h1",[e._v(e._s(e.name))]),e._v(" "),t("p",[e._v(e._s(e.description))]),e._v(" "),t("div",{staticClass:"confirmation-dialog--buttons"},[t("NcButton",{attrs:{type:"secondary"},on:{click:()=>e.close(!1)}},[e._v("\n\t\t\t\t"+e._s(e.cancelButtonText)+"\n\t\t\t")]),e._v(" "),t("NcButton",{attrs:{type:"primary"},on:{click:()=>e.close(!0)}},[e._v("\n\t\t\t\t"+e._s(e.confirmButtonText)+"\n\t\t\t")])],1)])])}),[],!1,null,"59370936",null).exports,Ce={data:()=>({openingLocally:!1}),methods:{startOpenLocalProcess(){this.showOpenLocalConfirmation()},showOpenLocalConfirmation(){(0,u.Ss)(we,{name:t("richdocuments","Open file locally"),description:t("richdocuments","When opening a file locally, the document will close for all users currently viewing the document."),confirmButtonText:t("richdocuments","Open locally"),cancelButtonText:t("richdocuments","Continue editing online")},(e=>{e&&(this.openingLocally=!0,this.postMessage.registerPostMessageHandler(this.handleCloseSession),this.sendPostMessage("Action_Save",{DontTerminateEdit:!1,DontSaveIfUnmodified:!1,Notify:!1}),this.sendPostMessage("Close_Session"))}))},handleCloseSession(){this.postMessage.unregisterPostMessageHandler(this.handleCloseSession),this.openLocally()},showOpenLocalFinished(){const e=this.filename;(0,u.Ss)(we,{name:t("richdocuments","Open file locally"),description:t("richdocuments","The file should now open locally. If you don't see this happening, make sure that the desktop client is installed on your system."),confirmButtonText:t("richdocuments","Retry to open locally"),cancelButtonText:t("richdocuments","Continue editing online")},(t=>{t?(this.openingLocally=!0,this.openLocally()):window.OCA.Viewer.open({path:e})}))},unlockFile(){return f.Ay.post((0,A.KT)("apps/richdocuments/api/v1/local"),{fileId:this.fileid})},openLocally(){this.openingLocally&&f.Ay.post((0,A.KT)("apps/files/api/v1/openlocaleditor"),{path:this.filename}).then((e=>{const t="nc://open/"+(0,Z.HW)()?.uid+"@"+G()+(0,fe.O0)(this.filename)+"?token="+e.data.ocs.data.token;this.showOpenLocalFinished(),setTimeout((()=>{this.openingLocally=!1,this.close()}),1e3),window.open(t,"_self")}))}}};var _e=s(64508);const be={methods:{async pickLink(){try{if(this.showLinkPicker)return;this.showLinkPicker=!0;const e=await(0,_e.J4)(null,!0);try{const t=new URL(e);if("http:"===t.protocol||"https:"===t.protocol)return void this.sendPostMessage("Action_InsertLink",{url:e})}catch(e){console.debug("error when parsing the link picker result")}this.sendPostMessage("Action_Paste",{Mimetype:"text/plain",Data:e})}catch(e){console.error("Link picker promise rejected :",e)}finally{this.showLinkPicker=!1}},async resolveLink(e){try{const t=(await f.Ay.get((0,A.KT)("references/resolve",2),{params:{reference:e}})).data.ocs.data.references[e],i=t?.openGraphObject?.name,s=t?.openGraphObject?.thumb;if(s)try{const t=await f.Ay.get(s,{responseType:"blob"});if(200===t?.status&&t?.data){const s=new FileReader;s.addEventListener("loadend",(t=>{const s=t.target.result;this.sendPostMessage("Action_GetLinkPreview_Resp",{url:e,title:i,image:s})})),s.readAsDataURL(t.data)}}catch(e){console.error("Error loading the reference image",e)}else this.sendPostMessage("Action_GetLinkPreview_Resp",{url:e,title:i,image:null})}catch(e){console.error("Error resolving a reference",e)}}}},ke="core:text2text",Fe="core:text2image",Ie={data:()=>({task:null}),methods:{async openAssistant(){this.task=await window.OCA.Assistant.openAssistantForm({appId:"richdocuments",customId:"richdocuments:"+this.fileid,isInsideViewer:!0,actionButtons:[{label:(0,R.Tl)("richdocuments","Insert into document"),title:(0,R.Tl)("richdocuments","Insert into document"),onClick:()=>this.handleTask(this.task)}]})},handleTask(e){switch(e.type){case ke:this.insertAIText(e.output.output);break;case Fe:this.insertAIImages(e.output.images)}},insertAIText(e){this.sendPostMessage("Action_Paste",{Mimetype:"text/plain;charset=utf-8",Data:e})},async insertAIImages(e){const t=(await(0,f.Ay)({method:"post",url:(0,A.Jv)("apps/richdocuments/assets/tasks"),data:{taskId:this.task.id,fileIds:[e[0]]}})).data[0];this.sendPostMessage("Action_InsertGraphic",{filename:t.filename,url:t.url})}}},Me={methods:{async saveAs(e){(0,u.Ss)(ee,{path:this.filename,format:e,description:t("richdocuments","Save a copy of the file under a new name and continue editing the new file")},(e=>{e&&(this.lastSaveAsFilename=(0,E.basename)(e),this.sendPostMessage("Action_SaveAs",{Filename:e,Notify:!0}))}))}}},xe={methods:{async uiMention({type:e,text:t,username:i}){if("autocomplete"===e){let e=[];if(null!==H.get("userId"))try{e=(await f.Ay.get((0,A.KT)("core/autocomplete/get"),{params:{search:t}})).data.ocs.data}catch(e){}const i=(0,Z.HW)();if(!e.some((e=>e.id===i.uid))){(i.uid.toLowerCase().includes(t.toLowerCase())||i.displayName.toLowerCase().includes(t.toLowerCase()))&&e.push({id:i.uid,label:i.displayName})}const s=e.map((e=>{const t=window.location.protocol+"//"+G()+"/index.php/u/"+e.id;return{label:e.label,username:e.id,profile:t}}));this.sendPostMessage("Action_Mention",{list:s})}"selected"===e&&await f.Ay.post((0,A.KT)(`apps/richdocuments/api/v1/mention/${this.fileid}`),{mention:i})}}},Pe={data:()=>({versionToRestore:null}),mounted(){(0,z.B1)("files_versions:restore:requested",this.onRestoreRequested)},beforeDestroy(){(0,z.al)("files_versions:restore:requested",this.onRestoreRequested)},methods:{onRestoreRequested(e){this.sendPostMessage("Host_VersionRestore",{Status:"Pre_Restore"}),this.versionToRestore=e.version,e.preventDefault=!0},async handlePreRestoreAck(){const e=(0,A.aU)()+"/remote.php/dav/versions/"+(0,Z.HW)().uid+"/versions/"+this.fileid+"/"+this.versionToRestore.fileVersion;try{await(0,f.Ay)({method:"MOVE",url:e,headers:{Destination:(0,A.dC)("dav")+"/versions/"+(0,Z.HW)().uid+"/restore/target"}}),(0,z.Ic)("files_versions:restore:restored",this.versionToRestore)}catch(e){(0,u.Qg)(t("richdocuments","Failed to revert the document to older version"))}this.versionToRestore=null}}};const Se=function(){return(0,h.C)("richdocuments","loggedInUser")};const Ne="FRAME_DOCUMENT",Le=0,Te=1,Oe=2,Ee=-1,Re={name:"Office",components:{AlertOctagonOutline:d.A,NcButton:r.A,NcEmptyContent:l.A,NcLoadingIcon:c.A,PencilIcon:a.A,ZoteroHint:O},mixins:[ge,Ce,be,Me,xe,Pe,Ie],props:{filename:{type:String,default:null},fileid:{type:Number,default:null},hasPreview:{type:Boolean,required:!1,default:()=>!1},source:{type:String,default:null},mime:{type:String,default:null},permissions:{type:String,default:""},isEmbedded:{type:Boolean,default:!1}},data:()=>({postMessage:null,iframeId:"collaboraframe_"+U(),iframeSrc:null,loading:Le,loadingTimeout:null,error:null,errorType:null,loadingMsg:null,showLinkPicker:!1,showZotero:!1,modified:!1,hasWidgetEditingEnabled:!1,lastSaveAsFilename:null,originalFavicon:null,formData:{action:null,accessToken:null,accessTokenTTL:null,uiDefaults:de(),cssVariables:me(),theme:(0,h.C)("richdocuments","theme","nextcloud"),hostSessionID:"nextcloud "+OC.config.version+" - richdocuments "+(0,D.F)().version,wopiSettingBaseUrl:(0,A.Jv)("apps/richdocuments/wopi/settings",null,{baseURL:V()})}}),computed:{showIframe(){return this.loading>=Te||this.debug},iframeTitle:()=>(0,h.C)("richdocuments","productName","Nextcloud Office"),showLoadingIndicator(){return this.loading!!window.TESTING,isPublic:()=>(0,j.f)(),shareToken:()=>(0,j.G)(),showAdminStorageFailure(){return(0,Z.HW)()?.isAdmin&&"websocketloadfailed"===this.errorType},showAdminWebsocketFailure(){return(0,Z.HW)()?.isAdmin&&"websocketconnectionfailed"===this.errorType}},watch:{hasWidgetEditingEnabled(){this.load()}},async mounted(){this.storeFavicon(),this.updateFavicon(),this.postMessage=new q({FRAME_DOCUMENT:()=>document.getElementById(this.iframeId).contentWindow});try{await(async()=>{const e=(0,D.F)()?.config?.wopi_url;if(!e)throw Error(ie)})(),await ne()}catch(e){return this.error=e.message,void(this.loading=Ee)}if(this.fileid){const e=OCA?.Files?.App?.getCurrentFileList?.();te.init({fileName:(0,E.basename)(this.filename),fileId:this.fileid,filePath:(0,E.dirname)(this.filename),fileList:e,fileModel:e?.getModelForFile((0,E.basename)(this.filename)),sendPostMessage:(e,t)=>{this.postMessage.sendWOPIPostMessage(Ne,e,t)}}),(0,K.dC)()?.close()}if(this.postMessage.registerPostMessageHandler(this.postMessageHandler),function(e,t){const i=!Se(),s=!(0,Z.P$)(),o=!(0,Z.HW)()||""===(0,Z.HW)()?.uid;return!!t&&i&&s&&o&&!("application/pdf"===e&&!t)}(this.mime,this.permissions?.includes("W"))){const{default:e}=await Promise.all([s.e("vendors-node_modules_nextcloud_vue_dist_Components_NcDateTimePicker_mjs"),s.e("vendors-node_modules_nextcloud_vue_dist_chunks_NcColorPicker-DVkGUHxL_mjs"),s.e("vendors-node_modules_nextcloud_vue_dist_chunks_NcActionInput-pjhToEAw_mjs-node_modules_nextcl-8ac611"),s.e("vendors-node_modules_nextcloud_vue_dist_index_mjs"),s.e("GuestNamePicker")]).then(s.bind(s,15644));(0,u.Ss)(e,{fileName:(0,E.basename)(this.filename),onSubmit:async()=>{await this.load()}})}else await this.load()},beforeDestroy(){this.postMessage.unregisterPostMessageHandler(this.postMessageHandler),this.restoreFavicon()},methods:{async load(){const e=this.fileid??(0,E.basename)((0,E.dirname)(this.source)),i=this.fileid?"0":(0,E.basename)(this.source);re||(re=!0,window?.visualViewport?.addEventListener("resize",le)||window.addEventListener("resize",le),document.addEventListener("touchstart",ce,!1),document.addEventListener("touchmove",ce,!1),ae=setInterval(le,200));const{data:s}=await f.Ay.post((0,A.Jv)("/apps/richdocuments/token"),{fileId:e,shareToken:this.shareToken,version:i,guestName:(0,Z.P$)()});if(s.federatedUrl)return this.$set(this.formData,"action",s.federatedUrl),this.$nextTick((()=>this.$refs.form.submit())),void(this.loading=Oe);H.update("urlsrc",s.urlSrc),H.update("wopi_callback_url",(0,h.C)("richdocuments","wopi_callback_url","")),H.update("startPresentation",(0,h.C)("richdocuments","startPresentation",!1));const o=this.isEmbedded&&!this.hasWidgetEditingEnabled,n=W({fileId:e+"_"+(0,h.C)("richdocuments","instanceId","instanceid")+(i&&"0"!==i?"_"+i:""),readOnly:o||i&&"0"!==i,revisionHistory:!this.isPublic,closeButton:!H.get("hideCloseButton")&&!this.isEmbedded,startPresentation:H.get("startPresentation"),target:s.target});this.$set(this.formData,"action",n),this.$set(this.formData,"accessToken",s.token),this.$nextTick((()=>this.$refs.form.submit())),this.loading=Le,this.loadingTimeout=setTimeout((()=>{console.error("Document loading failed due to timeout: Please check for failing network requests"),this.loading=Ee,this.error=t("richdocuments","Failed to load {productName} - please try again later",{productName:(0,h.C)("richdocuments","productName","Nextcloud Office")})}),1e3*(0,D.F)().config.timeout||15e3)},sendPostMessage(e,t={}){this.postMessage.sendWOPIPostMessage(Ne,e,t)},documentReady(){this.loading=Oe,clearTimeout(this.loadingTimeout),this.sendPostMessage("Host_PostmessageReady")},async share(){te.share()},close(){te.close(),this.modified&&te.updateFileInfo(void 0,Date.now()),re&&(re=!1,window?.visualViewport?.removeEventListener("resize",le)||window.removeEventListener("resize",le),document.removeEventListener("touchstart",ce,!1),document.removeEventListener("touchmove",ce,!1),clearInterval(ae)),this.restoreFavicon(),this.$emit("close")},reload(){this.loading=Le,this.load(),this.$refs.documentFrame.contentWindow.location.replace(this.iframeSrc)},postMessageHandler({parsed:e}){const{msgId:i,args:s,deprecated:o}=e;if(console.debug("[viewer] Received post message",i,s,o),!o)switch(i){case"App_LoadingStatus":"Frame_Ready"===s.Status?(this.loading=Te,this.$emit("update:loaded",!0),te.initAfterReady()):"Document_Loaded"===s.Status?(this.documentReady(),(0,h.C)("richdocuments","open_local_editor",!0)&&!this.isEmbedded&&this.sendPostMessage("Insert_Button",{id:"Open_Local_Editor",imgurl:window.location.protocol+"//"+G()+(0,A.d0)("richdocuments","launch.svg"),mobile:!1,label:t("richdocuments","Open in local editor"),hint:t("richdocuments","Open in local editor"),insertBefore:"print"})):"Failed"===s.Status&&(this.loading=Ee,this.$emit("update:loaded",!0));break;case"Action_Load_Resp":s.success?this.documentReady():"clusterscaling"===s.errorType?this.loadingMsg=t("richdocuments","Cluster is scaling …"):(this.error=s.errorMsg,this.errorType=s.errorType,this.loading=Ee,clearTimeout(this.loadingTimeout));break;case"UI_Close":this.close();break;case"Session_Closed":this.handleSessionClosed(s);break;case"UI_SaveAs":this.saveAs(s.format);break;case"Action_Save_Resp":if(console.debug("[viewer] Received post message Action_Save_Resp",s,this.lastSaveAsFilename),s.success){let e=s.fileName;!e&&"exportas"===s.result&&this.lastSaveAsFilename&&(e=this.lastSaveAsFilename),e&&e!==this.filename?te.createNodeForNewFile(e):te.updateFileInfo(void 0,Date.now()),this.lastSaveAsFilename=null}break;case"UI_InsertGraphic":te.insertGraphic(((e,t)=>{this.postMessage.sendWOPIPostMessage(Ne,"Action_InsertGraphic",{filename:e,url:t})}));break;case"UI_InsertFile":te.insertFile(s.mimeTypeFilter,((e,t)=>{this.postMessage.sendWOPIPostMessage(Ne,s.callback,{filename:e,url:t})}));break;case"UI_Mention":this.uiMention(e.args);break;case"UI_CreateFile":te.createNewFile(s.DocumentType);break;case"File_Rename":te.rename(decodeURIComponent(s.NewName));break;case"UI_FileVersions":te.showRevHistory();break;case"App_VersionRestore":"Pre_Restore_Ack"===s.Status&&this.handlePreRestoreAck();break;case"UI_Share":this.share();break;case"UI_ZoteroKeyMissing":this.showZotero=!0;break;case"UI UI_PickLink":case"UI_PickLink":this.pickLink();break;case"UI_InsertAIContent":this.openAssistant();break;case"Action_GetLinkPreview":this.resolveLink(s.url);break;case"Action_Save":this.modified&&te.updateFileInfo(void 0,Date.now());break;case"UI_Save":te.updateFileInfo(void 0,Date.now());break;case"Clicked_Button":this.buttonClicked(s);break;case"Doc_ModifiedStatus":s.Modified===this.modified||this.openingLocally||te.updateFileInfo(void 0,Date.now()),this.modified=s.Modified}},async buttonClicked(e){"Open_Local_Editor"===e?.Id&&this.startOpenLocalProcess()},handleSessionClosed({Reason:e}){"OwnerTermination"===e&&(this.openingLocally||((0,u.cf)(t("richdocuments","The collaborative editing was terminated by another user")),this.close()))},toggleEdit(){this.hasWidgetEditingEnabled=!0},getDocumentTypeIcon(){const e=this.mime.toLowerCase();return e.includes("spreadsheet")||e.includes("sheet")||e.includes("excel")||e.includes("csv")||e.includes("numbers")?"x-office-spreadsheet":e.includes("presentation")||e.includes("powerpoint")||e.includes("slideshow")||e.includes("keynote")?"x-office-presentation":e.includes("drawing")||e.includes("graphics")||e.includes("visio")?"x-office-drawing":"x-office-document"},storeFavicon(){const e=document.querySelector('link[rel*="icon"]');e&&(this.originalFavicon=e.href)},updateFavicon(){const e=document.querySelector('link[rel*="icon"]');if(e){const t=(0,A.fg)("richdocuments","img",this.getDocumentTypeIcon()+".svg");e.href=window.location.protocol+"//"+G()+t}},restoreFavicon(){if(this.originalFavicon){const e=document.querySelector('link[rel*="icon"]');e&&(e.href=this.originalFavicon)}}}},De=Re;var Ue=s(2889),Be={};Be.styleTagTransform=S(),Be.setAttributes=I(),Be.insert=k().bind(null,"head"),Be.domAPI=_(),Be.insertStyleElement=x();w()(Ue.A,Be);Ue.A&&Ue.A.locals&&Ue.A.locals;var $e=s(33705),He={};He.styleTagTransform=S(),He.setAttributes=I(),He.insert=k().bind(null,"head"),He.domAPI=_(),He.insertStyleElement=x();w()($e.A,He);$e.A&&$e.A.locals&&$e.A.locals;const Ve=(0,T.A)(De,(function(){var e=this,t=e._self._c;return t("div",{staticClass:"office-viewer",class:{"office-viewer__embedding":e.isEmbedded}},[e.showLoadingIndicator?t("div",{staticClass:"office-viewer__loading-overlay",class:{debug:e.debug}},[e.error?t("NcEmptyContent",{attrs:{name:e.t("richdocuments","Document loading failed"),description:e.errorMessage},scopedSlots:e._u([{key:"icon",fn:function(){return[t("AlertOctagonOutline")]},proxy:!0},{key:"description",fn:function(){return[t("p",[e._v(e._s(e.errorMessage))]),e._v(" "),e.showAdminStorageFailure?t("p",[e._v("\n\t\t\t\t\t"+e._s(e.t("richdocuments","Please check the Collabora Online server log for more details and make sure that Nextcloud can be reached from there."))+"\n\t\t\t\t")]):e._e(),e._v(" "),e.showAdminWebsocketFailure?t("p",[e._v("\n\t\t\t\t\t"+e._s(e.t("richdocuments","Socket connection closed unexpectedly. The reverse proxy might be misconfigured, please contact the administrator."))+"\n\t\t\t\t\t"),t("a",{staticClass:"external",attrs:{href:"https://docs.nextcloud.com/server/latest/admin_manual/office/proxy.html",target:"_blank",rel:"noreferrer noopener"}},[e._v("\n\t\t\t\t\t\t"+e._s(e.t("richdocuments","More information can be found in the reverse proxy documentation"))+"\n\t\t\t\t\t")])]):e._e()]},proxy:!0},{key:"action",fn:function(){return[t("NcButton",{on:{click:e.close}},[e._v("\n\t\t\t\t\t"+e._s(e.t("richdocuments","Close"))+"\n\t\t\t\t")])]},proxy:!0}],null,!1,3747207937)}):t("NcEmptyContent",{attrs:{name:e.loadingMessage},scopedSlots:e._u([{key:"icon",fn:function(){return[t("NcLoadingIcon")]},proxy:!0},{key:"action",fn:function(){return[t("NcButton",{on:{click:e.close}},[e._v("\n\t\t\t\t\t"+e._s(e.t("richdocuments","Cancel"))+"\n\t\t\t\t")])]},proxy:!0}],null,!1,2574797798)})],1):e._e(),e._v(" "),t("form",{ref:"form",attrs:{target:e.iframeId,action:e.formData.action,method:"post"}},[t("input",{attrs:{name:"access_token",type:"hidden"},domProps:{value:e.formData.accessToken}}),e._v(" "),t("input",{attrs:{name:"access_token_ttl",type:"hidden"},domProps:{value:e.formData.accessTokenTTL}}),e._v(" "),t("input",{attrs:{name:"ui_defaults",type:"hidden"},domProps:{value:e.formData.uiDefaults}}),e._v(" "),t("input",{attrs:{name:"css_variables",type:"hidden"},domProps:{value:e.formData.cssVariables}}),e._v(" "),t("input",{attrs:{name:"theme",type:"hidden"},domProps:{value:e.formData.theme}}),e._v(" "),t("input",{attrs:{name:"buy_product",value:"https://nextcloud.com/pricing",type:"hidden"}}),e._v(" "),t("input",{attrs:{name:"host_session_id",type:"hidden"},domProps:{value:e.formData.hostSessionID}}),e._v(" "),t("input",{attrs:{name:"wopi_setting_base_url",type:"hidden"},domProps:{value:e.formData.wopiSettingBaseUrl}})]),e._v(" "),t("iframe",{ref:"documentFrame",staticClass:"office-viewer__iframe",style:{visibility:e.showIframe?"visible":"hidden"},attrs:{id:e.iframeId,name:e.iframeId,"data-cy":"coolframe",scrolling:"no",allowfullscreen:"",allow:"clipboard-read *; clipboard-write *",src:e.iframeSrc,title:e.iframeTitle}}),e._v(" "),e.isEmbedded&&!e.hasWidgetEditingEnabled?t("NcButton",{staticClass:"toggle-interactive",on:{click:e.toggleEdit},scopedSlots:e._u([{key:"icon",fn:function(){return[t("PencilIcon")]},proxy:!0}],null,!1,411976917)},[e._v("\n\t\t"+e._s(e.t("richdocuments","Edit"))+"\n\t\t")]):e._e(),e._v(" "),t("ZoteroHint",{attrs:{show:e.showZotero},on:{"update:show":function(t){e.showZotero=t},submit:e.reload}})],1)}),[],!1,null,"c4f5812c",null).exports;o.Ay.prototype.t=t,o.Ay.prototype.n=n;const We={name:"Viewer",components:{Office:o.Ay.extend(Ve)},props:{filename:{type:String,default:null},fileid:{type:Number,default:null},hasPreview:{type:Boolean,required:!1,default:()=>!1},source:{type:String,default:null},mime:{type:String,default:null},permissions:{type:String,default:""},isEmbedded:{type:Boolean,default:!1}}};const Ge=(0,T.A)(We,(function(){var e=this;return(0,e._self._c)("Office",{attrs:{filename:e.filename,fileid:e.fileid,"has-preview":e.hasPreview,source:e.source,mime:e.mime,permissions:e.permissions,"is-embedded":e.isEmbedded},on:{close:function(t){return e.$parent.close()},"update:loaded":function(t){return e.$emit("update:loaded",t)}}})}),[],!1,null,null,null).exports},63779:()=>{},77199:()=>{}}]); //# sourceMappingURL=richdocuments-src_view_Viewer_vue.js.map?v=0b20368b10349e86b6fb