f7cloud_client/apps/richdocuments/js/richdocuments-src_view_Viewer_vue.js
root 8b6a0139db f7cloud_client
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-02-17 22:59:26 +00:00

2 lines
46 KiB
JavaScript

"use strict";(self.webpackChunkrichdocuments=self.webpackChunkrichdocuments||[]).push([["src_view_Viewer_vue"],{55901:(e,t,i)=>{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)=>{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)=>{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},95771:(e,t,i)=>{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-463e23e0]{z-index:100000;max-width:100%;display:flex;flex-direction:column;background-color:var(--color-main-background)}.office-viewer__loading-overlay[data-v-463e23e0]: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-463e23e0]{opacity:.5}.office-viewer__loading-overlay[data-v-463e23e0]:not(.viewer__file--hidden) .empty-content p{text-align:center}.office-viewer__loading-overlay:not(.viewer__file--hidden) .empty-content[data-v-463e23e0]{align-self:center;flex-grow:1}.office-viewer__embedding[data-v-463e23e0]{min-height:400px}.office-viewer__embedding .toggle-interactive[data-v-463e23e0]{position:sticky;bottom:12px;right:12px;z-index:1;margin-left:auto;margin-right:0}.office-viewer__iframe[data-v-463e23e0]{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},70711:(e,t,i)=>{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},51101:(e,i,s)=>{s.r(i),s.d(i,{default:()=>Ge});var o=s(85471),a=s(16502),r=s(74095),l=s(11275),c=s(88289),d=s(73076),h=s(32981),u=s(46787),m=s(80780),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),M=s.n(F),I=s(10540),P=s.n(I),x=s(41113),S=s.n(x),T=s(72281),L={};L.styleTagTransform=S(),L.setAttributes=M(),L.insert=k().bind(null,"head"),L.domAPI=_(),L.insertStyleElement=P();w()(T.A,L);T.A&&T.A.locals&&T.A.locals;var N=s(14486);const O=(0,N.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=function(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:5;return 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;i<s;i++)for(var o in t=arguments[i])Object.prototype.hasOwnProperty.call(t,o)&&(e[o]=t[o]);return e},B.apply(this,arguments)};const H=new(function(){function e(){this.values=B({wopi_callback_url:(0,h.C)("richdocuments","wopi_callback_url","")},(0,h.C)("richdocuments","document",{}))}return e.prototype.update=function(e,t){this.values[e]=t},e.prototype.get=function(e){return this.values[e]},e}()),V=()=>H.get("wopi_callback_url")||window.location.protocol+"//"+window.location.host+(0,A.aU)(),W=e=>{let{fileId:t,readOnly:i,closeButton:s,revisionHistory:o,target:n,startPresentation:a=!1}=e;return o=o&&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})(t))+"&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})()+(s?"&closebutton=1":"")+(o?"&revisionhistory=1":"")+(i?"&permission=readonly":"")+(n?"&target="+encodeURIComponent(n):"")+(a?"&startPresentation=1":"")},G=()=>window.location.host;var z=s(53537);const Z=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 q=s(21777),j=s(82680);var J=s(35810);const K={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 Y=s(98109),Q={};Q.styleTagTransform=S(),Q.setAttributes=M(),Q.insert=k().bind(null,"head"),Q.domAPI=_(),Q.insertStyleElement=P();w()(Y.A,Q);Y.A&&Y.A.locals&&Y.A.locals;const X=(0,N.A)(K,(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,ee={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(e){let{fileName:t,fileId:i,filePath:s,sendPostMessage:o,fileList:n,fileModel:a}=e;this.fileNode=void 0,this.fileName=t,this.fileId=i,this.fileList=n,this.filePath=s,this.fileModel=a,this.sendPostMessage=o,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),OCA?.Files?.Sidebar?.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()),OC.Apps.hideAppSidebar()}},share(){this.handlers.share&&this.handlers.share(this)||((0,j.f)()?console.error("[FilesAppIntegration] Sharing is not supported"):(OCA?.Files?.Sidebar?.open(this.filePath+"/"+this.fileName),OCA?.Files?.Sidebar?.setActiveTab("sharing")))},rename(e){this.updateFileInfo(e,Date.now()),this.fileName=e,this.handlers.rename&&this.handlers.rename(this)||this.getFileList()&&OC.Apps.hideAppSidebar()},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,i)=>{let{insertFileFromPath:s}=i;return this.handlers.insertGraphic&&this.handlers.insertGraphic(e,{insertFileFromPath:s})}))},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=$('<div id="richdocuments-actions"><div class="icon-collabora icon-more '+(e?"icon-black":"icon-white")+'"></div><ul id="richdocuments-actions-menu" class="popovermenu"></ul></div>'),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=$("<li><a></a></li>").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=$('<li><a class="icon-info"></a></li>').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=$('<li><a class="icon-download">Download</a></li>').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=$("<li></li>");i.append(this._avatarForView(e));const s=$('<div class="label"></div>');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=$('<div class="icon-close" title="'+t("richdocuments","Remove user")+'"/>');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=$('<div class="richdocuments-avatar"><div class="avatar" title="'+e.UserName+'" data-user="'+i+'"></div></div>'),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=$('<div id="editors-menu" class="popovermenu"><ul></ul></div>'),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,q.HW)()?.uid&&(""!==a.UserId&&s.indexOf(a.UserId)>-1||(s.push(a.UserId),o++<4&&e.append(this._avatarForView(a))))}const n=$('<li><input type="checkbox" class="checkbox" /><label class="label">'+t("richdocuments","Follow current editor")+"</label></li>");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)},showRevHistory(){this.handlers.showRevHistory&&this.handlers.showRevHistory(this)||(!(0,j.f)()&&OCA?.Files?.Sidebar?(OCA?.Files?.Sidebar?.open(this.filePath+"/"+this.fileName),OCA?.Files?.Sidebar?.setActiveTab("version_vue")):console.error("[FilesAppIntegration] Versions are not supported"))},createNewFile(e){this.handlers.createNewFile&&this.handlers.createNewFile(this,{type:e})||(0,u.Ss)(X,{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,q.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(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(!(0,j.f)()){if(void 0!==this.fileNode&&!e)return this.fileNode;try{const e=this.filePath+"/"+this.fileName,t=(0,J.H4)(),i=(await t.getDirectoryContents(`${J.lJ}${e}`,{details:!0,data:(0,J.VL)()})).data.map((e=>(0,J.Al)(e)));this.fileNode=i[0]??null}catch(e){console.error("Failed to fetch file metadata from webdav",e),this.fileNode=null}return this.fileNode}},changeFilesRoute(e){OCP?.Files?.Router?.goToRoute(OCP.Files.Router.name,{...OCP.Files.Router.params,fileid:e},OCP.Files.Router.query,!0)}},te=1,ie=2;let se=0;const oe=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(se<3&&("starting"===s.data.status||"stopped"===s.data.status||"restarting"===s.data.status)?setTimeout((()=>{se++,oe(e,i)})):i("Maximum retries reached"))};return i&&e?n(i,e):new Promise(n)};let ne,ae=!1;const re=["iPad Simulator","iPhone Simulator","iPod Simulator","iPad","iPhone","iPod"].includes(navigator.platform)||navigator.userAgent.includes("Mac")&&navigator.maxTouchPoints>1,le=()=>{re&&ae&&(document.documentElement.scrollTop=0,document.scrollingElement.scrollTop=0,(()=>{const e=window.visualViewport.height??document.documentElement.clientHeight,t=document.getElementById("richdocumentsframe");t&&(t.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=function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];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<o.length;++e)i+=o[e]+"="+s.trim()+";"}}catch(e){}if(e)return s.remove(),o.remove(),i.replace(/["']/g,"\\'");const a=["--color-main-background","--color-main-background-rgb","--color-main-background-translucent","--color-main-background-blur","--color-main-text","--color-text-maxcontrast","--color-box-shadow","--color-box-shadow-rgb","--default-font-size","--border-radius","--border-radius-large","--border-radius-rounded","--border-radius-pill","--default-clickable-area","--default-line-height","--default-grid-baseline","--color-primary","--color-primary-default","--color-primary-text","--color-primary-hover","--color-primary-light","--color-primary-light-text","--color-primary-light-hover","--color-primary-element","--color-primary-element-hover","--color-primary-element-text","--color-primary-element-light","--color-primary-element-light-hover","--color-primary-element-light-text","--color-primary-element-text-dark","--primary-invert-if-bright","--background-invert-if-bright","--background-invert-if-dark"];for(const e in a){const t=a[e],n=window.getComputedStyle(s).getPropertyValue(t),r=window.getComputedStyle(o).getPropertyValue(t);n&&(i+=t.replace("--","--nc-light-")+"="+n.trim()+";"),r&&(i+=t.replace("--","--nc-dark-")+"="+r.trim()+";"),"--primary-invert-if-bright"===t&&("no"===n.trim()?(i+="--nc-light-primary-invert-if-dark=invert(1);",i+="--nc-dark-primary-invert-if-dark=invert(1);"):(i+="--nc-light-primary-invert-if-dark=no;",i+="--nc-dark-primary-invert-if-dark=no;"))}s.remove(),o.remove();const r=(0,h.C)("richdocuments","theming-customLogo",!1);r&&(i+=`--nc-custom-logo=${encodeURIComponent(r)};`);const l=document.querySelector(":root"),c=window.getComputedStyle(l).getPropertyValue("--nc-logo-background");i+="--nc-logo-background="+(""===c?"transparent":c)+";";const d=window.getComputedStyle(l).getPropertyValue("--nc-logo-display");return d&&(i+=`--nc-logo-display=${d};`),i.replace(/["']/g,"\\'")},pe=(0,h.C)("core","config",{}),ge={data:()=>({autoLogoutInterval:null,autoLogoutRegistered:!1}),mounted(){(0,q.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(e){let{parsed:{msgId:t,args:i}}=e;if("Get_User_State_Resp"!==t)return;const s=i.Elapsed,o=Number(localStorage.getItem("lastActive")),n=Date.now()-o,a=1e3*(()=>{const e=pe.session_lifetime?Math.floor(pe.session_lifetime/2):900;return Math.min(86400,Math.max(60,e))})();!pe.session_keepalive&&n>a&&f.Ay.get((0,A.Jv)("/apps/richdocuments/heartbeat")),s<30&&(console.debug("[richdocuments] Extending auto logout timeout, office idle since "+s,n,a,n>a),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=M(),ye.insert=k().bind(null,"head"),ye.domAPI=_(),ye.insertStyleElement=P();w()(ve.A,ye);ve.A&&ve.A.locals&&ve.A.locals;const we=(0,N.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,q.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",Me={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})}}},Ie={methods:{async saveAs(e){(0,u.Ss)(X,{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.sendPostMessage("Action_SaveAs",{Filename:e,Notify:!0})))}}},Pe={methods:{async uiMention(e){let{type:t,text:i,username:s}=e;if("autocomplete"===t){let e=[];if(null!==H.get("userId"))try{e=(await f.Ay.get((0,A.KT)("core/autocomplete/get"),{params:{search:i}})).data.ocs.data}catch(e){}const t=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:t})}"selected"===t&&await f.Ay.post((0,A.KT)(`apps/richdocuments/api/v1/mention/${this.fileid}`),{mention:s})}}},xe={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,q.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,q.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 Te="FRAME_DOCUMENT",Le=0,Ne=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,Ie,Pe,xe,Me],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,formData:{action:null,accessToken:null,accessTokenTTL:null,uiDefaults:de(),cssVariables:me(),theme:(0,h.C)("richdocuments","theme","f7cloud"),hostSessionID:"f7cloud "+OC.config.version+" - richdocuments "+(0,D.F)().version,wopiSettingBaseUrl:(0,A.Jv)("apps/richdocuments/wopi/settings",null,{baseURL:V()})}}),computed:{showIframe(){return this.loading>=Ne||this.debug},iframeTitle:()=>(0,h.C)("richdocuments","productName","F7cloud Office"),showLoadingIndicator(){return this.loading<Ne},errorMessage(){switch(parseInt(this.error)){case te:return t("richdocuments","{productName} is not configured",{productName:(0,h.C)("richdocuments","productName","F7cloud Office")});case ie:return t("richdocuments","Starting the built-in CODE server failed");default:return this.error}},loadingMessage(){return this.loadingMsg?this.loadingMsg:t("richdocuments","Loading {filename} …",{filename:(0,E.basename)(this.filename)},1,{escape:!1})},debug:()=>!!window.TESTING,isPublic:()=>(0,j.f)(),shareToken:()=>(0,j.G)(),showAdminStorageFailure(){return(0,q.HW)()?.isAdmin&&"websocketloadfailed"===this.errorType},showAdminWebsocketFailure(){return(0,q.HW)()?.isAdmin&&"websocketconnectionfailed"===this.errorType}},watch:{hasWidgetEditingEnabled(){this.load()}},async mounted(){this.postMessage=new Z({FRAME_DOCUMENT:()=>document.getElementById(this.iframeId).contentWindow});try{await(async()=>{const e=(0,D.F)()?.config?.wopi_url;if(!e)throw Error(te)})(),await oe()}catch(e){return this.error=e.message,void(this.loading=Ee)}if(this.fileid){const e=OCA?.Files?.App?.getCurrentFileList?.();ee.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(Te,e,t)}}),window.OCA?.Files?.Sidebar?.close()}if(this.postMessage.registerPostMessageHandler(this.postMessageHandler),function(e,t){const i=!Se(),s=!(0,q.P$)(),o=!(0,q.HW)()||""===(0,q.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_f7cloud_vue_dist_Components_NcDateTimePicker_mjs"),s.e("vendors-node_modules_f7cloud_vue_dist_chunks_NcActionInput-CoG-fZq9_mjs-node_modules_nextcl-a13de7"),s.e("vendors-node_modules_f7cloud_vue_dist_chunks_NcColorPicker-Cae6XNoK_mjs"),s.e("vendors-node_modules_f7cloud_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)},methods:{async load(){const e=this.fileid??(0,E.basename)((0,E.dirname)(this.source)),i=this.fileid?0:(0,E.basename)(this.source);!ae&&re&&(ae=!0,window?.visualViewport?.addEventListener("resize",le)||window.addEventListener("resize",le),document.addEventListener("touchstart",ce,!1),document.addEventListener("touchmove",ce,!1),ne=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,q.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:""),readOnly:o||i>0,revisionHistory:!this.isPublic,closeButton:!H.get("hideCloseButton")&&!this.isEmbedded,startPresentation:H.get("startPresentation")});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","F7cloud Office")})}),1e3*(0,D.F)().config.timeout||15e3)},sendPostMessage(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};this.postMessage.sendWOPIPostMessage(Te,e,t)},documentReady(){this.loading=Oe,clearTimeout(this.loadingTimeout),this.sendPostMessage("Host_PostmessageReady")},async share(){ee.share()},close(){ee.close(),this.modified&&ee.updateFileInfo(void 0,Date.now()),ae&&re&&(ae=!1,window?.visualViewport?.removeEventListener("resize",le)||window.removeEventListener("resize",le),document.removeEventListener("touchstart",ce,!1),document.removeEventListener("touchmove",ce,!1),clearInterval(ne)),this.$emit("close")},reload(){this.loading=Le,this.load(),this.$refs.documentFrame.contentWindow.location.replace(this.iframeSrc)},postMessageHandler(e){let{parsed:i}=e;const{msgId:s,args:o,deprecated:n}=i;if(console.debug("[viewer] Received post message",s,o,n),!n)switch(s){case"App_LoadingStatus":"Frame_Ready"===o.Status?(this.loading=Ne,this.$emit("update:loaded",!0),ee.initAfterReady()):"Document_Loaded"===o.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"===o.Status&&(this.loading=Ee,this.$emit("update:loaded",!0));break;case"Action_Load_Resp":o.success?this.documentReady():"clusterscaling"===o.errorType?this.loadingMsg=t("richdocuments","Cluster is scaling …"):(this.error=o.errorMsg,this.errorType=o.errorType,this.loading=Ee,clearTimeout(this.loadingTimeout));break;case"UI_Close":this.close();break;case"Session_Closed":this.handleSessionClosed(o);break;case"UI_SaveAs":this.saveAs(o.format);break;case"Action_Save_Resp":o.fileName!==this.filename&&ee.saveAs(o.fileName);break;case"UI_InsertGraphic":ee.insertGraphic(((e,t)=>{this.postMessage.sendWOPIPostMessage(Te,"Action_InsertGraphic",{filename:e,url:t})}));break;case"UI_InsertFile":ee.insertFile(o.mimeTypeFilter,((e,t)=>{this.postMessage.sendWOPIPostMessage(Te,o.callback,{filename:e,url:t})}));break;case"UI_Mention":this.uiMention(i.args);break;case"UI_CreateFile":ee.createNewFile(o.DocumentType);break;case"File_Rename":ee.rename(decodeURIComponent(o.NewName));break;case"UI_FileVersions":ee.showRevHistory();break;case"App_VersionRestore":"Pre_Restore_Ack"===o.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(o.url);break;case"Action_Save":this.modified&&ee.updateFileInfo(void 0,Date.now());break;case"Clicked_Button":this.buttonClicked(o);break;case"Doc_ModifiedStatus":o.Modified===this.modified||this.openingLocally||ee.updateFileInfo(void 0,Date.now()),this.modified=o.Modified}},async buttonClicked(e){"Open_Local_Editor"===e?.Id&&this.startOpenLocalProcess()},handleSessionClosed(e){let{Reason:i}=e;"OwnerTermination"===i&&(this.openingLocally||((0,u.cf)(t("richdocuments","The collaborative editing was terminated by another user")),this.close()))},toggleEdit(){this.hasWidgetEditingEnabled=!0}}},De=Re;var Ue=s(95771),Be={};Be.styleTagTransform=S(),Be.setAttributes=M(),Be.insert=k().bind(null,"head"),Be.domAPI=_(),Be.insertStyleElement=P();w()(Ue.A,Be);Ue.A&&Ue.A.locals&&Ue.A.locals;var He=s(70711),$e={};$e.styleTagTransform=S(),$e.setAttributes=M(),$e.insert=k().bind(null,"head"),$e.domAPI=_(),$e.insertStyleElement=P();w()(He.A,$e);He.A&&He.A.locals&&He.A.locals;const Ve=(0,N.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 F7cloud 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.f7cloud.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://f7cloud.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,"463e23e0",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,N.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}}]);
//# sourceMappingURL=richdocuments-src_view_Viewer_vue.js.map?v=08049da19d648e9f9c4b