14 lines
43 KiB
JavaScript
14 lines
43 KiB
JavaScript
import{d as j}from"./index-Bp9-GhMo.chunk.mjs";import{g as B,u as q,s as V}from"./NcAvatar-ruClKRzS-D00PbCEA.chunk.mjs";import{N as z}from"./NcUserStatusIcon-JWiuiAXe-BJYvYIQF.chunk.mjs";import{r as Y,o as E,f as A,g as T,t as k,c as X,h as W,R as F,F as O,m as Q,M as I,a4 as _,e as Z}from"./preload-helper-DoJVKVMq.chunk.mjs";import{r as G,q as J,v as tt,b as P,_ as H,n as et,c as D}from"./NcIconSvgWrapper-De-2-ukl-CcvQeIAt.chunk.mjs";import{e as it,a as nt}from"./emoji-V9hqFgPs-DG-_iBjD.chunk.mjs";import{e as rt}from"./translation-DoG5ZELJ-DJHEP2RB.chunk.mjs";import{l as U}from"./mdi-BUoBIgaz.chunk.mjs";import"./index-ClciYKp3.chunk.mjs";import{g as ot,s as st}from"./index-CGU4a9vr.chunk.mjs";import"./NcEmptyContent-CDgWCt_m-MnlDvtO9.chunk.mjs";import"./NcSelect-B1uITk_3-D769WsNG.chunk.mjs";import"./Web-rJva_rmF.chunk.mjs";import"./NcTextField.vue_vue_type_script_setup_true_lang-B-4HNjYH-C1HLa-yu.chunk.mjs";import"./NcInputField-CPL-a_MM-DHVwy56P.chunk.mjs";import"./NcModal-kyWZ3UFC-BxKwwKAq.chunk.mjs";import"./colors-BfjxNgsx-Dyl_2CuU.chunk.mjs";import"./public-CvthP4YJ.chunk.mjs";import"./PencilOutline-BzoFsBsK.chunk.mjs";import"./NcDateTime.vue_vue_type_script_setup_true_lang-B4upiZjL-L27IwP9h.chunk.mjs";import"./util-Caafb9Jl.chunk.mjs";import"./NcCheckboxRadioSwitch-D0gFwEVl-CZhGfPiT.chunk.mjs";if(Array.prototype.find||(Array.prototype.find=function(s){if(this===null)throw new TypeError("Array.prototype.find called on null or undefined");if(typeof s!="function")throw new TypeError("predicate must be a function");for(var t=Object(this),e=t.length>>>0,i=arguments[1],n,r=0;r<e;r++)if(n=t[r],s.call(i,n,r,t))return n}),window&&typeof window.CustomEvent!="function"){let s=function(t,e){e=e||{bubbles:!1,cancelable:!1,detail:void 0};var i=document.createEvent("CustomEvent");return i.initCustomEvent(t,e.bubbles,e.cancelable,e.detail),i};typeof window.Event<"u"&&(s.prototype=window.Event.prototype),window.CustomEvent=s}class R{constructor(t){this.tribute=t,this.tribute.events=this}static keys(){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"}]}bind(t){t.boundKeydown=this.keydown.bind(t,this),t.boundKeyup=this.keyup.bind(t,this),t.boundInput=this.input.bind(t,this),t.addEventListener("keydown",t.boundKeydown,!1),t.addEventListener("keyup",t.boundKeyup,!1),t.addEventListener("input",t.boundInput,!1)}unbind(t){t.removeEventListener("keydown",t.boundKeydown,!1),t.removeEventListener("keyup",t.boundKeyup,!1),t.removeEventListener("input",t.boundInput,!1),delete t.boundKeydown,delete t.boundKeyup,delete t.boundInput}keydown(t,e){t.shouldDeactivate(e)&&(t.tribute.isActive=!1,t.tribute.hideMenu());let i=this;t.commandEvent=!1,R.keys().forEach(n=>{n.key===e.keyCode&&(t.commandEvent=!0,t.callbacks()[n.value.toLowerCase()](e,i))})}input(t,e){t.inputEvent=!0,t.keyup.call(this,t,e)}click(t,e){let i=t.tribute;if(i.menu&&i.menu.contains(e.target)){let n=e.target;for(e.preventDefault(),e.stopPropagation();n.nodeName.toLowerCase()!=="li";)if(n=n.parentNode,!n||n===i.menu)throw new Error("cannot find the <li> container for the click");i.selectItemAtIndex(n.getAttribute("data-index"),e),i.hideMenu()}else i.current.element&&!i.current.externalTrigger&&(i.current.externalTrigger=!1,setTimeout(()=>i.hideMenu()))}keyup(t,e){if(t.inputEvent&&(t.inputEvent=!1),t.updateSelection(this),e.keyCode!==27){if(!t.tribute.allowSpaces&&t.tribute.hasTrailingSpace){t.tribute.hasTrailingSpace=!1,t.commandEvent=!0,t.callbacks().space(e,this);return}if(!t.tribute.isActive)if(t.tribute.autocompleteMode)t.callbacks().triggerChar(e,this,"");else{let i=t.getKeyCode(t,this,e);if(isNaN(i)||!i)return;let n=t.tribute.triggers().find(r=>r.charCodeAt(0)===i);typeof n<"u"&&t.callbacks().triggerChar(e,this,n)}t.tribute.current.mentionText.length<t.tribute.current.collection.menuShowMinLength||((t.tribute.current.trigger||t.tribute.autocompleteMode)&&t.commandEvent===!1||t.tribute.isActive&&e.keyCode===8)&&t.tribute.showMenuFor(this,!0)}}shouldDeactivate(t){if(!this.tribute.isActive)return!1;if(this.tribute.current.mentionText.length===0){let e=!1;return R.keys().forEach(i=>{t.keyCode===i.key&&(e=!0)}),!e}return!1}getKeyCode(t,e,i){let n=t.tribute,r=n.range.getTriggerInfo(!1,n.hasTrailingSpace,!0,n.allowSpaces,n.autocompleteMode);return r?r.mentionTriggerChar.charCodeAt(0):!1}updateSelection(t){this.tribute.current.element=t;let e=this.tribute.range.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);e&&(this.tribute.current.selectedPath=e.mentionSelectedPath,this.tribute.current.mentionText=e.mentionText,this.tribute.current.selectedOffset=e.mentionSelectedOffset)}callbacks(){return{triggerChar:(t,e,i)=>{let n=this.tribute;n.current.trigger=i;let r=n.collection.find(o=>o.trigger===i);n.current.collection=r,n.current.mentionText.length>=n.current.collection.menuShowMinLength&&n.inputEvent&&n.showMenuFor(e,!0)},enter:(t,e)=>{this.tribute.isActive&&this.tribute.current.filteredItems&&(t.preventDefault(),t.stopPropagation(),setTimeout(()=>{this.tribute.selectItemAtIndex(this.tribute.menuSelected,t),this.tribute.hideMenu()},0))},escape:(t,e)=>{this.tribute.isActive&&(t.preventDefault(),t.stopPropagation(),this.tribute.isActive=!1,this.tribute.hideMenu())},tab:(t,e)=>{this.callbacks().enter(t,e)},space:(t,e)=>{this.tribute.isActive&&(this.tribute.spaceSelectsMatch?this.callbacks().enter(t,e):this.tribute.allowSpaces||(t.stopPropagation(),setTimeout(()=>{this.tribute.hideMenu(),this.tribute.isActive=!1},0)))},up:(t,e)=>{if(this.tribute.isActive&&this.tribute.current.filteredItems){t.preventDefault(),t.stopPropagation();let i=this.tribute.current.filteredItems.length,n=this.tribute.menuSelected;i>n&&n>0?(this.tribute.menuSelected--,this.setActiveLi()):n===0&&(this.tribute.menuSelected=i-1,this.setActiveLi(),this.tribute.menu.scrollTop=this.tribute.menu.scrollHeight)}},down:(t,e)=>{if(this.tribute.isActive&&this.tribute.current.filteredItems){t.preventDefault(),t.stopPropagation();let i=this.tribute.current.filteredItems.length-1,n=this.tribute.menuSelected;i>n?(this.tribute.menuSelected++,this.setActiveLi()):i===n&&(this.tribute.menuSelected=0,this.setActiveLi(),this.tribute.menu.scrollTop=0)}},delete:(t,e)=>{this.tribute.isActive&&this.tribute.current.mentionText.length<1?this.tribute.hideMenu():this.tribute.isActive&&this.tribute.showMenuFor(e)}}}setActiveLi(t){let e=this.tribute.menu.querySelectorAll("li"),i=e.length>>>0;t&&(this.tribute.menuSelected=parseInt(t));for(let n=0;n<i;n++){let r=e[n];if(n===this.tribute.menuSelected){r.classList.add(this.tribute.current.collection.selectClass);let o=r.getBoundingClientRect(),l=this.tribute.menu.getBoundingClientRect();if(o.bottom>l.bottom){let u=o.bottom-l.bottom;this.tribute.menu.scrollTop+=u}else if(o.top<l.top){let u=l.top-o.top;this.tribute.menu.scrollTop-=u}}else r.classList.remove(this.tribute.current.collection.selectClass)}}getFullHeight(t,e){let i=t.getBoundingClientRect().height;if(e){let n=t.currentStyle||window.getComputedStyle(t);return i+parseFloat(n.marginTop)+parseFloat(n.marginBottom)}return i}}class lt{constructor(t){this.tribute=t,this.tribute.menuEvents=this,this.menu=this.tribute.menu}bind(t){this.menuClickEvent=this.tribute.events.click.bind(null,this),this.menuContainerScrollEvent=this.debounce(()=>{this.tribute.isActive&&this.tribute.showMenuFor(this.tribute.current.element,!1)},300,!1),this.windowResizeEvent=this.debounce(()=>{this.tribute.isActive&&this.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)}unbind(t){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)}debounce(t,e,i){var n;return()=>{var r=this,o=arguments,l=()=>{n=null,i||t.apply(r,o)},u=i&&!n;clearTimeout(n),n=setTimeout(l,e),u&&t.apply(r,o)}}}class at{constructor(t){this.tribute=t,this.tribute.range=this}getDocument(){let t;return this.tribute.current.collection&&(t=this.tribute.current.collection.iframe),t?t.contentWindow.document:document}positionMenuAtCaret(t){let e=this.tribute.current,i,n=this.getTriggerInfo(!1,this.tribute.hasTrailingSpace,!0,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(typeof n<"u"){if(!this.tribute.positionMenu){this.tribute.menu.style.cssText="display: block;";return}this.isContentEditable(e.element)?i=this.getContentEditableCaretPosition(n.mentionPosition):i=this.getTextAreaOrInputUnderlinePosition(this.tribute.current.element,n.mentionPosition),this.tribute.menu.style.cssText=`top: ${i.top}px;
|
||
left: ${i.left}px;
|
||
right: ${i.right}px;
|
||
bottom: ${i.bottom}px;
|
||
position: absolute;
|
||
display: block;`,i.left==="auto"&&(this.tribute.menu.style.left="auto"),i.top==="auto"&&(this.tribute.menu.style.top="auto"),t&&this.scrollIntoView(),window.setTimeout(()=>{let r={width:this.tribute.menu.offsetWidth,height:this.tribute.menu.offsetHeight},o=this.isMenuOffScreen(i,r),l=window.innerWidth>r.width&&(o.left||o.right),u=window.innerHeight>r.height&&(o.top||o.bottom);(l||u)&&(this.tribute.menu.style.cssText="display: none",this.positionMenuAtCaret(t))},0)}else this.tribute.menu.style.cssText="display: none"}get menuContainerIsBody(){return this.tribute.menuContainer===document.body||!this.tribute.menuContainer}selectElement(t,e,i){let n,r=t;if(e)for(var o=0;o<e.length;o++){if(r=r.childNodes[e[o]],r===void 0)return;for(;r.length<i;)i-=r.length,r=r.nextSibling;r.childNodes.length===0&&!r.length&&(r=r.previousSibling)}let l=this.getWindowSelection();n=this.getDocument().createRange(),n.setStart(r,i),n.setEnd(r,i),n.collapse(!0);try{l.removeAllRanges()}catch{}l.addRange(n),t.focus()}replaceTriggerText(t,e,i,n,r){let o=this.getTriggerInfo(!0,i,e,this.tribute.allowSpaces,this.tribute.autocompleteMode);if(o!==void 0){let l=this.tribute.current,u=new CustomEvent("tribute-replaced",{detail:{item:r,instance:l,context:o,event:n}});if(this.isContentEditable(l.element)){let c=typeof this.tribute.replaceTextSuffix=="string"?this.tribute.replaceTextSuffix:" ";t+=c;let a=o.mentionPosition+o.mentionText.length;this.tribute.autocompleteMode||(a+=o.mentionTriggerChar.length),this.pasteHtml(t,o.mentionPosition,a)}else{let c=this.tribute.current.element,a=typeof this.tribute.replaceTextSuffix=="string"?this.tribute.replaceTextSuffix:" ";t+=a;let m=o.mentionPosition,h=o.mentionPosition+o.mentionText.length+a.length;this.tribute.autocompleteMode||(h+=o.mentionTriggerChar.length-1),c.value=c.value.substring(0,m)+t+c.value.substring(h,c.value.length),c.selectionStart=m+t.length,c.selectionEnd=m+t.length}l.element.dispatchEvent(new CustomEvent("input",{bubbles:!0})),l.element.dispatchEvent(u)}}pasteHtml(t,e,i){let n,r;r=this.getWindowSelection(),n=this.getDocument().createRange(),n.setStart(r.anchorNode,e),n.setEnd(r.anchorNode,i),n.deleteContents();let o=this.getDocument().createElement("div");o.innerHTML=t;let l=this.getDocument().createDocumentFragment(),u,c;for(;u=o.firstChild;)c=l.appendChild(u);n.insertNode(l),c&&(n=n.cloneRange(),n.setStartAfter(c),n.collapse(!0),r.removeAllRanges(),r.addRange(n))}getWindowSelection(){return this.tribute.collection.iframe?this.tribute.collection.iframe.contentWindow.getSelection():window.getSelection()}getNodePositionInParent(t){if(t.parentNode===null)return 0;for(var e=0;e<t.parentNode.childNodes.length;e++)if(t.parentNode.childNodes[e]===t)return e}getContentEditableSelectedPath(t){let e=this.getWindowSelection(),i=e.anchorNode,n=[],r;if(i!=null){let o,l=i.contentEditable;for(;i!==null&&l!=="true";)o=this.getNodePositionInParent(i),n.push(o),i=i.parentNode,i!==null&&(l=i.contentEditable);return n.reverse(),r=e.getRangeAt(0).startOffset,{selected:i,path:n,offset:r}}}getTextPrecedingCurrentSelection(){let t=this.tribute.current,e="";if(this.isContentEditable(t.element)){let i=this.getWindowSelection().anchorNode;if(i!=null){let n=i.textContent,r=this.getWindowSelection().getRangeAt(0).startOffset;n&&r>=0&&(e=n.substring(0,r))}}else{let i=this.tribute.current.element;if(i){let n=i.selectionStart;i.value&&n>=0&&(e=i.value.substring(0,n))}}return e}getLastWordInText(t){t=t.replace(/\u00A0/g," ");let e=t.split(/\s+/),i=e.length-1;return e[i].trim()}getTriggerInfo(t,e,i,n,r){let o=this.tribute.current,l,u,c;if(!this.isContentEditable(o.element))l=this.tribute.current.element;else{let h=this.getContentEditableSelectedPath(o);h&&(l=h.selected,u=h.path,c=h.offset)}let a=this.getTextPrecedingCurrentSelection(),m=this.getLastWordInText(a);if(r)return{mentionPosition:a.length-m.length,mentionText:m,mentionSelectedElement:l,mentionSelectedPath:u,mentionSelectedOffset:c};if(a!=null){let h=-1,g;if(this.tribute.collection.forEach(d=>{let f=d.trigger,p=d.requireLeadingSpace?this.lastIndexWithLeadingSpace(a,f):a.lastIndexOf(f);p>h&&(h=p,g=f,i=d.requireLeadingSpace)}),h>=0&&(h===0||!i||/[\xA0\s]/g.test(a.substring(h-1,h)))){let d=a.substring(h+g.length,a.length);g=a.substring(h,h+g.length);let f=d.substring(0,1),p=d.length>0&&(f===" "||f===" ");e&&(d=d.trim());let v=n?/[^\S ]/g:/[\xA0\s]/g;if(this.tribute.hasTrailingSpace=v.test(d),!p&&(t||!v.test(d)))return{mentionPosition:h,mentionText:d,mentionSelectedElement:l,mentionSelectedPath:u,mentionSelectedOffset:c,mentionTriggerChar:g}}}}lastIndexWithLeadingSpace(t,e){let i=t.split("").reverse().join(""),n=-1;for(let r=0,o=t.length;r<o;r++){let l=r===t.length-1,u=/\s/.test(i[r+1]),c=!0;for(let a=e.length-1;a>=0;a--)if(e[a]!==i[r-a]){c=!1;break}if(c&&(l||u)){n=t.length-1-r;break}}return n}isContentEditable(t){return t.nodeName!=="INPUT"&&t.nodeName!=="TEXTAREA"}isMenuOffScreen(t,e){let i=window.innerWidth,n=window.innerHeight,r=document.documentElement,o=(window.pageXOffset||r.scrollLeft)-(r.clientLeft||0),l=(window.pageYOffset||r.scrollTop)-(r.clientTop||0),u=typeof t.top=="number"?t.top:l+n-t.bottom-e.height,c=typeof t.right=="number"?t.right:t.left+e.width,a=typeof t.bottom=="number"?t.bottom:t.top+e.height,m=typeof t.left=="number"?t.left:o+i-t.right-e.width;return{top:u<Math.floor(l),right:c>Math.ceil(o+i),bottom:a>Math.ceil(l+n),left:m<Math.floor(o)}}getMenuDimensions(){let t={width:null,height:null};return this.tribute.menu.style.cssText=`top: 0px;
|
||
left: 0px;
|
||
position: fixed;
|
||
display: block;
|
||
visibility; hidden;`,t.width=this.tribute.menu.offsetWidth,t.height=this.tribute.menu.offsetHeight,this.tribute.menu.style.cssText="display: none;",t}getTextAreaOrInputUnderlinePosition(t,e,i){let n=["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"],r=window.mozInnerScreenX!==null,o=this.getDocument().createElement("div");o.id="input-textarea-caret-position-mirror-div",this.getDocument().body.appendChild(o);let l=o.style,u=window.getComputedStyle?getComputedStyle(t):t.currentStyle;l.whiteSpace="pre-wrap",t.nodeName!=="INPUT"&&(l.wordWrap="break-word"),l.position="absolute",l.visibility="hidden",n.forEach(C=>{l[C]=u[C]}),r?(l.width=`${parseInt(u.width)-2}px`,t.scrollHeight>parseInt(u.height)&&(l.overflowY="scroll")):l.overflow="hidden",o.textContent=t.value.substring(0,e),t.nodeName==="INPUT"&&(o.textContent=o.textContent.replace(/\s/g," "));let c=this.getDocument().createElement("span");c.textContent=t.value.substring(e)||".",o.appendChild(c);let a=t.getBoundingClientRect(),m=document.documentElement,h=(window.pageXOffset||m.scrollLeft)-(m.clientLeft||0),g=(window.pageYOffset||m.scrollTop)-(m.clientTop||0),d=0,f=0;this.menuContainerIsBody&&(d=a.top,f=a.left);let p={top:d+g+c.offsetTop+parseInt(u.borderTopWidth)+parseInt(u.fontSize)-t.scrollTop,left:f+h+c.offsetLeft+parseInt(u.borderLeftWidth)},v=window.innerWidth,x=window.innerHeight,w=this.getMenuDimensions(),y=this.isMenuOffScreen(p,w);y.right&&(p.right=v-p.left,p.left="auto");let N=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(y.bottom){let C=this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect(),b=N-(x-C.top);p.bottom=b+(x-a.top-c.offsetTop),p.top="auto"}return y=this.isMenuOffScreen(p,w),y.left&&(p.left=v>w.width?h+v-w.width:h,delete p.right),y.top&&(p.top=x>w.height?g+x-w.height:g,delete p.bottom),this.getDocument().body.removeChild(o),p}getContentEditableCaretPosition(t){let e,i=this.getWindowSelection();e=this.getDocument().createRange(),e.setStart(i.anchorNode,t),e.setEnd(i.anchorNode,t),e.collapse(!1);let n=e.getBoundingClientRect(),r=document.documentElement,o=(window.pageXOffset||r.scrollLeft)-(r.clientLeft||0),l=(window.pageYOffset||r.scrollTop)-(r.clientTop||0),u=n.left,c=n.top,a={left:u+o,top:c+n.height+l},m=window.innerWidth,h=window.innerHeight,g=this.getMenuDimensions(),d=this.isMenuOffScreen(a,g);d.right&&(a.left="auto",a.right=m-n.left-o);let f=this.tribute.menuContainer?this.tribute.menuContainer.offsetHeight:this.getDocument().body.offsetHeight;if(d.bottom){let p=this.tribute.menuContainer?this.tribute.menuContainer.getBoundingClientRect():this.getDocument().body.getBoundingClientRect(),v=f-(h-p.top);a.top="auto",a.bottom=v+(h-n.top)}return d=this.isMenuOffScreen(a,g),d.left&&(a.left=m>g.width?o+m-g.width:o,delete a.right),d.top&&(a.top=h>g.height?l+h-g.height:l,delete a.bottom),this.menuContainerIsBody||(a.left=a.left?a.left-this.tribute.menuContainer.offsetLeft:a.left,a.top=a.top?a.top-this.tribute.menuContainer.offsetTop:a.top),a}scrollIntoView(t){let e=20,i,n=100,r=this.menu;if(typeof r>"u")return;for(;i===void 0||i.height===0;)if(i=r.getBoundingClientRect(),i.height===0&&(r=r.childNodes[0],r===void 0||!r.getBoundingClientRect))return;let o=i.top,l=o+i.height;if(o<0)window.scrollTo(0,window.pageYOffset+i.top-e);else if(l>window.innerHeight){let u=window.pageYOffset+i.top-e;u-window.pageYOffset>n&&(u=window.pageYOffset+n);let c=window.pageYOffset-(window.innerHeight-l);c>u&&(c=u),window.scrollTo(0,c)}}}class ut{constructor(t){this.tribute=t,this.tribute.search=this}simpleFilter(t,e){return e.filter(i=>this.test(t,i))}test(t,e){return this.match(t,e)!==null}match(t,e,i){i=i||{},e.length;let n=i.pre||"",r=i.post||"",o=i.caseSensitive&&e||e.toLowerCase();if(i.skip)return{rendered:e,score:0};t=i.caseSensitive&&t||t.toLowerCase();let l=this.traverse(o,t,0,0,[]);return l?{rendered:this.render(e,l.cache,n,r),score:l.score}:null}traverse(t,e,i,n,r){if(e.length===n)return{score:this.calculateScore(r),cache:r.slice()};if(t.length===i||e.length-n>t.length-i)return;let o=e[n],l=t.indexOf(o,i),u,c;for(;l>-1;){if(r.push(l),c=this.traverse(t,e,l+1,n+1,r),r.pop(),!c)return u;(!u||u.score<c.score)&&(u=c),l=t.indexOf(o,l+1)}return u}calculateScore(t){let e=0,i=1;return t.forEach((n,r)=>{r>0&&(t[r-1]+1===n?i+=i+1:i=1),e+=i}),e}render(t,e,i,n){var r=t.substring(0,e[0]);return e.forEach((o,l)=>{r+=i+t[o]+n+t.substring(o+1,e[l+1]?e[l+1]:t.length)}),r}filter(t,e,i){return i=i||{},e.reduce((n,r,o,l)=>{let u=r;i.extract&&(u=i.extract(r),u||(u=""));let c=this.match(t,u,i);return c!=null&&(n[n.length]={string:c.rendered,score:c.score,index:o,original:r}),n},[]).sort((n,r)=>r.score-n.score||n.index-r.index)}}class S{constructor({values:t=null,iframe:e=null,selectClass:i="highlight",containerClass:n="tribute-container",itemClass:r="",trigger:o="@",autocompleteMode:l=!1,selectTemplate:u=null,menuItemTemplate:c=null,lookup:a="key",fillAttr:m="value",collection:h=null,menuContainer:g=null,noMatchTemplate:d=null,requireLeadingSpace:f=!0,allowSpaces:p=!1,replaceTextSuffix:v=null,positionMenu:x=!0,spaceSelectsMatch:w=!1,searchOpts:y={},menuItemLimit:N=null,menuShowMinLength:C=0}){if(this.autocompleteMode=l,this.menuSelected=0,this.current={},this.inputEvent=!1,this.isActive=!1,this.menuContainer=g,this.allowSpaces=p,this.replaceTextSuffix=v,this.positionMenu=x,this.hasTrailingSpace=!1,this.spaceSelectsMatch=w,this.autocompleteMode&&(o="",p=!1),t)this.collection=[{trigger:o,iframe:e,selectClass:i,containerClass:n,itemClass:r,selectTemplate:(u||S.defaultSelectTemplate).bind(this),menuItemTemplate:(c||S.defaultMenuItemTemplate).bind(this),noMatchTemplate:(b=>typeof b=="string"?b.trim()===""?null:b:typeof b=="function"?b.bind(this):d||function(){return"<li>No Match Found!</li>"}.bind(this))(d),lookup:a,fillAttr:m,values:t,requireLeadingSpace:f,searchOpts:y,menuItemLimit:N,menuShowMinLength:C}];else if(h)this.autocompleteMode&&console.warn("Tribute in autocomplete mode does not work for collections"),this.collection=h.map(b=>({trigger:b.trigger||o,iframe:b.iframe||e,selectClass:b.selectClass||i,containerClass:b.containerClass||n,itemClass:b.itemClass||r,selectTemplate:(b.selectTemplate||S.defaultSelectTemplate).bind(this),menuItemTemplate:(b.menuItemTemplate||S.defaultMenuItemTemplate).bind(this),noMatchTemplate:(M=>typeof M=="string"?M.trim()===""?null:M:typeof M=="function"?M.bind(this):d||function(){return"<li>No Match Found!</li>"}.bind(this))(d),lookup:b.lookup||a,fillAttr:b.fillAttr||m,values:b.values,requireLeadingSpace:b.requireLeadingSpace,searchOpts:b.searchOpts||y,menuItemLimit:b.menuItemLimit||N,menuShowMinLength:b.menuShowMinLength||C}));else throw new Error("[Tribute] No collection specified.");new at(this),new R(this),new lt(this),new ut(this)}get isActive(){return this._isActive}set isActive(t){if(this._isActive!=t&&(this._isActive=t,this.current.element)){let e=new CustomEvent(`tribute-active-${t}`);this.current.element.dispatchEvent(e)}}static defaultSelectTemplate(t){return typeof t>"u"?`${this.current.collection.trigger}${this.current.mentionText}`:this.range.isContentEditable(this.current.element)?'<span class="tribute-mention">'+(this.current.collection.trigger+t.original[this.current.collection.fillAttr])+"</span>":this.current.collection.trigger+t.original[this.current.collection.fillAttr]}static defaultMenuItemTemplate(t){return t.string}static inputTypes(){return["TEXTAREA","INPUT"]}triggers(){return this.collection.map(t=>t.trigger)}attach(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){let i=t.length;for(var e=0;e<i;++e)this._attach(t[e])}else this._attach(t)}_attach(t){t.hasAttribute("data-tribute")&&console.warn("Tribute was already bound to "+t.nodeName),this.ensureEditable(t),this.events.bind(t),t.setAttribute("data-tribute",!0)}ensureEditable(t){if(S.inputTypes().indexOf(t.nodeName)===-1)if(t.contentEditable)t.contentEditable=!0;else throw new Error("[Tribute] Cannot bind to "+t.nodeName)}createMenu(t){let e=this.range.getDocument().createElement("div"),i=this.range.getDocument().createElement("ul");return e.className=t,e.appendChild(i),this.menuContainer?this.menuContainer.appendChild(e):this.range.getDocument().body.appendChild(e)}showMenuFor(t,e){if(this.isActive&&this.current.element===t&&this.current.mentionText===this.currentMentionTextSnapshot)return;this.currentMentionTextSnapshot=this.current.mentionText,this.menu||(this.menu=this.createMenu(this.current.collection.containerClass),t.tributeMenu=this.menu,this.menuEvents.bind(this.menu)),this.isActive=!0,this.menuSelected=0,this.current.mentionText||(this.current.mentionText="");const i=n=>{if(!this.isActive)return;let r=this.search.filter(this.current.mentionText,n,{pre:this.current.collection.searchOpts.pre||"<span>",post:this.current.collection.searchOpts.post||"</span>",skip:this.current.collection.searchOpts.skip,extract:u=>{if(typeof this.current.collection.lookup=="string")return u[this.current.collection.lookup];if(typeof this.current.collection.lookup=="function")return this.current.collection.lookup(u,this.current.mentionText);throw new Error("Invalid lookup attribute, lookup must be string or function.")}});this.current.collection.menuItemLimit&&(r=r.slice(0,this.current.collection.menuItemLimit)),this.current.filteredItems=r;let o=this.menu.querySelector("ul");if(this.range.positionMenuAtCaret(e),!r.length){let u=new CustomEvent("tribute-no-match",{detail:this.menu});this.current.element.dispatchEvent(u),typeof this.current.collection.noMatchTemplate=="function"&&!this.current.collection.noMatchTemplate()||!this.current.collection.noMatchTemplate?this.hideMenu():typeof this.current.collection.noMatchTemplate=="function"?o.innerHTML=this.current.collection.noMatchTemplate():o.innerHTML=this.current.collection.noMatchTemplate;return}o.innerHTML="";let l=this.range.getDocument().createDocumentFragment();r.forEach((u,c)=>{let a=this.range.getDocument().createElement("li");a.setAttribute("data-index",c),a.className=this.current.collection.itemClass,a.addEventListener("mousemove",m=>{let[h,g]=this._findLiTarget(m.target);m.movementY!==0&&this.events.setActiveLi(g)}),this.menuSelected===c&&a.classList.add(this.current.collection.selectClass),a.innerHTML=this.current.collection.menuItemTemplate(u),l.appendChild(a)}),o.appendChild(l)};typeof this.current.collection.values=="function"?this.current.collection.values(this.current.mentionText,i):i(this.current.collection.values)}_findLiTarget(t){if(!t)return[];const e=t.getAttribute("data-index");return e?[t,e]:this._findLiTarget(t.parentNode)}showMenuForCollection(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)}placeCaretAtEnd(t){if(t.focus(),typeof window.getSelection<"u"&&typeof document.createRange<"u"){var e=document.createRange();e.selectNodeContents(t),e.collapse(!1);var i=window.getSelection();i.removeAllRanges(),i.addRange(e)}else if(typeof document.body.createTextRange<"u"){var n=document.body.createTextRange();n.moveToElementText(t),n.collapse(!1),n.select()}}insertTextAtCursor(t){var e,i;e=window.getSelection(),i=e.getRangeAt(0),i.deleteContents();var n=document.createTextNode(t);i.insertNode(n),i.selectNodeContents(n),i.collapse(!1),e.removeAllRanges(),e.addRange(i)}insertAtCaret(t,e){var i=t.scrollTop,n=t.selectionStart,r=t.value.substring(0,n),o=t.value.substring(t.selectionEnd,t.value.length);t.value=r+e+o,n=n+e.length,t.selectionStart=n,t.selectionEnd=n,t.focus(),t.scrollTop=i}hideMenu(){this.menu&&(this.menu.style.cssText="display: none;",this.isActive=!1,this.menuSelected=0,this.current={})}selectItemAtIndex(t,e){if(t=parseInt(t),typeof t!="number"||isNaN(t))return;let i=this.current.filteredItems[t],n=this.current.collection.selectTemplate(i);n!==null&&this.replaceText(n,e,i)}replaceText(t,e,i){this.range.replaceTriggerText(t,!0,!0,e,i)}_append(t,e,i){if(typeof t.values=="function")throw new Error("Unable to append to values, as it is a function.");i?t.values=e:t.values=t.values.concat(e)}append(t,e,i){let n=parseInt(t);if(typeof n!="number")throw new Error("please provide an index for the collection to update.");let r=this.collection[n];this._append(r,e,i)}appendCurrent(t,e){if(this.isActive)this._append(this.current.collection,t,e);else throw new Error("No active state. Please use append instead and pass an index.")}detach(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){let i=t.length;for(var e=0;e<i;++e)this._detach(t[e])}else this._detach(t)}_detach(t){this.events.unbind(t),t.tributeMenu&&this.menuEvents.unbind(t.tributeMenu),setTimeout(()=>{t.removeAttribute("data-tribute"),this.isActive=!1,t.tributeMenu&&t.tributeMenu.remove()})}}const ct={name:"NcMentionBubble",props:{id:{type:String,required:!0},label:{type:String,required:!1,default:null},icon:{type:String,required:!0},iconUrl:{type:[String,null],default:null},source:{type:String,required:!0},primary:{type:Boolean,default:!1}},setup(){return{isDarkTheme:q()}},computed:{avatarUrl(){return this.iconUrl?this.iconUrl:this.id&&this.source==="users"?B(this.id,{isDarkTheme:this.isDarkTheme}):null},mentionText(){return!this.id.includes(" ")&&!this.id.includes("/")?`@${this.id}`:`@"${this.id}"`}}},ht={class:"mention-bubble__wrapper"},dt={class:"mention-bubble__content"},mt=["title"],pt={role:"none",class:"mention-bubble__select"};function bt(s,t,e,i,n,r){return E(),A("span",{class:O(["mention-bubble",{"mention-bubble--primary":e.primary}]),contenteditable:"false"},[T("span",ht,[T("span",dt,[T("span",{class:O([[e.icon,`mention-bubble__icon--${r.avatarUrl?"with-avatar":""}`],"mention-bubble__icon"]),style:F(r.avatarUrl?{backgroundImage:`url(${r.avatarUrl})`}:null)},null,6),T("span",{role:"heading",class:"mention-bubble__title",title:e.label},null,8,mt)]),T("span",pt,k(r.mentionText),1)])],2)}const gt=H(ct,[["render",bt],["__scopeId","data-v-45238efd"]]),K=/(?=[a-z0-9_\-@.'])\B/.source,ft=/(@[a-z0-9_\-@.']+)/.source,vt=/@"(?:guest|email){1}\/[a-f0-9]+"/.source,Tt=/@"(?:federated_)?(?:group|team|user){1}\/[a-z0-9_\-@.' /:]+"/.source,wt=/@"[a-z0-9_\-@.' ]+"/.source,yt=`(${vt}|${Tt}|${wt})`,Ct=new RegExp(`${K}${ft}`,"gi"),St=new RegExp(`${K}${yt}`,"gi"),Et={props:{userData:{type:Object,default:()=>({})}},methods:{renderContent(s){return rt(s).split(Ct).map(t=>t.split(St)).flat().map(t=>{if(!t.startsWith("@"))return t;const e=t.slice(1).replace(/"/gi,"");return this.genSelectTemplate(e)}).join("").replace(/\n/gmi,"<br>").replace(/&/gmi,"&")},parseContent(s){let t=s;return t=t.replace(/<br>/gmi,`
|
||
`),t=t.replace(/ /gmi," "),t=t.replace(/&/gmi,"&"),t=t.replace(/<\/div>/gmi,`
|
||
`),t=V(t,"<div>"),t=V(t),t},genSelectTemplate(s){if(typeof s>"u")return`${this.autocompleteTribute.current.collection.trigger}${this.autocompleteTribute.current.mentionText}`;const t=this.userData[s];return t?this.renderComponentHtml(t,gt).replace(/[\n\t]/gmi,"").replace(/>\s+</g,"><"):[" ","/",":"].every(e=>!s.includes(e))?`@${s}`:`@"${s}"`},renderComponentHtml(s,t){const e=Z(t,{...s}),i=document.createElement("div");i.style.display="none",document.body.appendChild(i),e.mount(i);const n=i.innerHTML;return e.unmount(),i.remove(),n}}},xt={name:"NcAutoCompleteResult",components:{NcUserStatusIcon:z},props:{label:{type:String,required:!1,default:null},subline:{type:String,default:null},id:{type:String,default:null},icon:{type:String,required:!0},iconUrl:{type:String,default:null},source:{type:String,required:!0},status:{type:[Object,Array],default:()=>({})}},setup(){return{isDarkTheme:q()}},computed:{avatarUrl(){return this.iconUrl?this.iconUrl:this.id&&this.source==="users"?B(this.id,{isDarkTheme:this.isDarkTheme}):null}}},At={class:"autocomplete-result"},Mt={key:0,class:"autocomplete-result__status autocomplete-result__status--icon"},It={class:"autocomplete-result__content"},_t=["title"],Lt={key:0,class:"autocomplete-result__subline"};function kt(s,t,e,i,n,r){const o=Y("NcUserStatusIcon");return E(),A("div",At,[T("div",{class:O([[e.icon,`autocomplete-result__icon--${r.avatarUrl?"with-avatar":""}`],"autocomplete-result__icon"]),style:F(r.avatarUrl?{backgroundImage:`url(${r.avatarUrl})`}:null)},[e.status.icon?(E(),A("span",Mt,k(e.status&&e.status.icon||""),1)):e.status.status&&e.status.status!=="offline"?(E(),X(o,{key:1,class:"autocomplete-result__status",status:e.status.status},null,8,["status"])):W("",!0)],6),T("span",It,[T("span",{class:"autocomplete-result__title",title:e.label},k(e.label),9,_t),e.subline?(E(),A("span",Lt,k(e.subline),1)):W("",!0)])])}const $t=H(xt,[["render",kt],["__scopeId","data-v-ca83b679"]]);G(tt,J);const Nt={"material-design-icon":"_material-design-icon_UrExO","tribute-container":"_tribute-container_aTO5r","tribute-container__item":"_tribute-container__item_EHZ07","tribute-container--focus-visible":"_tribute-container--focus-visible_GHsDW","tribute-container-autocomplete":"_tribute-container-autocomplete_YNk1h","tribute-container-emoji":"_tribute-container-emoji_jWgZX","tribute-container-link":"_tribute-container-link_1b7mc","tribute-item":"_tribute-item_p5sRT","tribute-item__title":"_tribute-item__title_VPcy9","tribute-item__icon":"_tribute-item__icon_aTxCU"},Dt=["d","D","p","P","s","S","x","X",")","(","|","/"],$=[];Dt.forEach(s=>{$.push(":"+s),$.push(":-"+s)});let L=null;const Ot={name:"NcRichContenteditable",mixins:[Et],inheritAttrs:!1,props:{id:{type:String,default:()=>D()},label:{type:String,default:""},modelValue:{type:String,required:!0},placeholder:{type:String,default:P("Write a message …")},autoComplete:{type:Function,default:()=>[]},menuContainer:{type:Element,default:()=>document.body},multiline:{type:Boolean,default:!1},contenteditable:{type:Boolean,default:!0},disabled:{type:Boolean,default:!1},maxlength:{type:Number,default:null},emojiAutocomplete:{type:Boolean,default:!0},linkAutocomplete:{type:Boolean,default:!0},class:{type:[String,Array,Object],default:""}},emits:["paste","update:modelValue","smartPickerSubmit","submit"],setup(){const s=new Intl.Segmenter;if(L===null)try{document.createElement("div").contentEditable="plaintext-only",L=!0}catch(t){U.debug("[NcRichContenteditable] Unsupported attribute value:",{error:t}),L=!1}return{labelId:D(),tributeId:D(),segmenter:s,tribute:null,tributeStyleMutationObserver:null}},data(){return{localValue:this.modelValue,isComposing:!1,isAutocompleteOpen:!1,autocompleteActiveId:void 0,isTributeIntegrationDone:!1}},computed:{isEmptyValue(){return!this.localValue||this.localValue.trim()===""},isOverMaxlength(){return this.isEmptyValue||!this.maxlength?!1:[...this.segmenter.segment(this.localValue)].length>this.maxlength},tooltipString(){return this.isOverMaxlength?et("Message limit of %n character reached","Message limit of %n characters reached",this.maxlength):null},contenteditableAttributeValue(){return this.contenteditable&&!this.disabled?L?"plaintext-only":"true":"false"},debouncedAutoComplete(){return j(async(s,t)=>{this.autoComplete(s,t)},100)}},watch:{modelValue(){const s=this.$refs.contenteditable.innerHTML;this.modelValue.trim()!==this.parseContent(s).trim()&&this.updateContent(this.modelValue)}},mounted(){this.initializeTribute(),this.updateContent(this.modelValue),this.$refs.contenteditable.contentEditable=this.contenteditableAttributeValue},beforeUnmount(){this.tribute&&this.tribute.detach(this.$refs.contenteditable),this.tributeStyleMutationObserver&&this.tributeStyleMutationObserver.disconnect()},methods:{focus(){this.$refs.contenteditable.focus()},initializeTribute(){const s=e=>`<div id="${D()}" class="${this.$style["tribute-item"]}" role="option">${e}</div>`,t=[];t.push({fillAttr:"id",lookup:e=>`${e.id} ${e.label??e.title}`,requireLeadingSpace:!0,menuItemTemplate:e=>s(this.renderComponentHtml(e.original,$t)),noMatchTemplate:()=>'<span class="hidden"></span>',selectTemplate:e=>this.genSelectTemplate(e?.original?.id),values:this.debouncedAutoComplete,containerClass:`${this.$style["tribute-container"]} ${this.$style["tribute-container-autocomplete"]}`,itemClass:this.$style["tribute-container__item"]}),this.emojiAutocomplete&&t.push({trigger:":",lookup:(e,i)=>i,requireLeadingSpace:!0,menuItemTemplate:e=>$.includes(e.original)?e.original:s(`<span class="${this.$style["tribute-item__emoji"]}">${e.original.native}</span> :${e.original.short_name}`),noMatchTemplate:()=>P("No emoji found"),selectTemplate:e=>$.includes(e.original)?e.original:(nt(e.original),e.original.native),values:(e,i)=>{const n=it(e);$.includes(":"+e)&&n.unshift(":"+e),i(n)},containerClass:`${this.$style["tribute-container"]} ${this.$style["tribute-container-emoji"]}`,itemClass:this.$style["tribute-container__item"]}),this.linkAutocomplete&&t.push({trigger:"/",lookup:(e,i)=>i,requireLeadingSpace:!0,menuItemTemplate:e=>s(`<img class="${this.$style["tribute-item__icon"]}" src="${e.original.icon_url}"> <span class="${this.$style["tribute-item__title"]}">${e.original.title}</span>`),noMatchTemplate:()=>P("No link provider found"),selectTemplate:this.getLink,values:(e,i)=>i(st(e)),containerClass:`${this.$style["tribute-container"]} ${this.$style["tribute-container-link"]}`,itemClass:this.$style["tribute-container__item"]}),this.tribute=new S({collection:t,allowSpaces:!1,menuContainer:this.menuContainer}),this.tribute.attach(this.$refs.contenteditable)},getLink(s){return ot(s.original.id).then(t=>{const e=document.getElementById("tmp-smart-picker-result-node"),i={result:t,insertText:!0};if(this.$emit("smartPickerSubmit",i),i.insertText){const n=document.createTextNode(t);e.replaceWith(n),this.setCursorAfter(n),this.updateValue(this.$refs.contenteditable.innerHTML)}else e.remove()}).catch(t=>{U.debug("[NcRichContenteditable] Smart picker promise rejected:",{error:t});const e=document.getElementById("tmp-smart-picker-result-node");this.setCursorAfter(e),e.remove()}),'<span id="tmp-smart-picker-result-node"></span>'},setCursorAfter(s){const t=document.createRange();t.setEndAfter(s),t.collapse();const e=window.getSelection();e.removeAllRanges(),e.addRange(t)},moveCursorToEnd(){if(!document.createRange||window.getSelection().rangeCount>0&&this.$refs.contenteditable.contains(window.getSelection().getRangeAt(0).commonAncestorContainer))return;const s=document.createRange();s.selectNodeContents(this.$refs.contenteditable),s.collapse(!1);const t=window.getSelection();t.removeAllRanges(),t.addRange(s)},onInput(s){this.updateValue(s.target.innerHTML)},onPaste(s){if(!(!this.contenteditable||this.disabled)){if(L)this.$emit("paste",s);else{s.preventDefault();const t=s.clipboardData;if(this.$emit("paste",s),t.files.length!==0||!Object.values(t.items).find(n=>n?.type.startsWith("text")))return;const e=t.getData("text"),i=window.getSelection().getRangeAt(0);i.deleteContents(),i.insertNode(document.createTextNode(e)),i.collapse(!1)}this.updateValue(this.$refs.contenteditable.innerHTML)}},updateValue(s){const t=this.parseContent(s).replace(/^\n$/,"");this.localValue=t,this.$emit("update:modelValue",t)},updateContent(s){const t=this.renderContent(s);this.$refs.contenteditable.innerHTML=t,this.localValue=s},onEnter(s){this.multiline||this.isOverMaxlength||this.tribute.isActive||this.isComposing||(s.preventDefault(),s.stopPropagation(),this.$emit("submit",s))},onCtrlEnter(s){this.isOverMaxlength||this.$emit("submit",s)},onKeyUp(s){s.stopImmediatePropagation()},onKeyEsc(s){this.tribute&&this.isAutocompleteOpen&&(s.stopImmediatePropagation(),this.tribute.hideMenu())},getTributeContainer(){return this.tribute.menu},getTributeSelectedItem(){return this.getTributeContainer().querySelector('.highlight [id^="nc-rich-contenteditable-tribute-item-"]')},onTributeActive(s){this.isAutocompleteOpen=s,s?(this.getTributeContainer().setAttribute("class",this.tribute.current.collection.containerClass||this.$style["tribute-container"]),this.setupTributeIntegration(),document.removeEventListener("click",this.hideTribute,!0)):(this.debouncedAutoComplete.clear(),this.autocompleteActiveId=void 0,this.setTributeFocusVisible(!1))},onTributeArrowKeyDown(){this.isAutocompleteOpen&&(this.setTributeFocusVisible(!0),this.onTributeSelectedItemWillChange())},onTributeSelectedItemWillChange(){requestAnimationFrame(()=>{this.autocompleteActiveId=this.getTributeSelectedItem()?.id})},setupTributeIntegration(){if(this.isTributeIntegrationDone)return;this.isTributeIntegrationDone=!0;const s=this.getTributeContainer();s.id=this.tributeId,s.setAttribute("role","listbox"),s.children[0].setAttribute("role","presentation"),this.tributeStyleMutationObserver=new MutationObserver(([{target:t}])=>{t.style.display!=="none"&&this.onTributeSelectedItemWillChange()}).observe(s,{attributes:!0,attributeFilter:["style"]}),s.addEventListener("mousemove",()=>{this.setTributeFocusVisible(!1),this.onTributeSelectedItemWillChange()},{passive:!0})},setTributeFocusVisible(s){s?this.getTributeContainer().classList.add(this.$style["tribute-container--focus-visible"]):this.getTributeContainer().classList.remove(this.$style["tribute-container--focus-visible"])},showTribute(s){this.focus();const t=this.tribute.collection.findIndex(e=>e.trigger===s);this.tribute.showMenuForCollection(this.$refs.contenteditable,t),this.updateValue(this.$refs.contenteditable.innerHTML),document.addEventListener("click",this.hideTribute,!0)},hideTribute(){this.tribute.hideMenu(),document.removeEventListener("click",this.hideTribute,!0)}}},Rt=["id","contenteditable","aria-labelledby","aria-placeholder","aria-controls","aria-expanded","aria-activedescendant","title"],Pt=["id"];function Wt(s,t,e,i,n,r){return E(),A("div",{class:O(["rich-contenteditable",s.$props.class])},[T("div",Q({id:e.id,ref:"contenteditable",class:[{"rich-contenteditable__input--empty":r.isEmptyValue,"rich-contenteditable__input--multiline":e.multiline,"rich-contenteditable__input--has-label":e.label,"rich-contenteditable__input--overflow":r.isOverMaxlength,"rich-contenteditable__input--disabled":e.disabled},"rich-contenteditable__input"],contenteditable:r.contenteditableAttributeValue,"aria-labelledby":e.label?i.labelId:void 0,"aria-placeholder":e.placeholder,"aria-multiline":"true",role:"textbox","aria-haspopup":"listbox","aria-autocomplete":"inline","aria-controls":i.tributeId,"aria-expanded":n.isAutocompleteOpen?"true":"false","aria-activedescendant":n.autocompleteActiveId,title:r.tooltipString},s.$attrs,{onFocus:t[0]||(t[0]=(...o)=>r.moveCursorToEnd&&r.moveCursorToEnd(...o)),onInput:t[1]||(t[1]=(...o)=>r.onInput&&r.onInput(...o)),onCompositionstart:t[2]||(t[2]=o=>n.isComposing=!0),onCompositionend:t[3]||(t[3]=o=>n.isComposing=!1),onKeydownCapture:t[4]||(t[4]=_((...o)=>r.onKeyEsc&&r.onKeyEsc(...o),["esc"])),onKeydown:[t[5]||(t[5]=_(I((...o)=>r.onEnter&&r.onEnter(...o),["exact"]),["enter"])),t[6]||(t[6]=_(I((...o)=>r.onCtrlEnter&&r.onCtrlEnter(...o),["ctrl","exact","stop","prevent"]),["enter"])),t[9]||(t[9]=_(I((...o)=>r.onTributeArrowKeyDown&&r.onTributeArrowKeyDown(...o),["exact","stop"]),["up"])),t[10]||(t[10]=_(I((...o)=>r.onTributeArrowKeyDown&&r.onTributeArrowKeyDown(...o),["exact","stop"]),["down"]))],onPaste:t[7]||(t[7]=(...o)=>r.onPaste&&r.onPaste(...o)),onKeyupCapture:t[8]||(t[8]=I((...o)=>r.onKeyUp&&r.onKeyUp(...o),["stop","prevent"])),onTributeActiveTrue:t[11]||(t[11]=o=>r.onTributeActive(!0)),onTributeActiveFalse:t[12]||(t[12]=o=>r.onTributeActive(!1))}),null,16,Rt),e.label?(E(),A("div",{key:0,id:i.labelId,class:"rich-contenteditable__label"},k(e.label),9,Pt)):W("",!0)],2)}const Ht={$style:Nt},ae=H(Ot,[["render",Wt],["__cssModules",Ht],["__scopeId","data-v-426785d7"]]);export{$t as NcAutoCompleteResult,gt as NcMentionBubble,ae as default};
|
||
//# sourceMappingURL=index-GnRymwze.chunk.mjs.map
|