PageSourceSearch

https://quaker.software/s/c0aacc68167afe0d8b11e0786ae5e675-CDN/xgp…-previews:annotation-plugin.js?locale=en-US

js quaker.software collected 2026-09-29 00:00:49 UTC 57,809 bytes, 258 lines download raw bytes

1WRMCB=function(e){var c=console;if(c&&c.log&&c.error){c.log('Error running batched script.');c.error(e);}}
2;
3try {
4/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/templates/annotation.soy' */
5// This file was automatically generated from annotation.soy.
6// Please don't edit this file by hand.
7
8/**
9 * @fileoverview Templates in namespace FileViewer.Templates.Annotation.
10 */
11
12if (typeof FileViewer == 'undefined') { var FileViewer = {}; }
13if (typeof FileViewer.Templates == 'undefined') { FileViewer.Templates = {}; }
14if (typeof FileViewer.Templates.Annotation == 'undefined') { FileViewer.Templates.Annotation = {}; }
15
16
17FileViewer.Templates.Annotation.controlAnnotationButton = function(opt_data, opt_ignored) {
18  return '<a href="#" id="cp-control-panel-annotations" class="cp-icon" title="' + soy.$$escapeHtml('Comments') + '" role="button" tabindex="56" aria-haspopup="true">' + soy.$$escapeHtml('Comments') + '.<span class="counter">0</span></a>';
19};
20if (goog.DEBUG) {
21  FileViewer.Templates.Annotation.controlAnnotationButton.soyTemplateName = 'FileViewer.Templates.Annotation.controlAnnotationButton';
22}
23
24
25FileViewer.Templates.Annotation.blankAnnotation = function(opt_data, opt_ignored) {
26  return '<div id="cp-blank-annotation"><h5>' + soy.$$escapeHtml('Review and collaborate on this file') + '</h5><p>' + soy.$$escapeHtml('You can comment on most files (except audio and video), just drag a pin to where you want to add the first comment.') + '</p><p>' + soy.$$escapeHtml('@Mention team members in your comment to get their attention.') + '</p></div>';
27};
28if (goog.DEBUG) {
29  FileViewer.Templates.Annotation.blankAnnotation.soyTemplateName = 'FileViewer.Templates.Annotation.blankAnnotation';
30}
31
32
33FileViewer.Templates.Annotation.annotationHeader = function(opt_data, opt_ignored) {
34  return '<div class="cp-error"></div><a id="cp-annotation-next" title="' + soy.$$escapeHtml('Next comment') + '" class="cp-small-icon aui-icon aui-iconfont-chevron-down" href="#">' + soy.$$escapeHtml('Next comment') + '</a><a id="cp-annotation-previous" title="' + soy.$$escapeHtml('Previous comment') + '" class="cp-small-icon aui-icon aui-iconfont-chevron-up" href="#">' + soy.$$escapeHtml('Previous comment') + '</a>' + ((opt_data.current != 0) ? '<span id="cp-annotation-count">' + soy.$$escapeHtml(AJS.format('{0} of {1}',opt_data.current,opt_data.total)) + '</span>' : '') + ((opt_data.canDelete && ! opt_data.resolved) ? '<a id="cp-annotation-more" href="#cp-annotations-more-menu" aria-owns="cp-annotations-more-menu" aria-haspopup="true" class="aui-dropdown2-trigger aui-dropdown2-trigger-arrowless" data-fv-allow-focus="true">' + aui.icons.icon({useIconFont: true, size: 'small', icon: 'more', accessibilityText: 'More', extraClasses: 'cp-small-icon up'}) + '</a><div id="cp-annotations-more-menu" class="aui-dropdown2 aui-style-default" data-fv-allow-focus="true"><ul class="aui-list-truncate"><li><a href="#" id="cp-annotation-delete" class="interactive">' + soy.$$escapeHtml('Delete') + '</a></li></ul></div>' : '');
35};
36if (goog.DEBUG) {
37  FileViewer.Templates.Annotation.annotationHeader.soyTemplateName = 'FileViewer.Templates.Annotation.annotationHeader';
38}
39
40
41FileViewer.Templates.Annotation.annotationUserHeader = function(opt_data, opt_ignored) {
42  return '<div class="' + soy.$$escapeHtml(opt_data.small == true ? 'cp-annotation-user-small' : 'cp-annotation-user') + '"><img src="' + soy.$$escapeHtml(opt_data.author.avatar) + '"></img><a href="' + soy.$$escapeHtml(opt_data.author.profile) + '">' + soy.$$escapeHtml(opt_data.author.name) + '</a></div>';
43};
44if (goog.DEBUG) {
45  FileViewer.Templates.Annotation.annotationUserHeader.soyTemplateName = 'FileViewer.Templates.Annotation.annotationUserHeader';
46}
47
48
49FileViewer.Templates.Annotation.addAnnotation = function(opt_data, opt_ignored) {
50  return '<div class="cp-error"></div><div class="cp-annotation-adding">' + FileViewer.Templates.Annotation.annotationUserHeader(opt_data) + FileViewer.Templates.Annotation.annotationTextarea(null) + '</div>';
51};
52if (goog.DEBUG) {
53  FileViewer.Templates.Annotation.addAnnotation.soyTemplateName = 'FileViewer.Templates.Annotation.addAnnotation';
54}
55
56
57FileViewer.Templates.Annotation.annotationTextarea = function(opt_data, opt_ignored) {
58  return '<div class="cp-add-annotation cp-editor">
58' + FileViewer.Templates.Annotation.editorLoader(null) + '</div>';
59};
60if (goog.DEBUG) {
61  FileViewer.Templates.Annotation.annotationTextarea.soyTemplateName = 'FileViewer.Templates.Annotation.annotationTextarea';
62}
63
64
65FileViewer.Templates.Annotation.topLevelAnnotation = function(opt_data, opt_ignored) {
66  return '<div id="cp-top-level-annotation" data-commentId=' + soy.$$escapeHtml(opt_data.id) + '>' + FileViewer.Templates.Annotation.annotationUserHeader(opt_data) + '<div id="cp-annotation-main-comment" class="cp-annotation-comment  wiki-content"><p>' + soy.$$filterNoAutoescape(opt_data.comment) + '</p></div><ul class="cp-annotation-actions">' + ((opt_data.canEdit && ! opt_data.resolved) ? '<li><a class="cp-annotation-edit" href="#">' + soy.$$escapeHtml('Edit') + '</a></li>' : '') + ((opt_data.canResolve) ? '<li><a class="cp-annotation-resolve" href="#">' + ((opt_data.resolved) ? soy.$$escapeHtml('Unresolve') : soy.$$escapeHtml('Resolve')) + '</a></li>' : '') + ((! opt_data.resolved) ? '<span class="cp-annotation-comment-like"></span>' : '') + '<li class="nobullet">' + soy.$$escapeHtml(opt_data.date) + '</li></ul></id>';
67};
68if (goog.DEBUG) {
69  FileViewer.Templates.Annotation.topLevelAnnotation.soyTemplateName = 'FileViewer.Templates.Annotation.topLevelAnnotation';
70}
71
72
73FileViewer.Templates.Annotation.likes = function(opt_data, opt_ignored) {
74  return '' + ((! opt_data.isAnonymous && opt_data.canLike) ? '<li>' + ((opt_data.hasLiked) ? '<a class="cp-annotation-unlike" href="#">' + soy.$$escapeHtml('Unlike') + '</a>' : '<a class="cp-annotation-like" href="#">' + soy.$$escapeHtml('Like') + '</a>') + '</li>' : '') + ((opt_data.likes > 0) ? '<li><span class="cp-annotation-like-summary"><span class="cp-annotation-like-icon aui-icon aui-icon-small aui-iconfont-like-small"></span><span class="cp-annotation-count">' + soy.$$escapeHtml(opt_data.likes) + '</span></span></li>' : '');
75};
76if (goog.DEBUG) {
77  FileViewer.Templates.Annotation.likes.soyTemplateName = 'FileViewer.Templates.Annotation.likes';
78}
79
80
81FileViewer.Templates.Annotation.annotationReply = function(opt_data, opt_ignored) {
82  return FileViewer.Templates.Annotation.annotationUserHeader({author: opt_data.author, small: true}) + '<div class="cp-annotation-comment wiki-content" data-commentId=' + soy.$$escapeHtml(opt_data.id) + '><p>' + soy.$$filterNoAutoescape(opt_data.comment) + '</p></div><ul class="cp-annotation-actions">' + ((! opt_data.resolved) ? ((opt_data.canEdit) ? '<li><a class="cp-annotation-edit" href="#">' + soy.$$escapeHtml('Edit') + '</a></li>' : '') + ((opt_data.canDelete) ? '<li><a class="cp-annotation-delete" href="#">' + soy.$$escapeHtml('Delete') + '</a></li>' : '') + '<span class="cp-annotation-reply-like"></span>' : '') + '<li class="nobullet">' + soy.$$escapeHtml(opt_data.date) + '</li></ul>';
83};
84if (goog.DEBUG) {
85  FileViewer.Templates.Annotation.annotationReply.soyTemplateName = 'FileViewer.Templates.Annotation.annotationReply';
86}
87
88
89FileViewer.Templates.Annotation.annotationLike = function(opt_data, opt_ignored) {
90  return '<a href="#">' + ((opt_data.liked) ? soy.$$escapeHtml('Unlike') : soy.$$escapeHtml('Like')) + '</a>';
91};
92if (goog.DEBUG) {
93  FileViewer.Templates.Annotation.annotationLike.soyTemplateName = 'FileViewer.Templates.Annotation.annotationLike';
94}
95
96
97FileViewer.Templates.Annotation.annotationReplyInput = function(opt_data, opt_ignored) {
98  return '<div id="cp-annotation-reply-input">' + ((! opt_data.resolved && opt_data.canReply) ? FileViewer.Templates.Annotation.annotationUserHeader({author: opt_data.author, small: true}) + FileViewer.Templates.Annotation.replyInputBox(null) : '') + '</div>';
99};
100if (goog.DEBUG) {
101  FileViewer.Templates.Annotation.annotationReplyInput.soyTemplateName = 'FileViewer.Templates.Annotation.annotationReplyInput';
102}
103
104
105FileViewer.Templates.Annotation.replyInputBox = function(opt_data, opt_ignored) {
106  return '<input placeholder="' + soy.$$escapeHtml('Reply') + '"></input>';
107};
108if (goog.DEBUG) {
109  FileViewer.Templates.Annotation.replyInputBox.soyTemplateName = 'FileViewer.Templates.Annotation.replyInputBox';
110}
111
112
113FileViewer.Templates.Annotation.resolved = function(opt_data, opt_ignored) {
114  return '<div id="cp-annotation-resolved"><span class="aui-icon aui-icon-large aui-iconfont-check"></span>
114<p>' + soy.$$escapeHtml('Resolved') + '</p><div class="cp-resolved-info">' + soy.$$escapeHtml('Resolved feedback can be shown from the tools menu.') + '</div></div>';
115};
116if (goog.DEBUG) {
117  FileViewer.Templates.Annotation.resolved.soyTemplateName = 'FileViewer.Templates.Annotation.resolved';
118}
119
120
121FileViewer.Templates.Annotation.editorLoader = function(opt_data, opt_ignored) {
122  return '<form class="aui"><div class="loading-container"></div></form>';
123};
124if (goog.DEBUG) {
125  FileViewer.Templates.Annotation.editorLoader.soyTemplateName = 'FileViewer.Templates.Annotation.editorLoader';
126}
127
128
129FileViewer.Templates.Annotation.fileControlAnnotate = function(opt_data, opt_ignored) {
130  return '<a href="#" id=\'cp-file-control-annotate\' class=\'cp-icon cp-file-control-annotate\' tabindex="14" aria-label="' + soy.$$escapeHtml('Drag this pin to add a comment') + '"><span class="tooltip tooltip-s">' + soy.$$escapeHtml('Drag this pin to add a comment') + '</span></a>';
131};
132if (goog.DEBUG) {
133  FileViewer.Templates.Annotation.fileControlAnnotate.soyTemplateName = 'FileViewer.Templates.Annotation.fileControlAnnotate';
134}
135
136}catch(e){WRMCB(e)};
137;
138try {
139/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/templates/escape-error.soy' */
140// This file was automatically generated from escape-error.soy.
141// Please don't edit this file by hand.
142
143/**
144 * @fileoverview Templates in namespace FileViewer.Templates.
145 */
146
147if (typeof FileViewer == 'undefined') { var FileViewer = {}; }
148if (typeof FileViewer.Templates == 'undefined') { FileViewer.Templates = {}; }
149
150
151FileViewer.Templates.escapeError = function(opt_data, opt_ignored) {
152  return '<div>' + soy.$$escapeHtml(opt_data.text) + '</div>';
153};
154if (goog.DEBUG) {
155  FileViewer.Templates.escapeError.soyTemplateName = 'FileViewer.Templates.escapeError';
156}
157
158}catch(e){WRMCB(e)};
159;
160try {
161/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/utils/editor-utils.js' */
162define("cp/component/utils/editor-utils",["jquery","underscore","ajs","backbone","exports"],function(d,i,f,h,c){var g=["dateautocomplete","confluencemacrobrowser","propertypanel","jiraconnector","dfe"];var a=["autoresize"];function e(){return i.clone(g)}
162function b(){return i.clone(a)}function j(){var k=f.Rte&&f.Rte.getEditor();if(k&&k.getContent()!==""){k.setDirty(true)}if(k&&k.isDirty()&&!d(".quick-comment-body .editor-container").length){return window.confirm("You have an unsaved comment on this page. Are you sure you want to continue? You will lose any unsaved changes.")}return true}c.getUnsupportedRtePlugins=e;c.getSupportedRtePlugins=b;c.confirmProcess=j});
163}catch(e){WRMCB(e)};
164;
165try {
166/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/utils/editor.js' */
167define("cp/component/utils/editor",["jquery","underscore","ajs","tinymce","cp/component/utils/editor-utils","exports","MediaViewer"],function(d,s,f,a,i,t,c){var b;var m;var l;var h;var g;function o(v,u){if(!f.Confluence.EditorLoader.resourcesLoaded()){this.$form.find(".loading-container").spin("small")}b=c.prototype.close;u.close=function(){if(i.confirmProcess()){r();return b.apply(this,arguments)}};m=c.prototype.showFileNext;u.showFileNext=function(){if(i.confirmProcess()){r();return m.apply(this,arguments)}};l=c.prototype.showFilePrev;u.showFilePrev=function(){if(i.confirmProcess()){r();return l.apply(this,arguments)}};h=c.prototype.showFileWithCID;u.showFileWithCID=function(){if(i.confirmProcess()){r();return h.apply(this,arguments)}};g=c.prototype.showFile;u.showFile=function(){if(i.confirmProcess()){r();return g.apply(this,arguments)}};v&&v()}function k(u){f.Meta.set("content-type","comment");f.Meta.set("min-editor-height",80);f.Meta.set("use-inline-tasks","false");u&&u()}function j(v,u){u.$form.find(".loading-container").hide();u.$form.find("#rte-button-preview").hide();u.$form.find("#rte-button-publish").text("Save").removeAttr("title");u.$form.find("#rte-spinner").parent().addClass("rte-button-spinner").appendTo("#rte-savebar .toolbar-split .toolbar-split-right");u.$form.find("#toolbar-hints-draft-status").hide();u.$form.find("#wysiwygTextarea_ifr").height(f.Meta.get("min-editor-height"));f.Meta.set("min-editor-height",undefined);if(this.hideCancelButton){u.$form.find("#rte-button-cancel").hide()}v&&v();f.Confluence.QuickEdit.QuickEditPage.disable()}function p(v,u){u.close=b;u.showFileNext=m;u.showFilePrev=l;u.showFileWithCID=h;u.showFile=g;v&&v()}function n(u){return f.Confluence.QuickEdit.activateEditor({preActivate:s.partial(o,u.preActivate,u._mediaViewer),preInitialise:s.partial(k,u.preInitialise),postInitialise:s.partial(d.proxy(j,u),u.postInitialise),toolbar:false,$container:u.container,$form:u.form,saveHandler:u.saveHandler,cancelHandler:u.cancelHandler,fetchContent:u.fetchContent(),closeAnyExistingEditor:true,postDeactivate:s.partial(p,u.postDeactivate,u._mediaViewer),plugins:i.getSupportedRtePlugins(),excludePlugins:i.getUnsupportedRtePlugins()})}function r(){if(f.Rte&&f.Rte.getEditor()){if(!d(".quick-comment-body .editor-container").length){return f.Confluence.QuickEdit.deactivateEditor()}}else{return d.Deferred().resolve()}}function q(){return a.activeEditor.getContent()}function e(u){d(".ic-sidebar .rte-button-spinner").toggleClass("aui-icon-wait",u)}t.init=n;t.remove=r;t.getContent=q;t.setEditorBusy=e});
168}catch(e){WRMCB(e)};
169;
170try {
171/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/utils/editor-view.js' */
172define("cp/component/utils/editor-view",["backbone","underscore","jquery","cp/component/utils/editor","cp/component/utils/editor-utils"],function(f,c,d,a,e){var b=f.View.extend({initialize:function(g){this.editorSetup=g.editorSetup;this.preActivate=g.preActivate;this.preInitialise=g.preInitialise;this.postInitialise=g.postInitialise;this.container=g.container;this.saveHandler=g.saveHandler;this.cancelHandler=g.cancelHandler;this.postDeactivate=g.postDeactivate;this.content=g.content;this.errorCallback=g.errorCallback;this.restoreCallback=g.restoreCallback;this.successCallback=g.success;this._mediaViewer=g.mediaViewer;this.editorSetup&&this.editorSetup()},render:function(){a.init({preActivate:this.preActivate,preInitialise:this.preInitialise,postInitialise:this.postInitialise,container:this.container,form:this.container.find("form.aui"),saveHandler:this.saveHandler,cancelHandler:this.cancelHandler,fetchContent:function(){var g=new d.Deferred();g.resolve({editorContent:this.content});return g}.bind(this),closeAnyExistingEditor:true,postDeactivate:this.postDeactivate,_mediaViewer:this._mediaViewer}).fail(function(g){this.errorCallback(g)}.bind(this));return this},getContent:function(){return a.getContent()},remove:function(){a.remove();return this},checkIfOpen:function(){return e.confirmProcess()}});return b});
173}catch(e){WRMCB(e)};
174;
175try {
176/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/annotation-button-view.js' */
177define("cp/component/annotation/annotation-button-view",["jquery","backbone","cp/component/utils/editor-utils","core/template-store-singleton","confluence-previews/is-ignored-keypress-event"],function(d,f,e,a,c){var b=f.Vie
177w.extend({events:{click:"_toggleAnnotations",keydown:"_toggleAnnotations",},tagName:"span",initialize:function(g){this._mediaViewer=g.mediaViewer;this._model=this._mediaViewer.getCurrentFile();this._annotations=this._model.get("annotations");this.listenTo(this._annotations,"add reset sync change:resolved remove filterUpdated",this._updateAnnotationCount)},render:function(){this.$el.html(a.get("Annotation.controlAnnotationButton")());this._updateAnnotationCount();if(d.fn.tooltip){this.$("a").tooltip({gravity:"n"})}return this},_toggleAnnotations:function(g){if(c(g)){return}g.preventDefault();if(this._mediaViewer.getView().fileSidebarView.isAnyPanelInitialized()){if(e.confirmProcess()){this._mediaViewer.trigger("cp.close-editor");this._mediaViewer.getView().fileSidebarView.teardownPanel()}}else{this._annotations.getCurrentOrNext();this._mediaViewer.getView().fileSidebarView.initializePanel("annotations")}},_updateAnnotationCount:function(){var g=this._annotations.getCount();this.$(".counter").text(g>9?"9+":g)}});return b});
178}catch(e){WRMCB(e)};
179;
180try {
181/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/comments.js' */
182define("cp/component/annotation/comments",["backbone","underscore","cp/component/annotation/comment"],function(e,a,c){var b=function(f){return function(g){for(var h in f){if(f[h]!==g.get(h)){return false}}return true}};var d=e.Collection.extend({model:c,initialize:function(f,g){this._current=null;this.service=g&&g.service;this._currentFilter={resolved:false};if(g&&g.fileModel){this.fileModel=g.fileModel}this.listenTo(this,"remove",this.selectNextIfRemoved)},comparator:function(j,i){var h=j.get("position");var g=j.get("pageNumber");var f=i.get("position");var k=i.get("pageNumber");if(g!==k){return g>k?1:-1}if(h[1]!==f[1]){return h[1]>f[1]?1:-1}return(h[0]>f[0]?1:h[0]<f[0]?-1:0)},selectNextIfRemoved:function(f){if(this._current===f){this.next()}},fetchComments:function(){if(this.size()===0){return this.fetch()}else{return $.when()}},sync:function(i,h){if(!this.service){return}if(i==="read"){var g=h.service.getAnnotations(),f=this;g&&g.done(function(j){j=a.map(j,function(k){return new c(k,{service:f.service})});h.reset(j,{silent:true});h.trigger("sync",h)});return g}},currentIndexOfWhere:function(g,f){return f?this.where(f).indexOf(g):this.indexOf(g)},nextWhere:function(h){var g=this.indexOf(this._current);var f=this.chain().rest(g+1).filter(b(h)).first().value();f=f||this.chain().filter(b(h)).first().value();this.setSelected(f);return f},prevWhere:function(h){var g=this.indexOf(this._current);var f=this.chain().first(Math.max(g,0)).filter(b(h)).last().value();f=f||this.chain().filter(b(h)).last().value();this.setSelected(f);return f},currentIndexOf:function(f){return this.currentIndexOfWhere(f,this._currentFilter)},next:function(){return this.nextWhere(this._currentFilter)},prev:function(){return this.prevWhere(this._currentFilter)},getCurrent:function(){return this._current},getCurrentOrNext:function(){if(!this._current||!this.isFiltered(this._current)){this._current=this.next()}return this.getCurrent()},isFiltered:function(f){var g=b(this.getFilter());return g(f)},selectCommentWithId:function(g,f){var h=this.findWhere({id:g});if(h&&h.get("resolved")){this.setFilter()}if(f){h.replies.selectReplyWithId(f)}this.setSelected(h);this.trigger("pinSelected")},setSelected:function(g,f){this.invoke("set",{selected:false});this._current=null;if(g){g.set({selected:true});this._current=g;g.replies.fetch();!f&&this.trigger("selected",g)}else{!f&&this.trigger("unselected")}},setResolved:function(f){f.set({resolved:true})},getCountWhere:function(f){return f?this.where(f).length:this.size()},getCount:function(){return this.getCountWhere(this._currentFilter)},setFilter:function(f){this._currentFilter=f;this.trigger("filterUpdated");return this},getFilter:function(){return this._currentFilter}});return d});
183}catch(e){WRMCB(e)};
184;
185try {
186/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/comment.js' */
187define("cp/component/annotation/comment",["cp/component/annotation/replies","cp/component/annotation/likes","ajs","backbone"],function(b,d,a,e){var c=e.Model.extend({defaults:{author:{name:"",avatar:"",profile:""},comment:"",date:new Date(),pageNumber:1,position:[0.5,0.5],resolved:false,selected:false,hasEditPermission:true,hasResolvePermission:true,hasDeletePermission:true,hasReplyPermission:true},initialize:function(f,g){this.service=g.service;if(this.service){this.replies=new b(undefined,{service:this.service,parentModel:this})}else{this.replies=new b()}this.likes=new d([],{contentId:this.get("id"),replies:this.replies.models});this.on("change:id",this.createLikes);this.listenTo(this.replies,"reset sync",this.createLikes);this.createLikes();this.set("fileModel",f.fileModel)},createLikes:function(){if(!this.replies.isSynced()){return}
187if(this.get("id")!==undefined){this.likes.setReplies(this.replies.models);this.likes.fetch()}},setResolved:function(h,f,g){this.save({resolved:h},{success:f,error:g})},isNew:function(){return this.get("isNew")},sync:function(i,g,f){if(!this.service){return}if(i==="create"||i==="update"){var h=g.service.save(g);h.done(function(j){g.set(j);f.success()}).fail(function(j){f.error(j)});return h}else{if(i==="delete"){var h=g.service.remove(g);h.done(function(){f.success()}).fail(function(j){f.error(j)});return h}}}});return c});
188}catch(e){WRMCB(e)};
189;
190try {
191/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/replies.js' */
192define("cp/component/annotation/replies",["backbone","underscore","cp/component/annotation/reply"],function(d,b,a){var c=d.Collection.extend({initialize:function(e,f){this.parentModel=f.parentModel;this.service=f&&f.service;this.synced=false;this._skipFetch=false},sync:function(j,h,e){var i=h.parentModel&&h.parentModel.get("id");if(e.force){this._skipFetch=false}if(!this.service||!i||this._skipFetch){return}if(j==="read"){this._skipFetch=true;var g=h.service.getReplies({parentId:i}),f=this;g.done(function(k){k=b.map(k,function(l){return new a(l,{service:f.service})});this.synced=true;h.reset(k)}.bind(this)).fail(function(){this.synced=false;this._skipFetch=false}.bind(this))}},addReply:function(g,e){var f=new a(g,{service:this.service});this.setSelected(f);this.add(f);f.save(null,{wait:true,error:e.error,success:e.success})},selectReplyWithId:function(e){if(!this.isSynced()){this.listenToOnce(this,"reset",function(){this.setSelected(this.findWhere({id:e}))})}else{this.setSelected(this.findWhere({id:e}))}},setSelected:function(e){this.invoke("set",{selected:false});if(e){e.set("selected",true)}},isSynced:function(){return this.synced}});return c});
193}catch(e){WRMCB(e)};
194;
195try {
196/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/reply.js' */
197define("cp/component/annotation/reply",["backbone","cp/component/annotation/likes"],function(c,b){var a=c.Model.extend({defaults:{author:"",comment:"",date:new Date(),resolved:false,hasEditPermission:false,hasDeletePermission:false},initialize:function(d,e){this.service=e.service},sync:function(g,e,d){if(!this.service){return}if(g==="create"||g==="update"){var f=e.service.save(e);f.done(function(h){e.set(h);d.success()}).fail(function(h){d.error(h)});return f}else{if(g==="delete"){var f=e.service.remove(e);f.done(function(h){d.success()}).fail(function(h){d.error(h)});return f}}}});return a});
198}catch(e){WRMCB(e)};
199;
200try {
201/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/annotation-view.js' */
202define("cp/component/annotation/annotation-view",["backbone","jquery","ajs","cp/component/annotation/annotation-header-view","cp/component/annotation/comment-view","cp/component/annotation/add-annotation-view","core/template-store-singleton"],function(h,f,b,e,a,c,d){var g=h.View.extend({id:"cp-annotations",tagName:"div",initialize:function(i){this._mediaViewer=i.mediaViewer;this.fileSidebarView=i.panelView;this.model=this._mediaViewer.getCurrentFile();this.annotations=this.model.get("annotations");this.listenTo(this.annotations,"reset sync selected unselected add remove",this.render);this.listenTo(this.annotations,"pinSelected",this.show);this.listenTo(this.annotations,"filterUpdated",this.updateWithFiltered);this.listenTo(this._mediaViewer,"cp.close-editor",this._closeEditor);this.show();this.render()},teardown:function(){this.hide();this.commentView&&this.commentView.off().remove();this.addAnnotationView&&this.addAnnotationView.teardown()&&this.addAnnotationView.off().remove()},hide:function(){f("#cp-control-panel-annotations").removeClass("focused").removeAttr("aria-expanded");this.annotations.setSelected();this._mediaViewer._fileState.trigger("cp.hideAnnotations")},show:function(){f("#cp-control-panel-annotations").addClass("focused").attr("aria-expanded",true)},addAnnotation:function(j){if(!this.canOpenNewEditor()){f("#cp-file-control-annotate").draggable("option","disabled",fal
202se);return}this.show();this.annotations.setSelected();var i=this._mediaViewer.getCurrentFile().createAnnotation({author:this.currentUser,position:[j.x,j.y],pageNumber:j.pageNumber,isNew:true});this.annotations.setSelected(i,true);this.addAnnotationView=new c({annotation:i,collection:this.annotations,mediaViewer:this._mediaViewer,annotationView:this});this.$el.html(this.addAnnotationView.$el);this.addAnnotationView.render();this.$el.find("textarea.cp-add-annotation").focus()},render:function(){if(this.annotations){var i=this.annotations.getCurrent();if(!i){this.$el.html(d.get("Annotation.blankAnnotation")())}else{this.headerView=new e({model:this.model,annotationView:this});this.commentView=new a({model:i,annotationView:this});this.$el.empty().append(this.headerView.render().$el).append(this.commentView.render().el)}}b.trigger("ic-jim-async-supported");return this},_generateError:function(i){this.headerView._generateError(i)},canOpenNewEditor:function(){return !this._editorView||this._editorView.checkIfOpen()},isCommentVisible:function(i){return this.annotations.isFiltered(i)},clearErrorFlags:function(){this.headerView._clearError()},_closeEditor:function(){this._editorView&&this._editorView.remove()},updateWithFiltered:function(){this.annotations.getCurrentOrNext();this.render()}});return g});
203}catch(e){WRMCB(e)};
204;
205try {
206/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/pin-view.js' */
207define("cp/component/annotation/pin-view",["backbone","jquery","cp/component/annotation/comment","cp/component/utils/editor-utils"],function(e,b,c,d){var a=e.View.extend({model:c,tagName:"span",className:"cp-icon cp-active-annotation",events:{click:"clickPin"},clickPin:function(){if(d.confirmProcess()){var f=this._mediaViewer.getView().fileSidebarView;if(this.model.get("selected")&&f.isPanelInitialized("annotations")){this.closeSidebar()}else{this.showPin();this._mediaViewer.trigger("cp.close-editor")}}},closeSidebar:function(){this.collection.setSelected();this._mediaViewer.trigger("cp.close-editor");this._mediaViewer.getView().fileSidebarView.teardownPanel()},showPin:function(){this.collection.setSelected(this.model);this.collection.trigger("pinSelected");this._mediaViewer._fileState.trigger("cp.showAnnotations")},initialize:function(f){this._mediaViewer=f.mediaViewer;this.calculatePosition=f.calculatePosition;this.listenTo(this.model,"sync",this.render);this.listenTo(this.model,"change:resolved",this.setResolved);this.listenTo(this.model,"change:selected",this.setAnimate)},setResolved:function(){var f=this.model.get("resolved");this.$el.toggleClass("resolved",f)},setSelected:function(){var f=this.model.get("selected");this.$el.toggleClass("selected",f)},setAnimate:function(){var f=this.model.get("selected");this.setSelected();this.$el.toggleClass("animate",f)},setPosition:function(){var g;if(this.calculatePosition){g=this.calculatePosition(this.model.toJSON())}else{var h=this.model.get("position");var f=h[0]*100;var i=h[1]*100;g={x:f+"%",y:i+"%"}}this.$el.css("top",g.y);this.$el.css("left",g.x)},render:function(){this.$el.attr("data-comment-id",this.model.get("id"));this.setPosition();this.setResolved();this.setSelected();return this}});return a});
208}catch(e){WRMCB(e)};
209;
210try {
211/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/pins-view.js' */
212define("cp/component/annotation/pins-view",["backbone","jquery","underscore","cp/component/annotation/comments","cp/component/annotation/pin-view"],function(g,d,b,f,a){var c=function(h){return function(i){for(var j in h){if(h[j]!==i.get(j)){return false}}return true}};var e=g.View.extend({collection:f,initialize:function(h){this.container=h.container;this.filter=h.filter;this.calculatePosition=h.calculatePosition;this.collection=h.collection;this.annotationPins=[];this._mediaViewer=h.mediaViewer;this.listenTo(this.collection,"reset sync add remove",this.markRetrieved);this.listenTo(this.collection,"reset sync add remove",this.render);this.listenTo(this.collection,"filterUpdated",this.render)},markRetrieved:function(){d(this.container).attr("data-pins-retrieved",true)},render:function(){this.unbindAnnotationPins();var i=this.filter?b.filter(this.collection.models,this.filter):this.collection.models,h=this;b.chain(i).filter(c(this.collection.getFilter())).each(function(j){var k=new a({calculatePosition:h.c
212alculatePosition,model:j,collection:h.collection,mediaViewer:this._mediaViewer});h.annotationPins.push(k);d(k.render().el).prependTo(h.container)},this)},unbindAnnotationPins:function(){while(this.annotationPins.length>0){var h=this.annotationPins.pop();h.remove().off()}},off:function(i,j,h){this.unbindAnnotationPins();return g.Collection.prototype.off.call(this,i,j,h)}});return e});
213}catch(e){WRMCB(e)};
214;
215try {
216/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/reply-view.js' */
217define("cp/component/annotation/reply-view",["backbone","underscore","jquery","cp/component/annotation/reply","cp/component/utils/editor-view","cp/component/annotation/likes-view","core/template-store-singleton","confluence/message-controller","confluence/date-time"],function(g,h,d,b,j,a,i,c,f){var e=g.View.extend({model:b,tagName:"div",className:"cp-annotation-reply",events:{"click .cp-annotation-edit":"editReply","click .cp-annotation-delete":"deleteReply"},initialize:function(k){this.listenTo(this.model,"change",this.render);this.listenTo(this.model,"remove",this.remove);this._annotationView=k.annotationView;this._parentView=k.commentView},render:function(){if(!this.model.get("id")){return this}this.$el.html(i.get("Annotation.annotationReply")({id:this.model.get("id"),canEdit:this.model.get("hasEditPermission"),canDelete:this.model.get("hasDeletePermission"),author:this.model.get("author"),comment:this.model.get("comment"),date:f.timeAgo(new Date(this.model.get("date"))),resolved:this._parentView._isResolved()}));if(this.model.get("selected")){this.$el.addClass("selected")}else{this.$el.removeClass("selected")}this.showLikes();AJS.trigger("ic-jim-async-supported");return this},showLikes:function(){var k=new a({el:this.$el.find(".cp-annotation-reply-like"),id:this.model.get("id"),collection:this._parentView.model.likes,_annotationView:this._annotationView});k.render()},editReply:function(){if(!this._annotationView.canOpenNewEditor()){return}var k=this.model.get("editorFormat");this.editorView=this._annotationView._editorView=new j({editorSetup:function(){var l=d(i.get("Annotation.editorLoader")());this.$el.find(".cp-annotation-comment").replaceWith(l);this.$el.find(".cp-annotation-actions").hide()}.bind(this),container:this.$el,saveHandler:h.bind(this.saveReply,this),cancelHandler:h.bind(this.restore,this),postDeactivate:h.bind(this.restore,this),content:k,errorCallback:h.bind(this._handleEditorError,this),restoreCallback:h.bind(this.restore,this),mediaViewer:this._annotationView._mediaViewer});this.editorView.render()},saveReply:function(k){k&&k.preventDefault();if(this.editorView.getContent()===""){this._generateError("You cannot save an empty comment.");return}this._annotationView.clearErrorFlags();this.model.set({editorFormat:this.editorView.getContent()},{silent:true});this.model.save(null,{wait:true,success:this.restore.bind(this),error:this._handleError.bind(this)});this.editorView&&this.editorView.remove()},restore:function(k){k&&k.preventDefault&&k.preventDefault();this.editorView&&this.editorView.remove();this.render()},deleteReply:function(){var k=window.confirm("Are you sure you want to delete the reply?");if(k){this.model.destroy({wait:true,error:this._handleError.bind(this)})}},_handleError:function(k,l){this._generateError(c.parseError(l,"Error: There was a problem saving your changes."))},_handleEditorError:function(l){this.restore();var k;switch(l){case"READ_ONLY":k="This site is read-only. You can\u0027t make changes right now.";break;default:k="Error: Could not open the editor."}this._generateError(k)},_generateError:function(k){this._annotationView._generateError(k)}});return e});
218}catch(e){WRMCB(e)};
219;
220try {
221/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/comment-view.js' */
222define("cp/component/annotation/comment-view",["backbone","underscore","jquery","ajs","cp/component/annotation/comment","cp/component/annotation/reply-view","cp/component/annotation/likes-view","cp/component/utils/editor-view","core/template-store-singleton","confluence/message-controller","confluence/date-time"],function(i,j,e,h,d,g,a,l,k,b,f){var c=i.View.extend({model:d,tagName:"div",className:"cp-comment-view cp-editor",events:{"click input":"convertToEditor","click #cp-top-level-annotation .cp-annotation-edit":"editComment","click .cp-annotation-resolve":"resolve"},initialize:function(m){this.listenTo(this.model.replies,"reset add",this.showReplies);this.listenTo(this.model,"change",this.render);this.listenTo(this.model,"likesReady",this.showLikes);this.currentUser={name:h.Meta.get("current-user-fullname"),avatar:h.Meta.get("current-user-avatar-uri-reference"),profile:h.contextPath()+"/display/~"+h.Meta.get("remote-user")};this._annotationView=m.annotationView},renderComment:function(){return k.get("Annotation.topLevelAnnotation")({id:this.model.get("id"),author:this.model.get("author"),comment:this.model.get("comment"),canEdit:this.model.get("hasEditPermission"),
222canResolve:this.model.get("hasResolvePermission"),resolved:this.model.get("resolved"),date:f.timeAgo(new Date(this.model.get("date")))})},renderTopLevelAnnotation:function(){this.$el.find("#cp-top-level-annotation").replaceWith(this.renderComment());this.showLikes()},render:function(){if(!this.model.get("id")){return this}if(this._annotationView.isCommentVisible(this.model)){this.$el.html(this.renderComment());e(k.get("Annotation.annotationReplyInput")({author:this.currentUser,canReply:this.model.get("hasReplyPermission"),resolved:this.model.get("resolved")})).appendTo(this.$el);this.showReplies();this.showLikes()}else{if(this.model.get("resolved")){this.$el.html(k.get("Annotation.resolved")())}}return this},editComment:function(n){if(!this._annotationView.canOpenNewEditor()){return}var m=this.model.get("editorFormat");this.editorView=this._annotationView._editorView=new l({editorSetup:function(){var o=e(k.get("Annotation.editorLoader")());this.$el.find("#cp-annotation-main-comment").replaceWith(o);this.$el.find("#cp-top-level-annotation .cp-annotation-actions").hide()}.bind(this),container:this.$el.find("#cp-top-level-annotation"),form:this.$el.find("form.aui"),saveHandler:j.bind(this.saveEdit,this),cancelHandler:j.bind(this.cancelHandler,this),content:m,postDeactivate:j.bind(this.restoreCommentOnly,this),errorCallback:j.bind(this._handleAnnotationEditorError,this),restoreCallback:j.bind(this.completedHandler,this),mediaViewer:this._annotationView._mediaViewer});this.editorView.render()},saveEdit:function(m){m&&m.preventDefault();if(this.editorView.getContent()===""){this._generateError("You cannot save an empty comment.");return}this.model.set({editorFormat:this.editorView.getContent()},{silent:true});this.model.save(null,{wait:true,success:this.restoreActions.bind(this),error:this._handleError.bind(this)});this.editorView&&this.editorView.remove()},cancelHandler:function(m){this.completedHandler(m);h.trigger("ic-jim-async-supported")},completedHandler:function(m){this.restoreActions();m&&m.preventDefault()},restoreActions:function(){this.$el.find("#cp-top-level-annotation .cp-annotation-actions").show();this.editorView&&this.editorView.remove()},restoreCommentOnly:function(m){this.$el.find("#cp-top-level-annotation .cp-annotation-actions").show();this.renderTopLevelAnnotation()},showLikes:function(){var m=this.model.likes;var n=new a({el:this.$el.find(".cp-annotation-comment-like"),id:this.model.get("id"),collection:m,_annotationView:this._annotationView});n.render()},convertToInputBox:function(m){m&&m.preventDefault();var n=e(k.get("Annotation.replyInputBox")());this.$el.find("form.aui").replaceWith(n);this.editorView&&this.editorView.remove()},restoreAfterEditorDeactivate:function(m){var n=e(k.get("Annotation.replyInputBox")());this.$el.find("form.aui.fadeIn").replaceWith(n)},convertToEditor:function(){if(!this._annotationView.canOpenNewEditor()){return}this.editorView=this._annotationView._editorView=new l({editorSetup:function(){var m=e(k.get("Annotation.editorLoader")());this.$el.find("input").replaceWith(m)}.bind(this),container:this.$el,saveHandler:j.bind(this.saveReply,this),cancelHandler:j.bind(this.convertToInputBox,this),content:"",postDeactivate:j.bind(this.restoreAfterEditorDeactivate,this),errorCallback:j.bind(this._handleNewReplyEditorError,this),restoreCallback:function(){e("input").blur()},mediaViewer:this._annotationView._mediaViewer});this.editorView.render()},resolve:function(){var o=this;var m=function(){o._annotationView._closeEditor()};var n=function(p,q){o.model.set({resolved:!o.model.get("resolved")});o._handleError(p,q)};if(this.model.get("resolved")){h.trigger("analyticsEvent",{name:"confluence-spaces.previews.annotation.unresolve",data:{fileType:this._annotationView._mediaViewer.getCurrentFile().get("type"),commentId:this.model.get("id"),replyCount:this.model.replies.length}});this.model.setResolved(false,null,n)}else{if(!this._annotationView.canOpenNewEditor()){return}h.trigger("analyticsEvent",{name:"confluence-spaces.previews.annotation.resolve",data:{fileType:this._annotationView._mediaViewer.getCurrentFile().get("type"),commentId:this.model.get("id"),replyCount:this.model.replies.length}});
222this.model.setResolved(true,m,n)}},saveReply:function(n){n&&n.preventDefault();var m=this.model.replies;if(this.editorView.getContent()===""){this._generateError("You cannot save an empty comment.");return}this._annotationView.clearErrorFlags();m.addReply({author:this.currentUser,editorFormat:this.editorView.getContent(),parentId:this.model.get("id")},{error:this._handleError.bind(this),success:this._handleNewReplySuccess.bind(this)})},showReplies:function(){this.$el.find(".cp-annotation-reply").remove();var n=this.model.replies,m=this;j.each(n.models,function(p){var o=new g({model:p,annotationView:m._annotationView,commentView:m});m.$el.find("#cp-annotation-reply-input").before(o.render().el)})},_handleNewReplySuccess:function(){h.trigger("analyticsEvent",{name:"confluence-spaces.previews.annotation.reply",data:{commentId:this.model.get("id")}});this.convertToInputBox()},_handleError:function(m,n){this._generateError(b.parseError(n,"Error: There was a problem saving your changes."))},_handleNewReplyEditorError:function(m){this.convertToInputBox();this._handleEditorError(m)},_handleAnnotationEditorError:function(m){this.restoreCommentOnly();this._handleEditorError(m)},_handleEditorError:function(n){var m;switch(n){case"READ_ONLY":m="This site is read-only. You can\u0027t make changes right now.";break;default:m="Error: Could not open the editor."}this._generateError(m)},_generateError:function(m){this._annotationView._generateError(m)},_isResolved:function(){return this.model.get("resolved")}});return c});
223}catch(e){WRMCB(e)};
224;
225try {
226/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/annotation-header-view.js' */
227define("cp/component/annotation/annotation-header-view",["backbone","underscore","jquery","ajs","core/template-store-singleton","confluence/message-controller"],function(g,b,e,a,c,f){var d=g.View.extend({tagName:"div",className:"cp-annotation-header",events:{"click #cp-annotation-next":"next","click #cp-annotation-previous":"previous"},initialize:function(h){this.annotations=this.model.get("annotations");this.current=this.annotations.getCurrent();this._annotationView=h.annotationView;this.listenTo(this.annotations,"filterUpdated",this.render)},next:function(){this.annotations.next()},previous:function(){this.annotations.prev()},render:function(){this.$el.html(c.get("Annotation.annotationHeader")({current:this.annotations.currentIndexOf(this.current)+1,total:this.annotations.getCount(),canDelete:this.current.get("hasDeletePermission"),resolved:this.current.get("resolved")}));e(".tipsy").remove()&&e.fn.tooltip&&this.$el.find("a").tooltip();var h=b.bind(this.deleteComment,this);this.$el.find("#cp-annotations-more-menu").on({"aui-dropdown2-show":function(){e("body").on("click","#cp-annotation-delete",h)},"aui-dropdown2-hide":function(){e("body").off("click","#cp-annotation-delete",h)}});return this},deleteComment:function(h){h.preventDefault();var i=window.confirm("Are you sure you want to delete the comment?");if(i){this._annotationView._closeEditor();this.annotations.getCurrent().destroy({wait:true,error:this._handleError.bind(this)})}e("#cp-annotation-more").trigger("aui-button-invoke")},_handleError:function(h,i){this._generateError(f.parseError(i,"Error: There was a problem saving your changes."))},_generateError:function(h){this._clearError();a.messages.error(".cp-error",{body:c.get("escapeError")({text:h}),closeable:false,id:"cp-annotation-error"})},_clearError:function(){e(".cp-error").empty()}});return d});
228}catch(e){WRMCB(e)};
229;
230try {
231/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/add-annotation-view.js' */
232define("cp/component/annotation/add-annotation-view",["backbone","underscore","jquery","ajs","cp/component/utils/editor-view","cp/component/utils/editor-utils","MediaViewer","core/template-store-singleton","confluence/message-controller"],function(g,h,b,f,k,c,j,i,a){var e=j.prototype.changeMode;var d=g.View.extend({tagName:"div",id:"cp-add-annotation",events:{},initialize:function(l){this._mediaViewer=l.mediaViewer;this._annotationView=l.annotationView;this.currentUser={name:f.Meta.get("current-user-fullname"),avatar:f.Meta.get("current-user-avatar-uri-reference"),profile:f.contextPath()+"/display/~"+f.Meta.get("remote-user")};this._annotation=l.annotation;this.listenTo(this._mediaViewer._fileState,"cp.hideAnnotations",this.clearAnnotation);this.listenTo(this._mediaViewer,"fv.close",this.clearAnnotation);this.listenTo(this.collection,"pinSelected",this.teardown)},render:function(){this.editorView=this._annotationView._editorView=new k({editorSetup:function(){this.$el.html(i.get("Annotation.addAnnotation")({author:this.currentUser}))}.bind(this),container:this.$el,saveHandler:h.bind(this.saveAnnotation,this),cancelHandler:h.bind(this.cancelAnnotation,this),content:"",restoreCallback:h.bind(this.cancelAnnotation,this),mediaViewer:this._mediaViewer,errorCallback:h.bind(this._handleEditorError,this)});this.editorView.render();var l=this;this._mediaViewer.changeMode=function(){if(c.confirmProcess()){l.cancelAnnotation();return e.apply(this,arguments)}};return this},cancelAnnotation:function(l){l&&l.preventDefault();this.removeNewAnnotation();this.collection.setSelected(this.collection.getCurrentOrNext())},removeNewAnnotation:function(){this.clearAnnotation();this._annotation.destroy();this.editorView&&this.editorView.remove();this._mediaViewer.changeMode=e},clearAnnotation:function(){this._mediaViewer.getView().$el.find("#cp-file-control-annotate").draggable("option","disabled",fal
232se)},saveAnnotation:function(l){l&&l.preventDefault();if(this.editorView.getContent()===""){this._generateError("You cannot save an empty comment.");return}if(f.Meta.get("access-mode")==="READ_ONLY"){this._handleEditorError("READ_ONLY");return}this._annotation.set("editorFormat",this.editorView.getContent(),{silent:true});this._annotation.set("isNew",false);this._annotation.save(null,{error:this._handleError.bind(this),success:this._handleSuccess.bind(this)})},teardown:function(){if(this._annotation.isNew()){this.removeNewAnnotation()}else{this.clearAnnotation()}return this},_handleEditorError:function(m){var l;switch(m){case"READ_ONLY":l="This site is read-only. You can\u0027t make changes right now.";break;default:l="Error: Could not open the editor."}this._generateError(l)},_handleSuccess:function(){this.editorView&&this.editorView.remove();this.clearAnnotation();f.trigger("analyticsEvent",{name:"confluence-spaces.previews.annotation.comment",data:{fileType:this._mediaViewer.getCurrentFile().get("type"),attachmentId:this._mediaViewer.getCurrentFile().get("id")}});this.collection.setSelected(this._annotation);this._mediaViewer.changeMode=e},_handleError:function(l,m){this._generateError(a.parseError(m,"Error: There was a problem saving your changes."))},_generateError:function(l){b(".cp-error").empty();f.messages.error(".cp-error",{body:i.get("escapeError")({text:l}),closeable:false,id:"cp-annotation-error"})}});return d});
233}catch(e){WRMCB(e)};
234;
235try {
236/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/likes.js' */
237define("cp/component/annotation/likes",["backbone","underscore","jquery","cp/component/annotation/like","ajs"],function(f,c,d,b,a){var e=f.Collection.extend({model:b,initialize:function(h,g){this.contentId=g.contentId;this.replies=g.replies?g.replies:[];this._skipFetch=false},addLike:function(h,g){var i=c.find(this.models,function(j){return j.get("content_id")===h});if(!i){i=new b();this.add(i)}i.save(null,{id:h,wait:true,error:g.error})},removeLike:function(h,g){var i=c.find(this.models,function(j){return j.get("content_id")===h});i.id="";i.destroy({id:h,wait:true,error:g.error})},sync:function(k,j,h){if(h.force){this._skipFetch=false}if(this._skipFetch||!j.contentId){return}if(k==="read"){this._skipFetch=true;var i=this._getCommentIds();var g=d.Deferred();d.ajax({url:a.contextPath()+"/rest/likes/1.0/content/likes",type:"POST",data:JSON.stringify(i),contentType:"application/json"}).then(function(m){var l=c.map(m,function(n){return new b(n)});j.reset(l);g.resolve(l)}).fail(function(l,n,m){this._skipFetch=false;g.reject(l,n,m)}.bind(this))}},setReplies:function(g){this.replies=g},_getCommentIds:function(){var g=[];g.push(this.contentId);if(this.replies){c.each(this.replies,function(h){g.push(h.get("id"))})}return{ids:g}}});return e});
238}catch(e){WRMCB(e)};
239;
240try {
241/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/like.js' */
242define("cp/component/annotation/like",["backbone","jquery","ajs"],function(d,c,a){var b=d.Model.extend({defaults:{content_id:"",content_type:"",likes:[],summary:""},sync:function(g,f,e){if(g!=="create"&&g!=="update"&&g!=="delete"){throw"Unsupported method in likes model: "+g}return c.ajax({url:a.contextPath()+"/rest/likes/1.0/content/"+e.id+"/likes",type:g==="create"||g==="update"?"POST":"DELETE",contentType:"application/json"}).done(function(h){f.set(h);f.trigger("sync",f,h,e)}).fail(function(h){e.error&&e.error(h)})}});return b});
243}catch(e){WRMCB(e)};
244;
245try {
246/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/likes-view.js' */
247define("cp/component/annotation/likes-view",["backbone","underscore","ajs","cp/component/annotation/likes","core/template-store-singleton","confluence/message-controller"],function(g,b,a,e,c,f){var d=g.View.extend({collection:e,tagName:"span",className:"cp-annotation-like",events:{"click .cp-annotation-like":"like","click .cp-annotation-unlike":"unlike"},initialize:function(h){this.collection=h.collection;this.commentId=h.id;this._annotationView=h._annotationView;this.collection&&this.listenTo(this.collection,"reset add remove sync",this.render)},render:function(){this.$el.empty();if(this.collection===undefined){return}var j=b.find(this.collection.models,function(m){return m.attributes.content_id===this.commentId}.bind(this));var l=!(a.Meta.get("remote-user"));var i=a.Meta.get("render-mode")!=="READ_ONLY";var k=!l&&!!j&&b.some(j.get("likes"),function(m){return m.user.name===a.Meta.get("remote-user")});var h=j?j.get("likes").length:0;this.$el.html(c.get("Annotation.likes")({likes:h,hasLiked:k,isAnonymous:l,canLike:i}));return this},like:function(){a.trigger("analyticsEvent",{name:"confluence-spaces.previews.annotation.like",data:{fileType:this._annotationView._mediaViewer.getCurrentFile().get("type"),commentId:this.commentId}});this.collection.addLike(this.commentId,{error:this._handleError.bind(this)})},unlike:function(){this.collection.removeLike(this.commentId,{error:this._handleError.bind(this)})},_handleError:function(h,i){this._annotationView._generateError(f.parseError(i,"Error: Unable to save your like."))},});return d});
248}catch(e){WRMCB(e)};
249;
250try {
251/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/content-view.js' */
252define("cp/component/annotation/content-view",["MediaViewer","underscore","jquery"],function(g,d,h){var c=500;var b=c-100;var a={PLUS:187,MINUS:189,PLUS_NUMPAD:107,MINUS_NUMPAD:109,PLUS_FF:61,MINUS_FF:173};var e=g.require("core/base_viewer");var f={annotationEvents:{"mousemove.contentView.show":"_showControlsOnMove","mousemove.contentView.hide":"_hideControlsOnMove"},initialize:function(){this.events=d.extend(this.events||{},this.annotationEvents);this._toggleControlsTimeout=null;this._autoToggleControls=true;h(document).on("keydown.viewerZoom",this._handleKeyboardZoom.bind(this))},_showControlsOnMove:d.throttle(function(){if(!this._autoToggleControls){return}this.showControls()},b),_hideControlsOnMove:d.throttle(function(){if(!this._autoToggleControls){return}this.hideControls()},b),showControls:function(){if(!this.getControlsElement){return}clearTimeout(this._toggleControlsTimeout);this.getControlsElement().show()},hideControls:function(){if(!this.getControlsElement){return}this._toggleControlsTimeout=this._setHideTimer()},_setHideTimer:function(){return setTimeout(function(){if(this.getControlsElement().is(":hover")){return}this.getControlsElement().fadeOut()}.bind(this),c)},autoToggleControls:function(i){this._autoToggleControls=i;if(!this._autoToggleControls){clearTimeout(this._toggleControlsTimeout)}},_handleKeyboardZoom:function(i){var j=(i.ctrlKey||i.metaKey);if(this.zoomIn&&j&&(i.which===a.PLUS||i.which===a.PLUS_NUMPAD||i.which===a.PLUS_FF)){this.zoomIn();i.preventDefault()}if(this.zoomOut&&j&&(i.which===a.MINUS||i.which===a.MINUS_NUMPAD||i.which===a.MINUS_FF)){this.zoomOut();i.preventDefault()}}};Object.keys(f).forEach(function(i){e[i]=f[i]});return e});
253}catch(e){WRMCB(e)};
254;
255try {
256/* module-key = 'com.atlassian.confluence.plugins.confluence-previews:annotation-plugin', location = '/js/component/annotation/annotation-plugin.js' */
257define("cp/component/annotation/annotation-plugin",["MediaViewer","cp/component/annotation/annotation-view","cp/component/annotation/annotation-button-view","cp/component/annotation/pins-view","cp/component/annotation/comments","cp/component/annotation/comment","cp/component/annotation/content-view","underscore","jquery","ajs","core/template-store-singleton"],function(l,d,m,e,c,b,f,j,g,i,k){var h=l.require("viewers/unknown-file-type-view/unknown-file-type-view");var a=function(u){var s=u.getConfig();if(!s.enableAnnotations||!s.commentService){return}var A=s.commentService;f.prototype.annotationOptions={dropTarget:".cp-annotatable"};u.getView().fileSidebarView.addPanelView("annotations",d);var B=u.getView().fileControlsView;var p=u.getView().fileSidebarView;var x=function(){var C=u.getCurrentFile();return !C.get("isRemoteLink")};B.addLayerView("annotationButton",m,{predicate:x,weight:5});var r=a.showAnnotationsPanel;u._fileState.on("cp.showAnnotations",j.partial(r,u));var q=function(C){if(C.createAnnotation){return}C.set("annotations",new c([],{service:new A(C.get("id"),C.get("version")),fileModel:C}));if(l.isPluginEnabled("permalink")){var D=l.getPlugin("permalink");C.get("annotations").on("selected",function(E){if(E.get("id")){D.setRouteForPin(C,E)}else{E.on("change:id",function(){D.setRouteForPin(C,E)})}})}C.on("change:id",function(){this.get("annotations").service=new A(C.get("id"),C.get("version"))});C.createAnnotation=function(H){var G=j.extend(H,{fileModel:this});var I=this.get("annotations");var F=new A(C.get("id"),C.get("version"));var E=new b(G,{service:F});I.add(E);return E}.bind(C)};u.getView().on("fv.fileChange",q);var z=function(D){var C=u.getCurrentFile();if(C.get("annotations").where({resolved:true}).length>0){D.addFileAction({key:"resolved.toggle",text:"Show resolved comments",callback:function(){C.get("annotations").setFilter();y(D)}.bind(this)})}};var y=function(D){var C=u.getCurrentFile();D.addFileAction({key:"resolved.toggle",text:"Hide resolved comments",callback:function(){C.get("annotations").setFilter({resolved:false});z(D)}.bind(this)})};var w=function(C,E){var D=E.getFilter();if(j.isEqual(D,{resolved:false})){z(C)}else{y(C)}};var v;u.close=j.wrap(u.close,function(C){if(v){return}
257C.apply(u,Array.prototype.slice.call(arguments,1))});u.showFile=j.wrap(u.showFile,function(C){if(v){return}return C.apply(u,Array.prototype.slice.call(arguments,1))});var o=false;var n=function(U){var H=u.getView().fileContentView.getLayerForName("content")._viewer;if(!x()||H instanceof h){if(H instanceof h){B.getLayerForName("annotationButton").$el.hide()}p.teardownPanel();return}var N=g(".cp-toolbar");var O=N.find("#cp-file-control-annotate");if(O.length===0&&(U.get("hasReplyPermission")||U.get("hasReplyPermission")===undefined)){O=g(k.get("Annotation.fileControlAnnotate")());g.fn.tooltip&&O.tooltip({gravity:"s"});O.appendTo(N);N.css("margin-left",-N.width()/2)}U.trigger("cp.control-added",{plugin:"annotation"});H=j.extend(H,f);if(!o&&!g(".cp-annotatable .cp-active-annotation").length){H.renderAnnotations&&H.renderAnnotations(e);o=true}var T=B.getLayerForName("moreButton");var C=U.get("annotations");w(T,C);C.on("sync change:resolved filterUpdated",j.partial(w,T,C));C.fetchComments().done(function(){if(u.getView().fileSidebarView.isPanelInitialized("annotations")){C.getCurrentOrNext()}});var P=H.annotationOptions.dropTarget;var G=H.annotationOptions.annotationCreated;var E=function(Z,ac){ac.helper.addClass("active");var aa=g(this);var Y=aa.offset();var af=Z.pageX-Y.left;var ad=Z.pageY-Y.top;var ae=af/aa.width();var ab=ad/aa.height();var W;if(G){W=G(this,Z)}W=j.extend({},W,{x:ae,y:ab});var X=(W.x*100)+"%";var V=(W.y*100)+"%";aa.closest(P).append(ac.helper.detach());ac.helper.css({left:X,top:V});u._fileState.trigger("cp.showAnnotations");u.getView().$el.find("#cp-file-control-annotate").draggable("option","disabled",true);p.getInitializedPanel("annotations").addAnnotation(W)};var M=u.getView().$el.find("#cp-file-control-annotate");var J=M.draggable({appendTo:u.getView().el,helper:function(){return g("<div class='annotation-pin'></div>")},cursor:"-webkit-grabbing",cursorAt:{left:0,top:0},scroll:false,stack:"img",revert:"invalid",start:function(){v=true;H.autoToggleControls(false);H.hideControls();g(P).droppable({tolerance:"pointer",drop:E})},stop:function(){v=false;H.showControls();H.autoToggleControls(true);g(P).droppable("destroy")}});var K=J.data("draggable");if(K&&K._mouseUp&&K._mouseMove&&K._trigger&&K._clear){var F;var I=function(V){if(!v&&!K.options.disabled){K._mouseStart.call(K,V);v=true;F=V;D()}};var S=function(V){if(g(V.target).is(O)){return}if(v&&!K.options.disabled){K._mouseDownEvent=F;K._mouseUp.call(K,V);v=false;L()}};var R=function(V){if(v&&!K.options.disabled){K._mouseStarted=true;K._mouseMove.call(K,V)}};var Q=function(V){if(v&&!K.options.disabled&&V.keyCode===27){K._trigger("stop",V);K._clear()}};var D=function(){g(document).on("mousemove",R);g(P).on("click",S);g(document).on("click",S);g(document).on("keyup",Q)};var L=function(){g(document).off("mousemove",R);g(P).off("click",S);g(document).off("click",S);g(document).off("keyup",Q)};O.click(I)}};var t=function(D){var E=g(".cp-toolbar");var G=E.find("#cp-file-control-annotate");var F=g(".annotationLayer");var C=g(".cp-active-annotation");if(u.isInMode("PRESENTATION")){G.hide();F.hide();C.hide()}else{n(D);G.show();F.show();C.show()}};u.on("fv.showFile",function(C){o=false;t(C)});u.on("fv.changeMode",function(){t(u.getCurrentFile())})};a.showAnnotationsPanel=function(n){var o=n.getView().fileSidebarView;if(!o.isPanelInitialized("annotations")){if(o.isAnyPanelInitialized()){o.teardownPanel()}o.initializePanel("annotations")}i.trigger("ic-jim-async-supported")};return a});(function(){var a=require("cp/component/annotation/annotation-plugin");var b=require("MediaViewer");b.registerPlugin("annotation",a)})();
258}catch(e){WRMCB(e)};

Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.