@frontify/fondue 12.0.0-beta.226 → 12.0.0-beta.227
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/components/RichTextEditor/Plugins/TextStylePlugin/TextStyleDropdown/useTextStyleDropdown.es.js +14 -11
- package/dist/components/RichTextEditor/Plugins/TextStylePlugin/TextStyleDropdown/useTextStyleDropdown.es.js.map +1 -1
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.umd.js +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -36,7 +36,7 @@ ${P1("Ctrl+Shift+K")}`:"Buttons can only be set for a single text block."),class
|
|
|
36
36
|
color: var(--box-neutral-inverse-color-hover);
|
|
37
37
|
`]},Ad0={renderAfterEditable:fd0};class sV extends N0{constructor(l){super(Ld0,{button:hd0,showIn:[u0.BOTTOM,u0.TOP],...l})}plugins(){return[d.createComboboxPlugin(),d.createEmojiPlugin(Ad0)]}}const Cd0="soft-break-plugin";class mV extends N0{constructor(l){super(Cd0,{...l})}plugins(){return[d.createSoftBreakPlugin()]}}const Ed0="italic-plugin",D5="tw-italic",LV=({attributes:e,children:l})=>t.createElement("span",{...e,className:D5},l);class uV extends f0{constructor(l=d.MARK_ITALIC,a=LV){super(l,a)}}const Id0=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(d.MarkToolbarButton,{tooltip:b0(`Italic
|
|
38
38
|
${P1("Ctrl+I")}`),type:d.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(Pe,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"})),Md0=[{validNodeName:["EM","I"]},{validStyle:{fontStyle:"italic"}}];class dV extends N0{constructor(l){super(Ed0,{button:Id0,markupElement:new uV,...l})}plugins(){return[d.createItalicPlugin({deserializeHtml:{rules:[...Md0,{validNodeName:["SPAN"],validClassName:D5}]},options:{hotkey:["mod+i","ctrl+i"]}})]}}const Zd0=d.createComponentAs(e=>{var a;const l=d.useFloatingLinkInsert({...e,floatingOptions:{strategy:"fixed"}});return((a=l.style)==null?void 0:a.display)==="none"?null:d.createElementAs("div",l)}),Nd0=d.createComponentAs(e=>{var a;const l=kd0({...e,floatingOptions:{strategy:"fixed"}});return((a=l.style)==null?void 0:a.display)==="none"?null:d.createElementAs("div",l)});d.FloatingLink.EditRoot=Nd0,d.FloatingLink.InsertRoot=Zd0;const F5=d.FloatingLink,Sd0=()=>{const e=d.useFloatingLinkUrlInput({});return t.createElement("div",{"data-test-id":"floating-link-edit",className:"tw-bg-white tw-rounded tw-shadow tw-p-4 tw-min-w-[400px]"},t.createElement("span",{"data-test-id":"preview-link-flyout",className:"tw-flex tw-justify-between"},t.createElement("span",{style:B0("link"),className:"tw-pointer-events-none"},e.defaultValue),t.createElement("span",{className:"tw-flex tw-gap-2"},t.createElement("span",{role:"button",tabIndex:0,"data-test-id":"edit-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1"},t.createElement(F5.EditButton,null,t.createElement(P2,null))),t.createElement("span",{role:"button",tabIndex:0,"data-test-id":"remove-link-button",className:"tw-transition tw-cursor-pointer tw-rounded hover:tw-bg-black-10 tw-p-1"},t.createElement(F5.UnlinkButton,null,t.createElement(Q2,null))))))},E7=(e,l)=>{const a=d.getAboveNode(e,{match:{type:d.ELEMENT_LINK}});return Array.isArray(a)?l(a[0]):""},yd0=e=>E7(e,l=>{var a,o;return((o=(a=l.chosenLink)==null?void 0:a.searchResult)==null?void 0:o.link)||""}),xd0=e=>E7(e,l=>l.url||""),wV=e=>{var l,a;return e.url||((a=(l=e.chosenLink)==null?void 0:l.searchResult)==null?void 0:a.link)||""},bd0=e=>E7(e,wV),kd0=({floatingOptions:e,...l})=>{const a=d.useEditorRef(),o=d.usePlateSelectors().keyEditor(),i=d.useFloatingLinkSelectors().mode(),c=d.useFloatingLinkSelectors().isOpen(a.id),{triggerFloatingLinkHotkeys:s="command+k, ctrl+k"}=d.getPluginOptions(a,d.ELEMENT_LINK),m=t.useCallback(()=>{const h=d.getAboveNode(a,{match:{type:d.getPluginType(a,d.ELEMENT_LINK)}});if(h){const[,v]=h;return d.getRangeBoundingClientRect(a,{anchor:d.getStartPoint(a,v),focus:d.getEndPoint(a,v)})}return d.getDefaultBoundingClientRect()},[a]),L=c&&i==="edit",{update:u,style:w,floating:f}=d.useVirtualFloatingLink({editorId:a.id,open:L,getBoundingClientRect:m,...e});return t.useEffect(()=>{const h=bd0(a);if(h&&d.floatingLinkActions.url(h),a.selection&&d.someNode(a,{match:{type:d.getPluginType(a,d.ELEMENT_LINK)}})){d.floatingLinkActions.show("edit",a.id),u();return}d.floatingLinkSelectors.mode()==="edit"&&d.floatingLinkActions.hide()},[a,o,u]),d.useHotkeys(s,h=>{h.preventDefault(),d.floatingLinkSelectors.mode()==="edit"&&d.triggerFloatingLinkEdit(a)},{enableOnContentEditable:!0},[]),d.useFloatingLinkEnter(),d.useFloatingLinkEscape(),{style:{...w,zIndex:1},...l,ref:d.useComposedRef(l.ref,f)}},Hd0={url:"",text:"",newTab:n0.Unchecked},zd0=()=>{const[e,l]=t.useReducer((a,o)=>{const{type:i,payload:c}=o;switch(i){case"NEW_TAB":return{...a,newTab:n0.Checked};case"SAME_TAB":return{...a,newTab:n0.Unchecked};case"URL":case"TEXT":case"INIT":return{...a,...c};default:return a}},Hd0);return[e,l]},pd0=()=>{const e=d.useEditorRef(),[l,a]=zd0();t.useEffect(()=>{const w=yd0(e),f=xd0(e);a({type:"INIT",payload:{text:d.floatingLinkSelectors.text(),newTab:d.floatingLinkSelectors.newTab()?n0.Checked:n0.Unchecked,url:w&&f===""?w:d.floatingLinkSelectors.url()}})},[a,e]);const o=w=>{a({type:"TEXT",payload:{text:w}})},i=w=>{a({type:"URL",payload:{url:w}})},c=w=>{a(w?{type:"NEW_TAB"}:{type:"SAME_TAB"})},s=()=>{d.floatingLinkActions.hide()},m=w=>{!u()||!L||(d.floatingLinkActions.text(l.text),d.floatingLinkActions.url(l.url),d.floatingLinkActions.newTab(l.newTab===n0.Checked),d.submitFloatingLink(e)&&(w==null||w.preventDefault()))},L=l.url!==""&&l.text!=="",u=()=>{const{isUrl:w}=d.getPluginOptions(e,d.ELEMENT_LINK);return!l.url||w&&w(l.url)};return d.useHotkeys("enter",m,{enableOnTags:["INPUT"]},[]),{state:l,onTextChange:o,onUrlChange:i,onToggleTab:c,onCancel:s,onSave:m,hasValues:L,isValidUrlOrEmpty:u}},Td0=()=>t.createElement(eV,{...pd0(),testId:"floating-link-insert"}),Vd0=({readOnly:e})=>{const l=d.useFloatingLinkSelectors().isEditing();if(e)return null;const a=t.createElement(Td0,null),o=l?a:t.createElement(Sd0,null);return t.createElement(t.Fragment,null,t.createElement(F5.InsertRoot,null,a),t.createElement(F5.EditRoot,null,o))},jd0="link-plugin",Dd0=({id:e,editorId:l})=>{const a=d.usePlateEditorState(d.useEventPlateId(l)),o=!!d.isRangeInSameBlock(a,{at:a.selection}),i=M0(o);return t.createElement(Z0,{id:e},t.createElement(d.LinkToolbarButton,{tooltip:b0(o?`Link
|
|
39
|
-
${P1("Ctrl+K")}`:"Links can only be set for a single text block."),icon:t.createElement(S0,{icon:t.createElement(Ne,null)}),classNames:i,styles:y0,actionHandler:"onMouseDown"}))},Fd0=e=>({...d.useElementProps({...e,elementToAttributes:a=>({href:wV(a),target:a.target||"_blank"})}),onMouseOver:a=>{a.stopPropagation()}}),Bd0=e=>{const l=Fd0(e),{attributes:a,children:o}=e;return t.createElement("a",{...a,href:l.href,target:l.target,style:B0("link")},o)};class Od0 extends f0{constructor(l=d.ELEMENT_LINK,a=Bd0){super(l,a)}}const hV=d.createPluginFactory({...d.createLinkPlugin(),renderAfterEditable:Vd0,options:{isUrl:wT,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class fV extends N0{constructor(l){super(jd0,{button:Dd0,markupElement:new Od0,...l})}plugins(){return[hV()]}}const B5="list-plugin",Pd0=["[&>li>p]:before:tw-content-[counter(count,decimal)_'._']","[&>li>p]:before:tw-content-[counter(count,_lower-alpha)_'._']","[&>li>p]:before:tw-content-[counter(count,lower-roman)_'._']"],Ud0=(e,l)=>{const a=d.findNodePath(e,l);if(!a)return 0;const o=d.getNodeAncestors(e,a);return Array.from(o).filter(i=>i[0].type===d.ELEMENT_LI).length},I7=e=>`tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] [&>li>p]:before:tw-pr-1 ${Pd0[e%3]}`,M7={counterReset:"count"},vV=({attributes:e,children:l,element:a})=>{const o=d.usePlateEditorRef(),i=Ud0(o,a);return t.createElement("ol",{className:I7(i),...e,style:M7},l)};class gV extends f0{constructor(l=d.ELEMENT_OL,a=vV){super(l,a)}}const AV=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(d.ListToolbarButton,{tooltip:b0("Ordered list"),type:d.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(xe,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"})),Z7="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",CV=`${Z7} tw-break-after-column tw-break-inside-avoid-column`,N7=e=>{const l=e.breakAfterColumn;return E([l==="active"&&CV,l==="inactive"&&Z7])},EV=e=>E([N7(e),e.align?l7[e.align]:"tw-justify-start","tw-grid tw-grid-cols-[min-content_repeat(3,_auto)]"]),Qd0=({attributes:e,children:l,element:a})=>t.createElement("p",{className:EV(a),...e},t.createElement("span",{className:"tw-w-auto tw-min-w-[10px]",style:B0(a.children[0].textStyle)},l));class Yd0 extends f0{constructor(l=d.ELEMENT_LIC,a=Qd0){super(l,a)}}const IV="[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline",Gd0=({attributes:e,children:l,element:a})=>t.createElement("li",{style:MV(a),...e,className:IV},l);class Wd0 extends f0{constructor(l=d.ELEMENT_LI,a=Gd0){super(l,a)}}const MV=e=>({...B0(ZV(e)),counterIncrement:"count"}),ZV=e=>{let l;if(e.type==="a")l=e.children[0].textStyle;else if(e.children)for(const a of e.children){const o=ZV(a);o&&(!l||o.startsWith(l))&&(l=o)}else l=e.textStyle;return l},$d0=(e,{options:{validLiChildrenTypes:l,isSoftBreak:a}})=>{const{insertBreak:o,deleteBackward:i,deleteForward:c,deleteFragment:s}=e;return a?e.insertSoftBreak=()=>{d.insertBreakList(e)||o()}:e.insertBreak=()=>{d.insertBreakList(e)||o()},e.deleteBackward=m=>{d.deleteBackwardList(e,m)||i(m)},e.deleteForward=m=>{d.deleteForwardList(e)||c(m)},e.deleteFragment=m=>{d.deleteFragmentList(e)||s(m)},e.insertFragment=d.insertFragmentList(e),e.normalizeNode=d.normalizeList(e,{validLiChildrenTypes:l}),e},M2="textStyle",NV=d.createPluginFactory({key:M2,isLeaf:!0});class S7 extends N0{constructor(a){super(B5,{leafMarkupElements:[new Yd0,new Wd0],...a});s0(this,"isSoftBreak");this.isSoftBreak=(a==null?void 0:a.isSoftBreak)??!1}plugins(){return[d.createListPlugin({withOverrides:$d0,options:{isSoftBreak:this.isSoftBreak}}),NV()]}}class SV extends S7{constructor(l){super({id:B5,button:AV,markupElement:new gV,...l})}}const y7="[&>li>p]:before:tw-content-['•'] [&>li>p]:before:tw-px-2 tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",yV=({attributes:e,children:l})=>t.createElement("ul",{className:y7,...e},l);class xV extends f0{constructor(l=d.ELEMENT_UL,a=yV){super(l,a)}}const bV=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(d.ListToolbarButton,{tooltip:b0("Bullet list"),type:d.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(Se,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class kV extends S7{constructor(l){super({id:B5,button:bV,markupElement:new xV,...l})}}const HV="tw-m-0 tw-px-0 tw-py-0",x7=({element:e,attributes:l,children:a})=>{const o=e.align,i=E([o&&t7[o],HV,N7(e)]);return t.createElement("p",{...l,className:i,style:B0("body")},a)};class zV extends f0{constructor(l=d.ELEMENT_PARAGRAPH,a=x7){super(l,a)}}const pV=d.createPluginFactory({...d.createParagraphPlugin(),key:d.ELEMENT_PARAGRAPH,isElement:!0,component:x7});class TV extends N0{constructor(l){super(d.ELEMENT_PARAGRAPH,{markupElement:new zV,label:"Body Text",...l})}plugins(){return[pV()]}}class qd0{constructor(){s0(this,"toolbarButtons",{[u0.BOTTOM]:[],[u0.FLOATING]:[],[u0.TOP]:[]})}createGroupOfButtons(l){const a=[],o=[],i=[];for(const{markupElement:c,button:s,id:m,showIn:L}of l){if(!s)continue;const u={id:(c==null?void 0:c.getId())||m,button:s};L.includes(u0.BOTTOM)&&a.push(u),L.includes(u0.TOP)&&o.push(u),L.includes(u0.FLOATING)&&i.push(u)}a.length>0&&this.toolbarButtons[u0.BOTTOM].push(a),o.length>0&&this.toolbarButtons[u0.TOP].push(o),i.length>0&&this.toolbarButtons[u0.FLOATING].push(i)}at(l){return this.toolbarButtons[l]}}class VV{constructor(l){s0(this,"platePlugins",new Map);s0(this,"markupElements",{});s0(this,"inlineElements",[]);s0(this,"toolbarButtons",new qd0);this.props=l}setPlugin(...l){for(const a of l){const o=Array.isArray(a)?a:[a];for(const i of o)this.addElement(i.markupElement),this.addElement(i.markupInputElement),this.addLeafElements(i.leafMarkupElements),this.addPlugin(i),this.addInline(i.inline());this.hasToolbar&&this.toolbarButtons.createGroupOfButtons(o)}return this}addLeafElements(l){if(l===void 0)return;const a=Array.isArray(l)?l:[l];for(const o of a)this.addElement(o)}addElement(l){if(l===void 0)return;const a=l.getId(),o=l.getNode();o&&!this.markupElements[a]&&(this.markupElements[a]=o)}addPlugin(l){l.id&&!this.platePlugins.has(l.id)&&this.platePlugins.set(l.id,l.plugins())}addInline(l){l&&this.inlineElements.push(l)}get elements(){return{...this.defaultElementsFromPlugins,...this.markupElements}}get defaultElementsFromPlugins(){const l={};for(const a of this.platePlugins.values())for(const o of a){const{key:i,component:c}=o;c&&(l[i]=c)}return l}get plugins(){const l=[];for(const a of this.platePlugins.values())l.push(...a);return l}get buttons(){return this.toolbarButtons}get inline(){return this.inlineElements}get hasToolbar(){var l;return!((l=this.props)!=null&&l.noToolbar)}}const jV="reset-formatting-plugin",DV="reset-formatting",Kd0=e=>{!e||!e.selection||(d.removeMark(e,{key:[d.MARK_BOLD,d.MARK_ITALIC,d.MARK_CODE,d.MARK_UNDERLINE,d.MARK_STRIKETHROUGH]}),d.unwrapList(e,{}),d.setElements(e,{type:d.ELEMENT_PARAGRAPH,align:void 0}))},Xd0=d.withPlateProvider(({id:e,...l})=>{const a=d.usePlateEditorState(d.useEventPlateId(e));return t.createElement(d.ToolbarButton,{tooltip:b0("Clear formatting"),onMouseDown:()=>{Kd0(a)},...l})}),Jd0=({id:e})=>t.createElement(Z0,{id:e},t.createElement(Xd0,{icon:t.createElement(S0,{icon:t.createElement(Ie,null)}),classNames:M0(),styles:y0})),FV=d.createPluginFactory({key:DV,isElement:!1});class BV extends N0{constructor(l){super(jV,{button:Jd0,...l})}plugins(){return[FV()]}}const _d0="strikethrough-plugin",b7="!tw-line-through",OV=({attributes:e,children:l})=>t.createElement("span",{...e,className:b7},l);class PV extends f0{constructor(l=d.MARK_STRIKETHROUGH,a=OV){super(l,a)}}const Rd0=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(d.MarkToolbarButton,{tooltip:b0("Strikethrough"),type:d.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(_b,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class UV extends N0{constructor(l){super(_d0,{button:Rd0,markupElement:new PV,...l})}plugins(){return[d.createStrikethroughPlugin()]}}const QV="text-style-plugin",ew0=e=>d.getAboveNode(e,{match:{type:d.ELEMENT_LI},mode:"lowest"})||d.someNode(e,{match:{type:i1},mode:"lowest"}),tw0=({editor:e,type:l,children:a})=>{const o=e!=null&&e.selection?d.getMark(e,M2)===l.id:d.someNode(e,{match:{type:l}});return t.createElement("button",{"data-test-id":"textstyle-option",type:"button",className:E(["tw-block tw-w-full tw-text-left tw-px-3 tw-py-2 tw-outline-none tw-cursor-pointer tw-truncate hover:tw-bg-box-neutral-hover hover:w-text-box-neutral-inverse-hover tw-max-h-20 tw-max-w-[15rem] tw-min-h-[2.25rem]",o?"tw-text-box-neutral-inverse tw-bg-box-neutral":"tw-text-text"]),onMouseDown:i=>{!e||!e.selection||(d.setMarks(e,{[M2]:l.id}),ew0(e)||d.getPreventDefaultHandler(d.toggleNodeType,e,{activeType:l.id,inactiveType:l.id})(i))}},a)},lw0=({label:e,open:l,onClick:a},o)=>t.createElement("button",{ref:o,"data-test-id":"textstyle-dropdown-trigger",type:"button",className:"tw-cursor-pointer tw-h-8 tw-w-full",onMouseDown:d.getPreventDefaultHandler(a)},t.createElement("div",{className:E(["tw-relative tw-inline-flex tw-flex-row tw-items-center tw-justify-between tw-overflow-hidden tw-text-text tw-rounded tw-gap-1 tw-px-2 hover:tw-text-box-selected-inverse hover:tw-bg-box-selected tw-h-6 tw-w-28",l&&"tw-text-box-selected-inverse tw-bg-box-selected"])},t.createElement("span",{className:"tw-text-xs tw-truncate"},e),t.createElement("div",{className:E(["tw-transition-transform",l&&"tw-rotate-180"])},t.createElement(fe,null)))),nw0=t.forwardRef(lw0),rw0=e=>Array.isArray(e.children)?(e.children.find(a=>d.isText(a))??{})[M2]:d.ELEMENT_PARAGRAPH,aw0=[d.ELEMENT_LI,d.ELEMENT_UL,d.ELEMENT_OL],ow0=e=>!e||!e.selection?[]:Array.from(d.getNodeEntries(e,{unhang:!0,at:e.selection,reverse:!0})).reduce((a,[o])=>{if(!d.isNode(o))return a;const i=o.type===d.ELEMENT_LIC||o.type===i1?rw0(o):o.textStyle;return i&&!a.includes(i)&&!aw0.includes(i)&&a.push(i),a},[]),iw0=6,cw0=10,sw0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:a,maxHeight:o}=Z3(e.elements.reference,e.rects.popper.height,iw0+cw0,0);a==="top"&&(e.placement="top-start"),e.styles.popper={maxHeight:`${o}px`},e.reset=!0,e.modifiersData[l]._skip=!0},enabled:!0},O5="Mixed";var O0=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e))(O0||{});const mw0=e=>{const[l,a]=t.useState(!1),[o,i]=t.useState(null),[c,s]=t.useState(null),m=d.usePlateEditorState(e),L=ow0(m),u=L.length===1?L[0]:O5,w=t.useCallback(()=>{a(h=>!h)},[a]),f=x1.usePopper(o,c,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"flip",enabled:!1},sw0]});return t.useEffect(()=>{const h=v=>{if(l){const g=v.target;if(c&&c.contains(g)||o&&o.contains(g))return;a(!1)}};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[l,c,a,o]),{state:{isOpen:l,toggle:w,editor:m},dropdownProps:{...f.attributes.popper,style:f.styles.popper},key:u,dropdownRef:s,triggerRef:i}},Lw0=({editorId:e,textStyles:l=[]})=>{var f;const{state:{editor:a,toggle:o,isOpen:i},dropdownProps:c,triggerRef:s,dropdownRef:m,key:L}=mw0(e);if(l.length===0)return null;let u=O5;const w=l.find(h=>{var v;return h.id===L&&((v=h.props)==null?void 0:v.label)});return w&&(u=((f=w.props)==null?void 0:f.label)||O5),t.createElement(t.Fragment,null,t.createElement(nw0,{label:u,open:i,onClick:o,ref:s}),i&&t.createElement("div",{className:"tw-divide-y tw-divide-line tw-bg-base tw-shadow-md tw-border tw-border-line tw-z-[1000] tw-overflow-auto tw-min-h-[40px]",ref:m,...c},l.map(h=>{var v;return t.createElement(tw0,{editor:a,type:h,key:h.id},t.createElement("span",{style:B0(h.id)},(v=h.props)==null?void 0:v.label))})))},uw0=({editorId:e,id:l,textStyles:a})=>t.createElement(Z0,{id:l},t.createElement(Lw0,{editorId:e,textStyles:a})),dw0=(e,l)=>a=>t.createElement(e,{...a,textStyles:l});class YV extends N0{constructor({textStyles:a=[],...o}={}){super(QV,{button:dw0(uw0,a),textStyles:a,...o});s0(this,"textStyles");this.textStyles=a}plugins(){return this.textStyles.map(a=>a.plugins()).flat()}}const ww0="underline-plugin",P5="tw-underline",GV=({attributes:e,children:l})=>t.createElement("span",{...e,className:P5},l);class WV extends f0{constructor(l=d.MARK_UNDERLINE,a=GV){super(l,a)}}const hw0=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(d.MarkToolbarButton,{tooltip:b0(`Underline
|
|
39
|
+
${P1("Ctrl+K")}`:"Links can only be set for a single text block."),icon:t.createElement(S0,{icon:t.createElement(Ne,null)}),classNames:i,styles:y0,actionHandler:"onMouseDown"}))},Fd0=e=>({...d.useElementProps({...e,elementToAttributes:a=>({href:wV(a),target:a.target||"_blank"})}),onMouseOver:a=>{a.stopPropagation()}}),Bd0=e=>{const l=Fd0(e),{attributes:a,children:o}=e;return t.createElement("a",{...a,href:l.href,target:l.target,style:B0("link")},o)};class Od0 extends f0{constructor(l=d.ELEMENT_LINK,a=Bd0){super(l,a)}}const hV=d.createPluginFactory({...d.createLinkPlugin(),renderAfterEditable:Vd0,options:{isUrl:wT,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class fV extends N0{constructor(l){super(jd0,{button:Dd0,markupElement:new Od0,...l})}plugins(){return[hV()]}}const B5="list-plugin",Pd0=["[&>li>p]:before:tw-content-[counter(count,decimal)_'._']","[&>li>p]:before:tw-content-[counter(count,_lower-alpha)_'._']","[&>li>p]:before:tw-content-[counter(count,lower-roman)_'._']"],Ud0=(e,l)=>{const a=d.findNodePath(e,l);if(!a)return 0;const o=d.getNodeAncestors(e,a);return Array.from(o).filter(i=>i[0].type===d.ELEMENT_LI).length},I7=e=>`tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] [&>li>p]:before:tw-pr-1 ${Pd0[e%3]}`,M7={counterReset:"count"},vV=({attributes:e,children:l,element:a})=>{const o=d.usePlateEditorRef(),i=Ud0(o,a);return t.createElement("ol",{className:I7(i),...e,style:M7},l)};class gV extends f0{constructor(l=d.ELEMENT_OL,a=vV){super(l,a)}}const AV=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(d.ListToolbarButton,{tooltip:b0("Ordered list"),type:d.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(xe,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"})),Z7="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",CV=`${Z7} tw-break-after-column tw-break-inside-avoid-column`,N7=e=>{const l=e.breakAfterColumn;return E([l==="active"&&CV,l==="inactive"&&Z7])},EV=e=>E([N7(e),e.align?l7[e.align]:"tw-justify-start","tw-grid tw-grid-cols-[min-content_repeat(3,_auto)]"]),Qd0=({attributes:e,children:l,element:a})=>t.createElement("p",{className:EV(a),...e},t.createElement("span",{className:"tw-w-auto tw-min-w-[10px]",style:B0(a.children[0].textStyle)},l));class Yd0 extends f0{constructor(l=d.ELEMENT_LIC,a=Qd0){super(l,a)}}const IV="[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline",Gd0=({attributes:e,children:l,element:a})=>t.createElement("li",{style:MV(a),...e,className:IV},l);class Wd0 extends f0{constructor(l=d.ELEMENT_LI,a=Gd0){super(l,a)}}const MV=e=>({...B0(ZV(e)),counterIncrement:"count"}),ZV=e=>{let l;if(e.type==="a")l=e.children[0].textStyle;else if(e.children)for(const a of e.children){const o=ZV(a);o&&(!l||o.startsWith(l))&&(l=o)}else l=e.textStyle;return l},$d0=(e,{options:{validLiChildrenTypes:l,isSoftBreak:a}})=>{const{insertBreak:o,deleteBackward:i,deleteForward:c,deleteFragment:s}=e;return a?e.insertSoftBreak=()=>{d.insertBreakList(e)||o()}:e.insertBreak=()=>{d.insertBreakList(e)||o()},e.deleteBackward=m=>{d.deleteBackwardList(e,m)||i(m)},e.deleteForward=m=>{d.deleteForwardList(e)||c(m)},e.deleteFragment=m=>{d.deleteFragmentList(e)||s(m)},e.insertFragment=d.insertFragmentList(e),e.normalizeNode=d.normalizeList(e,{validLiChildrenTypes:l}),e},M2="textStyle",NV=d.createPluginFactory({key:M2,isLeaf:!0});class S7 extends N0{constructor(a){super(B5,{leafMarkupElements:[new Yd0,new Wd0],...a});s0(this,"isSoftBreak");this.isSoftBreak=(a==null?void 0:a.isSoftBreak)??!1}plugins(){return[d.createListPlugin({withOverrides:$d0,options:{isSoftBreak:this.isSoftBreak}}),NV()]}}class SV extends S7{constructor(l){super({id:B5,button:AV,markupElement:new gV,...l})}}const y7="[&>li>p]:before:tw-content-['•'] [&>li>p]:before:tw-px-2 tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",yV=({attributes:e,children:l})=>t.createElement("ul",{className:y7,...e},l);class xV extends f0{constructor(l=d.ELEMENT_UL,a=yV){super(l,a)}}const bV=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(d.ListToolbarButton,{tooltip:b0("Bullet list"),type:d.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(Se,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class kV extends S7{constructor(l){super({id:B5,button:bV,markupElement:new xV,...l})}}const HV="tw-m-0 tw-px-0 tw-py-0",x7=({element:e,attributes:l,children:a})=>{const o=e.align,i=E([o&&t7[o],HV,N7(e)]);return t.createElement("p",{...l,className:i,style:B0("body")},a)};class zV extends f0{constructor(l=d.ELEMENT_PARAGRAPH,a=x7){super(l,a)}}const pV=d.createPluginFactory({...d.createParagraphPlugin(),key:d.ELEMENT_PARAGRAPH,isElement:!0,component:x7});class TV extends N0{constructor(l){super(d.ELEMENT_PARAGRAPH,{markupElement:new zV,label:"Body Text",...l})}plugins(){return[pV()]}}class qd0{constructor(){s0(this,"toolbarButtons",{[u0.BOTTOM]:[],[u0.FLOATING]:[],[u0.TOP]:[]})}createGroupOfButtons(l){const a=[],o=[],i=[];for(const{markupElement:c,button:s,id:m,showIn:L}of l){if(!s)continue;const u={id:(c==null?void 0:c.getId())||m,button:s};L.includes(u0.BOTTOM)&&a.push(u),L.includes(u0.TOP)&&o.push(u),L.includes(u0.FLOATING)&&i.push(u)}a.length>0&&this.toolbarButtons[u0.BOTTOM].push(a),o.length>0&&this.toolbarButtons[u0.TOP].push(o),i.length>0&&this.toolbarButtons[u0.FLOATING].push(i)}at(l){return this.toolbarButtons[l]}}class VV{constructor(l){s0(this,"platePlugins",new Map);s0(this,"markupElements",{});s0(this,"inlineElements",[]);s0(this,"toolbarButtons",new qd0);this.props=l}setPlugin(...l){for(const a of l){const o=Array.isArray(a)?a:[a];for(const i of o)this.addElement(i.markupElement),this.addElement(i.markupInputElement),this.addLeafElements(i.leafMarkupElements),this.addPlugin(i),this.addInline(i.inline());this.hasToolbar&&this.toolbarButtons.createGroupOfButtons(o)}return this}addLeafElements(l){if(l===void 0)return;const a=Array.isArray(l)?l:[l];for(const o of a)this.addElement(o)}addElement(l){if(l===void 0)return;const a=l.getId(),o=l.getNode();o&&!this.markupElements[a]&&(this.markupElements[a]=o)}addPlugin(l){l.id&&!this.platePlugins.has(l.id)&&this.platePlugins.set(l.id,l.plugins())}addInline(l){l&&this.inlineElements.push(l)}get elements(){return{...this.defaultElementsFromPlugins,...this.markupElements}}get defaultElementsFromPlugins(){const l={};for(const a of this.platePlugins.values())for(const o of a){const{key:i,component:c}=o;c&&(l[i]=c)}return l}get plugins(){const l=[];for(const a of this.platePlugins.values())l.push(...a);return l}get buttons(){return this.toolbarButtons}get inline(){return this.inlineElements}get hasToolbar(){var l;return!((l=this.props)!=null&&l.noToolbar)}}const jV="reset-formatting-plugin",DV="reset-formatting",Kd0=e=>{!e||!e.selection||(d.removeMark(e,{key:[d.MARK_BOLD,d.MARK_ITALIC,d.MARK_CODE,d.MARK_UNDERLINE,d.MARK_STRIKETHROUGH]}),d.unwrapList(e,{}),d.setElements(e,{type:d.ELEMENT_PARAGRAPH,align:void 0}))},Xd0=d.withPlateProvider(({id:e,...l})=>{const a=d.usePlateEditorState(d.useEventPlateId(e));return t.createElement(d.ToolbarButton,{tooltip:b0("Clear formatting"),onMouseDown:()=>{Kd0(a)},...l})}),Jd0=({id:e})=>t.createElement(Z0,{id:e},t.createElement(Xd0,{icon:t.createElement(S0,{icon:t.createElement(Ie,null)}),classNames:M0(),styles:y0})),FV=d.createPluginFactory({key:DV,isElement:!1});class BV extends N0{constructor(l){super(jV,{button:Jd0,...l})}plugins(){return[FV()]}}const _d0="strikethrough-plugin",b7="!tw-line-through",OV=({attributes:e,children:l})=>t.createElement("span",{...e,className:b7},l);class PV extends f0{constructor(l=d.MARK_STRIKETHROUGH,a=OV){super(l,a)}}const Rd0=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(d.MarkToolbarButton,{tooltip:b0("Strikethrough"),type:d.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(_b,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class UV extends N0{constructor(l){super(_d0,{button:Rd0,markupElement:new PV,...l})}plugins(){return[d.createStrikethroughPlugin()]}}const QV="text-style-plugin",ew0=e=>d.getAboveNode(e,{match:{type:d.ELEMENT_LI},mode:"lowest"})||d.someNode(e,{match:{type:i1},mode:"lowest"}),tw0=({editor:e,type:l,children:a})=>{const o=e!=null&&e.selection?d.getMark(e,M2)===l.id:d.someNode(e,{match:{type:l}});return t.createElement("button",{"data-test-id":"textstyle-option",type:"button",className:E(["tw-block tw-w-full tw-text-left tw-px-3 tw-py-2 tw-outline-none tw-cursor-pointer tw-truncate hover:tw-bg-box-neutral-hover hover:w-text-box-neutral-inverse-hover tw-max-h-20 tw-max-w-[15rem] tw-min-h-[2.25rem]",o?"tw-text-box-neutral-inverse tw-bg-box-neutral":"tw-text-text"]),onMouseDown:i=>{!e||!e.selection||(d.setMarks(e,{[M2]:l.id}),ew0(e)||d.getPreventDefaultHandler(d.toggleNodeType,e,{activeType:l.id,inactiveType:l.id})(i))}},a)},lw0=({label:e,open:l,onClick:a},o)=>t.createElement("button",{ref:o,"data-test-id":"textstyle-dropdown-trigger",type:"button",className:"tw-cursor-pointer tw-h-8 tw-w-full",onMouseDown:d.getPreventDefaultHandler(a)},t.createElement("div",{className:E(["tw-relative tw-inline-flex tw-flex-row tw-items-center tw-justify-between tw-overflow-hidden tw-text-text tw-rounded tw-gap-1 tw-px-2 hover:tw-text-box-selected-inverse hover:tw-bg-box-selected tw-h-6 tw-w-28",l&&"tw-text-box-selected-inverse tw-bg-box-selected"])},t.createElement("span",{className:"tw-text-xs tw-truncate"},e),t.createElement("div",{className:E(["tw-transition-transform",l&&"tw-rotate-180"])},t.createElement(fe,null)))),nw0=t.forwardRef(lw0),rw0=e=>Array.isArray(e.children)?(e.children.find(a=>d.isText(a))??{})[M2]:d.ELEMENT_PARAGRAPH,aw0=[d.ELEMENT_LI,d.ELEMENT_UL,d.ELEMENT_OL],ow0=e=>!e||!e.selection?[]:Array.from(d.getNodeEntries(e,{unhang:!0,at:e.selection,reverse:!0})).reduce((a,[o])=>{if(!d.isNode(o))return a;const i=o.type===d.ELEMENT_LIC||o.type===i1?rw0(o):o.textStyle;return i&&!a.includes(i)&&!aw0.includes(i)&&a.push(i),a},[]),iw0=6,cw0=10,sw0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:a,maxHeight:o}=Z3(e.elements.reference,e.rects.popper.height,iw0+cw0,0);a==="top"&&(e.placement="top-start"),e.styles.popper={maxHeight:`${o}px`},e.reset=!0,e.modifiersData[l]._skip=!0},enabled:!0},O5="Mixed";var O0=(e=>(e.heading1="heading1",e.heading2="heading2",e.heading3="heading3",e.heading4="heading4",e.custom1="custom1",e.custom2="custom2",e.custom3="custom3",e.quote="quote",e.imageCaption="imageCaption",e.imageTitle="imageTitle",e))(O0||{});const mw0=e=>{const[l,a]=t.useState(!1),[o,i]=t.useState(null),[c,s]=t.useState(null),m=d.usePlateEditorState(e),L=ow0(m);let u=O5;L.length===1?u=L[0]:L.length===0&&(u="p");const w=t.useCallback(()=>{a(h=>!h)},[a]),f=x1.usePopper(o,c,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"flip",enabled:!1},sw0]});return t.useEffect(()=>{const h=v=>{if(l){const g=v.target;if(c&&c.contains(g)||o&&o.contains(g))return;a(!1)}};return document.addEventListener("mousedown",h),()=>{document.removeEventListener("mousedown",h)}},[l,c,a,o]),{state:{isOpen:l,toggle:w,editor:m},dropdownProps:{...f.attributes.popper,style:f.styles.popper},key:u,dropdownRef:s,triggerRef:i}},Lw0=({editorId:e,textStyles:l=[]})=>{var f;const{state:{editor:a,toggle:o,isOpen:i},dropdownProps:c,triggerRef:s,dropdownRef:m,key:L}=mw0(e);if(l.length===0)return null;let u=O5;const w=l.find(h=>{var v;return h.id===L&&((v=h.props)==null?void 0:v.label)});return w&&(u=((f=w.props)==null?void 0:f.label)||O5),t.createElement(t.Fragment,null,t.createElement(nw0,{label:u,open:i,onClick:o,ref:s}),i&&t.createElement("div",{className:"tw-divide-y tw-divide-line tw-bg-base tw-shadow-md tw-border tw-border-line tw-z-[1000] tw-overflow-auto tw-min-h-[40px]",ref:m,...c},l.map(h=>{var v;return t.createElement(tw0,{editor:a,type:h,key:h.id},t.createElement("span",{style:B0(h.id)},(v=h.props)==null?void 0:v.label))})))},uw0=({editorId:e,id:l,textStyles:a})=>t.createElement(Z0,{id:l},t.createElement(Lw0,{editorId:e,textStyles:a})),dw0=(e,l)=>a=>t.createElement(e,{...a,textStyles:l});class YV extends N0{constructor({textStyles:a=[],...o}={}){super(QV,{button:dw0(uw0,a),textStyles:a,...o});s0(this,"textStyles");this.textStyles=a}plugins(){return this.textStyles.map(a=>a.plugins()).flat()}}const ww0="underline-plugin",P5="tw-underline",GV=({attributes:e,children:l})=>t.createElement("span",{...e,className:P5},l);class WV extends f0{constructor(l=d.MARK_UNDERLINE,a=GV){super(l,a)}}const hw0=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(d.MarkToolbarButton,{tooltip:b0(`Underline
|
|
40
40
|
${P1("Ctrl+U")}`),type:d.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(Ue,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"})),fw0=[{validNodeName:["U"]},{validStyle:{textDecoration:["underline"]}}];class $V extends N0{constructor(l){super(ww0,{button:hw0,markupElement:new WV,...l})}plugins(){return[d.createUnderlinePlugin({deserializeHtml:{rules:[...fw0,{validNodeName:["SPAN"],validClassName:P5}]},options:{hotkey:["mod+u","ctrl+u"]}})]}}const qV=e=>Array.from(d.getNodeEntries(e,{at:[],match:l=>!!l.breakAfterColumn})).length,Z2=(e,{key:l=X1,value:a,at:o})=>{const i=c=>d.isBlock(e,c);a?d.setElements(e,{[l]:a},{mode:"lowest",match:i,at:o}):d.unsetNodes(e,l,{match:i,mode:"lowest",at:o})},vw0=(e,l,a)=>{Z2(e,{at:l,value:a})},k7=(e,l)=>{const a=Array.from(d.getNodeEntries(e,{at:[],match:o=>!!o.breakAfterColumn}));for(const[o,[,i]]of a.entries())vw0(e,i,o<l-1?"active":"inactive")},KV=(e,l,a)=>{if(!!(e!=null&&e.selection)&&d.someNode(e,{match:i=>!!i.breakAfterColumn}))Z2(e,{value:void 0});else{const i=qV(e),c=Math.max(l-i-1,0);if(c===0)return;const s=Array.from(d.getNodeEntries(e,{at:e.selection,match:m=>d.isBlock(e,m),mode:"lowest"})).slice(-c);d.getPreventDefaultHandler(()=>{for(const m of s)Z2(e,{value:"active",at:m[1]})})(a)}k7(e,l)},gw0=e=>l=>{var a;if(!l.defaultPrevented&&FD("shift+ctrl+enter",l)){const o=e.plugins.find(c=>c.key===X1),i=((a=o==null?void 0:o.options)==null?void 0:a.columns)??1;KV(e,i,l)}},Aw0=({id:e,...l})=>{var u;const a=d.usePlateEditorState(d.useEventPlateId(e)),o=!!(a!=null&&a.selection)&&d.someNode(a,{match:w=>!!w.breakAfterColumn}),i=a.pluginsByKey.breakAfterColumn,c=(u=i==null?void 0:i.options)==null?void 0:u.columns,s=Number(c)||1,m=Cw0(a,s,o),L=M0(m);return t.createElement(d.ToolbarButton,{active:o,tooltip:b0(m?`Column Break
|
|
41
41
|
Shift+Ctrl+Return`:"Already at maximum numbers of columns"),onMouseDown:w=>KV(a,s,w),...l,classNames:L})},Cw0=(e,l,a)=>qV(e)+1<l||a,XV=({id:e})=>t.createElement(Z0,{id:e},t.createElement(Aw0,{icon:t.createElement(S0,{icon:t.createElement(Be,null)}),classNames:M0(),styles:y0})),Ew0=(e,l)=>{const a=d.getStartPoint(e,l);setTimeout(()=>{d.select(e,{anchor:a,focus:a})})},Iw0=e=>{var a;const l=e.plugins.find(o=>o.key===X1);return((a=l==null?void 0:l.options)==null?void 0:a.columns)??1},Mw0=e=>{const{apply:l}=e,a=Iw0(e);e.apply=o=>{switch(o.type){case"split_node":o.properties={...o.properties,breakAfterColumn:void 0};break;case"merge_node":const i=d.getPointBefore(e,o.path);if(!i)break;const c=d.getParentNode(e,i.path);if(Z2(e,{at:i,value:void 0}),k7(e,a),c!=null&&c[0].breakAfterColumn)return Ew0(e,o.path),e;break}l(o)},setTimeout(()=>k7(e,a))},X1="breakAfterColumn",H7="normal";class Zw0 extends N0{constructor(a){super("break-after-plugin",{button:XV,...a});s0(this,"columns");s0(this,"gap");this.columns=(a==null?void 0:a.columns)??1,this.gap=(a==null?void 0:a.gap)??H7}plugins(){return[JV(this.columns,this.gap)]}}const JV=(e,l)=>d.createPluginFactory({key:X1,handlers:{onKeyDown:gw0},useHooks:Mw0,options:{columns:e,gap:l}})(),Nw0=12,Sw0=26,yw0=124,xw0=e=>e.map((l,a)=>({group:l,buttonGroupWidth:l.reduce((o,i)=>i.id===QV?yw0:Sw0+o,Nw0),index:a})),bw0=(e,l)=>l.reduce((a,{group:o,buttonGroupWidth:i,index:c})=>{const s=Math.max(0,a.length-1);return a[s]=a[s]??[],(a[s]??[{actions:[],buttonGroupWidth:0}]).reduce((L,{buttonGroupWidth:u})=>L+u,0)+i<=e?a[s].push({group:o,buttonGroupWidth:i,index:c}):a.push([{group:o,buttonGroupWidth:i,index:c}]),a.filter(L=>L.length)},[]),kw0=({index:e,children:l})=>t.createElement("div",{"data-test-id":`toolbar-group-${e}`,className:"tw-flex tw-items-center tw-h-9 tw-p-2"},l),Hw0=({toolbarButtons:e,editorId:l,toolbarWidth:a})=>{const o=d.usePlateEditorRef(l),{editorWidth:i}=vT(),{position:c}=y5(),s=a||i||0,m=xw0(e.at(c)),L=bw0(s,m),u=rj[c];return t.createElement(u.ToolbarWrapper,{editorWidth:i,toolbarWidth:a,toolbarButtonGroups:L},L.map((w,f)=>t.createElement("div",{className:"tw-divide-x tw-divide-line tw-flex tw-w-full tw-flex-wrap",key:f},w.map(({group:h,index:v})=>t.createElement(kw0,{index:v,key:v},h.map((g,C)=>t.createElement(g.button,{editor:o,editorId:l,id:g.id,key:C.toString()})))))))},_V=e=>d.createPlugins(e.plugins,{components:d.createPlateUI(e.elements)}),z7=(e,l)=>({create:()=>_V(l),toolbar:a=>l.hasToolbar?t.createElement(Hw0,{toolbarButtons:l.buttons,editorId:e,toolbarWidth:a}):null,inline:()=>t.createElement(t.Fragment,null,l.inline.map((a,o)=>t.createElement(a,{key:o})))}),zw0="mention-plugin",pw0=e=>l=>l.text.toLowerCase().includes(e.toLowerCase()),p7=(e,l)=>`${e}:${l}`,T7=e=>{const l=new Map;for(const a of e){const o=p7(a.data.category,a.data.id),i=a.text;l.set(o,i)}return l},RV=(e,l,a)=>e.get(l)??a;var K0=(e=>(e.GROUP="group",e.ALL="all",e.USER="user",e))(K0||{});const V7=({attributes:e,element:l,nodeProps:a,children:o})=>t.createElement("span",{...e,"data-slate-value":l==null?void 0:l.value,"data-slate-key":l==null?void 0:l.key,"data-slate-category":l==null?void 0:l.category,contentEditable:!1,style:{lineHeight:"10px",padding:"1px",margin:"0 1px",fontWeight:"bold",verticalAlign:"baseline",display:"inline-block",borderRadius:"2px",backgroundColor:"rgb(227, 232, 246)",color:"rgb(130, 95, 255)"},...a},o),Tw0=({children:e,...l})=>t.createElement(V7,{...l},t.createElement("span",{style:{paddingRight:"3px",display:"inline-block",margin:"-1px 0"}},t.createElement(U2,null)),e),Vw0=({children:e,...l})=>t.createElement(V7,{...l},"@",e),jw0=({children:e,...l})=>t.createElement(V7,{...l},e),Dw0=({category:e,children:l,...a})=>{const o={[K0.USER]:jw0,[K0.GROUP]:Tw0,[K0.ALL]:Vw0},i=o[e]??o[K0.USER];return t.createElement(i,{...a},l)},j7=e=>l=>{const{element:a,children:o}=l,i=p7(a==null?void 0:a.category,String(a==null?void 0:a.id));return t.createElement(Dw0,{category:a==null?void 0:a.category,...l},RV(e,i,String(a==null?void 0:a.id)),o)};class ej extends f0{constructor(l=d.ELEMENT_MENTION){super(l)}setNodeWithMentionable(l){return this.node=j7(T7(l)),this}}const Fw0=({image:e,category:l,text:a,id:o})=>{if(e)return t.createElement("img",{src:e,alt:`${o}-${l}-${a}`});switch(l){case K0.GROUP:return t.createElement(U2,null);case K0.ALL:return t.createElement(pe,null);default:return t.createElement(ke,null)}},Bw0=({item:e})=>{const{data:{image:l,category:a},key:o,text:i}=e;return t.createElement("div",{className:"tw-flex tw-items-center tw-w-full tw-min-h-[inherit]"},t.createElement("span",{className:"tw-flex tw-items-center tw-justify-center tw-rounded-full tw-mr-2.5 tw-bg-base-alt tw-border tw-border-line-weak tw-w-[22px] tw-h-[22px] tw-shrink-0 tw-overflow-hidden group-hover:tw-border-base group-aria-selected:tw-border-base"},t.createElement(Fw0,{image:l,category:a,text:i,id:o})),t.createElement("span",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis"},i))},tj=[`
|
|
42
42
|
color: var(--text-color-weak);
|