text: define ("mod_forum/discussion",["jquery","core/custom_interaction_events","mod_forum/selectors","core/pubsub","mod_forum/forum_events","core/str","core/notification"],function(a,b,c,d,e,f,g){var h=function(a){var b=a.prev(c.post.post);if(b.length){var d=b.find(c.post.post).last();if(d.length){d.focus()}else{b.focus()}}else{a.parents(c.post.post).first().focus()}},i=function(b){var d=b.find(c.post.post).first();if(d.length){d.focus()}else{var e=b.next(c.post.post);if(e.length){e.focus()}else{for(var f=b.parents(c.post.post).toArray(),g=0,h;g<f.length;g++){h=a(f[g]).next(c.post.post);if(h.length){h.focus();break}}}}},j=function(b){var d=a(b).closest(c.post.inpageReplyContent);return d.length?!0:!1},k=function(k){var l=k.find(c.post.post);l.each(function(b,d){var e=a(d).find(c.post.action),f=e.first();e.attr("tabindex","-1");f.attr("tabindex",0)});b.define(k,[b.events.up,b.events.down,b.events.next,b.events.previous,b.events.home,b.events.end]);k.on(b.events.up,function(b,d){var e=document.activeElement;if(j(e)){return}var f=a(e).closest(c.post.post);if(f.length){h(f)}else{k.find(c.post.post).first().focus()}d.originalEvent.preventDefault()});k.on(b.events.down,function(b,d){var e=document.activeElement;if(j(e)){return}var f=a(e).closest(c.post.post);if(f.length){i(f)}else{k.find(c.post.post).first().focus()}d.originalEvent.preventDefault()});k.on(b.events.home,function(a,b){if(j(document.activeElement)){return}k.find(c.post.post).first().focus();b.originalEvent.preventDefault()});k.on(b.events.end,function(a,b){if(j(document.activeElement)){return}k.find(c.post.post).last().focus();b.originalEvent.preventDefault()});k.on(b.events.next,c.post.action,function(b,d){var e=a(b.target),f=e.closest(c.post.actionsContainer),g=f.find(c.post.action),h=e.next(c.post.action);g.attr("tabindex","-1");if(!h.length){h=g.first()}h.attr("tabindex",0);h.focus();d.originalEvent.preventDefault()});k.on(b.events.previous,c.post.action,function(b,d){var e=a(b.target),f=e.closest(c.post.actionsContainer),g=f.find(c.post.action),h=e.prev(c.post.action);g.attr("tabindex","-1");if(!h.length){h=g.last()}h.attr("tabindex",0);h.focus();d.originalEvent.preventDefault()});k.on(b.events.home,c.post.action,function(b,d){var e=a(b.target),f=e.closest(c.post.actionsContainer),g=f.find(c.post.action),h=g.first();g.attr("tabindex","-1");h.attr("tabindex",0);h.focus();b.stopPropagation();d.originalEvent.preventDefault()});k.on(b.events.end,c.post.action,function(b,d){var e=a(b.target),f=e.closest(c.post.actionsContainer),g=f.find(c.post.action),h=g.last();g.attr("tabindex","-1");h.attr("tabindex",0);h.focus();b.stopPropagation();d.originalEvent.preventDefault()});d.subscribe(e.SUBSCRIPTION_TOGGLED,function(a){var b=a.subscriptionState,c=b?"discussionsubscribed":"discussionunsubscribed";f.get_string(c,"forum").then(function(a){return g.addNotification({message:a,type:"info"})}).catch(g.exception)})};return{init:function init(a){k(a)}}});
  //# sourceMappingURL=discussion.min.js.map
  