@frontify/fondue 12.0.0-beta.129 → 12.0.0-beta.130
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/ListPlugin/ListItemContentMarkupElement.es.js +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/ListItemContentMarkupElement.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/ListItemMarkupElement.es.js +10 -6
- package/dist/components/RichTextEditor/Plugins/ListPlugin/ListItemMarkupElement.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/OrderedListMarkupElement.es.js +6 -6
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/OrderedListMarkupElement.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/styles.css.es.js +5 -0
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/styles.css.es.js.map +1 -0
- package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/UnorderedListMarkupElement.es.js +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/UnorderedListMarkupElement.es.js.map +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/styles.css.es.js +5 -0
- package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/styles.css.es.js.map +1 -0
- 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/dist/styles.css +1 -1
- package/package.json +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/style.css.es.js +0 -5
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/style.css.es.js.map +0 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/style.css.es.js +0 -5
- package/dist/components/RichTextEditor/Plugins/ListPlugin/UnorderedListPlugin/style.css.es.js.map +0 -1
package/dist/index.umd.js
CHANGED
|
@@ -36,7 +36,7 @@ ${Y1("Shift+Ctrl+k")}`),active:i,onMouseDown:async c=>{o&&(c.preventDefault(),c.
|
|
|
36
36
|
color: var(--box-neutral-inverse-color-hover);
|
|
37
37
|
`]},Lo0={renderAfterEditable:co0};class ab extends w0{constructor(l){super(no0,{button:io0,showIn:[e0.BOTTOM,e0.TOP],...l})}plugins(){return[m.createComboboxPlugin(),m.createEmojiPlugin(Lo0)]}}const do0="soft-break-plugin";class ob extends w0{constructor(l){super(do0,{...l})}plugins(){return[m.createSoftBreakPlugin()]}}const uo0="italic-plugin",F2="tw-italic",ib=({attributes:e,children:l})=>t.createElement("span",{...e,className:F2},l);class cb extends s0{constructor(l=m.MARK_ITALIC,a=ib){super(l,a)}}const wo0=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(m.MarkToolbarButton,{tooltip:C0(`Italic
|
|
38
38
|
${Y1("Ctrl+I")}`),type:m.getPluginType(e,l),icon:t.createElement(v0,{icon:t.createElement(V5,null)}),classNames:m0,styles:g0,actionHandler:"onMouseDown"})),ho0=[{validNodeName:["EM","I"]},{validStyle:{fontStyle:"italic"}}];class sb extends w0{constructor(l){super(uo0,{button:wo0,markupElement:new cb,...l})}plugins(){return[m.createItalicPlugin({deserializeHtml:{rules:[...ho0,{validNodeName:["SPAN"],validClassName:F2}]},options:{hotkey:["mod+i","ctrl+i"]}})]}}const fo0=m.createComponentAs(e=>{var a;const l=m.useFloatingLinkInsert({...e,floatingOptions:{strategy:"fixed"}});return((a=l.style)==null?void 0:a.display)==="none"?null:m.createElementAs("div",l)}),vo0=m.createComponentAs(e=>{var a;const l=Mo0({...e,floatingOptions:{strategy:"fixed"}});return((a=l.style)==null?void 0:a.display)==="none"?null:m.createElementAs("div",l)});m.FloatingLink.EditRoot=vo0,m.FloatingLink.InsertRoot=fo0;const P2=m.FloatingLink,go0=()=>{const e=m.useFloatingLinkUrlInput({}),{designTokens:l}=t0();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:l.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(P2.EditButton,null,t.createElement(e2,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(P2.UnlinkButton,null,t.createElement(l2,null))))))},qe=(e,l)=>{const a=m.getAboveNode(e,{match:{type:m.ELEMENT_LINK}});return Array.isArray(a)?l(a[0]):""},Ao0=e=>qe(e,l=>{var a,o;return((o=(a=l.chosenLink)==null?void 0:a.searchResult)==null?void 0:o.link)||""}),Co0=e=>qe(e,l=>l.url||""),mb=e=>{var l,a;return e.url||((a=(l=e.chosenLink)==null?void 0:l.searchResult)==null?void 0:a.link)||""},Eo0=e=>qe(e,mb),Mo0=({floatingOptions:e,...l})=>{const a=m.useEditorRef(),o=m.usePlateSelectors().keyEditor(),i=m.useFloatingLinkSelectors().mode(),c=m.useFloatingLinkSelectors().isOpen(a.id),{triggerFloatingLinkHotkeys:s="command+k, ctrl+k"}=m.getPluginOptions(a,m.ELEMENT_LINK),L=t.useCallback(()=>{const f=m.getAboveNode(a,{match:{type:m.getPluginType(a,m.ELEMENT_LINK)}});if(f){const[,A]=f;return m.getRangeBoundingClientRect(a,{anchor:m.getStartPoint(a,A),focus:m.getEndPoint(a,A)})}return m.getDefaultBoundingClientRect()},[a]),d=c&&i==="edit",{update:w,style:u,floating:h}=m.useVirtualFloatingLink({editorId:a.id,open:d,getBoundingClientRect:L,...e});return t.useEffect(()=>{const f=Eo0(a);if(f&&m.floatingLinkActions.url(f),a.selection&&m.someNode(a,{match:{type:m.getPluginType(a,m.ELEMENT_LINK)}})){m.floatingLinkActions.show("edit",a.id),w();return}m.floatingLinkSelectors.mode()==="edit"&&m.floatingLinkActions.hide()},[a,o,w]),m.useHotkeys(s,f=>{f.preventDefault(),m.floatingLinkSelectors.mode()==="edit"&&m.triggerFloatingLinkEdit(a)},{enableOnContentEditable:!0},[]),m.useFloatingLinkEnter(),m.useFloatingLinkEscape(),{style:{...u,zIndex:1},...l,ref:m.useComposedRef(l.ref,h)}},Io0={url:"",text:"",newTab:q.Unchecked},Zo0=()=>{const[e,l]=t.useReducer((a,o)=>{const{type:i,payload:c}=o;switch(i){case"NEW_TAB":return{...a,newTab:q.Checked};case"SAME_TAB":return{...a,newTab:q.Unchecked};case"URL":case"TEXT":case"INIT":return{...a,...c};default:return a}},Io0);return[e,l]},No0=()=>{const e=m.useEditorRef(),[l,a]=Zo0();t.useEffect(()=>{const u=Ao0(e),h=Co0(e);a({type:"INIT",payload:{text:m.floatingLinkSelectors.text(),newTab:m.floatingLinkSelectors.newTab()?q.Checked:q.Unchecked,url:u&&h===""?u:m.floatingLinkSelectors.url()}})},[a,e]);const o=u=>{a({type:"TEXT",payload:{text:u}})},i=u=>{a({type:"URL",payload:{url:u}})},c=u=>{a(u?{type:"NEW_TAB"}:{type:"SAME_TAB"})},s=()=>{m.floatingLinkActions.hide()},L=u=>{!w()||!d||(m.floatingLinkActions.text(l.text),m.floatingLinkActions.url(l.url),m.floatingLinkActions.newTab(l.newTab===q.Checked),m.submitFloatingLink(e)&&(u==null||u.preventDefault()))},d=l.url!==""&&l.text!=="",w=()=>{const{isUrl:u}=m.getPluginOptions(e,m.ELEMENT_LINK);return!l.url||u&&u(l.url)};return m.useHotkeys("enter",L,{enableOnTags:["INPUT"]},[]),{state:l,onTextChange:o,onUrlChange:i,onToggleTab:c,onCancel:s,onSave:L,hasValues:d,isValidUrlOrEmpty:w}},So0=()=>t.createElement(Jz,{...No0(),testId:"floating-link-insert"}),xo0=({readOnly:e})=>{const l=m.useFloatingLinkSelectors().isEditing();if(e)return null;const a=t.createElement(So0,null),o=l?a:t.createElement(go0,null);return t.createElement(t.Fragment,null,t.createElement(P2.InsertRoot,null,a),t.createElement(P2.EditRoot,null,o))},yo0="link-plugin",ko0=({id:e})=>t.createElement(u0,{id:e},t.createElement(m.LinkToolbarButton,{tooltip:C0(`Link
|
|
39
|
-
${Y1("Ctrl+K")}`),icon:t.createElement(v0,{icon:t.createElement(A5,null)}),classNames:m0,styles:g0,actionHandler:"onMouseDown"})),Ho0=e=>({...m.useElementProps({...e,elementToAttributes:a=>({href:mb(a),target:a.target||"_blank"})}),onMouseOver:a=>{a.stopPropagation()}}),zo0=e=>{const l=Ho0(e),a=t0(),{attributes:o,children:i}=e;return t.createElement("a",{...o,href:l.href,target:l.target,style:a==null?void 0:a.designTokens.link},i)};class bo0 extends s0{constructor(l=m.ELEMENT_LINK,a=zo0){super(l,a)}}const Lb=m.createPluginFactory({...m.createLinkPlugin(),renderAfterEditable:xo0,options:{isUrl:Bz,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class db extends w0{constructor(l){super(yo0,{button:ko0,markupElement:new bo0,...l})}plugins(){return[Lb()]}}const O2="list-plugin",Os0="",To0=["decimal","alpha","roman"],Vo0=(e,l)=>{const a=m.findNodePath(e,l);if(!a)return 0;const o=m.getNodeAncestors(e,a);return Array.from(o).filter(i=>i[0].type===m.ELEMENT_OL).length},Ke=e=>`tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] ${To0[e%3]}`,ub=({attributes:e,children:l,element:a})=>{const o=m.usePlateEditorRef(),i=Vo0(o,a);return t.createElement("ol",{className:Ke(i),...e},l)};class wb extends s0{constructor(l=m.ELEMENT_OL,a=ub){super(l,a)}}const hb=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(m.ListToolbarButton,{tooltip:C0("Ordered list"),type:m.getPluginType(e,l),icon:t.createElement(v0,{icon:t.createElement(M5,null)}),classNames:m0,styles:g0,actionHandler:"onMouseDown"})),fb="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",po0=`${fb} tw-break-after-column tw-break-inside-avoid-column`,p0=e=>{const l=e.breakAfterColumn;return v([l==="active"&&po0,l==="inactive"&&fb])},vb="text-style-plugin",gb=[x.ELEMENT_HEADING1,x.ELEMENT_HEADING2,x.ELEMENT_HEADING3,x.ELEMENT_HEADING4,x.ELEMENT_CUSTOM1,x.ELEMENT_CUSTOM2,x.ELEMENT_CUSTOM3,x.ELEMENT_QUOTE,x.ELEMENT_PARAGRAPH],jo0=e=>m.getAboveNode(e,{match:{type:m.ELEMENT_LI},mode:"lowest"}),Do0=({editor:e,type:l,children:a})=>{const o=e!=null&&e.selection&&jo0(e)?m.getMark(e,G1)===l:m.someNode(e,{match:{type:l}});return t.createElement("button",{"data-test-id":"textstyle-option",type:"button",className:v(["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=>{if(!e||!e.selection)return;m.getAboveNode(e,{match:{type:m.ELEMENT_LI},mode:"lowest"})?m.setMarks(e,{[G1]:l}):m.getPreventDefaultHandler(m.toggleNodeType,e,{activeType:l,inactiveType:l})(i)}},a)},Bo0=({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:m.getPreventDefaultHandler(a)},t.createElement("div",{className:v(["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:v(["tw-transition-transform",l&&"tw-rotate-180"])},t.createElement(m5,null)))),Fo0=t.forwardRef(Bo0),Po0=e=>Array.isArray(e.children)?(e.children.find(a=>m.isText(a))??{})[G1]??x.ELEMENT_PARAGRAPH:x.ELEMENT_PARAGRAPH,Oo0=e=>!e||!e.selection?[]:Array.from(m.getNodeEntries(e,{unhang:!0,mode:"lowest",at:e.selection,reverse:!0,match:a=>m.isElement(a)&&m.isType(e,a,ea0)})).reduce((a,[o])=>{if(!m.isNode(o))return a;const i=o.type===m.ELEMENT_LIC?Po0(o):o.type;return i&&!a.includes(i)&&a.push(i),a},[]),Uo0=6,Qo0=10,Yo0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:a,maxHeight:o}=cH(e.elements.reference,e.rects.popper.height,Uo0+Qo0,0);a==="top"&&(e.placement="top-start"),e.styles.popper={maxHeight:`${o}px`},e.reset=!0,e.modifiersData[l]._skip=!0},enabled:!0},Go0=e=>{const[l,a]=t.useState(!1),[o,i]=t.useState(null),[c,s]=t.useState(null),L=m.usePlateEditorState(e),d=Oo0(L),w=d.length===1?Rr0[d[0]]:$r0,u=t.useCallback(()=>{a(f=>!f)},[a]),h=S1.usePopper(o,c,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"flip",enabled:!1},Yo0]});return t.useEffect(()=>{const f=A=>{if(l){const g=A.target;if(c&&c.contains(g)||o&&o.contains(g))return;a(!1)}};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[l,c,a,o]),{state:{isOpen:l,toggle:u,editor:L},dropdownProps:{...h.attributes.popper,style:h.styles.popper},label:w,dropdownRef:s,triggerRef:i}},Wo0=({editorId:e,textStyles:l=gb})=>{const{designTokens:a}=t0(),{state:{editor:o,toggle:i,isOpen:c},dropdownProps:s,triggerRef:L,dropdownRef:d,label:w}=Go0(e);return t.createElement(t.Fragment,null,t.createElement(Fo0,{label:w,open:c,onClick:i,ref:L}),c&&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:d,...s},l.map(u=>t.createElement(Do0,{editor:o,type:u,key:u},t.createElement("span",{style:a[u]},Mz[u])))))},qo0=({editorId:e,id:l,textStyles:a})=>t.createElement(u0,{id:l},t.createElement(Wo0,{editorId:e,textStyles:a})),Ko0=(e,l)=>a=>t.createElement(e,{...a,textStyles:l}),Xo0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("p",{...l,className:v([i&&V0[i],p0(e)]),style:o.custom1},a)},Jo0=m.createPluginFactory({key:x.ELEMENT_CUSTOM1,isElement:!0,component:Xo0,deserializeHtml:{rules:[{validClassName:"custom1"}]}}),$o0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("p",{...l,className:v([i&&V0[i],p0(e)]),style:o.custom2},a)},_o0=m.createPluginFactory({key:x.ELEMENT_CUSTOM2,isElement:!0,component:$o0,deserializeHtml:{rules:[{validClassName:"custom2"}]}}),Ro0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("p",{...l,className:v([i&&V0[i],p0(e)]),style:o.custom3},a)},ei0=m.createPluginFactory({key:x.ELEMENT_CUSTOM3,isElement:!0,component:Ro0,deserializeHtml:{rules:[{validClassName:"custom3"}]}}),ti0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("h1",{...l,className:v([i&&V0[i],p0(e)]),style:o.heading1},a)},li0=m.createPluginFactory({key:x.ELEMENT_HEADING1,isElement:!0,component:ti0,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}}),ni0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("h2",{...l,className:v([i&&V0[i],p0(e)]),style:o.heading2},a)},ri0=m.createPluginFactory({key:x.ELEMENT_HEADING2,isElement:!0,component:ni0,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}}),ai0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("h3",{...l,className:v([i&&V0[i],p0(e)]),style:o.heading3},a)},oi0=m.createPluginFactory({key:x.ELEMENT_HEADING3,isElement:!0,component:ai0,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}}),ii0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("h4",{...l,className:v([i&&V0[i],p0(e)]),style:o.heading4},a)},ci0=m.createPluginFactory({key:x.ELEMENT_HEADING4,isElement:!0,component:ii0,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}}),si0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("blockquote",{...l,className:v([i&&V0[i],p0(e)]),style:o.quote},a)},mi0=m.createPluginFactory({key:x.ELEMENT_QUOTE,isElement:!0,component:si0,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}}),Ab="tw-m-0 tw-px-0 tw-py-0",Xe=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align,c=v([i&&V0[i],Ab,p0(e)]);return t.createElement("p",{...l,className:c,style:o.p},a)};class Cb extends s0{constructor(l=m.ELEMENT_PARAGRAPH,a=Xe){super(l,a)}}const Eb=m.createPluginFactory({...m.createParagraphPlugin(),key:x.ELEMENT_PARAGRAPH,isElement:!0,component:Xe}),Li0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("p",{...l,className:v([i&&V0[i],p0(e)]),style:o.imageCaption},a)},di0=m.createPluginFactory({key:x.ELEMENT_IMAGE_CAPTION,isElement:!0,component:Li0,deserializeHtml:{rules:[{validClassName:"imageCaption"}]}}),ui0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("p",{...l,className:v([i&&V0[i],p0(e)]),style:o.imageTitle},a)},wi0=m.createPluginFactory({key:x.ELEMENT_IMAGE_TITLE,isElement:!0,component:ui0,deserializeHtml:{rules:[{validClassName:"imageTitle"}]}}),hi0={[x.ELEMENT_HEADING1]:li0,[x.ELEMENT_HEADING2]:ri0,[x.ELEMENT_HEADING3]:oi0,[x.ELEMENT_HEADING4]:ci0,[x.ELEMENT_CUSTOM1]:Jo0,[x.ELEMENT_CUSTOM2]:_o0,[x.ELEMENT_CUSTOM3]:ei0,[x.ELEMENT_IMAGE_TITLE]:wi0,[x.ELEMENT_IMAGE_CAPTION]:di0,[x.ELEMENT_QUOTE]:mi0,[x.ELEMENT_PARAGRAPH]:Eb},fi0=e=>e.map(l=>hi0[l]());class Mb extends w0{constructor({textStyles:l=gb,...a}={}){super(vb,{button:Ko0(qo0,l),textStyles:l,...a})}plugins(){var l;return fi0(((l=this.props)==null?void 0:l.textStyles)??[])}}const U2=e=>{const l=Object.values(x).find(a=>(e==null?void 0:e[G1])===a)??x.ELEMENT_PARAGRAPH;return ta0[l]},vi0=({attributes:e,children:l,element:a})=>{var s;const{designTokens:o}=t0(),i=a.align,c=a.children.every(L=>L.text==="");return t.createElement("p",{className:v([p0(a),i?Iz[i]:"tw-justify-start tw-flex"]),...e},t.createElement("span",{className:v([c&&"tw-w-4",((s=o[U2(a.children[0])])==null?void 0:s.textDecoration)==="underline"&&"tw-underline"])},l))};class gi0 extends s0{constructor(l=m.ELEMENT_LIC,a=vi0){super(l,a)}}const Ai0=({attributes:e,children:l,element:a})=>{var s,L;const{designTokens:o}=t0(),i=(L=(s=a.children[0])==null?void 0:s.children)==null?void 0:L[0],c=o[U2(i)];return t.createElement("li",{style:c,...e,className:v([(c==null?void 0:c.textTransform)==="uppercase"&&"marker:tw-uppercase","!tw-no-underline"])},l)};class Ci0 extends s0{constructor(l=m.ELEMENT_LI,a=Ai0){super(l,a)}}const Ei0=(e,{options:{validLiChildrenTypes:l,isSoftBreak:a}})=>{const{insertBreak:o,deleteBackward:i,deleteForward:c,deleteFragment:s}=e;return a?e.insertSoftBreak=()=>{m.insertBreakList(e)||o()}:e.insertBreak=()=>{m.insertBreakList(e)||o()},e.deleteBackward=L=>{m.deleteBackwardList(e,L)||i(L)},e.deleteForward=L=>{m.deleteForwardList(e)||c(L)},e.deleteFragment=L=>{m.deleteFragmentList(e)||s(L)},e.insertFragment=m.insertFragmentList(e),e.normalizeNode=m.normalizeList(e,{validLiChildrenTypes:l}),e},G1="textStyle",Mi0=m.createPluginFactory({key:G1,isLeaf:!0});class Ib extends w0{constructor(a){super(O2,{leafMarkupElements:[new gi0,new Ci0],...a});i0(this,"isSoftBreak");this.isSoftBreak=(a==null?void 0:a.isSoftBreak)??!1}plugins(){return[m.createListPlugin({withOverrides:Ei0,options:{isSoftBreak:this.isSoftBreak}}),Mi0()]}}class Zb extends Ib{constructor(l){super({id:O2,button:hb,markupElement:new wb,...l})}}const Us0="",Je="tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",Nb=({attributes:e,children:l})=>t.createElement("ul",{className:Je,...e},l);class Sb extends s0{constructor(l=m.ELEMENT_UL,a=Nb){super(l,a)}}const xb=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(m.ListToolbarButton,{tooltip:C0("Bullet list"),type:m.getPluginType(e,l),icon:t.createElement(v0,{icon:t.createElement(C5,null)}),classNames:m0,styles:g0,actionHandler:"onMouseDown"}));class yb extends Ib{constructor(l){super({id:O2,button:xb,markupElement:new Sb,...l})}}const Ii0="paragraph-plugin";class kb extends w0{constructor(l){super(Ii0,{markupElement:new Cb,...l})}plugins(){return[Eb()]}}class Zi0{constructor(){i0(this,"toolbarButtons",{[e0.BOTTOM]:[],[e0.FLOATING]:[],[e0.TOP]:[]})}createGroupOfButtons(l){const a=[],o=[],i=[];for(const{markupElement:c,button:s,id:L,showIn:d}of l){if(!s)continue;const w={id:(c==null?void 0:c.getId())||L,button:s};d.includes(e0.BOTTOM)&&a.push(w),d.includes(e0.TOP)&&o.push(w),d.includes(e0.FLOATING)&&i.push(w)}a.length>0&&this.toolbarButtons[e0.BOTTOM].push(a),o.length>0&&this.toolbarButtons[e0.TOP].push(o),i.length>0&&this.toolbarButtons[e0.FLOATING].push(i)}at(l){return this.toolbarButtons[l]}}class Hb{constructor(l){i0(this,"platePlugins",new Map);i0(this,"markupElements",{});i0(this,"inlineElements",[]);i0(this,"toolbarButtons",new Zi0);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 zb="reset-formatting-plugin",bb="reset-formatting",Ni0=e=>{!e||!e.selection||(m.removeMark(e,{key:[m.MARK_BOLD,m.MARK_ITALIC,m.MARK_CODE,m.MARK_UNDERLINE,m.MARK_STRIKETHROUGH]}),m.unwrapList(e,{}),m.setElements(e,{type:m.ELEMENT_PARAGRAPH,align:void 0}))},Si0=m.withPlateProvider(({id:e,...l})=>{const a=m.usePlateEditorState(m.useEventPlateId(e));return t.createElement(m.ToolbarButton,{tooltip:C0("Clear formatting"),onMouseDown:()=>{Ni0(a)},...l})}),xi0=({id:e})=>t.createElement(u0,{id:e},t.createElement(Si0,{icon:t.createElement(v0,{icon:t.createElement(f5,null)}),classNames:m0,styles:g0})),Tb=m.createPluginFactory({key:bb,isElement:!1});class Vb extends w0{constructor(l){super(zb,{button:xi0,...l})}plugins(){return[Tb()]}}const yi0="strikethrough-plugin",$e="tw-line-through",pb=({attributes:e,children:l})=>t.createElement("span",{...e,className:$e},l);class jb extends s0{constructor(l=m.MARK_STRIKETHROUGH,a=pb){super(l,a)}}const ki0=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(m.MarkToolbarButton,{tooltip:C0("Strikethrough"),type:m.getPluginType(e,l),icon:t.createElement(v0,{icon:t.createElement(Qx,null)}),classNames:m0,styles:g0,actionHandler:"onMouseDown"}));class Db extends w0{constructor(l){super(yi0,{button:ki0,markupElement:new jb,...l})}plugins(){return[m.createStrikethroughPlugin()]}}const Hi0="underline-plugin",Q2="tw-underline",Bb=({attributes:e,children:l})=>t.createElement("span",{...e,className:Q2},l);class Fb extends s0{constructor(l=m.MARK_UNDERLINE,a=Bb){super(l,a)}}const zi0=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(m.MarkToolbarButton,{tooltip:C0(`Underline
|
|
39
|
+
${Y1("Ctrl+K")}`),icon:t.createElement(v0,{icon:t.createElement(A5,null)}),classNames:m0,styles:g0,actionHandler:"onMouseDown"})),Ho0=e=>({...m.useElementProps({...e,elementToAttributes:a=>({href:mb(a),target:a.target||"_blank"})}),onMouseOver:a=>{a.stopPropagation()}}),zo0=e=>{const l=Ho0(e),a=t0(),{attributes:o,children:i}=e;return t.createElement("a",{...o,href:l.href,target:l.target,style:a==null?void 0:a.designTokens.link},i)};class bo0 extends s0{constructor(l=m.ELEMENT_LINK,a=zo0){super(l,a)}}const Lb=m.createPluginFactory({...m.createLinkPlugin(),renderAfterEditable:xo0,options:{isUrl:Bz,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class db extends w0{constructor(l){super(yo0,{button:ko0,markupElement:new bo0,...l})}plugins(){return[Lb()]}}const O2="list-plugin",Os0="",To0=["decimal","alpha","roman"],Vo0=(e,l)=>{const a=m.findNodePath(e,l);if(!a)return 0;const o=m.getNodeAncestors(e,a);return Array.from(o).filter(i=>i[0].type===m.ELEMENT_OL).length},Ke=e=>`tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] ${To0[e%3]}`,ub=({attributes:e,children:l,element:a})=>{const o=m.usePlateEditorRef(),i=Vo0(o,a);return t.createElement("ol",{className:Ke(i),...e,style:{counterReset:"count"}},l)};class wb extends s0{constructor(l=m.ELEMENT_OL,a=ub){super(l,a)}}const hb=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(m.ListToolbarButton,{tooltip:C0("Ordered list"),type:m.getPluginType(e,l),icon:t.createElement(v0,{icon:t.createElement(M5,null)}),classNames:m0,styles:g0,actionHandler:"onMouseDown"})),fb="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",po0=`${fb} tw-break-after-column tw-break-inside-avoid-column`,p0=e=>{const l=e.breakAfterColumn;return v([l==="active"&&po0,l==="inactive"&&fb])},vb="text-style-plugin",gb=[x.ELEMENT_HEADING1,x.ELEMENT_HEADING2,x.ELEMENT_HEADING3,x.ELEMENT_HEADING4,x.ELEMENT_CUSTOM1,x.ELEMENT_CUSTOM2,x.ELEMENT_CUSTOM3,x.ELEMENT_QUOTE,x.ELEMENT_PARAGRAPH],jo0=e=>m.getAboveNode(e,{match:{type:m.ELEMENT_LI},mode:"lowest"}),Do0=({editor:e,type:l,children:a})=>{const o=e!=null&&e.selection&&jo0(e)?m.getMark(e,G1)===l:m.someNode(e,{match:{type:l}});return t.createElement("button",{"data-test-id":"textstyle-option",type:"button",className:v(["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=>{if(!e||!e.selection)return;m.getAboveNode(e,{match:{type:m.ELEMENT_LI},mode:"lowest"})?m.setMarks(e,{[G1]:l}):m.getPreventDefaultHandler(m.toggleNodeType,e,{activeType:l,inactiveType:l})(i)}},a)},Bo0=({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:m.getPreventDefaultHandler(a)},t.createElement("div",{className:v(["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:v(["tw-transition-transform",l&&"tw-rotate-180"])},t.createElement(m5,null)))),Fo0=t.forwardRef(Bo0),Po0=e=>Array.isArray(e.children)?(e.children.find(a=>m.isText(a))??{})[G1]??x.ELEMENT_PARAGRAPH:x.ELEMENT_PARAGRAPH,Oo0=e=>!e||!e.selection?[]:Array.from(m.getNodeEntries(e,{unhang:!0,mode:"lowest",at:e.selection,reverse:!0,match:a=>m.isElement(a)&&m.isType(e,a,ea0)})).reduce((a,[o])=>{if(!m.isNode(o))return a;const i=o.type===m.ELEMENT_LIC?Po0(o):o.type;return i&&!a.includes(i)&&a.push(i),a},[]),Uo0=6,Qo0=10,Yo0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:a,maxHeight:o}=cH(e.elements.reference,e.rects.popper.height,Uo0+Qo0,0);a==="top"&&(e.placement="top-start"),e.styles.popper={maxHeight:`${o}px`},e.reset=!0,e.modifiersData[l]._skip=!0},enabled:!0},Go0=e=>{const[l,a]=t.useState(!1),[o,i]=t.useState(null),[c,s]=t.useState(null),L=m.usePlateEditorState(e),d=Oo0(L),w=d.length===1?Rr0[d[0]]:$r0,u=t.useCallback(()=>{a(f=>!f)},[a]),h=S1.usePopper(o,c,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"flip",enabled:!1},Yo0]});return t.useEffect(()=>{const f=A=>{if(l){const g=A.target;if(c&&c.contains(g)||o&&o.contains(g))return;a(!1)}};return document.addEventListener("mousedown",f),()=>{document.removeEventListener("mousedown",f)}},[l,c,a,o]),{state:{isOpen:l,toggle:u,editor:L},dropdownProps:{...h.attributes.popper,style:h.styles.popper},label:w,dropdownRef:s,triggerRef:i}},Wo0=({editorId:e,textStyles:l=gb})=>{const{designTokens:a}=t0(),{state:{editor:o,toggle:i,isOpen:c},dropdownProps:s,triggerRef:L,dropdownRef:d,label:w}=Go0(e);return t.createElement(t.Fragment,null,t.createElement(Fo0,{label:w,open:c,onClick:i,ref:L}),c&&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:d,...s},l.map(u=>t.createElement(Do0,{editor:o,type:u,key:u},t.createElement("span",{style:a[u]},Mz[u])))))},qo0=({editorId:e,id:l,textStyles:a})=>t.createElement(u0,{id:l},t.createElement(Wo0,{editorId:e,textStyles:a})),Ko0=(e,l)=>a=>t.createElement(e,{...a,textStyles:l}),Xo0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("p",{...l,className:v([i&&V0[i],p0(e)]),style:o.custom1},a)},Jo0=m.createPluginFactory({key:x.ELEMENT_CUSTOM1,isElement:!0,component:Xo0,deserializeHtml:{rules:[{validClassName:"custom1"}]}}),$o0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("p",{...l,className:v([i&&V0[i],p0(e)]),style:o.custom2},a)},_o0=m.createPluginFactory({key:x.ELEMENT_CUSTOM2,isElement:!0,component:$o0,deserializeHtml:{rules:[{validClassName:"custom2"}]}}),Ro0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("p",{...l,className:v([i&&V0[i],p0(e)]),style:o.custom3},a)},ei0=m.createPluginFactory({key:x.ELEMENT_CUSTOM3,isElement:!0,component:Ro0,deserializeHtml:{rules:[{validClassName:"custom3"}]}}),ti0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("h1",{...l,className:v([i&&V0[i],p0(e)]),style:o.heading1},a)},li0=m.createPluginFactory({key:x.ELEMENT_HEADING1,isElement:!0,component:ti0,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}}),ni0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("h2",{...l,className:v([i&&V0[i],p0(e)]),style:o.heading2},a)},ri0=m.createPluginFactory({key:x.ELEMENT_HEADING2,isElement:!0,component:ni0,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}}),ai0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("h3",{...l,className:v([i&&V0[i],p0(e)]),style:o.heading3},a)},oi0=m.createPluginFactory({key:x.ELEMENT_HEADING3,isElement:!0,component:ai0,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}}),ii0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("h4",{...l,className:v([i&&V0[i],p0(e)]),style:o.heading4},a)},ci0=m.createPluginFactory({key:x.ELEMENT_HEADING4,isElement:!0,component:ii0,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}}),si0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("blockquote",{...l,className:v([i&&V0[i],p0(e)]),style:o.quote},a)},mi0=m.createPluginFactory({key:x.ELEMENT_QUOTE,isElement:!0,component:si0,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}}),Ab="tw-m-0 tw-px-0 tw-py-0",Xe=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align,c=v([i&&V0[i],Ab,p0(e)]);return t.createElement("p",{...l,className:c,style:o.p},a)};class Cb extends s0{constructor(l=m.ELEMENT_PARAGRAPH,a=Xe){super(l,a)}}const Eb=m.createPluginFactory({...m.createParagraphPlugin(),key:x.ELEMENT_PARAGRAPH,isElement:!0,component:Xe}),Li0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("p",{...l,className:v([i&&V0[i],p0(e)]),style:o.imageCaption},a)},di0=m.createPluginFactory({key:x.ELEMENT_IMAGE_CAPTION,isElement:!0,component:Li0,deserializeHtml:{rules:[{validClassName:"imageCaption"}]}}),ui0=({element:e,attributes:l,children:a})=>{const{designTokens:o}=t0(),i=e.align;return t.createElement("p",{...l,className:v([i&&V0[i],p0(e)]),style:o.imageTitle},a)},wi0=m.createPluginFactory({key:x.ELEMENT_IMAGE_TITLE,isElement:!0,component:ui0,deserializeHtml:{rules:[{validClassName:"imageTitle"}]}}),hi0={[x.ELEMENT_HEADING1]:li0,[x.ELEMENT_HEADING2]:ri0,[x.ELEMENT_HEADING3]:oi0,[x.ELEMENT_HEADING4]:ci0,[x.ELEMENT_CUSTOM1]:Jo0,[x.ELEMENT_CUSTOM2]:_o0,[x.ELEMENT_CUSTOM3]:ei0,[x.ELEMENT_IMAGE_TITLE]:wi0,[x.ELEMENT_IMAGE_CAPTION]:di0,[x.ELEMENT_QUOTE]:mi0,[x.ELEMENT_PARAGRAPH]:Eb},fi0=e=>e.map(l=>hi0[l]());class Mb extends w0{constructor({textStyles:l=gb,...a}={}){super(vb,{button:Ko0(qo0,l),textStyles:l,...a})}plugins(){var l;return fi0(((l=this.props)==null?void 0:l.textStyles)??[])}}const U2=e=>{const l=Object.values(x).find(a=>(e==null?void 0:e[G1])===a)??x.ELEMENT_PARAGRAPH;return ta0[l]},vi0=({attributes:e,children:l,element:a})=>{var s;const{designTokens:o}=t0(),i=a.align,c=a.children.every(L=>L.text==="");return t.createElement("p",{className:v([p0(a),i?Iz[i]:"tw-justify-start tw-flex"]),...e},t.createElement("span",{className:v([c&&"tw-w-4",((s=o[U2(a.children[0])])==null?void 0:s.textDecoration)==="underline"&&"tw-underline"])},l))};class gi0 extends s0{constructor(l=m.ELEMENT_LIC,a=vi0){super(l,a)}}const Ai0=({attributes:e,children:l,element:a})=>{var s,L;const{designTokens:o}=t0(),i=(L=(s=a.children[0])==null?void 0:s.children)==null?void 0:L[0],c=o[U2(i)];return t.createElement("li",{style:c,...e,className:v([(c==null?void 0:c.textTransform)==="uppercase"&&"marker:tw-uppercase","!tw-no-underline","listElement"])},l)};class Ci0 extends s0{constructor(l=m.ELEMENT_LI,a=Ai0){super(l,a)}}const Ei0=(e,{options:{validLiChildrenTypes:l,isSoftBreak:a}})=>{const{insertBreak:o,deleteBackward:i,deleteForward:c,deleteFragment:s}=e;return a?e.insertSoftBreak=()=>{m.insertBreakList(e)||o()}:e.insertBreak=()=>{m.insertBreakList(e)||o()},e.deleteBackward=L=>{m.deleteBackwardList(e,L)||i(L)},e.deleteForward=L=>{m.deleteForwardList(e)||c(L)},e.deleteFragment=L=>{m.deleteFragmentList(e)||s(L)},e.insertFragment=m.insertFragmentList(e),e.normalizeNode=m.normalizeList(e,{validLiChildrenTypes:l}),e},G1="textStyle",Mi0=m.createPluginFactory({key:G1,isLeaf:!0});class Ib extends w0{constructor(a){super(O2,{leafMarkupElements:[new gi0,new Ci0],...a});i0(this,"isSoftBreak");this.isSoftBreak=(a==null?void 0:a.isSoftBreak)??!1}plugins(){return[m.createListPlugin({withOverrides:Ei0,options:{isSoftBreak:this.isSoftBreak}}),Mi0()]}}class Zb extends Ib{constructor(l){super({id:O2,button:hb,markupElement:new wb,...l})}}const Us0="",Je="tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",Nb=({attributes:e,children:l})=>t.createElement("ul",{className:Je,...e},l);class Sb extends s0{constructor(l=m.ELEMENT_UL,a=Nb){super(l,a)}}const xb=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(m.ListToolbarButton,{tooltip:C0("Bullet list"),type:m.getPluginType(e,l),icon:t.createElement(v0,{icon:t.createElement(C5,null)}),classNames:m0,styles:g0,actionHandler:"onMouseDown"}));class yb extends Ib{constructor(l){super({id:O2,button:xb,markupElement:new Sb,...l})}}const Ii0="paragraph-plugin";class kb extends w0{constructor(l){super(Ii0,{markupElement:new Cb,...l})}plugins(){return[Eb()]}}class Zi0{constructor(){i0(this,"toolbarButtons",{[e0.BOTTOM]:[],[e0.FLOATING]:[],[e0.TOP]:[]})}createGroupOfButtons(l){const a=[],o=[],i=[];for(const{markupElement:c,button:s,id:L,showIn:d}of l){if(!s)continue;const w={id:(c==null?void 0:c.getId())||L,button:s};d.includes(e0.BOTTOM)&&a.push(w),d.includes(e0.TOP)&&o.push(w),d.includes(e0.FLOATING)&&i.push(w)}a.length>0&&this.toolbarButtons[e0.BOTTOM].push(a),o.length>0&&this.toolbarButtons[e0.TOP].push(o),i.length>0&&this.toolbarButtons[e0.FLOATING].push(i)}at(l){return this.toolbarButtons[l]}}class Hb{constructor(l){i0(this,"platePlugins",new Map);i0(this,"markupElements",{});i0(this,"inlineElements",[]);i0(this,"toolbarButtons",new Zi0);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 zb="reset-formatting-plugin",bb="reset-formatting",Ni0=e=>{!e||!e.selection||(m.removeMark(e,{key:[m.MARK_BOLD,m.MARK_ITALIC,m.MARK_CODE,m.MARK_UNDERLINE,m.MARK_STRIKETHROUGH]}),m.unwrapList(e,{}),m.setElements(e,{type:m.ELEMENT_PARAGRAPH,align:void 0}))},Si0=m.withPlateProvider(({id:e,...l})=>{const a=m.usePlateEditorState(m.useEventPlateId(e));return t.createElement(m.ToolbarButton,{tooltip:C0("Clear formatting"),onMouseDown:()=>{Ni0(a)},...l})}),xi0=({id:e})=>t.createElement(u0,{id:e},t.createElement(Si0,{icon:t.createElement(v0,{icon:t.createElement(f5,null)}),classNames:m0,styles:g0})),Tb=m.createPluginFactory({key:bb,isElement:!1});class Vb extends w0{constructor(l){super(zb,{button:xi0,...l})}plugins(){return[Tb()]}}const yi0="strikethrough-plugin",$e="tw-line-through",pb=({attributes:e,children:l})=>t.createElement("span",{...e,className:$e},l);class jb extends s0{constructor(l=m.MARK_STRIKETHROUGH,a=pb){super(l,a)}}const ki0=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(m.MarkToolbarButton,{tooltip:C0("Strikethrough"),type:m.getPluginType(e,l),icon:t.createElement(v0,{icon:t.createElement(Qx,null)}),classNames:m0,styles:g0,actionHandler:"onMouseDown"}));class Db extends w0{constructor(l){super(yi0,{button:ki0,markupElement:new jb,...l})}plugins(){return[m.createStrikethroughPlugin()]}}const Hi0="underline-plugin",Q2="tw-underline",Bb=({attributes:e,children:l})=>t.createElement("span",{...e,className:Q2},l);class Fb extends s0{constructor(l=m.MARK_UNDERLINE,a=Bb){super(l,a)}}const zi0=({editor:e,id:l})=>t.createElement(u0,{id:l},t.createElement(m.MarkToolbarButton,{tooltip:C0(`Underline
|
|
40
40
|
${Y1("Ctrl+U")}`),type:m.getPluginType(e,l),icon:t.createElement(v0,{icon:t.createElement(p5,null)}),classNames:m0,styles:g0,actionHandler:"onMouseDown"})),bi0=[{validNodeName:["U"]},{validStyle:{textDecoration:["underline"]}}];class Pb extends w0{constructor(l){super(Hi0,{button:zi0,markupElement:new Fb,...l})}plugins(){return[m.createUnderlinePlugin({deserializeHtml:{rules:[...bi0,{validNodeName:["SPAN"],validClassName:Q2}]},options:{hotkey:["mod+u","ctrl+u"]}})]}}const Ob=e=>Array.from(m.getNodeEntries(e,{at:[],match:l=>!!l.breakAfterColumn})).length,W1=(e,{key:l=M1,value:a,at:o})=>{const i=c=>J1.isBlock(e,c);a?J1.setElements(e,{[l]:a},{mode:"lowest",match:i,at:o}):J1.unsetNodes(e,l,{match:i,mode:"lowest",at:o})},Ti0=(e,l,a)=>{W1(e,{at:l,value:a})},_e=(e,l)=>{const a=Array.from(m.getNodeEntries(e,{at:[],match:o=>!!o.breakAfterColumn}));for(const[o,[,i]]of a.entries())Ti0(e,i,o<l-1?"active":"inactive")},Ub=(e,l,a)=>{if(!!(e!=null&&e.selection)&&m.someNode(e,{match:i=>!!i.breakAfterColumn}))W1(e,{value:void 0});else{const i=Ob(e),c=Math.max(l-i-1,0);if(c===0)return;const s=Array.from(m.getNodeEntries(e,{at:e.selection,match:L=>m.isBlock(e,L),mode:"lowest"})).slice(-c);m.getPreventDefaultHandler(()=>{for(const L of s)W1(e,{value:"active",at:L[1]})})(a)}_e(e,l)},Vi0=e=>l=>{var a;if(!l.defaultPrevented&&QT("shift+ctrl+enter",l)){const o=e.plugins.find(c=>c.key===M1),i=((a=o==null?void 0:o.options)==null?void 0:a.columns)??1;Ub(e,i,l)}},pi0=({id:e,...l})=>{var d;const a=m.usePlateEditorState(m.useEventPlateId(e)),o=!!(a!=null&&a.selection)&&m.someNode(a,{match:w=>!!w.breakAfterColumn}),i=a.pluginsByKey.breakAfterColumn,c=(d=i==null?void 0:i.options)==null?void 0:d.columns,s=Number(c)||1,L=ji0(a,s,o);return t.createElement(m.ToolbarButton,{active:o,tooltip:C0(L?`Column Break
|
|
41
41
|
Shift+Ctrl+Return`:"Already at maximum numbers of columns"),onMouseDown:w=>Ub(a,s,w),...l,classNames:{root:`${m0.root} ${L?"":"!tw-cursor-not-allowed !tw-opacity-50"}`,active:m0.active}})},ji0=(e,l,a)=>Ob(e)+1<l||a,Qb=({id:e})=>t.createElement(u0,{id:e},t.createElement(pi0,{icon:t.createElement(v0,{icon:t.createElement(b5,null)}),classNames:m0,styles:g0})),Di0=(e,l)=>{const a=m.getStartPoint(e,l);setTimeout(()=>{m.select(e,{anchor:a,focus:a})})},Bi0=e=>{var a;const l=e.plugins.find(o=>o.key===M1);return((a=l==null?void 0:l.options)==null?void 0:a.columns)??1},Fi0=e=>{const{apply:l}=e,a=Bi0(e);e.apply=o=>{switch(o.type){case"split_node":o.properties={...o.properties,breakAfterColumn:void 0};break;case"merge_node":const i=m.getPointBefore(e,o.path);if(!i)break;const c=m.getParentNode(e,i.path);if(W1(e,{at:i,value:void 0}),_e(e,a),c!=null&&c[0].breakAfterColumn)return Di0(e,o.path),e;break}l(o)},setTimeout(()=>_e(e,a))},M1="breakAfterColumn",Re="normal";class Pi0 extends w0{constructor(a){super("break-after-plugin",{button:Qb,...a});i0(this,"columns");i0(this,"gap");this.columns=(a==null?void 0:a.columns)??1,this.gap=(a==null?void 0:a.gap)??Re}plugins(){return[Yb(this.columns,this.gap)]}}const Yb=(e,l)=>m.createPluginFactory({key:M1,handlers:{onKeyDown:Vi0},useHooks:Fi0,options:{columns:e,gap:l}})(),Oi0=12,Ui0=26,Qi0=124,Yi0=e=>e.map((l,a)=>({group:l,buttonGroupWidth:l.reduce((o,i)=>i.id===vb?Qi0:Ui0+o,Oi0),index:a})),Gi0=(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((d,{buttonGroupWidth:w})=>d+w,0)+i<=e?a[s].push({group:o,buttonGroupWidth:i,index:c}):a.push([{group:o,buttonGroupWidth:i,index:c}]),a.filter(d=>d.length)},[]),Wi0=({toolbarButtons:e,editorId:l})=>{const a=m.usePlateEditorRef(l),{editorWidth:o}=Ia0(),{position:i}=t0(),c=Yi0(e.at(i)),s=Gi0(o||0,c),L=Jb[i];return t.createElement(L.ToolbarWrapper,{editorWidth:o,toolbarButtonGroups:s},s.map((d,w)=>t.createElement("div",{className:"tw-divide-x tw-divide-line tw-flex tw-w-full tw-flex-wrap",key:w},d.map(({group:u,index:h})=>t.createElement(aa0,{index:h,key:h},u.map((f,A)=>t.createElement(f.button,{editor:a,editorId:l,id:f.id,key:A.toString()})))))))},Gb=e=>m.createPlugins(e.plugins,{components:m.createPlateUI(e.elements)}),e3=(e,l)=>({create:()=>Gb(l),toolbar:()=>l.hasToolbar?t.createElement(Wi0,{toolbarButtons:l.buttons,editorId:e}):null,inline:()=>t.createElement(t.Fragment,null,l.inline.map((a,o)=>t.createElement(a,{key:o})))}),qi0="mention-plugin",Ki0=e=>l=>l.text.toLowerCase().includes(e.toLowerCase()),t3=(e,l)=>`${e}:${l}`,l3=e=>{const l=new Map;for(const a of e){const o=t3(a.data.category,a.data.id),i=a.text;l.set(o,i)}return l},Wb=(e,l,a)=>e.get(l)??a;var Q0=(e=>(e.GROUP="group",e.ALL="all",e.USER="user",e))(Q0||{});const n3=({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),Xi0=({children:e,...l})=>t.createElement(n3,{...l},t.createElement("span",{style:{paddingRight:"3px",display:"inline-block",margin:"-1px 0"}},t.createElement(t2,null)),e),Ji0=({children:e,...l})=>t.createElement(n3,{...l},"@",e),$i0=({children:e,...l})=>t.createElement(n3,{...l},e),_i0=({category:e,children:l,...a})=>{const o={[Q0.USER]:$i0,[Q0.GROUP]:Xi0,[Q0.ALL]:Ji0},i=o[e]??o[Q0.USER];return t.createElement(i,{...a},l)},r3=e=>l=>{const{element:a,children:o}=l,i=t3(a==null?void 0:a.category,String(a==null?void 0:a.id));return t.createElement(_i0,{category:a==null?void 0:a.category,...l},Wb(e,i,String(a==null?void 0:a.id)),o)};class qb extends s0{constructor(l=m.ELEMENT_MENTION){super(l)}setNodeWithMentionable(l){return this.node=r3(l3(l)),this}}const Ri0=({image:e,category:l,text:a,id:o})=>{if(e)return t.createElement("img",{src:e,alt:`${o}-${l}-${a}`});switch(l){case Q0.GROUP:return t.createElement(t2,null);case Q0.ALL:return t.createElement(S5,null);default:return t.createElement(Z5,null)}},ec0=({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(Ri0,{image:l,category:a,text:i,id:o})),t.createElement("span",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis"},i))},Kb=[`
|
|
42
42
|
color: var(--text-color-weak);
|