Project

General

Profile

Patch #33424 » 0001-Update-Tribute-to-5.1.3.patch

Go MAEDA, 2020-05-10 05:45

View differences:

app/helpers/application_helper.rb
1622 1622

  
1623 1623
  # Returns the javascript tags that are included in the html layout head
1624 1624
  def javascript_heads
1625
    tags = javascript_include_tag('jquery-2.2.4-ui-1.12.1-ujs-5.2.3', 'tribute-3.7.3.min', 'application', 'responsive')
1625
    tags = javascript_include_tag('jquery-2.2.4-ui-1.12.1-ujs-5.2.3', 'tribute-5.1.3.min', 'application', 'responsive')
1626 1626
    unless User.current.pref.warn_on_leaving_unsaved == '0'
1627 1627
      tags << "\n".html_safe + javascript_tag("$(window).on('load', function(){ warnLeavingUnsaved('#{escape_javascript l(:text_warn_on_leaving_unsaved)}'); });")
1628 1628
    end
app/views/layouts/base.html.erb
9 9
<meta name="keywords" content="issue,bug,tracker" />
10 10
<%= csrf_meta_tag %>
11 11
<%= favicon %>
12
<%= stylesheet_link_tag 'jquery/jquery-ui-1.12.1', 'tribute-3.7.3', 'application', 'responsive', :media => 'all' %>
12
<%= stylesheet_link_tag 'jquery/jquery-ui-1.12.1', 'tribute-5.1.3', 'application', 'responsive', :media => 'all' %>
13 13
<%= stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' %>
14 14
<%= javascript_heads %>
15 15
<%= heads_for_theme %>
public/javascripts/application.js
1063 1063
      requireLeadingSpace: true,
1064 1064
      selectTemplate: function (issue) {
1065 1065
        return '#' + issue.original.id;
1066
      },
1067
      noMatchTemplate: function () {
1068
        return '<span style:"visibility: hidden;"></span>';
1066 1069
      }
1067 1070
    });
1068 1071

  
public/javascripts/tribute-3.7.3.min.js
1
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Tribute=e()}}(function(){return function o(u,a,l){function s(t,e){if(!a[t]){if(!u[t]){var n="function"==typeof require&&require;if(!e&&n)return n(t,!0);if(c)return c(t,!0);var i=new Error("Cannot find module '"+t+"'");throw i.code="MODULE_NOT_FOUND",i}var r=a[t]={exports:{}};u[t][0].call(r.exports,function(e){return s(u[t][1][e]||e)},r,r.exports,o,u,a,l)}return a[t].exports}for(var c="function"==typeof require&&require,e=0;e<l.length;e++)s(l[e]);return s}({1:[function(e,t,n){"use strict";Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;i(e("./utils"));var F=i(e("./TributeEvents")),q=i(e("./TributeMenuEvents")),z=i(e("./TributeRange")),Y=i(e("./TributeSearch"));function i(e){return e&&e.__esModule?e:{default:e}}function a(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){var n=[],i=!0,r=!1,o=void 0;try{for(var u,a=e[Symbol.iterator]();!(i=(u=a.next()).done)&&(n.push(u.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==a.return||a.return()}finally{if(r)throw o}}return n}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance")}()}function r(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}var o=function(){function B(e){var t=this,n=e.values,i=void 0===n?null:n,r=e.iframe,o=void 0===r?null:r,u=e.selectClass,a=void 0===u?"highlight":u,l=e.trigger,s=void 0===l?"@":l,c=e.autocompleteMode,d=void 0!==c&&c,f=e.selectTemplate,h=void 0===f?null:f,p=e.menuItemTemplate,v=void 0===p?null:p,m=e.lookup,g=void 0===m?"key":m,b=e.fillAttr,y=void 0===b?"value":b,w=e.collection,T=void 0===w?null:w,E=e.menuContainer,C=void 0===E?null:E,k=e.noMatchTemplate,S=void 0===k?null:k,x=e.requireLeadingSpace,M=void 0===x||x,A=e.allowSpaces,L=void 0!==A&&A,I=e.replaceTextSuffix,N=void 0===I?null:I,O=e.positionMenu,P=void 0===O||O,D=e.spaceSelectsMatch,R=void 0!==D&&D,_=e.searchOpts,W=void 0===_?{}:_,H=e.menuItemLimit,j=void 0===H?null:H;if(function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,B),this.autocompleteMode=d,this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=C,this.allowSpaces=L,this.replaceTextSuffix=N,this.positionMenu=P,this.hasTrailingSpace=!1,this.spaceSelectsMatch=R,this.autocompleteMode&&(s="",L=!1),i)this.collection=[{trigger:s,iframe:o,selectClass:a,selectTemplate:(h||B.defaultSelectTemplate).bind(this),menuItemTemplate:(v||B.defaultMenuItemTemplate).bind(this),noMatchTemplate:"function"==typeof S?S.bind(t):S||function(){return""}.bind(t),lookup:g,fillAttr:y,values:i,requireLeadingSpace:M,searchOpts:W,menuItemLimit:j}];else{if(!T)throw new Error("[Tribute] No collection specified.");this.autocompleteMode&&console.warn("Tribute in autocomplete mode does not work for collections"),this.collection=T.map(function(e){return{trigger:e.trigger||s,iframe:e.iframe||o,selectClass:e.selectClass||a,selectTemplate:(e.selectTemplate||B.defaultSelectTemplate).bind(t),menuItemTemplate:(e.menuItemTemplate||B.defaultMenuItemTemplate).bind(t),noMatchTemplate:"function"==typeof S?S.bind(t):null,lookup:e.lookup||g,fillAttr:e.fillAttr||y,values:e.values,requireLeadingSpace:e.requireLeadingSpace,searchOpts:e.searchOpts||W,menuItemLimit:e.menuItemLimit||j}})}new z.default(this),new F.default(this),new q.default(this),new Y.default(this)}return function(e,t,n){t&&r(e.prototype,t),n&&r(e,n)}(B,[{key:"triggers",value:function(){return this.collection.map(function(e){return e.trigger})}},{key:"attach",value:function(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array)for(var t=e.length,n=0;n<t;++n)this._attach(e[n]);else this._attach(e)}},{key:"_attach",value:function(e){e.hasAttribute("data-tribute")&&console.warn("Tribute was already bound to "+e.nodeName),this.ensureEditable(e),this.events.bind(e),e.setAttribute("data-tribute",!0)}},{key:"ensureEditable",value:function(e){if(-1===B.inputTypes().indexOf(e.nodeName)){if(!e.contentEditable)throw new Error("[Tribute] Cannot bind to "+e.nodeName);e.contentEditable=!0}}},{key:"createMenu",value:function(){var e=this.range.getDocument().createElement("div"),t=this.range.getDocument().createElement("ul");return e.className="tribute-container",e.appendChild(t),this.menuContainer?this.menuContainer.appendChild(e):this.range.getDocument().body.appendChild(e)}},{key:"showMenuFor",value:function(e,o){var u=this;if(!this.isActive||this.current.element!==e||this.current.mentionText!==this.currentMentionTextSnapshot){this.currentMentionTextSnapshot=this.current.mentionText,this.menu||(this.menu=this.createMenu(),e.tributeMenu=this.menu,this.menuEvents.bind(this.menu)),this.isActive=!0,this.menuSelected=0,this.current.mentionText||(this.current.mentionText="");var t=function(e){if(u.isActive){var t=u.search.filter(u.current.mentionText,e,{pre:u.current.collection.searchOpts.pre||"<span>",post:u.current.collection.searchOpts.post||"</span>",skip:u.current.collection.searchOpts.skip,extract:function(e){if("string"==typeof u.current.collection.lookup)return e[u.current.collection.lookup];if("function"==typeof u.current.collection.lookup)return u.current.collection.lookup(e,u.current.mentionText);throw new Error("Invalid lookup attribute, lookup must be string or function.")}});u.current.filteredItems=t;var n=u.menu.querySelector("ul");if(u.range.positionMenuAtCaret(o),!t.length){var i=new CustomEvent("tribute-no-match",{detail:u.menu});return u.current.element.dispatchEvent(i),void("function"==typeof u.current.collection.noMatchTemplate&&!u.current.collection.noMatchTemplate()||!u.current.collection.noMatchTemplate?u.hideMenu():"function"==typeof u.current.collection.noMatchTemplate?n.innerHTML=u.current.collection.noMatchTemplate():n.innerHTML=u.current.collection.noMatchTemplate)}u.current.collection.menuItemLimit&&(t=t.slice(0,u.current.collection.menuItemLimit)),n.innerHTML="";var r=u.range.getDocument().createDocumentFragment();t.forEach(function(e,t){var n=u.range.getDocument().createElement("li");n.setAttribute("data-index",t),n.addEventListener("mousemove",function(e){var t=a(u._findLiTarget(e.target),2),n=(t[0],t[1]);0!==e.movementY&&u.events.setActiveLi(n)}),u.menuSelected===t&&(n.className=u.current.collection.selectClass),n.innerHTML=u.current.collection.menuItemTemplate(e),r.appendChild(n)}),n.appendChild(r)}};"function"==typeof this.current.collection.values?this.current.collection.values(this.current.mentionText,t):t(this.current.collection.values)}}},{key:"_findLiTarget",value:function(e){if(!e)return[];var t=e.getAttribute("data-index");return t?[e,t]:this._findLiTarget(e.parentNode)}},{key:"showMenuForCollection",value:function(e,t){e!==document.activeElement&&this.placeCaretAtEnd(e),this.current.collection=this.collection[t||0],this.current.externalTrigger=!0,(this.current.element=e).isContentEditable?this.insertTextAtCursor(this.current.collection.trigger):this.insertAtCaret(e,this.current.collection.trigger),this.showMenuFor(e)}},{key:"placeCaretAtEnd",value:function(e){if(e.focus(),void 0!==window.getSelection&&void 0!==document.createRange){var t=document.createRange();t.selectNodeContents(e),t.collapse(!1);var n=window.getSelection();n.removeAllRanges(),n.addRange(t)}else if(void 0!==document.body.createTextRange){var i=document.body.createTextRange();i.moveToElementText(e),i.collapse(!1),i.select()}}},{key:"insertTextAtCursor",value:function(e){var t,n;(n=(t=window.getSelection()).getRangeAt(0)).deleteContents();var i=document.createTextNode(e);n.insertNode(i),n.selectNodeContents(i),n.collapse(!1),t.removeAllRanges(),t.addRange(n)}},{key:"insertAtCaret",value:function(e,t){var n=e.scrollTop,i=e.selectionStart,r=e.value.substring(0,i),o=e.value.substring(e.selectionEnd,e.value.length);e.value=r+t+o,i+=t.length,e.selectionStart=i,e.selectionEnd=i,e.focus(),e.scrollTop=n}},{key:"hideMenu",value:function(){this.menu&&(this.menu.style.cssText="display: none;",this.isActive=!1,this.menuSelected=0,this.current={})}},{key:"selectItemAtIndex",value:function(e,t){if("number"==typeof(e=parseInt(e))&&!isNaN(e)){var n=this.current.filteredItems[e],i=this.current.collection.selectTemplate(n);null!==i&&this.replaceText(i,t,n)}}},{key:"replaceText",value:function(e,t,n){this.range.replaceTriggerText(e,!0,!0,t,n)}},{key:"_append",value:function(e,t,n){if("function"==typeof e.values)throw new Error("Unable to append to values, as it is a function.");e.values=n?t:e.values.concat(t)}},{key:"append",value:function(e,t,n){var i=parseInt(e);if("number"!=typeof i)throw new Error("please provide an index for the collection to update.");var r=this.collection[i];this._append(r,t,n)}},{key:"appendCurrent",value:function(e,t){if(!this.isActive)throw new Error("No active state. Please use append instead and pass an index.");this._append(this.current.collection,e,t)}},{key:"detach",value:function(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array)for(var t=e.length,n=0;n<t;++n)this._detach(e[n]);else this._detach(e)}},{key:"_detach",value:function(e){var t=this;this.events.unbind(e),e.tributeMenu&&this.menuEvents.unbind(e.tributeMenu),setTimeout(function(){e.removeAttribute("data-tribute"),t.isActive=!1,e.tributeMenu&&e.tributeMenu.remove()})}}],[{key:"defaultSelectTemplate",value:function(e){return void 0===e?null:this.range.isContentEditable(this.current.element)?'<span class="tribute-mention">'+(this.current.collection.trigger+e.original[this.current.collection.fillAttr])+"</span>":this.current.collection.trigger+e.original[this.current.collection.fillAttr]}},{key:"defaultMenuItemTemplate",value:function(e){return e.string}},{key:"inputTypes",value:function(){return["TEXTAREA","INPUT"]}}]),B}();n.default=o,t.exports=n.default},{"./TributeEvents":2,"./TributeMenuEvents":3,"./TributeRange":4,"./TributeSearch":5,"./utils":7}],2:[function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=function(){function r(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,r),this.tribute=e,this.tribute.events=this}return function(e,t,n){t&&i(e.prototype,t),n&&i(e,n)}(r,[{key:"bind",value:function(e){e.boundKeydown=this.keydown.bind(e,this),e.boundKeyup=this.keyup.bind(e,this),e.boundInput=this.input.bind(e,this),e.addEventListener("keydown",e.boundKeydown,!1),e.addEventListener("keyup",e.boundKeyup,!1),e.addEventListener("input",e.boundInput,!1)}},{key:"unbind",value:function(e){e.removeEventListener("keydown",e.boundKeydown,!1),e.removeEventListener("keyup",e.boundKeyup,!1),e.removeEventListener("input",e.boundInput,!1),delete e.boundKeydown,delete e.boundKeyup,delete e.boundInput}},{key:"keydown",value:function(t,n){t.shouldDeactivate(n)&&(t.tribute.isActive=!1,t.tribute.hideMenu());var i=this;t.commandEvent=!1,r.keys().forEach(function(e){e.key===n.keyCode&&(t.commandEvent=!0,t.callbacks()[e.value.toLowerCase()](n,i))})}},{key:"input",value:function(e,t){e.inputEvent=!0,e.keyup.call(this,e,t)}},{key:"click",value:function(e,t){var n=e.tribute;if(n.menu&&n.menu.contains(t.target)){var i=t.target;for(t.preventDefault(),t.stopPropagation();"li"!==i.nodeName.toLowerCase();)if(!(i=i.parentNode)||i===n.menu)throw new Error("cannot find the <li> container for the click");n.selectItemAtIndex(i.getAttribute("data-index"),t),n.hideMenu()}else n.current.element&&!n.current.externalTrigger&&(n.current.externalTrigger=!1,setTimeout(function(){return n.hideMenu()}))}},{key:"keyup",value:function(e,t){if(e.inputEvent&&(e.inputEvent=!1),e.updateSelection(this),27!==t.keyCode){if(!e.tribute.allowSpaces&&e.tribute.hasTrailingSpace)return e.tribute.hasTrailingSpace=!1,e.commandEvent=!0,void e.callbacks().space(t,this);if(!e.tribute.isActive)if(e.tribute.autocompleteMode)e.callbacks().triggerChar(t,this,"");else{var n=e.getKeyCode(e,this,t);if(isNaN(n)||!n)return;var i=e.tribute.triggers().find(function(e){return e.charCodeAt(0)===n});void 0!==i&&e.callbacks().triggerChar(t,this,i)}((e.tribute.current.trigger||e.tribute.autocompleteMode)&&!1===e.commandEvent||e.tribute.isActive&&8===t.keyCode)&&e.tribute.showMenuFor(this,!0)}}},{key:"shouldDeactivate",value:function(t){if(!this.tribute.isActive)return!1;if(0!==this.tribute.current.mentionText.length)return!1;var n=!1;return r.keys().forEach(function(e){t.keyCode===e.key&&(n=!0)}),!n}},{key:"getKeyCode",value:function(e,t,n){var i=e.tribute,r=i.range.getTriggerInfo(!1,i.hasTrailingSpace,!0,i.allowSpaces,i.autocompleteMode);return!!r&&r.mentionTriggerChar.charCodeAt(0)}},{key:"updateSelection",value:function(e){this.tribute.current.element=e;var t=this.tribute.range.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);t&&(this.tribute.current.selectedPath=t.mentionSelectedPath,this.tribute.current.mentionText=t.mentionText,this.tribute.current.selectedOffset=t.mentionSelectedOffset)}},{key:"callbacks",value:function(){var o=this;return{triggerChar:function(e,t,n){var i=o.tribute;i.current.trigger=n;var r=i.collection.find(function(e){return e.trigger===n});i.current.collection=r,i.inputEvent&&i.showMenuFor(t,!0)},enter:function(e,t){o.tribute.isActive&&o.tribute.current.filteredItems&&(e.preventDefault(),e.stopPropagation(),setTimeout(function(){o.tribute.selectItemAtIndex(o.tribute.menuSelected,e),o.tribute.hideMenu()},0))},escape:function(e,t){o.tribute.isActive&&(e.preventDefault(),e.stopPropagation(),o.tribute.isActive=!1,o.tribute.hideMenu())},tab:function(e,t){o.callbacks().enter(e,t)},space:function(e,t){o.tribute.isActive&&(o.tribute.spaceSelectsMatch?o.callbacks().enter(e,t):o.tribute.allowSpaces||(e.stopPropagation(),setTimeout(function(){o.tribute.hideMenu(),o.tribute.isActive=!1},0)))},up:function(e,t){if(o.tribute.isActive&&o.tribute.current.filteredItems){e.preventDefault(),e.stopPropagation();var n=o.tribute.current.filteredItems.length,i=o.tribute.menuSelected;i<n&&0<i?(o.tribute.menuSelected--,o.setActiveLi()):0===i&&(o.tribute.menuSelected=n-1,o.setActiveLi(),o.tribute.menu.scrollTop=o.tribute.menu.scrollHeight)}},down:function(e,t){if(o.tribute.isActive&&o.tribute.current.filteredItems){e.preventDefault(),e.stopPropagation();var n=o.tribute.current.filteredItems.length-1,i=o.tribute.menuSelected;i<n?(o.tribute.menuSelected++,o.setActiveLi()):n===i&&(o.tribute.menuSelected=0,o.setActiveLi(),o.tribute.menu.scrollTop=0)}},delete:function(e,t){o.tribute.isActive&&o.tribute.current.mentionText.length<1?o.tribute.hideMenu():o.tribute.isActive&&o.tribute.showMenuFor(t)}}}},{key:"setActiveLi",value:function(e){var t=this.tribute.menu.querySelectorAll("li"),n=t.length>>>0;e&&(this.tribute.menuSelected=parseInt(e));for(var i=0;i<n;i++){var r=t[i];if(i===this.tribute.menuSelected){r.classList.add(this.tribute.current.collection.selectClass);var o=r.getBoundingClientRect(),u=this.tribute.menu.getBoundingClientRect();if(o.bottom>u.bottom){var a=o.bottom-u.bottom;this.tribute.menu.scrollTop+=a}else if(o.top<u.top){var l=u.top-o.top;this.tribute.menu.scrollTop-=l}}else r.classList.remove(this.tribute.current.collection.selectClass)}}},{key:"getFullHeight",value:function(e,t){var n=e.getBoundingClientRect().height;if(t){var i=e.currentStyle||window.getComputedStyle(e);return n+parseFloat(i.marginTop)+parseFloat(i.marginBottom)}return n}}],[{key:"keys",value:function(){return[{key:9,value:"TAB"},{key:8,value:"DELETE"},{key:13,value:"ENTER"},{key:27,value:"ESCAPE"},{key:32,value:"SPACE"},{key:38,value:"UP"},{key:40,value:"DOWN"}]}}]),r}();n.default=r,t.exports=n.default},{}],3:[function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.tribute=e,(this.tribute.menuEvents=this).menu=this.tribute.menu}return function(e,t,n){t&&i(e.prototype,t),n&&i(e,n)}(t,[{key:"bind",value:function(e){var t=this;this.menuClickEvent=this.tribute.events.click.bind(null,this),this.menuContainerScrollEvent=this.debounce(function(){t.tribute.isActive&&t.tribute.showMenuFor(t.tribute.current.element,!1)},300,!1),this.windowResizeEvent=this.debounce(function(){t.tribute.isActive&&t.tribute.range.positionMenuAtCaret(!0)},300,!1),this.tribute.range.getDocument().addEventListener("MSPointerDown",this.menuClickEvent,!1),this.tribute.range.getDocument().addEventListener("mousedown",this.menuClickEvent,!1),window.addEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.addEventListener("scroll",this.menuContainerScrollEvent,!1):window.addEventListener("scroll",this.menuContainerScrollEvent)}},{key:"unbind",value:function(e){this.tribute.range.getDocument().removeEventListener("mousedown",this.menuClickEvent,!1),this.tribute.range.getDocument().removeEventListener("MSPointerDown",this.menuClickEvent,!1),window.removeEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.removeEventListener("scroll",this.menuContainerScrollEvent,!1):window.removeEventListener("scroll",this.menuContainerScrollEvent)}},{key:"debounce",value:function(i,r,o){var u,a=this,l=arguments;return function(){var e=a,t=l,n=o&&!u;clearTimeout(u),u=setTimeout(function(){u=null,o||i.apply(e,t)},r),n&&i.apply(e,t)}}}]),t}();n.default=r,t.exports=n.default},{}],4:[function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.tribute=e,this.tribute.range=this}return function(e,t,n){t&&i(e.prototype,t),n&&i(e,n)}(t,[{key:"getDocument",value:function(){var e;return this.tribute.current.collection&&(e=this.tribute.current.collection.iframe),e?e.contentWindow.document:document}},{key:"positionMenuAtCaret",value:function(r){var o,u=this,e=this.tribute.current,t=this.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==t){if(!this.tribute.positionMenu)return void(this.tribute.menu.style.cssText="display: block;");o=this.isContentEditable(e.element)?this.getContentEditableCaretPosition(t.mentionPosition):this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element,t.mentionPosition),this.tribute.menu.style.cssText="top: ".concat(o.top,"px;\n                                     left: ").concat(o.left,"px;\n                                     right: ").concat(o.right,"px;\n                                     bottom: ").concat(o.bottom,"px;\n                                     position: absolute;\n                                     z-index: 10000;\n                                     display: block;"),"auto"===o.left&&(this.tribute.menu.style.left="auto"),"auto"===o.top&&(this.tribute.menu.style.top="auto"),r&&this.scrollIntoView(),window.setTimeout(function(){var e={width:u.tribute.menu.offsetWidth,height:u.tribute.menu.offsetHeight},t=u.isMenuOffScreen(o,e),n=window.innerWidth>e.width&&(t.left||t.right),i=window.innerHeight>e.height&&(t.top||t.bottom);(n||i)&&(u.tribute.menu.style.cssText="display: none",u.positionMenuAtCaret(r))},0)}else this.tribute.menu.style.cssText="display: none"}},{key:"selectElement",value:function(e,t,n){var i,r=e;if(t)for(var o=0;o<t.length;o++){if(void 0===(r=r.childNodes[t[o]]))return;for(;r.length<n;)n-=r.length,r=r.nextSibling;0!==r.childNodes.length||r.length||(r=r.previousSibling)}var u=this.getWindowSelection();(i=this.getDocument().createRange()).setStart(r,n),i.setEnd(r,n),i.collapse(!0);try{u.removeAllRanges()}catch(e){}u.addRange(i),e.focus()}},{key:"replaceTriggerText",value:function(e,t,n,i,r){var o=this.getTriggerInfo(!0,n,t,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==o){var u=this.tribute.current,a=new CustomEvent("tribute-replaced",{detail:{item:r,instance:u,context:o,event:i}});if(this.isContentEditable(u.element)){e+="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ",this.pasteHtml(e,o.mentionPosition,o.mentionPosition+o.mentionText.length+!this.tribute.autocompleteMode)}else{var l=this.tribute.current.element,s="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ";e+=s;var c=o.mentionPosition,d=o.mentionPosition+o.mentionText.length+s.length;l.value=l.value.substring(0,c)+e+l.value.substring(d,l.value.length),l.selectionStart=c+e.length,l.selectionEnd=c+e.length}u.element.dispatchEvent(a)}}},{key:"pasteHtml",value:function(e,t,n){var i,r;r=this.getWindowSelection(),(i=this.getDocument().createRange()).setStart(r.anchorNode,t),i.setEnd(r.anchorNode,n),i.deleteContents();var o=this.getDocument().createElement("div");o.innerHTML=e;for(var u,a,l=this.getDocument().createDocumentFragment();u=o.firstChild;)a=l.appendChild(u);i.insertNode(l),a&&((i=i.cloneRange()).setStartAfter(a),i.collapse(!0),r.removeAllRanges(),r.addRange(i))}},{key:"getWindowSelection",value:function(){return this.tribute.collection.iframe?this.tribute.collection.iframe.contentWindow.getSelection():window.getSelection()}},{key:"getNodePositionInParent",value:function(e){if(null===e.parentNode)return 0;for(var t=0;t<e.parentNode.childNodes.length;t++){if(e.parentNode.childNodes[t]===e)return t}}},{key:"getContentEditableSelectedPath",value:function(e){var t=this.getWindowSelection(),n=t.anchorNode,i=[];if(null!=n){for(var r,o=n.contentEditable;null!==n&&"true"!==o;)r=this.getNodePositionInParent(n),i.push(r),null!==(n=n.parentNode)&&(o=n.contentEditable);return i.reverse(),{selected:n,path:i,offset:t.getRangeAt(0).startOffset}}}},{key:"getTextPrecedingCurrentSelection",value:function(){var e=this.tribute.current,t="";if(this.isContentEditable(e.element)){var n=this.getWindowSelection().anchorNode;if(null!=n){var i=n.textContent,r=this.getWindowSelection().getRangeAt(0).startOffset;i&&0<=r&&(t=i.substring(0,r))}}else{var o=this.tribute.current.element;if(o){var u=o.selectionStart;o.value&&0<=u&&(t=o.value.substring(0,u))}}return t}},{key:"getLastWordInText",value:function(e){var t=(e=e.replace(/\u00A0/g," ")).split(" ");return t[t.length-1].trim()}},{key:"getTriggerInfo",value:function(e,t,i,n,r){var o,u,a,l=this,s=this.tribute.current;if(this.isContentEditable(s.element)){var c=this.getContentEditableSelectedPath(s);c&&(o=c.selected,u=c.path,a=c.offset)}else o=this.tribute.current.element;var d=this.getTextPrecedingCurrentSelection(),f=this.getLastWordInText(d);if(r)return{mentionPosition:d.length-f.length,mentionText:f,mentionSelectedElement:o,mentionSelectedPath:u,mentionSelectedOffset:a};if(null!=d){var h,p=-1;if(this.tribute.collection.forEach(function(e){var t=e.trigger,n=e.requireLeadingSpace?l.lastIndexWithLeadingSpace(d,t):d.lastIndexOf(t);p<n&&(p=n,h=t,i=e.requireLeadingSpace)}),0<=p&&(0===p||!i||/[\xA0\s]/g.test(d.substring(p-1,p)))){var v=d.substring(p+1,d.length);h=d.substring(p,p+1);var m=v.substring(0,1),g=0<v.length&&(" "===m||" "===m);t&&(v=v.trim());var b=n?/[^\S ]/g:/[\xA0\s]/g;if(this.tribute.hasTrailingSpace=b.test(v),!g&&(e||!b.test(v)))return{mentionPosition:p,mentionText:v,mentionSelectedElement:o,mentionSelectedPath:u,mentionSelectedOffset:a,mentionTriggerChar:h}}}}},{key:"lastIndexWithLeadingSpace",value:function(e,t){for(var n=e.split("").reverse().join(""),i=-1,r=0,o=e.length;r<o;r++){var u=r===e.length-1,a=/\s/.test(n[r+1]);if(t===n[r]&&(u||a)){i=e.length-1-r;break}}return i}},{key:"isContentEditable",value:function(e){return"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName}},{key:"isMenuOffScreen",value:function(e,t){var n=window.innerWidth,i=window.innerHeight,r=document.documentElement,o=(window.pageXOffset||r.scrollLeft)-(r.clientLeft||0),u=(window.pageYOffset||r.scrollTop)-(r.clientTop||0),a="number"==typeof e.top?e.top:u+i-e.bottom-t.height,l="number"==typeof e.right?e.right:e.left+t.width,s="number"==typeof e.bottom?e.bottom:e.top+t.height,c="number"==typeof e.left?e.left:o+n-e.right-t.width;return{top:a<Math.floor(u),right:l>Math.ceil(o+n),bottom:s>Math.ceil(u+i),left:c<Math.floor(o)}}},{key:"getMenuDimensions",value:function(){var e={width:null,height:null};return this.tribute.menu.style.cssText="top: 0px;\n                                 left: 0px;\n                                 position: fixed;\n                                 zIndex: 10000;\n                                 display: block;\n                                 visibility; hidden;",e.width=this.tribute.menu.offsetWidth,e.height=this.tribute.menu.offsetHeight,this.tribute.menu.style.cssText="display: none;",e}},{key:"getTextAreaOrInputUnderlinePosition",value:function(e,t,n){var i=null!==window.mozInnerScreenX,r=this.getDocument().createElement("div");r.id="input-textarea-caret-position-mirror-div",this.getDocument().body.appendChild(r);var o=r.style,u=window.getComputedStyle?getComputedStyle(e):e.currentStyle;o.whiteSpace="pre-wrap","INPUT"!==e.nodeName&&(o.wordWrap="break-word"),o.position="absolute",o.visibility="hidden",["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"].forEach(function(e){o[e]=u[e]}),i?(o.width="".concat(parseInt(u.width)-2,"px"),e.scrollHeight>parseInt(u.height)&&(o.overflowY="scroll")):o.overflow="hidden",r.textContent=e.value.substring(0,t),"INPUT"===e.nodeName&&(r.textContent=r.textContent.replace(/\s/g," "));var a=this.getDocument().createElement("span");a.textContent=e.value.substring(t)||".",r.appendChild(a);var l=e.getBoundingClientRect(),s=document.documentElement,c=(window.pageXOffset||s.scrollLeft)-(s.clientLeft||0),d=(window.pageYOffset||s.scrollTop)-(s.clientTop||0),f={top:l.top+d+a.offsetTop+parseInt(u.borderTopWidth)+parseInt(u.fontSize)-e.scrollTop,left:l.left+c+a.offsetLeft+parseInt(u.borderLeftWidth)},h=window.innerWidth,p=window.innerHeight,v=this.getMenuDimensions(),m=this.isMenuOffScreen(f,v);m.right&&(f.right=h-f.left,f.left="auto");var g=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(m.bottom){var b=g-(p-(this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect()).top);f.bottom=b+(p-l.top-a.offsetTop),f.top="auto"}return(m=this.isMenuOffScreen(f,v)).left&&(f.left=h>v.width?c+h-v.width:c,delete f.right),m.top&&(f.top=p>v.height?d+p-v.height:d,delete f.bottom),this.getDocument().body.removeChild(r),f}},{key:"getContentEditableCaretPosition",value:function(e){var t,n,i="sel_".concat((new Date).getTime(),"_").concat(Math.random().toString().substr(2)),r=this.getWindowSelection(),o=r.getRangeAt(0);(n=this.getDocument().createRange()).setStart(r.anchorNode,e),n.setEnd(r.anchorNode,e),n.collapse(!1),(t=this.getDocument().createElement("span")).id=i,t.appendChild(this.getDocument().createTextNode("\ufeff")),n.insertNode(t),r.removeAllRanges(),r.addRange(o);var u=t.getBoundingClientRect(),a=document.documentElement,l=(window.pageXOffset||a.scrollLeft)-(a.clientLeft||0),s=(window.pageYOffset||a.scrollTop)-(a.clientTop||0),c={left:u.left+l,top:u.top+t.offsetHeight+s},d=window.innerWidth,f=window.innerHeight,h=this.getMenuDimensions(),p=this.isMenuOffScreen(c,h);p.right&&(c.left="auto",c.right=d-u.left-l);var v=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(p.bottom){var m=v-(f-(this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect()).top);c.top="auto",c.bottom=m+(f-u.top)}return(p=this.isMenuOffScreen(c,h)).left&&(c.left=d>h.width?l+d-h.width:l,delete c.right),p.top&&(c.top=f>h.height?s+f-h.height:s,delete c.bottom),t.parentNode.removeChild(t),c}},{key:"scrollIntoView",value:function(e){var t,n=this.menu;if(void 0!==n){for(;void 0===t||0===t.height;)if(0===(t=n.getBoundingClientRect()).height&&(void 0===(n=n.childNodes[0])||!n.getBoundingClientRect))return;var i=t.top,r=i+t.height;if(i<0)window.scrollTo(0,window.pageYOffset+t.top-20);else if(r>window.innerHeight){var o=window.pageYOffset+t.top-20;100<o-window.pageYOffset&&(o=window.pageYOffset+100);var u=window.pageYOffset-(window.innerHeight-r);o<u&&(u=o),window.scrollTo(0,u)}}}}]),t}();n.default=r,t.exports=n.default},{}],5:[function(e,t,n){"use strict";function i(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=function(){function t(e){!function(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}(this,t),this.tribute=e,this.tribute.search=this}return function(e,t,n){t&&i(e.prototype,t),n&&i(e,n)}(t,[{key:"simpleFilter",value:function(t,e){var n=this;return e.filter(function(e){return n.test(t,e)})}},{key:"test",value:function(e,t){return null!==this.match(e,t)}},{key:"match",value:function(e,t,n){n=n||{};t.length;var i=n.pre||"",r=n.post||"",o=n.caseSensitive&&t||t.toLowerCase();if(n.skip)return{rendered:t,score:0};e=n.caseSensitive&&e||e.toLowerCase();var u=this.traverse(o,e,0,0,[]);return u?{rendered:this.render(t,u.cache,i,r),score:u.score}:null}},{key:"traverse",value:function(e,t,n,i,r){if(t.length===i)return{score:this.calculateScore(r),cache:r.slice()};if(!(e.length===n||t.length-i>e.length-n)){for(var o,u,a=t[i],l=e.indexOf(a,n);-1<l;){if(r.push(l),u=this.traverse(e,t,l+1,i+1,r),r.pop(),!u)return o;(!o||o.score<u.score)&&(o=u),l=e.indexOf(a,l+1)}return o}}},{key:"calculateScore",value:function(n){var i=0,r=1;return n.forEach(function(e,t){0<t&&(n[t-1]+1===e?r+=r+1:r=1),i+=r}),i}},{key:"render",value:function(n,i,r,o){var u=n.substring(0,i[0]);return i.forEach(function(e,t){u+=r+n[e]+o+n.substring(e+1,i[t+1]?i[t+1]:n.length)}),u}},{key:"filter",value:function(u,e,a){var l=this;return a=a||{},e.reduce(function(e,t,n,i){var r=t;a.extract&&(r=(r=a.extract(t))||"");var o=l.match(u,r,a);return null!=o&&(e[e.length]={string:o.rendered,score:o.score,index:n,original:t}),e},[]).sort(function(e,t){var n=t.score-e.score;return n||e.index-t.index})}}]),t}();n.default=r,t.exports=n.default},{}],6:[function(e,t,n){"use strict";var i;Object.defineProperty(n,"__esModule",{value:!0}),n.default=void 0;var r=((i=e("./Tribute"))&&i.__esModule?i:{default:i}).default;n.default=r,t.exports=n.default},{"./Tribute":1}],7:[function(e,t,n){"use strict";if(Array.prototype.find||(Array.prototype.find=function(e){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var t,n=Object(this),i=n.length>>>0,r=arguments[1],o=0;o<i;o++)if(t=n[o],e.call(r,t,o,n))return t}),window&&"function"!=typeof window.CustomEvent){var i=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};void 0!==window.Event&&(i.prototype=window.Event.prototype),window.CustomEvent=i}},{}]},{},[6])(6)});
2
//# sourceMappingURL=tribute.min.js.map
public/javascripts/tribute-5.1.3.min.js
1
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Tribute=t()}(this,(function(){"use strict";function e(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function t(e,t){for(var n=0;n<t.length;n++){var i=t[n];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(e,i.key,i)}}function n(e,n,i){return n&&t(e.prototype,n),i&&t(e,i),e}function i(e,t){return function(e){if(Array.isArray(e))return e}(e)||function(e,t){if("undefined"==typeof Symbol||!(Symbol.iterator in Object(e)))return;var n=[],i=!0,r=!1,o=void 0;try{for(var u,l=e[Symbol.iterator]();!(i=(u=l.next()).done)&&(n.push(u.value),!t||n.length!==t);i=!0);}catch(e){r=!0,o=e}finally{try{i||null==l.return||l.return()}finally{if(r)throw o}}return n}(e,t)||function(e,t){if(!e)return;if("string"==typeof e)return r(e,t);var n=Object.prototype.toString.call(e).slice(8,-1);"Object"===n&&e.constructor&&(n=e.constructor.name);if("Map"===n||"Set"===n)return Array.from(n);if("Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return r(e,t)}(e,t)||function(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}()}function r(e,t){(null==t||t>e.length)&&(t=e.length);for(var n=0,i=new Array(t);n<t;n++)i[n]=e[n];return i}if(Array.prototype.find||(Array.prototype.find=function(e){if(null===this)throw new TypeError("Array.prototype.find called on null or undefined");if("function"!=typeof e)throw new TypeError("predicate must be a function");for(var t,n=Object(this),i=n.length>>>0,r=arguments[1],o=0;o<i;o++)if(t=n[o],e.call(r,t,o,n))return t}),window&&"function"!=typeof window.CustomEvent){var o=function(e,t){t=t||{bubbles:!1,cancelable:!1,detail:void 0};var n=document.createEvent("CustomEvent");return n.initCustomEvent(e,t.bubbles,t.cancelable,t.detail),n};void 0!==window.Event&&(o.prototype=window.Event.prototype),window.CustomEvent=o}var u=function(){function t(n){e(this,t),this.tribute=n,this.tribute.events=this}return n(t,[{key:"bind",value:function(e){e.boundKeydown=this.keydown.bind(e,this),e.boundKeyup=this.keyup.bind(e,this),e.boundInput=this.input.bind(e,this),e.addEventListener("keydown",e.boundKeydown,!1),e.addEventListener("keyup",e.boundKeyup,!1),e.addEventListener("input",e.boundInput,!1)}},{key:"unbind",value:function(e){e.removeEventListener("keydown",e.boundKeydown,!1),e.removeEventListener("keyup",e.boundKeyup,!1),e.removeEventListener("input",e.boundInput,!1),delete e.boundKeydown,delete e.boundKeyup,delete e.boundInput}},{key:"keydown",value:function(e,n){e.shouldDeactivate(n)&&(e.tribute.isActive=!1,e.tribute.hideMenu());var i=this;e.commandEvent=!1,t.keys().forEach((function(t){t.key===n.keyCode&&(e.commandEvent=!0,e.callbacks()[t.value.toLowerCase()](n,i))}))}},{key:"input",value:function(e,t){e.inputEvent=!0,e.keyup.call(this,e,t)}},{key:"click",value:function(e,t){var n=e.tribute;if(n.menu&&n.menu.contains(t.target)){var i=t.target;for(t.preventDefault(),t.stopPropagation();"li"!==i.nodeName.toLowerCase();)if(!(i=i.parentNode)||i===n.menu)throw new Error("cannot find the <li> container for the click");n.selectItemAtIndex(i.getAttribute("data-index"),t),n.hideMenu()}else n.current.element&&!n.current.externalTrigger&&(n.current.externalTrigger=!1,setTimeout((function(){return n.hideMenu()})))}},{key:"keyup",value:function(e,t){if(e.inputEvent&&(e.inputEvent=!1),e.updateSelection(this),27!==t.keyCode){if(!e.tribute.allowSpaces&&e.tribute.hasTrailingSpace)return e.tribute.hasTrailingSpace=!1,e.commandEvent=!0,void e.callbacks().space(t,this);if(!e.tribute.isActive)if(e.tribute.autocompleteMode)e.callbacks().triggerChar(t,this,"");else{var n=e.getKeyCode(e,this,t);if(isNaN(n)||!n)return;var i=e.tribute.triggers().find((function(e){return e.charCodeAt(0)===n}));void 0!==i&&e.callbacks().triggerChar(t,this,i)}e.tribute.current.mentionText.length<e.tribute.current.collection.menuShowMinLength||((e.tribute.current.trigger||e.tribute.autocompleteMode)&&!1===e.commandEvent||e.tribute.isActive&&8===t.keyCode)&&e.tribute.showMenuFor(this,!0)}}},{key:"shouldDeactivate",value:function(e){if(!this.tribute.isActive)return!1;if(0===this.tribute.current.mentionText.length){var n=!1;return t.keys().forEach((function(t){e.keyCode===t.key&&(n=!0)})),!n}return!1}},{key:"getKeyCode",value:function(e,t,n){var i=e.tribute,r=i.range.getTriggerInfo(!1,i.hasTrailingSpace,!0,i.allowSpaces,i.autocompleteMode);return!!r&&r.mentionTriggerChar.charCodeAt(0)}},{key:"updateSelection",value:function(e){this.tribute.current.element=e;var t=this.tribute.range.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);t&&(this.tribute.current.selectedPath=t.mentionSelectedPath,this.tribute.current.mentionText=t.mentionText,this.tribute.current.selectedOffset=t.mentionSelectedOffset)}},{key:"callbacks",value:function(){var e=this;return{triggerChar:function(t,n,i){var r=e.tribute;r.current.trigger=i;var o=r.collection.find((function(e){return e.trigger===i}));r.current.collection=o,r.current.mentionText.length>=r.current.collection.menuShowMinLength&&r.inputEvent&&r.showMenuFor(n,!0)},enter:function(t,n){e.tribute.isActive&&e.tribute.current.filteredItems&&(t.preventDefault(),t.stopPropagation(),setTimeout((function(){e.tribute.selectItemAtIndex(e.tribute.menuSelected,t),e.tribute.hideMenu()}),0))},escape:function(t,n){e.tribute.isActive&&(t.preventDefault(),t.stopPropagation(),e.tribute.isActive=!1,e.tribute.hideMenu())},tab:function(t,n){e.callbacks().enter(t,n)},space:function(t,n){e.tribute.isActive&&(e.tribute.spaceSelectsMatch?e.callbacks().enter(t,n):e.tribute.allowSpaces||(t.stopPropagation(),setTimeout((function(){e.tribute.hideMenu(),e.tribute.isActive=!1}),0)))},up:function(t,n){if(e.tribute.isActive&&e.tribute.current.filteredItems){t.preventDefault(),t.stopPropagation();var i=e.tribute.current.filteredItems.length,r=e.tribute.menuSelected;i>r&&r>0?(e.tribute.menuSelected--,e.setActiveLi()):0===r&&(e.tribute.menuSelected=i-1,e.setActiveLi(),e.tribute.menu.scrollTop=e.tribute.menu.scrollHeight)}},down:function(t,n){if(e.tribute.isActive&&e.tribute.current.filteredItems){t.preventDefault(),t.stopPropagation();var i=e.tribute.current.filteredItems.length-1,r=e.tribute.menuSelected;i>r?(e.tribute.menuSelected++,e.setActiveLi()):i===r&&(e.tribute.menuSelected=0,e.setActiveLi(),e.tribute.menu.scrollTop=0)}},delete:function(t,n){e.tribute.isActive&&e.tribute.current.mentionText.length<1?e.tribute.hideMenu():e.tribute.isActive&&e.tribute.showMenuFor(n)}}}},{key:"setActiveLi",value:function(e){var t=this.tribute.menu.querySelectorAll("li"),n=t.length>>>0;e&&(this.tribute.menuSelected=parseInt(e));for(var i=0;i<n;i++){var r=t[i];if(i===this.tribute.menuSelected){r.classList.add(this.tribute.current.collection.selectClass);var o=r.getBoundingClientRect(),u=this.tribute.menu.getBoundingClientRect();if(o.bottom>u.bottom){var l=o.bottom-u.bottom;this.tribute.menu.scrollTop+=l}else if(o.top<u.top){var a=u.top-o.top;this.tribute.menu.scrollTop-=a}}else r.classList.remove(this.tribute.current.collection.selectClass)}}},{key:"getFullHeight",value:function(e,t){var n=e.getBoundingClientRect().height;if(t){var i=e.currentStyle||window.getComputedStyle(e);return n+parseFloat(i.marginTop)+parseFloat(i.marginBottom)}return n}}],[{key:"keys",value:function(){return[{key:9,value:"TAB"},{key:8,value:"DELETE"},{key:13,value:"ENTER"},{key:27,value:"ESCAPE"},{key:32,value:"SPACE"},{key:38,value:"UP"},{key:40,value:"DOWN"}]}}]),t}(),l=function(){function t(n){e(this,t),this.tribute=n,this.tribute.menuEvents=this,this.menu=this.tribute.menu}return n(t,[{key:"bind",value:function(e){var t=this;this.menuClickEvent=this.tribute.events.click.bind(null,this),this.menuContainerScrollEvent=this.debounce((function(){t.tribute.isActive&&t.tribute.showMenuFor(t.tribute.current.element,!1)}),300,!1),this.windowResizeEvent=this.debounce((function(){t.tribute.isActive&&t.tribute.range.positionMenuAtCaret(!0)}),300,!1),this.tribute.range.getDocument().addEventListener("MSPointerDown",this.menuClickEvent,!1),this.tribute.range.getDocument().addEventListener("mousedown",this.menuClickEvent,!1),window.addEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.addEventListener("scroll",this.menuContainerScrollEvent,!1):window.addEventListener("scroll",this.menuContainerScrollEvent)}},{key:"unbind",value:function(e){this.tribute.range.getDocument().removeEventListener("mousedown",this.menuClickEvent,!1),this.tribute.range.getDocument().removeEventListener("MSPointerDown",this.menuClickEvent,!1),window.removeEventListener("resize",this.windowResizeEvent),this.menuContainer?this.menuContainer.removeEventListener("scroll",this.menuContainerScrollEvent,!1):window.removeEventListener("scroll",this.menuContainerScrollEvent)}},{key:"debounce",value:function(e,t,n){var i,r=arguments,o=this;return function(){var u=o,l=r,a=n&&!i;clearTimeout(i),i=setTimeout((function(){i=null,n||e.apply(u,l)}),t),a&&e.apply(u,l)}}}]),t}(),a=function(){function t(n){e(this,t),this.tribute=n,this.tribute.range=this}return n(t,[{key:"getDocument",value:function(){var e;return this.tribute.current.collection&&(e=this.tribute.current.collection.iframe),e?e.contentWindow.document:document}},{key:"positionMenuAtCaret",value:function(e){var t,n=this,i=this.tribute.current,r=this.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==r){if(!this.tribute.positionMenu)return void(this.tribute.menu.style.cssText="display: block;");t=this.isContentEditable(i.element)?this.getContentEditableCaretPosition(r.mentionPosition):this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element,r.mentionPosition),this.tribute.menu.style.cssText="top: ".concat(t.top,"px;\n                                     left: ").concat(t.left,"px;\n                                     right: ").concat(t.right,"px;\n                                     bottom: ").concat(t.bottom,"px;\n                                     position: absolute;\n                                     display: block;"),"auto"===t.left&&(this.tribute.menu.style.left="auto"),"auto"===t.top&&(this.tribute.menu.style.top="auto"),e&&this.scrollIntoView(),window.setTimeout((function(){var i={width:n.tribute.menu.offsetWidth,height:n.tribute.menu.offsetHeight},r=n.isMenuOffScreen(t,i),o=window.innerWidth>i.width&&(r.left||r.right),u=window.innerHeight>i.height&&(r.top||r.bottom);(o||u)&&(n.tribute.menu.style.cssText="display: none",n.positionMenuAtCaret(e))}),0)}else this.tribute.menu.style.cssText="display: none"}},{key:"selectElement",value:function(e,t,n){var i,r=e;if(t)for(var o=0;o<t.length;o++){if(void 0===(r=r.childNodes[t[o]]))return;for(;r.length<n;)n-=r.length,r=r.nextSibling;0!==r.childNodes.length||r.length||(r=r.previousSibling)}var u=this.getWindowSelection();(i=this.getDocument().createRange()).setStart(r,n),i.setEnd(r,n),i.collapse(!0);try{u.removeAllRanges()}catch(e){}u.addRange(i),e.focus()}},{key:"replaceTriggerText",value:function(e,t,n,i,r){var o=this.getTriggerInfo(!0,n,t,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(void 0!==o){var u=this.tribute.current,l=new CustomEvent("tribute-replaced",{detail:{item:r,instance:u,context:o,event:i}});if(this.isContentEditable(u.element)){e+="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ";var a=o.mentionPosition+o.mentionText.length;this.tribute.autocompleteMode||(a+=o.mentionTriggerChar.length),this.pasteHtml(e,o.mentionPosition,a)}else{var s=this.tribute.current.element,c="string"==typeof this.tribute.replaceTextSuffix?this.tribute.replaceTextSuffix:" ";e+=c;var h=o.mentionPosition,d=o.mentionPosition+o.mentionText.length+c.length;this.tribute.autocompleteMode||(d+=o.mentionTriggerChar.length-1),s.value=s.value.substring(0,h)+e+s.value.substring(d,s.value.length),s.selectionStart=h+e.length,s.selectionEnd=h+e.length}u.element.dispatchEvent(new CustomEvent("input",{bubbles:!0})),u.element.dispatchEvent(l)}}},{key:"pasteHtml",value:function(e,t,n){var i,r;r=this.getWindowSelection(),(i=this.getDocument().createRange()).setStart(r.anchorNode,t),i.setEnd(r.anchorNode,n),i.deleteContents();var o=this.getDocument().createElement("div");o.innerHTML=e;for(var u,l,a=this.getDocument().createDocumentFragment();u=o.firstChild;)l=a.appendChild(u);i.insertNode(a),l&&((i=i.cloneRange()).setStartAfter(l),i.collapse(!0),r.removeAllRanges(),r.addRange(i))}},{key:"getWindowSelection",value:function(){return this.tribute.collection.iframe?this.tribute.collection.iframe.contentWindow.getSelection():window.getSelection()}},{key:"getNodePositionInParent",value:function(e){if(null===e.parentNode)return 0;for(var t=0;t<e.parentNode.childNodes.length;t++){if(e.parentNode.childNodes[t]===e)return t}}},{key:"getContentEditableSelectedPath",value:function(e){var t=this.getWindowSelection(),n=t.anchorNode,i=[];if(null!=n){for(var r,o=n.contentEditable;null!==n&&"true"!==o;)r=this.getNodePositionInParent(n),i.push(r),null!==(n=n.parentNode)&&(o=n.contentEditable);return i.reverse(),{selected:n,path:i,offset:t.getRangeAt(0).startOffset}}}},{key:"getTextPrecedingCurrentSelection",value:function(){var e=this.tribute.current,t="";if(this.isContentEditable(e.element)){var n=this.getWindowSelection().anchorNode;if(null!=n){var i=n.textContent,r=this.getWindowSelection().getRangeAt(0).startOffset;i&&r>=0&&(t=i.substring(0,r))}}else{var o=this.tribute.current.element;if(o){var u=o.selectionStart;o.value&&u>=0&&(t=o.value.substring(0,u))}}return t}},{key:"getLastWordInText",value:function(e){var t;return e=e.replace(/\u00A0/g," "),(t=this.tribute.autocompleteSeparator?e.split(this.tribute.autocompleteSeparator):e.split(/\s+/))[t.length-1].trim()}},{key:"getTriggerInfo",value:function(e,t,n,i,r){var o,u,l,a=this,s=this.tribute.current;if(this.isContentEditable(s.element)){var c=this.getContentEditableSelectedPath(s);c&&(o=c.selected,u=c.path,l=c.offset)}else o=this.tribute.current.element;var h=this.getTextPrecedingCurrentSelection(),d=this.getLastWordInText(h);if(r)return{mentionPosition:h.length-d.length,mentionText:d,mentionSelectedElement:o,mentionSelectedPath:u,mentionSelectedOffset:l};if(null!=h){var f,m=-1;if(this.tribute.collection.forEach((function(e){var t=e.trigger,i=e.requireLeadingSpace?a.lastIndexWithLeadingSpace(h,t):h.lastIndexOf(t);i>m&&(m=i,f=t,n=e.requireLeadingSpace)})),m>=0&&(0===m||!n||/[\xA0\s]/g.test(h.substring(m-1,m)))){var p=h.substring(m+f.length,h.length);f=h.substring(m,m+f.length);var v=p.substring(0,1),g=p.length>0&&(" "===v||" "===v);t&&(p=p.trim());var b=i?/[^\S ]/g:/[\xA0\s]/g;if(this.tribute.hasTrailingSpace=b.test(p),!g&&(e||!b.test(p)))return{mentionPosition:m,mentionText:p,mentionSelectedElement:o,mentionSelectedPath:u,mentionSelectedOffset:l,mentionTriggerChar:f}}}}},{key:"lastIndexWithLeadingSpace",value:function(e,t){for(var n=e.split("").reverse().join(""),i=-1,r=0,o=e.length;r<o;r++){for(var u=r===e.length-1,l=/\s/.test(n[r+1]),a=!0,s=t.length-1;s>=0;s--)if(t[s]!==n[r-s]){a=!1;break}if(a&&(u||l)){i=e.length-1-r;break}}return i}},{key:"isContentEditable",value:function(e){return"INPUT"!==e.nodeName&&"TEXTAREA"!==e.nodeName}},{key:"isMenuOffScreen",value:function(e,t){var n=window.innerWidth,i=window.innerHeight,r=document.documentElement,o=(window.pageXOffset||r.scrollLeft)-(r.clientLeft||0),u=(window.pageYOffset||r.scrollTop)-(r.clientTop||0),l="number"==typeof e.top?e.top:u+i-e.bottom-t.height,a="number"==typeof e.right?e.right:e.left+t.width,s="number"==typeof e.bottom?e.bottom:e.top+t.height,c="number"==typeof e.left?e.left:o+n-e.right-t.width;return{top:l<Math.floor(u),right:a>Math.ceil(o+n),bottom:s>Math.ceil(u+i),left:c<Math.floor(o)}}},{key:"getMenuDimensions",value:function(){var e={width:null,height:null};return this.tribute.menu.style.cssText="top: 0px;\n                                 left: 0px;\n                                 position: fixed;\n                                 display: block;\n                                 visibility; hidden;",e.width=this.tribute.menu.offsetWidth,e.height=this.tribute.menu.offsetHeight,this.tribute.menu.style.cssText="display: none;",e}},{key:"getTextAreaOrInputUnderlinePosition",value:function(e,t,n){var i=null!==window.mozInnerScreenX,r=this.getDocument().createElement("div");r.id="input-textarea-caret-position-mirror-div",this.getDocument().body.appendChild(r);var o=r.style,u=window.getComputedStyle?getComputedStyle(e):e.currentStyle;o.whiteSpace="pre-wrap","INPUT"!==e.nodeName&&(o.wordWrap="break-word"),o.position="absolute",o.visibility="hidden",["direction","boxSizing","width","height","overflowX","overflowY","borderTopWidth","borderRightWidth","borderBottomWidth","borderLeftWidth","paddingTop","paddingRight","paddingBottom","paddingLeft","fontStyle","fontVariant","fontWeight","fontStretch","fontSize","fontSizeAdjust","lineHeight","fontFamily","textAlign","textTransform","textIndent","textDecoration","letterSpacing","wordSpacing"].forEach((function(e){o[e]=u[e]})),i?(o.width="".concat(parseInt(u.width)-2,"px"),e.scrollHeight>parseInt(u.height)&&(o.overflowY="scroll")):o.overflow="hidden",r.textContent=e.value.substring(0,t),"INPUT"===e.nodeName&&(r.textContent=r.textContent.replace(/\s/g," "));var l=this.getDocument().createElement("span");l.textContent=e.value.substring(t)||".",r.appendChild(l);var a=e.getBoundingClientRect(),s=document.documentElement,c=(window.pageXOffset||s.scrollLeft)-(s.clientLeft||0),h=(window.pageYOffset||s.scrollTop)-(s.clientTop||0),d=0,f=0;this.menuContainerIsBody&&(d=a.top,f=a.left);var m={top:d+h+l.offsetTop+parseInt(u.borderTopWidth)+parseInt(u.fontSize)-e.scrollTop,left:f+c+l.offsetLeft+parseInt(u.borderLeftWidth)},p=window.innerWidth,v=window.innerHeight,g=this.getMenuDimensions(),b=this.isMenuOffScreen(m,g);b.right&&(m.right=p-m.left,m.left="auto");var y=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(b.bottom){var w=y-(v-(this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect()).top);m.bottom=w+(v-a.top-l.offsetTop),m.top="auto"}return(b=this.isMenuOffScreen(m,g)).left&&(m.left=p>g.width?c+p-g.width:c,delete m.right),b.top&&(m.top=v>g.height?h+v-g.height:h,delete m.bottom),this.getDocument().body.removeChild(r),m}},{key:"getContentEditableCaretPosition",value:function(e){var t,n=this.getWindowSelection();(t=this.getDocument().createRange()).setStart(n.anchorNode,e),t.setEnd(n.anchorNode,e),t.collapse(!1);var i=t.getBoundingClientRect(),r=document.documentElement,o=(window.pageXOffset||r.scrollLeft)-(r.clientLeft||0),u=(window.pageYOffset||r.scrollTop)-(r.clientTop||0),l={left:i.left+o,top:i.top+i.height+u},a=window.innerWidth,s=window.innerHeight,c=this.getMenuDimensions(),h=this.isMenuOffScreen(l,c);h.right&&(l.left="auto",l.right=a-i.left-o);var d=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(h.bottom){var f=d-(s-(this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect()).top);l.top="auto",l.bottom=f+(s-i.top)}return(h=this.isMenuOffScreen(l,c)).left&&(l.left=a>c.width?o+a-c.width:o,delete l.right),h.top&&(l.top=s>c.height?u+s-c.height:u,delete l.bottom),this.menuContainerIsBody||(l.left=l.left?l.left-this.tribute.menuContainer.offsetLeft:l.left,l.top=l.top?l.top-this.tribute.menuContainer.offsetTop:l.top),l}},{key:"scrollIntoView",value:function(e){var t,n=this.menu;if(void 0!==n){for(;void 0===t||0===t.height;)if(0===(t=n.getBoundingClientRect()).height&&(void 0===(n=n.childNodes[0])||!n.getBoundingClientRect))return;var i=t.top,r=i+t.height;if(i<0)window.scrollTo(0,window.pageYOffset+t.top-20);else if(r>window.innerHeight){var o=window.pageYOffset+t.top-20;o-window.pageYOffset>100&&(o=window.pageYOffset+100);var u=window.pageYOffset-(window.innerHeight-r);u>o&&(u=o),window.scrollTo(0,u)}}}},{key:"menuContainerIsBody",get:function(){return this.tribute.menuContainer===document.body||!this.tribute.menuContainer}}]),t}(),s=function(){function t(n){e(this,t),this.tribute=n,this.tribute.search=this}return n(t,[{key:"simpleFilter",value:function(e,t){var n=this;return t.filter((function(t){return n.test(e,t)}))}},{key:"test",value:function(e,t){return null!==this.match(e,t)}},{key:"match",value:function(e,t,n){n=n||{};t.length;var i=n.pre||"",r=n.post||"",o=n.caseSensitive&&t||t.toLowerCase();if(n.skip)return{rendered:t,score:0};e=n.caseSensitive&&e||e.toLowerCase();var u=this.traverse(o,e,0,0,[]);return u?{rendered:this.render(t,u.cache,i,r),score:u.score}:null}},{key:"traverse",value:function(e,t,n,i,r){if(this.tribute.autocompleteSeparator&&(t=t.split(this.tribute.autocompleteSeparator).splice(-1)[0]),t.length===i)return{score:this.calculateScore(r),cache:r.slice()};if(!(e.length===n||t.length-i>e.length-n)){for(var o,u,l=t[i],a=e.indexOf(l,n);a>-1;){if(r.push(a),u=this.traverse(e,t,a+1,i+1,r),r.pop(),!u)return o;(!o||o.score<u.score)&&(o=u),a=e.indexOf(l,a+1)}return o}}},{key:"calculateScore",value:function(e){var t=0,n=1;return e.forEach((function(i,r){r>0&&(e[r-1]+1===i?n+=n+1:n=1),t+=n})),t}},{key:"render",value:function(e,t,n,i){var r=e.substring(0,t[0]);return t.forEach((function(o,u){r+=n+e[o]+i+e.substring(o+1,t[u+1]?t[u+1]:e.length)})),r}},{key:"filter",value:function(e,t,n){var i=this;return n=n||{},t.reduce((function(t,r,o,u){var l=r;n.extract&&((l=n.extract(r))||(l=""));var a=i.match(e,l,n);return null!=a&&(t[t.length]={string:a.rendered,score:a.score,index:o,original:r}),t}),[]).sort((function(e,t){var n=t.score-e.score;return n||e.index-t.index}))}}]),t}();return function(){function t(n){var i,r=this,o=n.values,c=void 0===o?null:o,h=n.iframe,d=void 0===h?null:h,f=n.selectClass,m=void 0===f?"highlight":f,p=n.containerClass,v=void 0===p?"tribute-container":p,g=n.itemClass,b=void 0===g?"":g,y=n.trigger,w=void 0===y?"@":y,T=n.autocompleteMode,C=void 0!==T&&T,S=n.autocompleteSeparator,E=void 0===S?null:S,k=n.selectTemplate,x=void 0===k?null:k,M=n.menuItemTemplate,A=void 0===M?null:M,L=n.lookup,I=void 0===L?"key":L,N=n.fillAttr,O=void 0===N?"value":N,D=n.collection,P=void 0===D?null:D,R=n.menuContainer,W=void 0===R?null:R,H=n.noMatchTemplate,B=void 0===H?null:H,F=n.requireLeadingSpace,_=void 0===F||F,j=n.allowSpaces,Y=void 0!==j&&j,z=n.replaceTextSuffix,K=void 0===z?null:z,U=n.positionMenu,q=void 0===U||U,X=n.spaceSelectsMatch,Q=void 0!==X&&X,V=n.searchOpts,$=void 0===V?{}:V,G=n.menuItemLimit,J=void 0===G?null:G,Z=n.menuShowMinLength,ee=void 0===Z?0:Z;if(e(this,t),this.autocompleteMode=C,this.autocompleteSeparator=E,this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=W,this.allowSpaces=Y,this.replaceTextSuffix=K,this.positionMenu=q,this.hasTrailingSpace=!1,this.spaceSelectsMatch=Q,this.autocompleteMode&&(w="",Y=!1),c)this.collection=[{trigger:w,iframe:d,selectClass:m,containerClass:v,itemClass:b,selectTemplate:(x||t.defaultSelectTemplate).bind(this),menuItemTemplate:(A||t.defaultMenuItemTemplate).bind(this),noMatchTemplate:(i=B,"string"==typeof i?""===i.trim()?null:i:"function"==typeof i?i.bind(r):B||function(){return"<li>No Match Found!</li>"}.bind(r)),lookup:I,fillAttr:O,values:c,requireLeadingSpace:_,searchOpts:$,menuItemLimit:J,menuShowMinLength:ee}];else{if(!P)throw new Error("[Tribute] No collection specified.");this.autocompleteMode&&console.warn("Tribute in autocomplete mode does not work for collections"),this.collection=P.map((function(e){return{trigger:e.trigger||w,iframe:e.iframe||d,selectClass:e.selectClass||m,containerClass:e.containerClass||v,itemClass:e.itemClass||b,selectTemplate:(e.selectTemplate||t.defaultSelectTemplate).bind(r),menuItemTemplate:(e.menuItemTemplate||t.defaultMenuItemTemplate).bind(r),noMatchTemplate:function(e){return"string"==typeof e?""===e.trim()?null:e:"function"==typeof e?e.bind(r):B||function(){return"<li>No Match Found!</li>"}.bind(r)}(B),lookup:e.lookup||I,fillAttr:e.fillAttr||O,values:e.values,requireLeadingSpace:e.requireLeadingSpace,searchOpts:e.searchOpts||$,menuItemLimit:e.menuItemLimit||J,menuShowMinLength:e.menuShowMinLength||ee}}))}new a(this),new u(this),new l(this),new s(this)}return n(t,[{key:"triggers",value:function(){return this.collection.map((function(e){return e.trigger}))}},{key:"attach",value:function(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array)for(var t=e.length,n=0;n<t;++n)this._attach(e[n]);else this._attach(e)}},{key:"_attach",value:function(e){e.hasAttribute("data-tribute")&&console.warn("Tribute was already bound to "+e.nodeName),this.ensureEditable(e),this.events.bind(e),e.setAttribute("data-tribute",!0)}},{key:"ensureEditable",value:function(e){if(-1===t.inputTypes().indexOf(e.nodeName)){if(!e.contentEditable)throw new Error("[Tribute] Cannot bind to "+e.nodeName);e.contentEditable=!0}}},{key:"createMenu",value:function(e){var t=this.range.getDocument().createElement("div"),n=this.range.getDocument().createElement("ul");return t.className=e,t.appendChild(n),this.menuContainer?this.menuContainer.appendChild(t):this.range.getDocument().body.appendChild(t)}},{key:"showMenuFor",value:function(e,t){var n=this;if(!this.isActive||this.current.element!==e||this.current.mentionText!==this.currentMentionTextSnapshot){this.currentMentionTextSnapshot=this.current.mentionText,this.menu||(this.menu=this.createMenu(this.current.collection.containerClass),e.tributeMenu=this.menu,this.menuEvents.bind(this.menu)),this.isActive=!0,this.menuSelected=0,this.current.mentionText||(this.current.mentionText="");var r=function(e){if(n.isActive){var r=n.search.filter(n.current.mentionText,e,{pre:n.current.collection.searchOpts.pre||"<span>",post:n.current.collection.searchOpts.post||"</span>",skip:n.current.collection.searchOpts.skip,extract:function(e){if("string"==typeof n.current.collection.lookup)return e[n.current.collection.lookup];if("function"==typeof n.current.collection.lookup)return n.current.collection.lookup(e,n.current.mentionText);throw new Error("Invalid lookup attribute, lookup must be string or function.")}});n.current.collection.menuItemLimit&&(r=r.slice(0,n.current.collection.menuItemLimit)),n.current.filteredItems=r;var o=n.menu.querySelector("ul");if(n.range.positionMenuAtCaret(t),!r.length){var u=new CustomEvent("tribute-no-match",{detail:n.menu});return n.current.element.dispatchEvent(u),void("function"==typeof n.current.collection.noMatchTemplate&&!n.current.collection.noMatchTemplate()||!n.current.collection.noMatchTemplate?n.hideMenu():"function"==typeof n.current.collection.noMatchTemplate?o.innerHTML=n.current.collection.noMatchTemplate():o.innerHTML=n.current.collection.noMatchTemplate)}o.innerHTML="";var l=n.range.getDocument().createDocumentFragment();r.forEach((function(e,t){var r=n.range.getDocument().createElement("li");r.setAttribute("data-index",t),r.className=n.current.collection.itemClass,r.addEventListener("mousemove",(function(e){var t=i(n._findLiTarget(e.target),2),r=(t[0],t[1]);0!==e.movementY&&n.events.setActiveLi(r)})),n.menuSelected===t&&r.classList.add(n.current.collection.selectClass),r.innerHTML=n.current.collection.menuItemTemplate(e),l.appendChild(r)})),o.appendChild(l)}};"function"==typeof this.current.collection.values?this.current.collection.values(this.current.mentionText,r):r(this.current.collection.values)}}},{key:"_findLiTarget",value:function(e){if(!e)return[];var t=e.getAttribute("data-index");return t?[e,t]:this._findLiTarget(e.parentNode)}},{key:"showMenuForCollection",value:function(e,t){e!==document.activeElement&&this.placeCaretAtEnd(e),this.current.collection=this.collection[t||0],this.current.externalTrigger=!0,this.current.element=e,e.isContentEditable?this.insertTextAtCursor(this.current.collection.trigger):this.insertAtCaret(e,this.current.collection.trigger),this.showMenuFor(e)}},{key:"placeCaretAtEnd",value:function(e){if(e.focus(),void 0!==window.getSelection&&void 0!==document.createRange){var t=document.createRange();t.selectNodeContents(e),t.collapse(!1);var n=window.getSelection();n.removeAllRanges(),n.addRange(t)}else if(void 0!==document.body.createTextRange){var i=document.body.createTextRange();i.moveToElementText(e),i.collapse(!1),i.select()}}},{key:"insertTextAtCursor",value:function(e){var t,n;(n=(t=window.getSelection()).getRangeAt(0)).deleteContents();var i=document.createTextNode(e);n.insertNode(i),n.selectNodeContents(i),n.collapse(!1),t.removeAllRanges(),t.addRange(n)}},{key:"insertAtCaret",value:function(e,t){var n=e.scrollTop,i=e.selectionStart,r=e.value.substring(0,i),o=e.value.substring(e.selectionEnd,e.value.length);e.value=r+t+o,i+=t.length,e.selectionStart=i,e.selectionEnd=i,e.focus(),e.scrollTop=n}},{key:"hideMenu",value:function(){this.menu&&(this.menu.style.cssText="display: none;",this.isActive=!1,this.menuSelected=0,this.current={})}},{key:"selectItemAtIndex",value:function(e,t){if("number"==typeof(e=parseInt(e))&&!isNaN(e)){var n=this.current.filteredItems[e],i=this.current.collection.selectTemplate(n);null!==i&&this.replaceText(i,t,n)}}},{key:"replaceText",value:function(e,t,n){this.range.replaceTriggerText(e,!0,!0,t,n)}},{key:"_append",value:function(e,t,n){if("function"==typeof e.values)throw new Error("Unable to append to values, as it is a function.");e.values=n?t:e.values.concat(t)}},{key:"append",value:function(e,t,n){var i=parseInt(e);if("number"!=typeof i)throw new Error("please provide an index for the collection to update.");var r=this.collection[i];this._append(r,t,n)}},{key:"appendCurrent",value:function(e,t){if(!this.isActive)throw new Error("No active state. Please use append instead and pass an index.");this._append(this.current.collection,e,t)}},{key:"detach",value:function(e){if(!e)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if("undefined"!=typeof jQuery&&e instanceof jQuery&&(e=e.get()),e.constructor===NodeList||e.constructor===HTMLCollection||e.constructor===Array)for(var t=e.length,n=0;n<t;++n)this._detach(e[n]);else this._detach(e)}},{key:"_detach",value:function(e){var t=this;this.events.unbind(e),e.tributeMenu&&this.menuEvents.unbind(e.tributeMenu),setTimeout((function(){e.removeAttribute("data-tribute"),t.isActive=!1,e.tributeMenu&&e.tributeMenu.remove()}))}},{key:"isActive",get:function(){return this._isActive},set:function(e){if(this._isActive!=e&&(this._isActive=e,this.current.element)){var t=new CustomEvent("tribute-active-".concat(e));this.current.element.dispatchEvent(t)}}}],[{key:"defaultSelectTemplate",value:function(e){return void 0===e?"".concat(this.current.collection.trigger).concat(this.current.mentionText):this.range.isContentEditable(this.current.element)?'<span class="tribute-mention">'+(this.current.collection.trigger+e.original[this.current.collection.fillAttr])+"</span>":this.current.collection.trigger+e.original[this.current.collection.fillAttr]}},{key:"defaultMenuItemTemplate",value:function(e){return e.string}},{key:"inputTypes",value:function(){return["TEXTAREA","INPUT"]}}]),t}()}));
2
//# sourceMappingURL=tribute.min.js.map
public/javascripts/tribute.min.js.map
1
{"version":3,"sources":["tribute.min.js"],"names":["f","exports","module","define","amd","window","global","self","this","Tribute","r","e","n","t","o","i","c","require","u","a","Error","code","p","call","length","1","Object","defineProperty","value","_interopRequireDefault","_TributeEvents","_TributeMenuEvents","_TributeRange","_TributeSearch","obj","__esModule","default","_slicedToArray","arr","Array","isArray","_arrayWithHoles","_arr","_n","_d","_e","undefined","_s","_i","Symbol","iterator","next","done","push","err","_iterableToArrayLimit","TypeError","_nonIterableRest","_defineProperties","target","props","descriptor","enumerable","configurable","writable","key","_default","_ref","_this","_ref$values","values","_ref$iframe","iframe","_ref$selectClass","selectClass","_ref$trigger","trigger","_ref$autocompleteMode","autocompleteMode","_ref$selectTemplate","selectTemplate","_ref$menuItemTemplate","menuItemTemplate","_ref$lookup","lookup","_ref$fillAttr","fillAttr","_ref$collection","collection","_ref$menuContainer","menuContainer","_ref$noMatchTemplate","noMatchTemplate","_ref$requireLeadingSp","requireLeadingSpace","_ref$allowSpaces","allowSpaces","_ref$replaceTextSuffi","replaceTextSuffix","_ref$positionMenu","positionMenu","_ref$spaceSelectsMatc","spaceSelectsMatch","_ref$searchOpts","searchOpts","_ref$menuItemLimit","menuItemLimit","instance","Constructor","_classCallCheck","menuSelected","current","inputEvent","isActive","hasTrailingSpace","defaultSelectTemplate","bind","defaultMenuItemTemplate","console","warn","map","item","protoProps","staticProps","prototype","_createClass","config","el","jQuery","get","constructor","NodeList","HTMLCollection","_attach","hasAttribute","nodeName","ensureEditable","events","setAttribute","element","inputTypes","indexOf","contentEditable","wrapper","range","getDocument","createElement","ul","className","appendChild","body","scrollTo","_this2","mentionText","currentMentionTextSnapshot","menu","createMenu","tributeMenu","menuEvents","processValues","items","search","filter","pre","post","skip","extract","filteredItems","querySelector","positionMenuAtCaret","noMatchEvent","CustomEvent","detail","dispatchEvent","hideMenu","innerHTML","slice","fragment","createDocumentFragment","forEach","index","li","addEventListener","_this2$_findLiTarget2","_findLiTarget","movementY","setActiveLi","getAttribute","parentNode","collectionIndex","document","activeElement","placeCaretAtEnd","externalTrigger","isContentEditable","insertTextAtCursor","insertAtCaret","showMenuFor","focus","getSelection","createRange","selectNodeContents","collapse","sel","removeAllRanges","addRange","createTextRange","textRange","moveToElementText","select","text","getRangeAt","deleteContents","textNode","createTextNode","insertNode","textarea","scrollPos","scrollTop","caretPos","selectionStart","front","substring","back","selectionEnd","style","cssText","originalEvent","parseInt","isNaN","content","replaceText","replaceTriggerText","newValues","replace","concat","_append","_detach","_this3","unbind","setTimeout","removeAttribute","remove","original","matchItem","string","./TributeEvents","./TributeMenuEvents","./TributeRange","./TributeSearch","./utils","2","TributeEvents","tribute","boundKeydown","keydown","boundKeyup","keyup","boundInput","input","removeEventListener","event","shouldDeactivate","commandEvent","keys","keyCode","callbacks","toLowerCase","contains","preventDefault","stopPropagation","selectItemAtIndex","updateSelection","triggerChar","getKeyCode","triggers","find","charCodeAt","eventKeyPressed","info","getTriggerInfo","mentionTriggerChar","selectedPath","mentionSelectedPath","selectedOffset","mentionSelectedOffset","collectionItem","enter","escape","tab","space","up","count","selected","scrollHeight","down","delete","lis","querySelectorAll","classList","add","liClientRect","getBoundingClientRect","menuClientRect","bottom","scrollDistance","top","_scrollDistance","elem","includeMargin","height","currentStyle","getComputedStyle","parseFloat","marginTop","marginBottom","3","TributeMenuEvents","menuClickEvent","click","menuContainerScrollEvent","debounce","windowResizeEvent","func","wait","immediate","timeout","_arguments","arguments","context","args","callNow","clearTimeout","apply","4","TributeRange","contentWindow","coordinates","getContentEditableCaretPosition","mentionPosition","getTextAreaOrInputUnderlinePosition","left","right","scrollIntoView","menuDimensions","width","offsetWidth","offsetHeight","menuIsOffScreen","isMenuOffScreen","menuIsOffScreenHorizontally","innerWidth","menuIsOffScreenVertically","innerHeight","targetElement","path","offset","childNodes","nextSibling","previousSibling","getWindowSelection","setStart","setEnd","error","replaceEvent","pasteHtml","myField","textSuffix","startPos","endPos","html","anchorNode","node","lastNode","frag","firstChild","cloneRange","setStartAfter","ctx","ce","getNodePositionInParent","reverse","startOffset","selectedElem","workingNodeContent","textContent","selectStartOffset","textComponent","wordsArray","split","trim","menuAlreadyActive","isAutocomplete","selectionInfo","getContentEditableSelectedPath","effectiveRange","getTextPrecedingCurrentSelection","lastWordOfEffectiveRange","getLastWordInText","mentionSelectedElement","mostRecentTriggerCharPos","idx","lastIndexWithLeadingSpace","lastIndexOf","test","currentTriggerSnippet","firstSnippetChar","leadingSpace","regex","str","_char","reversedStr","join","cidx","len","firstChar","windowWidth","windowHeight","doc","documentElement","windowLeft","pageXOffset","scrollLeft","clientLeft","windowTop","pageYOffset","clientTop","menuTop","menuRight","menuBottom","menuLeft","Math","floor","ceil","dimensions","position","flipped","isFirefox","mozInnerScreenX","div","id","computed","whiteSpace","wordWrap","visibility","prop","overflowY","overflow","span","rect","offsetTop","borderTopWidth","fontSize","offsetLeft","borderLeftWidth","getMenuDimensions","parentHeight","scrollStillAvailable","removeChild","selectedNodePosition","markerEl","markerId","Date","getTime","random","toString","substr","prevRange","clientRect","elemTop","elemBottom","maxY","targetY","5","TributeSearch","pattern","array","match","opts","compareString","caseSensitive","rendered","score","patternCache","traverse","render","cache","stringIndex","patternIndex","calculateScore","best","temp","pop","indices","reduce","prev","sort","b","compare","6","./Tribute","7","predicate","list","thisArg","params","bubbles","cancelable","evt","createEvent","initCustomEvent","Event"],"mappings":"CAAA,SAAUA,GAAG,GAAoB,iBAAVC,SAAoC,oBAATC,OAAsBA,OAAOD,QAAQD,SAAS,GAAmB,mBAATG,QAAqBA,OAAOC,IAAKD,OAAO,GAAGH,OAAO,EAA0B,oBAATK,OAAwBA,OAA+B,oBAATC,OAAwBA,OAA6B,oBAAPC,KAAsBA,KAAYC,MAAOC,QAAUT,KAA5T,CAAmU,WAAqC,OAAmB,SAASU,EAAEC,EAAEC,EAAEC,GAAG,SAASC,EAAEC,EAAEf,GAAG,IAAIY,EAAEG,GAAG,CAAC,IAAIJ,EAAEI,GAAG,CAAC,IAAIC,EAAE,mBAAmBC,SAASA,QAAQ,IAAIjB,GAAGgB,EAAE,OAAOA,EAAED,GAAE,GAAI,GAAGG,EAAE,OAAOA,EAAEH,GAAE,GAAI,IAAII,EAAE,IAAIC,MAAM,uBAAuBL,EAAE,KAAK,MAAMI,EAAEE,KAAK,mBAAmBF,EAAE,IAAIG,EAAEV,EA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7d,OAAOlB,MACdgB,EAAS+d,EAAK/d,SAAW,EACzBge,EAAUhL,UAAU,GAGfzT,EAAI,EAAGA,EAAIS,EAAQT,IAG1B,GAFAa,EAAQ2d,EAAKxe,GAETue,EAAU/d,KAAKie,EAAS5d,EAAOb,EAAGwe,GACpC,OAAO3d,IAQXvB,QAAwC,mBAAvBA,OAAOsK,YAA4B,CACtD,IAAIA,EAAc,SAAqB0F,EAAOoP,GAC5CA,EAASA,GAAU,CACjBC,SAAS,EACTC,YAAY,EACZ/U,YAAQ9H,GAEV,IAAI8c,EAAM9T,SAAS+T,YAAY,eAE/B,OADAD,EAAIE,gBAAgBzP,EAAOoP,EAAOC,QAASD,EAAOE,WAAYF,EAAO7U,QAC9DgV,QAGmB,IAAjBvf,OAAO0f,QAChBpV,EAAY/C,UAAYvH,OAAO0f,MAAMnY,WAGvCvH,OAAOsK,YAAcA,IAGrB,KAAK,GAAG,CAAC,GA9zDoW,CA8zDhW","file":"tribute.min.js","sourcesContent":["(function(f){if(typeof exports===\"object\"&&typeof module!==\"undefined\"){module.exports=f()}else if(typeof define===\"function\"&&define.amd){define([],f)}else{var g;if(typeof window!==\"undefined\"){g=window}else if(typeof global!==\"undefined\"){g=global}else if(typeof self!==\"undefined\"){g=self}else{g=this}g.Tribute = f()}})(function(){var define,module,exports;return (function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c=\"function\"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error(\"Cannot find module '\"+i+\"'\");throw a.code=\"MODULE_NOT_FOUND\",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u=\"function\"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports[\"default\"] = void 0;\n\nvar _utils = _interopRequireDefault(require(\"./utils\"));\n\nvar _TributeEvents = _interopRequireDefault(require(\"./TributeEvents\"));\n\nvar _TributeMenuEvents = _interopRequireDefault(require(\"./TributeMenuEvents\"));\n\nvar _TributeRange = _interopRequireDefault(require(\"./TributeRange\"));\n\nvar _TributeSearch = _interopRequireDefault(require(\"./TributeSearch\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\nfunction _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar Tribute =\n/*#__PURE__*/\nfunction () {\n  function Tribute(_ref) {\n    var _this = this;\n\n    var _ref$values = _ref.values,\n        values = _ref$values === void 0 ? null : _ref$values,\n        _ref$iframe = _ref.iframe,\n        iframe = _ref$iframe === void 0 ? null : _ref$iframe,\n        _ref$selectClass = _ref.selectClass,\n        selectClass = _ref$selectClass === void 0 ? 'highlight' : _ref$selectClass,\n        _ref$trigger = _ref.trigger,\n        trigger = _ref$trigger === void 0 ? '@' : _ref$trigger,\n        _ref$autocompleteMode = _ref.autocompleteMode,\n        autocompleteMode = _ref$autocompleteMode === void 0 ? false : _ref$autocompleteMode,\n        _ref$selectTemplate = _ref.selectTemplate,\n        selectTemplate = _ref$selectTemplate === void 0 ? null : _ref$selectTemplate,\n        _ref$menuItemTemplate = _ref.menuItemTemplate,\n        menuItemTemplate = _ref$menuItemTemplate === void 0 ? null : _ref$menuItemTemplate,\n        _ref$lookup = _ref.lookup,\n        lookup = _ref$lookup === void 0 ? 'key' : _ref$lookup,\n        _ref$fillAttr = _ref.fillAttr,\n        fillAttr = _ref$fillAttr === void 0 ? 'value' : _ref$fillAttr,\n        _ref$collection = _ref.collection,\n        collection = _ref$collection === void 0 ? null : _ref$collection,\n        _ref$menuContainer = _ref.menuContainer,\n        menuContainer = _ref$menuContainer === void 0 ? null : _ref$menuContainer,\n        _ref$noMatchTemplate = _ref.noMatchTemplate,\n        noMatchTemplate = _ref$noMatchTemplate === void 0 ? null : _ref$noMatchTemplate,\n        _ref$requireLeadingSp = _ref.requireLeadingSpace,\n        requireLeadingSpace = _ref$requireLeadingSp === void 0 ? true : _ref$requireLeadingSp,\n        _ref$allowSpaces = _ref.allowSpaces,\n        allowSpaces = _ref$allowSpaces === void 0 ? false : _ref$allowSpaces,\n        _ref$replaceTextSuffi = _ref.replaceTextSuffix,\n        replaceTextSuffix = _ref$replaceTextSuffi === void 0 ? null : _ref$replaceTextSuffi,\n        _ref$positionMenu = _ref.positionMenu,\n        positionMenu = _ref$positionMenu === void 0 ? true : _ref$positionMenu,\n        _ref$spaceSelectsMatc = _ref.spaceSelectsMatch,\n        spaceSelectsMatch = _ref$spaceSelectsMatc === void 0 ? false : _ref$spaceSelectsMatc,\n        _ref$searchOpts = _ref.searchOpts,\n        searchOpts = _ref$searchOpts === void 0 ? {} : _ref$searchOpts,\n        _ref$menuItemLimit = _ref.menuItemLimit,\n        menuItemLimit = _ref$menuItemLimit === void 0 ? null : _ref$menuItemLimit;\n\n    _classCallCheck(this, Tribute);\n\n    this.autocompleteMode = autocompleteMode;\n    this.menuSelected = 0;\n    this.current = {};\n    this.inputEvent = false;\n    this.isActive = false;\n    this.menuContainer = menuContainer;\n    this.allowSpaces = allowSpaces;\n    this.replaceTextSuffix = replaceTextSuffix;\n    this.positionMenu = positionMenu;\n    this.hasTrailingSpace = false;\n    this.spaceSelectsMatch = spaceSelectsMatch;\n\n    if (this.autocompleteMode) {\n      trigger = '';\n      allowSpaces = false;\n    }\n\n    if (values) {\n      this.collection = [{\n        // symbol that starts the lookup\n        trigger: trigger,\n        // is it wrapped in an iframe\n        iframe: iframe,\n        // class applied to selected item\n        selectClass: selectClass,\n        // function called on select that retuns the content to insert\n        selectTemplate: (selectTemplate || Tribute.defaultSelectTemplate).bind(this),\n        // function called that returns content for an item\n        menuItemTemplate: (menuItemTemplate || Tribute.defaultMenuItemTemplate).bind(this),\n        // function called when menu is empty, disables hiding of menu.\n        noMatchTemplate: function (t) {\n          if (typeof t === 'function') {\n            return t.bind(_this);\n          }\n\n          return noMatchTemplate || function () {\n            return '';\n          }.bind(_this);\n        }(noMatchTemplate),\n        // column to search against in the object\n        lookup: lookup,\n        // column that contains the content to insert by default\n        fillAttr: fillAttr,\n        // array of objects or a function returning an array of objects\n        values: values,\n        requireLeadingSpace: requireLeadingSpace,\n        searchOpts: searchOpts,\n        menuItemLimit: menuItemLimit\n      }];\n    } else if (collection) {\n      if (this.autocompleteMode) console.warn('Tribute in autocomplete mode does not work for collections');\n      this.collection = collection.map(function (item) {\n        return {\n          trigger: item.trigger || trigger,\n          iframe: item.iframe || iframe,\n          selectClass: item.selectClass || selectClass,\n          selectTemplate: (item.selectTemplate || Tribute.defaultSelectTemplate).bind(_this),\n          menuItemTemplate: (item.menuItemTemplate || Tribute.defaultMenuItemTemplate).bind(_this),\n          // function called when menu is empty, disables hiding of menu.\n          noMatchTemplate: function (t) {\n            if (typeof t === 'function') {\n              return t.bind(_this);\n            }\n\n            return null;\n          }(noMatchTemplate),\n          lookup: item.lookup || lookup,\n          fillAttr: item.fillAttr || fillAttr,\n          values: item.values,\n          requireLeadingSpace: item.requireLeadingSpace,\n          searchOpts: item.searchOpts || searchOpts,\n          menuItemLimit: item.menuItemLimit || menuItemLimit\n        };\n      });\n    } else {\n      throw new Error('[Tribute] No collection specified.');\n    }\n\n    new _TributeRange[\"default\"](this);\n    new _TributeEvents[\"default\"](this);\n    new _TributeMenuEvents[\"default\"](this);\n    new _TributeSearch[\"default\"](this);\n  }\n\n  _createClass(Tribute, [{\n    key: \"triggers\",\n    value: function triggers() {\n      return this.collection.map(function (config) {\n        return config.trigger;\n      });\n    }\n  }, {\n    key: \"attach\",\n    value: function attach(el) {\n      if (!el) {\n        throw new Error('[Tribute] Must pass in a DOM node or NodeList.');\n      } // Check if it is a jQuery collection\n\n\n      if (typeof jQuery !== 'undefined' && el instanceof jQuery) {\n        el = el.get();\n      } // Is el an Array/Array-like object?\n\n\n      if (el.constructor === NodeList || el.constructor === HTMLCollection || el.constructor === Array) {\n        var length = el.length;\n\n        for (var i = 0; i < length; ++i) {\n          this._attach(el[i]);\n        }\n      } else {\n        this._attach(el);\n      }\n    }\n  }, {\n    key: \"_attach\",\n    value: function _attach(el) {\n      if (el.hasAttribute('data-tribute')) {\n        console.warn('Tribute was already bound to ' + el.nodeName);\n      }\n\n      this.ensureEditable(el);\n      this.events.bind(el);\n      el.setAttribute('data-tribute', true);\n    }\n  }, {\n    key: \"ensureEditable\",\n    value: function ensureEditable(element) {\n      if (Tribute.inputTypes().indexOf(element.nodeName) === -1) {\n        if (element.contentEditable) {\n          element.contentEditable = true;\n        } else {\n          throw new Error('[Tribute] Cannot bind to ' + element.nodeName);\n        }\n      }\n    }\n  }, {\n    key: \"createMenu\",\n    value: function createMenu() {\n      var wrapper = this.range.getDocument().createElement('div'),\n          ul = this.range.getDocument().createElement('ul');\n      wrapper.className = 'tribute-container';\n      wrapper.appendChild(ul);\n\n      if (this.menuContainer) {\n        return this.menuContainer.appendChild(wrapper);\n      }\n\n      return this.range.getDocument().body.appendChild(wrapper);\n    }\n  }, {\n    key: \"showMenuFor\",\n    value: function showMenuFor(element, scrollTo) {\n      var _this2 = this;\n\n      // Only proceed if menu isn't already shown for the current element & mentionText\n      if (this.isActive && this.current.element === element && this.current.mentionText === this.currentMentionTextSnapshot) {\n        return;\n      }\n\n      this.currentMentionTextSnapshot = this.current.mentionText; // create the menu if it doesn't exist.\n\n      if (!this.menu) {\n        this.menu = this.createMenu();\n        element.tributeMenu = this.menu;\n        this.menuEvents.bind(this.menu);\n      }\n\n      this.isActive = true;\n      this.menuSelected = 0;\n\n      if (!this.current.mentionText) {\n        this.current.mentionText = '';\n      }\n\n      var processValues = function processValues(values) {\n        // Tribute may not be active any more by the time the value callback returns\n        if (!_this2.isActive) {\n          return;\n        }\n\n        var items = _this2.search.filter(_this2.current.mentionText, values, {\n          pre: _this2.current.collection.searchOpts.pre || '<span>',\n          post: _this2.current.collection.searchOpts.post || '</span>',\n          skip: _this2.current.collection.searchOpts.skip,\n          extract: function extract(el) {\n            if (typeof _this2.current.collection.lookup === 'string') {\n              return el[_this2.current.collection.lookup];\n            } else if (typeof _this2.current.collection.lookup === 'function') {\n              return _this2.current.collection.lookup(el, _this2.current.mentionText);\n            } else {\n              throw new Error('Invalid lookup attribute, lookup must be string or function.');\n            }\n          }\n        });\n\n        _this2.current.filteredItems = items;\n\n        var ul = _this2.menu.querySelector('ul');\n\n        _this2.range.positionMenuAtCaret(scrollTo);\n\n        if (!items.length) {\n          var noMatchEvent = new CustomEvent('tribute-no-match', {\n            detail: _this2.menu\n          });\n\n          _this2.current.element.dispatchEvent(noMatchEvent);\n\n          if (typeof _this2.current.collection.noMatchTemplate === 'function' && !_this2.current.collection.noMatchTemplate() || !_this2.current.collection.noMatchTemplate) {\n            _this2.hideMenu();\n          } else {\n            typeof _this2.current.collection.noMatchTemplate === 'function' ? ul.innerHTML = _this2.current.collection.noMatchTemplate() : ul.innerHTML = _this2.current.collection.noMatchTemplate;\n          }\n\n          return;\n        }\n\n        if (_this2.current.collection.menuItemLimit) {\n          items = items.slice(0, _this2.current.collection.menuItemLimit);\n        }\n\n        ul.innerHTML = '';\n\n        var fragment = _this2.range.getDocument().createDocumentFragment();\n\n        items.forEach(function (item, index) {\n          var li = _this2.range.getDocument().createElement('li');\n\n          li.setAttribute('data-index', index);\n          li.addEventListener('mousemove', function (e) {\n            var _this2$_findLiTarget = _this2._findLiTarget(e.target),\n                _this2$_findLiTarget2 = _slicedToArray(_this2$_findLiTarget, 2),\n                li = _this2$_findLiTarget2[0],\n                index = _this2$_findLiTarget2[1];\n\n            if (e.movementY !== 0) {\n              _this2.events.setActiveLi(index);\n            }\n          });\n\n          if (_this2.menuSelected === index) {\n            li.className = _this2.current.collection.selectClass;\n          }\n\n          li.innerHTML = _this2.current.collection.menuItemTemplate(item);\n          fragment.appendChild(li);\n        });\n        ul.appendChild(fragment);\n      };\n\n      if (typeof this.current.collection.values === 'function') {\n        this.current.collection.values(this.current.mentionText, processValues);\n      } else {\n        processValues(this.current.collection.values);\n      }\n    }\n  }, {\n    key: \"_findLiTarget\",\n    value: function _findLiTarget(el) {\n      if (!el) return [];\n      var index = el.getAttribute('data-index');\n      return !index ? this._findLiTarget(el.parentNode) : [el, index];\n    }\n  }, {\n    key: \"showMenuForCollection\",\n    value: function showMenuForCollection(element, collectionIndex) {\n      if (element !== document.activeElement) {\n        this.placeCaretAtEnd(element);\n      }\n\n      this.current.collection = this.collection[collectionIndex || 0];\n      this.current.externalTrigger = true;\n      this.current.element = element;\n      if (element.isContentEditable) this.insertTextAtCursor(this.current.collection.trigger);else this.insertAtCaret(element, this.current.collection.trigger);\n      this.showMenuFor(element);\n    } // TODO: make sure this works for inputs/textareas\n\n  }, {\n    key: \"placeCaretAtEnd\",\n    value: function placeCaretAtEnd(el) {\n      el.focus();\n\n      if (typeof window.getSelection != \"undefined\" && typeof document.createRange != \"undefined\") {\n        var range = document.createRange();\n        range.selectNodeContents(el);\n        range.collapse(false);\n        var sel = window.getSelection();\n        sel.removeAllRanges();\n        sel.addRange(range);\n      } else if (typeof document.body.createTextRange != \"undefined\") {\n        var textRange = document.body.createTextRange();\n        textRange.moveToElementText(el);\n        textRange.collapse(false);\n        textRange.select();\n      }\n    } // for contenteditable\n\n  }, {\n    key: \"insertTextAtCursor\",\n    value: function insertTextAtCursor(text) {\n      var sel, range, html;\n      sel = window.getSelection();\n      range = sel.getRangeAt(0);\n      range.deleteContents();\n      var textNode = document.createTextNode(text);\n      range.insertNode(textNode);\n      range.selectNodeContents(textNode);\n      range.collapse(false);\n      sel.removeAllRanges();\n      sel.addRange(range);\n    } // for regular inputs\n\n  }, {\n    key: \"insertAtCaret\",\n    value: function insertAtCaret(textarea, text) {\n      var scrollPos = textarea.scrollTop;\n      var caretPos = textarea.selectionStart;\n      var front = textarea.value.substring(0, caretPos);\n      var back = textarea.value.substring(textarea.selectionEnd, textarea.value.length);\n      textarea.value = front + text + back;\n      caretPos = caretPos + text.length;\n      textarea.selectionStart = caretPos;\n      textarea.selectionEnd = caretPos;\n      textarea.focus();\n      textarea.scrollTop = scrollPos;\n    }\n  }, {\n    key: \"hideMenu\",\n    value: function hideMenu() {\n      if (this.menu) {\n        this.menu.style.cssText = 'display: none;';\n        this.isActive = false;\n        this.menuSelected = 0;\n        this.current = {};\n      }\n    }\n  }, {\n    key: \"selectItemAtIndex\",\n    value: function selectItemAtIndex(index, originalEvent) {\n      index = parseInt(index);\n      if (typeof index !== 'number' || isNaN(index)) return;\n      var item = this.current.filteredItems[index];\n      var content = this.current.collection.selectTemplate(item);\n      if (content !== null) this.replaceText(content, originalEvent, item);\n    }\n  }, {\n    key: \"replaceText\",\n    value: function replaceText(content, originalEvent, item) {\n      this.range.replaceTriggerText(content, true, true, originalEvent, item);\n    }\n  }, {\n    key: \"_append\",\n    value: function _append(collection, newValues, replace) {\n      if (typeof collection.values === 'function') {\n        throw new Error('Unable to append to values, as it is a function.');\n      } else if (!replace) {\n        collection.values = collection.values.concat(newValues);\n      } else {\n        collection.values = newValues;\n      }\n    }\n  }, {\n    key: \"append\",\n    value: function append(collectionIndex, newValues, replace) {\n      var index = parseInt(collectionIndex);\n      if (typeof index !== 'number') throw new Error('please provide an index for the collection to update.');\n      var collection = this.collection[index];\n\n      this._append(collection, newValues, replace);\n    }\n  }, {\n    key: \"appendCurrent\",\n    value: function appendCurrent(newValues, replace) {\n      if (this.isActive) {\n        this._append(this.current.collection, newValues, replace);\n      } else {\n        throw new Error('No active state. Please use append instead and pass an index.');\n      }\n    }\n  }, {\n    key: \"detach\",\n    value: function detach(el) {\n      if (!el) {\n        throw new Error('[Tribute] Must pass in a DOM node or NodeList.');\n      } // Check if it is a jQuery collection\n\n\n      if (typeof jQuery !== 'undefined' && el instanceof jQuery) {\n        el = el.get();\n      } // Is el an Array/Array-like object?\n\n\n      if (el.constructor === NodeList || el.constructor === HTMLCollection || el.constructor === Array) {\n        var length = el.length;\n\n        for (var i = 0; i < length; ++i) {\n          this._detach(el[i]);\n        }\n      } else {\n        this._detach(el);\n      }\n    }\n  }, {\n    key: \"_detach\",\n    value: function _detach(el) {\n      var _this3 = this;\n\n      this.events.unbind(el);\n\n      if (el.tributeMenu) {\n        this.menuEvents.unbind(el.tributeMenu);\n      }\n\n      setTimeout(function () {\n        el.removeAttribute('data-tribute');\n        _this3.isActive = false;\n\n        if (el.tributeMenu) {\n          el.tributeMenu.remove();\n        }\n      });\n    }\n  }], [{\n    key: \"defaultSelectTemplate\",\n    value: function defaultSelectTemplate(item) {\n      if (typeof item === 'undefined') return null;\n\n      if (this.range.isContentEditable(this.current.element)) {\n        return '<span class=\"tribute-mention\">' + (this.current.collection.trigger + item.original[this.current.collection.fillAttr]) + '</span>';\n      }\n\n      return this.current.collection.trigger + item.original[this.current.collection.fillAttr];\n    }\n  }, {\n    key: \"defaultMenuItemTemplate\",\n    value: function defaultMenuItemTemplate(matchItem) {\n      return matchItem.string;\n    }\n  }, {\n    key: \"inputTypes\",\n    value: function inputTypes() {\n      return ['TEXTAREA', 'INPUT'];\n    }\n  }]);\n\n  return Tribute;\n}();\n\nvar _default = Tribute;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n\n},{\"./TributeEvents\":2,\"./TributeMenuEvents\":3,\"./TributeRange\":4,\"./TributeSearch\":5,\"./utils\":7}],2:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports[\"default\"] = void 0;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar TributeEvents =\n/*#__PURE__*/\nfunction () {\n  function TributeEvents(tribute) {\n    _classCallCheck(this, TributeEvents);\n\n    this.tribute = tribute;\n    this.tribute.events = this;\n  }\n\n  _createClass(TributeEvents, [{\n    key: \"bind\",\n    value: function bind(element) {\n      element.boundKeydown = this.keydown.bind(element, this);\n      element.boundKeyup = this.keyup.bind(element, this);\n      element.boundInput = this.input.bind(element, this);\n      element.addEventListener('keydown', element.boundKeydown, false);\n      element.addEventListener('keyup', element.boundKeyup, false);\n      element.addEventListener('input', element.boundInput, false);\n    }\n  }, {\n    key: \"unbind\",\n    value: function unbind(element) {\n      element.removeEventListener('keydown', element.boundKeydown, false);\n      element.removeEventListener('keyup', element.boundKeyup, false);\n      element.removeEventListener('input', element.boundInput, false);\n      delete element.boundKeydown;\n      delete element.boundKeyup;\n      delete element.boundInput;\n    }\n  }, {\n    key: \"keydown\",\n    value: function keydown(instance, event) {\n      if (instance.shouldDeactivate(event)) {\n        instance.tribute.isActive = false;\n        instance.tribute.hideMenu();\n      }\n\n      var element = this;\n      instance.commandEvent = false;\n      TributeEvents.keys().forEach(function (o) {\n        if (o.key === event.keyCode) {\n          instance.commandEvent = true;\n          instance.callbacks()[o.value.toLowerCase()](event, element);\n        }\n      });\n    }\n  }, {\n    key: \"input\",\n    value: function input(instance, event) {\n      instance.inputEvent = true;\n      instance.keyup.call(this, instance, event);\n    }\n  }, {\n    key: \"click\",\n    value: function click(instance, event) {\n      var tribute = instance.tribute;\n\n      if (tribute.menu && tribute.menu.contains(event.target)) {\n        var li = event.target;\n        event.preventDefault();\n        event.stopPropagation();\n\n        while (li.nodeName.toLowerCase() !== 'li') {\n          li = li.parentNode;\n\n          if (!li || li === tribute.menu) {\n            throw new Error('cannot find the <li> container for the click');\n          }\n        }\n\n        tribute.selectItemAtIndex(li.getAttribute('data-index'), event);\n        tribute.hideMenu(); // TODO: should fire with externalTrigger and target is outside of menu\n      } else if (tribute.current.element && !tribute.current.externalTrigger) {\n        tribute.current.externalTrigger = false;\n        setTimeout(function () {\n          return tribute.hideMenu();\n        });\n      }\n    }\n  }, {\n    key: \"keyup\",\n    value: function keyup(instance, event) {\n      if (instance.inputEvent) {\n        instance.inputEvent = false;\n      }\n\n      instance.updateSelection(this);\n      if (event.keyCode === 27) return;\n\n      if (!instance.tribute.allowSpaces && instance.tribute.hasTrailingSpace) {\n        instance.tribute.hasTrailingSpace = false;\n        instance.commandEvent = true;\n        instance.callbacks()[\"space\"](event, this);\n        return;\n      }\n\n      if (!instance.tribute.isActive) {\n        if (instance.tribute.autocompleteMode) {\n          instance.callbacks().triggerChar(event, this, '');\n        } else {\n          var keyCode = instance.getKeyCode(instance, this, event);\n          if (isNaN(keyCode) || !keyCode) return;\n          var trigger = instance.tribute.triggers().find(function (trigger) {\n            return trigger.charCodeAt(0) === keyCode;\n          });\n\n          if (typeof trigger !== 'undefined') {\n            instance.callbacks().triggerChar(event, this, trigger);\n          }\n        }\n      }\n\n      if ((instance.tribute.current.trigger || instance.tribute.autocompleteMode) && instance.commandEvent === false || instance.tribute.isActive && event.keyCode === 8) {\n        instance.tribute.showMenuFor(this, true);\n      }\n    }\n  }, {\n    key: \"shouldDeactivate\",\n    value: function shouldDeactivate(event) {\n      if (!this.tribute.isActive) return false;\n\n      if (this.tribute.current.mentionText.length === 0) {\n        var eventKeyPressed = false;\n        TributeEvents.keys().forEach(function (o) {\n          if (event.keyCode === o.key) eventKeyPressed = true;\n        });\n        return !eventKeyPressed;\n      }\n\n      return false;\n    }\n  }, {\n    key: \"getKeyCode\",\n    value: function getKeyCode(instance, el, event) {\n      var _char;\n\n      var tribute = instance.tribute;\n      var info = tribute.range.getTriggerInfo(false, tribute.hasTrailingSpace, true, tribute.allowSpaces, tribute.autocompleteMode);\n\n      if (info) {\n        return info.mentionTriggerChar.charCodeAt(0);\n      } else {\n        return false;\n      }\n    }\n  }, {\n    key: \"updateSelection\",\n    value: function updateSelection(el) {\n      this.tribute.current.element = el;\n      var info = this.tribute.range.getTriggerInfo(false, this.tribute.hasTrailingSpace, true, this.tribute.allowSpaces, this.tribute.autocompleteMode);\n\n      if (info) {\n        this.tribute.current.selectedPath = info.mentionSelectedPath;\n        this.tribute.current.mentionText = info.mentionText;\n        this.tribute.current.selectedOffset = info.mentionSelectedOffset;\n      }\n    }\n  }, {\n    key: \"callbacks\",\n    value: function callbacks() {\n      var _this = this;\n\n      return {\n        triggerChar: function triggerChar(e, el, trigger) {\n          var tribute = _this.tribute;\n          tribute.current.trigger = trigger;\n          var collectionItem = tribute.collection.find(function (item) {\n            return item.trigger === trigger;\n          });\n          tribute.current.collection = collectionItem;\n          if (tribute.inputEvent) tribute.showMenuFor(el, true);\n        },\n        enter: function enter(e, el) {\n          // choose selection\n          if (_this.tribute.isActive && _this.tribute.current.filteredItems) {\n            e.preventDefault();\n            e.stopPropagation();\n            setTimeout(function () {\n              _this.tribute.selectItemAtIndex(_this.tribute.menuSelected, e);\n\n              _this.tribute.hideMenu();\n            }, 0);\n          }\n        },\n        escape: function escape(e, el) {\n          if (_this.tribute.isActive) {\n            e.preventDefault();\n            e.stopPropagation();\n            _this.tribute.isActive = false;\n\n            _this.tribute.hideMenu();\n          }\n        },\n        tab: function tab(e, el) {\n          // choose first match\n          _this.callbacks().enter(e, el);\n        },\n        space: function space(e, el) {\n          if (_this.tribute.isActive) {\n            if (_this.tribute.spaceSelectsMatch) {\n              _this.callbacks().enter(e, el);\n            } else if (!_this.tribute.allowSpaces) {\n              e.stopPropagation();\n              setTimeout(function () {\n                _this.tribute.hideMenu();\n\n                _this.tribute.isActive = false;\n              }, 0);\n            }\n          }\n        },\n        up: function up(e, el) {\n          // navigate up ul\n          if (_this.tribute.isActive && _this.tribute.current.filteredItems) {\n            e.preventDefault();\n            e.stopPropagation();\n            var count = _this.tribute.current.filteredItems.length,\n                selected = _this.tribute.menuSelected;\n\n            if (count > selected && selected > 0) {\n              _this.tribute.menuSelected--;\n\n              _this.setActiveLi();\n            } else if (selected === 0) {\n              _this.tribute.menuSelected = count - 1;\n\n              _this.setActiveLi();\n\n              _this.tribute.menu.scrollTop = _this.tribute.menu.scrollHeight;\n            }\n          }\n        },\n        down: function down(e, el) {\n          // navigate down ul\n          if (_this.tribute.isActive && _this.tribute.current.filteredItems) {\n            e.preventDefault();\n            e.stopPropagation();\n            var count = _this.tribute.current.filteredItems.length - 1,\n                selected = _this.tribute.menuSelected;\n\n            if (count > selected) {\n              _this.tribute.menuSelected++;\n\n              _this.setActiveLi();\n            } else if (count === selected) {\n              _this.tribute.menuSelected = 0;\n\n              _this.setActiveLi();\n\n              _this.tribute.menu.scrollTop = 0;\n            }\n          }\n        },\n        \"delete\": function _delete(e, el) {\n          if (_this.tribute.isActive && _this.tribute.current.mentionText.length < 1) {\n            _this.tribute.hideMenu();\n          } else if (_this.tribute.isActive) {\n            _this.tribute.showMenuFor(el);\n          }\n        }\n      };\n    }\n  }, {\n    key: \"setActiveLi\",\n    value: function setActiveLi(index) {\n      var lis = this.tribute.menu.querySelectorAll('li'),\n          length = lis.length >>> 0;\n      if (index) this.tribute.menuSelected = parseInt(index);\n\n      for (var i = 0; i < length; i++) {\n        var li = lis[i];\n\n        if (i === this.tribute.menuSelected) {\n          li.classList.add(this.tribute.current.collection.selectClass);\n          var liClientRect = li.getBoundingClientRect();\n          var menuClientRect = this.tribute.menu.getBoundingClientRect();\n\n          if (liClientRect.bottom > menuClientRect.bottom) {\n            var scrollDistance = liClientRect.bottom - menuClientRect.bottom;\n            this.tribute.menu.scrollTop += scrollDistance;\n          } else if (liClientRect.top < menuClientRect.top) {\n            var _scrollDistance = menuClientRect.top - liClientRect.top;\n\n            this.tribute.menu.scrollTop -= _scrollDistance;\n          }\n        } else {\n          li.classList.remove(this.tribute.current.collection.selectClass);\n        }\n      }\n    }\n  }, {\n    key: \"getFullHeight\",\n    value: function getFullHeight(elem, includeMargin) {\n      var height = elem.getBoundingClientRect().height;\n\n      if (includeMargin) {\n        var style = elem.currentStyle || window.getComputedStyle(elem);\n        return height + parseFloat(style.marginTop) + parseFloat(style.marginBottom);\n      }\n\n      return height;\n    }\n  }], [{\n    key: \"keys\",\n    value: function keys() {\n      return [{\n        key: 9,\n        value: 'TAB'\n      }, {\n        key: 8,\n        value: 'DELETE'\n      }, {\n        key: 13,\n        value: 'ENTER'\n      }, {\n        key: 27,\n        value: 'ESCAPE'\n      }, {\n        key: 32,\n        value: 'SPACE'\n      }, {\n        key: 38,\n        value: 'UP'\n      }, {\n        key: 40,\n        value: 'DOWN'\n      }];\n    }\n  }]);\n\n  return TributeEvents;\n}();\n\nvar _default = TributeEvents;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n\n},{}],3:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports[\"default\"] = void 0;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\nvar TributeMenuEvents =\n/*#__PURE__*/\nfunction () {\n  function TributeMenuEvents(tribute) {\n    _classCallCheck(this, TributeMenuEvents);\n\n    this.tribute = tribute;\n    this.tribute.menuEvents = this;\n    this.menu = this.tribute.menu;\n  }\n\n  _createClass(TributeMenuEvents, [{\n    key: \"bind\",\n    value: function bind(menu) {\n      var _this = this;\n\n      this.menuClickEvent = this.tribute.events.click.bind(null, this);\n      this.menuContainerScrollEvent = this.debounce(function () {\n        if (_this.tribute.isActive) {\n          _this.tribute.showMenuFor(_this.tribute.current.element, false);\n        }\n      }, 300, false);\n      this.windowResizeEvent = this.debounce(function () {\n        if (_this.tribute.isActive) {\n          _this.tribute.range.positionMenuAtCaret(true);\n        }\n      }, 300, false); // fixes IE11 issues with mousedown\n\n      this.tribute.range.getDocument().addEventListener('MSPointerDown', this.menuClickEvent, false);\n      this.tribute.range.getDocument().addEventListener('mousedown', this.menuClickEvent, false);\n      window.addEventListener('resize', this.windowResizeEvent);\n\n      if (this.menuContainer) {\n        this.menuContainer.addEventListener('scroll', this.menuContainerScrollEvent, false);\n      } else {\n        window.addEventListener('scroll', this.menuContainerScrollEvent);\n      }\n    }\n  }, {\n    key: \"unbind\",\n    value: function unbind(menu) {\n      this.tribute.range.getDocument().removeEventListener('mousedown', this.menuClickEvent, false);\n      this.tribute.range.getDocument().removeEventListener('MSPointerDown', this.menuClickEvent, false);\n      window.removeEventListener('resize', this.windowResizeEvent);\n\n      if (this.menuContainer) {\n        this.menuContainer.removeEventListener('scroll', this.menuContainerScrollEvent, false);\n      } else {\n        window.removeEventListener('scroll', this.menuContainerScrollEvent);\n      }\n    }\n  }, {\n    key: \"debounce\",\n    value: function debounce(func, wait, immediate) {\n      var _this2 = this,\n          _arguments = arguments;\n\n      var timeout;\n      return function () {\n        var context = _this2,\n            args = _arguments;\n\n        var later = function later() {\n          timeout = null;\n          if (!immediate) func.apply(context, args);\n        };\n\n        var callNow = immediate && !timeout;\n        clearTimeout(timeout);\n        timeout = setTimeout(later, wait);\n        if (callNow) func.apply(context, args);\n      };\n    }\n  }]);\n\n  return TributeMenuEvents;\n}();\n\nvar _default = TributeMenuEvents;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n\n},{}],4:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports[\"default\"] = void 0;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n// Thanks to https://github.com/jeff-collins/ment.io\nvar TributeRange =\n/*#__PURE__*/\nfunction () {\n  function TributeRange(tribute) {\n    _classCallCheck(this, TributeRange);\n\n    this.tribute = tribute;\n    this.tribute.range = this;\n  }\n\n  _createClass(TributeRange, [{\n    key: \"getDocument\",\n    value: function getDocument() {\n      var iframe;\n\n      if (this.tribute.current.collection) {\n        iframe = this.tribute.current.collection.iframe;\n      }\n\n      if (!iframe) {\n        return document;\n      }\n\n      return iframe.contentWindow.document;\n    }\n  }, {\n    key: \"positionMenuAtCaret\",\n    value: function positionMenuAtCaret(scrollTo) {\n      var _this = this;\n\n      var context = this.tribute.current,\n          coordinates;\n      var info = this.getTriggerInfo(false, this.tribute.hasTrailingSpace, true, this.tribute.allowSpaces, this.tribute.autocompleteMode);\n\n      if (typeof info !== 'undefined') {\n        if (!this.tribute.positionMenu) {\n          this.tribute.menu.style.cssText = \"display: block;\";\n          return;\n        }\n\n        if (!this.isContentEditable(context.element)) {\n          coordinates = this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element, info.mentionPosition);\n        } else {\n          coordinates = this.getContentEditableCaretPosition(info.mentionPosition);\n        }\n\n        this.tribute.menu.style.cssText = \"top: \".concat(coordinates.top, \"px;\\n                                     left: \").concat(coordinates.left, \"px;\\n                                     right: \").concat(coordinates.right, \"px;\\n                                     bottom: \").concat(coordinates.bottom, \"px;\\n                                     position: absolute;\\n                                     z-index: 10000;\\n                                     display: block;\");\n\n        if (coordinates.left === 'auto') {\n          this.tribute.menu.style.left = 'auto';\n        }\n\n        if (coordinates.top === 'auto') {\n          this.tribute.menu.style.top = 'auto';\n        }\n\n        if (scrollTo) this.scrollIntoView();\n        window.setTimeout(function () {\n          var menuDimensions = {\n            width: _this.tribute.menu.offsetWidth,\n            height: _this.tribute.menu.offsetHeight\n          };\n\n          var menuIsOffScreen = _this.isMenuOffScreen(coordinates, menuDimensions);\n\n          var menuIsOffScreenHorizontally = window.innerWidth > menuDimensions.width && (menuIsOffScreen.left || menuIsOffScreen.right);\n          var menuIsOffScreenVertically = window.innerHeight > menuDimensions.height && (menuIsOffScreen.top || menuIsOffScreen.bottom);\n\n          if (menuIsOffScreenHorizontally || menuIsOffScreenVertically) {\n            _this.tribute.menu.style.cssText = 'display: none';\n\n            _this.positionMenuAtCaret(scrollTo);\n          }\n        }, 0);\n      } else {\n        this.tribute.menu.style.cssText = 'display: none';\n      }\n    }\n  }, {\n    key: \"selectElement\",\n    value: function selectElement(targetElement, path, offset) {\n      var range;\n      var elem = targetElement;\n\n      if (path) {\n        for (var i = 0; i < path.length; i++) {\n          elem = elem.childNodes[path[i]];\n\n          if (elem === undefined) {\n            return;\n          }\n\n          while (elem.length < offset) {\n            offset -= elem.length;\n            elem = elem.nextSibling;\n          }\n\n          if (elem.childNodes.length === 0 && !elem.length) {\n            elem = elem.previousSibling;\n          }\n        }\n      }\n\n      var sel = this.getWindowSelection();\n      range = this.getDocument().createRange();\n      range.setStart(elem, offset);\n      range.setEnd(elem, offset);\n      range.collapse(true);\n\n      try {\n        sel.removeAllRanges();\n      } catch (error) {}\n\n      sel.addRange(range);\n      targetElement.focus();\n    }\n  }, {\n    key: \"replaceTriggerText\",\n    value: function replaceTriggerText(text, requireLeadingSpace, hasTrailingSpace, originalEvent, item) {\n      var info = this.getTriggerInfo(true, hasTrailingSpace, requireLeadingSpace, this.tribute.allowSpaces, this.tribute.autocompleteMode);\n\n      if (info !== undefined) {\n        var context = this.tribute.current;\n        var replaceEvent = new CustomEvent('tribute-replaced', {\n          detail: {\n            item: item,\n            instance: context,\n            context: info,\n            event: originalEvent\n          }\n        });\n\n        if (!this.isContentEditable(context.element)) {\n          var myField = this.tribute.current.element;\n          var textSuffix = typeof this.tribute.replaceTextSuffix == 'string' ? this.tribute.replaceTextSuffix : ' ';\n          text += textSuffix;\n          var startPos = info.mentionPosition;\n          var endPos = info.mentionPosition + info.mentionText.length + textSuffix.length;\n          myField.value = myField.value.substring(0, startPos) + text + myField.value.substring(endPos, myField.value.length);\n          myField.selectionStart = startPos + text.length;\n          myField.selectionEnd = startPos + text.length;\n        } else {\n          // add a space to the end of the pasted text\n          var _textSuffix = typeof this.tribute.replaceTextSuffix == 'string' ? this.tribute.replaceTextSuffix : '\\xA0';\n\n          text += _textSuffix;\n          this.pasteHtml(text, info.mentionPosition, info.mentionPosition + info.mentionText.length + !this.tribute.autocompleteMode);\n        }\n\n        context.element.dispatchEvent(replaceEvent);\n      }\n    }\n  }, {\n    key: \"pasteHtml\",\n    value: function pasteHtml(html, startPos, endPos) {\n      var range, sel;\n      sel = this.getWindowSelection();\n      range = this.getDocument().createRange();\n      range.setStart(sel.anchorNode, startPos);\n      range.setEnd(sel.anchorNode, endPos);\n      range.deleteContents();\n      var el = this.getDocument().createElement('div');\n      el.innerHTML = html;\n      var frag = this.getDocument().createDocumentFragment(),\n          node,\n          lastNode;\n\n      while (node = el.firstChild) {\n        lastNode = frag.appendChild(node);\n      }\n\n      range.insertNode(frag); // Preserve the selection\n\n      if (lastNode) {\n        range = range.cloneRange();\n        range.setStartAfter(lastNode);\n        range.collapse(true);\n        sel.removeAllRanges();\n        sel.addRange(range);\n      }\n    }\n  }, {\n    key: \"getWindowSelection\",\n    value: function getWindowSelection() {\n      if (this.tribute.collection.iframe) {\n        return this.tribute.collection.iframe.contentWindow.getSelection();\n      }\n\n      return window.getSelection();\n    }\n  }, {\n    key: \"getNodePositionInParent\",\n    value: function getNodePositionInParent(element) {\n      if (element.parentNode === null) {\n        return 0;\n      }\n\n      for (var i = 0; i < element.parentNode.childNodes.length; i++) {\n        var node = element.parentNode.childNodes[i];\n\n        if (node === element) {\n          return i;\n        }\n      }\n    }\n  }, {\n    key: \"getContentEditableSelectedPath\",\n    value: function getContentEditableSelectedPath(ctx) {\n      var sel = this.getWindowSelection();\n      var selected = sel.anchorNode;\n      var path = [];\n      var offset;\n\n      if (selected != null) {\n        var i;\n        var ce = selected.contentEditable;\n\n        while (selected !== null && ce !== 'true') {\n          i = this.getNodePositionInParent(selected);\n          path.push(i);\n          selected = selected.parentNode;\n\n          if (selected !== null) {\n            ce = selected.contentEditable;\n          }\n        }\n\n        path.reverse(); // getRangeAt may not exist, need alternative\n\n        offset = sel.getRangeAt(0).startOffset;\n        return {\n          selected: selected,\n          path: path,\n          offset: offset\n        };\n      }\n    }\n  }, {\n    key: \"getTextPrecedingCurrentSelection\",\n    value: function getTextPrecedingCurrentSelection() {\n      var context = this.tribute.current,\n          text = '';\n\n      if (!this.isContentEditable(context.element)) {\n        var textComponent = this.tribute.current.element;\n\n        if (textComponent) {\n          var startPos = textComponent.selectionStart;\n\n          if (textComponent.value && startPos >= 0) {\n            text = textComponent.value.substring(0, startPos);\n          }\n        }\n      } else {\n        var selectedElem = this.getWindowSelection().anchorNode;\n\n        if (selectedElem != null) {\n          var workingNodeContent = selectedElem.textContent;\n          var selectStartOffset = this.getWindowSelection().getRangeAt(0).startOffset;\n\n          if (workingNodeContent && selectStartOffset >= 0) {\n            text = workingNodeContent.substring(0, selectStartOffset);\n          }\n        }\n      }\n\n      return text;\n    }\n  }, {\n    key: \"getLastWordInText\",\n    value: function getLastWordInText(text) {\n      text = text.replace(/\\u00A0/g, ' '); // https://stackoverflow.com/questions/29850407/how-do-i-replace-unicode-character-u00a0-with-a-space-in-javascript\n\n      var wordsArray = text.split(' ');\n      var worldsCount = wordsArray.length - 1;\n      return wordsArray[worldsCount].trim();\n    }\n  }, {\n    key: \"getTriggerInfo\",\n    value: function getTriggerInfo(menuAlreadyActive, hasTrailingSpace, requireLeadingSpace, allowSpaces, isAutocomplete) {\n      var _this2 = this;\n\n      var ctx = this.tribute.current;\n      var selected, path, offset;\n\n      if (!this.isContentEditable(ctx.element)) {\n        selected = this.tribute.current.element;\n      } else {\n        var selectionInfo = this.getContentEditableSelectedPath(ctx);\n\n        if (selectionInfo) {\n          selected = selectionInfo.selected;\n          path = selectionInfo.path;\n          offset = selectionInfo.offset;\n        }\n      }\n\n      var effectiveRange = this.getTextPrecedingCurrentSelection();\n      var lastWordOfEffectiveRange = this.getLastWordInText(effectiveRange);\n\n      if (isAutocomplete) {\n        return {\n          mentionPosition: effectiveRange.length - lastWordOfEffectiveRange.length,\n          mentionText: lastWordOfEffectiveRange,\n          mentionSelectedElement: selected,\n          mentionSelectedPath: path,\n          mentionSelectedOffset: offset\n        };\n      }\n\n      if (effectiveRange !== undefined && effectiveRange !== null) {\n        var mostRecentTriggerCharPos = -1;\n        var triggerChar;\n        this.tribute.collection.forEach(function (config) {\n          var c = config.trigger;\n          var idx = config.requireLeadingSpace ? _this2.lastIndexWithLeadingSpace(effectiveRange, c) : effectiveRange.lastIndexOf(c);\n\n          if (idx > mostRecentTriggerCharPos) {\n            mostRecentTriggerCharPos = idx;\n            triggerChar = c;\n            requireLeadingSpace = config.requireLeadingSpace;\n          }\n        });\n\n        if (mostRecentTriggerCharPos >= 0 && (mostRecentTriggerCharPos === 0 || !requireLeadingSpace || /[\\xA0\\s]/g.test(effectiveRange.substring(mostRecentTriggerCharPos - 1, mostRecentTriggerCharPos)))) {\n          var currentTriggerSnippet = effectiveRange.substring(mostRecentTriggerCharPos + 1, effectiveRange.length);\n          triggerChar = effectiveRange.substring(mostRecentTriggerCharPos, mostRecentTriggerCharPos + 1);\n          var firstSnippetChar = currentTriggerSnippet.substring(0, 1);\n          var leadingSpace = currentTriggerSnippet.length > 0 && (firstSnippetChar === ' ' || firstSnippetChar === '\\xA0');\n\n          if (hasTrailingSpace) {\n            currentTriggerSnippet = currentTriggerSnippet.trim();\n          }\n\n          var regex = allowSpaces ? /[^\\S ]/g : /[\\xA0\\s]/g;\n          this.tribute.hasTrailingSpace = regex.test(currentTriggerSnippet);\n\n          if (!leadingSpace && (menuAlreadyActive || !regex.test(currentTriggerSnippet))) {\n            return {\n              mentionPosition: mostRecentTriggerCharPos,\n              mentionText: currentTriggerSnippet,\n              mentionSelectedElement: selected,\n              mentionSelectedPath: path,\n              mentionSelectedOffset: offset,\n              mentionTriggerChar: triggerChar\n            };\n          }\n        }\n      }\n    }\n  }, {\n    key: \"lastIndexWithLeadingSpace\",\n    value: function lastIndexWithLeadingSpace(str, _char) {\n      var reversedStr = str.split('').reverse().join('');\n      var index = -1;\n\n      for (var cidx = 0, len = str.length; cidx < len; cidx++) {\n        var firstChar = cidx === str.length - 1;\n        var leadingSpace = /\\s/.test(reversedStr[cidx + 1]);\n        var match = _char === reversedStr[cidx];\n\n        if (match && (firstChar || leadingSpace)) {\n          index = str.length - 1 - cidx;\n          break;\n        }\n      }\n\n      return index;\n    }\n  }, {\n    key: \"isContentEditable\",\n    value: function isContentEditable(element) {\n      return element.nodeName !== 'INPUT' && element.nodeName !== 'TEXTAREA';\n    }\n  }, {\n    key: \"isMenuOffScreen\",\n    value: function isMenuOffScreen(coordinates, menuDimensions) {\n      var windowWidth = window.innerWidth;\n      var windowHeight = window.innerHeight;\n      var doc = document.documentElement;\n      var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);\n      var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);\n      var menuTop = typeof coordinates.top === 'number' ? coordinates.top : windowTop + windowHeight - coordinates.bottom - menuDimensions.height;\n      var menuRight = typeof coordinates.right === 'number' ? coordinates.right : coordinates.left + menuDimensions.width;\n      var menuBottom = typeof coordinates.bottom === 'number' ? coordinates.bottom : coordinates.top + menuDimensions.height;\n      var menuLeft = typeof coordinates.left === 'number' ? coordinates.left : windowLeft + windowWidth - coordinates.right - menuDimensions.width;\n      return {\n        top: menuTop < Math.floor(windowTop),\n        right: menuRight > Math.ceil(windowLeft + windowWidth),\n        bottom: menuBottom > Math.ceil(windowTop + windowHeight),\n        left: menuLeft < Math.floor(windowLeft)\n      };\n    }\n  }, {\n    key: \"getMenuDimensions\",\n    value: function getMenuDimensions() {\n      // Width of the menu depends of its contents and position\n      // We must check what its width would be without any obstruction\n      // This way, we can achieve good positioning for flipping the menu\n      var dimensions = {\n        width: null,\n        height: null\n      };\n      this.tribute.menu.style.cssText = \"top: 0px;\\n                                 left: 0px;\\n                                 position: fixed;\\n                                 zIndex: 10000;\\n                                 display: block;\\n                                 visibility; hidden;\";\n      dimensions.width = this.tribute.menu.offsetWidth;\n      dimensions.height = this.tribute.menu.offsetHeight;\n      this.tribute.menu.style.cssText = \"display: none;\";\n      return dimensions;\n    }\n  }, {\n    key: \"getTextAreaOrInputUnderlinePosition\",\n    value: function getTextAreaOrInputUnderlinePosition(element, position, flipped) {\n      var properties = ['direction', 'boxSizing', 'width', 'height', 'overflowX', 'overflowY', 'borderTopWidth', 'borderRightWidth', 'borderBottomWidth', 'borderLeftWidth', 'paddingTop', 'paddingRight', 'paddingBottom', 'paddingLeft', 'fontStyle', 'fontVariant', 'fontWeight', 'fontStretch', 'fontSize', 'fontSizeAdjust', 'lineHeight', 'fontFamily', 'textAlign', 'textTransform', 'textIndent', 'textDecoration', 'letterSpacing', 'wordSpacing'];\n      var isFirefox = window.mozInnerScreenX !== null;\n      var div = this.getDocument().createElement('div');\n      div.id = 'input-textarea-caret-position-mirror-div';\n      this.getDocument().body.appendChild(div);\n      var style = div.style;\n      var computed = window.getComputedStyle ? getComputedStyle(element) : element.currentStyle;\n      style.whiteSpace = 'pre-wrap';\n\n      if (element.nodeName !== 'INPUT') {\n        style.wordWrap = 'break-word';\n      } // position off-screen\n\n\n      style.position = 'absolute';\n      style.visibility = 'hidden'; // transfer the element's properties to the div\n\n      properties.forEach(function (prop) {\n        style[prop] = computed[prop];\n      });\n\n      if (isFirefox) {\n        style.width = \"\".concat(parseInt(computed.width) - 2, \"px\");\n        if (element.scrollHeight > parseInt(computed.height)) style.overflowY = 'scroll';\n      } else {\n        style.overflow = 'hidden';\n      }\n\n      div.textContent = element.value.substring(0, position);\n\n      if (element.nodeName === 'INPUT') {\n        div.textContent = div.textContent.replace(/\\s/g, ' ');\n      }\n\n      var span = this.getDocument().createElement('span');\n      span.textContent = element.value.substring(position) || '.';\n      div.appendChild(span);\n      var rect = element.getBoundingClientRect();\n      var doc = document.documentElement;\n      var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);\n      var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);\n      var coordinates = {\n        top: rect.top + windowTop + span.offsetTop + parseInt(computed.borderTopWidth) + parseInt(computed.fontSize) - element.scrollTop,\n        left: rect.left + windowLeft + span.offsetLeft + parseInt(computed.borderLeftWidth)\n      };\n      var windowWidth = window.innerWidth;\n      var windowHeight = window.innerHeight;\n      var menuDimensions = this.getMenuDimensions();\n      var menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions);\n\n      if (menuIsOffScreen.right) {\n        coordinates.right = windowWidth - coordinates.left;\n        coordinates.left = 'auto';\n      }\n\n      var parentHeight = this.tribute.menuContainer ? this.tribute.menuContainer.offsetHeight : this.getDocument().body.offsetHeight;\n\n      if (menuIsOffScreen.bottom) {\n        var parentRect = this.tribute.menuContainer ? this.tribute.menuContainer.getBoundingClientRect() : this.getDocument().body.getBoundingClientRect();\n        var scrollStillAvailable = parentHeight - (windowHeight - parentRect.top);\n        coordinates.bottom = scrollStillAvailable + (windowHeight - rect.top - span.offsetTop);\n        coordinates.top = 'auto';\n      }\n\n      menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions);\n\n      if (menuIsOffScreen.left) {\n        coordinates.left = windowWidth > menuDimensions.width ? windowLeft + windowWidth - menuDimensions.width : windowLeft;\n        delete coordinates.right;\n      }\n\n      if (menuIsOffScreen.top) {\n        coordinates.top = windowHeight > menuDimensions.height ? windowTop + windowHeight - menuDimensions.height : windowTop;\n        delete coordinates.bottom;\n      }\n\n      this.getDocument().body.removeChild(div);\n      return coordinates;\n    }\n  }, {\n    key: \"getContentEditableCaretPosition\",\n    value: function getContentEditableCaretPosition(selectedNodePosition) {\n      var markerTextChar = '';\n      var markerEl,\n          markerId = \"sel_\".concat(new Date().getTime(), \"_\").concat(Math.random().toString().substr(2));\n      var range;\n      var sel = this.getWindowSelection();\n      var prevRange = sel.getRangeAt(0);\n      range = this.getDocument().createRange();\n      range.setStart(sel.anchorNode, selectedNodePosition);\n      range.setEnd(sel.anchorNode, selectedNodePosition);\n      range.collapse(false); // Create the marker element containing a single invisible character using DOM methods and insert it\n\n      markerEl = this.getDocument().createElement('span');\n      markerEl.id = markerId;\n      markerEl.appendChild(this.getDocument().createTextNode(markerTextChar));\n      range.insertNode(markerEl);\n      sel.removeAllRanges();\n      sel.addRange(prevRange);\n      var rect = markerEl.getBoundingClientRect();\n      var doc = document.documentElement;\n      var windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0);\n      var windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0);\n      var coordinates = {\n        left: rect.left + windowLeft,\n        top: rect.top + markerEl.offsetHeight + windowTop\n      };\n      var windowWidth = window.innerWidth;\n      var windowHeight = window.innerHeight;\n      var menuDimensions = this.getMenuDimensions();\n      var menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions);\n\n      if (menuIsOffScreen.right) {\n        coordinates.left = 'auto';\n        coordinates.right = windowWidth - rect.left - windowLeft;\n      }\n\n      var parentHeight = this.tribute.menuContainer ? this.tribute.menuContainer.offsetHeight : this.getDocument().body.offsetHeight;\n\n      if (menuIsOffScreen.bottom) {\n        var parentRect = this.tribute.menuContainer ? this.tribute.menuContainer.getBoundingClientRect() : this.getDocument().body.getBoundingClientRect();\n        var scrollStillAvailable = parentHeight - (windowHeight - parentRect.top);\n        coordinates.top = 'auto';\n        coordinates.bottom = scrollStillAvailable + (windowHeight - rect.top);\n      }\n\n      menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions);\n\n      if (menuIsOffScreen.left) {\n        coordinates.left = windowWidth > menuDimensions.width ? windowLeft + windowWidth - menuDimensions.width : windowLeft;\n        delete coordinates.right;\n      }\n\n      if (menuIsOffScreen.top) {\n        coordinates.top = windowHeight > menuDimensions.height ? windowTop + windowHeight - menuDimensions.height : windowTop;\n        delete coordinates.bottom;\n      }\n\n      markerEl.parentNode.removeChild(markerEl);\n      return coordinates;\n    }\n  }, {\n    key: \"scrollIntoView\",\n    value: function scrollIntoView(elem) {\n      var reasonableBuffer = 20,\n          clientRect;\n      var maxScrollDisplacement = 100;\n      var e = this.menu;\n      if (typeof e === 'undefined') return;\n\n      while (clientRect === undefined || clientRect.height === 0) {\n        clientRect = e.getBoundingClientRect();\n\n        if (clientRect.height === 0) {\n          e = e.childNodes[0];\n\n          if (e === undefined || !e.getBoundingClientRect) {\n            return;\n          }\n        }\n      }\n\n      var elemTop = clientRect.top;\n      var elemBottom = elemTop + clientRect.height;\n\n      if (elemTop < 0) {\n        window.scrollTo(0, window.pageYOffset + clientRect.top - reasonableBuffer);\n      } else if (elemBottom > window.innerHeight) {\n        var maxY = window.pageYOffset + clientRect.top - reasonableBuffer;\n\n        if (maxY - window.pageYOffset > maxScrollDisplacement) {\n          maxY = window.pageYOffset + maxScrollDisplacement;\n        }\n\n        var targetY = window.pageYOffset - (window.innerHeight - elemBottom);\n\n        if (targetY > maxY) {\n          targetY = maxY;\n        }\n\n        window.scrollTo(0, targetY);\n      }\n    }\n  }]);\n\n  return TributeRange;\n}();\n\nvar _default = TributeRange;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n\n},{}],5:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports[\"default\"] = void 0;\n\nfunction _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError(\"Cannot call a class as a function\"); } }\n\nfunction _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if (\"value\" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }\n\nfunction _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }\n\n// Thanks to https://github.com/mattyork/fuzzy\nvar TributeSearch =\n/*#__PURE__*/\nfunction () {\n  function TributeSearch(tribute) {\n    _classCallCheck(this, TributeSearch);\n\n    this.tribute = tribute;\n    this.tribute.search = this;\n  }\n\n  _createClass(TributeSearch, [{\n    key: \"simpleFilter\",\n    value: function simpleFilter(pattern, array) {\n      var _this = this;\n\n      return array.filter(function (string) {\n        return _this.test(pattern, string);\n      });\n    }\n  }, {\n    key: \"test\",\n    value: function test(pattern, string) {\n      return this.match(pattern, string) !== null;\n    }\n  }, {\n    key: \"match\",\n    value: function match(pattern, string, opts) {\n      opts = opts || {};\n      var patternIdx = 0,\n          result = [],\n          len = string.length,\n          totalScore = 0,\n          currScore = 0,\n          pre = opts.pre || '',\n          post = opts.post || '',\n          compareString = opts.caseSensitive && string || string.toLowerCase(),\n          ch,\n          compareChar;\n\n      if (opts.skip) {\n        return {\n          rendered: string,\n          score: 0\n        };\n      }\n\n      pattern = opts.caseSensitive && pattern || pattern.toLowerCase();\n      var patternCache = this.traverse(compareString, pattern, 0, 0, []);\n\n      if (!patternCache) {\n        return null;\n      }\n\n      return {\n        rendered: this.render(string, patternCache.cache, pre, post),\n        score: patternCache.score\n      };\n    }\n  }, {\n    key: \"traverse\",\n    value: function traverse(string, pattern, stringIndex, patternIndex, patternCache) {\n      // if the pattern search at end\n      if (pattern.length === patternIndex) {\n        // calculate score and copy the cache containing the indices where it's found\n        return {\n          score: this.calculateScore(patternCache),\n          cache: patternCache.slice()\n        };\n      } // if string at end or remaining pattern > remaining string\n\n\n      if (string.length === stringIndex || pattern.length - patternIndex > string.length - stringIndex) {\n        return undefined;\n      }\n\n      var c = pattern[patternIndex];\n      var index = string.indexOf(c, stringIndex);\n      var best, temp;\n\n      while (index > -1) {\n        patternCache.push(index);\n        temp = this.traverse(string, pattern, index + 1, patternIndex + 1, patternCache);\n        patternCache.pop(); // if downstream traversal failed, return best answer so far\n\n        if (!temp) {\n          return best;\n        }\n\n        if (!best || best.score < temp.score) {\n          best = temp;\n        }\n\n        index = string.indexOf(c, index + 1);\n      }\n\n      return best;\n    }\n  }, {\n    key: \"calculateScore\",\n    value: function calculateScore(patternCache) {\n      var score = 0;\n      var temp = 1;\n      patternCache.forEach(function (index, i) {\n        if (i > 0) {\n          if (patternCache[i - 1] + 1 === index) {\n            temp += temp + 1;\n          } else {\n            temp = 1;\n          }\n        }\n\n        score += temp;\n      });\n      return score;\n    }\n  }, {\n    key: \"render\",\n    value: function render(string, indices, pre, post) {\n      var rendered = string.substring(0, indices[0]);\n      indices.forEach(function (index, i) {\n        rendered += pre + string[index] + post + string.substring(index + 1, indices[i + 1] ? indices[i + 1] : string.length);\n      });\n      return rendered;\n    }\n  }, {\n    key: \"filter\",\n    value: function filter(pattern, arr, opts) {\n      var _this2 = this;\n\n      opts = opts || {};\n      return arr.reduce(function (prev, element, idx, arr) {\n        var str = element;\n\n        if (opts.extract) {\n          str = opts.extract(element);\n\n          if (!str) {\n            // take care of undefineds / nulls / etc.\n            str = '';\n          }\n        }\n\n        var rendered = _this2.match(pattern, str, opts);\n\n        if (rendered != null) {\n          prev[prev.length] = {\n            string: rendered.rendered,\n            score: rendered.score,\n            index: idx,\n            original: element\n          };\n        }\n\n        return prev;\n      }, []).sort(function (a, b) {\n        var compare = b.score - a.score;\n        if (compare) return compare;\n        return a.index - b.index;\n      });\n    }\n  }]);\n\n  return TributeSearch;\n}();\n\nvar _default = TributeSearch;\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n\n},{}],6:[function(require,module,exports){\n\"use strict\";\n\nObject.defineProperty(exports, \"__esModule\", {\n  value: true\n});\nexports[\"default\"] = void 0;\n\nvar _Tribute = _interopRequireDefault(require(\"./Tribute\"));\n\nfunction _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { \"default\": obj }; }\n\n/**\n* Tribute.js\n* Native ES6 JavaScript @mention Plugin\n**/\nvar _default = _Tribute[\"default\"];\nexports[\"default\"] = _default;\nmodule.exports = exports.default;\n\n},{\"./Tribute\":1}],7:[function(require,module,exports){\n\"use strict\";\n\nif (!Array.prototype.find) {\n  Array.prototype.find = function (predicate) {\n    if (this === null) {\n      throw new TypeError('Array.prototype.find called on null or undefined');\n    }\n\n    if (typeof predicate !== 'function') {\n      throw new TypeError('predicate must be a function');\n    }\n\n    var list = Object(this);\n    var length = list.length >>> 0;\n    var thisArg = arguments[1];\n    var value;\n\n    for (var i = 0; i < length; i++) {\n      value = list[i];\n\n      if (predicate.call(thisArg, value, i, list)) {\n        return value;\n      }\n    }\n\n    return undefined;\n  };\n}\n\nif (window && typeof window.CustomEvent !== \"function\") {\n  var CustomEvent = function CustomEvent(event, params) {\n    params = params || {\n      bubbles: false,\n      cancelable: false,\n      detail: undefined\n    };\n    var evt = document.createEvent('CustomEvent');\n    evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail);\n    return evt;\n  };\n\n  if (typeof window.Event !== 'undefined') {\n    CustomEvent.prototype = window.Event.prototype;\n  }\n\n  window.CustomEvent = CustomEvent;\n}\n\n},{}]},{},[6])(6)\n});\n//# sourceMappingURL=tribute.js.map\n"]}
1
{"version":3,"file":"tribute.min.js","sources":["../src/utils.js","../src/TributeEvents.js","../src/TributeMenuEvents.js","../src/TributeRange.js","../src/TributeSearch.js","../src/Tribute.js"],"sourcesContent":["if (!Array.prototype.find) {\n    Array.prototype.find = function(predicate) {\n        if (this === null) {\n            throw new TypeError('Array.prototype.find called on null or undefined')\n        }\n        if (typeof predicate !== 'function') {\n            throw new TypeError('predicate must be a function')\n        }\n        var list = Object(this)\n        var length = list.length >>> 0\n        var thisArg = arguments[1]\n        var value\n\n        for (var i = 0; i < length; i++) {\n            value = list[i]\n            if (predicate.call(thisArg, value, i, list)) {\n                return value\n            }\n        }\n        return undefined\n    }\n}\n\nif (window && typeof window.CustomEvent !== \"function\") {\n  function CustomEvent(event, params) {\n    params = params || {\n      bubbles: false,\n      cancelable: false,\n      detail: undefined\n    }\n    var evt = document.createEvent('CustomEvent')\n    evt.initCustomEvent(event, params.bubbles, params.cancelable, params.detail)\n    return evt\n  }\n\n if (typeof window.Event !== 'undefined') {\n   CustomEvent.prototype = window.Event.prototype\n }\n\n  window.CustomEvent = CustomEvent\n}","class TributeEvents {\n  constructor(tribute) {\n    this.tribute = tribute;\n    this.tribute.events = this;\n  }\n\n  static keys() {\n    return [\n      {\n        key: 9,\n        value: \"TAB\"\n      },\n      {\n        key: 8,\n        value: \"DELETE\"\n      },\n      {\n        key: 13,\n        value: \"ENTER\"\n      },\n      {\n        key: 27,\n        value: \"ESCAPE\"\n      },\n      {\n        key: 32,\n        value: \"SPACE\"\n      },\n      {\n        key: 38,\n        value: \"UP\"\n      },\n      {\n        key: 40,\n        value: \"DOWN\"\n      }\n    ];\n  }\n\n  bind(element) {\n    element.boundKeydown = this.keydown.bind(element, this);\n    element.boundKeyup = this.keyup.bind(element, this);\n    element.boundInput = this.input.bind(element, this);\n\n    element.addEventListener(\"keydown\", element.boundKeydown, false);\n    element.addEventListener(\"keyup\", element.boundKeyup, false);\n    element.addEventListener(\"input\", element.boundInput, false);\n  }\n\n  unbind(element) {\n    element.removeEventListener(\"keydown\", element.boundKeydown, false);\n    element.removeEventListener(\"keyup\", element.boundKeyup, false);\n    element.removeEventListener(\"input\", element.boundInput, false);\n\n    delete element.boundKeydown;\n    delete element.boundKeyup;\n    delete element.boundInput;\n  }\n\n  keydown(instance, event) {\n    if (instance.shouldDeactivate(event)) {\n      instance.tribute.isActive = false;\n      instance.tribute.hideMenu();\n    }\n\n    let element = this;\n    instance.commandEvent = false;\n\n    TributeEvents.keys().forEach(o => {\n      if (o.key === event.keyCode) {\n        instance.commandEvent = true;\n        instance.callbacks()[o.value.toLowerCase()](event, element);\n      }\n    });\n  }\n\n  input(instance, event) {\n    instance.inputEvent = true;\n    instance.keyup.call(this, instance, event);\n  }\n\n  click(instance, event) {\n    let tribute = instance.tribute;\n    if (tribute.menu && tribute.menu.contains(event.target)) {\n      let li = event.target;\n      event.preventDefault();\n      event.stopPropagation();\n      while (li.nodeName.toLowerCase() !== \"li\") {\n        li = li.parentNode;\n        if (!li || li === tribute.menu) {\n          throw new Error(\"cannot find the <li> container for the click\");\n        }\n      }\n      tribute.selectItemAtIndex(li.getAttribute(\"data-index\"), event);\n      tribute.hideMenu();\n\n      // TODO: should fire with externalTrigger and target is outside of menu\n    } else if (tribute.current.element && !tribute.current.externalTrigger) {\n      tribute.current.externalTrigger = false;\n      setTimeout(() => tribute.hideMenu());\n    }\n  }\n\n  keyup(instance, event) {\n    if (instance.inputEvent) {\n      instance.inputEvent = false;\n    }\n    instance.updateSelection(this);\n\n    if (event.keyCode === 27) return;\n\n    if (!instance.tribute.allowSpaces && instance.tribute.hasTrailingSpace) {\n      instance.tribute.hasTrailingSpace = false;\n      instance.commandEvent = true;\n      instance.callbacks()[\"space\"](event, this);\n      return;\n    }\n\n    if (!instance.tribute.isActive) {\n      if (instance.tribute.autocompleteMode) {\n        instance.callbacks().triggerChar(event, this, \"\");\n      } else {\n        let keyCode = instance.getKeyCode(instance, this, event);\n\n        if (isNaN(keyCode) || !keyCode) return;\n\n        let trigger = instance.tribute.triggers().find(trigger => {\n          return trigger.charCodeAt(0) === keyCode;\n        });\n\n        if (typeof trigger !== \"undefined\") {\n          instance.callbacks().triggerChar(event, this, trigger);\n        }\n      }\n    }\n\n    if (\n      instance.tribute.current.mentionText.length <\n      instance.tribute.current.collection.menuShowMinLength\n    ) {\n      return;\n    }\n\n    if (\n      ((instance.tribute.current.trigger ||\n        instance.tribute.autocompleteMode) &&\n        instance.commandEvent === false) ||\n      (instance.tribute.isActive && event.keyCode === 8)\n    ) {\n      instance.tribute.showMenuFor(this, true);\n    }\n  }\n\n  shouldDeactivate(event) {\n    if (!this.tribute.isActive) return false;\n\n    if (this.tribute.current.mentionText.length === 0) {\n      let eventKeyPressed = false;\n      TributeEvents.keys().forEach(o => {\n        if (event.keyCode === o.key) eventKeyPressed = true;\n      });\n\n      return !eventKeyPressed;\n    }\n\n    return false;\n  }\n\n  getKeyCode(instance, el, event) {\n    let char;\n    let tribute = instance.tribute;\n    let info = tribute.range.getTriggerInfo(\n      false,\n      tribute.hasTrailingSpace,\n      true,\n      tribute.allowSpaces,\n      tribute.autocompleteMode\n    );\n\n    if (info) {\n      return info.mentionTriggerChar.charCodeAt(0);\n    } else {\n      return false;\n    }\n  }\n\n  updateSelection(el) {\n    this.tribute.current.element = el;\n    let info = this.tribute.range.getTriggerInfo(\n      false,\n      this.tribute.hasTrailingSpace,\n      true,\n      this.tribute.allowSpaces,\n      this.tribute.autocompleteMode\n    );\n\n    if (info) {\n      this.tribute.current.selectedPath = info.mentionSelectedPath;\n      this.tribute.current.mentionText = info.mentionText;\n      this.tribute.current.selectedOffset = info.mentionSelectedOffset;\n    }\n  }\n\n  callbacks() {\n    return {\n      triggerChar: (e, el, trigger) => {\n        let tribute = this.tribute;\n        tribute.current.trigger = trigger;\n\n        let collectionItem = tribute.collection.find(item => {\n          return item.trigger === trigger;\n        });\n\n        tribute.current.collection = collectionItem;\n\n        if (\n          tribute.current.mentionText.length >=\n            tribute.current.collection.menuShowMinLength &&\n          tribute.inputEvent\n        ) {\n          tribute.showMenuFor(el, true);\n        }\n      },\n      enter: (e, el) => {\n        // choose selection\n        if (this.tribute.isActive && this.tribute.current.filteredItems) {\n          e.preventDefault();\n          e.stopPropagation();\n          setTimeout(() => {\n            this.tribute.selectItemAtIndex(this.tribute.menuSelected, e);\n            this.tribute.hideMenu();\n          }, 0);\n        }\n      },\n      escape: (e, el) => {\n        if (this.tribute.isActive) {\n          e.preventDefault();\n          e.stopPropagation();\n          this.tribute.isActive = false;\n          this.tribute.hideMenu();\n        }\n      },\n      tab: (e, el) => {\n        // choose first match\n        this.callbacks().enter(e, el);\n      },\n      space: (e, el) => {\n        if (this.tribute.isActive) {\n          if (this.tribute.spaceSelectsMatch) {\n            this.callbacks().enter(e, el);\n          } else if (!this.tribute.allowSpaces) {\n            e.stopPropagation();\n            setTimeout(() => {\n              this.tribute.hideMenu();\n              this.tribute.isActive = false;\n            }, 0);\n          }\n        }\n      },\n      up: (e, el) => {\n        // navigate up ul\n        if (this.tribute.isActive && this.tribute.current.filteredItems) {\n          e.preventDefault();\n          e.stopPropagation();\n          let count = this.tribute.current.filteredItems.length,\n            selected = this.tribute.menuSelected;\n\n          if (count > selected && selected > 0) {\n            this.tribute.menuSelected--;\n            this.setActiveLi();\n          } else if (selected === 0) {\n            this.tribute.menuSelected = count - 1;\n            this.setActiveLi();\n            this.tribute.menu.scrollTop = this.tribute.menu.scrollHeight;\n          }\n        }\n      },\n      down: (e, el) => {\n        // navigate down ul\n        if (this.tribute.isActive && this.tribute.current.filteredItems) {\n          e.preventDefault();\n          e.stopPropagation();\n          let count = this.tribute.current.filteredItems.length - 1,\n            selected = this.tribute.menuSelected;\n\n          if (count > selected) {\n            this.tribute.menuSelected++;\n            this.setActiveLi();\n          } else if (count === selected) {\n            this.tribute.menuSelected = 0;\n            this.setActiveLi();\n            this.tribute.menu.scrollTop = 0;\n          }\n        }\n      },\n      delete: (e, el) => {\n        if (\n          this.tribute.isActive &&\n          this.tribute.current.mentionText.length < 1\n        ) {\n          this.tribute.hideMenu();\n        } else if (this.tribute.isActive) {\n          this.tribute.showMenuFor(el);\n        }\n      }\n    };\n  }\n\n  setActiveLi(index) {\n    let lis = this.tribute.menu.querySelectorAll(\"li\"),\n      length = lis.length >>> 0;\n\n    if (index) this.tribute.menuSelected = parseInt(index);\n\n    for (let i = 0; i < length; i++) {\n      let li = lis[i];\n      if (i === this.tribute.menuSelected) {\n        li.classList.add(this.tribute.current.collection.selectClass);\n\n        let liClientRect = li.getBoundingClientRect();\n        let menuClientRect = this.tribute.menu.getBoundingClientRect();\n\n        if (liClientRect.bottom > menuClientRect.bottom) {\n          let scrollDistance = liClientRect.bottom - menuClientRect.bottom;\n          this.tribute.menu.scrollTop += scrollDistance;\n        } else if (liClientRect.top < menuClientRect.top) {\n          let scrollDistance = menuClientRect.top - liClientRect.top;\n          this.tribute.menu.scrollTop -= scrollDistance;\n        }\n      } else {\n        li.classList.remove(this.tribute.current.collection.selectClass);\n      }\n    }\n  }\n\n  getFullHeight(elem, includeMargin) {\n    let height = elem.getBoundingClientRect().height;\n\n    if (includeMargin) {\n      let style = elem.currentStyle || window.getComputedStyle(elem);\n      return (\n        height + parseFloat(style.marginTop) + parseFloat(style.marginBottom)\n      );\n    }\n\n    return height;\n  }\n}\n\nexport default TributeEvents;\n","class TributeMenuEvents {\n  constructor(tribute) {\n    this.tribute = tribute;\n    this.tribute.menuEvents = this;\n    this.menu = this.tribute.menu;\n  }\n\n  bind(menu) {\n    this.menuClickEvent = this.tribute.events.click.bind(null, this);\n    this.menuContainerScrollEvent = this.debounce(\n      () => {\n        if (this.tribute.isActive) {\n          this.tribute.showMenuFor(this.tribute.current.element, false);\n        }\n      },\n      300,\n      false\n    );\n    this.windowResizeEvent = this.debounce(\n      () => {\n        if (this.tribute.isActive) {\n          this.tribute.range.positionMenuAtCaret(true);\n        }\n      },\n      300,\n      false\n    );\n\n    // fixes IE11 issues with mousedown\n    this.tribute.range\n      .getDocument()\n      .addEventListener(\"MSPointerDown\", this.menuClickEvent, false);\n    this.tribute.range\n      .getDocument()\n      .addEventListener(\"mousedown\", this.menuClickEvent, false);\n    window.addEventListener(\"resize\", this.windowResizeEvent);\n\n    if (this.menuContainer) {\n      this.menuContainer.addEventListener(\n        \"scroll\",\n        this.menuContainerScrollEvent,\n        false\n      );\n    } else {\n      window.addEventListener(\"scroll\", this.menuContainerScrollEvent);\n    }\n  }\n\n  unbind(menu) {\n    this.tribute.range\n      .getDocument()\n      .removeEventListener(\"mousedown\", this.menuClickEvent, false);\n    this.tribute.range\n      .getDocument()\n      .removeEventListener(\"MSPointerDown\", this.menuClickEvent, false);\n    window.removeEventListener(\"resize\", this.windowResizeEvent);\n\n    if (this.menuContainer) {\n      this.menuContainer.removeEventListener(\n        \"scroll\",\n        this.menuContainerScrollEvent,\n        false\n      );\n    } else {\n      window.removeEventListener(\"scroll\", this.menuContainerScrollEvent);\n    }\n  }\n\n  debounce(func, wait, immediate) {\n    var timeout;\n    return () => {\n      var context = this,\n        args = arguments;\n      var later = () => {\n        timeout = null;\n        if (!immediate) func.apply(context, args);\n      };\n      var callNow = immediate && !timeout;\n      clearTimeout(timeout);\n      timeout = setTimeout(later, wait);\n      if (callNow) func.apply(context, args);\n    };\n  }\n}\n\nexport default TributeMenuEvents;\n","// Thanks to https://github.com/jeff-collins/ment.io\nimport \"./utils\";\n\nclass TributeRange {\n    constructor(tribute) {\n        this.tribute = tribute\n        this.tribute.range = this\n    }\n\n    getDocument() {\n        let iframe\n        if (this.tribute.current.collection) {\n            iframe = this.tribute.current.collection.iframe\n        }\n\n        if (!iframe) {\n            return document\n        }\n\n        return iframe.contentWindow.document\n    }\n\n    positionMenuAtCaret(scrollTo) {\n        let context = this.tribute.current,\n            coordinates\n\n        let info = this.getTriggerInfo(false, this.tribute.hasTrailingSpace, true, this.tribute.allowSpaces, this.tribute.autocompleteMode)\n\n        if (typeof info !== 'undefined') {\n\n            if(!this.tribute.positionMenu){\n                this.tribute.menu.style.cssText = `display: block;`\n                return\n            }\n\n            if (!this.isContentEditable(context.element)) {\n                coordinates = this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element,\n                    info.mentionPosition)\n            }\n            else {\n                coordinates = this.getContentEditableCaretPosition(info.mentionPosition)\n            }\n\n            this.tribute.menu.style.cssText = `top: ${coordinates.top}px;\n                                     left: ${coordinates.left}px;\n                                     right: ${coordinates.right}px;\n                                     bottom: ${coordinates.bottom}px;\n                                     position: absolute;\n                                     display: block;`\n\n            if (coordinates.left === 'auto') {\n                this.tribute.menu.style.left = 'auto'\n            }\n\n            if (coordinates.top === 'auto') {\n                this.tribute.menu.style.top = 'auto'\n            }\n\n            if (scrollTo) this.scrollIntoView()\n\n            window.setTimeout(() => {\n                let menuDimensions = {\n                   width: this.tribute.menu.offsetWidth,\n                   height: this.tribute.menu.offsetHeight\n                }\n                let menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions)\n\n                let menuIsOffScreenHorizontally = window.innerWidth > menuDimensions.width && (menuIsOffScreen.left || menuIsOffScreen.right)\n                let menuIsOffScreenVertically = window.innerHeight > menuDimensions.height && (menuIsOffScreen.top || menuIsOffScreen.bottom)\n                if (menuIsOffScreenHorizontally || menuIsOffScreenVertically) {\n                    this.tribute.menu.style.cssText = 'display: none'\n                    this.positionMenuAtCaret(scrollTo)\n                }\n            }, 0)\n\n        } else {\n            this.tribute.menu.style.cssText = 'display: none'\n        }\n    }\n\n    get menuContainerIsBody() {\n        return this.tribute.menuContainer === document.body || !this.tribute.menuContainer;\n    }\n\n\n    selectElement(targetElement, path, offset) {\n        let range\n        let elem = targetElement\n\n        if (path) {\n            for (var i = 0; i < path.length; i++) {\n                elem = elem.childNodes[path[i]]\n                if (elem === undefined) {\n                    return\n                }\n                while (elem.length < offset) {\n                    offset -= elem.length\n                    elem = elem.nextSibling\n                }\n                if (elem.childNodes.length === 0 && !elem.length) {\n                    elem = elem.previousSibling\n                }\n            }\n        }\n        let sel = this.getWindowSelection()\n\n        range = this.getDocument().createRange()\n        range.setStart(elem, offset)\n        range.setEnd(elem, offset)\n        range.collapse(true)\n\n        try {\n            sel.removeAllRanges()\n        } catch (error) {}\n\n        sel.addRange(range)\n        targetElement.focus()\n    }\n\n    replaceTriggerText(text, requireLeadingSpace, hasTrailingSpace, originalEvent, item) {\n        let info = this.getTriggerInfo(true, hasTrailingSpace, requireLeadingSpace, this.tribute.allowSpaces, this.tribute.autocompleteMode)\n\n        if (info !== undefined) {\n            let context = this.tribute.current\n            let replaceEvent = new CustomEvent('tribute-replaced', {\n                detail: {\n                    item: item,\n                    instance: context,\n                    context: info,\n                    event: originalEvent,\n                }\n            })\n\n            if (!this.isContentEditable(context.element)) {\n                let myField = this.tribute.current.element\n                let textSuffix = typeof this.tribute.replaceTextSuffix == 'string'\n                    ? this.tribute.replaceTextSuffix\n                    : ' '\n                text += textSuffix\n                let startPos = info.mentionPosition\n                let endPos = info.mentionPosition + info.mentionText.length + textSuffix.length\n                if (!this.tribute.autocompleteMode) {\n                    endPos += info.mentionTriggerChar.length - 1\n                }\n                myField.value = myField.value.substring(0, startPos) + text +\n                    myField.value.substring(endPos, myField.value.length)\n                myField.selectionStart = startPos + text.length\n                myField.selectionEnd = startPos + text.length\n            } else {\n                // add a space to the end of the pasted text\n                let textSuffix = typeof this.tribute.replaceTextSuffix == 'string'\n                    ? this.tribute.replaceTextSuffix\n                    : '\\xA0'\n                text += textSuffix\n                let endPos = info.mentionPosition + info.mentionText.length\n                if (!this.tribute.autocompleteMode) {\n                    endPos += info.mentionTriggerChar.length\n                }\n                this.pasteHtml(text, info.mentionPosition, endPos)\n            }\n\n            context.element.dispatchEvent(new CustomEvent('input', { bubbles: true }))\n            context.element.dispatchEvent(replaceEvent)\n        }\n    }\n\n    pasteHtml(html, startPos, endPos) {\n        let range, sel\n        sel = this.getWindowSelection()\n        range = this.getDocument().createRange()\n        range.setStart(sel.anchorNode, startPos)\n        range.setEnd(sel.anchorNode, endPos)\n        range.deleteContents()\n\n        let el = this.getDocument().createElement('div')\n        el.innerHTML = html\n        let frag = this.getDocument().createDocumentFragment(),\n            node, lastNode\n        while ((node = el.firstChild)) {\n            lastNode = frag.appendChild(node)\n        }\n        range.insertNode(frag)\n\n        // Preserve the selection\n        if (lastNode) {\n            range = range.cloneRange()\n            range.setStartAfter(lastNode)\n            range.collapse(true)\n            sel.removeAllRanges()\n            sel.addRange(range)\n        }\n    }\n\n    getWindowSelection() {\n        if (this.tribute.collection.iframe) {\n            return this.tribute.collection.iframe.contentWindow.getSelection()\n        }\n\n        return window.getSelection()\n    }\n\n    getNodePositionInParent(element) {\n        if (element.parentNode === null) {\n            return 0\n        }\n\n        for (var i = 0; i < element.parentNode.childNodes.length; i++) {\n            let node = element.parentNode.childNodes[i]\n\n            if (node === element) {\n                return i\n            }\n        }\n    }\n\n    getContentEditableSelectedPath(ctx) {\n        let sel = this.getWindowSelection()\n        let selected = sel.anchorNode\n        let path = []\n        let offset\n\n        if (selected != null) {\n            let i\n            let ce = selected.contentEditable\n            while (selected !== null && ce !== 'true') {\n                i = this.getNodePositionInParent(selected)\n                path.push(i)\n                selected = selected.parentNode\n                if (selected !== null) {\n                    ce = selected.contentEditable\n                }\n            }\n            path.reverse()\n\n            // getRangeAt may not exist, need alternative\n            offset = sel.getRangeAt(0).startOffset\n\n            return {\n                selected: selected,\n                path: path,\n                offset: offset\n            }\n        }\n    }\n\n    getTextPrecedingCurrentSelection() {\n        let context = this.tribute.current,\n            text = ''\n\n        if (!this.isContentEditable(context.element)) {\n            let textComponent = this.tribute.current.element;\n            if (textComponent) {\n                let startPos = textComponent.selectionStart\n                if (textComponent.value && startPos >= 0) {\n                    text = textComponent.value.substring(0, startPos)\n                }\n            }\n\n        } else {\n            let selectedElem = this.getWindowSelection().anchorNode\n\n            if (selectedElem != null) {\n                let workingNodeContent = selectedElem.textContent\n                let selectStartOffset = this.getWindowSelection().getRangeAt(0).startOffset\n\n                if (workingNodeContent && selectStartOffset >= 0) {\n                    text = workingNodeContent.substring(0, selectStartOffset)\n                }\n            }\n        }\n\n        return text\n    }\n\n    getLastWordInText(text) {\n        text = text.replace(/\\u00A0/g, ' '); // https://stackoverflow.com/questions/29850407/how-do-i-replace-unicode-character-u00a0-with-a-space-in-javascript\n        var wordsArray;\n        if (this.tribute.autocompleteSeparator) {\n            wordsArray = text.split(this.tribute.autocompleteSeparator);\n        } else {\n            wordsArray = text.split(/\\s+/);\n        }\n        var worldsCount = wordsArray.length - 1;\n        return wordsArray[worldsCount].trim();\n    }\n\n    getTriggerInfo(menuAlreadyActive, hasTrailingSpace, requireLeadingSpace, allowSpaces, isAutocomplete) {\n        let ctx = this.tribute.current\n        let selected, path, offset\n\n        if (!this.isContentEditable(ctx.element)) {\n            selected = this.tribute.current.element\n        } else {\n            let selectionInfo = this.getContentEditableSelectedPath(ctx)\n\n            if (selectionInfo) {\n                selected = selectionInfo.selected\n                path = selectionInfo.path\n                offset = selectionInfo.offset\n            }\n        }\n\n        let effectiveRange = this.getTextPrecedingCurrentSelection()\n        let lastWordOfEffectiveRange = this.getLastWordInText(effectiveRange)\n\n        if (isAutocomplete) {\n            return {\n                mentionPosition: effectiveRange.length - lastWordOfEffectiveRange.length,\n                mentionText: lastWordOfEffectiveRange,\n                mentionSelectedElement: selected,\n                mentionSelectedPath: path,\n                mentionSelectedOffset: offset\n            }\n        }\n\n        if (effectiveRange !== undefined && effectiveRange !== null) {\n            let mostRecentTriggerCharPos = -1\n            let triggerChar\n\n            this.tribute.collection.forEach(config => {\n                let c = config.trigger\n                let idx = config.requireLeadingSpace ?\n                    this.lastIndexWithLeadingSpace(effectiveRange, c) :\n                    effectiveRange.lastIndexOf(c)\n\n                if (idx > mostRecentTriggerCharPos) {\n                    mostRecentTriggerCharPos = idx\n                    triggerChar = c\n                    requireLeadingSpace = config.requireLeadingSpace\n                }\n            })\n\n            if (mostRecentTriggerCharPos >= 0 &&\n                (\n                    mostRecentTriggerCharPos === 0 ||\n                    !requireLeadingSpace ||\n                    /[\\xA0\\s]/g.test(\n                        effectiveRange.substring(\n                            mostRecentTriggerCharPos - 1,\n                            mostRecentTriggerCharPos)\n                    )\n                )\n            ) {\n                let currentTriggerSnippet = effectiveRange.substring(mostRecentTriggerCharPos + triggerChar.length,\n                    effectiveRange.length)\n\n                triggerChar = effectiveRange.substring(mostRecentTriggerCharPos, mostRecentTriggerCharPos + triggerChar.length)\n                let firstSnippetChar = currentTriggerSnippet.substring(0, 1)\n                let leadingSpace = currentTriggerSnippet.length > 0 &&\n                    (\n                        firstSnippetChar === ' ' ||\n                        firstSnippetChar === '\\xA0'\n                    )\n                if (hasTrailingSpace) {\n                    currentTriggerSnippet = currentTriggerSnippet.trim()\n                }\n\n                let regex = allowSpaces ? /[^\\S ]/g : /[\\xA0\\s]/g;\n\n                this.tribute.hasTrailingSpace = regex.test(currentTriggerSnippet);\n\n                if (!leadingSpace && (menuAlreadyActive || !(regex.test(currentTriggerSnippet)))) {\n                    return {\n                        mentionPosition: mostRecentTriggerCharPos,\n                        mentionText: currentTriggerSnippet,\n                        mentionSelectedElement: selected,\n                        mentionSelectedPath: path,\n                        mentionSelectedOffset: offset,\n                        mentionTriggerChar: triggerChar\n                    }\n                }\n            }\n        }\n    }\n\n    lastIndexWithLeadingSpace (str, trigger) {\n        let reversedStr = str.split('').reverse().join('')\n        let index = -1\n\n        for (let cidx = 0, len = str.length; cidx < len; cidx++) {\n            let firstChar = cidx === str.length - 1\n            let leadingSpace = /\\s/.test(reversedStr[cidx + 1])\n\n            let match = true\n            for (let triggerIdx = trigger.length - 1; triggerIdx >= 0; triggerIdx--) {\n              if (trigger[triggerIdx] !== reversedStr[cidx-triggerIdx]) {\n                match = false\n                break\n              }\n            }\n\n            if (match && (firstChar || leadingSpace)) {\n                index = str.length - 1 - cidx\n                break\n            }\n        }\n\n        return index\n    }\n\n    isContentEditable(element) {\n        return element.nodeName !== 'INPUT' && element.nodeName !== 'TEXTAREA'\n    }\n\n    isMenuOffScreen(coordinates, menuDimensions) {\n        let windowWidth = window.innerWidth\n        let windowHeight = window.innerHeight\n        let doc = document.documentElement\n        let windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0)\n        let windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0)\n\n        let menuTop = typeof coordinates.top === 'number' ? coordinates.top : windowTop + windowHeight - coordinates.bottom - menuDimensions.height\n        let menuRight = typeof coordinates.right === 'number' ? coordinates.right : coordinates.left + menuDimensions.width\n        let menuBottom = typeof coordinates.bottom === 'number' ? coordinates.bottom : coordinates.top + menuDimensions.height\n        let menuLeft = typeof coordinates.left === 'number' ? coordinates.left : windowLeft + windowWidth - coordinates.right - menuDimensions.width\n\n        return {\n            top: menuTop < Math.floor(windowTop),\n            right: menuRight > Math.ceil(windowLeft + windowWidth),\n            bottom: menuBottom > Math.ceil(windowTop + windowHeight),\n            left: menuLeft < Math.floor(windowLeft)\n        }\n    }\n\n    getMenuDimensions() {\n        // Width of the menu depends of its contents and position\n        // We must check what its width would be without any obstruction\n        // This way, we can achieve good positioning for flipping the menu\n        let dimensions = {\n            width: null,\n            height: null\n        }\n\n        this.tribute.menu.style.cssText = `top: 0px;\n                                 left: 0px;\n                                 position: fixed;\n                                 display: block;\n                                 visibility; hidden;`\n       dimensions.width = this.tribute.menu.offsetWidth\n       dimensions.height = this.tribute.menu.offsetHeight\n\n       this.tribute.menu.style.cssText = `display: none;`\n\n       return dimensions\n    }\n\n    getTextAreaOrInputUnderlinePosition(element, position, flipped) {\n        let properties = ['direction', 'boxSizing', 'width', 'height', 'overflowX',\n            'overflowY', 'borderTopWidth', 'borderRightWidth',\n            'borderBottomWidth', 'borderLeftWidth', 'paddingTop',\n            'paddingRight', 'paddingBottom', 'paddingLeft',\n            'fontStyle', 'fontVariant', 'fontWeight', 'fontStretch',\n            'fontSize', 'fontSizeAdjust', 'lineHeight', 'fontFamily',\n            'textAlign', 'textTransform', 'textIndent',\n            'textDecoration', 'letterSpacing', 'wordSpacing'\n        ]\n\n        let isFirefox = (window.mozInnerScreenX !== null)\n\n        let div = this.getDocument().createElement('div')\n        div.id = 'input-textarea-caret-position-mirror-div'\n        this.getDocument().body.appendChild(div)\n\n        let style = div.style\n        let computed = window.getComputedStyle ? getComputedStyle(element) : element.currentStyle\n\n        style.whiteSpace = 'pre-wrap'\n        if (element.nodeName !== 'INPUT') {\n            style.wordWrap = 'break-word'\n        }\n\n        // position off-screen\n        style.position = 'absolute'\n        style.visibility = 'hidden'\n\n        // transfer the element's properties to the div\n        properties.forEach(prop => {\n            style[prop] = computed[prop]\n        })\n\n        if (isFirefox) {\n            style.width = `${(parseInt(computed.width) - 2)}px`\n            if (element.scrollHeight > parseInt(computed.height))\n                style.overflowY = 'scroll'\n        } else {\n            style.overflow = 'hidden'\n        }\n\n        div.textContent = element.value.substring(0, position)\n\n        if (element.nodeName === 'INPUT') {\n            div.textContent = div.textContent.replace(/\\s/g, ' ')\n        }\n\n        let span = this.getDocument().createElement('span')\n        span.textContent = element.value.substring(position) || '.'\n        div.appendChild(span)\n\n        let rect = element.getBoundingClientRect()\n        let doc = document.documentElement\n        let windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0)\n        let windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0)\n\n        let top = 0;\n        let left = 0;\n        if (this.menuContainerIsBody) {\n          top = rect.top;\n          left = rect.left;\n        }\n\n        let coordinates = {\n            top: top + windowTop + span.offsetTop + parseInt(computed.borderTopWidth) + parseInt(computed.fontSize) - element.scrollTop,\n            left: left + windowLeft + span.offsetLeft + parseInt(computed.borderLeftWidth)\n        }\n\n        let windowWidth = window.innerWidth\n        let windowHeight = window.innerHeight\n\n        let menuDimensions = this.getMenuDimensions()\n        let menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions)\n\n        if (menuIsOffScreen.right) {\n            coordinates.right = windowWidth - coordinates.left\n            coordinates.left = 'auto'\n        }\n\n        let parentHeight = this.tribute.menuContainer\n            ? this.tribute.menuContainer.offsetHeight\n            : this.getDocument().body.offsetHeight\n\n        if (menuIsOffScreen.bottom) {\n            let parentRect = this.tribute.menuContainer\n                ? this.tribute.menuContainer.getBoundingClientRect()\n                : this.getDocument().body.getBoundingClientRect()\n            let scrollStillAvailable = parentHeight - (windowHeight - parentRect.top)\n\n            coordinates.bottom = scrollStillAvailable + (windowHeight - rect.top - span.offsetTop)\n            coordinates.top = 'auto'\n        }\n\n        menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions)\n        if (menuIsOffScreen.left) {\n            coordinates.left = windowWidth > menuDimensions.width\n                ? windowLeft + windowWidth - menuDimensions.width\n                : windowLeft\n            delete coordinates.right\n        }\n        if (menuIsOffScreen.top) {\n            coordinates.top = windowHeight > menuDimensions.height\n                ? windowTop + windowHeight - menuDimensions.height\n                : windowTop\n            delete coordinates.bottom\n        }\n\n        this.getDocument().body.removeChild(div)\n        return coordinates\n    }\n\n    getContentEditableCaretPosition(selectedNodePosition) {\n        let range\n        let sel = this.getWindowSelection()\n\n        range = this.getDocument().createRange()\n        range.setStart(sel.anchorNode, selectedNodePosition)\n        range.setEnd(sel.anchorNode, selectedNodePosition)\n\n        range.collapse(false)\n\n        let rect = range.getBoundingClientRect()\n        let doc = document.documentElement\n        let windowLeft = (window.pageXOffset || doc.scrollLeft) - (doc.clientLeft || 0)\n        let windowTop = (window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0)\n\n        let left = rect.left\n        let top = rect.top\n\n        let coordinates = {\n            left: left + windowLeft,\n            top: top + rect.height + windowTop\n        }\n        let windowWidth = window.innerWidth\n        let windowHeight = window.innerHeight\n\n        let menuDimensions = this.getMenuDimensions()\n        let menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions)\n\n        if (menuIsOffScreen.right) {\n            coordinates.left = 'auto'\n            coordinates.right = windowWidth - rect.left - windowLeft\n        }\n\n        let parentHeight = this.tribute.menuContainer\n            ? this.tribute.menuContainer.offsetHeight\n            : this.getDocument().body.offsetHeight\n\n        if (menuIsOffScreen.bottom) {\n            let parentRect = this.tribute.menuContainer\n                ? this.tribute.menuContainer.getBoundingClientRect()\n                : this.getDocument().body.getBoundingClientRect()\n            let scrollStillAvailable = parentHeight - (windowHeight - parentRect.top)\n\n            coordinates.top = 'auto'\n            coordinates.bottom = scrollStillAvailable + (windowHeight - rect.top)\n        }\n\n        menuIsOffScreen = this.isMenuOffScreen(coordinates, menuDimensions)\n        if (menuIsOffScreen.left) {\n            coordinates.left = windowWidth > menuDimensions.width\n                ? windowLeft + windowWidth - menuDimensions.width\n                : windowLeft\n            delete coordinates.right\n        }\n        if (menuIsOffScreen.top) {\n            coordinates.top = windowHeight > menuDimensions.height\n                ? windowTop + windowHeight - menuDimensions.height\n                : windowTop\n            delete coordinates.bottom\n        }\n\n        if (!this.menuContainerIsBody) {\n            coordinates.left = coordinates.left ? coordinates.left - this.tribute.menuContainer.offsetLeft : coordinates.left\n            coordinates.top = coordinates.top ? coordinates.top - this.tribute.menuContainer.offsetTop : coordinates.top\n        }\n\n        return coordinates\n    }\n\n    scrollIntoView(elem) {\n        let reasonableBuffer = 20,\n            clientRect\n        let maxScrollDisplacement = 100\n        let e = this.menu\n\n        if (typeof e === 'undefined') return;\n\n        while (clientRect === undefined || clientRect.height === 0) {\n            clientRect = e.getBoundingClientRect()\n\n            if (clientRect.height === 0) {\n                e = e.childNodes[0]\n                if (e === undefined || !e.getBoundingClientRect) {\n                    return\n                }\n            }\n        }\n\n        let elemTop = clientRect.top\n        let elemBottom = elemTop + clientRect.height\n\n        if (elemTop < 0) {\n            window.scrollTo(0, window.pageYOffset + clientRect.top - reasonableBuffer)\n        } else if (elemBottom > window.innerHeight) {\n            let maxY = window.pageYOffset + clientRect.top - reasonableBuffer\n\n            if (maxY - window.pageYOffset > maxScrollDisplacement) {\n                maxY = window.pageYOffset + maxScrollDisplacement\n            }\n\n            let targetY = window.pageYOffset - (window.innerHeight - elemBottom)\n\n            if (targetY > maxY) {\n                targetY = maxY\n            }\n\n            window.scrollTo(0, targetY)\n        }\n    }\n}\n\n\nexport default TributeRange;\n","// Thanks to https://github.com/mattyork/fuzzy\nclass TributeSearch {\n    constructor(tribute) {\n        this.tribute = tribute\n        this.tribute.search = this\n    }\n\n    simpleFilter(pattern, array) {\n        return array.filter(string => {\n            return this.test(pattern, string)\n        })\n    }\n\n    test(pattern, string) {\n        return this.match(pattern, string) !== null\n    }\n\n    match(pattern, string, opts) {\n        opts = opts || {}\n        let patternIdx = 0,\n            result = [],\n            len = string.length,\n            totalScore = 0,\n            currScore = 0,\n            pre = opts.pre || '',\n            post = opts.post || '',\n            compareString = opts.caseSensitive && string || string.toLowerCase(),\n            ch, compareChar\n\n        if (opts.skip) {\n            return {rendered: string, score: 0}\n        }\n\n        pattern = opts.caseSensitive && pattern || pattern.toLowerCase()\n\n        let patternCache = this.traverse(compareString, pattern, 0, 0, [])\n        if (!patternCache) {\n            return null\n        }\n        return {\n            rendered: this.render(string, patternCache.cache, pre, post),\n            score: patternCache.score\n        }\n    }\n\n    traverse(string, pattern, stringIndex, patternIndex, patternCache) {\n        if (this.tribute.autocompleteSeparator) {\n            // if the pattern search at end\n            pattern = pattern.split(this.tribute.autocompleteSeparator).splice(-1)[0];\n        }\n\n        if (pattern.length === patternIndex) {\n\n            // calculate score and copy the cache containing the indices where it's found\n            return {\n                score: this.calculateScore(patternCache),\n                cache: patternCache.slice()\n            }\n        }\n\n        // if string at end or remaining pattern > remaining string\n        if (string.length === stringIndex || pattern.length - patternIndex > string.length - stringIndex) {\n            return undefined\n        }\n\n        let c = pattern[patternIndex]\n        let index = string.indexOf(c, stringIndex)\n        let best, temp\n\n        while (index > -1) {\n            patternCache.push(index)\n            temp = this.traverse(string, pattern, index + 1, patternIndex + 1, patternCache)\n            patternCache.pop()\n\n            // if downstream traversal failed, return best answer so far\n            if (!temp) {\n                return best\n            }\n\n            if (!best || best.score < temp.score) {\n                best = temp\n            }\n\n            index = string.indexOf(c, index + 1)\n        }\n\n        return best\n    }\n\n    calculateScore(patternCache) {\n        let score = 0\n        let temp = 1\n\n        patternCache.forEach((index, i) => {\n            if (i > 0) {\n                if (patternCache[i - 1] + 1 === index) {\n                    temp += temp + 1\n                }\n                else {\n                    temp = 1\n                }\n            }\n\n            score += temp\n        })\n\n        return score\n    }\n\n    render(string, indices, pre, post) {\n        var rendered = string.substring(0, indices[0])\n\n        indices.forEach((index, i) => {\n            rendered += pre + string[index] + post +\n                string.substring(index + 1, (indices[i + 1]) ? indices[i + 1] : string.length)\n        })\n\n        return rendered\n    }\n\n    filter(pattern, arr, opts) {\n        opts = opts || {}\n        return arr\n            .reduce((prev, element, idx, arr) => {\n                let str = element\n\n                if (opts.extract) {\n                    str = opts.extract(element)\n\n                    if (!str) { // take care of undefineds / nulls / etc.\n                        str = ''\n                    }\n                }\n\n                let rendered = this.match(pattern, str, opts)\n\n                if (rendered != null) {\n                    prev[prev.length] = {\n                        string: rendered.rendered,\n                        score: rendered.score,\n                        index: idx,\n                        original: element\n                    }\n                }\n\n                return prev\n            }, [])\n\n        .sort((a, b) => {\n            let compare = b.score - a.score\n            if (compare) return compare\n            return a.index - b.index\n        })\n    }\n}\n\nexport default TributeSearch;\n","import \"./utils\";\nimport TributeEvents from \"./TributeEvents\";\nimport TributeMenuEvents from \"./TributeMenuEvents\";\nimport TributeRange from \"./TributeRange\";\nimport TributeSearch from \"./TributeSearch\";\n\nclass Tribute {\n  constructor({\n    values = null,\n    iframe = null,\n    selectClass = \"highlight\",\n    containerClass = \"tribute-container\",\n    itemClass = \"\",\n    trigger = \"@\",\n    autocompleteMode = false,\n    autocompleteSeparator = null,\n    selectTemplate = null,\n    menuItemTemplate = null,\n    lookup = \"key\",\n    fillAttr = \"value\",\n    collection = null,\n    menuContainer = null,\n    noMatchTemplate = null,\n    requireLeadingSpace = true,\n    allowSpaces = false,\n    replaceTextSuffix = null,\n    positionMenu = true,\n    spaceSelectsMatch = false,\n    searchOpts = {},\n    menuItemLimit = null,\n    menuShowMinLength = 0\n  }) {\n    this.autocompleteMode = autocompleteMode;\n    this.autocompleteSeparator = autocompleteSeparator;\n    this.menuSelected = 0;\n    this.current = {};\n    this.inputEvent = false;\n    this.isActive = false;\n    this.menuContainer = menuContainer;\n    this.allowSpaces = allowSpaces;\n    this.replaceTextSuffix = replaceTextSuffix;\n    this.positionMenu = positionMenu;\n    this.hasTrailingSpace = false;\n    this.spaceSelectsMatch = spaceSelectsMatch;\n\n    if (this.autocompleteMode) {\n      trigger = \"\";\n      allowSpaces = false;\n    }\n\n    if (values) {\n      this.collection = [\n        {\n          // symbol that starts the lookup\n          trigger: trigger,\n\n          // is it wrapped in an iframe\n          iframe: iframe,\n\n          // class applied to selected item\n          selectClass: selectClass,\n\n          // class applied to the Container\n          containerClass: containerClass,\n\n          // class applied to each item\n          itemClass: itemClass,\n\n          // function called on select that retuns the content to insert\n          selectTemplate: (\n            selectTemplate || Tribute.defaultSelectTemplate\n          ).bind(this),\n\n          // function called that returns content for an item\n          menuItemTemplate: (\n            menuItemTemplate || Tribute.defaultMenuItemTemplate\n          ).bind(this),\n\n          // function called when menu is empty, disables hiding of menu.\n          noMatchTemplate: (t => {\n            if (typeof t === \"string\") {\n              if (t.trim() === \"\") return null;\n              return t;\n            }\n            if (typeof t === \"function\") {\n              return t.bind(this);\n            }\n\n            return (\n              noMatchTemplate ||\n              function() {\n                return \"<li>No Match Found!</li>\";\n              }.bind(this)\n            );\n          })(noMatchTemplate),\n\n          // column to search against in the object\n          lookup: lookup,\n\n          // column that contains the content to insert by default\n          fillAttr: fillAttr,\n\n          // array of objects or a function returning an array of objects\n          values: values,\n\n          requireLeadingSpace: requireLeadingSpace,\n\n          searchOpts: searchOpts,\n\n          menuItemLimit: menuItemLimit,\n\n          menuShowMinLength: menuShowMinLength\n        }\n      ];\n    } else if (collection) {\n      if (this.autocompleteMode)\n        console.warn(\n          \"Tribute in autocomplete mode does not work for collections\"\n        );\n      this.collection = collection.map(item => {\n        return {\n          trigger: item.trigger || trigger,\n          iframe: item.iframe || iframe,\n          selectClass: item.selectClass || selectClass,\n          containerClass: item.containerClass || containerClass,\n          itemClass: item.itemClass || itemClass,\n          selectTemplate: (\n            item.selectTemplate || Tribute.defaultSelectTemplate\n          ).bind(this),\n          menuItemTemplate: (\n            item.menuItemTemplate || Tribute.defaultMenuItemTemplate\n          ).bind(this),\n          // function called when menu is empty, disables hiding of menu.\n          noMatchTemplate: (t => {\n            if (typeof t === \"string\") {\n              if (t.trim() === \"\") return null;\n              return t;\n            }\n            if (typeof t === \"function\") {\n              return t.bind(this);\n            }\n\n            return (\n              noMatchTemplate ||\n              function() {\n                return \"<li>No Match Found!</li>\";\n              }.bind(this)\n            );\n          })(noMatchTemplate),\n          lookup: item.lookup || lookup,\n          fillAttr: item.fillAttr || fillAttr,\n          values: item.values,\n          requireLeadingSpace: item.requireLeadingSpace,\n          searchOpts: item.searchOpts || searchOpts,\n          menuItemLimit: item.menuItemLimit || menuItemLimit,\n          menuShowMinLength: item.menuShowMinLength || menuShowMinLength\n        };\n      });\n    } else {\n      throw new Error(\"[Tribute] No collection specified.\");\n    }\n\n    new TributeRange(this);\n    new TributeEvents(this);\n    new TributeMenuEvents(this);\n    new TributeSearch(this);\n  }\n\n  get isActive() {\n    return this._isActive;\n  }\n\n  set isActive(val) {\n    if (this._isActive != val) {\n      this._isActive = val;\n      if (this.current.element) {\n        let noMatchEvent = new CustomEvent(`tribute-active-${val}`);\n        this.current.element.dispatchEvent(noMatchEvent);\n      }\n    }\n  }\n\n  static defaultSelectTemplate(item) {\n    if (typeof item === \"undefined\")\n      return `${this.current.collection.trigger}${this.current.mentionText}`;\n    if (this.range.isContentEditable(this.current.element)) {\n      return (\n        '<span class=\"tribute-mention\">' +\n        (this.current.collection.trigger +\n          item.original[this.current.collection.fillAttr]) +\n        \"</span>\"\n      );\n    }\n\n    return (\n      this.current.collection.trigger +\n      item.original[this.current.collection.fillAttr]\n    );\n  }\n\n  static defaultMenuItemTemplate(matchItem) {\n    return matchItem.string;\n  }\n\n  static inputTypes() {\n    return [\"TEXTAREA\", \"INPUT\"];\n  }\n\n  triggers() {\n    return this.collection.map(config => {\n      return config.trigger;\n    });\n  }\n\n  attach(el) {\n    if (!el) {\n      throw new Error(\"[Tribute] Must pass in a DOM node or NodeList.\");\n    }\n\n    // Check if it is a jQuery collection\n    if (typeof jQuery !== \"undefined\" && el instanceof jQuery) {\n      el = el.get();\n    }\n\n    // Is el an Array/Array-like object?\n    if (\n      el.constructor === NodeList ||\n      el.constructor === HTMLCollection ||\n      el.constructor === Array\n    ) {\n      let length = el.length;\n      for (var i = 0; i < length; ++i) {\n        this._attach(el[i]);\n      }\n    } else {\n      this._attach(el);\n    }\n  }\n\n  _attach(el) {\n    if (el.hasAttribute(\"data-tribute\")) {\n      console.warn(\"Tribute was already bound to \" + el.nodeName);\n    }\n\n    this.ensureEditable(el);\n    this.events.bind(el);\n    el.setAttribute(\"data-tribute\", true);\n  }\n\n  ensureEditable(element) {\n    if (Tribute.inputTypes().indexOf(element.nodeName) === -1) {\n      if (element.contentEditable) {\n        element.contentEditable = true;\n      } else {\n        throw new Error(\"[Tribute] Cannot bind to \" + element.nodeName);\n      }\n    }\n  }\n\n  createMenu(containerClass) {\n    let wrapper = this.range.getDocument().createElement(\"div\"),\n      ul = this.range.getDocument().createElement(\"ul\");\n    wrapper.className = containerClass;\n    wrapper.appendChild(ul);\n\n    if (this.menuContainer) {\n      return this.menuContainer.appendChild(wrapper);\n    }\n\n    return this.range.getDocument().body.appendChild(wrapper);\n  }\n\n  showMenuFor(element, scrollTo) {\n    // Only proceed if menu isn't already shown for the current element & mentionText\n    if (\n      this.isActive &&\n      this.current.element === element &&\n      this.current.mentionText === this.currentMentionTextSnapshot\n    ) {\n      return;\n    }\n    this.currentMentionTextSnapshot = this.current.mentionText;\n\n    // create the menu if it doesn't exist.\n    if (!this.menu) {\n      this.menu = this.createMenu(this.current.collection.containerClass);\n      element.tributeMenu = this.menu;\n      this.menuEvents.bind(this.menu);\n    }\n\n    this.isActive = true;\n    this.menuSelected = 0;\n\n    if (!this.current.mentionText) {\n      this.current.mentionText = \"\";\n    }\n\n    const processValues = values => {\n      // Tribute may not be active any more by the time the value callback returns\n      if (!this.isActive) {\n        return;\n      }\n\n      let items = this.search.filter(this.current.mentionText, values, {\n        pre: this.current.collection.searchOpts.pre || \"<span>\",\n        post: this.current.collection.searchOpts.post || \"</span>\",\n        skip: this.current.collection.searchOpts.skip,\n        extract: el => {\n          if (typeof this.current.collection.lookup === \"string\") {\n            return el[this.current.collection.lookup];\n          } else if (typeof this.current.collection.lookup === \"function\") {\n            return this.current.collection.lookup(el, this.current.mentionText);\n          } else {\n            throw new Error(\n              \"Invalid lookup attribute, lookup must be string or function.\"\n            );\n          }\n        }\n      });\n\n      if (this.current.collection.menuItemLimit) {\n        items = items.slice(0, this.current.collection.menuItemLimit);\n      }\n\n      this.current.filteredItems = items;\n\n      let ul = this.menu.querySelector(\"ul\");\n\n      this.range.positionMenuAtCaret(scrollTo);\n\n      if (!items.length) {\n        let noMatchEvent = new CustomEvent(\"tribute-no-match\", {\n          detail: this.menu\n        });\n        this.current.element.dispatchEvent(noMatchEvent);\n        if (\n          (typeof this.current.collection.noMatchTemplate === \"function\" &&\n            !this.current.collection.noMatchTemplate()) ||\n          !this.current.collection.noMatchTemplate\n        ) {\n          this.hideMenu();\n        } else {\n          typeof this.current.collection.noMatchTemplate === \"function\"\n            ? (ul.innerHTML = this.current.collection.noMatchTemplate())\n            : (ul.innerHTML = this.current.collection.noMatchTemplate);\n        }\n\n        return;\n      }\n\n      ul.innerHTML = \"\";\n      let fragment = this.range.getDocument().createDocumentFragment();\n\n      items.forEach((item, index) => {\n        let li = this.range.getDocument().createElement(\"li\");\n        li.setAttribute(\"data-index\", index);\n        li.className = this.current.collection.itemClass;\n        li.addEventListener(\"mousemove\", e => {\n          let [li, index] = this._findLiTarget(e.target);\n          if (e.movementY !== 0) {\n            this.events.setActiveLi(index);\n          }\n        });\n        if (this.menuSelected === index) {\n          li.classList.add(this.current.collection.selectClass);\n        }\n        li.innerHTML = this.current.collection.menuItemTemplate(item);\n        fragment.appendChild(li);\n      });\n      ul.appendChild(fragment);\n    };\n\n    if (typeof this.current.collection.values === \"function\") {\n      this.current.collection.values(this.current.mentionText, processValues);\n    } else {\n      processValues(this.current.collection.values);\n    }\n  }\n\n  _findLiTarget(el) {\n    if (!el) return [];\n    const index = el.getAttribute(\"data-index\");\n    return !index ? this._findLiTarget(el.parentNode) : [el, index];\n  }\n\n  showMenuForCollection(element, collectionIndex) {\n    if (element !== document.activeElement) {\n      this.placeCaretAtEnd(element);\n    }\n\n    this.current.collection = this.collection[collectionIndex || 0];\n    this.current.externalTrigger = true;\n    this.current.element = element;\n\n    if (element.isContentEditable)\n      this.insertTextAtCursor(this.current.collection.trigger);\n    else this.insertAtCaret(element, this.current.collection.trigger);\n\n    this.showMenuFor(element);\n  }\n\n  // TODO: make sure this works for inputs/textareas\n  placeCaretAtEnd(el) {\n    el.focus();\n    if (\n      typeof window.getSelection != \"undefined\" &&\n      typeof document.createRange != \"undefined\"\n    ) {\n      var range = document.createRange();\n      range.selectNodeContents(el);\n      range.collapse(false);\n      var sel = window.getSelection();\n      sel.removeAllRanges();\n      sel.addRange(range);\n    } else if (typeof document.body.createTextRange != \"undefined\") {\n      var textRange = document.body.createTextRange();\n      textRange.moveToElementText(el);\n      textRange.collapse(false);\n      textRange.select();\n    }\n  }\n\n  // for contenteditable\n  insertTextAtCursor(text) {\n    var sel, range, html;\n    sel = window.getSelection();\n    range = sel.getRangeAt(0);\n    range.deleteContents();\n    var textNode = document.createTextNode(text);\n    range.insertNode(textNode);\n    range.selectNodeContents(textNode);\n    range.collapse(false);\n    sel.removeAllRanges();\n    sel.addRange(range);\n  }\n\n  // for regular inputs\n  insertAtCaret(textarea, text) {\n    var scrollPos = textarea.scrollTop;\n    var caretPos = textarea.selectionStart;\n\n    var front = textarea.value.substring(0, caretPos);\n    var back = textarea.value.substring(\n      textarea.selectionEnd,\n      textarea.value.length\n    );\n    textarea.value = front + text + back;\n    caretPos = caretPos + text.length;\n    textarea.selectionStart = caretPos;\n    textarea.selectionEnd = caretPos;\n    textarea.focus();\n    textarea.scrollTop = scrollPos;\n  }\n\n  hideMenu() {\n    if (this.menu) {\n      this.menu.style.cssText = \"display: none;\";\n      this.isActive = false;\n      this.menuSelected = 0;\n      this.current = {};\n    }\n  }\n\n  selectItemAtIndex(index, originalEvent) {\n    index = parseInt(index);\n    if (typeof index !== \"number\" || isNaN(index)) return;\n    let item = this.current.filteredItems[index];\n    let content = this.current.collection.selectTemplate(item);\n    if (content !== null) this.replaceText(content, originalEvent, item);\n  }\n\n  replaceText(content, originalEvent, item) {\n    this.range.replaceTriggerText(content, true, true, originalEvent, item);\n  }\n\n  _append(collection, newValues, replace) {\n    if (typeof collection.values === \"function\") {\n      throw new Error(\"Unable to append to values, as it is a function.\");\n    } else if (!replace) {\n      collection.values = collection.values.concat(newValues);\n    } else {\n      collection.values = newValues;\n    }\n  }\n\n  append(collectionIndex, newValues, replace) {\n    let index = parseInt(collectionIndex);\n    if (typeof index !== \"number\")\n      throw new Error(\"please provide an index for the collection to update.\");\n\n    let collection = this.collection[index];\n\n    this._append(collection, newValues, replace);\n  }\n\n  appendCurrent(newValues, replace) {\n    if (this.isActive) {\n      this._append(this.current.collection, newValues, replace);\n    } else {\n      throw new Error(\n        \"No active state. Please use append instead and pass an index.\"\n      );\n    }\n  }\n\n  detach(el) {\n    if (!el) {\n      throw new Error(\"[Tribute] Must pass in a DOM node or NodeList.\");\n    }\n\n    // Check if it is a jQuery collection\n    if (typeof jQuery !== \"undefined\" && el instanceof jQuery) {\n      el = el.get();\n    }\n\n    // Is el an Array/Array-like object?\n    if (\n      el.constructor === NodeList ||\n      el.constructor === HTMLCollection ||\n      el.constructor === Array\n    ) {\n      let length = el.length;\n      for (var i = 0; i < length; ++i) {\n        this._detach(el[i]);\n      }\n    } else {\n      this._detach(el);\n    }\n  }\n\n  _detach(el) {\n    this.events.unbind(el);\n    if (el.tributeMenu) {\n      this.menuEvents.unbind(el.tributeMenu);\n    }\n\n    setTimeout(() => {\n      el.removeAttribute(\"data-tribute\");\n      this.isActive = false;\n      if (el.tributeMenu) {\n        el.tributeMenu.remove();\n      }\n    });\n  }\n}\n\nexport default Tribute;\n"],"names":["Array","prototype","find","predicate","this","TypeError","value","list","Object","length","thisArg","arguments","i","call","window","CustomEvent","event","params","bubbles","cancelable","detail","undefined","evt","document","createEvent","initCustomEvent","Event","TributeEvents","tribute","events","element","boundKeydown","keydown","bind","boundKeyup","keyup","boundInput","input","addEventListener","removeEventListener","instance","shouldDeactivate","isActive","hideMenu","commandEvent","keys","forEach","o","key","keyCode","callbacks","toLowerCase","inputEvent","menu","contains","target","li","preventDefault","stopPropagation","nodeName","parentNode","Error","selectItemAtIndex","getAttribute","current","externalTrigger","setTimeout","updateSelection","allowSpaces","hasTrailingSpace","autocompleteMode","triggerChar","getKeyCode","isNaN","trigger","triggers","charCodeAt","mentionText","collection","menuShowMinLength","showMenuFor","eventKeyPressed","el","info","range","getTriggerInfo","mentionTriggerChar","selectedPath","mentionSelectedPath","selectedOffset","mentionSelectedOffset","e","_this","collectionItem","item","enter","filteredItems","menuSelected","escape","tab","space","spaceSelectsMatch","up","count","selected","setActiveLi","scrollTop","scrollHeight","down","index","lis","querySelectorAll","parseInt","classList","add","selectClass","liClientRect","getBoundingClientRect","menuClientRect","bottom","scrollDistance","top","remove","elem","includeMargin","height","style","currentStyle","getComputedStyle","parseFloat","marginTop","marginBottom","TributeMenuEvents","menuEvents","menuClickEvent","click","menuContainerScrollEvent","debounce","windowResizeEvent","positionMenuAtCaret","getDocument","menuContainer","func","wait","immediate","timeout","context","_this2","args","callNow","clearTimeout","apply","TributeRange","iframe","contentWindow","scrollTo","coordinates","positionMenu","cssText","isContentEditable","getContentEditableCaretPosition","mentionPosition","getTextAreaOrInputUnderlinePosition","left","right","scrollIntoView","menuDimensions","width","offsetWidth","offsetHeight","menuIsOffScreen","isMenuOffScreen","menuIsOffScreenHorizontally","innerWidth","menuIsOffScreenVertically","innerHeight","targetElement","path","offset","childNodes","nextSibling","previousSibling","sel","getWindowSelection","createRange","setStart","setEnd","collapse","removeAllRanges","error","addRange","focus","text","requireLeadingSpace","originalEvent","replaceEvent","replaceTextSuffix","endPos","pasteHtml","myField","textSuffix","startPos","substring","selectionStart","selectionEnd","dispatchEvent","html","anchorNode","deleteContents","createElement","innerHTML","node","lastNode","frag","createDocumentFragment","firstChild","appendChild","insertNode","cloneRange","setStartAfter","getSelection","ctx","ce","contentEditable","getNodePositionInParent","push","reverse","getRangeAt","startOffset","selectedElem","workingNodeContent","textContent","selectStartOffset","textComponent","wordsArray","replace","autocompleteSeparator","split","trim","menuAlreadyActive","isAutocomplete","selectionInfo","getContentEditableSelectedPath","effectiveRange","getTextPrecedingCurrentSelection","lastWordOfEffectiveRange","getLastWordInText","mentionSelectedElement","mostRecentTriggerCharPos","config","c","idx","lastIndexWithLeadingSpace","lastIndexOf","test","currentTriggerSnippet","firstSnippetChar","leadingSpace","regex","str","reversedStr","join","cidx","len","firstChar","match","triggerIdx","windowWidth","windowHeight","doc","documentElement","windowLeft","pageXOffset","scrollLeft","clientLeft","windowTop","pageYOffset","clientTop","menuTop","menuRight","menuBottom","menuLeft","Math","floor","ceil","dimensions","position","flipped","isFirefox","mozInnerScreenX","div","id","body","computed","whiteSpace","wordWrap","visibility","prop","overflowY","overflow","span","rect","menuContainerIsBody","offsetTop","borderTopWidth","fontSize","offsetLeft","borderLeftWidth","getMenuDimensions","parentHeight","scrollStillAvailable","removeChild","selectedNodePosition","clientRect","elemTop","elemBottom","maxY","targetY","TributeSearch","search","pattern","array","filter","string","opts","pre","post","compareString","caseSensitive","skip","rendered","score","patternCache","traverse","render","cache","stringIndex","patternIndex","splice","calculateScore","slice","best","temp","indexOf","pop","indices","arr","reduce","prev","extract","original","sort","a","b","compare","t","values","containerClass","itemClass","selectTemplate","menuItemTemplate","lookup","fillAttr","noMatchTemplate","searchOpts","menuItemLimit","Tribute","defaultSelectTemplate","defaultMenuItemTemplate","console","warn","map","jQuery","get","constructor","NodeList","HTMLCollection","_attach","hasAttribute","ensureEditable","setAttribute","inputTypes","wrapper","ul","className","currentMentionTextSnapshot","createMenu","tributeMenu","processValues","items","querySelector","noMatchEvent","fragment","_findLiTarget","movementY","collectionIndex","activeElement","placeCaretAtEnd","insertTextAtCursor","insertAtCaret","selectNodeContents","createTextRange","textRange","moveToElementText","select","textNode","createTextNode","textarea","scrollPos","caretPos","front","back","content","replaceText","replaceTriggerText","newValues","concat","_append","_detach","unbind","removeAttribute","_this3","_isActive","val","matchItem"],"mappings":"k8CAuBA,GAvBKA,MAAMC,UAAUC,OACjBF,MAAMC,UAAUC,KAAO,SAASC,MACf,OAATC,WACM,IAAIC,UAAU,uDAEC,mBAAdF,QACD,IAAIE,UAAU,wCAKpBC,EAHAC,EAAOC,OAAOJ,MACdK,EAASF,EAAKE,SAAW,EACzBC,EAAUC,UAAU,GAGfC,EAAI,EAAGA,EAAIH,EAAQG,OACxBN,EAAQC,EAAKK,GACTT,EAAUU,KAAKH,EAASJ,EAAOM,EAAGL,UAC3BD,IAOnBQ,QAAwC,mBAAvBA,OAAOC,YAA4B,KAC7CA,EAAT,SAAqBC,EAAOC,GAC1BA,EAASA,GAAU,CACjBC,SAAS,EACTC,YAAY,EACZC,YAAQC,OAENC,EAAMC,SAASC,YAAY,sBAC/BF,EAAIG,gBAAgBT,EAAOC,EAAOC,QAASD,EAAOE,WAAYF,EAAOG,QAC9DE,QAGkB,IAAjBR,OAAOY,QAChBX,EAAYd,UAAYa,OAAOY,MAAMzB,WAGtCa,OAAOC,YAAcA,MCvCjBY,wBACQC,kBACLA,QAAUA,OACVA,QAA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WAAW+B,QAE5BoT,QAAQnV,EAAYiV,EAAWpL,yCAGxBoL,EAAWpL,OACnBvO,KAAKsC,eAGD,IAAImB,MACR,sEAHGoW,QAAQ7Z,KAAK4D,QAAQc,WAAYiV,EAAWpL,kCAQ9CzJ,OACAA,QACG,IAAIrB,MAAM,qDAII,oBAAXuT,QAA0BlS,aAAckS,SACjDlS,EAAKA,EAAGmS,OAKRnS,EAAGoS,cAAgBC,UACnBrS,EAAGoS,cAAgBE,gBACnBtS,EAAGoS,cAAgBtX,cAEfS,EAASyE,EAAGzE,OACPG,EAAI,EAAGA,EAAIH,IAAUG,OACvBsZ,QAAQhV,EAAGtE,cAGbsZ,QAAQhV,mCAITA,mBACDrD,OAAOsY,OAAOjV,GACfA,EAAGiT,kBACA9P,WAAW8R,OAAOjV,EAAGiT,aAG5BjU,YAAW,WACTgB,EAAGkV,gBAAgB,gBACnBC,EAAK3X,UAAW,EACZwC,EAAGiT,aACLjT,EAAGiT,YAAYzQ,oDAnXZtH,KAAKka,wBAGDC,MACPna,KAAKka,WAAaC,SACfD,UAAYC,EACbna,KAAK4D,QAAQlC,SAAS,KACpByW,EAAe,IAAIxX,qCAA8BwZ,SAChDvW,QAAQlC,QAAQ+K,cAAc0L,oDAKZzS,eACP,IAATA,YACC1F,KAAK4D,QAAQc,WAAWJ,gBAAUtE,KAAK4D,QAAQa,aACvDzE,KAAKgF,MAAM2E,kBAAkB3J,KAAK4D,QAAQlC,SAE1C,kCACC1B,KAAK4D,QAAQc,WAAWJ,QACvBoB,EAAKgQ,SAAS1V,KAAK4D,QAAQc,WAAW4R,WACxC,UAKFtW,KAAK4D,QAAQc,WAAWJ,QACxBoB,EAAKgQ,SAAS1V,KAAK4D,QAAQc,WAAW4R,0DAIX8D,UACtBA,EAAUrG,kDAIV,CAAC,WAAY"}
public/stylesheets/tribute-3.7.3.css
1
.tribute-container {
2
    position: absolute;
3
    top: 0;
4
    left: 0;
5
    height: auto;
6
    max-height: 300px;
7
    max-width: 500px;
8
    overflow: auto;
9
    display: block;
10
    z-index: 999999; }
11
.tribute-container ul {
12
    margin: 0;
13
    margin-top: 2px;
14
    padding: 0;
15
    list-style: none;
16
    background: #efefef; }
17
.tribute-container li {
18
    padding: 5px 5px;
19
    cursor: pointer; }
20
.tribute-container li.highlight {
21
    background: #ddd; }
22
.tribute-container li span {
23
    font-weight: bold; }
24
.tribute-container li.no-match {
25
    cursor: default; }
26
.tribute-container .menu-highlighted {
27
    font-weight: bold; }
public/stylesheets/tribute-5.1.3.css
1
.tribute-container {
2
  position: absolute;
3
  top: 0;
4
  left: 0;
5
  height: auto;
6
  max-height: 300px;
7
  max-width: 500px;
8
  overflow: auto;
9
  display: block;
10
  z-index: 999999;
11
}
12
.tribute-container ul {
13
  margin: 0;
14
  margin-top: 2px;
15
  padding: 0;
16
  list-style: none;
17
  background: #efefef;
18
}
19
.tribute-container li {
20
  padding: 5px 5px;
21
  cursor: pointer;
22
}
23
.tribute-container li.highlight {
24
  background: #ddd;
25
}
26
.tribute-container li span {
27
  font-weight: bold;
28
}
29
.tribute-container li.no-match {
30
  cursor: default;
31
}
32
.tribute-container .menu-highlighted {
33
  font-weight: bold;
34
}
    (1-1/1)