/*! For license information please see 7255-7255.js.LICENSE.txt */
"use strict";(self.webpackChunknextcloud=self.webpackChunknextcloud||[]).push([[7255],{85971:(e,a,n)=>{n.d(a,{Z:()=>d});var i=n(64024),o=n(15978),s=n(69302),r=n(35868),c=n(59953),m=n(25108);const d={props:{id:{type:Number,default:null},message:{type:String,default:""},resourceId:{type:[String,Number],required:!0},resourceType:{type:String,default:"files"}},data:()=>({deleted:!1,editing:!1,loading:!1}),methods:{onEdit(){this.editing=!0},onEditCancel(){this.editing=!1,this.updateLocalMessage(this.message)},async onEditComment(e){this.loading=!0;try{await(0,r.Z)(this.resourceType,this.resourceId,this.id,e),c.Z.debug("Comment edited",{resourceType:this.resourceType,resourceId:this.resourceId,id:this.id,message:e}),this.$emit("update:message",e),this.editing=!1}catch(e){(0,i.x2)(t("comments","An error occurred while trying to edit the comment")),m.error(e)}finally{this.loading=!1}},onDeleteWithUndo(){this.deleted=!0;const e=setTimeout(this.onDelete,i.et);(0,i.yl)(t("comments","Comment deleted"),(()=>{clearTimeout(e),this.deleted=!1}))},async onDelete(){try{await(0,s.Z)(this.resourceType,this.resourceId,this.id),c.Z.debug("Comment deleted",{resourceType:this.resourceType,resourceId:this.resourceId,id:this.id}),this.$emit("delete",this.id)}catch(e){(0,i.x2)(t("comments","An error occurred while trying to delete the comment")),m.error(e),this.deleted=!1}},async onNewComment(e){this.loading=!0;try{const t=await(0,o.Z)(this.resourceType,this.resourceId,e);c.Z.debug("New comment posted",{resourceType:this.resourceType,resourceId:this.resourceId,newComment:t}),this.$emit("new",t),this.$emit("update:message",""),this.localMessage=""}catch(e){(0,i.x2)(t("comments","An error occurred while trying to create the comment")),m.error(e)}finally{this.loading=!1}}}}},69302:(t,e,a)=>{a.d(e,{Z:()=>i});var n=a(38728);async function i(t,e,a){const i=["",t,e,a].join("/");await n.Z.deleteFile(i)}},35868:(t,e,a)=>{a.d(e,{Z:()=>i});var n=a(38728);async function i(t,e,a,i){const o=["",t,e,a].join("/");return await n.Z.customRequest(o,Object.assign({method:"PROPPATCH",data:`\n\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t${i}\n\t\t\t\t\n\t\t\t\n\t\t\t`}))}},15978:(t,e,a)=>{a.d(e,{Z:()=>c});var n=a(77958),i=a(85581),o=a(67225),s=a(93664),r=a(38728);async function c(t,e,a){const c=["",t,e].join("/"),m=await s.Z.post((0,i.R)()+c,{actorDisplayName:(0,n.ts)().displayName,actorId:(0,n.ts)().uid,actorType:"users",creationDateTime:(new Date).toUTCString(),message:a,objectType:t,verb:"comment"}),d=c+"/"+parseInt(m.headers["content-location"].split("/").pop()),l=await r.Z.stat(d,{details:!0}),A=l.data.props;return A.actorDisplayName=(0,o.a)(A.actorDisplayName,2),A.message=(0,o.a)(A.message,2),l.data}},67225:(t,e,a)=>{function n(t){let e=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1;const a=new DOMParser;let n=t;for(let t=0;tn})},94534:(t,e,a)=>{a.d(e,{Z:()=>r});var n=a(93664),i=a(77958),o=a(43554),s=a(79753);const r=(0,a(20144).defineComponent)({props:{resourceId:{type:Number,required:!0},resourceType:{type:String,default:"files"}},data:()=>({editorData:{actorDisplayName:(0,i.ts)().displayName,actorId:(0,i.ts)().uid,key:"editor"},userData:{}}),methods:{async autoComplete(t,e){const{data:a}=await n.Z.get((0,s.generateOcsUrl)("core/autocomplete/get"),{params:{search:t,itemType:"files",itemId:this.resourceId,sorter:"commenters|share-recipients",limit:(0,o.j)("comments","maxAutoCompleteResults")}});return a.ocs.data.forEach((t=>{this.userData[t.id]=t})),e(Object.values(this.userData))},genMentionsData(t){return Object.values(t).flat().forEach((t=>{this.userData[t.mentionId]={icon:"icon-user",id:t.mentionId,label:t.mentionDisplayName,source:"users",primary:(0,i.ts)()?.uid===t.mentionId}})),this.userData}}})},32049:(t,e,a)=>{a.d(e,{Z:()=>C});var n=a(77958),i=a(31352),o=a(80351),s=a.n(o),r=a(72155),c=a(55212),m=a(96204),d=a(18519),l=a(74628),A=a(30589),p=a(73567),g=a(78081),u=a(85971);const C={name:"Comment",components:{NcActionButton:r.Z,NcActions:c.Z,NcActionSeparator:m.Z,ArrowRight:p.default,NcAvatar:d.Z,NcButton:l.Z,Moment:g.Z,NcRichContenteditable:()=>a.e(7874).then(a.bind(a,98212))},mixins:[A.ZP,u.Z],inheritAttrs:!1,props:{actorDisplayName:{type:String,required:!0},actorId:{type:String,required:!0},creationDateTime:{type:String,default:null},editor:{type:Boolean,default:!1},autoComplete:{type:Function,required:!0},tag:{type:String,default:"div"}},data:()=>({expanded:!1,localMessage:""}),computed:{isOwnComment(){return(0,n.ts)().uid===this.actorId},renderedContent(){return this.isEmptyMessage?"":this.renderContent(this.localMessage)},isEmptyMessage(){return!this.localMessage||""===this.localMessage.trim()},timestamp(){return parseInt(s()(this.creationDateTime).format("x"),10)/1e3}},watch:{message(t){this.updateLocalMessage(t)}},beforeMount(){this.updateLocalMessage(this.message)},methods:{t:i.Iu,updateLocalMessage(t){this.localMessage=t.toString()},onSubmit(){if(""!==this.localMessage.trim())return this.editor?(this.onNewComment(this.localMessage.trim()),void this.$nextTick((()=>{this.$refs.editor.$el.focus()}))):void this.onEditComment(this.localMessage.trim())},onExpand(){this.expanded=!0}}}},96257:(t,e,a)=>{a.d(e,{Z:()=>o});var n=a(80351),i=a.n(n);const o={name:"Moment",props:{timestamp:{type:Number,required:!0},format:{type:String,default:"LLL"}},computed:{title(){return i().unix(this.timestamp).format(this.format)},formatted(){return i().unix(this.timestamp).fromNow()}}}},4669:(t,e,a)=>{a.d(e,{s:()=>n,x:()=>i});var n=function(){var t=this,e=t._self._c;return e(t.tag,{directives:[{name:"show",rawName:"v-show",value:!t.deleted,expression:"!deleted"}],tag:"component",staticClass:"comment",class:{"comment--loading":t.loading}},[e("div",{staticClass:"comment__side"},[e("NcAvatar",{staticClass:"comment__avatar",attrs:{"display-name":t.actorDisplayName,user:t.actorId,size:32}})],1),t._v(" "),e("div",{staticClass:"comment__body"},[e("div",{staticClass:"comment__header"},[e("span",{staticClass:"comment__author"},[t._v(t._s(t.actorDisplayName))]),t._v(" "),t.isOwnComment&&t.id&&!t.loading?e("NcActions",{staticClass:"comment__actions"},[t.editing?e("NcActionButton",{attrs:{icon:"icon-close"},on:{click:t.onEditCancel}},[t._v("\n\t\t\t\t\t"+t._s(t.t("comments","Cancel edit"))+"\n\t\t\t\t")]):[e("NcActionButton",{attrs:{"close-after-click":!0,icon:"icon-rename"},on:{click:t.onEdit}},[t._v("\n\t\t\t\t\t\t"+t._s(t.t("comments","Edit comment"))+"\n\t\t\t\t\t")]),t._v(" "),e("NcActionSeparator"),t._v(" "),e("NcActionButton",{attrs:{"close-after-click":!0,icon:"icon-delete"},on:{click:t.onDeleteWithUndo}},[t._v("\n\t\t\t\t\t\t"+t._s(t.t("comments","Delete comment"))+"\n\t\t\t\t\t")])]],2):t._e(),t._v(" "),t.id&&t.loading?e("div",{staticClass:"comment_loading icon-loading-small"}):t.creationDateTime?e("Moment",{staticClass:"comment__timestamp",attrs:{timestamp:t.timestamp}}):t._e()],1),t._v(" "),t.editor||t.editing?e("form",{staticClass:"comment__editor",on:{submit:function(t){t.preventDefault()}}},[e("div",{staticClass:"comment__editor-group"},[e("NcRichContenteditable",{ref:"editor",attrs:{"auto-complete":t.autoComplete,contenteditable:!t.loading,value:t.localMessage,"user-data":t.userData,"aria-describedby":"tab-comments__editor-description"},on:{"update:value":t.updateLocalMessage,submit:t.onSubmit}}),t._v(" "),e("div",{staticClass:"comment__submit"},[e("NcButton",{attrs:{type:"tertiary-no-background","native-type":"submit","aria-label":t.t("comments","Post comment"),disabled:t.isEmptyMessage},on:{click:t.onSubmit},scopedSlots:t._u([{key:"icon",fn:function(){return[t.loading?e("span",{staticClass:"icon-loading-small"}):e("ArrowRight",{attrs:{size:20}})]},proxy:!0}],null,!1,2357784758)})],1)],1),t._v(" "),e("div",{staticClass:"comment__editor-description",attrs:{id:"tab-comments__editor-description"}},[t._v("\n\t\t\t\t"+t._s(t.t("comments","@ for mentions, : for emoji, / for smart picker"))+"\n\t\t\t")])]):e("div",{staticClass:"comment__message",class:{"comment__message--expanded":t.expanded},domProps:{innerHTML:t._s(t.renderedContent)},on:{click:t.onExpand}})])])},i=[]},57352:(t,e,a)=>{a.d(e,{s:()=>n,x:()=>i});var n=function(){var t=this;return(0,t._self._c)("span",{staticClass:"live-relative-timestamp",attrs:{"data-timestamp":1e3*t.timestamp,title:t.title}},[t._v(t._s(t.formatted))])},i=[]},4874:(t,e,a)=>{a.d(e,{Z:()=>r});var n=a(87537),i=a.n(n),o=a(23645),s=a.n(o)()(i());s.push([t.id,".comment[data-v-5c8f36b1]{display:flex;gap:8px;padding:5px 10px}.comment__side[data-v-5c8f36b1]{display:flex;align-items:flex-start;padding-top:6px}.comment__body[data-v-5c8f36b1]{display:flex;flex-grow:1;flex-direction:column}.comment__header[data-v-5c8f36b1]{display:flex;align-items:center;min-height:44px}.comment__actions[data-v-5c8f36b1]{margin-left:10px !important}.comment__author[data-v-5c8f36b1]{overflow:hidden;white-space:nowrap;text-overflow:ellipsis;color:var(--color-text-maxcontrast)}.comment_loading[data-v-5c8f36b1],.comment__timestamp[data-v-5c8f36b1]{margin-left:auto;text-align:right;white-space:nowrap;color:var(--color-text-maxcontrast)}.comment__editor-group[data-v-5c8f36b1]{position:relative}.comment__editor-description[data-v-5c8f36b1]{color:var(--color-text-maxcontrast);padding-block:var(--default-grid-baseline)}.comment__submit[data-v-5c8f36b1]{position:absolute !important;bottom:0;right:0}.comment__message[data-v-5c8f36b1]{white-space:pre-wrap;word-break:break-word;max-height:70px;overflow:hidden;margin-top:-6px}.comment__message--expanded[data-v-5c8f36b1]{max-height:none;overflow:visible}.rich-contenteditable__input[data-v-5c8f36b1]{min-height:44px;margin:0;padding:10px}","",{version:3,sources:["webpack://./apps/comments/src/components/Comment.vue"],names:[],mappings:"AAKA,0BACC,YAAA,CACA,OAAA,CACA,gBAAA,CAEA,gCACC,YAAA,CACA,sBAAA,CACA,eAAA,CAGD,gCACC,YAAA,CACA,WAAA,CACA,qBAAA,CAGD,kCACC,YAAA,CACA,kBAAA,CACA,eAAA,CAGD,mCACC,2BAAA,CAGD,kCACC,eAAA,CACA,kBAAA,CACA,sBAAA,CACA,mCAAA,CAGD,uEAEC,gBAAA,CACA,gBAAA,CACA,kBAAA,CACA,mCAAA,CAGD,wCACC,iBAAA,CAGD,8CACC,mCAAA,CACA,0CAAA,CAGD,kCACC,4BAAA,CACA,QAAA,CACA,OAAA,CAGD,mCACC,oBAAA,CACA,qBAAA,CACA,eAAA,CACA,eAAA,CACA,eAAA,CACA,6CACC,eAAA,CACA,gBAAA,CAKH,8CACC,eAAA,CACA,QAAA,CACA,YA3EiB",sourcesContent:['\n@use "sass:math";\n\n$comment-padding: 10px;\n\n.comment {\n\tdisplay: flex;\n\tgap: 8px;\n\tpadding: 5px $comment-padding;\n\n\t&__side {\n\t\tdisplay: flex;\n\t\talign-items: flex-start;\n\t\tpadding-top: 6px;\n\t}\n\n\t&__body {\n\t\tdisplay: flex;\n\t\tflex-grow: 1;\n\t\tflex-direction: column;\n\t}\n\n\t&__header {\n\t\tdisplay: flex;\n\t\talign-items: center;\n\t\tmin-height: 44px;\n\t}\n\n\t&__actions {\n\t\tmargin-left: $comment-padding !important;\n\t}\n\n\t&__author {\n\t\toverflow: hidden;\n\t\twhite-space: nowrap;\n\t\ttext-overflow: ellipsis;\n\t\tcolor: var(--color-text-maxcontrast);\n\t}\n\n\t&_loading,\n\t&__timestamp {\n\t\tmargin-left: auto;\n\t\ttext-align: right;\n\t\twhite-space: nowrap;\n\t\tcolor: var(--color-text-maxcontrast);\n\t}\n\n\t&__editor-group {\n\t\tposition: relative;\n\t}\n\n\t&__editor-description {\n\t\tcolor: var(--color-text-maxcontrast);\n\t\tpadding-block: var(--default-grid-baseline);\n\t}\n\n\t&__submit {\n\t\tposition: absolute !important;\n\t\tbottom: 0;\n\t\tright: 0;\n\t}\n\n\t&__message {\n\t\twhite-space: pre-wrap;\n\t\tword-break: break-word;\n\t\tmax-height: 70px;\n\t\toverflow: hidden;\n\t\tmargin-top: -6px;\n\t\t&--expanded {\n\t\t\tmax-height: none;\n\t\t\toverflow: visible;\n\t\t}\n\t}\n}\n\n.rich-contenteditable__input {\n\tmin-height: 44px;\n\tmargin: 0;\n\tpadding: $comment-padding;\n}\n\n'],sourceRoot:""}]);const r=s},30122:(t,e,a)=>{var n=a(93379),i=a.n(n),o=a(7795),s=a.n(o),r=a(90569),c=a.n(r),m=a(3565),d=a.n(m),l=a(19216),A=a.n(l),p=a(44589),g=a.n(p),u=a(4874),C={};C.styleTagTransform=g(),C.setAttributes=d(),C.insert=c().bind(null,"head"),C.domAPI=s(),C.insertStyleElement=A(),i()(u.Z,C),u.Z&&u.Z.locals&&u.Z.locals},49251:(t,e,a)=>{a.d(e,{Z:()=>o});var n=a(4669),i=a(70762);a(56993);const o=(0,a(51900).Z)(i.Z,n.s,n.x,!1,null,"5c8f36b1",null).exports},78081:(t,e,a)=>{a.d(e,{Z:()=>o});var n=a(57352),i=a(88822);const o=(0,a(51900).Z)(i.Z,n.s,n.x,!1,null,null,null).exports},70762:(t,e,a)=>{a.d(e,{Z:()=>n});const n=a(32049).Z},88822:(t,e,a)=>{a.d(e,{Z:()=>n});const n=a(96257).Z},56993:(t,e,a)=>{a(30122)},42761:t=>{t.exports="data:image/svg+xml;base64,PCEtLSBUaGlzIGljb24gaXMgcGFydCBvZiBNYXRlcmlhbCBVSSBJY29ucy4gQ29weXJpZ2h0IDIwMjAgR29vZ2xlIEluYy4sIEFwYWNoZS0yLjAgTGljZW5zZSAtLT4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggZD0iTS00LTRoMjR2MjRILTRWLTR6IiBmaWxsPSJub25lIi8+PHBhdGggZD0iTTggMEMzLjYgMCAwIDMuNiAwIDhzMy42IDggOCA4IDgtMy42IDgtOC0zLjYtOC04LTh6IiBmaWxsPSIjZWQ0ODRjIi8+PHBhdGggZD0iTTUgNi41aDZjLjggMCAxLjUuNyAxLjUgMS41cy0uNyAxLjUtMS41IDEuNUg1Yy0uOCAwLTEuNS0uNy0xLjUtMS41UzQuMiA2LjUgNSA2LjV6IiBmaWxsPSIjZmRmZmZmIi8+PC9zdmc+Cg=="},87210:t=>{t.exports="data:image/svg+xml;base64,PCEtLSBUaGlzIGljb24gaXMgcGFydCBvZiBNYXRlcmlhbCBVSSBJY29ucy4gQ29weXJpZ2h0IDIwMjAgR29vZ2xlIEluYy4sIEFwYWNoZS0yLjAgTGljZW5zZSAtLT4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggZD0iTTQuOCAxMS4yaDYuNFY0LjhINC44djYuNHpNOCAwQzMuNiAwIDAgMy42IDAgOHMzLjYgOCA4IDggOC0zLjYgOC04LTMuNi04LTgtOHoiIGZpbGw9IiM0OWIzODIiLz48L3N2Zz4K"},94659:t=>{t.exports="data:image/svg+xml;base64,PCEtLSBUaGlzIGljb24gaXMgcGFydCBvZiBNYXRlcmlhbCBVSSBJY29ucy4gQ29weXJpZ2h0IDIwMjAgR29vZ2xlIEluYy4sIEFwYWNoZS0yLjAgTGljZW5zZSAtLT4KPHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHZpZXdCb3g9IjAgMCAxNiAxNiI+PHBhdGggZmlsbD0ibm9uZSIgZD0iTS00LTRoMjR2MjRILTR6Ii8+PHBhdGggZD0iTTYuOS4xQzMgLjYtLjEgNC0uMSA4YzAgNC40IDMuNiA4IDggOCA0IDAgNy40LTMgOC02LjktMS4yIDEuMy0yLjkgMi4xLTQuNyAyLjEtMy41IDAtNi40LTIuOS02LjQtNi40IDAtMS45LjgtMy42IDIuMS00Ljd6IiBmaWxsPSIjZjRhMzMxIi8+PC9zdmc+Cg=="}}]);
//# sourceMappingURL=7255-7255.js.map?v=ee3155ac7765bb364ab8