@dialpad/dialtone-vue 4.1.0 → 4.2.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.
Files changed (57) hide show
  1. package/dist/ForceLinkify-CI1tkUBf.cjs +3 -0
  2. package/dist/ForceLinkify-CI1tkUBf.cjs.map +1 -0
  3. package/dist/ForceLinkify-bO3ug94b.js +544 -0
  4. package/dist/ForceLinkify-bO3ug94b.js.map +1 -0
  5. package/dist/{MarkdownRenderer-BQQDcWMC.cjs → MarkdownRenderer-B6oyniLV.cjs} +1 -1
  6. package/dist/{MarkdownRenderer-BQQDcWMC.cjs.map → MarkdownRenderer-B6oyniLV.cjs.map} +1 -1
  7. package/dist/{MarkdownRenderer-D3rM2x-1.js → MarkdownRenderer-D-EV50_M.js} +1 -1
  8. package/dist/{MarkdownRenderer-D3rM2x-1.js.map → MarkdownRenderer-D-EV50_M.js.map} +1 -1
  9. package/dist/{RichTextEditor-CzMY0oVT.js → RichTextEditor-Cz2VXb7-.js} +470 -466
  10. package/dist/{RichTextEditor-CzMY0oVT.js.map → RichTextEditor-Cz2VXb7-.js.map} +1 -1
  11. package/dist/RichTextEditor-EHgahp8r.cjs +11 -0
  12. package/dist/{RichTextEditor-n42FPkjs.cjs.map → RichTextEditor-EHgahp8r.cjs.map} +1 -1
  13. package/dist/{Scroller-BUtC5Z7j.cjs → Scroller-Du2kJsTR.cjs} +1 -1
  14. package/dist/{Scroller-BUtC5Z7j.cjs.map → Scroller-Du2kJsTR.cjs.map} +1 -1
  15. package/dist/{Scroller-BsGXTN6S.js → Scroller-JDoDYC5V.js} +1 -1
  16. package/dist/{Scroller-BsGXTN6S.js.map → Scroller-JDoDYC5V.js.map} +1 -1
  17. package/dist/{TextList-B6XFfQfD.js → TextList-D40u4g4T.js} +1 -1
  18. package/dist/{TextList-B6XFfQfD.js.map → TextList-D40u4g4T.js.map} +1 -1
  19. package/dist/{TextList-Dd-ROFiI.cjs → TextList-rS1MQdPB.cjs} +1 -1
  20. package/dist/{TextList-Dd-ROFiI.cjs.map → TextList-rS1MQdPB.cjs.map} +1 -1
  21. package/dist/{TextListItem-DIlrCkaM.cjs → TextListItem-CF6DzdvT.cjs} +1 -1
  22. package/dist/{TextListItem-DIlrCkaM.cjs.map → TextListItem-CF6DzdvT.cjs.map} +1 -1
  23. package/dist/{TextListItem-ImUi_FWh.js → TextListItem-PHgDIWV1.js} +1 -1
  24. package/dist/{TextListItem-ImUi_FWh.js.map → TextListItem-PHgDIWV1.js.map} +1 -1
  25. package/dist/{Toast-IyFVsArp.cjs → Toast-CN9x3jKH.cjs} +1 -1
  26. package/dist/{Toast-IyFVsArp.cjs.map → Toast-CN9x3jKH.cjs.map} +1 -1
  27. package/dist/{Toast-t6T8fd29.js → Toast-DVUE2_fV.js} +1 -1
  28. package/dist/{Toast-t6T8fd29.js.map → Toast-DVUE2_fV.js.map} +1 -1
  29. package/dist/component-documentation.json +1 -1
  30. package/dist/components/RichTextEditor/ForceLinkify.d.ts +4 -0
  31. package/dist/components/RichTextEditor/ForceLinkify.d.ts.map +1 -0
  32. package/dist/dialtone-vue.cjs +1 -1
  33. package/dist/dialtone-vue.js +5 -5
  34. package/dist/lib/rich-text-editor/force-linkify.cjs +1 -0
  35. package/dist/lib/rich-text-editor/force-linkify.js +2 -0
  36. package/dist/lib/rich-text-editor/index.cjs +1 -1
  37. package/dist/lib/rich-text-editor/index.js +1 -1
  38. package/dist/lib/rich-text-editor/markdown-renderer.cjs +1 -1
  39. package/dist/lib/rich-text-editor/markdown-renderer.js +1 -1
  40. package/dist/lib/rich-text-editor/rich-text-editor.cjs +1 -1
  41. package/dist/lib/rich-text-editor/rich-text-editor.js +1 -1
  42. package/dist/lib/scroller/index.cjs +1 -1
  43. package/dist/lib/scroller/index.js +1 -1
  44. package/dist/lib/scroller/scroller.cjs +1 -1
  45. package/dist/lib/scroller/scroller.js +1 -1
  46. package/dist/lib/text-list/index.cjs +1 -1
  47. package/dist/lib/text-list/index.js +2 -2
  48. package/dist/lib/text-list/text-list-item.cjs +1 -1
  49. package/dist/lib/text-list/text-list-item.js +1 -1
  50. package/dist/lib/text-list/text-list.cjs +1 -1
  51. package/dist/lib/text-list/text-list.js +1 -1
  52. package/dist/lib/toast/index.cjs +1 -1
  53. package/dist/lib/toast/index.js +1 -1
  54. package/dist/lib/toast/toast.cjs +1 -1
  55. package/dist/lib/toast/toast.js +1 -1
  56. package/package.json +3 -3
  57. package/dist/RichTextEditor-n42FPkjs.cjs +0 -11
@@ -0,0 +1,11 @@
1
+ const e=require(`./chunk-Bmb41Sf3.cjs`),t=require(`./common/utils/index.cjs`),n=require(`./_plugin-vue_export-helper-D8jCH6HB.cjs`),r=require(`./common/emoji/index.cjs`),i=require(`./lib/avatar/avatar.cjs`),a=require(`./lib/badge/badge.cjs`),o=require(`./lib/text/text.cjs`),s=require(`./lib/link/link.cjs`),c=require(`./localization/index.cjs`),l=require(`./lib/button/button.cjs`),u=require(`./lib/list-item/list-item.cjs`),d=require(`./lib/stack/stack.cjs`),f=require(`./lib/popover/popover.cjs`),p=require(`./lib/emoji/emoji.cjs`),m=require(`./lib/input/input.cjs`),h=require(`./node_modules/@tiptap/vue-3.cjs`),g=require(`./ForceLinkify-CI1tkUBf.cjs`),_=require(`./lib/rich-text-editor/rich-text-editor-constants.cjs`),v=require(`./MarkdownRenderer-B6oyniLV.cjs`);let y=require(`vue`),b=require(`@dialpad/dialtone-icons/vue`),x=require(`regex-combined-emojis`),S=require(`@tiptap/core`),C=require(`@tiptap/pm/state`),w=require(`@tiptap/pm/tables`),T=require(`@tiptap/extension-blockquote`);T=e.t(T);let ee=require(`@tiptap/extension-code-block`);ee=e.t(ee);let E=require(`@tiptap/extension-code`);E=e.t(E);let D=require(`@tiptap/extension-document`);D=e.t(D);let te=require(`@tiptap/extensions`),O=require(`@tiptap/extension-hard-break`);O=e.t(O);let k=require(`@tiptap/extension-paragraph`);k=e.t(k);let A=require(`@tiptap/extension-bold`);A=e.t(A);let j=require(`@tiptap/extension-list`),ne=require(`@tiptap/extension-italic`);ne=e.t(ne);let re=require(`@tiptap/extension-link`);re=e.t(re);let ie=require(`@tiptap/extension-strike`);ie=e.t(ie);let ae=require(`@tiptap/extension-underline`);ae=e.t(ae);let oe=require(`@tiptap/extension-text`);oe=e.t(oe);let se=require(`@tiptap/extension-text-align`);se=e.t(se);let ce=require(`@tiptap/extension-table`),le=require(`@tiptap/extension-text-style`),ue=require(`@tiptap/suggestion`);ue=e.t(ue);let de=require(`@tiptap/extension-image`);de=e.t(de);let M=require(`@tiptap/extension-mention`);M=e.t(M);let fe=require(`@dialpad/dialtone-icons/vue/hash`);fe=e.t(fe);let pe=require(`@dialpad/dialtone-icons/vue/lock`);pe=e.t(pe);let me=require(`deep-equal`);me=e.t(me);var he=[`top`,`right`,`bottom`,`left`],ge=[`start`,`end`],_e=he.reduce((e,t)=>e.concat(t,t+`-`+ge[0],t+`-`+ge[1]),[]),N=Math.min,P=Math.max,ve=Math.round,F=e=>({x:e,y:e}),ye={left:`right`,right:`left`,bottom:`top`,top:`bottom`};function be(e,t,n){return P(e,N(t,n))}function I(e,t){return typeof e==`function`?e(t):e}function L(e){return e.split(`-`)[0]}function R(e){return e.split(`-`)[1]}function xe(e){return e===`x`?`y`:`x`}function Se(e){return e===`y`?`height`:`width`}function z(e){let t=e[0];return t===`t`||t===`b`?`y`:`x`}function Ce(e){return xe(z(e))}function we(e,t,n){n===void 0&&(n=!1);let r=R(e),i=Ce(e),a=Se(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Ne(o)),[o,Ne(o)]}function Te(e){let t=Ne(e);return[Ee(e),t,Ee(t)]}function Ee(e){return e.includes(`start`)?e.replace(`start`,`end`):e.replace(`end`,`start`)}var De=[`left`,`right`],Oe=[`right`,`left`],ke=[`top`,`bottom`],Ae=[`bottom`,`top`];function je(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Oe:De:t?De:Oe;case`left`:case`right`:return t?ke:Ae;default:return[]}}function Me(e,t,n,r){let i=R(e),a=je(L(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Ee)))),a}function Ne(e){let t=L(e);return ye[t]+e.slice(t.length)}function Pe(e){return{top:0,right:0,bottom:0,left:0,...e}}function Fe(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Pe(e)}function B(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Ie(e,t,n){let{reference:r,floating:i}=e,a=z(t),o=Ce(t),s=Se(o),c=L(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(R(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function Le(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=I(t,e),p=Fe(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=B(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=B(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Re=50,ze=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=o.detectOverflow?o:{...o,detectOverflow:Le},c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Ie(l,r,c),f=r,p=0,m={};for(let n=0;n<a.length;n++){let h=a[n];if(!h)continue;let{name:g,fn:_}=h,{x:v,y,data:b,reset:x}=await _({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:m,rects:l,platform:s,elements:{reference:e,floating:t}});u=v??u,d=y??d,m[g]={...m[g],...b},x&&p<Re&&(p++,typeof x==`object`&&(x.placement&&(f=x.placement),x.rects&&(l=x.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):x.rects),{x:u,y:d}=Ie(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:m}},Be=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=I(e,t)||{};if(l==null)return{};let d=Fe(u),f={x:n,y:r},p=Ce(i),m=Se(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,ee=N(d[_],T),E=N(d[v],T),D=ee,te=C-h[m]-E,O=C/2-h[m]/2+w,k=be(D,O,te),A=!c.arrow&&R(i)!=null&&O!==k&&a.reference[m]/2-(O<D?ee:E)-h[m]/2<0,j=A?O<D?O-D:O-te:0;return{[p]:f[p]+j,data:{[p]:k,centerOffset:O-k-j,...A&&{alignmentOffset:j}},reset:A}}});function Ve(e,t,n){return(e?[...n.filter(t=>R(t)===e),...n.filter(t=>R(t)!==e)]:n.filter(e=>L(e)===e)).filter(n=>e?R(n)===e||(t?Ee(n)!==n:!1):!0)}var He=function(e){return e===void 0&&(e={}),{name:`autoPlacement`,options:e,async fn(t){let{rects:n,middlewareData:r,placement:i,platform:a,elements:o}=t,{crossAxis:s=!1,alignment:c,allowedPlacements:l=_e,autoAlignment:u=!0,...d}=I(e,t),f=c!==void 0||l===_e?Ve(c||null,u,l):l,p=await a.detectOverflow(t,d),m=r.autoPlacement?.index||0,h=f[m];if(h==null)return{};let g=we(h,n,await(a.isRTL==null?void 0:a.isRTL(o.floating)));if(i!==h)return{reset:{placement:f[0]}};let _=[p[L(h)],p[g[0]],p[g[1]]],v=[...r.autoPlacement?.overflows||[],{placement:h,overflows:_}],y=f[m+1];if(y)return{data:{index:m+1,overflows:v},reset:{placement:y}};let b=v.map(e=>{let t=R(e.placement);return[e.placement,t&&s?e.overflows.slice(0,2).reduce((e,t)=>e+t,0):e.overflows[0],e.overflows]}).sort((e,t)=>e[1]-t[1]),x=b.filter(e=>e[2].slice(0,R(e[0])?2:3).every(e=>e<=0))[0]?.[0]||b[0][0];return x===i?{}:{data:{index:m+1,overflows:v},reset:{placement:x}}}}},Ue=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=I(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=L(r),_=z(o),v=L(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Ne(o)]:Te(o)),x=p!==`none`;!d&&x&&b.push(...Me(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=we(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==z(t))||T.every(e=>z(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=z(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function We(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Ge(e){return he.some(t=>e[t]>=0)}var Ke=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=I(e,t);switch(i){case`referenceHidden`:{let e=We(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Ge(e)}}}case`escaped`:{let e=We(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Ge(e)}}}default:return{}}}}};function qe(e){let t=N(...e.map(e=>e.left)),n=N(...e.map(e=>e.top)),r=P(...e.map(e=>e.right)),i=P(...e.map(e=>e.bottom));return{x:t,y:n,width:r-t,height:i-n}}function Je(e){let t=e.slice().sort((e,t)=>e.y-t.y),n=[],r=null;for(let e=0;e<t.length;e++){let i=t[e];!r||i.y-r.y>r.height/2?n.push([i]):n[n.length-1].push(i),r=i}return n.map(e=>B(qe(e)))}var Ye=function(e){return e===void 0&&(e={}),{name:`inline`,options:e,async fn(t){let{placement:n,elements:r,rects:i,platform:a,strategy:o}=t,{padding:s=2,x:c,y:l}=I(e,t),u=Array.from(await(a.getClientRects==null?void 0:a.getClientRects(r.reference))||[]),d=Je(u),f=B(qe(u)),p=Fe(s);function m(){if(d.length===2&&d[0].left>d[1].right&&c!=null&&l!=null)return d.find(e=>c>e.left-p.left&&c<e.right+p.right&&l>e.top-p.top&&l<e.bottom+p.bottom)||f;if(d.length>=2){if(z(n)===`y`){let e=d[0],t=d[d.length-1],r=L(n)===`top`,i=e.top,a=t.bottom,o=r?e.left:t.left,s=r?e.right:t.right;return{top:i,bottom:a,left:o,right:s,width:s-o,height:a-i,x:o,y:i}}let e=L(n)===`left`,t=P(...d.map(e=>e.right)),r=N(...d.map(e=>e.left)),i=d.filter(n=>e?n.left===r:n.right===t),a=i[0].top,o=i[i.length-1].bottom,s=r,c=t;return{top:a,bottom:o,left:s,right:c,width:c-s,height:o-a,x:s,y:a}}return f}let h=await a.getElementRects({reference:{getBoundingClientRect:m},floating:r.floating,strategy:o});return i.reference.x!==h.reference.x||i.reference.y!==h.reference.y||i.reference.width!==h.reference.width||i.reference.height!==h.reference.height?{reset:{rects:h}}:{}}}},Xe=new Set([`left`,`top`]);async function Ze(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=L(n),s=R(n),c=z(n)===`y`,l=Xe.has(o)?-1:1,u=a&&c?-1:1,d=I(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Qe=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Ze(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},$e=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=I(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=z(L(i)),p=xe(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=be(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=be(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},et=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=I(e,t),u=await o.detectOverflow(t,l),d=L(i),f=R(i),p=z(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=N(h-u[g],v),x=N(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=P(u.left,0),t=P(u.right,0),n=P(u.top,0),r=P(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:P(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:P(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function tt(){return typeof window<`u`}function V(e){return nt(e)?(e.nodeName||``).toLowerCase():`#document`}function H(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function U(e){return((nt(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function nt(e){return tt()?e instanceof Node||e instanceof H(e).Node:!1}function W(e){return tt()?e instanceof Element||e instanceof H(e).Element:!1}function G(e){return tt()?e instanceof HTMLElement||e instanceof H(e).HTMLElement:!1}function rt(e){return!tt()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof H(e).ShadowRoot}function K(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Y(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&i!==`inline`&&i!==`contents`}function it(e){return/^(table|td|th)$/.test(V(e))}function at(e){try{if(e.matches(`:popover-open`))return!0}catch{}try{return e.matches(`:modal`)}catch{return!1}}var ot=/transform|translate|scale|rotate|perspective|filter/,st=/paint|layout|strict|content/,q=e=>!!e&&e!==`none`,ct;function lt(e){let t=W(e)?Y(e):e;return q(t.transform)||q(t.translate)||q(t.scale)||q(t.rotate)||q(t.perspective)||!dt()&&(q(t.backdropFilter)||q(t.filter))||ot.test(t.willChange||``)||st.test(t.contain||``)}function ut(e){let t=X(e);for(;G(t)&&!J(t);){if(lt(t))return t;if(at(t))return null;t=X(t)}return null}function dt(){return ct??(ct=typeof CSS<`u`&&CSS.supports&&CSS.supports(`-webkit-backdrop-filter`,`none`)),ct}function J(e){return/^(html|body|#document)$/.test(V(e))}function Y(e){return H(e).getComputedStyle(e)}function ft(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function X(e){if(V(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||rt(e)&&e.host||U(e);return rt(t)?t.host:t}function pt(e){let t=X(e);return J(t)?e.ownerDocument?e.ownerDocument.body:e.body:G(t)&&K(t)?t:pt(t)}function mt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=pt(e),i=r===e.ownerDocument?.body,a=H(r);if(i){let e=ht(a);return t.concat(a,a.visualViewport||[],K(r)?r:[],e&&n?mt(e):[])}else return t.concat(r,mt(r,[],n))}function ht(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function gt(e){let t=Y(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=G(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ve(n)!==a||ve(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function _t(e){return W(e)?e:e.contextElement}function Z(e){let t=_t(e);if(!G(t))return F(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=gt(t),o=(a?ve(n.width):n.width)/r,s=(a?ve(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var vt=F(0);function yt(e){let t=H(e);return!dt()||!t.visualViewport?vt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function bt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==H(e)?!1:t}function Q(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=_t(e),o=F(1);t&&(r?W(r)&&(o=Z(r)):o=Z(e));let s=bt(a,n,r)?yt(a):F(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=H(a),t=r&&W(r)?H(r):r,n=e,i=ht(n);for(;i&&r&&t!==n;){let e=Z(i),t=i.getBoundingClientRect(),r=Y(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=H(i),i=ht(n)}}return B({width:u,height:d,x:c,y:l})}function xt(e,t){let n=ft(e).scrollLeft;return t?t.left+n:Q(U(e)).left+n}function St(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-xt(e,n),y:n.top+t.scrollTop}}function Ct(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=U(r),s=t?at(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=F(1),u=F(0),d=G(r);if((d||!d&&!a)&&((V(r)!==`body`||K(o))&&(c=ft(r)),d)){let e=Q(r);l=Z(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?St(o,c):F(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function wt(e){return Array.from(e.getClientRects())}function Tt(e){let t=U(e),n=ft(e),r=e.ownerDocument.body,i=P(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=P(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+xt(e),s=-n.scrollTop;return Y(r).direction===`rtl`&&(o+=P(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Et=25;function Dt(e,t){let n=H(e),r=U(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=dt();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=xt(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=Et&&(a-=o)}else l<=Et&&(a+=l);return{width:a,height:o,x:s,y:c}}function Ot(e,t){let n=Q(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=G(e)?Z(e):F(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function kt(e,t,n){let r;if(t===`viewport`)r=Dt(e,n);else if(t===`document`)r=Tt(U(e));else if(W(t))r=Ot(t,n);else{let n=yt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return B(r)}function At(e,t){let n=X(e);return n===t||!W(n)||J(n)?!1:Y(n).position===`fixed`||At(n,t)}function jt(e,t){let n=t.get(e);if(n)return n;let r=mt(e,[],!1).filter(e=>W(e)&&V(e)!==`body`),i=null,a=Y(e).position===`fixed`,o=a?X(e):e;for(;W(o)&&!J(o);){let t=Y(o),n=lt(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&(i.position===`absolute`||i.position===`fixed`)||K(o)&&!n&&At(e,o))?r=r.filter(e=>e!==o):i=t,o=X(o)}return t.set(e,r),r}function Mt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?at(t)?[]:jt(t,this._c):[].concat(n),r],o=kt(t,a[0],i),s=o.top,c=o.right,l=o.bottom,u=o.left;for(let e=1;e<a.length;e++){let n=kt(t,a[e],i);s=P(n.top,s),c=N(n.right,c),l=N(n.bottom,l),u=P(n.left,u)}return{width:c-u,height:l-s,x:u,y:s}}function Nt(e){let{width:t,height:n}=gt(e);return{width:t,height:n}}function Pt(e,t,n){let r=G(t),i=U(t),a=n===`fixed`,o=Q(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=F(0);function l(){c.x=xt(i)}if(r||!r&&!a)if((V(t)!==`body`||K(i))&&(s=ft(t)),r){let e=Q(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?St(i,s):F(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Ft(e){return Y(e).position===`static`}function It(e,t){if(!G(e)||Y(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return U(e)===n&&(n=n.ownerDocument.body),n}function Lt(e,t){let n=H(e);if(at(e))return n;if(!G(e)){let t=X(e);for(;t&&!J(t);){if(W(t)&&!Ft(t))return t;t=X(t)}return n}let r=It(e,t);for(;r&&it(r)&&Ft(r);)r=It(r,t);return r&&J(r)&&Ft(r)&&!lt(r)?n:r||ut(e)||n}var Rt=async function(e){let t=this.getOffsetParent||Lt,n=this.getDimensions,r=await n(e.floating);return{reference:Pt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function zt(e){return Y(e).direction===`rtl`}var Bt={convertOffsetParentRelativeRectToViewportRelativeRect:Ct,getDocumentElement:U,getClippingRect:Mt,getOffsetParent:Lt,getElementRects:Rt,getClientRects:wt,getDimensions:Nt,getScale:Z,isElement:W,isRTL:zt},Vt=Qe,Ht=He,Ut=$e,Wt=Ue,Gt=et,Kt=Ke,qt=Be,Jt=Ye,Yt=(e,t,n)=>{let r=new Map,i={platform:Bt,...n},a={...i.platform,_c:r};return ze(e,t,{...i,platform:a})};function Xt(e,t){let n=Math.min(e.top,t.top),r=Math.max(e.bottom,t.bottom),i=Math.min(e.left,t.left),a=Math.max(e.right,t.right)-i,o=r-n;return new DOMRect(i,n,a,o)}var Zt=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:i=60,shouldShow:a,appendTo:o,getReferencedVirtualElement:s,options:c}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.floatingUIOptions={strategy:`absolute`,placement:`top`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1,onShow:void 0,onHide:void 0,onUpdate:void 0,onDestroy:void 0},this.shouldShow=({view:e,state:t,from:n,to:r})=>{let{doc:i,selection:a}=t,{empty:o}=a,s=!i.textBetween(n,r).length&&(0,S.isTextSelection)(t.selection),c=this.element.contains(document.activeElement);return!(!(e.hasFocus()||c)||o||s||!this.editor.isEditable)},this.mousedownHandler=()=>{this.preventHide=!0},this.dragstartHandler=()=>{this.hide()},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.editor.isDestroyed){this.destroy();return}if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.handleDebouncedUpdate=(e,t)=>{let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);!n&&!r||(this.updateDebounceTimer&&clearTimeout(this.updateDebounceTimer),this.updateDebounceTimer=window.setTimeout(()=>{this.updateHandler(e,n,r,t)},this.updateDelay))},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(`bubbleMenu`);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`&&this.updateOptions(t.options)},this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=c?.scrollTarget??window,this.getReferencedVirtualElement=s,this.floatingUIOptions={...this.floatingUIOptions,...c},this.element.tabIndex=0,a&&(this.shouldShow=a),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.addEventListener(`dragstart`,this.dragstartHandler),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Wt(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Ut(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Vt(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(qt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Gt(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ht(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Kt(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Jt(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}get virtualElement(){let{selection:e}=this.editor.state,t=this.getReferencedVirtualElement?.call(this);if(t)return t;if(!this.view?.dom?.parentNode)return;let n=(0,S.posToDOMRect)(this.view,e.from,e.to),r={getBoundingClientRect:()=>n,getClientRects:()=>[n]};if(e instanceof C.NodeSelection){let t=this.view.nodeDOM(e.from),n=t.dataset.nodeViewWrapper?t:t.querySelector(`[data-node-view-wrapper]`);n&&(t=n),t&&(r={getBoundingClientRect:()=>t.getBoundingClientRect(),getClientRects:()=>[t.getBoundingClientRect()]})}if(e instanceof w.CellSelection){let{$anchorCell:t,$headCell:n}=e,i=t?t.pos:n.pos,a=n?n.pos:t.pos,o=this.view.nodeDOM(i),s=this.view.nodeDOM(a);if(!o||!s)return;let c=o===s?o.getBoundingClientRect():Xt(o.getBoundingClientRect(),s.getBoundingClientRect());r={getBoundingClientRect:()=>c,getClientRects:()=>[c]}}return r}updatePosition(){let e=this.virtualElement;e&&Yt(e,this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let{state:n}=e,r=n.selection.from!==n.selection.to;if(this.updateDelay>0&&r){this.handleDebouncedUpdate(e,t);return}let i=!t?.selection.eq(e.state.selection),a=!t?.doc.eq(e.state.doc);this.updateHandler(e,i,a,t)}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,element:this.element,view:this.view,state:t,oldState:e,from:i,to:a})||!1}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.getReferencedVirtualElement!==void 0&&(this.getReferencedVirtualElement=e.getReferencedVirtualElement),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.view.dom.removeEventListener(`dragstart`,this.dragstartHandler),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},Qt=e=>new C.Plugin({key:typeof e.pluginKey==`string`?new C.PluginKey(e.pluginKey):e.pluginKey,view:t=>new Zt({view:t,...e})}),$t=(0,y.defineComponent)({name:`BubbleMenu`,inheritAttrs:!1,props:{pluginKey:{type:[String,Object],default:`bubbleMenu`},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null},getReferencedVirtualElement:{type:Function,default:void 0}},setup(e,{slots:t,attrs:n}){let r=(0,y.ref)(null);return(0,y.onMounted)(()=>{let{editor:t,options:n,pluginKey:i,resizeDelay:a,appendTo:o,shouldShow:s,getReferencedVirtualElement:c,updateDelay:l}=e,u=r.value;u&&(u.style.visibility=`hidden`,u.style.position=`absolute`,u.remove(),(0,y.nextTick)(()=>{t.registerPlugin(Qt({editor:t,element:u,options:n,pluginKey:i,resizeDelay:a,appendTo:o,shouldShow:s,getReferencedVirtualElement:c,updateDelay:l}))}))}),(0,y.onBeforeUnmount)(()=>{let{pluginKey:t,editor:n}=e;n.unregisterPlugin(t)}),()=>(0,y.h)(`div`,{ref:r,...n},t.default?.call(t))}}),en=class{constructor({editor:e,element:t,view:n,updateDelay:r=250,resizeDelay:i=60,options:a,appendTo:o,shouldShow:s}){this.preventHide=!1,this.isVisible=!1,this.scrollTarget=window,this.shouldShow=({view:e,state:t})=>{let{selection:n}=t,{$anchor:r,empty:i}=n,a=r.depth===1,o=r.parent.isTextblock&&!r.parent.type.spec.code&&!r.parent.textContent&&r.parent.childCount===0&&!this.getTextContent(r.parent);return!(!e.hasFocus()||!i||!a||!o||!this.editor.isEditable)},this.floatingUIOptions={strategy:`absolute`,placement:`right`,offset:8,flip:{},shift:{},arrow:!1,size:!1,autoPlacement:!1,hide:!1,inline:!1},this.updateHandler=(e,t,n,r)=>{let{composing:i}=e;if(!(i||!t&&!n)){if(!this.getShouldShow(r)){this.hide();return}this.updatePosition(),this.show()}},this.mousedownHandler=()=>{this.preventHide=!0},this.focusHandler=()=>{setTimeout(()=>this.update(this.editor.view))},this.blurHandler=({event:e})=>{if(this.preventHide){this.preventHide=!1;return}e?.relatedTarget&&this.element.parentNode?.contains(e.relatedTarget)||e?.relatedTarget!==this.editor.view.dom&&this.hide()},this.transactionHandler=({transaction:e})=>{let t=e.getMeta(`floatingMenu`);t===`updatePosition`?this.updatePosition():t&&typeof t==`object`&&t.type===`updateOptions`&&this.updateOptions(t.options)},this.resizeHandler=()=>{this.resizeDebounceTimer&&clearTimeout(this.resizeDebounceTimer),this.resizeDebounceTimer=window.setTimeout(()=>{this.updatePosition()},this.resizeDelay)},this.editor=e,this.element=t,this.view=n,this.updateDelay=r,this.resizeDelay=i,this.appendTo=o,this.scrollTarget=a?.scrollTarget??window,this.floatingUIOptions={...this.floatingUIOptions,...a},this.element.tabIndex=0,s&&(this.shouldShow=s),this.element.addEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),this.editor.on(`focus`,this.focusHandler),this.editor.on(`blur`,this.blurHandler),this.editor.on(`transaction`,this.transactionHandler),window.addEventListener(`resize`,this.resizeHandler),this.scrollTarget.addEventListener(`scroll`,this.resizeHandler),this.update(n,n.state),this.getShouldShow()&&(this.show(),this.updatePosition())}getTextContent(e){return(0,S.getText)(e,{textSerializers:(0,S.getTextSerializersFromSchema)(this.editor.schema)})}get middlewares(){let e=[];return this.floatingUIOptions.flip&&e.push(Wt(typeof this.floatingUIOptions.flip==`boolean`?void 0:this.floatingUIOptions.flip)),this.floatingUIOptions.shift&&e.push(Ut(typeof this.floatingUIOptions.shift==`boolean`?void 0:this.floatingUIOptions.shift)),this.floatingUIOptions.offset&&e.push(Vt(typeof this.floatingUIOptions.offset==`boolean`?void 0:this.floatingUIOptions.offset)),this.floatingUIOptions.arrow&&e.push(qt(this.floatingUIOptions.arrow)),this.floatingUIOptions.size&&e.push(Gt(typeof this.floatingUIOptions.size==`boolean`?void 0:this.floatingUIOptions.size)),this.floatingUIOptions.autoPlacement&&e.push(Ht(typeof this.floatingUIOptions.autoPlacement==`boolean`?void 0:this.floatingUIOptions.autoPlacement)),this.floatingUIOptions.hide&&e.push(Kt(typeof this.floatingUIOptions.hide==`boolean`?void 0:this.floatingUIOptions.hide)),this.floatingUIOptions.inline&&e.push(Jt(typeof this.floatingUIOptions.inline==`boolean`?void 0:this.floatingUIOptions.inline)),e}getShouldShow(e){let{state:t}=this.view,{selection:n}=t,{ranges:r}=n,i=Math.min(...r.map(e=>e.$from.pos)),a=Math.max(...r.map(e=>e.$to.pos));return this.shouldShow?.call(this,{editor:this.editor,view:this.view,state:t,oldState:e,from:i,to:a})}updateOptions(e){if(e.updateDelay!==void 0&&(this.updateDelay=e.updateDelay),e.resizeDelay!==void 0&&(this.resizeDelay=e.resizeDelay),e.appendTo!==void 0&&(this.appendTo=e.appendTo),e.shouldShow!==void 0&&e.shouldShow&&(this.shouldShow=e.shouldShow),e.options!==void 0){let t=e.options.scrollTarget??window;t!==this.scrollTarget&&(this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.scrollTarget=t,this.scrollTarget.addEventListener(`scroll`,this.resizeHandler)),this.floatingUIOptions={...this.floatingUIOptions,...e.options}}}updatePosition(){let{selection:e}=this.editor.state,t=(0,S.posToDOMRect)(this.view,e.from,e.to);Yt({getBoundingClientRect:()=>t,getClientRects:()=>[t]},this.element,{placement:this.floatingUIOptions.placement,strategy:this.floatingUIOptions.strategy,middleware:this.middlewares}).then(({x:e,y:t,strategy:n,middlewareData:r})=>{if(r.hide?.referenceHidden||r.hide?.escaped){this.element.style.visibility=`hidden`;return}this.element.style.visibility=`visible`,this.element.style.width=`max-content`,this.element.style.position=n,this.element.style.left=`${e}px`,this.element.style.top=`${t}px`,this.isVisible&&this.floatingUIOptions.onUpdate&&this.floatingUIOptions.onUpdate()})}update(e,t){let n=!t?.selection.eq(e.state.selection),r=!t?.doc.eq(e.state.doc);this.updateHandler(e,n,r,t)}show(){var e;this.isVisible||(this.element.style.visibility=`visible`,this.element.style.opacity=`1`,(e=(typeof this.appendTo==`function`?this.appendTo():this.appendTo)??this.view.dom.parentElement)==null||e.appendChild(this.element),this.floatingUIOptions.onShow&&this.floatingUIOptions.onShow(),this.isVisible=!0)}hide(){this.isVisible&&(this.element.style.visibility=`hidden`,this.element.style.opacity=`0`,this.element.remove(),this.floatingUIOptions.onHide&&this.floatingUIOptions.onHide(),this.isVisible=!1)}destroy(){this.hide(),this.element.removeEventListener(`mousedown`,this.mousedownHandler,{capture:!0}),window.removeEventListener(`resize`,this.resizeHandler),this.scrollTarget.removeEventListener(`scroll`,this.resizeHandler),this.editor.off(`focus`,this.focusHandler),this.editor.off(`blur`,this.blurHandler),this.editor.off(`transaction`,this.transactionHandler),this.floatingUIOptions.onDestroy&&this.floatingUIOptions.onDestroy()}},tn=e=>new C.Plugin({key:typeof e.pluginKey==`string`?new C.PluginKey(e.pluginKey):e.pluginKey,view:t=>new en({view:t,...e})});(0,y.defineComponent)({name:`FloatingMenu`,inheritAttrs:!1,props:{pluginKey:{type:null,default:`floatingMenu`},editor:{type:Object,required:!0},updateDelay:{type:Number,default:void 0},resizeDelay:{type:Number,default:void 0},options:{type:Object,default:()=>({})},appendTo:{type:[Object,Function],default:void 0},shouldShow:{type:Function,default:null}},setup(e,{slots:t,attrs:n}){let r=(0,y.ref)(null);return(0,y.onMounted)(()=>{let{pluginKey:t,editor:n,updateDelay:i,resizeDelay:a,options:o,appendTo:s,shouldShow:c}=e,l=r.value;l&&(l.style.visibility=`hidden`,l.style.position=`absolute`,l.remove(),n.registerPlugin(tn({pluginKey:t,editor:n,element:l,updateDelay:i,resizeDelay:a,options:o,appendTo:s,shouldShow:c})))}),(0,y.onBeforeUnmount)(()=>{let{pluginKey:t,editor:n}=e;n.unregisterPlugin(t)}),()=>(0,y.h)(`div`,{ref:r,...n},t.default?.call(t))}});var $=e=>({default:null,parseHTML:t=>t.getAttribute(e),renderHTML:t=>t[e]?{[e]:t[e]}:{}}),nn=()=>{let e=$(`style`);return e.renderHTML=e=>e.style?{style:rn(e.style)}:{},e};function rn(e){return e.replace(/(?<![a-z-])width\s*:\s*([^;]+);?/gi,(e,t)=>/^\s*0\s*[a-z%]*\s*(!important)?\s*$/i.test(t)?`width: 100%;`:e)}var an=ce.Table.extend({addAttributes(){return{...this.parent?.(),border:$(`border`),cellpadding:$(`cellpadding`),cellspacing:$(`cellspacing`),style:nn()}},renderHTML({HTMLAttributes:e}){return[`table`,(0,S.mergeAttributes)(this.options.HTMLAttributes,e),[`tbody`,0]]}}),on=ce.TableRow.extend({addAttributes(){return{...this.parent?.(),style:$(`style`)}}}),sn={style:$(`style`),valign:$(`valign`),width:$(`width`)},cn=ce.TableCell.extend({addAttributes(){return{...this.parent?.(),...sn}}}),ln=ce.TableHeader.extend({addAttributes(){return{...this.parent?.(),...sn}}}),un=le.TextStyle.extend({parseHTML(){return[...this.parent?.()||[],{tag:`div`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?{}:!1},{tag:`a`,consuming:!1,getAttrs:e=>e.hasAttribute(`style`)?{}:!1}]}}),dn={name:`EmojiComponent`,components:{NodeViewWrapper:h.NodeViewWrapper,DtEmoji:p.default},props:h.nodeViewProps};function fn(e,t,n,r,i,a){let o=(0,y.resolveComponent)(`dt-emoji`),s=(0,y.resolveComponent)(`node-view-wrapper`);return(0,y.openBlock)(),(0,y.createBlock)(s,{class:`d-d-inline-block d-va-bottom d-lh0`},{default:(0,y.withCtx)(()=>[(0,y.createVNode)(o,{size:`500`,code:e.node.attrs.code},null,8,[`code`])]),_:1})}var pn=n.t(dn,[[`render`,fn]]),mn={name:`SuggestionList`,components:{DtListItem:u.default},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:e}){return e.key===`ArrowUp`?(this.upHandler(),!0):e.key===`ArrowDown`?(this.downHandler(),!0):e.key===`Enter`||e.key===`Tab`?(this.selectHandler(),!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()},async scrollActiveElementIntoView(){await this.$nextTick();let e=this.$refs.suggestionList.querySelector(`.d-list-item--highlighted`);e&&e.scrollIntoView({behavior:`smooth`,block:`nearest`})},selectHandler(){this.selectItem(this.selectedIndex)},selectItem(e){let t=this.items[e];switch(this.itemType){case`emoji`:this.command(t);return;case`mention`:this.command({name:t.name,id:t.id,avatarSrc:t.avatarSrc,contactKey:t.contactKey});break;case`channel`:this.command({name:t.name,id:t.id,locked:t.locked,channelKey:t.channelKey});break;case`slash-command`:this.command({command:t.command});break}}}},hn={class:`d-popover__dialog d-suggestion-list__container`},gn={ref:`suggestionList`,class:`d-suggestion-list`};function _n(e,t,n,r,i,a){let o=(0,y.resolveComponent)(`dt-list-item`);return(0,y.openBlock)(),(0,y.createElementBlock)(`div`,hn,[(0,y.withDirectives)((0,y.createElementVNode)(`ul`,gn,[((0,y.openBlock)(!0),(0,y.createElementBlock)(y.Fragment,null,(0,y.renderList)(n.items,(e,t)=>((0,y.openBlock)(),(0,y.createBlock)(o,{key:e.id,class:(0,y.normalizeClass)([`d-suggestion-list__item`,{"d-list-item--highlighted":t===i.selectedIndex}]),"navigation-type":`arrow-keys`,onClick:e=>a.selectItem(t),onKeydown:(0,y.withModifiers)(a.onKeyDown,[`prevent`])},{default:(0,y.withCtx)(()=>[((0,y.openBlock)(),(0,y.createBlock)((0,y.resolveDynamicComponent)(n.itemComponent),{item:e},null,8,[`item`]))]),_:2},1032,[`class`,`onClick`,`onKeydown`]))),128))],512),[[y.vShow,n.items.length]])])}var vn=n.t(mn,[[`render`,_n]]),yn=`top-start`;function bn(){return{getBoundingClientRect:()=>({width:0,height:0,x:0,y:0,top:0,left:0,right:0,bottom:0})}}function xn(e){return{getBoundingClientRect:e}}async function Sn(e,t,n={}){if(!e||!t?.getBoundingClientRect)return;let{placement:r=yn,middleware:i=[Vt(0),Wt(),Ut({padding:8})]}=n,{x:a,y:o}=await Yt(t,e,{placement:r,middleware:i});Object.assign(e.style,{left:`${a}px`,top:`${o}px`})}function Cn(e,t={}){let{zIndex:n=`650`}=t;e.style.position=`absolute`,e.style.zIndex=n,e.style.display=`none`}function wn(e){e&&(e.style.display=`block`)}function Tn(e){e&&(e.style.display=`none`)}function En(e,t){return n=>{n.key===`Escape`&&t()&&e()}}function Dn(e){document.addEventListener(`keydown`,e)}function On(e){document.removeEventListener(`keydown`,e)}function kn(e,t,n,r){return new h.VueRenderer(e,{props:{itemComponent:(0,y.markRaw)(t),itemType:n,...r},editor:r.editor})}function An(e){e.escHandler&&On(e.escHandler),e.floatingEl?.remove(),e.component?.destroy()}function jn(e,t,n={}){let{listComponent:r=vn,placement:i=yn,zIndex:a=`650`}=n;return()=>{let n=null,o=null,s=!1,c=bn(),l=null;function u(){Sn(o,c,{placement:i})}function d(){o&&(wn(o),s=!0,u())}function f(){o&&(Tn(o),s=!1)}return{onStart:i=>{n=kn(r,e,t,i),i.clientRect&&(o=n.element,Cn(o,{zIndex:a}),document.body.appendChild(o),c=xn(i.clientRect),l=En(f,()=>s),Dn(l),i.items.length>0&&d())},onUpdate(e){n?.updateProps(e),e.items.length>0?d():f(),e.clientRect&&(c=xn(e.clientRect),u())},onKeyDown(e){if(s)return n?.ref?.onKeyDown(e)},onExit(){An({escHandler:l,floatingEl:o,component:n}),l=null,o=null,n=null}}}}var Mn={name:`EmojiSuggestion`,components:{DtEmoji:p.default,DtStack:d.default},props:{item:{type:Object,required:!0}}};function Nn(e,t,n,r,i,a){let o=(0,y.resolveComponent)(`dt-emoji`),s=(0,y.resolveComponent)(`dt-stack`);return(0,y.openBlock)(),(0,y.createBlock)(s,{direction:`row`,gap:`100`},{default:(0,y.withCtx)(()=>[(0,y.createVNode)(o,{size:`200`,code:n.item.code},null,8,[`code`]),(0,y.createTextVNode)(` `+(0,y.toDisplayString)(n.item.code),1)]),_:1})}var Pn=n.t(Mn,[[`render`,Nn]]),Fn=20,In=(e,t,n)=>{let r=e.shortname?.replaceAll(`:`,``),i=t.shortname?.replaceAll(`:`,``),a=r.startsWith(n),o=i.startsWith(n);return a&&!o?-1:!a&&o?1:r.localeCompare(i)},Ln={items:({query:e})=>{if(e.length<2)return[];let t=Object.values(r.getEmojiData());return e=e.toLowerCase(),t.filter(t=>[t.name,t.shortname?.replaceAll(`:`,``),...t.keywords||[]].some(t=>t&&t.startsWith(e))).splice(0,Fn).sort((t,n)=>In(t,n,e)).map(e=>({code:e.shortname}))},command:({editor:e,range:t,props:n})=>{e.view.state.selection.$to.nodeAfter?.text?.startsWith(` `)&&(t.to+=1),e.chain().focus().insertContentAt(t,[{type:`emoji`,attrs:n}]).run(),window.getSelection()?.collapseToEnd()},render:jn(Pn,`emoji`)},Rn=/(:\w+:)$/,zn=RegExp(x.emojiPattern+`$`),Bn=e=>{if(e&&r.codeToEmojiData(e[0]))return{text:e[2]||e[0]}},Vn=e=>[...e.matchAll(r.emojiShortCodeRegex)].filter(e=>r.codeToEmojiData(e[0])).map(e=>({index:e.index,text:e[0],match:e})),Hn=S.Node.create({name:`emoji`,addOptions(){return{HTMLAttributes:{}}},group:`inline`,inline:!0,selectable:!1,atom:!0,addNodeView(){return h.VueNodeViewRenderer(pn)},addAttributes(){return{code:{default:null}}},parseHTML(){return[{tag:`emoji-component`}]},renderText({node:e}){let t=e.attrs.code??``,n=t?r.codeToEmojiData(t):void 0;return n?r.stringToUnicode(n.unicode_output):t},renderHTML({HTMLAttributes:e}){return[`emoji-component`,(0,S.mergeAttributes)(this.options.HTMLAttributes,e)]},addInputRules(){return[new S.InputRule({find:e=>{let t=e.match(Rn)||e.match(zn);if(t)return Bn(t)},handler:({state:e,range:t,match:n})=>{let{tr:r}=e,i=t.from,a=t.to;r.replaceWith(i,a,this.type.create({code:n[0]}))}})]},addPasteRules(){return[(0,S.nodePasteRule)({find:Vn,type:this.type,getAttributes(e){return{code:e[0]}}}),(0,S.nodePasteRule)({find:r.emojiRegex,type:this.type,getAttributes(e){return{code:e[0]}}})]},addProseMirrorPlugins(){return[(0,ue.default)({char:`:`,pluginKey:new C.PluginKey(`emoji`),editor:this.editor,...this.options.suggestion,...Ln})]},addKeyboardShortcuts(){return{Backspace:()=>this.editor.commands.command(({tr:e,state:t})=>{let n=!1,{selection:r}=t,{empty:i,anchor:a}=r;return i?(t.doc.nodesBetween(a-1,a,(t,r)=>{if(t.type.name===this.name)return n=!0,e.insertText(``,r,r+t.nodeSize),!1}),n):!1})}}});function Un(e,t,n=()=>!0){let r=[];t.lastIndex=0;let i;for(;i=t.exec(e);)n(e,i)&&r.push(i);return r}function Wn(e,t){return![`#`,`@`].includes(e.charAt(t.index))&&![`#`,`@`].includes(e.charAt(t.index-1))}function Gn(e){let t=RegExp(`(?:`+[`[!?.,:;'"]`,`(?:&|&amp;)(?:lt|gt|quot|apos|raquo|laquo|rsaquo|lsaquo);)+$`].join(`|`),`g`);return e.replace(t,``)}function Kn(e,t){let n=e.slice(0,t+1).search(/\S+\s*$/),r=e.slice(t).search(/\s/);if(r<0){let t=e.slice(n);return{text:t,from:n,to:n+t.length}}return{text:e.slice(n,r+t),from:n,to:r+t}}function qn(e,t,n,r){let i=Kn(e,t);if(r.lastIndex=0,!r.test(i.text))return i;let a=n===`left`?i.from-1:i.to+1;return a<=0||a>=e.length||a===t?i:qn(e,a,n,r)}function Jn(e,t,n,r){let i=(0,S.getMarksBetween)(Math.max(e.from-1,0),Math.min(e.to+1,t.content.size),t);for(let e of i)e.mark.type===r&&n.removeMark(e.from,e.to,r)}var Yn=t.getPhoneNumberRegex(1,15);function Xn(e,n,r,i,a,o){if(!e)return;let s=r-n-1;s=s<0?0:s;let c=i-n,l=qn(e,s,`left`,Yn),u=qn(e,c,`right`,Yn);Un(e.slice(l.from,u.to),t.linkRegex,Wn).forEach(e=>{let t=Gn(e[0]),r=n+l.from+e.index+1,i=r+t.length;a.addMark(r,i,o.create())})}function Zn(e){let t=!1;return new C.Plugin({key:new C.PluginKey(`autolink`),appendTransaction:(n,r,i)=>{let a=n.some(e=>e.docChanged)&&!r.doc.eq(i.doc);if(t&&!a)return;let{tr:o}=i,{textContent:s}=i.doc;if(!t||!r.doc.textContent)return Xn(s,0,0,s.length,o,e.type),t=!0,o;t=!0;let c=(0,S.getChangedRanges)((0,S.combineTransactionSteps)(r.doc,[...n]));return c.length?(c.forEach(({oldRange:t,newRange:n})=>{if(n.from===n.to){Xn(s,0,0,s.length,o,e.type);return}Jn(n,i.doc,o,e.type),(0,S.findChildrenInRange)(i.doc,n,e=>e.isTextblock).forEach(({node:r,pos:i})=>{Xn(r.textContent,i,t.from,n.to,o,e.type)})}),o):(Xn(s,0,0,s.length,o,e.type),o)}})}var Qn={class:`d-link d-c-text d-d-inline-block d-wb-break-all`,rel:`noopener noreferrer nofollow`},$n=S.Mark.create({name:`CustomLink`,renderHTML({HTMLAttributes:e}){return[`a`,(0,S.mergeAttributes)(this.options.HTMLAttributes,e,Qn)]},renderText({node:e}){return e.attrs.text},addProseMirrorPlugins(){return[Zn({type:this.type})]}}),er=S.Mark.create({name:`LinkPhoneNumbers`,renderHTML({HTMLAttributes:e}){return[`a`,(0,S.mergeAttributes)(e,{class:`d-link d-c-pointer d-d-inline-block d-wb-break-all`,rel:`noopener noreferrer nofollow`})]},addProseMirrorPlugins(){let e=this.editor,t=this.type;return[new C.Plugin({key:new C.PluginKey(`phoneClick`),props:{handleClick(n,r,i){let{state:a}=n,o=a.doc.resolve(r);if(!o.marks().some(e=>e.type===t))return!1;let s=(0,S.getMarkRange)(o,t),c=s?a.doc.textBetween(s.from,s.to):``;return i.preventDefault(),e.emit(`phone-click`,{phoneNumber:c}),!0}}})]}}),tr=de.default.extend({name:`ConfigurableImage`,addAttributes(){return{src:{default:``},alt:{default:void 0},title:{default:void 0},width:{default:void 0},height:{default:void 0},style:{default:void 0}}}}).configure({inline:!0,allowBase64:!0}),nr=new Set(`address.article.aside.blockquote.dd.details.dialog.div.dl.dt.fieldset.figcaption.figure.footer.form.h1.h2.h3.h4.h5.h6.header.hgroup.hr.li.main.nav.ol.p.pre.section.table.ul`.split(`.`)),rr=k.default.extend({parseHTML(){return[{tag:`div`,getAttrs:e=>{for(let t of e.children)if(nr.has(t.tagName.toLowerCase()))return!1;return null}}]},renderHTML({HTMLAttributes:e}){return[`div`,(0,S.mergeAttributes)(this.options.HTMLAttributes,e),0]}}),ir={name:`MentionComponent`,components:{NodeViewWrapper:h.NodeViewWrapper,DtLink:s.default},props:h.nodeViewProps,computed:{text(){return`@`+this.$props.node.attrs.name}},methods:{getMentionData(){return{name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,avatarSrc:this.$props.node.attrs.avatarSrc,contactKey:this.$props.node.attrs.contactKey}},handleClick(){this.$props.editor.emit(`mention-click`,this.getMentionData())},handleMouseEnter(e){this.$props.editor.emit(`mention-hover`,{...this.getMentionData(),event:e})},handleMouseLeave(e){this.$props.editor.emit(`mention-leave`,{...this.getMentionData(),event:e})}}};function ar(e,t,n,r,i,a){let o=(0,y.resolveComponent)(`dt-link`),s=(0,y.resolveComponent)(`node-view-wrapper`);return(0,y.openBlock)(),(0,y.createBlock)(s,{class:`d-d-inline-block`},{default:(0,y.withCtx)(()=>[(0,y.createVNode)(o,{tone:`mention`,onClick:(0,y.withModifiers)(a.handleClick,[`prevent`]),onMouseenter:a.handleMouseEnter,onMouseleave:a.handleMouseLeave,onFocusin:a.handleMouseEnter,onFocusout:a.handleMouseLeave},{default:(0,y.withCtx)(()=>[(0,y.createTextVNode)((0,y.toDisplayString)(a.text),1)]),_:1},8,[`onClick`,`onMouseenter`,`onMouseleave`,`onFocusin`,`onFocusout`])]),_:1})}var or=n.t(ir,[[`render`,ar]]),sr=M.default.extend({addNodeView(){return h.VueNodeViewRenderer(or)},parseHTML(){return[{tag:`mention-component`}]},addAttributes(){return{name:{default:``},avatarSrc:{default:``},id:{default:``},contactKey:{default:``}}},renderText({node:e}){return`@${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return[`mention-component`,(0,S.mergeAttributes)(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:`@`,pluginKey:new C.PluginKey(`mentionSuggestion`)}}),cr={name:`ChannelComponent`,components:{NodeViewWrapper:h.NodeViewWrapper,DtLink:s.default,DtIconLock:b.DtIconLock,DtStack:d.default},props:h.nodeViewProps,computed:{text(){return this.$props.node.attrs.locked?this.$props.node.attrs.name:`#`+this.$props.node.attrs.name}},methods:{handleClick(){let e={name:this.$props.node.attrs.name,id:this.$props.node.attrs.id,locked:this.$props.node.attrs.locked,channelKey:this.$props.node.attrs.channelKey};this.$props.editor.emit(`channel-click`,e)}}};function lr(e,t,n,r,i,a){let o=(0,y.resolveComponent)(`dt-icon-lock`),s=(0,y.resolveComponent)(`dt-stack`),c=(0,y.resolveComponent)(`dt-link`),l=(0,y.resolveComponent)(`node-view-wrapper`);return(0,y.openBlock)(),(0,y.createBlock)(l,{class:`d-d-inline-block`},{default:(0,y.withCtx)(()=>[(0,y.createVNode)(c,{tone:`mention`,onClick:(0,y.withModifiers)(a.handleClick,[`prevent`])},{default:(0,y.withCtx)(()=>[(0,y.createVNode)(s,{direction:`row`,gap:`0`},{default:(0,y.withCtx)(()=>[e.$props.node.attrs.locked?((0,y.openBlock)(),(0,y.createBlock)(o,{key:0,size:`200`})):(0,y.createCommentVNode)(``,!0),(0,y.createElementVNode)(`span`,null,(0,y.toDisplayString)(a.text),1)]),_:1})]),_:1},8,[`onClick`])]),_:1})}var ur=n.t(cr,[[`render`,lr]]),dr=M.default.extend({name:`channel`,addNodeView(){return h.VueNodeViewRenderer(ur)},parseHTML(){return[{tag:`channel-component`}]},addAttributes(){return{name:{default:``},id:{default:``},locked:{default:!1},channelKey:{default:``}}},renderText({node:e}){return`#${e.attrs.id}`},renderHTML({HTMLAttributes:e}){return[`channel-component`,(0,S.mergeAttributes)(this.options.HTMLAttributes,e)]}}).configure({suggestion:{char:`#`,pluginKey:new C.PluginKey(`channelSuggestion`)}}),fr={name:`SlashCommandsComponent`,components:{NodeViewWrapper:h.NodeViewWrapper},props:{...h.nodeViewProps},emits:[`selected-command`],computed:{text(){return`/`+this.$props.node.attrs.command}},created(){let e=this.$props.node.attrs.command;this.$emit(`selected-command`,e);let t=this.editor?.storage?.[`slash-commands`]?.onSelectedCommand;t&&typeof t==`function`&&t(e)}};function pr(e,t,n,r,i,a){let o=(0,y.resolveComponent)(`node-view-wrapper`);return(0,y.openBlock)(),(0,y.createBlock)(o,{class:`d-d-inline-block`},{default:(0,y.withCtx)(()=>[(0,y.createTextVNode)((0,y.toDisplayString)(a.text),1)]),_:1})}var mr=n.t(fr,[[`render`,pr]]),hr=(e,t)=>[...e.matchAll(t)].map(e=>{let t=e[2];return t.endsWith(` `)||(t+=` `),{index:e.index,text:t,match:e}}),gr=M.default.extend({name:`slash-commands`,group:`inline`,inline:!0,addOptions(){return{...this.parent?.(),onSelectedCommand:null}},addStorage(){return{onSelectedCommand:this.options.onSelectedCommand}},addNodeView(){return h.VueNodeViewRenderer(mr)},parseHTML(){return[{tag:`command-component`}]},addAttributes(){return{command:{default:``},parametersExample:{default:``},description:{default:``}}},renderText({node:e}){return`/${e.attrs.command}`},renderHTML({HTMLAttributes:e}){return[`command-component`,(0,S.mergeAttributes)(this.options.HTMLAttributes,e)]},addInputRules(){let e=this.options.suggestion?.items({query:``}).map(e=>e.command);return[(0,S.nodeInputRule)({find:RegExp(`^((?:\\/)(${e.join(`|`)})) $`),type:this.type,getAttributes(e){return{command:e[2]}}})]},addPasteRules(){let e=this.options.suggestion?.items({query:``}).map(e=>e.command),t=RegExp(`^((?:\\/)(${e.join(`|`)})) ?$`,`g`);return[(0,S.nodePasteRule)({find:e=>hr(e,t),type:this.type,getAttributes(e){return{command:e[0].trim()}}})]}}).configure({suggestion:{char:`/`,pluginKey:new C.PluginKey(`slashCommandSuggestion`)}}),_r=100,vr={name:`VariableComponent`,components:{DtBadge:a.default,DtButton:l.default,DtPopover:f.default,DtInput:m.default,NodeViewWrapper:h.NodeViewWrapper},props:h.nodeViewProps,data(){return{i18n:new c.DialtoneLocalization,MAX_VARIABLE_ALT_LENGTH:_r}},computed:{altText:{get(){return this.node?.attrs?.altText||``},set(e){this.updateAttributes({altText:e})}},variableId(){return this.node?.attrs?.id},placeholder(){return this.variableData?.placeholder||``},variableItems(){return this.extension?.options?.variableItems||[]},variableData(){return this.variableItems.find(e=>e.id===this.variableId)},enableAltText(){return this.node?.attrs?.enableAltText},badgeLabel(){return`{} ${this.placeholder}`},placeholderText(){return`Replaces ${this.placeholder}`}}};function yr(e,t,n,r,i,a){let o=(0,y.resolveComponent)(`dt-badge`),s=(0,y.resolveComponent)(`dt-button`),c=(0,y.resolveComponent)(`dt-input`),l=(0,y.resolveComponent)(`dt-popover`),u=(0,y.resolveComponent)(`node-view-wrapper`);return(0,y.openBlock)(),(0,y.createBlock)(u,{class:`d-d-inline-block`},{default:(0,y.withCtx)(()=>[a.enableAltText?((0,y.openBlock)(),(0,y.createBlock)(l,{key:0,padding:`small`,"navigation-type":`arrow-keys`,placement:`top-start`,modal:!1},{anchor:(0,y.withCtx)(({attrs:e})=>[(0,y.createVNode)(s,(0,y.mergeProps)(e,{kind:`unstyled`}),{default:(0,y.withCtx)(()=>[(0,y.createVNode)(o,{text:a.badgeLabel,contenteditable:`false`},null,8,[`text`])]),_:1},16)]),content:(0,y.withCtx)(({close:e})=>[(0,y.createVNode)(c,{modelValue:a.altText,"onUpdate:modelValue":t[0]||(t[0]=e=>a.altText=e),class:`d-p-100 d-w332`,label:i.i18n.$t(`DIALTONE_EDITOR_VARIABLE_LABEL`),placeholder:a.placeholderText,validate:{length:{description:i.i18n.$t(`DIALTONE_EDITOR_VARIABLE_VALIDATE_DESCRIPTION`),message:i.i18n.$t(`DIALTONE_EDITOR_VARIABLE_VALIDATE_MESSAGE`),max:i.MAX_VARIABLE_ALT_LENGTH,warn:i.MAX_VARIABLE_ALT_LENGTH,limitMaxLength:!0}},onKeyup:(0,y.withKeys)(t=>e(),[`enter`])},null,8,[`modelValue`,`label`,`placeholder`,`validate`,`onKeyup`])]),_:1})):((0,y.openBlock)(),(0,y.createBlock)(o,{key:1,text:a.badgeLabel,contenteditable:`false`},null,8,[`text`]))]),_:1})}var br=n.t(vr,[[`render`,yr]]),xr=S.Node.create({name:`variable`,group:`inline`,inline:!0,selectable:!0,atom:!0,addOptions(){return{HTMLAttributes:{},variableItems:[]}},addNodeView(){return h.VueNodeViewRenderer(br)},addAttributes(){return{id:{default:null,parseHTML:e=>e.getAttribute(`data-variable-id`),renderHTML:e=>e.id?{"data-variable-id":e.id}:{}},altText:{default:``,parseHTML:e=>e.getAttribute(`data-alt-text`),renderHTML:e=>e.altText?{"data-alt-text":e.altText}:{}},enableAltText:{default:!0,parseHTML:e=>e.getAttribute(`data-enable-alt-text`)===`true`,renderHTML:e=>({"data-enable-alt-text":String(e.enableAltText)})}}},parseHTML(){return[{tag:`variable`}]},renderText({node:e}){return e.attrs.altText},renderHTML({node:e,HTMLAttributes:t}){return[`variable`,(0,S.mergeAttributes)(this.options.HTMLAttributes,t,{"data-variable-id":e.attrs.id,"data-alt-text":e.attrs.altText,"data-enable-alt-text":String(e.attrs.enableAltText)})]},addCommands(){return{insertVariable:(e={})=>({commands:t})=>t.insertContent({type:this.name,attrs:{id:e.id||null,altText:e.altText||``,enableAltText:e.enableAltText}})}}}),Sr={name:`MentionSuggestion`,components:{DtAvatar:i.default,DtStack:d.default,DtText:o.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name},avatarSrc(){return this.item.avatarSrc},presence(){return this.item.presence},status(){return this.item.status},presenceText(){return this.item.presenceText},presenceFontColorClass(){return{active:`d-mention-suggestion__presence--active`,busy:`d-mention-suggestion__presence--busy`,away:`d-mention-suggestion__presence--away`,offline:`d-mention-suggestion__presence--busy`}[this.presence]},showDetails(){return this.item.showDetails}}},Cr={class:`d-mention-suggestion__name`};function wr(e,t,n,r,i,a){let o=(0,y.resolveComponent)(`dt-avatar`),s=(0,y.resolveComponent)(`dt-text`),c=(0,y.resolveComponent)(`dt-stack`);return(0,y.openBlock)(),(0,y.createBlock)(c,{direction:`row`,class:`d-mention-suggestion__container`,gap:`100`},{default:(0,y.withCtx)(()=>[(0,y.createVNode)(o,{"full-name":a.name,"image-src":a.avatarSrc,"image-alt":a.name,"show-presence":a.showDetails,presence:a.presence,size:200},null,8,[`full-name`,`image-src`,`image-alt`,`show-presence`,`presence`]),(0,y.createVNode)(c,{class:`d-mention-suggestion__details-container`,gap:`1`},{default:(0,y.withCtx)(()=>[(0,y.createElementVNode)(`span`,Cr,(0,y.toDisplayString)(a.name),1),a.showDetails?((0,y.openBlock)(),(0,y.createBlock)(c,{key:0,direction:`row`,gap:`50`},{default:(0,y.withCtx)(()=>[a.presenceText?((0,y.openBlock)(),(0,y.createBlock)(s,{key:0,kind:`label`,size:200,strength:`normal`,class:(0,y.normalizeClass)([`d-mention-suggestion__presence`,[a.presenceFontColorClass]])},{default:(0,y.withCtx)(()=>[(0,y.createTextVNode)((0,y.toDisplayString)(a.presenceText),1)]),_:1},8,[`class`])):(0,y.createCommentVNode)(``,!0),a.status&&a.presenceText?((0,y.openBlock)(),(0,y.createBlock)(s,{key:1,kind:`label`,size:200,strength:`normal`,as:`div`,class:`d-mention-suggestion__divider`},{default:(0,y.withCtx)(()=>[...t[0]||(t[0]=[(0,y.createTextVNode)(` • `,-1)])]),_:1})):(0,y.createCommentVNode)(``,!0),a.status?((0,y.openBlock)(),(0,y.createBlock)(s,{key:2,kind:`label`,size:200,strength:`normal`,as:`div`,class:`d-mention-suggestion__status`},{default:(0,y.withCtx)(()=>[(0,y.createTextVNode)((0,y.toDisplayString)(a.status),1)]),_:1})):(0,y.createCommentVNode)(``,!0)]),_:1})):(0,y.createCommentVNode)(``,!0)]),_:1})]),_:1})}var Tr={allowSpaces:!0,render:jn(n.t(Sr,[[`render`,wr]]),`mention`)},Er={name:`ChannelSuggestion`,components:{DtStack:d.default,DtIconHash:fe.default,DtIconLock:pe.default},props:{item:{type:Object,required:!0}},computed:{name(){return this.item.name}}};function Dr(e,t,n,r,i,a){let o=(0,y.resolveComponent)(`dt-icon-hash`),s=(0,y.resolveComponent)(`dt-icon-lock`),c=(0,y.resolveComponent)(`dt-stack`);return(0,y.openBlock)(),(0,y.createBlock)(c,{direction:`row`,gap:`100`},{default:(0,y.withCtx)(()=>[n.item.locked?((0,y.openBlock)(),(0,y.createBlock)(s,{key:1,size:`300`})):((0,y.openBlock)(),(0,y.createBlock)(o,{key:0,size:`300`})),(0,y.createElementVNode)(`span`,null,(0,y.toDisplayString)(a.name),1)]),_:1})}var Or={allowSpaces:!0,render:jn(n.t(Er,[[`render`,Dr]]),`channel`)},kr={name:`SlashCommandSuggestion`,components:{DtText:o.default},props:{item:{type:Object,required:!0}},computed:{command(){return this.item.command},description(){return this.item.description},parametersExample(){return this.item.parametersExample}}},Ar={key:0};function jr(e,t,n,r,i,a){let o=(0,y.resolveComponent)(`dt-text`);return(0,y.openBlock)(),(0,y.createElementBlock)(`div`,null,[(0,y.createVNode)(o,{kind:`body`,size:300,density:300,as:`div`},{default:(0,y.withCtx)(()=>[(0,y.createElementVNode)(`span`,null,`/`+(0,y.toDisplayString)(a.command),1),a.parametersExample?((0,y.openBlock)(),(0,y.createElementBlock)(`span`,Ar,(0,y.toDisplayString)(a.parametersExample),1)):(0,y.createCommentVNode)(``,!0)]),_:1}),(0,y.createVNode)(o,{kind:`body`,size:200,tone:`tertiary`,as:`div`},{default:(0,y.withCtx)(()=>[(0,y.createTextVNode)((0,y.toDisplayString)(a.description),1)]),_:1})])}var Mr={allowSpaces:!0,startOfLine:!0,render:jn(n.t(kr,[[`render`,jr]]),`slash-command`)},Nr={name:`DtRichTextEditor`,components:{EditorContent:h.EditorContent,BubbleMenu:$t,DtButton:l.default,DtStack:d.default},props:{modelValue:{type:[Object,String],default:``},editable:{type:Boolean,default:!0},allowTyping:{type:Boolean,default:!0},pasteRichText:{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(e){return typeof e==`string`?_.RICH_TEXT_EDITOR_AUTOFOCUS_TYPES.includes(e):!0}},outputFormat:{type:String,default:`html`,validator(e){return _.RICH_TEXT_EDITOR_OUTPUT_FORMATS.includes(e)}},placeholder:{type:String,default:``},link:{type:[Boolean,Object],default:!1},customLink:{type:[Boolean,Object],default:!1},linkPhoneNumbers:{type:Array,default:null},mentionSuggestion:{type:Object,default:null},channelSuggestion:{type:Object,default:null},slashCommandSuggestion:{type:Object,default:null},allowBlockquote:{type:Boolean,default:!0},allowBold:{type:Boolean,default:!0},allowBulletList:{type:Boolean,default:!0},allowItalic:{type:Boolean,default:!0},allowStrike:{type:Boolean,default:!0},allowUnderline:{type:Boolean,default:!0},allowCode:{type:Boolean,default:!0},allowCodeblock:{type:Boolean,default:!0},allowInlineImages:{type:Boolean,default:!1},allowFontColor:{type:Boolean,default:!1},allowBackgroundColor:{type:Boolean,default:!1},allowFontSize:{type:Boolean,default:!1},allowFontFamily:{type:Boolean,default:!1},allowLineHeight:{type:Boolean,default:!1},allowVariable:{type:Boolean,default:!1},variableItems:{type:Array,default:()=>[]},additionalExtensions:{type:Array,default:()=>[]},showLinkBubbleMenu:{type:Boolean,default:!0},preserveWhitespace:{type:[Boolean,String],default:`full`},useDivTags:{type:Boolean,default:!1},allowTables:{type:Boolean,default:!1},allowTextAlign:{type:Boolean,default:!0},allowImageResize:{type:Boolean,default:!1}},emits:[`update:modelValue`,`json-input`,`html-input`,`text-input`,`markdown-input`,`blur`,`focus`,`enter`,`edit-link`,`selected`,`selected-command`,`mention-click`,`mention-hover`,`mention-leave`,`channel-click`,`phone-click`,`link-click`],data(){return{editor:null,appendTo:()=>t.returnFirstEl(this.$refs.editor.$el).getRootNode()?.querySelector(`body`),floatingOptions:{placement:`top-start`},i18n:new c.DialtoneLocalization}},computed:{attrs(){return{...this.$attrs,onInput:()=>{},onFocus:()=>{},onBlur:()=>{}}},extensions(){let e=[D.default,oe.default,te.UndoRedo,O.default];e.push(this.useDivTags?rr:k.default),this.allowBold&&e.push(A.default),this.allowBlockquote&&e.push(T.default),this.allowBulletList&&(e.push(j.BulletList),e.push(j.ListItem.extend({renderText({node:e}){return e.textContent}})),e.push(j.OrderedList)),this.allowItalic&&e.push(ne.default),this.allowStrike&&e.push(ie.default),this.allowUnderline&&e.push(ae.default),this.placeholder&&e.push(te.Placeholder.configure({placeholder:this.placeholder}));let t=this,n=S.Extension.create({addKeyboardShortcuts(){return{"Shift-Enter":({editor:e})=>t.allowLineBreaks?!1:(e.commands.first(({commands:e})=>[()=>e.newlineInCode(),()=>t.allowBulletList&&e.splitListItem(`listItem`),()=>e.createParagraphNear(),()=>e.liftEmptyBlock(),()=>e.splitBlock()]),!0),Enter:()=>t.allowLineBreaks?!1:(t.$emit(`enter`),!0)}}});if(e.push(n),this.link&&e.push(re.default.extend({inclusive:!1,addKeyboardShortcuts(){return{"Mod-k":()=>(t.$emit(`edit-link`),!0)}}}).configure({HTMLAttributes:{class:`d-link d-wb-break-all`},openOnClick:!1,autolink:!this.customLink,protocols:_.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS})),this.customLink&&e.push(this.getExtension($n,this.customLink)),this.linkPhoneNumbers!==null&&e.push(er),this.mentionSuggestion){let t={...this.mentionSuggestion,...Tr};e.push(sr.configure({suggestion:t}))}if(this.channelSuggestion){let t={...this.channelSuggestion,...Or};e.push(dr.configure({suggestion:t}))}if(this.slashCommandSuggestion){let t={...this.slashCommandSuggestion,...Mr};e.push(gr.configure({suggestion:t,onSelectedCommand:e=>{this.$emit(`selected-command`,e)}}))}return this.allowVariable&&e.push(xr.configure({variableItems:this.variableItems})),e.push(Hn),this.allowTextAlign&&e.push(se.default.configure({types:[`paragraph`]})),this.allowCode&&e.push(E.default),this.allowCodeblock&&e.push(ee.default.extend({renderText({node:e,pos:t,range:n}){let r=n?.from??0,i=n?.to??t+e.nodeSize;if(r<=t&&i>=t+e.nodeSize)return`\`\`\`\n${e.textContent}\n\`\`\``;let a=Math.max(0,r-t-1),o=Math.min(e.textContent.length,i-t-1);return e.textContent.slice(a,o)},addCommands(){return{...this.parent?.(),toggleCodeBlock:(e={})=>({state:t,chain:n,commands:r})=>{let i=t.schema.nodes[this.name],{$from:a,$to:o}=t.selection,s=[];return t.doc.nodesBetween(a.pos,o.pos,(e,t)=>{if(e.isTextblock)return s.push({node:e,pos:t}),!1}),s.length<=1?r.toggleNode(this.name,`paragraph`,e):s.every(({node:e})=>e.type===i)?r.toggleNode(this.name,`paragraph`):n().setNode(this.name,e).command(({tr:e})=>{for(let n=s.length-1;n>0;n--){let r=e.mapping.map(s[n].pos),a=r-1;e.doc.resolve(a).parent.type===i&&e.replaceWith(a,r+1,t.schema.text(`
2
+ `))}return!0}).run()}}}}).configure({HTMLAttributes:{class:`d-rich-text-editor__code-block`}})),this.allowInlineImages&&e.push(tr.configure({resize:{enabled:this.allowImageResize,alwaysPreserveAspectRatio:!0}})),(this.allowFontFamily||this.allowFontColor||this.allowFontSize||this.allowBackgroundColor||this.allowLineHeight)&&(e.push(le.TextStyleKit.configure({textStyle:!1,color:this.allowFontColor,backgroundColor:this.allowBackgroundColor,fontFamily:this.allowFontFamily,fontSize:this.allowFontSize,lineHeight:this.allowLineHeight})),e.push(un)),this.additionalExtensions.length&&e.push(...this.additionalExtensions),this.allowTables&&e.push(an.configure({resizable:!0}),on,ln,cn,te.Gapcursor),e},inputAttrs(){let e={"aria-label":this.inputAriaLabel,"aria-multiline":!0,role:`textbox`};return this.editable||(e[`aria-readonly`]=!0),e}},watch:{editable(e){this.editor.setEditable(e),this.updateEditorAttributes({"aria-readonly":!e})},inputClass(e){this.updateEditorAttributes({class:e})},inputAriaLabel(e){this.updateEditorAttributes({"aria-label":e})},extensions(){this.destroyEditor(),this.createEditor()},modelValue(e){this.processValue(e)},linkPhoneNumbers(){this._applyPhoneMarks()}},created(){this.createEditor()},beforeUnmount(){this.destroyEditor()},mounted(){t.warnIfUnmounted(t.returnFirstEl(this.$el),this.$options.name),this.processValue(this.modelValue,!1)},methods:{createEditor(){this.editor=new h.Editor({autofocus:this.autoFocus,content:this.modelValue,editable:this.editable,extensions:this.extensions,shouldRerenderOnTransaction:!1,parseOptions:{preserveWhitespace:this.preserveWhitespace},editorProps:{attributes:{...this.inputAttrs,class:this.inputClass},handleDOMEvents:{click:(e,t)=>{if(!this.link||t.button!==0)return!1;let n=t.target?.closest?.(`a`);return n?(this.editor.emit(`link-click`,{href:n.href,text:n.textContent,event:t}),t.defaultPrevented):!1}},handleKeyDown:(e,t)=>{if(this.allowTyping)return!1;let n=[`Backspace`];return!this.allowLineBreaks&&!t.shiftKey&&n.push(`Enter`),!n.includes(t.key)},handlePaste:(e,t)=>{let n=t.clipboardData||window.clipboardData,r=n.getData(`text/plain`),i=n.getData(`text/html`);return this.processPasteData(e,r,i)},transformPastedHTML(e){return e.replace(/<hr[^>]*\/?>/gi,`<p><br></p>`).replace(/(<\/\w+>)((<br \/>)+)/g,`$2$1`).replace(/(<br[^>]*>\s*)+<\/p>(\s*)$/i,`</p>$2`)}}}),this.addEditorListeners()},bubbleMenuShouldShow({editor:e}){return this.showLinkBubbleMenu&&e.isActive(`link`)},getSelectedLinkText(e){let{view:t,state:n}=e,{from:r,to:i}=t.state.selection,a=n.doc.textBetween(r,i,``),o=this.editor.state.doc.nodeAt(r);return o&&o.marks?.at(0)?.type?.name===`link`?o.textContent:a},editLink(){let e=this.getSelectedLinkText(this.editor),t={href:this.editor.getAttributes(`link`).href,text:e};this.$emit(`edit-link`,t)},removeLink(){this.editor?.chain()?.focus()?.unsetLink()?.run()},openLink(){this.editor?.chain()?.focus();let e=this.editor.getAttributes(`link`).href;window.open(e,`_blank`)},forceLinkifyPendingText(){!this.editor||!this.link||this.customLink||g.t(this.editor)},setLink(e,t,n,r=_.RICH_TEXT_EDITOR_SUPPORTED_LINK_PROTOCOLS,i){if(!e){this.removeLink();return}r.find(t=>t.test(e))||(e=`${i}${e}`),this.editor.chain().focus().extendMarkRange(`link`).run();let a=this.editor?.view?.state?.selection,o=t||e;this.editor.chain().focus().insertContent(o).setTextSelection({from:a.from,to:a.from+o.length}).setLink({href:e,class:n.class}).run()},processValue(e,t=!0){if(!this.editor)return;let n=this.getOutput();if(!(t&&(0,me.default)(e,n))){if(typeof e==`string`&&this.outputFormat===`text`){let t=RegExp(`(${x.emojiPattern})`,`g`);e=e?.replace(t,`<emoji-component code="$1"></emoji-component>`)}this.editor.commands.setContent(e,{emitUpdate:!1,parseOptions:{preserveWhitespace:this.preserveWhitespace}}),this._applyPhoneMarks()}},_applyPhoneMarks(){if(!this.editor)return;let e=this.editor.schema.marks.LinkPhoneNumbers;if(!e)return;let{tr:t,doc:n}=this.editor.state;t.removeMark(0,n.content.size,e),this.linkPhoneNumbers?.length&&n.descendants((n,r)=>{if(!(!n.isText||!n.text))for(let i of this.linkPhoneNumbers){let a=0,o;for(;(o=n.text.indexOf(i,a))!==-1;)t.addMark(r+o,r+o+i.length,e.create()),a=o+i.length}}),this.editor.view.dispatch(t)},destroyEditor(){this.editor.destroy()},insertPlainTextWithHardBreaks(e,t){let n=(this.pasteRichText?t:t.replace(/\r\n/g,`
3
+ `).replace(/\n\n/g,`
4
+ `)).replace(/[\r\n]+$/,``).split(/\r?\n/),r=[];for(let e=0;e<n.length;e++)e>0&&r.push({type:`hardBreak`}),n[e]&&r.push({type:`text`,text:n[e]});this.editor.chain().focus().insertContent(r).run()},shouldPreserveLineBreaks(e,t){return this.pasteRichText?!t&&e&&this.hasBlankLines(e):!!e},processPasteData(e,t,n){if(this.shouldPreserveLineBreaks(t,n))return this.insertPlainTextWithHardBreaks(e,t),!0;if(this.shouldHandlePreformattedHTML(n)){let t=this.extractPreformattedText(n);if(t&&t.includes(`
5
+ `))return this.insertPlainTextWithHardBreaks(e,t),!0}return!1},shouldHandlePreformattedHTML(e){return this.pasteRichText&&e&&this.containsPreformattedContent(e)},containsPreformattedContent(e){let t=document.createElement(`div`);t.innerHTML=e;let n=t.querySelectorAll(`*`);for(let e of n)if(this.hasPreWhitespace(e)&&this.hasLineBreaks(e))return!0;return!1},hasPreWhitespace(e){let t=e.getAttribute(`style`)||``,n=e.style.whiteSpace||``,r=n===`pre`||n===`pre-wrap`,i=t.includes(`white-space: pre`);return r||i},hasLineBreaks(e){return e.textContent&&e.textContent.includes(`
6
+ `)},hasBlankLines(e){return e.includes(`
7
+
8
+ `)||/\n\s*\n/.test(e)},extractPreformattedText(e){let t=document.createElement(`div`);return t.innerHTML=e,this.walkAndExtractText(t)},walkAndExtractText(e){let t=``;if(e.nodeType===Node.TEXT_NODE)t+=e.textContent;else if(e.nodeType===Node.ELEMENT_NODE)if(this.hasPreWhitespace(e))t+=e.textContent;else for(let n of e.childNodes)t+=this.walkAndExtractText(n);return t},triggerInputChangeEvents(){let e=this.getOutput();this.$emit(`update:modelValue`,e);let t=this.editor.getJSON();this.$emit(`json-input`,t);let n=this.editor.getHTML();this.$emit(`html-input`,n);let r=this.editor.getText({blockSeparator:`
9
+ `});this.$emit(`text-input`,r);let i=v.t(t,this.extensions);this.$emit(`markdown-input`,i)},addEditorListeners(){this.editor.on(`create`,()=>{this.triggerInputChangeEvents()}),this.editor.on(`update`,()=>{this.triggerInputChangeEvents()}),this.editor.on(`selectionUpdate`,({editor:e})=>{this.$emit(`selected`,this.getSelectedLinkText(e))}),this.editor.on(`focus`,({event:e})=>{this.$emit(`focus`,e)}),this.editor.on(`blur`,({event:e})=>{this.$emit(`blur`,e)}),this.editor.on(`mention-click`,e=>{this.$emit(`mention-click`,e)}),this.editor.on(`mention-hover`,e=>{this.$emit(`mention-hover`,e)}),this.editor.on(`mention-leave`,e=>{this.$emit(`mention-leave`,e)}),this.editor.on(`channel-click`,e=>{this.$emit(`channel-click`,e)}),this.editor.on(`phone-click`,e=>{this.$emit(`phone-click`,e)}),this.editor.on(`link-click`,e=>{this.$emit(`link-click`,e)})},getOutput(){switch(this.outputFormat){case`json`:return this.editor.getJSON();case`html`:return this.editor.getHTML();case`markdown`:return v.t(this.editor.getJSON(),this.extensions);default:return this.editor.getText({blockSeparator:`
10
+ `})}},getExtension(e,t){return typeof t==`boolean`?e:e.configure?.(t)},updateEditorAttributes(e){this.editor.setOptions({editorProps:{attributes:{...this.inputAttrs,class:this.inputClass,...e}}})},focusEditor(){this.editor.commands.focus()}}},Pr={class:`d-popover__dialog`};function Fr(e,t,n,r,i,a){let o=(0,y.resolveComponent)(`dt-button`),s=(0,y.resolveComponent)(`dt-stack`),c=(0,y.resolveComponent)(`bubble-menu`),l=(0,y.resolveComponent)(`editor-content`);return(0,y.openBlock)(),(0,y.createElementBlock)(`div`,null,[i.editor&&n.link?((0,y.openBlock)(),(0,y.createBlock)(c,{key:0,editor:i.editor,"should-show":a.bubbleMenuShouldShow,options:i.floatingOptions,"append-to":i.appendTo,style:{visibility:`visible`}},{default:(0,y.withCtx)(()=>[(0,y.createElementVNode)(`div`,Pr,[(0,y.createVNode)(s,{direction:`row`,class:`d-rich-text-editor-bubble-menu__button-stack`,gap:`0`},{default:(0,y.withCtx)(()=>[(0,y.createVNode)(o,{kind:`muted`,importance:`clear`,onClick:a.editLink},{default:(0,y.withCtx)(()=>[(0,y.createTextVNode)((0,y.toDisplayString)(i.i18n.$t(`DIALTONE_RICH_TEXT_EDITOR_EDIT_BUTTON_LABEL`)),1)]),_:1},8,[`onClick`]),(0,y.createVNode)(o,{kind:`muted`,importance:`clear`,onClick:a.openLink},{default:(0,y.withCtx)(()=>[(0,y.createTextVNode)((0,y.toDisplayString)(i.i18n.$t(`DIALTONE_RICH_TEXT_EDITOR_OPEN_LINK_BUTTON_LABEL`)),1)]),_:1},8,[`onClick`]),(0,y.createVNode)(o,{kind:`critical`,importance:`clear`,onClick:a.removeLink},{default:(0,y.withCtx)(()=>[(0,y.createTextVNode)((0,y.toDisplayString)(i.i18n.$t(`DIALTONE_RICH_TEXT_EDITOR_REMOVE_BUTTON_LABEL`)),1)]),_:1},8,[`onClick`])]),_:1})])]),_:1},8,[`editor`,`should-show`,`options`,`append-to`])):(0,y.createCommentVNode)(``,!0),(0,y.createVNode)(l,(0,y.mergeProps)({ref:`editor`,editor:i.editor,class:`d-rich-text-editor`,"data-qa":`dt-rich-text-editor`},a.attrs),null,16,[`editor`])])}var Ir=n.t(Nr,[[`render`,Fr]]);Object.defineProperty(exports,`t`,{enumerable:!0,get:function(){return Ir}});
11
+ //# sourceMappingURL=RichTextEditor-EHgahp8r.cjs.map