!function(t){var e={};function n(o){if(e[o])return e[o].exports;var i=e[o]={i:o,l:!1,exports:{}};return t[o].call(i.exports,i,i.exports,n),i.l=!0,i.exports}n.m=t,n.c=e,n.d=function(t,e,o){n.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:o})},n.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},n.t=function(t,e){if(1&e&&(t=n(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var o=Object.create(null);if(n.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var i in t)n.d(o,i,function(e){return t[e]}.bind(null,i));return o},n.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return n.d(e,"a",e),e},n.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},n.p="/js/",n(n.s=3)}([function(t,e){t.exports=jQuery},function(t,e,n){"use strict";t.exports=function(t){var e=[];return e.toString=function(){return this.map((function(e){var n=function(t,e){var n=t[1]||"",o=t[3];if(!o)return n;if(e&&"function"==typeof btoa){var i=(r=o,s=btoa(unescape(encodeURIComponent(JSON.stringify(r)))),l="sourceMappingURL=data:application/json;charset=utf-8;base64,".concat(s),"/*# ".concat(l," */")),a=o.sources.map((function(t){return"/*# sourceURL=".concat(o.sourceRoot).concat(t," */")}));return[n].concat(a).concat([i]).join("\n")}var r,s,l;return[n].join("\n")}(e,t);return e[2]?"@media ".concat(e[2],"{").concat(n,"}"):n})).join("")},e.i=function(t,n){"string"==typeof t&&(t=[[null,t,""]]);for(var o={},i=0;in.parts.length&&(o.parts.length=n.parts.length)}else{var r=[];for(i=0;i\n\t\t\t\n'},11:function(t,e,n,o,i){return'\t\t
\n'},compiler:[7,">= 4.0.0"],main:function(t,e,o,i,a){var r,s,l=null!=e?e:t.nullContext||{},c=o.helperMissing,m="function",u=t.escapeExpression;return'
  • \n\t
    \n\t\t
    \n\t\t
    '+u(n(s=null!=(s=o.actorDisplayName||(null!=e?e.actorDisplayName:e))?s:c)===m?s.call(l,{name:"actorDisplayName",hash:{},data:a}):s)+"
    \n"+(null!=(r=o.if.call(l,null!=e?e.isUserAuthor:e,{name:"if",hash:{},fn:t.program(9,a,0),inverse:t.noop,data:a}))?r:"")+'\t\t
    '+u(n(s=null!=(s=o.date||(null!=e?e.date:e))?s:c)===m?s.call(l,{name:"date",hash:{},data:a}):s)+'
    \n\t
    \n\t
    '+(null!=(r=n(s=null!=(s=o.formattedMessage||(null!=e?e.formattedMessage:e))?s:c)===m?s.call(l,{name:"formattedMessage",hash:{},data:a}):s)?r:"")+"
    \n"+(null!=(r=o.if.call(l,null!=e?e.isLong:e,{name:"if",hash:{},fn:t.program(11,a,0),inverse:t.noop,data:a}))?r:"")+"
  • \n"},useData:!0}),i.commentsmodifymenu=o({1:function(t,e,o,i,a){var r,s,l=null!=e?e:t.nullContext||{},c=o.helperMissing,m=t.escapeExpression;return'\t\t
  • \n\t\t\t\n'+(null!=(r=o.if.call(l,null!=e?e.iconClass:e,{name:"if",hash:{},fn:t.program(2,a,0),inverse:t.program(4,a,0),data:a}))?r:"")+"\t\t\t\t"+m("function"===n(s=null!=(s=o.displayName||(null!=e?e.displayName:e))?s:c)?s.call(l,{name:"displayName",hash:{},data:a}):s)+"\n\t\t\t\n\t\t
  • \n"},2:function(t,e,n,o,i){var a;return'\t\t\t\t\t\n'},4:function(t,e,n,o,i){return'\t\t\t\t\t\n'},compiler:[7,">= 4.0.0"],main:function(t,e,n,o,i){var a;return"\n"},useData:!0}),i.edit_comment=o({1:function(t,e,n,o,i){var a;return'\t\t\t
    \n\t\t\t\t\n\t\t\t
    \n'},compiler:[7,">= 4.0.0"],main:function(t,e,o,i,a){var r,s,l=null!=e?e:t.nullContext||{},c=o.helperMissing,m="function",u=t.escapeExpression;return"<"+u(n(s=null!=(s=o.tag||(null!=e?e.tag:e))?s:c)===m?s.call(l,{name:"tag",hash:{},data:a}):s)+' class="newCommentRow comment" data-id="'+u(n(s=null!=(s=o.id||(null!=e?e.id:e))?s:c)===m?s.call(l,{name:"id",hash:{},data:a}):s)+'">\n\t
    \n\t\t
    \n\t\t
    '+u(n(s=null!=(s=o.actorDisplayName||(null!=e?e.actorDisplayName:e))?s:c)===m?s.call(l,{name:"actorDisplayName",hash:{},data:a}):s)+"
    \n"+(null!=(r=o.if.call(l,null!=e?e.isEditMode:e,{name:"if",hash:{},fn:t.program(1,a,0),inverse:t.noop,data:a}))?r:"")+'\t
    \n\t
    \n\t\t
    '+u(n(s=null!=(s=o.message||(null!=e?e.message:e))?s:c)===m?s.call(l,{name:"message",hash:{},data:a}):s)+'
    \n\t\t\n\t\t\n\t
    \n\n"},useData:!0}),i.filesplugin=o({compiler:[7,">= 4.0.0"],main:function(t,e,o,i,a){var r,s=null!=e?e:t.nullContext||{},l=o.helperMissing,c=t.escapeExpression;return'\n\t\n\n'},useData:!0}),i.view=o({compiler:[7,">= 4.0.0"],main:function(t,e,o,i,a){var r,s=null!=e?e:t.nullContext||{},l=o.helperMissing,c=t.escapeExpression;return'\n\n\n\n'},useData:!0})},function(t,e){!function(t,e){_.extend(t.Files.Client,{PROPERTY_FILEID:"{"+t.Files.Client.NS_OWNCLOUD+"}id",PROPERTY_MESSAGE:"{"+t.Files.Client.NS_OWNCLOUD+"}message",PROPERTY_ACTORTYPE:"{"+t.Files.Client.NS_OWNCLOUD+"}actorType",PROPERTY_ACTORID:"{"+t.Files.Client.NS_OWNCLOUD+"}actorId",PROPERTY_ISUNREAD:"{"+t.Files.Client.NS_OWNCLOUD+"}isUnread",PROPERTY_OBJECTID:"{"+t.Files.Client.NS_OWNCLOUD+"}objectId",PROPERTY_OBJECTTYPE:"{"+t.Files.Client.NS_OWNCLOUD+"}objectType",PROPERTY_ACTORDISPLAYNAME:"{"+t.Files.Client.NS_OWNCLOUD+"}actorDisplayName",PROPERTY_CREATIONDATETIME:"{"+t.Files.Client.NS_OWNCLOUD+"}creationDateTime",PROPERTY_MENTIONS:"{"+t.Files.Client.NS_OWNCLOUD+"}mentions"});var n=t.Backbone.Model.extend({sync:t.Backbone.davSync,defaults:{actorType:"users",objectType:"files"},davProperties:{id:t.Files.Client.PROPERTY_FILEID,message:t.Files.Client.PROPERTY_MESSAGE,actorType:t.Files.Client.PROPERTY_ACTORTYPE,actorId:t.Files.Client.PROPERTY_ACTORID,actorDisplayName:t.Files.Client.PROPERTY_ACTORDISPLAYNAME,creationDateTime:t.Files.Client.PROPERTY_CREATIONDATETIME,objectType:t.Files.Client.PROPERTY_OBJECTTYPE,objectId:t.Files.Client.PROPERTY_OBJECTID,isUnread:t.Files.Client.PROPERTY_ISUNREAD,mentions:t.Files.Client.PROPERTY_MENTIONS},parse:function(t){return{id:t.id,message:t.message,actorType:t.actorType,actorId:t.actorId,actorDisplayName:t.actorDisplayName,creationDateTime:t.creationDateTime,objectType:t.objectType,objectId:t.objectId,isUnread:"true"===t.isUnread,mentions:this._parseMentions(t.mentions)}},_parseMentions:function(t){if(_.isUndefined(t))return{};var e={};for(var n in t){var o=t[n];if(!_.isUndefined(o.localName)&&"mention"===o.localName){e[n]={};for(var i=o.firstChild;i;i=i.nextSibling)!_.isUndefined(i.localName)&&i.localName.startsWith("mention")&&(e[n][i.localName]=i.textContent)}}return e}});e.Comments.CommentModel=n}(OC,OCA)},function(t,e){!function(t,e){var n=t.Backbone.Collection.extend({sync:t.Backbone.davSync,model:e.Comments.CommentModel,_objectType:"files",_objectId:null,_endReached:!1,_limit:20,initialize:function(t,e){(e=e||{}).objectType&&(this._objectType=e.objectType),e.objectId&&(this._objectId=e.objectId)},url:function(){return t.linkToRemote("dav")+"/comments/"+encodeURIComponent(this._objectType)+"/"+encodeURIComponent(this._objectId)+"/"},setObjectId:function(t){this._objectId=t},hasMoreResults:function(){return!this._endReached},reset:function(){return this._endReached=!1,this._summaryModel=null,t.Backbone.Collection.prototype.reset.apply(this,arguments)},fetchNext:function(t){var e=this;if(!this.hasMoreResults())return null;var o='\n\n '+(this._limit+1)+"\n "+this.length+"\n\n",i=(t=t||{}).success;return t=_.extend({remove:!1,parse:!0,data:o,davProperties:n.prototype.model.prototype.davProperties,success:function(n){if(n.length<=e._limit?e._endReached=!0:n=_.initial(n),!e.set(n,t))return!1;i&&i.apply(null,arguments),e.trigger("sync","REPORT",e,t)}},t),this.sync("REPORT",this,t)},getSummaryModel:function(){return this._summaryModel||(this._summaryModel=new e.Comments.CommentSummaryModel({id:this._objectId,objectType:this._objectType})),this._summaryModel},updateReadMarker:function(t,e){return e=e||{},this.getSummaryModel().save({readMarker:(t||new Date).toUTCString()},e)}});e.Comments.CommentCollection=n}(OC,OCA)},function(t,e){!function(t,e){_.extend(t.Files.Client,{PROPERTY_READMARKER:"{"+t.Files.Client.NS_OWNCLOUD+"}readMarker"});var n=t.Backbone.Model.extend({sync:t.Backbone.davSync,_objectType:"files",_objectId:null,davProperties:{readMarker:t.Files.Client.PROPERTY_READMARKER},initialize:function(t,e){(e=e||{}).objectType&&(this._objectType=e.objectType)},url:function(){return t.linkToRemote("dav")+"/comments/"+encodeURIComponent(this._objectType)+"/"+encodeURIComponent(this.id)+"/"}});e.Comments.CommentSummaryModel=n}(OC,OCA)},function(e,n){!function(e,n){var o=n.Files.DetailTabView.extend({id:"commentsTabView",className:"tab commentsTabView",_autoCompleteData:void 0,_commentsModifyMenu:void 0,events:{"submit .newCommentForm":"_onSubmitComment","click .showMore":"_onClickShowMore","click .cancel":"_onClickCloseComment","click .comment":"_onClickComment","keyup div.message":"_onTextChange","change div.message":"_onTextChange","input div.message":"_onTextChange","paste div.message":"_onPaste"},_commentMaxLength:1e3,initialize:function(){n.Files.DetailTabView.prototype.initialize.apply(this,arguments),this.collection=new n.Comments.CommentCollection,this.collection.on("request",this._onRequest,this),this.collection.on("sync",this._onEndRequest,this),this.collection.on("add",this._onAddModel,this),this.collection.on("change:message",this._onChangeModel,this),this._commentMaxThreshold=.9*this._commentMaxLength,_.bindAll(this,"_onTypeComment","_initAutoComplete","_onAutoComplete")},template:function(t){var o=e.getCurrentUser();return n.Comments.Templates.view(_.extend({actorId:o.uid,actorDisplayName:o.displayName},t))},editCommentTemplate:function(o){var i=e.getCurrentUser();return n.Comments.Templates.edit_comment(_.extend({actorId:i.uid,actorDisplayName:i.displayName,newMessagePlaceholder:t("comments","New comment …"),submitText:t("comments","Post"),cancelText:t("comments","Cancel"),tag:"li"},o))},commentTemplate:function(o){return"deleted_users"===(o=_.extend({editTooltip:t("comments","Edit comment"),isUserAuthor:e.getCurrentUser().uid===o.actorId,isLong:this._isLong(o.message)},o)).actorType&&(o.actorId=null,o.actorDisplayName=t("comments","[Deleted user]")),n.Comments.Templates.comment(o)},getLabel:function(){return t("comments","Comments")},getIcon:function(){return"icon-comment"},setFileInfo:function(t){t?(this.model=t,this.render(),this._initAutoComplete($("#commentsTabView").find(".newCommentForm .message")),this.collection.setObjectId(this.model.id),this.collection.reset([],{silent:!0}),this.nextPage()):(this.model=null,this.render(),this.collection.reset())},render:function(){this.$el.html(this.template({emptyResultLabel:t("comments","No comments yet, start the conversation!"),moreLabel:t("comments","More comments …")})),this.$el.find(".comments").before(this.editCommentTemplate({tag:"div"})),this.$el.find(".has-tooltip").tooltip(),this.$container=this.$el.find("ul.comments"),this.$el.find(".avatar").avatar(e.getCurrentUser().uid,32),this.delegateEvents(),this.$el.find(".message").on("keydown input change",this._onTypeComment),autosize(this.$el.find(".newCommentRow .message")),this.$el.find(".newCommentForm .message").focus()},_initAutoComplete:function(t){var n=this,o=10;_.isUndefined(e.appConfig.comments)||(o=e.appConfig.comments.maxAutoCompleteResults),t.atwho({at:"@",limit:o,callbacks:{remoteFilter:n._onAutoComplete,highlighter:function(t){var e=$(t);return e.find(".avatar").avatar(void 0,32),e},sorter:function(t,e){return e}},displayTpl:function(t){return'
  • '+escapeHTML(t.label)+"
  • "},insertTpl:function(t){return''+escapeHTML(t.label)+""},searchKey:"label"}),t.on("inserted.atwho",(function(t,e){n._postRenderItem($(t.target).find('span[data-username="'+e.find("[data-username]").data("username")+'"]').parent(),!0)}))},_onAutoComplete:function(t,n){var o=this;_.isUndefined(this._autoCompleteRequestTimer)||clearTimeout(this._autoCompleteRequestTimer),this._autoCompleteRequestTimer=_.delay((function(){_.isUndefined(this._autoCompleteRequestCall)||this._autoCompleteRequestCall.abort(),this._autoCompleteRequestCall=$.ajax({url:e.linkToOCS("core",2)+"autocomplete/get",data:{search:t,itemType:"files",itemId:o.model.get("id"),sorter:"commenters|share-recipients",limit:e.appConfig.comments.maxAutoCompleteResults},beforeSend:function(t){t.setRequestHeader("Accept","application/json")},success:function(t){n(t.ocs.data)}})}),400)},_formatItem:function(t){var n=new Date(t.get("creationDateTime")).getTime();return _.extend({timestamp:n,date:e.Util.relativeModifiedDate(n),altDate:e.Util.formatDate(n),formattedMessage:this._formatMessage(t.get("message"),t.get("mentions"))},t.attributes)},_toggleLoading:function(t){this._loading=t,this.$el.find(".loading").toggleClass("hidden",!t)},_onRequest:function(t){"REPORT"===t&&(this._toggleLoading(!0),this.$el.find(".showMore").addClass("hidden"))},_onEndRequest:function(t){var e=this.model;(this._toggleLoading(!1),this.$el.find(".emptycontent").toggleClass("hidden",!!this.collection.length),this.$el.find(".showMore").toggleClass("hidden",!this.collection.hasMoreResults()),"REPORT"===t)&&(this.collection.findWhere({isUnread:!0})&&this.collection.updateReadMarker(null,{success:function(){e.set("commentsUnread",0)}}),this.$el.find(".newCommentForm .message").focus())},_onAddModel:function(t,e,n){var o=$(this.commentTemplate(this._formatItem(t)));!_.isUndefined(n.at)&&e.length>1?this.$container.find("li").eq(n.at).before(o):this.$container.append(o),this._postRenderItem(o),$("#commentsTabView").find(".newCommentForm div.message").text("").prop("contenteditable",!0);var i=t.get("mentions"),a=this;t.fetch({success:function(t){if(!_.isEqual(i,t.get("mentions"))){var e=$(a.commentTemplate(a._formatItem(t)));o.html(e.html()),a._postRenderItem(o)}}})},_onChangeModel:function(t){if(t.get("message").trim()!==t.previous("message").trim()){var e=this.$container.find('.comment[data-id="'+t.id+'"] form').closest(".comment"),n=e.data("commentEl");if(!_.isUndefined(n)){var o=this;t.fetch({success:function(t){n.removeClass("hidden"),e.remove();var i=n.find(".message");i.html(o._formatMessage(t.get("message"),t.get("mentions"))).find(".avatar").each((function(){$(this).avatar()})),o._postRenderItem(i)}})}}},_postRenderItem:function(t,o){t.find(".has-tooltip").tooltip();var i=t.find(".message .avatar");$(t.context).hasClass("message")&&(i=t.find(".avatar")),i.each((function(){var t=$(this);t.avatar(t.attr("data-username"),16)})),t.find(".authorRow .avatar").each((function(){var t=$(this);t.avatar(t.attr("data-username"),32)}));var a=t.find(".avatar").data("username");a!==e.getCurrentUser().uid&&t.find(".authorRow .avatar, .authorRow .author").contactsMenu(a,0,t.find(".authorRow"));var r=t.find(".message");if(0===r.length&&(r=t),!o){var s=this,l=new n.Comments.CommentsModifyMenu;t.find(".authorRow").append(l.$el),t.find(".more").on("click",_.bind(l.show,l)),s.listenTo(l,"select:menu-item-clicked",(function(t,e){"edit"===e?s._onClickEditComment(t):"delete"===e&&s._onClickDeleteComment(t)}))}this._postRenderMessage(r,o)},_postRenderMessage:function(t,n){n||t.find(".avatar-name-wrapper").each((function(){var t=$(this),n=t.find(".avatar").data("user");n!==e.getCurrentUser().uid&&t.contactsMenu(n,0,t)}))},_formatMessage:function(t,e,n){for(var o in t=escapeHTML(t).replace(/\n/g,"
    "),e){if(!e.hasOwnProperty(o))return;var i="@"+e[o].mentionId;-1!==e[o].mentionId.indexOf(" ")&&(i=_.escape('@"'+e[o].mentionId+'"')),i=i.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");var a=new RegExp("(^|\\s)("+i+")\\b","g");-1!==e[o].mentionId.indexOf(" ")&&(a=new RegExp("(^|\\s)("+i+")","g"));var r=this._composeHTMLMention(e[o].mentionId,e[o].mentionDisplayName);t=t.replace(a,(function(t,e){return e+r}))}return!0!==n&&(t=OCP.Comments.plainToRich(t)),t},_composeHTMLMention:function(t,n){var o='';return''+o+""+_.escape(n)+""},nextPage:function(){!this._loading&&this.collection.hasMoreResults()&&this.collection.fetchNext()},_onClickEditComment:function(e){e.preventDefault();var n=$(e.target).closest(".comment"),o=n.data("id"),i=this.collection.get(o),a=$(this.editCommentTemplate(_.extend({isEditMode:!0,submitText:t("comments","Save")},i.attributes)));n.addClass("hidden").removeClass("collapsed"),n.after(a),a.data("commentEl",n),a.find(".message").on("keydown input change",this._onTypeComment),a.find(".avatar:first").replaceWith(n.find(".avatar:first").clone()),a.find(".has-tooltip").tooltip();var r=a.find(".message");r.html(this._formatMessage(i.get("message"),i.get("mentions"),!0)).find(".avatar").each((function(){$(this).avatar()}));return this._postRenderItem(r,!0),autosize(a.find(".message")),this._initAutoComplete(a.find(".message")),!1},_onTypeComment:function(e){var n=$(e.target),o=n.text().length,i=n.data("submitButtonEl");i||(i=n.closest("form").find(".submit"),n.data("submitButtonEl",i)),n.tooltip("hide"),o>this._commentMaxThreshold&&(n.attr("data-original-title",t("comments","Allowed characters {count} of {max}",{count:o,max:this._commentMaxLength})),n.tooltip({trigger:"manual"}),n.tooltip("show"),n.addClass("error"));var a=o>this._commentMaxLength;n.toggleClass("error",a),i.prop("disabled",a),13!==e.keyCode||e.shiftKey||n.atwho("isSelecting")||(i.click(),e.preventDefault())},_onClickComment:function(t){var e=$(t.target);e.is(".comment")||(e=e.closest(".comment")),e.removeClass("collapsed")},_onClickCloseComment:function(t){t.preventDefault();var e=$(t.target).closest(".comment");return e.data("commentEl").removeClass("hidden"),e.remove(),!1},_onClickDeleteComment:function(n){n.preventDefault();var o=$(n.target).closest(".comment"),i=o.data("id"),a=o.find(".deleteLoading"),r=o.find(".more");return o.addClass("disabled"),a.removeClass("hidden"),r.addClass("hidden"),o.data("commentEl",o),this.collection.get(i).destroy({success:function(){o.data("commentEl").remove(),o.remove()},error:function(){a.addClass("hidden"),r.removeClass("hidden"),o.removeClass("disabled"),e.Notification.showTemporary(t("comments","Error occurred while retrieving comment with ID {id}",{id:i}))}}),!1},_onClickShowMore:function(t){t.preventDefault(),this.nextPage()},_onSubmitSuccess:function(t,e){var n=e.find(".submit"),o=e.find(".submitLoading");n.removeClass("hidden"),o.addClass("hidden")},_commentBodyHTML2Plain:function(t){var e,n=t.clone();n.find(".avatar-name-wrapper").each((function(){var t=$(this),e=t.parent(),n=t.find(".avatar").data("username").toString();-1!==n.indexOf(" ")?e.html('@"'+n+'"'):e.html("@"+n)})),n.html(OCP.Comments.richToPlain(n.html()));var o=n.html();do{o=(e=o).replace("
    ","\n")}while(e!==o);return n.html(o),n.text()},_onSubmitComment:function(t){var n=this,o=$(t.target),i=o.closest(".comment").data("id"),a=e.getCurrentUser(),r=o.find(".submit"),s=o.find(".submitLoading"),l=o.find(".message"),c=l.text().trim();if(t.preventDefault(),c.length&&!(c.length>this._commentMaxLength)){if(l.prop("contenteditable",!1),r.addClass("hidden"),s.removeClass("hidden"),c=this._commentBodyHTML2Plain(l),i)this.collection.get(i).save({message:c},{success:function(t){if(n._onSubmitSuccess(t,o),t.get("message").trim()===t.previous("message").trim()){var e=o.closest(".comment");e.data("commentEl").removeClass("hidden"),e.remove()}},error:function(){n._onSubmitError(o,i)}});else this.collection.create({actorId:a.uid,actorDisplayName:a.displayName,actorType:"users",verb:"comment",message:c,creationDateTime:(new Date).toUTCString()},{at:0,wait:!0,success:function(t){n._onSubmitSuccess(t,o)},error:function(){n._onSubmitError(o,void 0)}});return!1}},_onSubmitError:function(n,o){n.find(".submit").removeClass("hidden"),n.find(".submitLoading").addClass("hidden"),n.find(".message").prop("contenteditable",!0),_.isUndefined(o)?e.Notification.show(t("comments","Error occurred while posting comment"),{type:"error"}):e.Notification.show(t("comments","Error occurred while updating comment with id {id}",{id:o}),{type:"error"})},_onTextChange:function(){var t=$("#commentsTabView").find(".newCommentForm div.message");t.text().trim().length||t.empty()},_onPaste:function(t){t.preventDefault();var e=t.originalEvent.clipboardData.getData("text/plain");document.execCommand("insertText",!1,e)},_isLong:function(t){return t.length>250||(t.match(/\n/g)||[]).length>1}});n.Comments.CommentsTabView=o}(OC,OCA)},function(e,n){var o;OC,OCA,o=OC.Backbone.View.extend({tagName:"div",className:"commentsModifyMenu popovermenu bubble menu",_scopes:[{name:"edit",displayName:t("comments","Edit comment"),iconClass:"icon-rename"},{name:"delete",displayName:t("comments","Delete comment"),iconClass:"icon-delete"}],initialize:function(){},events:{"click a.action":"_onClickAction"},_onClickAction:function(t){var e=$(t.currentTarget);e.hasClass("menuitem")||(e=e.closest(".menuitem")),OC.hideMenus(),this.trigger("select:menu-item-clicked",t,e.data("action"))},render:function(){this.$el.html(OCA.Comments.Templates.commentsmodifymenu({items:this._scopes}))},show:function(t){for(var e in this._context=t,this._scopes)this._scopes[e].active=!1;var n=$(t.target),o=n.offset(),i=n.closest(".authorRow").offset(),a={top:o.top-i.top+48,left:"",right:""};a.left=o.left-i.left,a.left>200?(a.left="",a.right=this.$el.closest(".comment").find(".date").width(),this.$el.removeClass("menu-left").addClass("menu-right")):this.$el.removeClass("menu-right").addClass("menu-left"),this.$el.css(a),this.render(),this.$el.removeClass("hidden"),OC.showMenu(null,this.$el)}}),OCA.Comments=OCA.Comments||{},OCA.Comments.CommentsModifyMenu=o},function(e,o){_.extend(OC.Files.Client,{PROPERTY_COMMENTS_UNREAD:"{"+OC.Files.Client.NS_OWNCLOUD+"}comments-unread"}),OCA.Comments=_.extend({},OCA.Comments),OCA.Comments||(OCA.Comments={}),OCA.Comments.FilesPlugin={ignoreLists:["trashbin","files.public"],_formatCommentCount:function(t){return OCA.Comments.Templates.filesplugin({count:t,countMessage:n("comments","%n unread comment","%n unread comments",t),iconUrl:OC.imagePath("core","actions/comment")})},attach:function(e){var o=this;if(!(this.ignoreLists.indexOf(e.id)>=0)){e.registerTabView(new OCA.Comments.CommentsTabView("commentsTabView"));var i=e._getWebdavProperties;e._getWebdavProperties=function(){var t=i.apply(this,arguments);return t.push(OC.Files.Client.PROPERTY_COMMENTS_UNREAD),t},e.filesClient.addFileInfoParser((function(t){var e={},n=t.propStat[0].properties[OC.Files.Client.PROPERTY_COMMENTS_UNREAD];return _.isUndefined(n)||""===n||(e.commentsUnread=parseInt(n,10)),e})),e.$el.addClass("has-comments");var a=e._createRow;e._createRow=function(t){var e=a.apply(this,arguments);return t.commentsUnread&&e.attr("data-comments-unread",t.commentsUnread),e},e.fileActions.registerAction({name:"Comment",displayName:function(e){if(e&&e.$file){var o=parseInt(e.$file.data("comments-unread"),10);if(o>=0)return n("comments","1 new comment","{unread} new comments",o,{unread:o})}return t("comments","Comment")},mime:"all",order:-140,iconClass:"icon-comment",permissions:OC.PERMISSION_READ,type:OCA.Files.FileActions.TYPE_INLINE,render:function(t,e,n){var i=n.$file.data("comments-unread");if(i){var a=$(o._formatCommentCount(i));return n.$file.find("a.name>span.fileactions").append(a),a}return""},actionHandler:function(t,e){e.$file.find(".action-comment").tooltip("hide"),e.fileList.showDetailsView(t,"comments")}});var r=e.elementToFile;e.elementToFile=function(t){var e=r.apply(this,arguments),n=t.data("comments-unread");return n&&(e.commentsUnread=n),e}}}},OC.Plugins.register("OCA.Files.FileList",OCA.Comments.FilesPlugin)},function(t,e){OCA.Comments.ActivityTabViewPlugin={prepareModelForDisplay:function(t,e,n){if("comments"===t.get("app")&&"comments"===t.get("type")&&"ActivityTabView"===n&&(e.addClass("comment"),t.get("message")&&this._isLong(t.get("message")))){e.addClass("collapsed");var o=$("
    ").addClass("message-overlay");e.find(".activitymessage").after(o),e.on("click",this._onClickCollapsedComment)}},_onClickCollapsedComment:function(t){var e=$(t.target);e.is(".comment")||(e=e.closest(".comment")),e.removeClass("collapsed")},_isLong:function(t){return t.length>250||(t.match(/\n/g)||[]).length>1}},OC.Plugins.register("OCA.Activity.RenderingPlugins",OCA.Comments.ActivityTabViewPlugin)},function(t,e){!function(t,e,n){"use strict";var o=function(){this.initialize()};o.prototype={fileList:null,initialize:function(){var o=this;this.fileAppLoaded=function(){return!!e.Files&&!!e.Files.App},this.renderCommentResult=function(e,o){var i;(i=n(".nofilterresults")).hasClass("hidden")||i.addClass("hidden"),this.updateLegacyMimetype(o);var a=n("
    ").addClass("path").text(o.path),r=n("
    ");r.addClass("avatar").css("display","inline-block").css("vertical-align","middle").css("margin","0 5px 2px 3px"),o.authorName?r.avatar(o.authorId,21,void 0,!1,void 0,o.authorName):r.avatar(o.authorId,21),e.find("td.info div.name").after(a).text(o.comment).prepend(n("").addClass("path").css("margin-right","5px").text(o.authorName)).prepend(r),e.find("td.result a").attr("href",o.link),e.find("td.icon").css("background-image","url("+t.imagePath("core","actions/comment")+")").css("opacity",".4");var s=t.dirname(o.path);return s===o.path&&(s="/"),e.find("td.info a").attr("href",t.generateUrl("/apps/files/?dir={dir}&scrollto={scrollto}",{dir:s,scrollto:o.fileName})),e},this.handleCommentClick=function(e,n,i){return!o.fileAppLoaded()||"files"!==o.fileList.id||(o.fileList.changeDirectory(t.dirname(n.path)),o.fileList.scrollTo(n.name),!1)},this.updateLegacyMimetype=function(t){!t.mime&&t.mime_type&&(t.mime=t.mime_type)},this.setFileList=function(t){this.fileList=t},t.Plugins.register("OCA.Search.Core",this)},attach:function(t){t.setRenderer("comment",this.renderCommentResult.bind(this)),t.setHandler("comment",this.handleCommentClick.bind(this))}},e.Search.comment=new o}(OC,OCA,$)},function(t,e,n){var o,i,a;a=this,o=[n(0)],void 0===(i=function(t){return a.returnExportsGlobal=function(t){"use strict";var e,n,o,i,a,r,s,l;e=function(){function e(t){this.$inputor=t,this.domInputor=this.$inputor[0]}return e.prototype.setPos=function(){return this.domInputor},e.prototype.getIEPosition=function(){return this.getPosition()},e.prototype.getPosition=function(){var t,e;return e=this.getOffset(),t=this.$inputor.offset(),e.left-=t.left,e.top-=t.top,e},e.prototype.getOldIEPos=function(){var t,e;return e=r.selection.createRange(),(t=r.body.createTextRange()).moveToElementText(this.domInputor),t.setEndPoint("EndToEnd",e),t.text.length},e.prototype.getPos=function(){var t,e,n;return(n=this.range())?((t=n.cloneRange()).selectNodeContents(this.domInputor),t.setEnd(n.endContainer,n.endOffset),e=t.toString().length,t.detach(),e):r.selection?this.getOldIEPos():void 0},e.prototype.getOldIEOffset=function(){var t,e;return(t=r.selection.createRange().duplicate()).moveStart("character",-1),{height:(e=t.getBoundingClientRect()).bottom-e.top,left:e.left,top:e.top}},e.prototype.getOffset=function(){var e,n,o,i,a;return s.getSelection&&(o=this.range())?(o.endOffset-1>0&&o.endContainer===!this.domInputor&&((e=o.cloneRange()).setStart(o.endContainer,o.endOffset-1),e.setEnd(o.endContainer,o.endOffset),n={height:(i=e.getBoundingClientRect()).height,left:i.left+i.width,top:i.top},e.detach()),n&&0!==(null!=n?n.height:void 0)||(e=o.cloneRange(),a=t(r.createTextNode("|")),e.insertNode(a[0]),e.selectNode(a[0]),n={height:(i=e.getBoundingClientRect()).height,left:i.left,top:i.top},a.remove(),e.detach())):r.selection&&(n=this.getOldIEOffset()),n&&(n.top+=t(s).scrollTop(),n.left+=t(s).scrollLeft()),n},e.prototype.range=function(){var t;if(s.getSelection)return(t=s.getSelection()).rangeCount>0?t.getRangeAt(0):null},e}(),n=function(){function e(t){this.$inputor=t,this.domInputor=this.$inputor[0]}return e.prototype.getIEPos=function(){var t,e,n,o,i,a;return e=this.domInputor,o=0,(i=r.selection.createRange())&&i.parentElement()===e&&(n=e.value.replace(/\r\n/g,"\n").length,(a=e.createTextRange()).moveToBookmark(i.getBookmark()),(t=e.createTextRange()).collapse(!1),o=a.compareEndPoints("StartToEnd",t)>-1?n:-a.moveStart("character",-n)),o},e.prototype.getPos=function(){return r.selection?this.getIEPos():this.domInputor.selectionStart},e.prototype.setPos=function(t){var e,n;return e=this.domInputor,r.selection?((n=e.createTextRange()).move("character",t),n.select()):e.setSelectionRange&&e.setSelectionRange(t,t),e},e.prototype.getIEOffset=function(t){var e;return e=this.domInputor.createTextRange(),t||(t=this.getPos()),e.move("character",t),{left:e.boundingLeft,top:e.boundingTop,height:e.boundingHeight}},e.prototype.getOffset=function(e){var n,o,i;return n=this.$inputor,r.selection?((o=this.getIEOffset(e)).top+=t(s).scrollTop()+n.scrollTop(),o.left+=t(s).scrollLeft()+n.scrollLeft(),o):(o=n.offset(),i=this.getPosition(e),o={left:o.left+i.left-n.scrollLeft(),top:o.top+i.top-n.scrollTop(),height:i.height})},e.prototype.getPosition=function(t){var e,n,i,a,r;return e=this.$inputor,i=function(t){return t=t.replace(/<|>|`|"|&/g,"?").replace(/\r\n|\r|\n/g,"
    "),/firefox/i.test(navigator.userAgent)&&(t=t.replace(/\s/g," ")),t},void 0===t&&(t=this.getPos()),r=e.val().slice(0,t),n=e.val().slice(t),a=""+i(r)+"",a+="|",a+=""+i(n)+"",new o(e).create(a).rect()},e.prototype.getIEPosition=function(t){var e,n;return n=this.getIEOffset(t),e=this.$inputor.offset(),{left:n.left-e.left,top:n.top-e.top,height:n.height}},e}(),o=function(){function e(t){this.$inputor=t}return e.prototype.css_attr=["borderBottomWidth","borderLeftWidth","borderRightWidth","borderTopStyle","borderRightStyle","borderBottomStyle","borderLeftStyle","borderTopWidth","boxSizing","fontFamily","fontSize","fontWeight","height","letterSpacing","lineHeight","marginBottom","marginLeft","marginRight","marginTop","outlineWidth","overflow","overflowX","overflowY","paddingBottom","paddingLeft","paddingRight","paddingTop","textAlign","textOverflow","textTransform","whiteSpace","wordBreak","wordWrap"],e.prototype.mirrorCss=function(){var e,n=this;return e={position:"absolute",left:-9999,top:0,zIndex:-2e4},"TEXTAREA"===this.$inputor.prop("tagName")&&this.css_attr.push("width"),t.each(this.css_attr,(function(t,o){return e[o]=n.$inputor.css(o)})),e},e.prototype.create=function(e){return this.$mirror=t("
    "),this.$mirror.css(this.mirrorCss()),this.$mirror.html(e),this.$inputor.after(this.$mirror),this},e.prototype.rect=function(){var t,e,n;return n={left:(e=(t=this.$mirror.find("#caret")).position()).left,top:e.top,height:t.height()},this.$mirror.remove(),n},e}(),i={contentEditable:function(t){return!(!t[0].contentEditable||"true"!==t[0].contentEditable)}},a={pos:function(t){return t||0===t?this.setPos(t):this.getPos()},position:function(t){return r.selection?this.getIEPosition(t):this.getPosition(t)},offset:function(t){return this.getOffset(t)}},r=null,s=null,l=function(t){var e;return(e=null!=t?t.iframe:void 0)?(s=e.contentWindow,r=e.contentDocument||s.document):(s=window,r=document)},t.fn.caret=function(o,r,s){var c;return a[o]?(t.isPlainObject(r)?(l(r),r=void 0):l(s),c=i.contentEditable(this)?new e(this):new n(this),a[o].apply(c,[r])):t.error("Method "+o+" does not exist on jQuery.caret")},t.fn.caret.EditableCaret=e,t.fn.caret.InputCaret=n,t.fn.caret.Utils=i,t.fn.caret.apis=a}(t)}.apply(e,o))||(t.exports=i)},function(t,e,n){var o,i;function a(t){return(a="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(t){return typeof t}:function(t){return t&&"function"==typeof Symbol&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t})(t)}o=[n(0)],void 0===(i=function(t){return function(t){var e,n,o;n={ESC:27,TAB:9,ENTER:13,CTRL:17,A:65,P:80,N:78,LEFT:37,UP:38,RIGHT:39,DOWN:40,BACKSPACE:8,SPACE:32},e={beforeSave:function(t){return i.arrayToDefaultHash(t)},matcher:function(t,e,n,o){var i,a,r;return t=t.replace(/[\-\[\]\/\{\}\(\)\*\+\?\.\\\^\$\|]/g,"\\$&"),n&&(t="(?:^|\\s)"+t),i=decodeURI("%C3%80"),a=decodeURI("%C3%BF"),(r=new RegExp(t+"([A-Za-z"+i+"-"+a+"0-9_"+(o?" ":"")+"'.+-]*)$|"+t+"([^\\x00-\\xff]*)$","gi").exec(e))?r[2]||r[1]:null},filter:function(t,e,n){var o,i,a,r;for(o=[],i=0,r=e.length;r>i;i++)a=e[i],~new String(a[n]).toLowerCase().indexOf(t.toLowerCase())&&o.push(a);return o},remoteFilter:null,sorter:function(t,e,n){var o,i,a,r;if(!t)return e;for(o=[],i=0,r=e.length;r>i;i++)(a=e[i]).atwho_order=new String(a[n]).toLowerCase().indexOf(t.toLowerCase()),a.atwho_order>-1&&o.push(a);return o.sort((function(t,e){return t.atwho_order-e.atwho_order}))},tplEval:function(t,e){var n;n=t;try{return"string"!=typeof t&&(n=t(e)),n.replace(/\$\{([^\}]*)\}/g,(function(t,n,o){return e[n]}))}catch(t){return""}},highlighter:function(t,e){var n;return e?(n=new RegExp(">\\s*([^<]*?)("+e.replace("+","\\+")+")([^<]*)\\s*<","ig"),t.replace(n,(function(t,e,n,o){return"> "+e+""+n+""+o+" <"}))):t},beforeInsert:function(t,e,n){return t},beforeReposition:function(t){return t},afterMatchFailed:function(t,e){}},o=function(){function e(e){this.currentFlag=null,this.controllers={},this.aliasMaps={},this.$inputor=t(e),this.setupRootElement(),this.listen()}return e.prototype.createContainer=function(e){var n;return null!=(n=this.$el)&&n.remove(),t(e.body).append(this.$el=t("
    "))},e.prototype.setupRootElement=function(e,n){var o,i;if(null==n&&(n=!1),e)this.window=e.contentWindow,this.document=e.contentDocument||this.window.document,this.iframe=e;else{this.document=this.$inputor[0].ownerDocument,this.window=this.document.defaultView||this.document.parentWindow;try{this.iframe=this.window.frameElement}catch(i){if(o=i,this.iframe=null,t.fn.atwho.debug)throw new Error("iframe auto-discovery is failed.\nPlease use `setIframe` to set the target iframe manually.\n"+o)}}return this.createContainer((this.iframeAsRoot=n)?this.document:document)},e.prototype.controller=function(t){var e,n,o,i;if(this.aliasMaps[t])n=this.controllers[this.aliasMaps[t]];else for(o in i=this.controllers)if(e=i[o],o===t){n=e;break}return n||this.controllers[this.currentFlag]},e.prototype.setContextFor=function(t){return this.currentFlag=t,this},e.prototype.reg=function(t,e){var n,o;return o=(n=this.controllers)[t]||(n[t]=this.$inputor.is("[contentEditable]")?new l(this,t):new s(this,t)),e.alias&&(this.aliasMaps[e.alias]=t),o.init(e),this},e.prototype.listen=function(){return this.$inputor.on("compositionstart",function(t){return function(e){var n;return null!=(n=t.controller())&&n.view.hide(),t.isComposing=!0,null}}(this)).on("compositionend",function(t){return function(e){return t.isComposing=!1,setTimeout((function(e){return t.dispatch(e)})),null}}(this)).on("keyup.atwhoInner",function(t){return function(e){return t.onKeyup(e)}}(this)).on("keydown.atwhoInner",function(t){return function(e){return t.onKeydown(e)}}(this)).on("blur.atwhoInner",function(t){return function(e){var n;return(n=t.controller())?(n.expectedQueryCBId=null,n.view.hide(e,n.getOpt("displayTimeout"))):void 0}}(this)).on("click.atwhoInner",function(t){return function(e){return t.dispatch(e)}}(this)).on("scroll.atwhoInner",function(t){return function(){var e;return e=t.$inputor.scrollTop(),function(n){var o,i;return o=n.target.scrollTop,e!==o&&null!=(i=t.controller())&&i.view.hide(n),e=o,!0}}}(this)())},e.prototype.shutdown=function(){var t,e;for(t in e=this.controllers)e[t].destroy(),delete this.controllers[t];return this.$inputor.off(".atwhoInner"),this.$el.remove()},e.prototype.dispatch=function(t){var e,n,o,i;for(e in i=[],o=this.controllers)n=o[e],i.push(n.lookUp(t));return i},e.prototype.onKeyup=function(e){var o;switch(e.keyCode){case n.ESC:e.preventDefault(),null!=(o=this.controller())&&o.view.hide();break;case n.DOWN:case n.UP:case n.CTRL:case n.ENTER:t.noop();break;case n.P:case n.N:e.ctrlKey||this.dispatch(e);break;default:this.dispatch(e)}},e.prototype.onKeydown=function(e){var o,i;if((i=null!=(o=this.controller())?o.view:void 0)&&i.visible())switch(e.keyCode){case n.ESC:e.preventDefault(),i.hide(e);break;case n.UP:e.preventDefault(),i.prev();break;case n.DOWN:e.preventDefault(),i.next();break;case n.P:if(!e.ctrlKey)return;e.preventDefault(),i.prev();break;case n.N:if(!e.ctrlKey)return;e.preventDefault(),i.next();break;case n.TAB:case n.ENTER:case n.SPACE:if(!i.visible())return;if(!this.controller().getOpt("spaceSelectsMatch")&&e.keyCode===n.SPACE)return;if(!this.controller().getOpt("tabSelectsMatch")&&e.keyCode===n.TAB)return;i.highlighted()?(e.preventDefault(),i.choose(e)):i.hide(e);break;default:t.noop()}},e}();var i,r=[].slice;i=function(){function n(e,n){this.app=e,this.at=n,this.$inputor=this.app.$inputor,this.id=this.$inputor[0].id||this.uid(),this.expectedQueryCBId=null,this.setting=null,this.query=null,this.pos=0,this.range=null,0===(this.$el=t("#atwho-ground-"+this.id,this.app.$el)).length&&this.app.$el.append(this.$el=t("
    ")),this.model=new c(this),this.view=new m(this)}return n.prototype.uid=function(){return(Math.random().toString(16)+"000000000").substr(2,8)+(new Date).getTime()},n.prototype.init=function(e){return this.setting=t.extend({},this.setting||t.fn.atwho.default,e),this.view.init(),this.model.reload(this.setting.data)},n.prototype.destroy=function(){return this.trigger("beforeDestroy"),this.model.destroy(),this.view.destroy(),this.$el.remove()},n.prototype.callDefault=function(){var n,o,i,a;a=arguments[0],n=2<=arguments.length?r.call(arguments,1):[];try{return e[a].apply(this,n)}catch(i){return o=i,t.error(o+" Or maybe At.js doesn't have function "+a)}},n.prototype.trigger=function(t,e){var n,o;return null==e&&(e=[]),e.push(this),o=(n=this.getOpt("alias"))?t+"-"+n+".atwho":t+".atwho",this.$inputor.trigger(o,e)},n.prototype.callbacks=function(t){return this.getOpt("callbacks")[t]||e[t]},n.prototype.getOpt=function(t,e){try{return this.setting[t]}catch(t){return null}},n.prototype.insertContentFor=function(e){var n,o;return o=this.getOpt("insertTpl"),n=t.extend({},e.data("item-data"),{"atwho-at":this.at}),this.callbacks("tplEval").call(this,o,n,"onInsert")},n.prototype.renderView=function(t){var e;return e=this.getOpt("searchKey"),t=this.callbacks("sorter").call(this,this.query.text,t.slice(0,1001),e),this.view.render(t.slice(0,this.getOpt("limit")))},n.arrayToDefaultHash=function(e){var n,o,i,a;if(!t.isArray(e))return e;for(a=[],n=0,i=e.length;i>n;n++)o=e[n],t.isPlainObject(o)?a.push(o):a.push({name:o});return a},n.prototype.lookUp=function(t){var e,n;if((!t||"click"!==t.type||this.getOpt("lookUpOnClick"))&&(!this.getOpt("suspendOnComposing")||!this.app.isComposing))return(e=this.catchQuery(t))?(this.app.setContextFor(this.at),(n=this.getOpt("delay"))?this._delayLookUp(e,n):this._lookUp(e),e):(this.expectedQueryCBId=null,e)},n.prototype._delayLookUp=function(t,e){var n,o;return n=Date.now?Date.now():(new Date).getTime(),this.previousCallTime||(this.previousCallTime=n),(o=e-(n-this.previousCallTime))>0&&e>o?(this.previousCallTime=n,this._stopDelayedCall(),this.delayedCallTimeout=setTimeout(function(e){return function(){return e.previousCallTime=0,e.delayedCallTimeout=null,e._lookUp(t)}}(this),e)):(this._stopDelayedCall(),this.previousCallTime!==n&&(this.previousCallTime=0),this._lookUp(t))},n.prototype._stopDelayedCall=function(){return this.delayedCallTimeout?(clearTimeout(this.delayedCallTimeout),this.delayedCallTimeout=null):void 0},n.prototype._generateQueryCBId=function(){return{}},n.prototype._lookUp=function(e){var n;return n=function(t,e){return t===this.expectedQueryCBId?e&&e.length>0?this.renderView(this.constructor.arrayToDefaultHash(e)):this.view.hide():void 0},this.expectedQueryCBId=this._generateQueryCBId(),this.model.query(e.text,t.proxy(n,this,this.expectedQueryCBId))},n}();var s,l,c,m,u,d=function(t,e){function n(){this.constructor=t}for(var o in e)h.call(e,o)&&(t[o]=e[o]);return n.prototype=e.prototype,t.prototype=new n,t.__super__=e.prototype,t},h={}.hasOwnProperty;s=function(e){function n(){return n.__super__.constructor.apply(this,arguments)}return d(n,e),n.prototype.catchQuery=function(){var t,e,n,o,i,a,r;return e=this.$inputor.val(),t=this.$inputor.caret("pos",{iframe:this.app.iframe}),r=e.slice(0,t),(o="string"==typeof(i=this.callbacks("matcher").call(this,this.at,r,this.getOpt("startWithSpace"),this.getOpt("acceptSpaceBar"))))&&i.length0?t.getRangeAt(0):void 0},o.prototype._setRange=function(e,n,o){return null==o&&(o=this._getRange()),o&&n?(n=t(n)[0],"after"===e?(o.setEndAfter(n),o.setStartAfter(n)):(o.setEndBefore(n),o.setStartBefore(n)),o.collapse(!1),this._clearRange(o)):void 0},o.prototype._clearRange=function(t){var e;return null==t&&(t=this._getRange()),e=this.app.window.getSelection(),null==this.ctrl_a_pressed?(e.removeAllRanges(),e.addRange(t)):void 0},o.prototype._movingEvent=function(t){var e;return"click"===t.type||(e=t.which)===n.RIGHT||e===n.LEFT||e===n.UP||e===n.DOWN},o.prototype._unwrap=function(e){var n;return(n=(e=t(e).unwrap().get(0)).nextSibling)&&n.nodeValue&&(e.nodeValue+=n.nodeValue,t(n).remove()),e},o.prototype.catchQuery=function(e){var o,i,a,r,s,l,c,m,u,d,h,p;if((p=this._getRange())&&p.collapsed){if(e.which===n.ENTER)return(i=t(p.startContainer).closest(".atwho-query")).contents().unwrap(),i.is(":empty")&&i.remove(),(i=t(".atwho-query",this.app.document)).text(i.text()).contents().last().unwrap(),void this._clearRange();if(/firefox/i.test(navigator.userAgent)){if(t(p.startContainer).is(this.$inputor))return void this._clearRange();e.which===n.BACKSPACE&&p.startContainer.nodeType===document.ELEMENT_NODE&&(u=p.startOffset-1)>=0?((a=p.cloneRange()).setStart(p.startContainer,u),t(a.cloneContents()).contents().last().is(".atwho-inserted")&&(s=t(p.startContainer).contents().get(u),this._setRange("after",t(s).contents().last()))):e.which===n.LEFT&&p.startContainer.nodeType===document.TEXT_NODE&&(o=t(p.startContainer.previousSibling)).is(".atwho-inserted")&&0===p.startOffset&&this._setRange("after",o.contents().last())}if(t(p.startContainer).closest(".atwho-inserted").addClass("atwho-query").siblings().removeClass("atwho-query"),(i=t(".atwho-query",this.app.document)).length>0&&i.is(":empty")&&0===i.text().length&&i.remove(),this._movingEvent(e)||i.removeClass("atwho-inserted"),i.length>0)switch(e.which){case n.LEFT:return this._setRange("before",i.get(0),p),void i.removeClass("atwho-query");case n.RIGHT:return this._setRange("after",i.get(0).nextSibling,p),void i.removeClass("atwho-query")}if(i.length>0&&(h=i.attr("data-atwho-at-query"))&&(i.empty().html(h).attr("data-atwho-at-query",null),this._setRange("after",i.get(0),p)),(a=p.cloneRange()).setStart(p.startContainer,0),l="string"==typeof(m=this.callbacks("matcher").call(this,this.at,a.toString(),this.getOpt("startWithSpace"),this.getOpt("acceptSpaceBar"))),0===i.length&&l&&(r=p.startOffset-this.at.length-m.length)>=0&&(p.setStart(p.startContainer,r),i=t("",this.app.document).attr(this.getOpt("editableAtwhoQueryAttrs")).addClass("atwho-query"),p.surroundContents(i.get(0)),(c=i.contents().last().get(0))&&(/firefox/i.test(navigator.userAgent)?(p.setStart(c,c.length),p.setEnd(c,c.length),this._clearRange(p)):this._setRange("after",c,p))),!(l&&m.length=0&&(this._movingEvent(e)&&i.hasClass("atwho-inserted")?i.removeClass("atwho-query"):!1!==this.callbacks("afterMatchFailed").call(this,this.at,i)&&this._setRange("after",this._unwrap(i.text(i.text()).contents().first()))),null)}},o.prototype.rect=function(){var e,n;return(n=this.query.el.offset())&&this.query.el[0].getClientRects().length?(this.app.iframe&&!this.app.iframeAsRoot&&(e=t(this.app.iframe).offset(),n.left+=e.left-this.$inputor.scrollLeft(),n.top+=e.top-this.$inputor.scrollTop()),n.bottom=n.top+this.query.el.height(),n):void 0},o.prototype.insert=function(t,e){var n,o,i,a,r;return this.$inputor.is(":focus")||this.$inputor.focus(),(o=this.getOpt("functionOverrides")).insert?o.insert.call(this,t,e):(a=""===(a=this.getOpt("suffix"))?a:a||" ",n=e.data("item-data"),this.query.el.removeClass("atwho-query").addClass("atwho-inserted").html(t).attr("data-atwho-at-query",""+n["atwho-at"]+this.query.text).attr("contenteditable","false"),(i=this._getRange())&&(this.query.el.length&&i.setEndAfter(this.query.el[0]),i.collapse(!1),i.insertNode(r=this.app.document.createTextNode(""+a)),this._setRange("after",r,i)),this.$inputor.is(":focus")||this.$inputor.focus(),this.$inputor.change())},o}(i),c=function(){function e(t){this.context=t,this.at=this.context.at,this.storage=this.context.$inputor}return e.prototype.destroy=function(){return this.storage.data(this.at,null)},e.prototype.saved=function(){return this.fetch()>0},e.prototype.query=function(t,e){var n,o,i;return o=this.fetch(),i=this.context.getOpt("searchKey"),o=this.context.callbacks("filter").call(this.context,t,o,i)||[],n=this.context.callbacks("remoteFilter"),o.length>0||!n&&0===o.length?e(o):n.call(this.context,t,e)},e.prototype.fetch=function(){return this.storage.data(this.at)||[]},e.prototype.save=function(t){return this.storage.data(this.at,this.context.callbacks("beforeSave").call(this.context,t||[]))},e.prototype.load=function(t){return!this.saved()&&t?this._load(t):void 0},e.prototype.reload=function(t){return this._load(t)},e.prototype._load=function(e){return"string"==typeof e?t.ajax(e,{dataType:"json"}).done(function(t){return function(e){return t.save(e)}}(this)):this.save(e)},e}(),m=function(){function e(e){this.context=e,this.$el=t("
      "),this.$elUl=this.$el.children(),this.timeoutID=null,this.context.$el.append(this.$el),this.bindEvent()}return e.prototype.init=function(){var t,e;return e=this.context.getOpt("alias")||this.context.at.charCodeAt(0),(t=this.context.getOpt("headerTpl"))&&1===this.$el.children().length&&this.$el.prepend(t),this.$el.attr({id:"at-view-"+e})},e.prototype.destroy=function(){return this.$el.remove()},e.prototype.bindEvent=function(){var e,n,o;return e=this.$el.find("ul"),n=0,o=0,e.on("mousemove.atwho-view","li",(function(i){var a;if((n!==i.clientX||o!==i.clientY)&&(n=i.clientX,o=i.clientY,!(a=t(i.currentTarget)).hasClass("cur")))return e.find(".cur").removeClass("cur"),a.addClass("cur")})).on("click.atwho-view","li",function(n){return function(o){return e.find(".cur").removeClass("cur"),t(o.currentTarget).addClass("cur"),n.choose(o),o.preventDefault()}}(this))},e.prototype.visible=function(){return t.expr.filters.visible(this.$el[0])},e.prototype.highlighted=function(){return this.$el.find(".cur").length>0},e.prototype.choose=function(t){var e,n;return(e=this.$el.find(".cur")).length&&(n=this.context.insertContentFor(e),this.context._stopDelayedCall(),this.context.insert(this.context.callbacks("beforeInsert").call(this.context,n,e,t),e),this.context.trigger("inserted",[e,t]),this.hide(t)),this.context.getOpt("hideWithoutSuffix")?this.stopShowing=!0:void 0},e.prototype.reposition=function(e){var n,o,i,a;return n=this.context.app.iframeAsRoot?this.context.app.window:window,e.bottom+this.$el.height()-t(n).scrollTop()>t(n).height()&&(e.bottom=e.top-this.$el.height()),e.left>(i=t(n).width()-this.$el.width()-5)&&(e.left=i),o={left:e.left,top:e.bottom},null!=(a=this.context.callbacks("beforeReposition"))&&a.call(this.context,o),this.$el.offset(o),this.context.trigger("reposition",[o])},e.prototype.next=function(){var t,e,n;return(t=this.$el.find(".cur").removeClass("cur").next()).length||(t=this.$el.find("li:first")),t.addClass("cur"),n=(e=t[0]).offsetTop+e.offsetHeight+(e.nextSibling?e.nextSibling.offsetHeight:0),this.scrollTop(Math.max(0,n-this.$el.height()))},e.prototype.prev=function(){var t,e,n;return(e=this.$el.find(".cur").removeClass("cur").prev()).length||(e=this.$el.find("li:last")),e.addClass("cur"),t=(n=e[0]).offsetTop+n.offsetHeight+(n.nextSibling?n.nextSibling.offsetHeight:0),this.scrollTop(Math.max(0,t-this.$el.height()))},e.prototype.scrollTop=function(t){var e;return(e=this.context.getOpt("scrollDuration"))?this.$elUl.animate({scrollTop:t},e):this.$elUl.scrollTop(t)},e.prototype.show=function(){var t;return this.stopShowing?void(this.stopShowing=!1):(this.visible()||(this.$el.show(),this.$el.scrollTop(0),this.context.trigger("shown")),(t=this.context.rect())?this.reposition(t):void 0)},e.prototype.hide=function(t,e){var n;if(this.visible())return isNaN(e)?(this.$el.hide(),this.context.trigger("hidden",[t])):(n=function(t){return function(){return t.hide()}}(this),clearTimeout(this.timeoutID),this.timeoutID=setTimeout(n,e))},e.prototype.render=function(e){var n,o,i,a,r,s,l;if(t.isArray(e)&&e.length>0){for(this.$el.find("ul").empty(),o=this.$el.find("ul"),l=this.context.getOpt("displayTpl"),i=0,r=e.length;r>i;i++)a=e[i],a=t.extend({},a,{"atwho-at":this.context.at}),s=this.context.callbacks("tplEval").call(this.context,l,a,"onDisplay"),(n=t(this.context.callbacks("highlighter").call(this.context,s,this.context.query.text))).data("item-data",a),o.append(n);return this.show(),this.context.getOpt("highlightFirst")?o.find("li:first").addClass("cur"):void 0}this.hide()},e}(),u={load:function(t,e){var n;return(n=this.controller(t))?n.model.load(e):void 0},isSelecting:function(){var t;return!!(null!=(t=this.controller())?t.view.visible():void 0)},hide:function(){var t;return null!=(t=this.controller())?t.view.hide():void 0},reposition:function(){var t;return(t=this.controller())?t.view.reposition(t.rect()):void 0},setIframe:function(t,e){return this.setupRootElement(t,e),null},run:function(){return this.dispatch()},destroy:function(){return this.shutdown(),this.$inputor.data("atwho",null)}},t.fn.atwho=function(e){var n,i;return n=arguments,i=null,this.filter('textarea, input, [contenteditable=""], [contenteditable=true]').each((function(){var r,s;return(s=(r=t(this)).data("atwho"))||r.data("atwho",s=new o(this)),"object"!=a(e)&&e?u[e]&&s?i=u[e].apply(s,Array.prototype.slice.call(n,1)):t.error("Method "+e+" does not exist on jQuery.atwho"):s.reg(e.at,e)})),null!=i?i:this},t.fn.atwho.default={at:void 0,alias:void 0,data:null,displayTpl:"
    • ${name}
    • ",insertTpl:"${atwho-at}${name}",headerTpl:null,callbacks:e,functionOverrides:{},searchKey:"name",suffix:void 0,hideWithoutSuffix:!1,startWithSpace:!0,acceptSpaceBar:!1,highlightFirst:!0,limit:5,maxLen:20,minLen:0,displayTimeout:300,delay:null,spaceSelectsMatch:!1,tabSelectsMatch:!0,editableAtwhoQueryAttrs:{},scrollDuration:150,suspendOnComposing:!0,lookUpOnClick:!0},t.fn.atwho.debug=!1}(t)}.apply(e,o))||(t.exports=i)},function(t,e,n){var o=n(17);"string"==typeof o&&(o=[[t.i,o,""]]),o.locals&&(t.exports=o.locals);(0,n(2).default)("8e87fa8e",o,!0,{})},function(t,e,n){(t.exports=n(1)(!1)).push([t.i,".atwho-view{position:absolute;top:0;left:0;display:none;margin-top:18px;background:var(--color-main-background);color:var(--color-main-text);border:1px solid var(--color-border);border-radius:var(--border-radius);box-shadow:0 0 5px var(--color-box-shadow);min-width:120px;z-index:11110 !important}.atwho-view .atwho-header{padding:5px;margin:5px;cursor:pointer;border-bottom:solid 1px var(--color-border);color:var(--color-main-text);font-size:11px;font-weight:bold}.atwho-view .atwho-header .small{color:var(--color-main-text);float:right;padding-top:2px;margin-right:-5px;font-size:12px;font-weight:normal}.atwho-view .atwho-header:hover{cursor:default}.atwho-view .cur{background:var(--color-primary);color:var(--color-primary-text)}.atwho-view .cur small{color:var(--color-primary-text)}.atwho-view strong{color:var(--color-main-text);font-weight:normal}.atwho-view .cur strong{color:var(--color-primary-text);font-weight:normal}.atwho-view ul{list-style:none;padding:0;margin:auto;max-height:200px;overflow-y:auto}.atwho-view ul li{display:block;padding:5px 10px;border-bottom:1px solid var(--color-border);cursor:pointer}.atwho-view small{font-size:smaller;color:var(--color-main-text);font-weight:normal}\n",""])},function(t,e,n){var o=n(19);"string"==typeof o&&(o=[[t.i,o,""]]),o.locals&&(t.exports=o.locals);(0,n(2).default)("477a5c21",o,!0,{})},function(t,e,n){(t.exports=n(1)(!1)).push([t.i,"#commentsTabView .emptycontent{margin-top:0}#commentsTabView .newCommentForm{margin-left:36px;position:relative}#commentsTabView .newCommentForm .message{width:100%;padding:10px;min-height:44px;margin:0;padding-right:30px}#commentsTabView .newCommentForm .submit,#commentsTabView .newCommentForm .submitLoading{width:44px;height:44px;margin:0;padding:13px;background-color:transparent;border:none;opacity:.3;position:absolute;bottom:0;right:0}#commentsTabView .deleteLoading{padding:14px;vertical-align:middle}#commentsTabView .newCommentForm .submit:not(:disabled):hover,#commentsTabView .newCommentForm .submit:not(:disabled):focus{opacity:1}#commentsTabView .newCommentForm div.message{resize:none}#commentsTabView .newCommentForm div.message:empty:before{content:attr(data-placeholder);color:grey}#commentsTabView .comment{position:relative;padding:10px 0 15px}#commentsTabView .comments .comment{border-top:1px solid var(--color-border)}#commentsTabView .comment .avatar,.atwho-view-ul * .avatar{width:32px;height:32px;line-height:32px;margin-right:5px}#commentsTabView .comment .message .avatar,.atwho-view-ul * .avatar{display:inline-block}#activityTabView li.comment.collapsed .activitymessage,#commentsTabView .comment.collapsed .message{white-space:pre-wrap}#activityTabView li.comment.collapsed .activitymessage,#commentsTabView .comment.collapsed .message{max-height:70px;overflow:hidden}#activityTabView li.comment .message-overlay,#commentsTabView .comment .message-overlay{display:none}#activityTabView li.comment.collapsed .message-overlay,#commentsTabView .comment.collapsed .message-overlay{display:block;position:absolute;z-index:2;height:50px;pointer-events:none;left:0;right:0;bottom:0;background:-moz-linear-gradient(rgba(var(--color-main-background), 0), var(--color-main-background));background:-webkit-linear-gradient(rgba(var(--color-main-background), 0), var(--color-main-background));background:-o-linear-gradient(rgba(var(--color-main-background), 0), var(--color-main-background));background:-ms-linear-gradient(rgba(var(--color-main-background), 0), var(--color-main-background));background:linear-gradient(rgba(var(--color-main-background), 0), var(--color-main-background));background-repeat:no-repeat}#commentsTabView .hidden{display:none !important}#commentsTabView .comment .authorRow{min-height:44px}#commentsTabView .comment .authorRow .tooltip{margin-top:5px}.atwho-view-ul * .avatar-name-wrapper,#commentsTabView .comment .authorRow{position:relative;display:inline-flex;align-items:center;width:100%}#commentsTabView .comment:not(.newCommentRow) .message .avatar-name-wrapper:not(.currentUser),#commentsTabView .comment:not(.newCommentRow) .message .avatar-name-wrapper:not(.currentUser) .avatar,#commentsTabView .comment:not(.newCommentRow) .message .avatar-name-wrapper:not(.currentUser) .avatar img,#commentsTabView .comment .authorRow .avatar:not(.currentUser),#commentsTabView .comment .authorRow .author:not(.currentUser){cursor:pointer}.atwho-view-ul .avatar-name-wrapper,.atwho-view-ul .avatar-name-wrapper .avatar,.atwho-view-ul .avatar-name-wrapper .avatar img{cursor:pointer}#commentsTabView .comments li .message .atwho-inserted .avatar-name-wrapper,#commentsTabView .newCommentForm .atwho-inserted .avatar-name-wrapper{position:relative;display:inline;vertical-align:top;background-color:var(--color-background-dark);border-radius:50vh;padding:1px 7px 1px 1px;white-space:nowrap}#commentsTabView .comments li .message .atwho-inserted .avatar-name-wrapper .avatar,#commentsTabView .newCommentForm .atwho-inserted .avatar-name-wrapper .avatar{height:16px;width:16px;vertical-align:middle;padding:1px;margin-top:-3px;margin-left:0;margin-right:2px}#commentsTabView .comments li .message .atwho-inserted .avatar-name-wrapper .avatar img,#commentsTabView .newCommentForm .atwho-inserted .avatar-name-wrapper .avatar img{vertical-align:top}#commentsTabView .comments li .message .atwho-inserted .avatar-name-wrapper strong,#commentsTabView .newCommentForm .atwho-inserted .avatar-name-wrapper strong{font-weight:bold}#commentsTabView .comments li .message .atwho-inserted .avatar-name-wrapper.currentUser,#commentsTabView .newCommentForm .atwho-inserted .avatar-name-wrapper.currentUser{background-color:var(--color-primary);color:var(--color-primary-text)}.atwho-view-ul * .avatar-name-wrapper{white-space:nowrap}#commentsTabView .comment .author,#commentsTabView .comment .date{opacity:.5}#commentsTabView .comment .author{max-width:210px;text-overflow:ellipsis;overflow:hidden;white-space:nowrap}#commentsTabView .comment .date{margin-left:auto;padding:10px 0px}#commentsTabView .comments>li:not(.newCommentRow) .message{padding-left:40px;word-wrap:break-word;overflow-wrap:break-word}#commentsTabView .comment .action{opacity:0.3;padding:14px;display:block}#commentsTabView .comment .action:hover,#commentsTabView .comment .action:focus{opacity:1}#commentsTabView .newCommentRow .action-container{margin-left:auto}#commentsTabView .comment.disabled .message{opacity:0.3}#commentsTabView .comment.disabled .action{display:none}#commentsTabView .message.error{color:#e9322d;border-color:#e9322d;box-shadow:0 0 6px #f8b9b7}.app-files .action-comment{padding:16px 14px}#commentsTabView .comment .message .contactsmenu-popover{left:-6px;top:24px}\n",""])}]); //# sourceMappingURL=comments.js.map