(self.webpackChunk=self.webpackChunk||[]).push([["tribute"],{"./node_modules/tributejs/dist/tribute.min.js":function(V){(function(k,M){V.exports=M()})(this,function(){"use strict";function k(a,t){if(!(a instanceof t))throw new TypeError("Cannot call a class as a function")}function M(a,t){for(var e=0;e>>0,i=arguments[1],r=0;r container for the click");n.selectItemAtIndex(i.getAttribute("data-index"),e),n.hideMenu()}else n.current.element&&!n.current.externalTrigger&&(n.current.externalTrigger=!1,setTimeout(function(){return n.hideMenu()}))}},{key:"keyup",value:function(t,e){if(t.inputEvent&&(t.inputEvent=!1),t.updateSelection(this),e.keyCode!==27){if(!t.tribute.allowSpaces&&t.tribute.hasTrailingSpace)return t.tribute.hasTrailingSpace=!1,t.commandEvent=!0,void t.callbacks().space(e,this);if(!t.tribute.isActive)if(t.tribute.autocompleteMode)t.callbacks().triggerChar(e,this,"");else{var n=t.getKeyCode(t,this,e);if(isNaN(n)||!n)return;var i=t.tribute.triggers().find(function(r){return r.charCodeAt(0)===n});i!==void 0&&t.callbacks().triggerChar(e,this,i)}t.tribute.current.mentionText.length=r.current.collection.menuShowMinLength&&r.inputEvent&&r.showMenuFor(n,!0)},enter:function(e,n){t.tribute.isActive&&t.tribute.current.filteredItems&&(e.preventDefault(),e.stopPropagation(),setTimeout(function(){t.tribute.selectItemAtIndex(t.tribute.menuSelected,e),t.tribute.hideMenu()},0))},escape:function(e,n){t.tribute.isActive&&(e.preventDefault(),e.stopPropagation(),t.tribute.isActive=!1,t.tribute.hideMenu())},tab:function(e,n){t.callbacks().enter(e,n)},space:function(e,n){t.tribute.isActive&&(t.tribute.spaceSelectsMatch?t.callbacks().enter(e,n):t.tribute.allowSpaces||(e.stopPropagation(),setTimeout(function(){t.tribute.hideMenu(),t.tribute.isActive=!1},0)))},up:function(e,n){if(t.tribute.isActive&&t.tribute.current.filteredItems){e.preventDefault(),e.stopPropagation();var i=t.tribute.current.filteredItems.length,r=t.tribute.menuSelected;i>r&&r>0?(t.tribute.menuSelected--,t.setActiveLi()):r===0&&(t.tribute.menuSelected=i-1,t.setActiveLi(),t.tribute.menu.scrollTop=t.tribute.menu.scrollHeight)}},down:function(e,n){if(t.tribute.isActive&&t.tribute.current.filteredItems){e.preventDefault(),e.stopPropagation();var i=t.tribute.current.filteredItems.length-1,r=t.tribute.menuSelected;i>r?(t.tribute.menuSelected++,t.setActiveLi()):i===r&&(t.tribute.menuSelected=0,t.setActiveLi(),t.tribute.menu.scrollTop=0)}},delete:function(e,n){t.tribute.isActive&&t.tribute.current.mentionText.length<1?t.tribute.hideMenu():t.tribute.isActive&&t.tribute.showMenuFor(n)}}}},{key:"setActiveLi",value:function(t){var e=this.tribute.menu.querySelectorAll("li"),n=e.length>>>0;t&&(this.tribute.menuSelected=parseInt(t));for(var i=0;iu.bottom){var l=o.bottom-u.bottom;this.tribute.menu.scrollTop+=l}else if(o.topo.width&&(u.left||u.right),s=window.innerHeight>o.height&&(u.top||u.bottom);(l||s)&&(n.tribute.menu.style.cssText="display: none",n.positionMenuAtCaret(t))},0)}else this.tribute.menu.style.cssText="display: none"}},{key:"selectElement",value:function(t,e,n){var i,r=t;if(e)for(var o=0;o=0&&(e=i.substring(0,r))}}else{var o=this.tribute.current.element;if(o){var u=o.selectionStart;o.value&&u>=0&&(e=o.value.substring(0,u))}}return e}},{key:"getLastWordInText",value:function(t){var e=(t=t.replace(/\u00A0/g," ")).split(/\s+/);return e[e.length-1].trim()}},{key:"getTriggerInfo",value:function(t,e,n,i,r){var o,u,l,s=this,c=this.tribute.current;if(this.isContentEditable(c.element)){var f=this.getContentEditableSelectedPath(c);f&&(o=f.selected,u=f.path,l=f.offset)}else o=this.tribute.current.element;var h=this.getTextPrecedingCurrentSelection(),m=this.getLastWordInText(h);if(r)return{mentionPosition:h.length-m.length,mentionText:m,mentionSelectedElement:o,mentionSelectedPath:u,mentionSelectedOffset:l};if(h!=null){var v,d=-1;if(this.tribute.collection.forEach(function(T){var S=T.trigger,C=T.requireLeadingSpace?s.lastIndexWithLeadingSpace(h,S):h.lastIndexOf(S);C>d&&(d=C,v=S,n=T.requireLeadingSpace)}),d>=0&&(d===0||!n||/[\xA0\s]/g.test(h.substring(d-1,d)))){var p=h.substring(d+v.length,h.length);v=h.substring(d,d+v.length);var y=p.substring(0,1),b=p.length>0&&(y===" "||y==="\xA0");e&&(p=p.trim());var w=i?/[^\S ]/g:/[\xA0\s]/g;if(this.tribute.hasTrailingSpace=w.test(p),!b&&(t||!w.test(p)))return{mentionPosition:d,mentionText:p,mentionSelectedElement:o,mentionSelectedPath:u,mentionSelectedOffset:l,mentionTriggerChar:v}}}}},{key:"lastIndexWithLeadingSpace",value:function(t,e){for(var n=t.split("").reverse().join(""),i=-1,r=0,o=t.length;r=0;c--)if(e[c]!==n[r-c]){s=!1;break}if(s&&(u||l)){i=t.length-1-r;break}}return i}},{key:"isContentEditable",value:function(t){return t.nodeName!=="INPUT"&&t.nodeName!=="TEXTAREA"}},{key:"isMenuOffScreen",value:function(t,e){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=typeof t.top=="number"?t.top:u+i-t.bottom-e.height,s=typeof t.right=="number"?t.right:t.left+e.width,c=typeof t.bottom=="number"?t.bottom:t.top+e.height,f=typeof t.left=="number"?t.left:o+n-t.right-e.width;return{top:lMath.ceil(o+n),bottom:c>Math.ceil(u+i),left:fparseInt(u.height)&&(o.overflowY="scroll")):o.overflow="hidden",r.textContent=t.value.substring(0,e),t.nodeName==="INPUT"&&(r.textContent=r.textContent.replace(/\s/g,"\xA0"));var l=this.getDocument().createElement("span");l.textContent=t.value.substring(e)||".",r.appendChild(l);var s=t.getBoundingClientRect(),c=document.documentElement,f=(window.pageXOffset||c.scrollLeft)-(c.clientLeft||0),h=(window.pageYOffset||c.scrollTop)-(c.clientTop||0),m=0,v=0;this.menuContainerIsBody&&(m=s.top,v=s.left);var d={top:m+h+l.offsetTop+parseInt(u.borderTopWidth)+parseInt(u.fontSize)-t.scrollTop,left:v+f+l.offsetLeft+parseInt(u.borderLeftWidth)},p=window.innerWidth,y=window.innerHeight,b=this.getMenuDimensions(),w=this.isMenuOffScreen(d,b);w.right&&(d.right=p-d.left,d.left="auto");var T=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(w.bottom){var S=T-(y-(this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect()).top);d.bottom=S+(y-s.top-l.offsetTop),d.top="auto"}return(w=this.isMenuOffScreen(d,b)).left&&(d.left=p>b.width?f+p-b.width:f,delete d.right),w.top&&(d.top=y>b.height?h+y-b.height:h,delete d.bottom),this.getDocument().body.removeChild(r),d}},{key:"getContentEditableCaretPosition",value:function(t){var e,n=this.getWindowSelection();(e=this.getDocument().createRange()).setStart(n.anchorNode,t),e.setEnd(n.anchorNode,t),e.collapse(!1);var i=e.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},s=window.innerWidth,c=window.innerHeight,f=this.getMenuDimensions(),h=this.isMenuOffScreen(l,f);h.right&&(l.left="auto",l.right=s-i.left-o);var m=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(h.bottom){var v=m-(c-(this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect()).top);l.top="auto",l.bottom=v+(c-i.top)}return(h=this.isMenuOffScreen(l,f)).left&&(l.left=s>f.width?o+s-f.width:o,delete l.right),h.top&&(l.top=c>f.height?u+c-f.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(t){var e,n=this.menu;if(n!==void 0){for(;e===void 0||e.height===0;)if((e=n.getBoundingClientRect()).height===0&&((n=n.childNodes[0])===void 0||!n.getBoundingClientRect))return;var i=e.top,r=i+e.height;if(i<0)window.scrollTo(0,window.pageYOffset+e.top-20);else if(r>window.innerHeight){var o=window.pageYOffset+e.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}}]),a}(),tt=function(){function a(t){k(this,a),this.tribute=t,this.tribute.search=this}return E(a,[{key:"simpleFilter",value:function(t,e){var n=this;return e.filter(function(i){return n.test(t,i)})}},{key:"test",value:function(t,e){return this.match(t,e)!==null}},{key:"match",value:function(t,e,n){n=n||{},e.length;var i=n.pre||"",r=n.post||"",o=n.caseSensitive&&e||e.toLowerCase();if(n.skip)return{rendered:e,score:0};t=n.caseSensitive&&t||t.toLowerCase();var u=this.traverse(o,t,0,0,[]);return u?{rendered:this.render(e,u.cache,i,r),score:u.score}:null}},{key:"traverse",value:function(t,e,n,i,r){if(e.length===i)return{score:this.calculateScore(r),cache:r.slice()};if(!(t.length===n||e.length-i>t.length-n)){for(var o,u,l=e[i],s=t.indexOf(l,n);s>-1;){if(r.push(s),u=this.traverse(t,e,s+1,i+1,r),r.pop(),!u)return o;(!o||o.score0&&(t[r-1]+1===i?n+=n+1:n=1),e+=n}),e}},{key:"render",value:function(t,e,n,i){var r=t.substring(0,e[0]);return e.forEach(function(o,u){r+=n+t[o]+i+t.substring(o+1,e[u+1]?e[u+1]:t.length)}),r}},{key:"filter",value:function(t,e,n){var i=this;return n=n||{},e.reduce(function(r,o,u,l){var s=o;n.extract&&((s=n.extract(o))||(s=""));var c=i.match(t,s,n);return c!=null&&(r[r.length]={string:c.rendered,score:c.score,index:u,original:o}),r},[]).sort(function(r,o){var u=o.score-r.score;return u||r.index-o.index})}}]),a}();return function(){function a(t){var e,n=this,i=t.values,r=i===void 0?null:i,o=t.iframe,u=o===void 0?null:o,l=t.selectClass,s=l===void 0?"highlight":l,c=t.containerClass,f=c===void 0?"tribute-container":c,h=t.itemClass,m=h===void 0?"":h,v=t.trigger,d=v===void 0?"@":v,p=t.autocompleteMode,y=p!==void 0&&p,b=t.selectTemplate,w=b===void 0?null:b,T=t.menuItemTemplate,S=T===void 0?null:T,C=t.lookup,I=C===void 0?"key":C,N=t.fillAttr,O=N===void 0?"value":N,D=t.collection,P=D===void 0?null:D,R=t.menuContainer,et=R===void 0?null:R,W=t.noMatchTemplate,A=W===void 0?null:W,H=t.requireLeadingSpace,nt=H===void 0||H,B=t.allowSpaces,F=B!==void 0&&B,_=t.replaceTextSuffix,it=_===void 0?null:_,j=t.positionMenu,rt=j===void 0||j,Y=t.spaceSelectsMatch,ot=Y!==void 0&&Y,z=t.searchOpts,K=z===void 0?{}:z,q=t.menuItemLimit,U=q===void 0?null:q,X=t.menuShowMinLength,Q=X===void 0?0:X;if(k(this,a),this.autocompleteMode=y,this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=et,this.allowSpaces=F,this.replaceTextSuffix=it,this.positionMenu=rt,this.hasTrailingSpace=!1,this.spaceSelectsMatch=ot,this.autocompleteMode&&(d="",F=!1),r)this.collection=[{trigger:d,iframe:u,selectClass:s,containerClass:f,itemClass:m,selectTemplate:(w||a.defaultSelectTemplate).bind(this),menuItemTemplate:(S||a.defaultMenuItemTemplate).bind(this),noMatchTemplate:(e=A,typeof e=="string"?e.trim()===""?null:e:typeof e=="function"?e.bind(n):A||function(){return"
  • No Match Found!
  • "}.bind(n)),lookup:I,fillAttr:O,values:r,requireLeadingSpace:nt,searchOpts:K,menuItemLimit:U,menuShowMinLength:Q}];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(g){return{trigger:g.trigger||d,iframe:g.iframe||u,selectClass:g.selectClass||s,containerClass:g.containerClass||f,itemClass:g.itemClass||m,selectTemplate:(g.selectTemplate||a.defaultSelectTemplate).bind(n),menuItemTemplate:(g.menuItemTemplate||a.defaultMenuItemTemplate).bind(n),noMatchTemplate:function(x){return typeof x=="string"?x.trim()===""?null:x:typeof x=="function"?x.bind(n):A||function(){return"
  • No Match Found!
  • "}.bind(n)}(A),lookup:g.lookup||I,fillAttr:g.fillAttr||O,values:g.values,requireLeadingSpace:g.requireLeadingSpace,searchOpts:g.searchOpts||K,menuItemLimit:g.menuItemLimit||U,menuShowMinLength:g.menuShowMinLength||Q}})}new $(this),new J(this),new Z(this),new tt(this)}return E(a,[{key:"triggers",value:function(){return this.collection.map(function(t){return t.trigger})}},{key:"attach",value:function(t){if(!t)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if(typeof jQuery<"u"&&t instanceof jQuery&&(t=t.get()),t.constructor===NodeList||t.constructor===HTMLCollection||t.constructor===Array)for(var e=t.length,n=0;n",post:n.current.collection.searchOpts.post||"",skip:n.current.collection.searchOpts.skip,extract:function(c){if(typeof n.current.collection.lookup=="string")return c[n.current.collection.lookup];if(typeof n.current.collection.lookup=="function")return n.current.collection.lookup(c,n.current.mentionText);throw new Error("Invalid lookup attribute, lookup must be string or function.")}});n.current.collection.menuItemLimit&&(o=o.slice(0,n.current.collection.menuItemLimit)),n.current.filteredItems=o;var u=n.menu.querySelector("ul");if(n.range.positionMenuAtCaret(e),!o.length){var l=new CustomEvent("tribute-no-match",{detail:n.menu});return n.current.element.dispatchEvent(l),void(typeof n.current.collection.noMatchTemplate=="function"&&!n.current.collection.noMatchTemplate()||!n.current.collection.noMatchTemplate?n.hideMenu():typeof n.current.collection.noMatchTemplate=="function"?u.innerHTML=n.current.collection.noMatchTemplate():u.innerHTML=n.current.collection.noMatchTemplate)}u.innerHTML="";var s=n.range.getDocument().createDocumentFragment();o.forEach(function(c,f){var h=n.range.getDocument().createElement("li");h.setAttribute("data-index",f),h.className=n.current.collection.itemClass,h.addEventListener("mousemove",function(m){var v=G(n._findLiTarget(m.target),2),d=(v[0],v[1]);m.movementY!==0&&n.events.setActiveLi(d)}),n.menuSelected===f&&h.classList.add(n.current.collection.selectClass),h.innerHTML=n.current.collection.menuItemTemplate(c),s.appendChild(h)}),u.appendChild(s)}};typeof this.current.collection.values=="function"?this.current.collection.values(this.current.mentionText,i):i(this.current.collection.values)}}},{key:"_findLiTarget",value:function(t){if(!t)return[];var e=t.getAttribute("data-index");return e?[t,e]:this._findLiTarget(t.parentNode)}},{key:"showMenuForCollection",value:function(t,e){t!==document.activeElement&&this.placeCaretAtEnd(t),this.current.collection=this.collection[e||0],this.current.externalTrigger=!0,this.current.element=t,t.isContentEditable?this.insertTextAtCursor(this.current.collection.trigger):this.insertAtCaret(t,this.current.collection.trigger),this.showMenuFor(t)}},{key:"placeCaretAtEnd",value:function(t){if(t.focus(),window.getSelection!==void 0&&document.createRange!==void 0){var e=document.createRange();e.selectNodeContents(t),e.collapse(!1);var n=window.getSelection();n.removeAllRanges(),n.addRange(e)}else if(document.body.createTextRange!==void 0){var i=document.body.createTextRange();i.moveToElementText(t),i.collapse(!1),i.select()}}},{key:"insertTextAtCursor",value:function(t){var e,n;(n=(e=window.getSelection()).getRangeAt(0)).deleteContents();var i=document.createTextNode(t);n.insertNode(i),n.selectNodeContents(i),n.collapse(!1),e.removeAllRanges(),e.addRange(n)}},{key:"insertAtCaret",value:function(t,e){var n=t.scrollTop,i=t.selectionStart,r=t.value.substring(0,i),o=t.value.substring(t.selectionEnd,t.value.length);t.value=r+e+o,i+=e.length,t.selectionStart=i,t.selectionEnd=i,t.focus(),t.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(t,e){if(typeof(t=parseInt(t))=="number"&&!isNaN(t)){var n=this.current.filteredItems[t],i=this.current.collection.selectTemplate(n);i!==null&&this.replaceText(i,e,n)}}},{key:"replaceText",value:function(t,e,n){this.range.replaceTriggerText(t,!0,!0,e,n)}},{key:"_append",value:function(t,e,n){if(typeof t.values=="function")throw new Error("Unable to append to values, as it is a function.");t.values=n?e:t.values.concat(e)}},{key:"append",value:function(t,e,n){var i=parseInt(t);if(typeof i!="number")throw new Error("please provide an index for the collection to update.");var r=this.collection[i];this._append(r,e,n)}},{key:"appendCurrent",value:function(t,e){if(!this.isActive)throw new Error("No active state. Please use append instead and pass an index.");this._append(this.current.collection,t,e)}},{key:"detach",value:function(t){if(!t)throw new Error("[Tribute] Must pass in a DOM node or NodeList.");if(typeof jQuery<"u"&&t instanceof jQuery&&(t=t.get()),t.constructor===NodeList||t.constructor===HTMLCollection||t.constructor===Array)for(var e=t.length,n=0;n'+(this.current.collection.trigger+t.original[this.current.collection.fillAttr])+"":this.current.collection.trigger+t.original[this.current.collection.fillAttr]}},{key:"defaultMenuItemTemplate",value:function(t){return t.string}},{key:"inputTypes",value:function(){return["TEXTAREA","INPUT"]}}]),a}()})}}]);