@dialpad/dialtone 9.24.0 → 9.25.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/css/CHANGELOG.json +1 -1
- package/dist/css/dialtone.css +2 -2
- package/dist/tokens/android/java/tokens-dark.kt +1 -1
- package/dist/tokens/android/java/tokens-light.kt +1 -1
- package/dist/tokens/android/res/values/colors-dark.xml +1 -1
- package/dist/tokens/android/res/values/colors-light.xml +1 -1
- package/dist/tokens/android/res/values/dimens.xml +1 -1
- package/dist/tokens/css/variables-dark.css +1 -1
- package/dist/tokens/css/variables-light.css +1 -1
- package/dist/tokens/ios/tokens-dark.swift +1 -1
- package/dist/tokens/ios/tokens-light.swift +1 -1
- package/dist/tokens/less/variables-dark.less +1 -1
- package/dist/tokens/less/variables-light.less +1 -1
- package/dist/vue2/dialtone-vue.cjs +1 -1
- package/dist/vue2/dialtone-vue.js +2 -2
- package/dist/vue2/message_input.cjs +1 -1
- package/dist/vue2/message_input.js +44 -28
- package/dist/vue2/{rich_text_editor-tzOBsCIH.js → rich_text_editor-9sMob7ck.js} +5 -5
- package/dist/vue2/{rich_text_editor-hUaQyiPu.cjs → rich_text_editor-Eh5kYokw.cjs} +15 -15
- package/dist/vue2/types/components/rich_text_editor/extensions/mentions/suggestion.d.ts +1 -0
- package/dist/vue2/types/components/rich_text_editor/extensions/mentions/suggestion.d.ts.map +1 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts +2 -1
- package/dist/vue2/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/dist/vue3/dialtone-vue.cjs +1 -1
- package/dist/vue3/dialtone-vue.js +2 -2
- package/dist/vue3/message_input.cjs +1 -1
- package/dist/vue3/message_input.js +45 -26
- package/dist/vue3/{rich_text_editor-knDe1iDy.cjs → rich_text_editor-0HG24WVq.cjs} +1 -1
- package/dist/vue3/{rich_text_editor-5t4kYsh_.js → rich_text_editor-m9B5NpUj.js} +6 -6
- package/dist/vue3/types/components/rich_text_editor/extensions/mentions/suggestion.d.ts +1 -0
- package/dist/vue3/types/components/rich_text_editor/extensions/mentions/suggestion.d.ts.map +1 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts +3 -1
- package/dist/vue3/types/recipes/conversation_view/message_input/message_input.vue.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -94,4 +94,4 @@ img.ProseMirror-separator {
|
|
|
94
94
|
`,Kp="️",qp="";let hn=null,fn=null;function Wp(n){n===void 0&&(n=[]);const e={};se.groups=e;const t=new se;hn==null&&(hn=So(Fp)),fn==null&&(fn=So(zp)),S(t,"'",Yn),S(t,"{",Kt),S(t,"}",qt),S(t,"[",Ln),S(t,"]",Bn),S(t,"(",_n),S(t,")",Fn),S(t,"<",zn),S(t,">",Hn),S(t,"(",Vn),S(t,")",$n),S(t,"「",jn),S(t,"」",Kn),S(t,"『",qn),S(t,"』",Wn),S(t,"<",Un),S(t,">",Jn),S(t,"&",Gn),S(t,"*",Xn),S(t,"@",He),S(t,"`",Zn),S(t,"^",er),S(t,":",$e),S(t,",",Qi),S(t,"$",tr),S(t,".",Se),S(t,"=",nr),S(t,"!",Zi),S(t,"-",xe),S(t,"%",rr),S(t,"|",ir),S(t,"+",sr),S(t,"#",or),S(t,"?",lr),S(t,'"',es),S(t,"/",Ce),S(t,";",ts),S(t,"~",Wt),S(t,"_",ar),S(t,"\\",Qn);const r=ue(t,Yr,Yi,{[Si]:!0});ue(r,Yr,r);const i=ue(t,mt,Ae,{[xi]:!0});ue(i,mt,i);const s=ue(t,Jr,Ti,{[Ci]:!0});ue(s,mt),ue(s,Jr,s);const o=ue(t,bo,Sa,{[go]:!0});S(t,ko,Xi,{[go]:!0}),S(o,ko),ue(o,bo,o);const l=ue(t,Gr,xa,{[ka]:!0});ue(l,Gr,l),S(l,Kp,l);const a=S(l,qp);ue(a,Gr,l);const c=[[mt,i]],d=[[mt,null],[Jr,s]];for(let u=0;u<hn.length;u++)_e(t,hn[u],Mi,Ae,c);for(let u=0;u<fn.length;u++)_e(t,fn[u],wi,Ti,d);it(Mi,{tld:!0,ascii:!0},e),it(wi,{utld:!0,alpha:!0},e),_e(t,"file",Sn,Ae,c),_e(t,"mailto",Sn,Ae,c),_e(t,"http",bt,Ae,c),_e(t,"https",bt,Ae,c),_e(t,"ftp",bt,Ae,c),_e(t,"ftps",bt,Ae,c),it(Sn,{scheme:!0,ascii:!0},e),it(bt,{slashscheme:!0,ascii:!0},e),n=n.sort((u,h)=>u[0]>h[0]?1:-1);for(let u=0;u<n.length;u++){const h=n[u][0],p=n[u][1]?{[Hp]:!0}:{[Vp]:!0};h.indexOf("-")>=0?p[Ei]=!0:mt.test(h)?Yr.test(h)?p[kn]=!0:p[xi]=!0:p[Si]=!0,yo(t,h,h,p)}return yo(t,"localhost",rn,{ascii:!0}),t.jd=new se(cr),{start:t,tokens:Nt({groups:e},Ca)}}function Up(n,e){const t=Jp(e.replace(/[A-Z]/g,l=>l.toLowerCase())),r=t.length,i=[];let s=0,o=0;for(;o<r;){let l=n,a=null,c=0,d=null,u=-1,h=-1;for(;o<r&&(a=l.go(t[o]));)l=a,l.accepts()?(u=0,h=0,d=l):u>=0&&(u+=t[o].length,h++),c+=t[o].length,s+=t[o].length,o++;s-=u,o-=h,c-=u,i.push({t:d.t,v:e.slice(s-c,s),s:s-c,e:s})}return i}function Jp(n){const e=[],t=n.length;let r=0;for(;r<t;){let i=n.charCodeAt(r),s,o=i<55296||i>56319||r+1===t||(s=n.charCodeAt(r+1))<56320||s>57343?n[r]:n.slice(r,r+2);e.push(o),r+=o.length}return e}function _e(n,e,t,r,i){let s;const o=e.length;for(let l=0;l<o-1;l++){const a=e[l];n.j[a]?s=n.j[a]:(s=new se(r),s.jr=i.slice(),n.j[a]=s),n=s}return s=new se(t),s.jr=i.slice(),n.j[e[o-1]]=s,s}function So(n){const e=[],t=[];let r=0,i="0123456789";for(;r<n.length;){let s=0;for(;i.indexOf(n[r+s])>=0;)s++;if(s>0){e.push(t.join(""));for(let o=parseInt(n.substring(r,r+s),10);o>0;o--)t.pop();r+=s}else t.push(n[r]),r++}return e}const sn={defaultProtocol:"http",events:null,format:xo,formatHref:xo,nl2br:!1,tagName:"a",target:null,rel:null,validate:!0,truncate:1/0,className:null,attributes:null,ignoreTags:[],render:null};function ns(n,e){e===void 0&&(e=null);let t=Nt({},sn);n&&(t=Nt(t,n instanceof ns?n.o:n));const r=t.ignoreTags,i=[];for(let s=0;s<r.length;s++)i.push(r[s].toUpperCase());this.o=t,e&&(this.defaultRender=e),this.ignoreTags=i}ns.prototype={o:sn,ignoreTags:[],defaultRender(n){return n},check(n){return this.get("validate",n.toString(),n)},get(n,e,t){const r=e!=null;let i=this.o[n];return i&&(typeof i=="object"?(i=t.t in i?i[t.t]:sn[n],typeof i=="function"&&r&&(i=i(e,t))):typeof i=="function"&&r&&(i=i(e,t.t,t)),i)},getObj(n,e,t){let r=this.o[n];return typeof r=="function"&&e!=null&&(r=r(e,t.t,t)),r},render(n){const e=n.render(this);return(this.get("render",null,n)||this.defaultRender)(e,n.t,n)}};function xo(n){return n}function Ea(n,e){this.t="token",this.v=n,this.tk=e}Ea.prototype={isLink:!1,toString(){return this.v},toHref(n){return this.toString()},toFormattedString(n){const e=this.toString(),t=n.get("truncate",e,this),r=n.get("format",e,this);return t&&r.length>t?r.substring(0,t)+"…":r},toFormattedHref(n){return n.get("formatHref",this.toHref(n.get("defaultProtocol")),this)},startIndex(){return this.tk[0].s},endIndex(){return this.tk[this.tk.length-1].e},toObject(n){return n===void 0&&(n=sn.defaultProtocol),{type:this.t,value:this.toString(),isLink:this.isLink,href:this.toHref(n),start:this.startIndex(),end:this.endIndex()}},toFormattedObject(n){return{type:this.t,value:this.toFormattedString(n),isLink:this.isLink,href:this.toFormattedHref(n),start:this.startIndex(),end:this.endIndex()}},validate(n){return n.get("validate",this.toString(),this)},render(n){const e=this,t=this.toHref(n.get("defaultProtocol")),r=n.get("formatHref",t,this),i=n.get("tagName",t,e),s=this.toFormattedString(n),o={},l=n.get("className",t,e),a=n.get("target",t,e),c=n.get("rel",t,e),d=n.getObj("attributes",t,e),u=n.getObj("events",t,e);return o.href=r,l&&(o.class=l),a&&(o.target=a),c&&(o.rel=c),d&&Nt(o,d),{tagName:i,attributes:o,content:s,eventListeners:u}}};function Mr(n,e){class t extends Ea{constructor(i,s){super(i,s),this.t=n}}for(const r in e)t.prototype[r]=e[r];return t.t=n,t}const Co=Mr("email",{isLink:!0,toHref(){return"mailto:"+this.toString()}}),Eo=Mr("text"),Gp=Mr("nl"),pn=Mr("url",{isLink:!0,toHref(n){return n===void 0&&(n=sn.defaultProtocol),this.hasProtocol()?this.v:`${n}://${this.v}`},hasProtocol(){const n=this.tk;return n.length>=2&&n[0].t!==rn&&n[1].t===$e}}),he=n=>new se(n);function Yp(n){let{groups:e}=n;const t=e.domain.concat([Gn,Xn,He,Qn,Zn,er,tr,nr,xe,Yi,rr,ir,sr,or,Ce,cr,Wt,ar]),r=[Yn,$e,Qi,Se,Zi,lr,es,ts,zn,Hn,Kt,qt,Bn,Ln,_n,Fn,Vn,$n,jn,Kn,qn,Wn,Un,Jn],i=[Gn,Yn,Xn,Qn,Zn,er,tr,nr,xe,Kt,qt,rr,ir,sr,or,lr,Ce,cr,Wt,ar],s=he(),o=S(s,Wt);A(o,i,o),A(o,e.domain,o);const l=he(),a=he(),c=he();A(s,e.domain,l),A(s,e.scheme,a),A(s,e.slashscheme,c),A(l,i,o),A(l,e.domain,l);const d=S(l,He);S(o,He,d),S(a,He,d),S(c,He,d);const u=S(o,Se);A(u,i,o),A(u,e.domain,o);const h=he();A(d,e.domain,h),A(h,e.domain,h);const f=S(h,Se);A(f,e.domain,h);const p=he(Co);A(f,e.tld,p),A(f,e.utld,p),S(d,rn,p);const g=S(h,xe);A(g,e.domain,h),A(p,e.domain,h),S(p,Se,f),S(p,xe,g);const y=S(p,$e);A(y,e.numeric,Co);const b=S(l,xe),C=S(l,Se);A(b,e.domain,l),A(C,i,o),A(C,e.domain,l);const M=he(pn);A(C,e.tld,M),A(C,e.utld,M),A(M,e.domain,l),A(M,i,o),S(M,Se,C),S(M,xe,b),S(M,He,d);const P=S(M,$e),L=he(pn);A(P,e.numeric,L);const T=he(pn),B=he();A(T,t,T),A(T,r,B),A(B,t,T),A(B,r,B),S(M,Ce,T),S(L,Ce,T);const R=S(a,$e),w=S(c,$e),J=S(w,Ce),ge=S(J,Ce);A(a,e.domain,l),S(a,Se,C),S(a,xe,b),A(c,e.domain,l),S(c,Se,C),S(c,xe,b),A(R,e.domain,T),S(R,Ce,T),A(ge,e.domain,T),A(ge,t,T),S(ge,Ce,T);const et=[[Kt,qt],[Ln,Bn],[_n,Fn],[zn,Hn],[Vn,$n],[jn,Kn],[qn,Wn],[Un,Jn]];for(let It=0;It<et.length;It++){const[Re,Pe]=et[It],Le=S(T,Re);S(B,Re,Le),S(Le,Pe,T);const le=he(pn);A(Le,t,le);const Be=he();A(Le,r),A(le,t,le),A(le,r,Be),A(Be,t,le),A(Be,r,Be),S(le,Pe,T),S(Be,Pe,T)}return S(s,rn,M),S(s,Xi,Gp),{start:s,tokens:Ca}}function Xp(n,e,t){let r=t.length,i=0,s=[],o=[];for(;i<r;){let l=n,a=null,c=null,d=0,u=null,h=-1;for(;i<r&&!(a=l.go(t[i].t));)o.push(t[i++]);for(;i<r&&(c=a||l.go(t[i].t));)a=null,l=c,l.accepts()?(h=0,u=l):h>=0&&h++,i++,d++;if(h<0)i-=d,i<r&&(o.push(t[i]),i++);else{o.length>0&&(s.push(Xr(Eo,e,o)),o=[]),i-=h,d-=h;const f=u.t,p=t.slice(i-d,i);s.push(Xr(f,e,p))}}return o.length>0&&s.push(Xr(Eo,e,o)),s}function Xr(n,e,t){const r=t[0].s,i=t[t.length-1].e,s=e.slice(r,i);return new n(s,t)}const Qp=typeof console<"u"&&console&&console.warn||(()=>{}),Zp="until manual call of linkify.init(). Register all schemes and plugins before invoking linkify the first time.",F={scanner:null,parser:null,tokenQueue:[],pluginQueue:[],customSchemes:[],initialized:!1};function em(){se.groups={},F.scanner=null,F.parser=null,F.tokenQueue=[],F.pluginQueue=[],F.customSchemes=[],F.initialized=!1}function To(n,e){if(e===void 0&&(e=!1),F.initialized&&Qp(`linkifyjs: already initialized - will not register custom scheme "${n}" ${Zp}`),!/^[0-9a-z]+(-[0-9a-z]+)*$/.test(n))throw new Error(`linkifyjs: incorrect scheme format.
|
|
95
95
|
1. Must only contain digits, lowercase ASCII letters or "-"
|
|
96
96
|
2. Cannot start or end with "-"
|
|
97
|
-
3. "-" cannot repeat`);F.customSchemes.push([n,e])}function tm(){F.scanner=Wp(F.customSchemes);for(let n=0;n<F.tokenQueue.length;n++)F.tokenQueue[n][1]({scanner:F.scanner});F.parser=Yp(F.scanner.tokens);for(let n=0;n<F.pluginQueue.length;n++)F.pluginQueue[n][1]({scanner:F.scanner,parser:F.parser});F.initialized=!0}function nm(n){return F.initialized||tm(),Xp(F.parser.start,n,Up(F.scanner.start,n))}function rs(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new ns(t),i=nm(n),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}function rm(n){return new U({key:new ee("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=ca(t.doc,[...e]);if(ha(l).forEach(({newRange:c})=>{const d=da(r.doc,c,f=>f.isTextblock);let u,h;if(d.length>1?(u=d[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ")):d.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(u=d[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")),u&&h){const f=h.split(" ").filter(y=>y!=="");if(f.length<=0)return!1;const p=f[f.length-1],g=u.pos+h.lastIndexOf(p);if(!p)return!1;rs(p).filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate?n.validate(y.value):!0).forEach(y=>{Tr(y.from,y.to,r.doc).some(b=>b.mark.type===n.type)||o.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function im(n){return new U({key:new ee("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||r.target.nodeName!=="A")return!1;const l=ua(e.state,n.type.name),a=r.target,c=(i=a==null?void 0:a.href)!==null&&i!==void 0?i:l.href,d=(s=a==null?void 0:a.target)!==null&&s!==void 0?s:l.target;return a&&c?(e.editable&&window.open(c,d),!0):!1}}})}function sm(n){return new U({key:new ee("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=rs(l).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(n.editor.commands.setMark(n.type,{href:a.href}),!0)}}})}const om=me.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){To(n);return}To(n.scheme,n.optionalSlashes)})},onDestroy(){em()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",z(this.options.HTMLAttributes,{...n,href:""}),0]:["a",z(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[At({find:(n,e)=>{var t;const r=(t=e==null?void 0:e.clipboardData)===null||t===void 0?void 0:t.getData("text/html"),i=[];if(r){const s=new DOMParser().parseFromString(r,"text/html"),o=s.querySelectorAll("a");o.length&&[...o].forEach(l=>i.push({text:l.innerText,data:{href:l.getAttribute("href")},index:s.body.innerText.indexOf(l.innerText)+l.innerText.length}))}if(n){const s=rs(n).filter(o=>o.isLink);s.length&&s.forEach(o=>i.push({text:o.value,data:{href:o.href},index:o.start}))}return i},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(rm({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(im({type:this.type})),this.options.linkOnPaste&&n.push(sm({editor:this.editor,type:this.type})),n}}),lm=Q.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",z(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),am=Q.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",z(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Mo=me.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",z(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Er(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),wo=/^(\d+)\.\s$/,cm=Q.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",z(this.options.HTMLAttributes,t),0]:["ol",z(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(am.name,this.editor.getAttributes(Mo.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=nn({find:wo,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=nn({find:wo,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mo.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),dm=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,um=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,hm=me.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",z(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){const n={};return Ui()?n["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():n["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),n},addInputRules(){return[tn({find:dm,type:this.type})]},addPasteRules(){return[At({find:um,type:this.type})]}}),fm=me.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",z(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),pm=Q.create({name:"text",group:"inline"}),mm=de.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>n.style.textAlign||this.options.defaultAlignment,renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.every(t=>e.updateAttributes(t,{textAlign:n})):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.every(e=>n.resetAttributes(e,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),gm={name:"EmojiComponent",components:{NodeViewWrapper:ga,DtEmoji:X.DtEmoji},props:ya};function ym(n,e,t,r,i,s){const o=m.resolveComponent("dt-emoji"),l=m.resolveComponent("node-view-wrapper");return m.openBlock(),m.createBlock(l,{class:"d-d-inline-block d-va-bottom d-lh0"},{default:m.withCtx(()=>[m.createVNode(o,{size:"500",code:n.node.attrs.code},null,8,["code"])]),_:1})}const bm=v._export_sfc(gm,[["render",ym]]);function km(n){var e;const{char:t,allowSpaces:r,allowedPrefixes:i,startOfLine:s,$position:o}=n,l=up(t),a=new RegExp(`\\s${l}$`),c=s?"^":"",d=r?new RegExp(`${c}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${c}(?:^)?${l}[^\\s${l}]*`,"gm"),u=((e=o.nodeBefore)===null||e===void 0?void 0:e.isText)&&o.nodeBefore.text;if(!u)return null;const h=o.pos-u.length,f=Array.from(u.matchAll(d)).pop();if(!f||f.input===void 0||f.index===void 0)return null;const p=f.input.slice(Math.max(0,f.index-1),f.index),g=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(p);if(i!==null&&!g)return null;const y=h+f.index;let b=y+f[0].length;return r&&a.test(u.slice(b-1,b+1))&&(f[0]+=" ",b+=1),y<o.pos&&b>=o.pos?{range:{from:y,to:b},query:f[0].slice(t.length),text:f[0]}:null}const Sm=new ee("suggestion");function Ta({pluginKey:n=Sm,editor:e,char:t="@",allowSpaces:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:o="span",decorationClass:l="suggestion",command:a=()=>null,items:c=()=>[],render:d=()=>({}),allow:u=()=>!0}){let h;const f=d==null?void 0:d(),p=new U({key:n,view(){return{update:async(g,y)=>{var b,C,M,P,L,T,B;const R=(b=this.key)===null||b===void 0?void 0:b.getState(y),w=(C=this.key)===null||C===void 0?void 0:C.getState(g.state),J=R.active&&w.active&&R.range.from!==w.range.from,ge=!R.active&&w.active,et=R.active&&!w.active,It=!ge&&!et&&R.query!==w.query,Re=ge||J,Pe=It&&!J,Le=et||J;if(!Re&&!Pe&&!Le)return;const le=Le&&!Re?R:w,Be=g.dom.querySelector(`[data-decoration-id="${le.decorationId}"]`);h={editor:e,range:le.range,query:le.query,text:le.text,items:[],command:Rt=>{a({editor:e,range:le.range,props:Rt})},decorationNode:Be,clientRect:Be?()=>{var Rt;const{decorationId:va}=(Rt=this.key)===null||Rt===void 0?void 0:Rt.getState(e.state),wr=g.dom.querySelector(`[data-decoration-id="${va}"]`);return(wr==null?void 0:wr.getBoundingClientRect())||null}:null},Re&&((M=f==null?void 0:f.onBeforeStart)===null||M===void 0||M.call(f,h)),Pe&&((P=f==null?void 0:f.onBeforeUpdate)===null||P===void 0||P.call(f,h)),(Pe||Re)&&(h.items=await c({editor:e,query:le.query})),Le&&((L=f==null?void 0:f.onExit)===null||L===void 0||L.call(f,h)),Pe&&((T=f==null?void 0:f.onUpdate)===null||T===void 0||T.call(f,h)),Re&&((B=f==null?void 0:f.onStart)===null||B===void 0||B.call(f,h))},destroy:()=>{var g;h&&((g=f==null?void 0:f.onExit)===null||g===void 0||g.call(f,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(g,y,b,C){const{isEditable:M}=e,{composing:P}=e.view,{selection:L}=g,{empty:T,from:B}=L,R={...y};if(R.composing=P,M&&(T||e.view.composing)){(B<y.range.from||B>y.range.to)&&!P&&!y.composing&&(R.active=!1);const w=km({char:t,allowSpaces:r,allowedPrefixes:i,startOfLine:s,$position:L.$from}),J=`id_${Math.floor(Math.random()*4294967295)}`;w&&u({editor:e,state:C,range:w.range})?(R.active=!0,R.decorationId=y.decorationId?y.decorationId:J,R.range=w.range,R.query=w.query,R.text=w.text):R.active=!1}else R.active=!1;return R.active||(R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null),R}},props:{handleKeyDown(g,y){var b;const{active:C,range:M}=p.getState(g.state);return C&&((b=f==null?void 0:f.onKeyDown)===null||b===void 0?void 0:b.call(f,{view:g,event:y,range:M}))||!1},decorations(g){const{active:y,range:b,decorationId:C}=p.getState(g);return y?H.create(g.doc,[ce.inline(b.from,b.to,{nodeName:o,class:l,"data-decoration-id":C})]):null}}});return p}const xm={name:"SuggestionList",components:{DtListItem:$o},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:n}){return n.key==="ArrowUp"?(this.upHandler(),!0):n.key==="ArrowDown"?(this.downHandler(),!0):n.key==="Enter"?(this.enterHandler(),n.stopPropagation(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},scrollActiveElementIntoView(){const n=this.$refs.suggestionList.querySelector(".dt-list-item--highlighted");n&&n.scrollIntoView({behaviour:"smooth",block:"center"})},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(n){const e=this.items[n];switch(this.itemType){case"emoji":this.command(e);return;case"mention":this.command({name:e.name,id:e.contactId,avatarSrc:e.avatarSrc});break}}}},Cm={class:"d-popover__dialog"},Em={ref:"suggestionList",class:"dt-suggestion-list"};function Tm(n,e,t,r,i,s){const o=m.resolveComponent("dt-list-item");return m.openBlock(),m.createElementBlock("div",Cm,[m.withDirectives(m.createElementVNode("ul",Em,[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(t.items,(l,a)=>(m.openBlock(),m.createBlock(o,{key:l.id,class:m.normalizeClass(["dt-suggestion-list--item",{"dt-list-item--highlighted":a===i.selectedIndex}]),"navigation-type":"arrow-keys",onClick:c=>s.selectItem(a),onKeydown:m.withModifiers(s.onKeyDown,["prevent","stop"])},{default:m.withCtx(()=>[(m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.itemComponent),{item:l},null,8,["item"]))]),_:2},1032,["class","onClick","onKeydown"]))),128))],512),[[m.vShow,t.items.length]])])}const Ma=v._export_sfc(xm,[["render",Tm]]),Mm={name:"EmojiSuggestion",components:{DtEmoji:X.DtEmoji,DtStack:Ai},props:{item:{type:Object,required:!0}}};function wm(n,e,t,r,i,s){const o=m.resolveComponent("dt-emoji"),l=m.resolveComponent("dt-stack");return m.openBlock(),m.createBlock(l,{direction:"row",gap:"400"},{default:m.withCtx(()=>[m.createVNode(o,{size:"200",code:t.item.code},null,8,["code"]),m.createTextVNode(" "+m.toDisplayString(t.item.code),1)]),_:1})}const Om=v._export_sfc(Mm,[["render",wm]]),vm={items:({query:n})=>n.length<2?[]:Object.values(X.emojisIndexed).filter(function(r){return!!r.shortname.substring(1,r.shortname.length-1).startsWith(n.toLowerCase())}).map(r=>({id:r.unicode_character,code:r.shortname})),command:({editor:n,range:e,props:t})=>{var s,o;const r=n.view.state.selection.$to.nodeAfter;((s=r==null?void 0:r.text)==null?void 0:s.startsWith(" "))&&(e.to+=1),n.chain().focus().insertContentAt(e,[{type:"emoji",attrs:t},{type:"text",text:" "}]).run(),(o=window.getSelection())==null||o.collapseToEnd()},render:()=>{let n,e;return{onStart:t=>{n=new Gi(Ma,{props:{itemComponent:m.markRaw(Om),itemType:"emoji",...t},editor:t.editor}),t.clientRect&&(e=v.tippy("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",contentElement:null,zIndex:650}))},onUpdate(t){n.updateProps(t),t.clientRect&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var r;return t.event.key==="Escape"?(e[0].hide(),!0):(r=n.ref)==null?void 0:r.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},Am=new ee("emoji"),Nm=/:\w+:$/,Dm=/:\w+:/g,Im=/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])$/,Rm=/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g,Oo=n=>{if(n&&X.codeToEmojiData(n[0]))return{index:n.index,text:n[0],match:n}},Pm=n=>[...n.matchAll(Dm)].filter(t=>X.codeToEmojiData(t[0])).map(t=>({index:t.index,text:t[0],match:t})),Lm=Q.create({addOptions(){return{HTMLAttributes:{},suggestion:{char:":",pluginKey:Am}}},name:"emoji",group:"inline",inline:!0,selectable:!0,addNodeView(){return ba(bm)},addAttributes(){return{code:{default:null},id:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:n}){return n.attrs.code},renderHTML({HTMLAttributes:n}){return["emoji-component",z(this.options.HTMLAttributes,n)]},addInputRules(){return[co({find:n=>{const e=n.match(Nm);return Oo(e)},type:this.type,getAttributes(n){return{code:n[0]}}}),co({find:n=>{const e=n.match(Im);return Oo(e)},type:this.type,getAttributes(n){const e=X.shortcodeToEmojiData(n[0]).unicode_output;return{code:String.fromCodePoint(parseInt(e,16)),label:"emoji"}}})]},addPasteRules(){return[ho({find:Pm,type:this.type,getAttributes(n){return{code:n[0]}}}),ho({find:Rm,type:this.type,getAttributes(n){return{code:n[0]}}})]},addProseMirrorPlugins(){return[Ta({editor:this.editor,...this.options.suggestion,...vm})]}});function Bm(n,e,t=()=>!0){const r=[];e.lastIndex=0;let i;for(;i=e.exec(n);)t(n,i)&&r.push(i);return r}function _m(n,e){return!["#","@"].includes(n.charAt(e.index))&&!["#","@"].includes(n.charAt(e.index-1))}function Fm(n){const e=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return n.replace(e,"")}function zm(n,e){const t=n.slice(0,e+1).search(/\S+\s*$/),r=n.slice(e).search(/\s/);if(r<0){const i=n.slice(t);return{text:i,from:t,to:t+i.length}}return{text:n.slice(t,r+e),from:t,to:r+e}}function Oi(n,e,t,r){const i=zm(n,e);if(r.lastIndex=0,!r.test(i.text))return i;const s=t==="left"?i.from-1:i.to+1;return s<=0||s>=n.length||s===e?i:Oi(n,s,t,r)}function Hm(n,e,t,r){const i=Math.max(n.from-1,0),s=Math.min(n.to+1,e.content.size),o=Tr(i,s,e);for(const l of o)l.mark.type===r&&t.removeMark(l.from,l.to,r)}const vo=v.getPhoneNumberRegex(1,15);function Ao(n,e,t,r,i,s){if(!n)return;let o=t-e-1;o=o<0?0:o;const l=r-e,a=Oi(n,o,"left",vo),c=Oi(n,l,"right",vo),d=n.slice(a.from,c.to);Bm(d,v.linkRegex,_m).forEach(h=>{const f=Fm(h[0]),p=e+a.from+h.index+1,g=p+f.length;i.addMark(p,g,s.create())})}function Vm(n){let e=!1;return new U({key:new ee("autolink"),appendTransaction:(t,r,i)=>{const s=t.some(d=>d.docChanged)&&!r.doc.eq(i.doc);if(e&&!s)return;const{tr:o}=i,{textContent:l}=i.doc;e||Ao(l,0,0,l.length,o,n.type),e=!0;const a=ca(r.doc,[...t]);return ha(a).forEach(({oldRange:d,newRange:u})=>{Hm(u,i.doc,o,n.type),da(i.doc,u,f=>f.isTextblock).forEach(({node:f,pos:p})=>{Ao(f.textContent,p,d.from,u.to,o,n.type)})}),o}})}const $m={class:"d-link d-c-text d-d-inline-block",rel:"noopener noreferrer nofollow"},jm=me.create({name:"Link",renderHTML({HTMLAttributes:n}){return["a",z(this.options.HTMLAttributes,n,$m),0]},renderText({node:n}){return n.attrs.text},addProseMirrorPlugins(){return[Vm({type:this.type})]}}),Km=new ee("mention"),qm=Q.create({name:"mention",addOptions(){return{HTMLAttributes:{},renderLabel({options:n,node:e}){var t;return`${n.suggestion.char}${(t=e.attrs.label)!==null&&t!==void 0?t:e.attrs.id}`},suggestion:{char:"@",pluginKey:Km,command:({editor:n,range:e,props:t})=>{var r,i;const s=n.view.state.selection.$to.nodeAfter;((r=s==null?void 0:s.text)===null||r===void 0?void 0:r.startsWith(" "))&&(e.to+=1),n.chain().focus().insertContentAt(e,[{type:this.name,attrs:t},{type:"text",text:" "}]).run(),(i=window.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:n,range:e})=>{const t=n.doc.resolve(e.from),r=n.schema.nodes[this.name];return!!t.parent.type.contentMatch.matchType(r)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){return["span",z({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n})]},renderText({node:n}){return this.options.renderLabel({options:this.options,node:n})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:r}=e,{empty:i,anchor:s}=r;return i?(e.doc.nodesBetween(s-1,s,(o,l)=>{if(o.type.name===this.name)return t=!0,n.insertText(this.options.suggestion.char||"",l,l+o.nodeSize),!1}),t):!1})}},addProseMirrorPlugins(){return[Ta({editor:this.editor,...this.options.suggestion})]}}),Wm={name:"MentionComponent",components:{NodeViewWrapper:ga,DtLink:_o},props:ya,computed:{text(){return"@"+this.$props.node.attrs.name}}};function Um(n,e,t,r,i,s){const o=m.resolveComponent("dt-link"),l=m.resolveComponent("node-view-wrapper");return m.openBlock(),m.createBlock(l,{class:"d-d-inline-block"},{default:m.withCtx(()=>[m.createVNode(o,{kind:"mention"},{default:m.withCtx(()=>[m.createTextVNode(m.toDisplayString(s.text),1)]),_:1})]),_:1})}const Jm=v._export_sfc(Wm,[["render",Um]]),Gm=qm.extend({addNodeView(){return ba(Jm)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""}}},renderText({node:n}){return"@ "+n.attrs.name},renderHTML({HTMLAttributes:n}){return["mention-component",z(this.options.HTMLAttributes,n),0]}}),wa=["text","json","html"],Oa=["start","end","all"],Ym=["https","http","ftp","ftps","sftp","mailto"],Xm={name:"MentionSuggestion",components:{DtAvatar:Bo,DtStack:Ai},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc}}};function Qm(n,e,t,r,i,s){const o=m.resolveComponent("dt-avatar"),l=m.resolveComponent("dt-stack");return m.openBlock(),m.createBlock(l,{direction:"row",gap:"400"},{default:m.withCtx(()=>[m.createVNode(o,{"full-name":s.name,"image-src":s.avatarSrc,"image-alt":"",size:"xs"},null,8,["full-name","image-src"]),m.createTextVNode(" "+m.toDisplayString(s.name),1)]),_:1})}const Zm=v._export_sfc(Xm,[["render",Qm]]),eg={render:()=>{let n,e;return{onStart:t=>{n=new Gi(Ma,{props:{itemComponent:m.markRaw(Zm),itemType:"mention",...t},editor:t.editor}),t.clientRect&&(e=v.tippy("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"}))},onUpdate(t){n.updateProps(t),t.clientRect&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var r;return t.event.key==="Escape"?(e[0].hide(),!0):(r=n.ref)==null?void 0:r.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},tg={name:"DtRichTextEditor",components:{EditorContent:mp},props:{modelValue:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(n){return typeof n=="string"?Oa.includes(n):!0}},outputFormat:{type:String,default:"text",validator(n){return wa.includes(n)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null}},emits:["input","update:modelValue","blur","focus"],data(){return{editor:null,popoverOpened:!1}},computed:{extensions(){const n=[bp,Np,Ip,Cp,_p,lm,Tp,hm,pm,fm];if(this.link&&n.push(this.getExtension(jm,this.link)),n.push(Mp.configure({placeholder:this.placeholder})),this.allowLineBreaks||n.push(Ep.extend({addKeyboardShortcuts(){return{Enter:()=>!0,"Shift-Enter":()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])}}})),n.push(om.extend({inclusive:!1}).configure({autolink:!0,protocols:Ym})),this.mentionSuggestion){const e={...this.mentionSuggestion,...eg};n.push(Gm.configure({suggestion:e}))}return n.push(Lm),n.push(mm.configure({types:["paragraph"],defaultAlignment:"left"})),n.push(xp.configure({HTMLAttributes:{class:"dt-rich-text-editor--code-block"}})),n.push(cm.configure({itemTypeName:"listItem"})),n},inputAttrs(){const n={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(n["aria-readonly"]=!0),n}},watch:{editable(n){this.editor.setEditable(n),this.updateEditorAttributes({"aria-readonly":!n})},inputClass(n){this.updateEditorAttributes({class:n})},inputAriaLabel(n){this.updateEditorAttributes({"aria-label":n})},extensions(){this.destroyEditor(),this.createEditor()},modelValue(n){let e=this.getOutput();this.outputFormat==="json"&&(n=JSON.stringify(n),e=JSON.stringify(e)),n!==e&&this.editor.commands.setContent(n,!1)}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},methods:{createEditor(){this.editor=new pp({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,editorProps:{attributes:{...this.inputAttrs,class:this.inputClass}}}),this.addEditorListeners()},destroyEditor(){this.editor.destroy()},addEditorListeners(){this.editor.on("update",()=>{const n=this.getOutput();this.$emit("input",n),this.$emit("update:modelValue",n)}),this.editor.on("focus",({event:n})=>{this.$emit("focus",n)}),this.editor.on("blur",({event:n})=>{this.$emit("blur",n)})},getOutput(){switch(this.outputFormat){case"json":return this.editor.getJSON();case"html":return this.editor.getHTML();case"text":default:return this.editor.getText()}},getExtension(n,e){var t;return typeof e=="boolean"?n:(t=n.configure)==null?void 0:t.call(n,e)},updateEditorAttributes(n){this.editor.setOptions({editorProps:{attributes:n}})},focusEditor(){this.editor.commands.focus()}}};function ng(n,e,t,r,i,s){const o=m.resolveComponent("editor-content");return m.openBlock(),m.createBlock(o,{editor:i.editor,"data-qa":"dt-rich-text-editor",class:"dt-rich-text-editor"},null,8,["editor"])}const rg=v._export_sfc(tg,[["render",ng]]);exports.AVATAR_COLORS=Lo;exports.AVATAR_GROUP_VALIDATOR=Zr;exports.AVATAR_ICON_SIZES=Po;exports.AVATAR_KIND_MODIFIERS=Io;exports.AVATAR_PRESENCE_SIZE_MODIFIERS=Ro;exports.AVATAR_PRESENCE_STATES=Qr;exports.AVATAR_SIZE_MODIFIERS=mn;exports.DT_STACK_DIRECTION=Ge;exports.DT_STACK_GAP=dr;exports.DT_STACK_RESPONSIVE_BREAKPOINTS=vi;exports.DtAvatar=Bo;exports.DtItemLayout=ei;exports.DtLink=_o;exports.DtListItem=$o;exports.DtPopover=fc;exports.DtPresence=Do;exports.DtRichTextEditor=rg;exports.DtStack=Ai;exports.LIST_ITEM_NAVIGATION_TYPES=Lt;exports.LIST_ITEM_TYPES=gn;exports.Modal=Vo;exports.PRESENCE_STATES=kt;exports.PRESENCE_STATES_LIST=No;exports.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES=Oa;exports.RICH_TEXT_EDITOR_OUTPUT_FORMATS=wa;exports.SrOnlyCloseButton=zo;exports.SrOnlyCloseButtonMixin=Fo;
|
|
97
|
+
3. "-" cannot repeat`);F.customSchemes.push([n,e])}function tm(){F.scanner=Wp(F.customSchemes);for(let n=0;n<F.tokenQueue.length;n++)F.tokenQueue[n][1]({scanner:F.scanner});F.parser=Yp(F.scanner.tokens);for(let n=0;n<F.pluginQueue.length;n++)F.pluginQueue[n][1]({scanner:F.scanner,parser:F.parser});F.initialized=!0}function nm(n){return F.initialized||tm(),Xp(F.parser.start,n,Up(F.scanner.start,n))}function rs(n,e,t){if(e===void 0&&(e=null),t===void 0&&(t=null),e&&typeof e=="object"){if(t)throw Error(`linkifyjs: Invalid link type ${e}; must be a string`);t=e,e=null}const r=new ns(t),i=nm(n),s=[];for(let o=0;o<i.length;o++){const l=i[o];l.isLink&&(!e||l.t===e)&&r.check(l)&&s.push(l.toFormattedObject(r))}return s}function rm(n){return new U({key:new ee("autolink"),appendTransaction:(e,t,r)=>{const i=e.some(c=>c.docChanged)&&!t.doc.eq(r.doc),s=e.some(c=>c.getMeta("preventAutolink"));if(!i||s)return;const{tr:o}=r,l=ca(t.doc,[...e]);if(ha(l).forEach(({newRange:c})=>{const d=da(r.doc,c,f=>f.isTextblock);let u,h;if(d.length>1?(u=d[0],h=r.doc.textBetween(u.pos,u.pos+u.node.nodeSize,void 0," ")):d.length&&r.doc.textBetween(c.from,c.to," "," ").endsWith(" ")&&(u=d[0],h=r.doc.textBetween(u.pos,c.to,void 0," ")),u&&h){const f=h.split(" ").filter(y=>y!=="");if(f.length<=0)return!1;const p=f[f.length-1],g=u.pos+h.lastIndexOf(p);if(!p)return!1;rs(p).filter(y=>y.isLink).map(y=>({...y,from:g+y.start+1,to:g+y.end+1})).filter(y=>r.schema.marks.code?!r.doc.rangeHasMark(y.from,y.to,r.schema.marks.code):!0).filter(y=>n.validate?n.validate(y.value):!0).forEach(y=>{Tr(y.from,y.to,r.doc).some(b=>b.mark.type===n.type)||o.addMark(y.from,y.to,n.type.create({href:y.href}))})}}),!!o.steps.length)return o}})}function im(n){return new U({key:new ee("handleClickLink"),props:{handleClick:(e,t,r)=>{var i,s;if(r.button!==0||r.target.nodeName!=="A")return!1;const l=ua(e.state,n.type.name),a=r.target,c=(i=a==null?void 0:a.href)!==null&&i!==void 0?i:l.href,d=(s=a==null?void 0:a.target)!==null&&s!==void 0?s:l.target;return a&&c?(e.editable&&window.open(c,d),!0):!1}}})}function sm(n){return new U({key:new ee("handlePasteLink"),props:{handlePaste:(e,t,r)=>{const{state:i}=e,{selection:s}=i,{empty:o}=s;if(o)return!1;let l="";r.content.forEach(c=>{l+=c.textContent});const a=rs(l).find(c=>c.isLink&&c.value===l);return!l||!a?!1:(n.editor.commands.setMark(n.type,{href:a.href}),!0)}}})}const om=me.create({name:"link",priority:1e3,keepOnSplit:!1,onCreate(){this.options.protocols.forEach(n=>{if(typeof n=="string"){To(n);return}To(n.scheme,n.optionalSlashes)})},onDestroy(){em()},inclusive(){return this.options.autolink},addOptions(){return{openOnClick:!0,linkOnPaste:!0,autolink:!0,protocols:[],HTMLAttributes:{target:"_blank",rel:"noopener noreferrer nofollow",class:null},validate:void 0}},addAttributes(){return{href:{default:null},target:{default:this.options.HTMLAttributes.target},rel:{default:this.options.HTMLAttributes.rel},class:{default:this.options.HTMLAttributes.class}}},parseHTML(){return[{tag:'a[href]:not([href *= "javascript:" i])'}]},renderHTML({HTMLAttributes:n}){var e;return!((e=n.href)===null||e===void 0)&&e.startsWith("javascript:")?["a",z(this.options.HTMLAttributes,{...n,href:""}),0]:["a",z(this.options.HTMLAttributes,n),0]},addCommands(){return{setLink:n=>({chain:e})=>e().setMark(this.name,n).setMeta("preventAutolink",!0).run(),toggleLink:n=>({chain:e})=>e().toggleMark(this.name,n,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run(),unsetLink:()=>({chain:n})=>n().unsetMark(this.name,{extendEmptyMarkRange:!0}).setMeta("preventAutolink",!0).run()}},addPasteRules(){return[At({find:(n,e)=>{var t;const r=(t=e==null?void 0:e.clipboardData)===null||t===void 0?void 0:t.getData("text/html"),i=[];if(r){const s=new DOMParser().parseFromString(r,"text/html"),o=s.querySelectorAll("a");o.length&&[...o].forEach(l=>i.push({text:l.innerText,data:{href:l.getAttribute("href")},index:s.body.innerText.indexOf(l.innerText)+l.innerText.length}))}if(n){const s=rs(n).filter(o=>o.isLink);s.length&&s.forEach(o=>i.push({text:o.value,data:{href:o.href},index:o.start}))}return i},type:this.type,getAttributes:n=>{var e;return{href:(e=n.data)===null||e===void 0?void 0:e.href}}})]},addProseMirrorPlugins(){const n=[];return this.options.autolink&&n.push(rm({type:this.type,validate:this.options.validate})),this.options.openOnClick&&n.push(im({type:this.type})),this.options.linkOnPaste&&n.push(sm({editor:this.editor,type:this.type})),n}}),lm=Q.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",z(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),am=Q.create({name:"listItem",addOptions(){return{HTMLAttributes:{},bulletListTypeName:"bulletList",orderedListTypeName:"orderedList"}},content:"paragraph block*",defining:!0,parseHTML(){return[{tag:"li"}]},renderHTML({HTMLAttributes:n}){return["li",z(this.options.HTMLAttributes,n),0]},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>this.editor.commands.sinkListItem(this.name),"Shift-Tab":()=>this.editor.commands.liftListItem(this.name)}}}),Mo=me.create({name:"textStyle",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"span",getAttrs:n=>n.hasAttribute("style")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["span",z(this.options.HTMLAttributes,n),0]},addCommands(){return{removeEmptyTextStyle:()=>({state:n,commands:e})=>{const t=Er(n,this.type);return Object.entries(t).some(([,i])=>!!i)?!0:e.unsetMark(this.name)}}}}),wo=/^(\d+)\.\s$/,cm=Q.create({name:"orderedList",addOptions(){return{itemTypeName:"listItem",HTMLAttributes:{},keepMarks:!1,keepAttributes:!1}},group:"block list",content(){return`${this.options.itemTypeName}+`},addAttributes(){return{start:{default:1,parseHTML:n=>n.hasAttribute("start")?parseInt(n.getAttribute("start")||"",10):1}}},parseHTML(){return[{tag:"ol"}]},renderHTML({HTMLAttributes:n}){const{start:e,...t}=n;return e===1?["ol",z(this.options.HTMLAttributes,t),0]:["ol",z(this.options.HTMLAttributes,n),0]},addCommands(){return{toggleOrderedList:()=>({commands:n,chain:e})=>this.options.keepAttributes?e().toggleList(this.name,this.options.itemTypeName,this.options.keepMarks).updateAttributes(am.name,this.editor.getAttributes(Mo.name)).run():n.toggleList(this.name,this.options.itemTypeName,this.options.keepMarks)}},addKeyboardShortcuts(){return{"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList()}},addInputRules(){let n=nn({find:wo,type:this.type,getAttributes:e=>({start:+e[1]}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1]});return(this.options.keepMarks||this.options.keepAttributes)&&(n=nn({find:wo,type:this.type,keepMarks:this.options.keepMarks,keepAttributes:this.options.keepAttributes,getAttributes:e=>({start:+e[1],...this.editor.getAttributes(Mo.name)}),joinPredicate:(e,t)=>t.childCount+t.attrs.start===+e[1],editor:this.editor})),[n]}}),dm=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))$/,um=/(?:^|\s)((?:~~)((?:[^~]+))(?:~~))/g,hm=me.create({name:"strike",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"s"},{tag:"del"},{tag:"strike"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("line-through")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["s",z(this.options.HTMLAttributes,n),0]},addCommands(){return{setStrike:()=>({commands:n})=>n.setMark(this.name),toggleStrike:()=>({commands:n})=>n.toggleMark(this.name),unsetStrike:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){const n={};return Ui()?n["Mod-Shift-s"]=()=>this.editor.commands.toggleStrike():n["Ctrl-Shift-s"]=()=>this.editor.commands.toggleStrike(),n},addInputRules(){return[tn({find:dm,type:this.type})]},addPasteRules(){return[At({find:um,type:this.type})]}}),fm=me.create({name:"underline",addOptions(){return{HTMLAttributes:{}}},parseHTML(){return[{tag:"u"},{style:"text-decoration",consuming:!1,getAttrs:n=>n.includes("underline")?{}:!1}]},renderHTML({HTMLAttributes:n}){return["u",z(this.options.HTMLAttributes,n),0]},addCommands(){return{setUnderline:()=>({commands:n})=>n.setMark(this.name),toggleUnderline:()=>({commands:n})=>n.toggleMark(this.name),unsetUnderline:()=>({commands:n})=>n.unsetMark(this.name)}},addKeyboardShortcuts(){return{"Mod-u":()=>this.editor.commands.toggleUnderline(),"Mod-U":()=>this.editor.commands.toggleUnderline()}}}),pm=Q.create({name:"text",group:"inline"}),mm=de.create({name:"textAlign",addOptions(){return{types:[],alignments:["left","center","right","justify"],defaultAlignment:"left"}},addGlobalAttributes(){return[{types:this.options.types,attributes:{textAlign:{default:this.options.defaultAlignment,parseHTML:n=>n.style.textAlign||this.options.defaultAlignment,renderHTML:n=>n.textAlign===this.options.defaultAlignment?{}:{style:`text-align: ${n.textAlign}`}}}}]},addCommands(){return{setTextAlign:n=>({commands:e})=>this.options.alignments.includes(n)?this.options.types.every(t=>e.updateAttributes(t,{textAlign:n})):!1,unsetTextAlign:()=>({commands:n})=>this.options.types.every(e=>n.resetAttributes(e,"textAlign"))}},addKeyboardShortcuts(){return{"Mod-Shift-l":()=>this.editor.commands.setTextAlign("left"),"Mod-Shift-e":()=>this.editor.commands.setTextAlign("center"),"Mod-Shift-r":()=>this.editor.commands.setTextAlign("right"),"Mod-Shift-j":()=>this.editor.commands.setTextAlign("justify")}}}),gm={name:"EmojiComponent",components:{NodeViewWrapper:ga,DtEmoji:X.DtEmoji},props:ya};function ym(n,e,t,r,i,s){const o=m.resolveComponent("dt-emoji"),l=m.resolveComponent("node-view-wrapper");return m.openBlock(),m.createBlock(l,{class:"d-d-inline-block d-va-bottom d-lh0"},{default:m.withCtx(()=>[m.createVNode(o,{size:"500",code:n.node.attrs.code},null,8,["code"])]),_:1})}const bm=v._export_sfc(gm,[["render",ym]]);function km(n){var e;const{char:t,allowSpaces:r,allowedPrefixes:i,startOfLine:s,$position:o}=n,l=up(t),a=new RegExp(`\\s${l}$`),c=s?"^":"",d=r?new RegExp(`${c}${l}.*?(?=\\s${l}|$)`,"gm"):new RegExp(`${c}(?:^)?${l}[^\\s${l}]*`,"gm"),u=((e=o.nodeBefore)===null||e===void 0?void 0:e.isText)&&o.nodeBefore.text;if(!u)return null;const h=o.pos-u.length,f=Array.from(u.matchAll(d)).pop();if(!f||f.input===void 0||f.index===void 0)return null;const p=f.input.slice(Math.max(0,f.index-1),f.index),g=new RegExp(`^[${i==null?void 0:i.join("")}\0]?$`).test(p);if(i!==null&&!g)return null;const y=h+f.index;let b=y+f[0].length;return r&&a.test(u.slice(b-1,b+1))&&(f[0]+=" ",b+=1),y<o.pos&&b>=o.pos?{range:{from:y,to:b},query:f[0].slice(t.length),text:f[0]}:null}const Sm=new ee("suggestion");function Ta({pluginKey:n=Sm,editor:e,char:t="@",allowSpaces:r=!1,allowedPrefixes:i=[" "],startOfLine:s=!1,decorationTag:o="span",decorationClass:l="suggestion",command:a=()=>null,items:c=()=>[],render:d=()=>({}),allow:u=()=>!0}){let h;const f=d==null?void 0:d(),p=new U({key:n,view(){return{update:async(g,y)=>{var b,C,M,P,L,T,B;const R=(b=this.key)===null||b===void 0?void 0:b.getState(y),w=(C=this.key)===null||C===void 0?void 0:C.getState(g.state),J=R.active&&w.active&&R.range.from!==w.range.from,ge=!R.active&&w.active,et=R.active&&!w.active,It=!ge&&!et&&R.query!==w.query,Re=ge||J,Pe=It&&!J,Le=et||J;if(!Re&&!Pe&&!Le)return;const le=Le&&!Re?R:w,Be=g.dom.querySelector(`[data-decoration-id="${le.decorationId}"]`);h={editor:e,range:le.range,query:le.query,text:le.text,items:[],command:Rt=>{a({editor:e,range:le.range,props:Rt})},decorationNode:Be,clientRect:Be?()=>{var Rt;const{decorationId:va}=(Rt=this.key)===null||Rt===void 0?void 0:Rt.getState(e.state),wr=g.dom.querySelector(`[data-decoration-id="${va}"]`);return(wr==null?void 0:wr.getBoundingClientRect())||null}:null},Re&&((M=f==null?void 0:f.onBeforeStart)===null||M===void 0||M.call(f,h)),Pe&&((P=f==null?void 0:f.onBeforeUpdate)===null||P===void 0||P.call(f,h)),(Pe||Re)&&(h.items=await c({editor:e,query:le.query})),Le&&((L=f==null?void 0:f.onExit)===null||L===void 0||L.call(f,h)),Pe&&((T=f==null?void 0:f.onUpdate)===null||T===void 0||T.call(f,h)),Re&&((B=f==null?void 0:f.onStart)===null||B===void 0||B.call(f,h))},destroy:()=>{var g;h&&((g=f==null?void 0:f.onExit)===null||g===void 0||g.call(f,h))}}},state:{init(){return{active:!1,range:{from:0,to:0},query:null,text:null,composing:!1}},apply(g,y,b,C){const{isEditable:M}=e,{composing:P}=e.view,{selection:L}=g,{empty:T,from:B}=L,R={...y};if(R.composing=P,M&&(T||e.view.composing)){(B<y.range.from||B>y.range.to)&&!P&&!y.composing&&(R.active=!1);const w=km({char:t,allowSpaces:r,allowedPrefixes:i,startOfLine:s,$position:L.$from}),J=`id_${Math.floor(Math.random()*4294967295)}`;w&&u({editor:e,state:C,range:w.range})?(R.active=!0,R.decorationId=y.decorationId?y.decorationId:J,R.range=w.range,R.query=w.query,R.text=w.text):R.active=!1}else R.active=!1;return R.active||(R.decorationId=null,R.range={from:0,to:0},R.query=null,R.text=null),R}},props:{handleKeyDown(g,y){var b;const{active:C,range:M}=p.getState(g.state);return C&&((b=f==null?void 0:f.onKeyDown)===null||b===void 0?void 0:b.call(f,{view:g,event:y,range:M}))||!1},decorations(g){const{active:y,range:b,decorationId:C}=p.getState(g);return y?H.create(g.doc,[ce.inline(b.from,b.to,{nodeName:o,class:l,"data-decoration-id":C})]):null}}});return p}const xm={name:"SuggestionList",components:{DtListItem:$o},props:{items:{type:Array,required:!0},command:{type:Function,required:!0},itemComponent:{type:Object,required:!0},itemType:{type:String,required:!0}},data(){return{selectedIndex:0}},watch:{items(){this.selectedIndex=0}},methods:{onKeyDown({event:n}){return n.key==="ArrowUp"?(this.upHandler(),!0):n.key==="ArrowDown"?(this.downHandler(),!0):n.key==="Enter"?(this.enterHandler(),n.stopPropagation(),!0):!1},upHandler(){this.selectedIndex=(this.selectedIndex+this.items.length-1)%this.items.length,this.scrollActiveElementIntoView()},downHandler(){this.selectedIndex=(this.selectedIndex+1)%this.items.length,this.scrollActiveElementIntoView()},scrollActiveElementIntoView(){const n=this.$refs.suggestionList.querySelector(".dt-list-item--highlighted");n&&n.scrollIntoView({behaviour:"smooth",block:"center"})},enterHandler(){this.selectItem(this.selectedIndex)},selectItem(n){const e=this.items[n];switch(this.itemType){case"emoji":this.command(e);return;case"mention":this.command({name:e.name,id:e.id,avatarSrc:e.avatarSrc});break}}}},Cm={class:"d-popover__dialog"},Em={ref:"suggestionList",class:"dt-suggestion-list"};function Tm(n,e,t,r,i,s){const o=m.resolveComponent("dt-list-item");return m.openBlock(),m.createElementBlock("div",Cm,[m.withDirectives(m.createElementVNode("ul",Em,[(m.openBlock(!0),m.createElementBlock(m.Fragment,null,m.renderList(t.items,(l,a)=>(m.openBlock(),m.createBlock(o,{key:l.id,class:m.normalizeClass(["dt-suggestion-list--item",{"dt-list-item--highlighted":a===i.selectedIndex}]),"navigation-type":"arrow-keys",onClick:c=>s.selectItem(a),onKeydown:m.withModifiers(s.onKeyDown,["prevent","stop"])},{default:m.withCtx(()=>[(m.openBlock(),m.createBlock(m.resolveDynamicComponent(t.itemComponent),{item:l},null,8,["item"]))]),_:2},1032,["class","onClick","onKeydown"]))),128))],512),[[m.vShow,t.items.length]])])}const Ma=v._export_sfc(xm,[["render",Tm]]),Mm={name:"EmojiSuggestion",components:{DtEmoji:X.DtEmoji,DtStack:Ai},props:{item:{type:Object,required:!0}}};function wm(n,e,t,r,i,s){const o=m.resolveComponent("dt-emoji"),l=m.resolveComponent("dt-stack");return m.openBlock(),m.createBlock(l,{direction:"row",gap:"400"},{default:m.withCtx(()=>[m.createVNode(o,{size:"200",code:t.item.code},null,8,["code"]),m.createTextVNode(" "+m.toDisplayString(t.item.code),1)]),_:1})}const Om=v._export_sfc(Mm,[["render",wm]]),vm={items:({query:n})=>n.length<2?[]:Object.values(X.emojisIndexed).filter(function(r){return!!r.shortname.substring(1,r.shortname.length-1).startsWith(n.toLowerCase())}).map(r=>({id:r.unicode_character,code:r.shortname})),command:({editor:n,range:e,props:t})=>{var s,o;const r=n.view.state.selection.$to.nodeAfter;((s=r==null?void 0:r.text)==null?void 0:s.startsWith(" "))&&(e.to+=1),n.chain().focus().insertContentAt(e,[{type:"emoji",attrs:t},{type:"text",text:" "}]).run(),(o=window.getSelection())==null||o.collapseToEnd()},render:()=>{let n,e;return{onStart:t=>{n=new Gi(Ma,{props:{itemComponent:m.markRaw(Om),itemType:"emoji",...t},editor:t.editor}),t.clientRect&&(e=v.tippy("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start",contentElement:null,zIndex:650}))},onUpdate(t){n.updateProps(t),t.clientRect&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){var r;return t.event.key==="Escape"?(e[0].hide(),!0):(r=n.ref)==null?void 0:r.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},Am=new ee("emoji"),Nm=/:\w+:$/,Dm=/:\w+:/g,Im=/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])$/,Rm=/(\u00a9|\u00ae|[\u2000-\u3300]|\ud83c[\ud000-\udfff]|\ud83d[\ud000-\udfff]|\ud83e[\ud000-\udfff])/g,Oo=n=>{if(n&&X.codeToEmojiData(n[0]))return{index:n.index,text:n[0],match:n}},Pm=n=>[...n.matchAll(Dm)].filter(t=>X.codeToEmojiData(t[0])).map(t=>({index:t.index,text:t[0],match:t})),Lm=Q.create({addOptions(){return{HTMLAttributes:{},suggestion:{char:":",pluginKey:Am}}},name:"emoji",group:"inline",inline:!0,selectable:!0,addNodeView(){return ba(bm)},addAttributes(){return{code:{default:null},id:{default:null}}},parseHTML(){return[{tag:"emoji-component"}]},renderText({node:n}){return n.attrs.code},renderHTML({HTMLAttributes:n}){return["emoji-component",z(this.options.HTMLAttributes,n)]},addInputRules(){return[co({find:n=>{const e=n.match(Nm);return Oo(e)},type:this.type,getAttributes(n){return{code:n[0]}}}),co({find:n=>{const e=n.match(Im);return Oo(e)},type:this.type,getAttributes(n){const e=X.shortcodeToEmojiData(n[0]).unicode_output;return{code:String.fromCodePoint(parseInt(e,16)),label:"emoji"}}})]},addPasteRules(){return[ho({find:Pm,type:this.type,getAttributes(n){return{code:n[0]}}}),ho({find:Rm,type:this.type,getAttributes(n){return{code:n[0]}}})]},addProseMirrorPlugins(){return[Ta({editor:this.editor,...this.options.suggestion,...vm})]}});function Bm(n,e,t=()=>!0){const r=[];e.lastIndex=0;let i;for(;i=e.exec(n);)t(n,i)&&r.push(i);return r}function _m(n,e){return!["#","@"].includes(n.charAt(e.index))&&!["#","@"].includes(n.charAt(e.index-1))}function Fm(n){const e=new RegExp("(?:"+[`[!?.,:;'"]`,"(?:&|&)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$"].join("|"),"g");return n.replace(e,"")}function zm(n,e){const t=n.slice(0,e+1).search(/\S+\s*$/),r=n.slice(e).search(/\s/);if(r<0){const i=n.slice(t);return{text:i,from:t,to:t+i.length}}return{text:n.slice(t,r+e),from:t,to:r+e}}function Oi(n,e,t,r){const i=zm(n,e);if(r.lastIndex=0,!r.test(i.text))return i;const s=t==="left"?i.from-1:i.to+1;return s<=0||s>=n.length||s===e?i:Oi(n,s,t,r)}function Hm(n,e,t,r){const i=Math.max(n.from-1,0),s=Math.min(n.to+1,e.content.size),o=Tr(i,s,e);for(const l of o)l.mark.type===r&&t.removeMark(l.from,l.to,r)}const vo=v.getPhoneNumberRegex(1,15);function Ao(n,e,t,r,i,s){if(!n)return;let o=t-e-1;o=o<0?0:o;const l=r-e,a=Oi(n,o,"left",vo),c=Oi(n,l,"right",vo),d=n.slice(a.from,c.to);Bm(d,v.linkRegex,_m).forEach(h=>{const f=Fm(h[0]),p=e+a.from+h.index+1,g=p+f.length;i.addMark(p,g,s.create())})}function Vm(n){let e=!1;return new U({key:new ee("autolink"),appendTransaction:(t,r,i)=>{const s=t.some(d=>d.docChanged)&&!r.doc.eq(i.doc);if(e&&!s)return;const{tr:o}=i,{textContent:l}=i.doc;e||Ao(l,0,0,l.length,o,n.type),e=!0;const a=ca(r.doc,[...t]);return ha(a).forEach(({oldRange:d,newRange:u})=>{Hm(u,i.doc,o,n.type),da(i.doc,u,f=>f.isTextblock).forEach(({node:f,pos:p})=>{Ao(f.textContent,p,d.from,u.to,o,n.type)})}),o}})}const $m={class:"d-link d-c-text d-d-inline-block",rel:"noopener noreferrer nofollow"},jm=me.create({name:"Link",renderHTML({HTMLAttributes:n}){return["a",z(this.options.HTMLAttributes,n,$m),0]},renderText({node:n}){return n.attrs.text},addProseMirrorPlugins(){return[Vm({type:this.type})]}}),Km=new ee("mention"),qm=Q.create({name:"mention",addOptions(){return{HTMLAttributes:{},renderLabel({options:n,node:e}){var t;return`${n.suggestion.char}${(t=e.attrs.label)!==null&&t!==void 0?t:e.attrs.id}`},suggestion:{char:"@",pluginKey:Km,command:({editor:n,range:e,props:t})=>{var r,i;const s=n.view.state.selection.$to.nodeAfter;((r=s==null?void 0:s.text)===null||r===void 0?void 0:r.startsWith(" "))&&(e.to+=1),n.chain().focus().insertContentAt(e,[{type:this.name,attrs:t},{type:"text",text:" "}]).run(),(i=window.getSelection())===null||i===void 0||i.collapseToEnd()},allow:({state:n,range:e})=>{const t=n.doc.resolve(e.from),r=n.schema.nodes[this.name];return!!t.parent.type.contentMatch.matchType(r)}}}},group:"inline",inline:!0,selectable:!1,atom:!0,addAttributes(){return{id:{default:null,parseHTML:n=>n.getAttribute("data-id"),renderHTML:n=>n.id?{"data-id":n.id}:{}},label:{default:null,parseHTML:n=>n.getAttribute("data-label"),renderHTML:n=>n.label?{"data-label":n.label}:{}}}},parseHTML(){return[{tag:`span[data-type="${this.name}"]`}]},renderHTML({node:n,HTMLAttributes:e}){return["span",z({"data-type":this.name},this.options.HTMLAttributes,e),this.options.renderLabel({options:this.options,node:n})]},renderText({node:n}){return this.options.renderLabel({options:this.options,node:n})},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:n,state:e})=>{let t=!1;const{selection:r}=e,{empty:i,anchor:s}=r;return i?(e.doc.nodesBetween(s-1,s,(o,l)=>{if(o.type.name===this.name)return t=!0,n.insertText(this.options.suggestion.char||"",l,l+o.nodeSize),!1}),t):!1})}},addProseMirrorPlugins(){return[Ta({editor:this.editor,...this.options.suggestion})]}}),Wm={name:"MentionComponent",components:{NodeViewWrapper:ga,DtLink:_o},props:ya,computed:{text(){return"@"+this.$props.node.attrs.name}}};function Um(n,e,t,r,i,s){const o=m.resolveComponent("dt-link"),l=m.resolveComponent("node-view-wrapper");return m.openBlock(),m.createBlock(l,{class:"d-d-inline-block"},{default:m.withCtx(()=>[m.createVNode(o,{kind:"mention"},{default:m.withCtx(()=>[m.createTextVNode(m.toDisplayString(s.text),1)]),_:1})]),_:1})}const Jm=v._export_sfc(Wm,[["render",Um]]),Gm=qm.extend({addNodeView(){return ba(Jm)},parseHTML(){return[{tag:"mention-component"}]},addAttributes(){return{name:{default:""},avatarSrc:{default:""},id:{default:""}}},renderText({node:n}){return`@${n.attrs.id}`},renderHTML({HTMLAttributes:n}){return["mention-component",z(this.options.HTMLAttributes,n),0]}}),wa=["text","json","html"],Oa=["start","end","all"],Ym=["https","http","ftp","ftps","sftp","mailto"],Xm={name:"MentionSuggestion",components:{DtAvatar:Bo,DtStack:Ai},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc}}};function Qm(n,e,t,r,i,s){const o=m.resolveComponent("dt-avatar"),l=m.resolveComponent("dt-stack");return m.openBlock(),m.createBlock(l,{direction:"row",gap:"400"},{default:m.withCtx(()=>[m.createVNode(o,{"full-name":s.name,"image-src":s.avatarSrc,"image-alt":s.name,size:"xs"},null,8,["full-name","image-src","image-alt"]),m.createTextVNode(" "+m.toDisplayString(s.name),1)]),_:1})}const Zm=v._export_sfc(Xm,[["render",Qm]]),eg={allowSpaces:!0,render:()=>{let n,e;return{onStart:t=>{n=new Gi(Ma,{props:{itemComponent:m.markRaw(Zm),itemType:"mention",...t},editor:t.editor}),t.clientRect&&(e=v.tippy("body",{getReferenceClientRect:t.clientRect,appendTo:()=>document.body,content:n.element,showOnCreate:!0,interactive:!0,trigger:"manual",placement:"bottom-start"}))},onUpdate(t){n.updateProps(t),t.clientRect&&e[0].setProps({getReferenceClientRect:t.clientRect})},onKeyDown(t){return t.event.key==="Escape"?(e[0].hide(),!0):n==null?void 0:n.ref.onKeyDown(t)},onExit(){e[0].destroy(),n.destroy()}}}},tg={name:"DtRichTextEditor",components:{EditorContent:mp},props:{modelValue:{type:[Object,String],default:""},editable:{type:Boolean,default:!0},allowLineBreaks:{type:Boolean,default:!1},inputAriaLabel:{type:String,required:!0},inputClass:{type:String,default:""},autoFocus:{type:[Boolean,String,Number],default:!1,validator(n){return typeof n=="string"?Oa.includes(n):!0}},outputFormat:{type:String,default:"text",validator(n){return wa.includes(n)}},placeholder:{type:String,default:""},link:{type:[Boolean,Object],default:!1},mentionSuggestion:{type:Object,default:null}},emits:["input","update:modelValue","blur","focus"],data(){return{editor:null,popoverOpened:!1}},computed:{extensions(){const n=[bp,Np,Ip,Cp,_p,lm,Tp,hm,pm,fm];if(this.link&&n.push(this.getExtension(jm,this.link)),n.push(Mp.configure({placeholder:this.placeholder})),this.allowLineBreaks||n.push(Ep.extend({addKeyboardShortcuts(){return{Enter:()=>!0,"Shift-Enter":()=>this.editor.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()])}}})),n.push(om.extend({inclusive:!1}).configure({autolink:!0,protocols:Ym})),this.mentionSuggestion){const e={...this.mentionSuggestion,...eg};n.push(Gm.configure({suggestion:e}))}return n.push(Lm),n.push(mm.configure({types:["paragraph"],defaultAlignment:"left"})),n.push(xp.configure({HTMLAttributes:{class:"dt-rich-text-editor--code-block"}})),n.push(cm.configure({itemTypeName:"listItem"})),n},inputAttrs(){const n={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:"textbox"};return this.editable||(n["aria-readonly"]=!0),n}},watch:{editable(n){this.editor.setEditable(n),this.updateEditorAttributes({"aria-readonly":!n})},inputClass(n){this.updateEditorAttributes({class:n})},inputAriaLabel(n){this.updateEditorAttributes({"aria-label":n})},extensions(){this.destroyEditor(),this.createEditor()},modelValue(n){let e=this.getOutput();this.outputFormat==="json"&&(n=JSON.stringify(n),e=JSON.stringify(e)),n!==e&&this.editor.commands.setContent(n,!1)}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},methods:{createEditor(){this.editor=new pp({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,editorProps:{attributes:{...this.inputAttrs,class:this.inputClass}}}),this.addEditorListeners()},destroyEditor(){this.editor.destroy()},addEditorListeners(){this.editor.on("update",()=>{const n=this.getOutput();this.$emit("input",n),this.$emit("update:modelValue",n)}),this.editor.on("focus",({event:n})=>{this.$emit("focus",n)}),this.editor.on("blur",({event:n})=>{this.$emit("blur",n)})},getOutput(){switch(this.outputFormat){case"json":return this.editor.getJSON();case"html":return this.editor.getHTML();case"text":default:return this.editor.getText()}},getExtension(n,e){var t;return typeof e=="boolean"?n:(t=n.configure)==null?void 0:t.call(n,e)},updateEditorAttributes(n){this.editor.setOptions({editorProps:{attributes:n}})},focusEditor(){this.editor.commands.focus()}}};function ng(n,e,t,r,i,s){const o=m.resolveComponent("editor-content");return m.openBlock(),m.createBlock(o,{editor:i.editor,"data-qa":"dt-rich-text-editor",class:"dt-rich-text-editor"},null,8,["editor"])}const rg=v._export_sfc(tg,[["render",ng]]);exports.AVATAR_COLORS=Lo;exports.AVATAR_GROUP_VALIDATOR=Zr;exports.AVATAR_ICON_SIZES=Po;exports.AVATAR_KIND_MODIFIERS=Io;exports.AVATAR_PRESENCE_SIZE_MODIFIERS=Ro;exports.AVATAR_PRESENCE_STATES=Qr;exports.AVATAR_SIZE_MODIFIERS=mn;exports.DT_STACK_DIRECTION=Ge;exports.DT_STACK_GAP=dr;exports.DT_STACK_RESPONSIVE_BREAKPOINTS=vi;exports.DtAvatar=Bo;exports.DtItemLayout=ei;exports.DtLink=_o;exports.DtListItem=$o;exports.DtPopover=fc;exports.DtPresence=Do;exports.DtRichTextEditor=rg;exports.DtStack=Ai;exports.LIST_ITEM_NAVIGATION_TYPES=Lt;exports.LIST_ITEM_TYPES=gn;exports.Modal=Vo;exports.PRESENCE_STATES=kt;exports.PRESENCE_STATES_LIST=No;exports.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES=Oa;exports.RICH_TEXT_EDITOR_OUTPUT_FORMATS=wa;exports.SrOnlyCloseButton=zo;exports.SrOnlyCloseButtonMixin=Fo;
|
|
@@ -15747,7 +15747,7 @@ const Og = {
|
|
|
15747
15747
|
this.command(e);
|
|
15748
15748
|
return;
|
|
15749
15749
|
case "mention":
|
|
15750
|
-
this.command({ name: e.name, id: e.
|
|
15750
|
+
this.command({ name: e.name, id: e.id, avatarSrc: e.avatarSrc });
|
|
15751
15751
|
break;
|
|
15752
15752
|
}
|
|
15753
15753
|
}
|
|
@@ -16256,7 +16256,7 @@ const ey = /* @__PURE__ */ de(Qg, [["render", Zg]]), ty = Xg.extend({
|
|
|
16256
16256
|
};
|
|
16257
16257
|
},
|
|
16258
16258
|
renderText({ node: n }) {
|
|
16259
|
-
return
|
|
16259
|
+
return `@${n.attrs.id}`;
|
|
16260
16260
|
},
|
|
16261
16261
|
renderHTML({ HTMLAttributes: n }) {
|
|
16262
16262
|
return ["mention-component", F(this.options.HTMLAttributes, n), 0];
|
|
@@ -16307,9 +16307,9 @@ function oy(n, e, t, r, i, s) {
|
|
|
16307
16307
|
nt(o, {
|
|
16308
16308
|
"full-name": s.name,
|
|
16309
16309
|
"image-src": s.avatarSrc,
|
|
16310
|
-
"image-alt":
|
|
16310
|
+
"image-alt": s.name,
|
|
16311
16311
|
size: "xs"
|
|
16312
|
-
}, null, 8, ["full-name", "image-src"]),
|
|
16312
|
+
}, null, 8, ["full-name", "image-src", "image-alt"]),
|
|
16313
16313
|
Wi(" " + ut(s.name), 1)
|
|
16314
16314
|
]),
|
|
16315
16315
|
_: 1
|
|
@@ -16319,6 +16319,7 @@ const ly = /* @__PURE__ */ de(sy, [["render", oy]]), ay = {
|
|
|
16319
16319
|
// This function comes from the user and passed to the editor directly.
|
|
16320
16320
|
// This will also activate the mention plugin on the editor
|
|
16321
16321
|
// items: ({ query }) => { return [] },
|
|
16322
|
+
allowSpaces: !0,
|
|
16322
16323
|
render: () => {
|
|
16323
16324
|
let n, e;
|
|
16324
16325
|
return {
|
|
@@ -16346,8 +16347,7 @@ const ly = /* @__PURE__ */ de(sy, [["render", oy]]), ay = {
|
|
|
16346
16347
|
});
|
|
16347
16348
|
},
|
|
16348
16349
|
onKeyDown(t) {
|
|
16349
|
-
|
|
16350
|
-
return t.event.key === "Escape" ? (e[0].hide(), !0) : (r = n.ref) == null ? void 0 : r.onKeyDown(t);
|
|
16350
|
+
return t.event.key === "Escape" ? (e[0].hide(), !0) : n == null ? void 0 : n.ref.onKeyDown(t);
|
|
16351
16351
|
},
|
|
16352
16352
|
onExit() {
|
|
16353
16353
|
e[0].destroy(), n.destroy();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"suggestion.d.ts","sourceRoot":"","sources":["../../../../../../components/rich_text_editor/extensions/mentions/suggestion.js"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"suggestion.d.ts","sourceRoot":"","sources":["../../../../../../components/rich_text_editor/extensions/mentions/suggestion.js"],"names":[],"mappings":";;IAeU;;;;;MAyDP"}
|
|
@@ -183,6 +183,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
183
183
|
}, {
|
|
184
184
|
onDrag(e: any): void;
|
|
185
185
|
onDrop(e: any): void;
|
|
186
|
+
onPaste(e: any): void;
|
|
186
187
|
onSkinTone(skinTone: any): void;
|
|
187
188
|
onSelectEmoji(emoji: any): void;
|
|
188
189
|
onSelectImage(): void;
|
|
@@ -193,7 +194,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
193
194
|
onFocus(event: any): void;
|
|
194
195
|
onBlur(event: any): void;
|
|
195
196
|
onInput(event: any): void;
|
|
196
|
-
}, never, import("vue").ComponentOptionsMixin, ("input" | "focus" | "submit" | "blur" | "cancel" | "selected-emoji" | "skin-tone" | "select-media" | "add-media")[], "input" | "focus" | "submit" | "blur" | "cancel" | "selected-emoji" | "skin-tone" | "select-media" | "add-media", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
197
|
+
}, never, import("vue").ComponentOptionsMixin, ("input" | "focus" | "submit" | "blur" | "cancel" | "selected-emoji" | "skin-tone" | "select-media" | "add-media" | "paste-media")[], "input" | "focus" | "submit" | "blur" | "cancel" | "selected-emoji" | "skin-tone" | "select-media" | "add-media" | "paste-media", import("vue").VNodeProps & import("vue").AllowedComponentProps & import("vue").ComponentCustomProps, Readonly<import("vue").ExtractPropTypes<{
|
|
197
198
|
/**
|
|
198
199
|
* Value of the input. The object format should match TipTap's JSON
|
|
199
200
|
* document structure: https://tiptap.dev/guide/output#option-1-json
|
|
@@ -369,6 +370,7 @@ declare const _default: import("vue").DefineComponent<{
|
|
|
369
370
|
"onSkin-tone"?: ((...args: any[]) => any) | undefined;
|
|
370
371
|
"onSelect-media"?: ((...args: any[]) => any) | undefined;
|
|
371
372
|
"onAdd-media"?: ((...args: any[]) => any) | undefined;
|
|
373
|
+
"onPaste-media"?: ((...args: any[]) => any) | undefined;
|
|
372
374
|
}, {
|
|
373
375
|
link: boolean | Record<string, any>;
|
|
374
376
|
maxHeight: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"message_input.vue.d.ts","sourceRoot":"","sources":["../../../../../recipes/conversation_view/message_input/message_input.vue.js"],"names":[],"mappings":";IAiCI;;;OAGG;;;;;IAMH;;OAEG;;;;;IAMH;;OAEG;;;;;;IAOH;;;;OAIG;;;;;IAMH;;;;;;;;;;OAUG;;;;;;IAYH;;;;;OAKG;;;;;;IASH;;OAEG;;;;;IAMH;;OAEG;;;;;IAMH;;OAEG;;;;;IAMH;;;OAGG;;;;;;;;;IAYH;;OAEG;;;;;;IAeH;;OAEG;;;;;IAOH;;OAEG;;;;;IAMH;;OAEG;;;;;;;;;;;;;;;;IAWH;;OAEG;;;;;;;IAMH;;OAEG;;;;;;;IAMH;;;;;;;;;;OAUG
|
|
1
|
+
{"version":3,"file":"message_input.vue.d.ts","sourceRoot":"","sources":["../../../../../recipes/conversation_view/message_input/message_input.vue.js"],"names":[],"mappings":";IAiCI;;;OAGG;;;;;IAMH;;OAEG;;;;;IAMH;;OAEG;;;;;;IAOH;;;;OAIG;;;;;IAMH;;;;;;;;;;OAUG;;;;;;IAYH;;;;;OAKG;;;;;;IASH;;OAEG;;;;;IAMH;;OAEG;;;;;IAMH;;OAEG;;;;;IAMH;;;OAGG;;;;;;;;;IAYH;;OAEG;;;;;;IAeH;;OAEG;;;;;IAOH;;OAEG;;;;;IAMH;;OAEG;;;;;;;;;;;;;;;;IAWH;;OAEG;;;;;;;IAMH;;OAEG;;;;;;;IAMH;;;;;;;;;;OAUG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;IAxLH;;;OAGG;;;;;IAMH;;OAEG;;;;;IAMH;;OAEG;;;;;;IAOH;;;;OAIG;;;;;IAMH;;;;;;;;;;OAUG;;;;;;IAYH;;;;;OAKG;;;;;;IASH;;OAEG;;;;;IAMH;;OAEG;;;;;IAMH;;OAEG;;;;;IAMH;;;OAGG;;;;;;;;;IAYH;;OAEG;;;;;;IAeH;;OAEG;;;;;IAOH;;OAEG;;;;;IAMH;;OAEG;;;;;;;;;;;;;;;;IAWH;;OAEG;;;;;;;IAMH;;OAEG;;;;;;;IAMH;;;;;;;;;;OAUG"}
|