@frontify/fondue 12.0.0-beta.285 → 12.0.0-beta.286
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/ListItemMarkupElement.d.ts +1 -1
- package/dist/components/RichTextEditor/Plugins/ListPlugin/ListItemMarkupElement.es.js +18 -18
- package/dist/components/RichTextEditor/Plugins/ListPlugin/ListItemMarkupElement.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/dist/styles.css +1 -1
- package/package.json +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -35,7 +35,7 @@ ${i2("Ctrl+B")}`),key:l,type:w.getPluginType(e,l),icon:t.createElement(y0,{icon:
|
|
|
35
35
|
color: var(--box-neutral-inverse-color-hover);
|
|
36
36
|
`]},Hm0={renderAfterEditable:Sm0};class LV extends n0{constructor(l){super(Em0,{button:Nm0,showIn:[h0.BOTTOM,h0.TOP],...l})}plugins(){return[w.createComboboxPlugin(),w.createEmojiPlugin(Hm0)]}}const bm0="soft-break-plugin";class dV extends n0{constructor(l){super(bm0,{...l})}plugins(){return[w.createSoftBreakPlugin()]}}const km0="italic-plugin",h5="tw-italic",uV=({attributes:e,children:l})=>t.createElement("span",{...e,className:h5},l);class wV extends l0{constructor(l=w.MARK_ITALIC,a=uV){super(l,a)}}const zm0=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(w.MarkToolbarButton,{tooltip:V0(`Italic
|
|
37
37
|
${i2("Ctrl+I")}`),type:w.getPluginType(e,l),icon:t.createElement(y0,{icon:t.createElement(Ce,null)}),classNames:I0(),styles:x0,actionHandler:"onMouseDown"})),pm0=[{validNodeName:["EM","I"]},{validStyle:{fontStyle:"italic"}}];class hV extends n0{constructor(l){super(km0,{button:zm0,markupElement:new wV,...l})}plugins(){return[w.createItalicPlugin({deserializeHtml:{rules:[...pm0,{validNodeName:["SPAN"],validClassName:h5}]},options:{hotkey:["mod+i","ctrl+i"]}})]}}const Vm0=e=>!!e.match(/^(https?:\/\/|mailto:|tel:).+/),Tm0=w.createComponentAs(e=>{var a;const l=w.useFloatingLinkInsert({...e,floatingOptions:{strategy:"fixed"}});return((a=l.style)==null?void 0:a.display)==="none"?null:w.createElementAs("div",l)}),jm0=w.createComponentAs(e=>{var a;const l=Pm0({...e,floatingOptions:{strategy:"fixed"}});return((a=l.style)==null?void 0:a.display)==="none"?null:w.createElementAs("div",l)});w.FloatingLink.EditRoot=jm0,w.FloatingLink.InsertRoot=Tm0;const f5=w.FloatingLink,F1="link-plugin",Dm0=()=>{const e=w.useFloatingLinkUrlInput({}),{styles:l}=C1();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[F1],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(ce,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(Me,null))))))},j3=(e,l)=>{const a=w.getAboveNode(e,{match:{type:w.ELEMENT_LINK}});return Array.isArray(a)?l(a[0]):""},Fm0=e=>j3(e,l=>{var a,o;return((o=(a=l.chosenLink)==null?void 0:a.searchResult)==null?void 0:o.link)||""}),Bm0=e=>j3(e,l=>l.url||""),fV=e=>{var l,a;return e.url||((a=(l=e.chosenLink)==null?void 0:l.searchResult)==null?void 0:a.link)||""},Om0=e=>j3(e,fV),Pm0=({floatingOptions:e,...l})=>{const a=w.useEditorRef(),o=w.usePlateSelectors().keyEditor(),i=w.useFloatingLinkSelectors().mode(),c=w.useFloatingLinkSelectors().isOpen(a.id),{triggerFloatingLinkHotkeys:s="command+k, ctrl+k"}=w.getPluginOptions(a,w.ELEMENT_LINK),m=t.useCallback(()=>{const h=w.getAboveNode(a,{match:{type:w.getPluginType(a,w.ELEMENT_LINK)}});if(h){const[,g]=h;return w.getRangeBoundingClientRect(a,{anchor:w.getStartPoint(a,g),focus:w.getEndPoint(a,g)})}return w.getDefaultBoundingClientRect()},[a]),L=c&&i==="edit",{update:d,style:u,floating:f}=w.useVirtualFloatingLink({editorId:a.id,open:L,getBoundingClientRect:m,...e});return t.useEffect(()=>{const h=Om0(a);if(h&&w.floatingLinkActions.url(h),a.selection&&w.someNode(a,{match:{type:w.getPluginType(a,w.ELEMENT_LINK)}})){w.floatingLinkActions.show("edit",a.id),d();return}w.floatingLinkSelectors.mode()==="edit"&&w.floatingLinkActions.hide()},[a,o,d]),w.useHotkeys(s,h=>{h.preventDefault(),w.floatingLinkSelectors.mode()==="edit"&&w.triggerFloatingLinkEdit(a)},{enableOnContentEditable:!0},[]),w.useFloatingLinkEnter(),w.useFloatingLinkEscape(),{style:{...u,zIndex:1},...l,ref:w.useComposedRef(l.ref,f)}},Um0=({state:e,onTextChange:l,onUrlChange:a,onToggleTab:o,onCancel:i,onSave:c,isValidUrlOrEmpty:s,hasValues:m,testId:L,children:d})=>t.createElement("div",{"data-test-id":L,className:"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto"},t.createElement(q2,{label:{children:"Text",htmlFor:"linkText",required:!0}},t.createElement(v1,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:l})),d,t.createElement("div",{className:"tw-pt-5"},t.createElement(q2,{label:{children:"URL",htmlFor:"url",required:!0}},t.createElement(v1,{id:"url",value:e.url,placeholder:"https://example.com",focusOnMount:!0,onChange:a})),!s()&&t.createElement("div",{className:"tw-text-red-65 tw-mt-3"},"Please enter a valid URL.")),t.createElement("div",{className:"tw-pt-5"},t.createElement(f1,{value:"new-tab",label:"Open in new tab",state:e.newTab,onChange:o})),t.createElement("div",{className:"tw-mt-3"},t.createElement("div",{className:"tw-pt-5 tw-flex tw-gap-x-3 tw-justify-end tw-border-t tw-border-t-black-10"},t.createElement(z0,{onClick:i,size:i0.Medium,style:$.Default,emphasis:f0.Default},"Cancel"),t.createElement(z0,{onClick:c,size:i0.Medium,icon:t.createElement(X5,null),disabled:!s()||!m},"Save")))),Qm0={url:"",text:"",newTab:M0.Unchecked},Ym0=()=>{const[e,l]=t.useReducer((a,o)=>{const{type:i,payload:c}=o;switch(i){case"NEW_TAB":return{...a,newTab:M0.Checked};case"SAME_TAB":return{...a,newTab:M0.Unchecked};case"URL":case"TEXT":case"INIT":return{...a,...c};default:return a}},Qm0);return[e,l]},Gm0=()=>{const e=w.useEditorRef(),[l,a]=Ym0();t.useEffect(()=>{const u=Fm0(e),f=Bm0(e);a({type:"INIT",payload:{text:w.floatingLinkSelectors.text(),newTab:w.floatingLinkSelectors.newTab()?M0.Checked:M0.Unchecked,url:u&&f===""?u:w.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=()=>{w.floatingLinkActions.hide()},m=u=>{!d()||!L||(w.floatingLinkActions.text(l.text),w.floatingLinkActions.url(l.url),w.floatingLinkActions.newTab(l.newTab===M0.Checked),w.submitFloatingLink(e)&&(u==null||u.preventDefault()))},L=l.url!==""&&l.text!=="",d=()=>{const{isUrl:u}=w.getPluginOptions(e,w.ELEMENT_LINK);return!l.url||u&&u(l.url)};return w.useHotkeys("enter",m,{enableOnFormTags:["INPUT"]},[]),{state:l,onTextChange:o,onUrlChange:i,onToggleTab:c,onCancel:s,onSave:m,hasValues:L,isValidUrlOrEmpty:d}},Wm0=()=>t.createElement(Um0,{...Gm0(),testId:"floating-link-insert"}),qm0=({readOnly:e})=>{const l=w.useFloatingLinkSelectors().isEditing();if(e)return null;const a=t.createElement(Wm0,null),o=l?a:t.createElement(Dm0,null);return t.createElement(t.Fragment,null,t.createElement(f5.InsertRoot,null,a),t.createElement(f5.EditRoot,null,o))},Km0=({id:e,editorId:l})=>{const a=w.usePlateEditorState(w.useEventPlateId(l)),o=!!w.isRangeInSameBlock(a,{at:a.selection}),i=I0(o);return t.createElement(Z0,{id:e},t.createElement(w.LinkToolbarButton,{tooltip:V0(o?`Link
|
|
38
|
-
${i2("Ctrl+K")}`:"Links can only be set for a single text block."),icon:t.createElement(y0,{icon:t.createElement(ne,null)}),classNames:i,styles:x0,actionHandler:"onMouseDown"}))},$m0=e=>({...w.useElementProps({...e,elementToAttributes:a=>({href:fV(a),target:a.target||"_blank"})}),onMouseOver:a=>{a.stopPropagation()}}),Xm0=e=>{const l=$m0(e),{attributes:a,children:o}=e,{styles:i}=C1();return t.createElement("a",{...a,href:l.href,target:l.target,style:i[F1]},o)};class Jm0 extends l0{constructor(l=w.ELEMENT_LINK,a=Xm0){super(l,a)}}const vV=w.createPluginFactory({...w.createLinkPlugin(),renderAfterEditable:qm0,options:{isUrl:Vm0,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class gV extends n0{constructor({styles:a=p0[F1],...o}={}){super(F1,{button:Km0,markupElement:new Jm0,...o});W(this,"styles",{});this.styles=a}plugins(){return[vV()]}}const D3="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",AV=`${D3} tw-break-after-column tw-break-inside-avoid-column`,O0=e=>{const l=e.breakAfterColumn;return A([l==="active"&&AV,l==="inactive"&&D3])},F3=e=>A([O0(e),e.align?z3[e.align]:"tw-justify-start","tw-grid tw-grid-cols-[min-content_repeat(3,_auto)]"]),CV=({attributes:e,children:l,element:a})=>t.createElement("p",{className:F3(a),...e},t.createElement("span",{className:"tw-w-auto tw-min-w-[10px]"},l));class EV extends l0{constructor(l=w.ELEMENT_LIC,a=CV){super(l,a)}}const MV="text-style-plugin",v5="list-plugin",_m0=(e,{options:{validLiChildrenTypes:l,isSoftBreak:a}})=>{const{insertBreak:o,deleteBackward:i,deleteForward:c,deleteFragment:s}=e;return a?e.insertSoftBreak=()=>{w.insertBreakList(e)||o()}:e.insertBreak=()=>{w.insertBreakList(e)||o()},e.deleteBackward=m=>{w.deleteBackwardList(e,m)||i(m)},e.deleteForward=m=>{w.deleteForwardList(e)||c(m)},e.deleteFragment=m=>{w.deleteFragmentList(e)||s(m)},e.insertFragment=w.insertFragmentList(e),e.normalizeNode=w.normalizeList(e,{validLiChildrenTypes:l}),e},c2="textStyle",IV=w.createPluginFactory({key:c2,isLeaf:!0});class B3 extends n0{constructor(a){super(v5,{leafMarkupElements:[new EV,new VV],...a});W(this,"isSoftBreak");this.isSoftBreak=(a==null?void 0:a.isSoftBreak)??!1}plugins(){return[w.createListPlugin({withOverrides:_m0,options:{isSoftBreak:this.isSoftBreak}}),IV()]}}const Rm0=e=>w.getAboveNode(e,{match:{type:w.ELEMENT_LI},mode:"lowest"})||w.someNode(e,{match:{type:J0},mode:"lowest"}),eL0=({editor:e,type:l,children:a})=>{const o=e!=null&&e.selection?w.getMark(e,c2)===l.id:w.someNode(e,{match:{type:l}});return t.createElement("button",{"data-test-id":"textstyle-option",type:"button",className:A(["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=>{i.preventDefault(),i.stopPropagation(),!(!e||!e.selection)&&(w.setMarks(e,{[c2]:l.id}),Rm0(e)||w.toggleNodeType(e,{activeType:l.id,inactiveType:l.id}))}},a)},tL0=({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:i=>{i.preventDefault(),i.stopPropagation(),a()}},t.createElement("div",{className:A(["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:A(["tw-transition-transform",l&&"tw-rotate-180"])},t.createElement($5,null)))),lL0=t.forwardRef(tL0),nL0=e=>Array.isArray(e.children)?(e.children.find(a=>w.isText(a))??{})[c2]:w.ELEMENT_PARAGRAPH,rL0=[w.ELEMENT_LI,w.ELEMENT_UL,w.ELEMENT_OL],aL0=e=>!e||!e.selection?[]:Array.from(w.getNodeEntries(e,{unhang:!0,at:e.selection,reverse:!0})).reduce((a,[o])=>{if(!w.isNode(o))return a;const i=o.type===w.ELEMENT_LIC||o.type===J0?nL0(o):o.textStyle;return i&&!a.includes(i)&&!rL0.includes(i)&&a.push(i),a},[]),oL0=6,iL0=10,cL0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:a,maxHeight:o}=r3(e.elements.reference,e.rects.popper.height,oL0+iL0,0);a==="top"&&(e.placement="top-start"),e.styles.popper={maxHeight:`${o}px`},e.reset=!0,e.modifiersData[l]._skip=!0},enabled:!0},g5="Mixed";var j=(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.p="p",e))(j||{});const sL0=e=>{const[l,a]=t.useState(!1),[o,i]=t.useState(null),[c,s]=t.useState(null),m=w.usePlateEditorState(e),L=aL0(m);let d=g5;L.length===1?d=L[0]:L.length===0&&(d="p");const u=t.useCallback(()=>{a(h=>!h)},[a]),f=N1.usePopper(o,c,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"flip",enabled:!1},cL0]});return t.useEffect(()=>{const h=g=>{if(l){const v=g.target;if(c&&c.contains(v)||o&&o.contains(v))return;a(!1)}};return document.addEventListener("pointerdown",h),()=>{document.removeEventListener("pointerdown",h)}},[l,c,a,o]),{state:{isOpen:l,toggle:u,editor:m},dropdownProps:{...f.attributes.popper,style:f.styles.popper},key:d,dropdownRef:s,triggerRef:i}},mL0=({editorId:e,textStyles:l=[]})=>{var f;const{state:{editor:a,toggle:o,isOpen:i},dropdownProps:c,triggerRef:s,dropdownRef:m,key:L}=sL0(e);let d=g5;const u=l.find(h=>{var g;return h.id===L&&((g=h.props)==null?void 0:g.label)});return u&&(d=((f=u.props)==null?void 0:f.label)||g5),t.createElement(t.Fragment,null,t.createElement(lL0,{label:d,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 g;return t.createElement(eL0,{editor:a,type:h,key:h.id},t.createElement("span",{style:h.styles??{}},(g=h.props)==null?void 0:g.label))})))},LL0=({editorId:e,id:l,textStyles:a})=>t.createElement(Z0,{id:l},t.createElement(mL0,{editorId:e,textStyles:a})),dL0=(e,l)=>a=>t.createElement(e,{...a,textStyles:l}),uL0="textstyle-custom1-plugin";class wL0 extends n0{constructor({styles:a=p0.custom1,...o}={}){super(j.custom1,{label:"Custom 1",markupElement:new hL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[fL0(this.styles)]}}class hL0 extends l0{constructor(l=uL0,a=ZV){super(l,a)}}const ZV=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("p",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},fL0=e=>w.createPluginFactory({key:j.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:j.custom1}]}})({component:l=>t.createElement(ZV,{...l,styles:e})}),vL0="textstyle-custom2-plugin";class gL0 extends n0{constructor({styles:a=p0.custom2,...o}={}){super(j.custom2,{label:"Custom 2",markupElement:new AL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[CL0(this.styles)]}}class AL0 extends l0{constructor(l=vL0,a=NV){super(l,a)}}const NV=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("p",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},CL0=e=>w.createPluginFactory({key:j.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:j.custom2}]}})({component:l=>t.createElement(NV,{...l,styles:e})}),EL0="textstyle-custom3-plugin";class ML0 extends n0{constructor({styles:a=p0.custom3,...o}={}){super(j.custom3,{label:"Custom 3",markupElement:new IL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[ZL0(this.styles)]}}class IL0 extends l0{constructor(l=EL0,a=SV){super(l,a)}}const SV=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("p",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},ZL0=e=>w.createPluginFactory({key:j.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:j.custom3}]}})({component:l=>t.createElement(SV,{...l,styles:e})}),NL0="textstyle-heading1-plugin";class SL0 extends n0{constructor({styles:a=p0.heading1,...o}={}){super(j.heading1,{label:"Heading 1",markupElement:new yL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[xL0(this.styles)]}}class yL0 extends l0{constructor(l=NL0,a=O3){super(l,a)}}const O3=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("h1",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},xL0=e=>w.createPluginFactory({key:j.heading1,isElement:!0,component:O3,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:l=>t.createElement(O3,{...l,styles:e})}),HL0="textstyle-heading2-plugin";class bL0 extends n0{constructor({styles:a=p0.heading2,...o}={}){super(j.heading2,{label:"Heading 2",markupElement:new kL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[zL0(this.styles)]}}class kL0 extends l0{constructor(l=HL0,a=P3){super(l,a)}}const P3=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("h2",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},zL0=e=>w.createPluginFactory({key:j.heading2,isElement:!0,component:P3,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:l=>t.createElement(P3,{...l,styles:e})}),pL0="textstyle-heading3-plugin";class VL0 extends n0{constructor({styles:a=p0.heading3,...o}={}){super(j.heading3,{label:"Heading 3",markupElement:new TL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[jL0(this.styles)]}}class TL0 extends l0{constructor(l=pL0,a=U3){super(l,a)}}const U3=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("h3",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},jL0=e=>w.createPluginFactory({key:j.heading3,isElement:!0,component:U3,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:l=>t.createElement(U3,{...l,styles:e})}),DL0="textstyle-heading4-plugin";class FL0 extends n0{constructor({styles:a=p0.heading4,...o}={}){super(j.heading4,{label:"Heading 4",markupElement:new BL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[OL0(this.styles)]}}class BL0 extends l0{constructor(l=DL0,a=Q3){super(l,a)}}const Q3=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("h4",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},OL0=e=>w.createPluginFactory({key:j.heading4,isElement:!0,component:Q3,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:l=>t.createElement(Q3,{...l,styles:e})}),PL0="textstyle-imageCaption-plugin";class UL0 extends n0{constructor({styles:a=p0.imageCaption,...o}={}){super(j.imageCaption,{label:"Image Caption",markupElement:new QL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[YL0(this.styles)]}}class QL0 extends l0{constructor(l=PL0,a=Y3){super(l,a)}}const Y3=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("p",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},YL0=e=>w.createPluginFactory({key:j.imageCaption,isElement:!0,component:Y3,deserializeHtml:{rules:[{validClassName:j.imageCaption}]}})({component:l=>t.createElement(Y3,{...l,styles:e})}),GL0="textstyle-imageTitle-plugin";class WL0 extends n0{constructor({styles:a=p0.imageTitle,...o}={}){super(j.imageTitle,{label:"Image Title",markupElement:new qL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[KL0(this.styles)]}}class qL0 extends l0{constructor(l=GL0,a=G3){super(l,a)}}const G3=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("p",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},KL0=e=>w.createPluginFactory({key:j.imageTitle,isElement:!0,component:G3,deserializeHtml:{rules:[{validClassName:j.imageTitle}]}})({component:l=>t.createElement(G3,{...l,styles:e})});class yV extends n0{constructor({styles:a=p0.p,...o}={}){super(j.p,{markupElement:new HV,label:"Body Text",...o});W(this,"styles",{});this.styles=a}plugins(){return[bV(this.styles)]}}const xV="tw-m-0 tw-px-0 tw-py-0",A5=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align,c=A([i&&B0[i],xV,O0(e)]);return t.createElement("p",{...l,className:c,style:o},a)};class HV extends l0{constructor(l=j.p,a=A5){super(l,a)}}const bV=e=>w.createPluginFactory({...w.createParagraphPlugin(),key:j.p,isElement:!0,component:A5})({component:l=>t.createElement(A5,{...l,styles:e})}),$L0="textstyle-quote-plugin";class XL0 extends n0{constructor({styles:a=p0.quote,...o}={}){super(j.quote,{label:"Quote",markupElement:new JL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[kV(this.styles)]}}class JL0 extends l0{constructor(l=$L0,a=C5){super(l,a)}}const C5=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("blockquote",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},kV=e=>w.createPluginFactory({key:j.quote,isElement:!0,component:C5,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:l=>t.createElement(C5,{...l,styles:e})});class zV extends n0{constructor({...a}){super(MV,{button:dL0(LL0,a.textStyles),...a});W(this,"textStyles");this.textStyles=a.textStyles}plugins(){return this.textStyles.map(a=>a.plugins()).flat()}}const W3="[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline",pV=({attributes:e,children:l,element:a})=>{const{styles:o}=C1();return t.createElement("li",{style:q3(a,o),...e,className:W3},l)};class VV extends l0{constructor(l=w.ELEMENT_LI,a=pV){super(l,a)}}const q3=(e,l)=>({...l[TV(e)??j.p],counterIncrement:"count"}),TV=e=>{let l;if(e.type==="a")l=e.children[0].textStyle;else if(e.children)for(const a of e.children){const o=TV(a);o&&(!l||o.startsWith(l))&&(l=o)}else l=e.textStyle;return l},_L0=["[&>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)_'._']"],RL0=(e,l)=>{const a=w.findNodePath(e,l);if(!a)return 0;const o=w.getNodeAncestors(e,a);return Array.from(o).filter(i=>i[0].type===w.ELEMENT_LI).length},K3=e=>`tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] [&>li>p]:before:tw-pr-1 [&>li>p]:before:tw-tabular-nums ${_L0[e%3]}`,$3={counterReset:"count"},jV=({attributes:e,children:l,element:a})=>{const o=w.usePlateEditorRef(),i=RL0(o,a);return t.createElement("ol",{className:K3(i),...e,style:$3},l)};class DV extends l0{constructor(l=w.ELEMENT_OL,a=jV){super(l,a)}}const FV=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(w.ListToolbarButton,{tooltip:V0("Ordered list"),type:w.getPluginType(e,l),icon:t.createElement(y0,{icon:t.createElement(oe,null)}),classNames:I0(),styles:x0,actionHandler:"onMouseDown"}));class BV extends B3{constructor(l){super({id:v5,button:FV,markupElement:new DV,...l})}}const X3="[&>li>p]:before:tw-content-['•'] [&>li>p]:before:tw-px-2 tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",OV=({attributes:e,children:l})=>t.createElement("ul",{className:X3,...e},l);class PV extends l0{constructor(l=w.ELEMENT_UL,a=OV){super(l,a)}}const UV=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(w.ListToolbarButton,{tooltip:V0("Bullet list"),type:w.getPluginType(e,l),icon:t.createElement(y0,{icon:t.createElement(re,null)}),classNames:I0(),styles:x0,actionHandler:"onMouseDown"}));class QV extends B3{constructor(l){super({id:v5,button:UV,markupElement:new PV,...l})}}class ed0{constructor(){W(this,"toolbarButtons",{[h0.BOTTOM]:[],[h0.FLOATING]:[],[h0.TOP]:[]})}createGroupOfButtons(l){const a=[],o=[],i=[];for(const{markupElement:c,button:s,id:m,showIn:L}of l){if(!s)continue;const d={id:(c==null?void 0:c.getId())||m,button:s};L.includes(h0.BOTTOM)&&a.push(d),L.includes(h0.TOP)&&o.push(d),L.includes(h0.FLOATING)&&i.push(d)}a.length>0&&this.toolbarButtons[h0.BOTTOM].push(a),o.length>0&&this.toolbarButtons[h0.TOP].push(o),i.length>0&&this.toolbarButtons[h0.FLOATING].push(i)}at(l){return this.toolbarButtons[l]}}class YV{constructor(l){W(this,"platePlugins",new Map);W(this,"markupElements",{});W(this,"inlineElements",[]);W(this,"toolbarButtons",new ed0);W(this,"styles",{});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()),i.styles&&this.addStyles(i.styles,i.id),i.textStyles&&this.addTextStylesOfSubPlugins(i.textStyles);this.hasToolbar&&this.toolbarButtons.createGroupOfButtons(o)}return this}addTextStylesOfSubPlugins(l){for(const a of l)a.styles&&this.addStyles(a.styles,a.id)}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)}addStyles(l,a){this.styles[a]=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)}get getStyles(){return this.styles}}const GV="reset-formatting-plugin",WV="reset-formatting",td0=e=>{!e||!e.selection||(w.removeMark(e,{key:[w.MARK_BOLD,w.MARK_ITALIC,w.MARK_CODE,w.MARK_UNDERLINE,w.MARK_STRIKETHROUGH]}),w.unwrapList(e,{}),w.setElements(e,{type:w.ELEMENT_PARAGRAPH,align:void 0}))},ld0=w.withPlateProvider(({id:e,...l})=>{const a=w.usePlateEditorState(w.useEventPlateId(e));return t.createElement(w.ToolbarButton,{tooltip:V0("Clear formatting"),onMouseDown:()=>{td0(a)},...l})}),nd0=({id:e})=>t.createElement(Z0,{id:e},t.createElement(ld0,{icon:t.createElement(y0,{icon:t.createElement(ee,null)}),classNames:I0(),styles:x0})),qV=w.createPluginFactory({key:WV,isElement:!1});class KV extends n0{constructor(l){super(GV,{button:nd0,...l})}plugins(){return[qV()]}}const rd0="strikethrough-plugin",J3="!tw-line-through",$V=({attributes:e,children:l})=>t.createElement("span",{...e,className:J3},l);class XV extends l0{constructor(l=w.MARK_STRIKETHROUGH,a=$V){super(l,a)}}const ad0=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(w.MarkToolbarButton,{tooltip:V0("Strikethrough"),type:w.getPluginType(e,l),icon:t.createElement(y0,{icon:t.createElement(UH,null)}),classNames:I0(),styles:x0,actionHandler:"onMouseDown"}));class JV extends n0{constructor(l){super(rd0,{button:ad0,markupElement:new XV,...l})}plugins(){return[w.createStrikethroughPlugin()]}}const od0="underline-plugin",E5="tw-underline",_V=({attributes:e,children:l})=>t.createElement("span",{...e,className:E5},l);class RV extends l0{constructor(l=w.MARK_UNDERLINE,a=_V){super(l,a)}}const id0=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(w.MarkToolbarButton,{tooltip:V0(`Underline
|
|
38
|
+
${i2("Ctrl+K")}`:"Links can only be set for a single text block."),icon:t.createElement(y0,{icon:t.createElement(ne,null)}),classNames:i,styles:x0,actionHandler:"onMouseDown"}))},$m0=e=>({...w.useElementProps({...e,elementToAttributes:a=>({href:fV(a),target:a.target||"_blank"})}),onMouseOver:a=>{a.stopPropagation()}}),Xm0=e=>{const l=$m0(e),{attributes:a,children:o}=e,{styles:i}=C1();return t.createElement("a",{...a,href:l.href,target:l.target,style:i[F1]},o)};class Jm0 extends l0{constructor(l=w.ELEMENT_LINK,a=Xm0){super(l,a)}}const vV=w.createPluginFactory({...w.createLinkPlugin(),renderAfterEditable:qm0,options:{isUrl:Vm0,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class gV extends n0{constructor({styles:a=p0[F1],...o}={}){super(F1,{button:Km0,markupElement:new Jm0,...o});W(this,"styles",{});this.styles=a}plugins(){return[vV()]}}const D3="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",AV=`${D3} tw-break-after-column tw-break-inside-avoid-column`,O0=e=>{const l=e.breakAfterColumn;return A([l==="active"&&AV,l==="inactive"&&D3])},F3=e=>A([O0(e),e.align?z3[e.align]:"tw-justify-start","tw-grid tw-grid-cols-[min-content_repeat(3,_auto)]"]),CV=({attributes:e,children:l,element:a})=>t.createElement("p",{className:F3(a),...e},t.createElement("span",{className:"tw-w-auto tw-min-w-[10px]"},l));class EV extends l0{constructor(l=w.ELEMENT_LIC,a=CV){super(l,a)}}const MV="text-style-plugin",v5="list-plugin",_m0=(e,{options:{validLiChildrenTypes:l,isSoftBreak:a}})=>{const{insertBreak:o,deleteBackward:i,deleteForward:c,deleteFragment:s}=e;return a?e.insertSoftBreak=()=>{w.insertBreakList(e)||o()}:e.insertBreak=()=>{w.insertBreakList(e)||o()},e.deleteBackward=m=>{w.deleteBackwardList(e,m)||i(m)},e.deleteForward=m=>{w.deleteForwardList(e)||c(m)},e.deleteFragment=m=>{w.deleteFragmentList(e)||s(m)},e.insertFragment=w.insertFragmentList(e),e.normalizeNode=w.normalizeList(e,{validLiChildrenTypes:l}),e},c2="textStyle",IV=w.createPluginFactory({key:c2,isLeaf:!0});class B3 extends n0{constructor(a){super(v5,{leafMarkupElements:[new EV,new VV],...a});W(this,"isSoftBreak");this.isSoftBreak=(a==null?void 0:a.isSoftBreak)??!1}plugins(){return[w.createListPlugin({withOverrides:_m0,options:{isSoftBreak:this.isSoftBreak}}),IV()]}}const Rm0=e=>w.getAboveNode(e,{match:{type:w.ELEMENT_LI},mode:"lowest"})||w.someNode(e,{match:{type:J0},mode:"lowest"}),eL0=({editor:e,type:l,children:a})=>{const o=e!=null&&e.selection?w.getMark(e,c2)===l.id:w.someNode(e,{match:{type:l}});return t.createElement("button",{"data-test-id":"textstyle-option",type:"button",className:A(["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=>{i.preventDefault(),i.stopPropagation(),!(!e||!e.selection)&&(w.setMarks(e,{[c2]:l.id}),Rm0(e)||w.toggleNodeType(e,{activeType:l.id,inactiveType:l.id}))}},a)},tL0=({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:i=>{i.preventDefault(),i.stopPropagation(),a()}},t.createElement("div",{className:A(["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:A(["tw-transition-transform",l&&"tw-rotate-180"])},t.createElement($5,null)))),lL0=t.forwardRef(tL0),nL0=e=>Array.isArray(e.children)?(e.children.find(a=>w.isText(a))??{})[c2]:w.ELEMENT_PARAGRAPH,rL0=[w.ELEMENT_LI,w.ELEMENT_UL,w.ELEMENT_OL],aL0=e=>!e||!e.selection?[]:Array.from(w.getNodeEntries(e,{unhang:!0,at:e.selection,reverse:!0})).reduce((a,[o])=>{if(!w.isNode(o))return a;const i=o.type===w.ELEMENT_LIC||o.type===J0?nL0(o):o.textStyle;return i&&!a.includes(i)&&!rL0.includes(i)&&a.push(i),a},[]),oL0=6,iL0=10,cL0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:a,maxHeight:o}=r3(e.elements.reference,e.rects.popper.height,oL0+iL0,0);a==="top"&&(e.placement="top-start"),e.styles.popper={maxHeight:`${o}px`},e.reset=!0,e.modifiersData[l]._skip=!0},enabled:!0},g5="Mixed";var j=(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.p="p",e))(j||{});const sL0=e=>{const[l,a]=t.useState(!1),[o,i]=t.useState(null),[c,s]=t.useState(null),m=w.usePlateEditorState(e),L=aL0(m);let d=g5;L.length===1?d=L[0]:L.length===0&&(d="p");const u=t.useCallback(()=>{a(h=>!h)},[a]),f=N1.usePopper(o,c,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"flip",enabled:!1},cL0]});return t.useEffect(()=>{const h=g=>{if(l){const v=g.target;if(c&&c.contains(v)||o&&o.contains(v))return;a(!1)}};return document.addEventListener("pointerdown",h),()=>{document.removeEventListener("pointerdown",h)}},[l,c,a,o]),{state:{isOpen:l,toggle:u,editor:m},dropdownProps:{...f.attributes.popper,style:f.styles.popper},key:d,dropdownRef:s,triggerRef:i}},mL0=({editorId:e,textStyles:l=[]})=>{var f;const{state:{editor:a,toggle:o,isOpen:i},dropdownProps:c,triggerRef:s,dropdownRef:m,key:L}=sL0(e);let d=g5;const u=l.find(h=>{var g;return h.id===L&&((g=h.props)==null?void 0:g.label)});return u&&(d=((f=u.props)==null?void 0:f.label)||g5),t.createElement(t.Fragment,null,t.createElement(lL0,{label:d,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 g;return t.createElement(eL0,{editor:a,type:h,key:h.id},t.createElement("span",{style:h.styles??{}},(g=h.props)==null?void 0:g.label))})))},LL0=({editorId:e,id:l,textStyles:a})=>t.createElement(Z0,{id:l},t.createElement(mL0,{editorId:e,textStyles:a})),dL0=(e,l)=>a=>t.createElement(e,{...a,textStyles:l}),uL0="textstyle-custom1-plugin";class wL0 extends n0{constructor({styles:a=p0.custom1,...o}={}){super(j.custom1,{label:"Custom 1",markupElement:new hL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[fL0(this.styles)]}}class hL0 extends l0{constructor(l=uL0,a=ZV){super(l,a)}}const ZV=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("p",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},fL0=e=>w.createPluginFactory({key:j.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:j.custom1}]}})({component:l=>t.createElement(ZV,{...l,styles:e})}),vL0="textstyle-custom2-plugin";class gL0 extends n0{constructor({styles:a=p0.custom2,...o}={}){super(j.custom2,{label:"Custom 2",markupElement:new AL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[CL0(this.styles)]}}class AL0 extends l0{constructor(l=vL0,a=NV){super(l,a)}}const NV=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("p",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},CL0=e=>w.createPluginFactory({key:j.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:j.custom2}]}})({component:l=>t.createElement(NV,{...l,styles:e})}),EL0="textstyle-custom3-plugin";class ML0 extends n0{constructor({styles:a=p0.custom3,...o}={}){super(j.custom3,{label:"Custom 3",markupElement:new IL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[ZL0(this.styles)]}}class IL0 extends l0{constructor(l=EL0,a=SV){super(l,a)}}const SV=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("p",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},ZL0=e=>w.createPluginFactory({key:j.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:j.custom3}]}})({component:l=>t.createElement(SV,{...l,styles:e})}),NL0="textstyle-heading1-plugin";class SL0 extends n0{constructor({styles:a=p0.heading1,...o}={}){super(j.heading1,{label:"Heading 1",markupElement:new yL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[xL0(this.styles)]}}class yL0 extends l0{constructor(l=NL0,a=O3){super(l,a)}}const O3=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("h1",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},xL0=e=>w.createPluginFactory({key:j.heading1,isElement:!0,component:O3,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:l=>t.createElement(O3,{...l,styles:e})}),HL0="textstyle-heading2-plugin";class bL0 extends n0{constructor({styles:a=p0.heading2,...o}={}){super(j.heading2,{label:"Heading 2",markupElement:new kL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[zL0(this.styles)]}}class kL0 extends l0{constructor(l=HL0,a=P3){super(l,a)}}const P3=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("h2",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},zL0=e=>w.createPluginFactory({key:j.heading2,isElement:!0,component:P3,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:l=>t.createElement(P3,{...l,styles:e})}),pL0="textstyle-heading3-plugin";class VL0 extends n0{constructor({styles:a=p0.heading3,...o}={}){super(j.heading3,{label:"Heading 3",markupElement:new TL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[jL0(this.styles)]}}class TL0 extends l0{constructor(l=pL0,a=U3){super(l,a)}}const U3=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("h3",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},jL0=e=>w.createPluginFactory({key:j.heading3,isElement:!0,component:U3,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:l=>t.createElement(U3,{...l,styles:e})}),DL0="textstyle-heading4-plugin";class FL0 extends n0{constructor({styles:a=p0.heading4,...o}={}){super(j.heading4,{label:"Heading 4",markupElement:new BL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[OL0(this.styles)]}}class BL0 extends l0{constructor(l=DL0,a=Q3){super(l,a)}}const Q3=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("h4",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},OL0=e=>w.createPluginFactory({key:j.heading4,isElement:!0,component:Q3,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:l=>t.createElement(Q3,{...l,styles:e})}),PL0="textstyle-imageCaption-plugin";class UL0 extends n0{constructor({styles:a=p0.imageCaption,...o}={}){super(j.imageCaption,{label:"Image Caption",markupElement:new QL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[YL0(this.styles)]}}class QL0 extends l0{constructor(l=PL0,a=Y3){super(l,a)}}const Y3=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("p",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},YL0=e=>w.createPluginFactory({key:j.imageCaption,isElement:!0,component:Y3,deserializeHtml:{rules:[{validClassName:j.imageCaption}]}})({component:l=>t.createElement(Y3,{...l,styles:e})}),GL0="textstyle-imageTitle-plugin";class WL0 extends n0{constructor({styles:a=p0.imageTitle,...o}={}){super(j.imageTitle,{label:"Image Title",markupElement:new qL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[KL0(this.styles)]}}class qL0 extends l0{constructor(l=GL0,a=G3){super(l,a)}}const G3=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("p",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},KL0=e=>w.createPluginFactory({key:j.imageTitle,isElement:!0,component:G3,deserializeHtml:{rules:[{validClassName:j.imageTitle}]}})({component:l=>t.createElement(G3,{...l,styles:e})});class yV extends n0{constructor({styles:a=p0.p,...o}={}){super(j.p,{markupElement:new HV,label:"Body Text",...o});W(this,"styles",{});this.styles=a}plugins(){return[bV(this.styles)]}}const xV="tw-m-0 tw-px-0 tw-py-0",A5=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align,c=A([i&&B0[i],xV,O0(e)]);return t.createElement("p",{...l,className:c,style:o},a)};class HV extends l0{constructor(l=j.p,a=A5){super(l,a)}}const bV=e=>w.createPluginFactory({...w.createParagraphPlugin(),key:j.p,isElement:!0,component:A5})({component:l=>t.createElement(A5,{...l,styles:e})}),$L0="textstyle-quote-plugin";class XL0 extends n0{constructor({styles:a=p0.quote,...o}={}){super(j.quote,{label:"Quote",markupElement:new JL0,...o});W(this,"styles",{});this.styles=a}plugins(){return[kV(this.styles)]}}class JL0 extends l0{constructor(l=$L0,a=C5){super(l,a)}}const C5=({element:e,attributes:l,children:a,styles:o})=>{const i=e.align;return t.createElement("blockquote",{...l,className:A([i&&B0[i],O0(e)]),style:o},a)},kV=e=>w.createPluginFactory({key:j.quote,isElement:!0,component:C5,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:l=>t.createElement(C5,{...l,styles:e})});class zV extends n0{constructor({...a}){super(MV,{button:dL0(LL0,a.textStyles),...a});W(this,"textStyles");this.textStyles=a.textStyles}plugins(){return this.textStyles.map(a=>a.plugins()).flat()}}const W3="[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline !tw-list-item",pV=({attributes:e,children:l,element:a})=>{const{styles:o}=C1();return t.createElement("li",{style:q3(a,o),...e,className:W3},l)};class VV extends l0{constructor(l=w.ELEMENT_LI,a=pV){super(l,a)}}const q3=(e,l)=>({...l[TV(e)??j.p],counterIncrement:"count"}),TV=e=>{let l;if(e.type==="a")l=e.children[0].textStyle;else if(e.children)for(const a of e.children){const o=TV(a);o&&(!l||o.startsWith(l))&&(l=o)}else l=e.textStyle;return l},_L0=["[&>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)_'._']"],RL0=(e,l)=>{const a=w.findNodePath(e,l);if(!a)return 0;const o=w.getNodeAncestors(e,a);return Array.from(o).filter(i=>i[0].type===w.ELEMENT_LI).length},K3=e=>`tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] [&>li>p]:before:tw-pr-1 [&>li>p]:before:tw-tabular-nums ${_L0[e%3]}`,$3={counterReset:"count"},jV=({attributes:e,children:l,element:a})=>{const o=w.usePlateEditorRef(),i=RL0(o,a);return t.createElement("ol",{className:K3(i),...e,style:$3},l)};class DV extends l0{constructor(l=w.ELEMENT_OL,a=jV){super(l,a)}}const FV=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(w.ListToolbarButton,{tooltip:V0("Ordered list"),type:w.getPluginType(e,l),icon:t.createElement(y0,{icon:t.createElement(oe,null)}),classNames:I0(),styles:x0,actionHandler:"onMouseDown"}));class BV extends B3{constructor(l){super({id:v5,button:FV,markupElement:new DV,...l})}}const X3="[&>li>p]:before:tw-content-['•'] [&>li>p]:before:tw-px-2 tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",OV=({attributes:e,children:l})=>t.createElement("ul",{className:X3,...e},l);class PV extends l0{constructor(l=w.ELEMENT_UL,a=OV){super(l,a)}}const UV=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(w.ListToolbarButton,{tooltip:V0("Bullet list"),type:w.getPluginType(e,l),icon:t.createElement(y0,{icon:t.createElement(re,null)}),classNames:I0(),styles:x0,actionHandler:"onMouseDown"}));class QV extends B3{constructor(l){super({id:v5,button:UV,markupElement:new PV,...l})}}class ed0{constructor(){W(this,"toolbarButtons",{[h0.BOTTOM]:[],[h0.FLOATING]:[],[h0.TOP]:[]})}createGroupOfButtons(l){const a=[],o=[],i=[];for(const{markupElement:c,button:s,id:m,showIn:L}of l){if(!s)continue;const d={id:(c==null?void 0:c.getId())||m,button:s};L.includes(h0.BOTTOM)&&a.push(d),L.includes(h0.TOP)&&o.push(d),L.includes(h0.FLOATING)&&i.push(d)}a.length>0&&this.toolbarButtons[h0.BOTTOM].push(a),o.length>0&&this.toolbarButtons[h0.TOP].push(o),i.length>0&&this.toolbarButtons[h0.FLOATING].push(i)}at(l){return this.toolbarButtons[l]}}class YV{constructor(l){W(this,"platePlugins",new Map);W(this,"markupElements",{});W(this,"inlineElements",[]);W(this,"toolbarButtons",new ed0);W(this,"styles",{});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()),i.styles&&this.addStyles(i.styles,i.id),i.textStyles&&this.addTextStylesOfSubPlugins(i.textStyles);this.hasToolbar&&this.toolbarButtons.createGroupOfButtons(o)}return this}addTextStylesOfSubPlugins(l){for(const a of l)a.styles&&this.addStyles(a.styles,a.id)}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)}addStyles(l,a){this.styles[a]=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)}get getStyles(){return this.styles}}const GV="reset-formatting-plugin",WV="reset-formatting",td0=e=>{!e||!e.selection||(w.removeMark(e,{key:[w.MARK_BOLD,w.MARK_ITALIC,w.MARK_CODE,w.MARK_UNDERLINE,w.MARK_STRIKETHROUGH]}),w.unwrapList(e,{}),w.setElements(e,{type:w.ELEMENT_PARAGRAPH,align:void 0}))},ld0=w.withPlateProvider(({id:e,...l})=>{const a=w.usePlateEditorState(w.useEventPlateId(e));return t.createElement(w.ToolbarButton,{tooltip:V0("Clear formatting"),onMouseDown:()=>{td0(a)},...l})}),nd0=({id:e})=>t.createElement(Z0,{id:e},t.createElement(ld0,{icon:t.createElement(y0,{icon:t.createElement(ee,null)}),classNames:I0(),styles:x0})),qV=w.createPluginFactory({key:WV,isElement:!1});class KV extends n0{constructor(l){super(GV,{button:nd0,...l})}plugins(){return[qV()]}}const rd0="strikethrough-plugin",J3="!tw-line-through",$V=({attributes:e,children:l})=>t.createElement("span",{...e,className:J3},l);class XV extends l0{constructor(l=w.MARK_STRIKETHROUGH,a=$V){super(l,a)}}const ad0=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(w.MarkToolbarButton,{tooltip:V0("Strikethrough"),type:w.getPluginType(e,l),icon:t.createElement(y0,{icon:t.createElement(UH,null)}),classNames:I0(),styles:x0,actionHandler:"onMouseDown"}));class JV extends n0{constructor(l){super(rd0,{button:ad0,markupElement:new XV,...l})}plugins(){return[w.createStrikethroughPlugin()]}}const od0="underline-plugin",E5="tw-underline",_V=({attributes:e,children:l})=>t.createElement("span",{...e,className:E5},l);class RV extends l0{constructor(l=w.MARK_UNDERLINE,a=_V){super(l,a)}}const id0=({editor:e,id:l})=>t.createElement(Z0,{id:l},t.createElement(w.MarkToolbarButton,{tooltip:V0(`Underline
|
|
39
39
|
${i2("Ctrl+U")}`),type:w.getPluginType(e,l),icon:t.createElement(y0,{icon:t.createElement(Ee,null)}),classNames:I0(),styles:x0,actionHandler:"onMouseDown"})),cd0=[{validNodeName:["U"]},{validStyle:{textDecoration:["underline"]}}];class eT extends n0{constructor(l){super(od0,{button:id0,markupElement:new RV,...l})}plugins(){return[w.createUnderlinePlugin({deserializeHtml:{rules:[...cd0,{validNodeName:["SPAN"],validClassName:E5}]},options:{hotkey:["mod+u","ctrl+u"]}})]}}const tT=e=>Array.from(w.getNodeEntries(e,{at:[],match:l=>!!l.breakAfterColumn})).length,s2=(e,{key:l=B1,value:a,at:o})=>{const i=c=>w.isBlock(e,c);a?w.setElements(e,{[l]:a},{mode:"lowest",match:i,at:o}):w.unsetNodes(e,l,{match:i,mode:"lowest",at:o})},sd0=(e,l,a)=>{s2(e,{at:l,value:a})},_3=(e,l)=>{const a=Array.from(w.getNodeEntries(e,{at:[],match:o=>!!o.breakAfterColumn}));for(const[o,[,i]]of a.entries())sd0(e,i,o<l-1?"active":"inactive")},lT=(e,l,a)=>{if(a.preventDefault(),a.stopPropagation(),!!(e!=null&&e.selection)&&w.someNode(e,{match:i=>!!i.breakAfterColumn}))s2(e,{value:void 0});else{const i=tT(e),c=Math.max(l-i-1,0);if(c===0)return;const s=Array.from(w.getNodeEntries(e,{at:e.selection,match:m=>w.isBlock(e,m),mode:"lowest"})).slice(-c);for(const m of s)s2(e,{value:"active",at:m[1]})}_3(e,l)},md0=(e,{options:{hotkey:l}})=>a=>{var o;if(!a.defaultPrevented&&l&&ED(l,a)){const i=e.plugins.find(s=>s.key===B1),c=((o=i==null?void 0:i.options)==null?void 0:o.columns)??1;lT(e,c,a)}},Ld0=({id:e,...l})=>{var L,d;const a=w.usePlateEditorState(w.useEventPlateId(e)),o=!!(a!=null&&a.selection)&&w.someNode(a,{match:u=>!!u.breakAfterColumn}),i=(d=(L=a==null?void 0:a.pluginsByKey.breakAfterColumn)==null?void 0:L.options)==null?void 0:d.columns,c=Number(i)||1,s=dd0(a,c,o),m=I0(s);return t.createElement(w.ToolbarButton,{active:o,tooltip:V0(s?`Column Break
|
|
40
40
|
Shift+Ctrl+Return`:"Already at maximum numbers of columns"),onMouseDown:u=>lT(a,c,u),...l,classNames:m})},dd0=(e,l,a)=>tT(e)+1<l||a,nT=({id:e})=>t.createElement(Z0,{id:e},t.createElement(Ld0,{icon:t.createElement(y0,{icon:t.createElement(ge,null)}),classNames:I0(),styles:x0})),ud0=(e,l)=>{const a=w.getStartPoint(e,l);setTimeout(()=>{w.select(e,{anchor:a,focus:a})})},wd0=e=>{var a;const l=e.plugins.find(o=>o.key===B1);return((a=l==null?void 0:l.options)==null?void 0:a.columns)??1},hd0=e=>{const{apply:l}=e,a=wd0(e);e.apply=o=>{switch(o.type){case"split_node":o.properties={...o.properties,breakAfterColumn:void 0};break;case"merge_node":const i=w.getPointBefore(e,o.path);if(!i)break;const c=w.getParentNode(e,i.path);if(s2(e,{at:i,value:void 0}),_3(e,a),c!=null&&c[0].breakAfterColumn)return ud0(e,o.path),e;break}l(o)},setTimeout(()=>_3(e,a))},B1="breakAfterColumn",R3="normal";class fd0 extends n0{constructor(a){super("break-after-plugin",{button:nT,...a});W(this,"columns");W(this,"gap");this.columns=(a==null?void 0:a.columns)??1,this.gap=(a==null?void 0:a.gap)??R3}plugins(){return[rT(this.columns,this.gap)]}}const rT=(e,l)=>w.createPluginFactory({key:B1,handlers:{onKeyDown:md0},useHooks:hd0,options:{columns:e,gap:l,hotkey:["shift+ctrl+enter"]}})(),vd0=12,gd0=26,Ad0=124,Cd0=e=>e.map((l,a)=>({group:l,buttonGroupWidth:l.reduce((o,i)=>i.id===MV?Ad0:gd0+o,vd0),index:a})),Ed0=(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:d})=>L+d,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)},[]),Md0=({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),Id0=({toolbarButtons:e,editorId:l,toolbarWidth:a})=>{const o=w.usePlateEditorRef(l),{editorWidth:i}=$p(),{position:c}=C1(),s=a||i||0,m=Cd0(e.at(c)),L=Ed0(s,m),d=uT[c];return t.createElement(d.ToolbarWrapper,{editorWidth:i,toolbarWidth:a,toolbarButtonGroups:L},L.map((u,f)=>t.createElement("div",{className:"tw-divide-x tw-divide-line tw-flex tw-w-full tw-flex-wrap",key:f},u.map(({group:h,index:g})=>t.createElement(Md0,{index:g,key:g},h.map((v,E)=>t.createElement(v.button,{editor:o,editorId:l,id:v.id,key:E.toString()})))))))},aT=e=>w.createPlugins(e.plugins,{components:w.createPlateUI(e.elements)}),e7=(e,l)=>({create:()=>aT(l),toolbar:a=>l.hasToolbar?t.createElement(Id0,{toolbarButtons:l.buttons,editorId:e,toolbarWidth:a}):null,inline:()=>t.createElement(t.Fragment,null,l.inline.map((a,o)=>t.createElement(a,{key:o}))),styles:()=>l.getStyles}),Zd0="mention-plugin",Nd0=e=>l=>l.text.toLowerCase().includes(e.toLowerCase()),t7=(e,l)=>`${e}:${l}`,l7=e=>{const l=new Map;for(const a of e){const o=t7(a.data.category,a.data.id),i=a.text;l.set(o,i)}return l},oT=(e,l,a)=>e.get(l)??a;var _0=(e=>(e.GROUP="group",e.ALL="all",e.USER="user",e))(_0||{});const n7=({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),Sd0=({children:e,...l})=>t.createElement(n7,{...l},t.createElement("span",{style:{paddingRight:"3px",display:"inline-block",margin:"-1px 0"}},t.createElement(N2,null)),e),yd0=({children:e,...l})=>t.createElement(n7,{...l},"@",e),xd0=({children:e,...l})=>t.createElement(n7,{...l},e),Hd0=({category:e,children:l,...a})=>{const o={[_0.USER]:xd0,[_0.GROUP]:Sd0,[_0.ALL]:yd0},i=o[e]??o[_0.USER];return t.createElement(i,{...a},l)},r7=e=>l=>{const{element:a,children:o}=l,i=t7(a==null?void 0:a.category,String(a==null?void 0:a.id));return t.createElement(Hd0,{category:a==null?void 0:a.category,...l},oT(e,i,String(a==null?void 0:a.id)),o)};class iT extends l0{constructor(l=w.ELEMENT_MENTION){super(l)}setNodeWithMentionable(l){return this.node=r7(l7(l)),this}}const bd0=({image:e,category:l,text:a,id:o})=>{if(e)return t.createElement("img",{src:e,alt:`${o}-${l}-${a}`});switch(l){case _0.GROUP:return t.createElement(N2,null);case _0.ALL:return t.createElement(de,null);default:return t.createElement(se,null)}},kd0=({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(bd0,{image:l,category:a,text:i,id:o})),t.createElement("span",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis"},i))},cT=[`
|
|
41
41
|
color: var(--text-color-weak);
|