@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
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { PlateRenderElementProps, TElement } from '@udecode/plate';
|
|
2
2
|
import { CSSProperties } from 'react';
|
|
3
3
|
import { MarkupElement } from '../MarkupElement';
|
|
4
|
-
export declare const LI_CLASSNAMES = "[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline";
|
|
4
|
+
export declare const LI_CLASSNAMES = "[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline !tw-list-item";
|
|
5
5
|
export declare const ListItemMarkupElementNode: ({ attributes, children, element }: PlateRenderElementProps) => JSX.Element;
|
|
6
6
|
export declare class ListItemMarkupElement extends MarkupElement {
|
|
7
7
|
constructor(id?: string, node?: ({ attributes, children, element }: PlateRenderElementProps<import("@udecode/plate").Value, TElement>) => JSX.Element);
|
|
@@ -1,32 +1,32 @@
|
|
|
1
1
|
import { ELEMENT_LI as l } from "@udecode/plate";
|
|
2
2
|
import n from "react";
|
|
3
|
-
import { MarkupElement as
|
|
4
|
-
import { TextStyles as
|
|
3
|
+
import { MarkupElement as i } from "../MarkupElement.es.js";
|
|
4
|
+
import { TextStyles as c } from "../TextStylePlugin/types.es.js";
|
|
5
5
|
import { useRichTextEditorContext as m } from "../../context/RichTextEditorContext.es.js";
|
|
6
|
-
const p = "[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline", f = ({ attributes:
|
|
6
|
+
const p = "[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline !tw-list-item", f = ({ attributes: e, children: t, element: r }) => {
|
|
7
7
|
const { styles: s } = m();
|
|
8
|
-
return /* @__PURE__ */ n.createElement("li", { style: u(r, s), ...
|
|
8
|
+
return /* @__PURE__ */ n.createElement("li", { style: u(r, s), ...e, className: p }, t);
|
|
9
9
|
};
|
|
10
|
-
class d extends
|
|
11
|
-
constructor(
|
|
12
|
-
super(
|
|
10
|
+
class d extends i {
|
|
11
|
+
constructor(t = l, r = f) {
|
|
12
|
+
super(t, r);
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
|
-
const u = (
|
|
16
|
-
...
|
|
15
|
+
const u = (e, t) => ({
|
|
16
|
+
...t[o(e) ?? c.p],
|
|
17
17
|
counterIncrement: "count"
|
|
18
|
-
}), o = (
|
|
19
|
-
let
|
|
20
|
-
if (
|
|
21
|
-
|
|
22
|
-
else if (
|
|
23
|
-
for (const r of
|
|
18
|
+
}), o = (e) => {
|
|
19
|
+
let t;
|
|
20
|
+
if (e.type === "a")
|
|
21
|
+
t = e.children[0].textStyle;
|
|
22
|
+
else if (e.children)
|
|
23
|
+
for (const r of e.children) {
|
|
24
24
|
const s = o(r);
|
|
25
|
-
s && (!
|
|
25
|
+
s && (!t || s.startsWith(t)) && (t = s);
|
|
26
26
|
}
|
|
27
27
|
else
|
|
28
|
-
|
|
29
|
-
return
|
|
28
|
+
t = e.textStyle;
|
|
29
|
+
return t;
|
|
30
30
|
};
|
|
31
31
|
export {
|
|
32
32
|
p as LI_CLASSNAMES,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListItemMarkupElement.es.js","sources":["../../../../../src/components/RichTextEditor/Plugins/ListPlugin/ListItemMarkupElement.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ELEMENT_LI, PlateRenderElementProps, TElement } from '@udecode/plate';\nimport React, { CSSProperties } from 'react';\nimport { MarkupElement } from '../MarkupElement';\nimport { useRichTextEditorContext } from '@components/RichTextEditor/context';\nimport { TextStyles } from '../TextStylePlugin';\n\nexport const LI_CLASSNAMES =\n '[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline';\n\nexport const ListItemMarkupElementNode = ({ attributes, children, element }: PlateRenderElementProps) => {\n const { styles } = useRichTextEditorContext();\n return (\n <li style={getLiStyles(element, styles)} {...attributes} className={LI_CLASSNAMES}>\n {children}\n </li>\n );\n};\n\nexport class ListItemMarkupElement extends MarkupElement {\n constructor(id = ELEMENT_LI, node = ListItemMarkupElementNode) {\n super(id, node);\n }\n}\n\nexport const getLiStyles = (element: TElement, styles: Record<string, CSSProperties>): CSSProperties => {\n return {\n ...styles[getDeepestTextStyle(element) ?? TextStyles.p],\n counterIncrement: 'count',\n };\n};\n\nconst getDeepestTextStyle = (node: TElement): string => {\n let textStyle;\n\n if (node.type === 'a') {\n textStyle = node.children[0].textStyle;\n } else if (node.children) {\n for (const childNode of node.children) {\n const deepestTextStyle = getDeepestTextStyle(childNode as TElement);\n if (deepestTextStyle && (!textStyle || deepestTextStyle.startsWith(textStyle))) {\n textStyle = deepestTextStyle;\n }\n }\n } else {\n textStyle = node.textStyle;\n }\n\n return textStyle as string;\n};\n"],"names":["LI_CLASSNAMES","ListItemMarkupElementNode","attributes","children","element","styles","useRichTextEditorContext","React","getLiStyles","ListItemMarkupElement","MarkupElement","id","ELEMENT_LI","node","getDeepestTextStyle","TextStyles","textStyle","childNode","deepestTextStyle"],"mappings":";;;;;AAQO,MAAMA,IACT
|
|
1
|
+
{"version":3,"file":"ListItemMarkupElement.es.js","sources":["../../../../../src/components/RichTextEditor/Plugins/ListPlugin/ListItemMarkupElement.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport { ELEMENT_LI, PlateRenderElementProps, TElement } from '@udecode/plate';\nimport React, { CSSProperties } from 'react';\nimport { MarkupElement } from '../MarkupElement';\nimport { useRichTextEditorContext } from '@components/RichTextEditor/context';\nimport { TextStyles } from '../TextStylePlugin';\n\nexport const LI_CLASSNAMES =\n '[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline !tw-list-item';\n\nexport const ListItemMarkupElementNode = ({ attributes, children, element }: PlateRenderElementProps) => {\n const { styles } = useRichTextEditorContext();\n return (\n <li style={getLiStyles(element, styles)} {...attributes} className={LI_CLASSNAMES}>\n {children}\n </li>\n );\n};\n\nexport class ListItemMarkupElement extends MarkupElement {\n constructor(id = ELEMENT_LI, node = ListItemMarkupElementNode) {\n super(id, node);\n }\n}\n\nexport const getLiStyles = (element: TElement, styles: Record<string, CSSProperties>): CSSProperties => {\n return {\n ...styles[getDeepestTextStyle(element) ?? TextStyles.p],\n counterIncrement: 'count',\n };\n};\n\nconst getDeepestTextStyle = (node: TElement): string => {\n let textStyle;\n\n if (node.type === 'a') {\n textStyle = node.children[0].textStyle;\n } else if (node.children) {\n for (const childNode of node.children) {\n const deepestTextStyle = getDeepestTextStyle(childNode as TElement);\n if (deepestTextStyle && (!textStyle || deepestTextStyle.startsWith(textStyle))) {\n textStyle = deepestTextStyle;\n }\n }\n } else {\n textStyle = node.textStyle;\n }\n\n return textStyle as string;\n};\n"],"names":["LI_CLASSNAMES","ListItemMarkupElementNode","attributes","children","element","styles","useRichTextEditorContext","React","getLiStyles","ListItemMarkupElement","MarkupElement","id","ELEMENT_LI","node","getDeepestTextStyle","TextStyles","textStyle","childNode","deepestTextStyle"],"mappings":";;;;;AAQO,MAAMA,IACT,6GAESC,IAA4B,CAAC,EAAE,YAAAC,GAAY,UAAAC,GAAU,SAAAC,QAAuC;AAC/F,QAAA,EAAE,QAAAC,MAAWC;AAEf,SAAA,gBAAAC,EAAA,cAAC,MAAG,EAAA,OAAOC,EAAYJ,GAASC,CAAM,GAAI,GAAGH,GAAY,WAAWF,EAAA,GAC/DG,CACL;AAER;AAEO,MAAMM,UAA8BC,EAAc;AAAA,EACrD,YAAYC,IAAKC,GAAYC,IAAOZ,GAA2B;AAC3D,UAAMU,GAAIE,CAAI;AAAA,EAClB;AACJ;AAEa,MAAAL,IAAc,CAACJ,GAAmBC,OACpC;AAAA,EACH,GAAGA,EAAOS,EAAoBV,CAAO,KAAKW,EAAW,CAAC;AAAA,EACtD,kBAAkB;AAAA,IAIpBD,IAAsB,CAACD,MAA2B;AAChD,MAAAG;AAEA,MAAAH,EAAK,SAAS;AACF,IAAAG,IAAAH,EAAK,SAAS,CAAC,EAAE;AAAA,WACtBA,EAAK;AACD,eAAAI,KAAaJ,EAAK,UAAU;AAC7B,YAAAK,IAAmBJ,EAAoBG,CAAqB;AAClE,MAAIC,MAAqB,CAACF,KAAaE,EAAiB,WAAWF,CAAS,OAC5DA,IAAAE;AAAA,IAEpB;AAAA;AAEA,IAAAF,IAAYH,EAAK;AAGd,SAAAG;AACX;"}
|
package/dist/index.cjs.js
CHANGED
|
@@ -35,7 +35,7 @@ ${h2("Ctrl+B")}`),key:l,type:u.getPluginType(e,l),icon:t.createElement(S0,{icon:
|
|
|
35
35
|
color: var(--box-neutral-inverse-color-hover);
|
|
36
36
|
`]},Dm0={renderAfterEditable:Vm0};class cV extends n0{constructor(l){super(Rm0,{button:zm0,showIn:[u0.BOTTOM,u0.TOP],...l})}plugins(){return[u.createComboboxPlugin(),u.createEmojiPlugin(Dm0)]}}const Fm0="soft-break-plugin";class rV extends n0{constructor(l){super(Fm0,{...l})}plugins(){return[u.createSoftBreakPlugin()]}}const Bm0="italic-plugin",ye="tw-italic",oV=({attributes:e,children:l})=>t.createElement("span",{...e,className:ye},l);class iV extends t0{constructor(l=u.MARK_ITALIC,a=oV){super(l,a)}}const Om0=({editor:e,id:l})=>t.createElement(I0,{id:l},t.createElement(u.MarkToolbarButton,{tooltip:k0(`Italic
|
|
37
37
|
${h2("Ctrl+I")}`),type:u.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(J5,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"})),Pm0=[{validNodeName:["EM","I"]},{validStyle:{fontStyle:"italic"}}];class sV extends n0{constructor(l){super(Bm0,{button:Om0,markupElement:new iV,...l})}plugins(){return[u.createItalicPlugin({deserializeHtml:{rules:[...Pm0,{validNodeName:["SPAN"],validClassName:ye}]},options:{hotkey:["mod+i","ctrl+i"]}})]}}const Um0=e=>!!e.match(/^(https?:\/\/|mailto:|tel:).+/),Qm0=u.createComponentAs(e=>{var a;const l=u.useFloatingLinkInsert({...e,floatingOptions:{strategy:"fixed"}});return((a=l.style)==null?void 0:a.display)==="none"?null:u.createElementAs("div",l)}),Ym0=u.createComponentAs(e=>{var a;const l=$m0({...e,floatingOptions:{strategy:"fixed"}});return((a=l.style)==null?void 0:a.display)==="none"?null:u.createElementAs("div",l)});u.FloatingLink.EditRoot=Ym0;u.FloatingLink.InsertRoot=Qm0;const W2=u.FloatingLink,k1="link-plugin",Gm0=()=>{const e=u.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[k1],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(W2.EditButton,null,t.createElement(B5,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(W2.UnlinkButton,null,t.createElement(et,null))))))},n3=(e,l)=>{const a=u.getAboveNode(e,{match:{type:u.ELEMENT_LINK}});return Array.isArray(a)?l(a[0]):""},Wm0=e=>n3(e,l=>{var a,c;return((c=(a=l.chosenLink)==null?void 0:a.searchResult)==null?void 0:c.link)||""}),qm0=e=>n3(e,l=>l.url||""),mV=e=>{var l,a;return e.url||((a=(l=e.chosenLink)==null?void 0:l.searchResult)==null?void 0:a.link)||""},Km0=e=>n3(e,mV),$m0=({floatingOptions:e,...l})=>{const a=u.useEditorRef(),c=u.usePlateSelectors().keyEditor(),r=u.useFloatingLinkSelectors().mode(),o=u.useFloatingLinkSelectors().isOpen(a.id),{triggerFloatingLinkHotkeys:i="command+k, ctrl+k"}=u.getPluginOptions(a,u.ELEMENT_LINK),s=t.useCallback(()=>{const w=u.getAboveNode(a,{match:{type:u.getPluginType(a,u.ELEMENT_LINK)}});if(w){const[,v]=w;return u.getRangeBoundingClientRect(a,{anchor:u.getStartPoint(a,v),focus:u.getEndPoint(a,v)})}return u.getDefaultBoundingClientRect()},[a]),m=o&&r==="edit",{update:L,style:d,floating:h}=u.useVirtualFloatingLink({editorId:a.id,open:m,getBoundingClientRect:s,...e});return t.useEffect(()=>{const w=Km0(a);if(w&&u.floatingLinkActions.url(w),a.selection&&u.someNode(a,{match:{type:u.getPluginType(a,u.ELEMENT_LINK)}})){u.floatingLinkActions.show("edit",a.id),L();return}u.floatingLinkSelectors.mode()==="edit"&&u.floatingLinkActions.hide()},[a,c,L]),u.useHotkeys(i,w=>{w.preventDefault(),u.floatingLinkSelectors.mode()==="edit"&&u.triggerFloatingLinkEdit(a)},{enableOnContentEditable:!0},[]),u.useFloatingLinkEnter(),u.useFloatingLinkEscape(),{style:{...d,zIndex:1},...l,ref:u.useComposedRef(l.ref,h)}},Xm0=({state:e,onTextChange:l,onUrlChange:a,onToggleTab:c,onCancel:r,onSave:o,isValidUrlOrEmpty:i,hasValues:s,testId:m,children:L})=>t.createElement("div",{"data-test-id":m,className:"tw-bg-white tw-rounded tw-shadow tw-p-7 tw-min-w-[400px] tw-overflow-y-auto"},t.createElement(B2,{label:{children:"Text",htmlFor:"linkText",required:!0}},t.createElement(u1,{id:"linkText",value:e.text,placeholder:"Link Text",onChange:l})),L,t.createElement("div",{className:"tw-pt-5"},t.createElement(B2,{label:{children:"URL",htmlFor:"url",required:!0}},t.createElement(u1,{id:"url",value:e.url,placeholder:"https://example.com",focusOnMount:!0,onChange:a})),!i()&&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(A1,{value:"new-tab",label:"Open in new tab",state:e.newTab,onChange:c})),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(b0,{onClick:r,size:i0.Medium,style:$.Default,emphasis:v0.Default},"Cancel"),t.createElement(b0,{onClick:o,size:i0.Medium,icon:t.createElement(S5,null),disabled:!i()||!s},"Save")))),Jm0={url:"",text:"",newTab:A0.Unchecked},_m0=()=>{const[e,l]=t.useReducer((a,c)=>{const{type:r,payload:o}=c;switch(r){case"NEW_TAB":return{...a,newTab:A0.Checked};case"SAME_TAB":return{...a,newTab:A0.Unchecked};case"URL":case"TEXT":case"INIT":return{...a,...o};default:return a}},Jm0);return[e,l]},eL0=()=>{const e=u.useEditorRef(),[l,a]=_m0();t.useEffect(()=>{const d=Wm0(e),h=qm0(e);a({type:"INIT",payload:{text:u.floatingLinkSelectors.text(),newTab:u.floatingLinkSelectors.newTab()?A0.Checked:A0.Unchecked,url:d&&h===""?d:u.floatingLinkSelectors.url()}})},[a,e]);const c=d=>{a({type:"TEXT",payload:{text:d}})},r=d=>{a({type:"URL",payload:{url:d}})},o=d=>{a(d?{type:"NEW_TAB"}:{type:"SAME_TAB"})},i=()=>{u.floatingLinkActions.hide()},s=d=>{!L()||!m||(u.floatingLinkActions.text(l.text),u.floatingLinkActions.url(l.url),u.floatingLinkActions.newTab(l.newTab===A0.Checked),u.submitFloatingLink(e)&&(d==null||d.preventDefault()))},m=l.url!==""&&l.text!=="",L=()=>{const{isUrl:d}=u.getPluginOptions(e,u.ELEMENT_LINK);return!l.url||d&&d(l.url)};return u.useHotkeys("enter",s,{enableOnFormTags:["INPUT"]},[]),{state:l,onTextChange:c,onUrlChange:r,onToggleTab:o,onCancel:i,onSave:s,hasValues:m,isValidUrlOrEmpty:L}},tL0=()=>t.createElement(Xm0,{...eL0(),testId:"floating-link-insert"}),lL0=({readOnly:e})=>{const l=u.useFloatingLinkSelectors().isEditing();if(e)return null;const a=t.createElement(tL0,null),c=l?a:t.createElement(Gm0,null);return t.createElement(t.Fragment,null,t.createElement(W2.InsertRoot,null,a),t.createElement(W2.EditRoot,null,c))},nL0=({id:e,editorId:l})=>{const a=u.usePlateEditorState(u.useEventPlateId(l)),c=!!u.isRangeInSameBlock(a,{at:a.selection}),r=M0(c);return t.createElement(I0,{id:e},t.createElement(u.LinkToolbarButton,{tooltip:k0(c?`Link
|
|
38
|
-
${h2("Ctrl+K")}`:"Links can only be set for a single text block."),icon:t.createElement(S0,{icon:t.createElement(V5,null)}),classNames:r,styles:y0,actionHandler:"onMouseDown"}))},aL0=e=>({...u.useElementProps({...e,elementToAttributes:a=>({href:mV(a),target:a.target||"_blank"})}),onMouseOver:a=>{a.stopPropagation()}}),cL0=e=>{const l=aL0(e),{attributes:a,children:c}=e,{styles:r}=C1();return t.createElement("a",{...a,href:l.href,target:l.target,style:r[k1]},c)};class rL0 extends t0{constructor(l=u.ELEMENT_LINK,a=cL0){super(l,a)}}const LV=u.createPluginFactory({...u.createLinkPlugin(),renderAfterEditable:lL0,options:{isUrl:Um0,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class dV extends n0{constructor({styles:a=H0[k1],...c}={}){super(k1,{button:nL0,markupElement:new rL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[LV()]}}const a3="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",uV=`${a3} tw-break-after-column tw-break-inside-avoid-column`,D0=e=>{const l=e.breakAfterColumn;return g([l==="active"&&uV,l==="inactive"&&a3])},c3=e=>g([D0(e),e.align?_t[e.align]:"tw-justify-start","tw-grid tw-grid-cols-[min-content_repeat(3,_auto)]"]),wV=({attributes:e,children:l,element:a})=>t.createElement("p",{className:c3(a),...e},t.createElement("span",{className:"tw-w-auto tw-min-w-[10px]"},l));class hV extends t0{constructor(l=u.ELEMENT_LIC,a=wV){super(l,a)}}const fV="text-style-plugin",Re="list-plugin",oL0=(e,{options:{validLiChildrenTypes:l,isSoftBreak:a}})=>{const{insertBreak:c,deleteBackward:r,deleteForward:o,deleteFragment:i}=e;return a?e.insertSoftBreak=()=>{u.insertBreakList(e)||c()}:e.insertBreak=()=>{u.insertBreakList(e)||c()},e.deleteBackward=s=>{u.deleteBackwardList(e,s)||r(s)},e.deleteForward=s=>{u.deleteForwardList(e)||o(s)},e.deleteFragment=s=>{u.deleteFragmentList(e)||i(s)},e.insertFragment=u.insertFragmentList(e),e.normalizeNode=u.normalizeList(e,{validLiChildrenTypes:l}),e},e2="textStyle",vV=u.createPluginFactory({key:e2,isLeaf:!0});class r3 extends n0{constructor(a){super(Re,{leafMarkupElements:[new hV,new SV],...a});Y(this,"isSoftBreak");this.isSoftBreak=(a==null?void 0:a.isSoftBreak)??!1}plugins(){return[u.createListPlugin({withOverrides:oL0,options:{isSoftBreak:this.isSoftBreak}}),vV()]}}const iL0=e=>u.getAboveNode(e,{match:{type:u.ELEMENT_LI},mode:"lowest"})||u.someNode(e,{match:{type:J0},mode:"lowest"}),sL0=({editor:e,type:l,children:a})=>{const c=e!=null&&e.selection?u.getMark(e,e2)===l.id:u.someNode(e,{match:{type:l}});return t.createElement("button",{"data-test-id":"textstyle-option",type:"button",className:g(["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]",c?"tw-text-box-neutral-inverse tw-bg-box-neutral":"tw-text-text"]),onMouseDown:r=>{r.preventDefault(),r.stopPropagation(),!(!e||!e.selection)&&(u.setMarks(e,{[e2]:l.id}),iL0(e)||u.toggleNodeType(e,{activeType:l.id,inactiveType:l.id}))}},a)},mL0=({label:e,open:l,onClick:a},c)=>t.createElement("button",{ref:c,"data-test-id":"textstyle-dropdown-trigger",type:"button",className:"tw-cursor-pointer tw-h-8 tw-w-full",onMouseDown:r=>{r.preventDefault(),r.stopPropagation(),a()}},t.createElement("div",{className:g(["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:g(["tw-transition-transform",l&&"tw-rotate-180"])},t.createElement(N5,null)))),LL0=t.forwardRef(mL0),dL0=e=>Array.isArray(e.children)?(e.children.find(a=>u.isText(a))??{})[e2]:u.ELEMENT_PARAGRAPH,uL0=[u.ELEMENT_LI,u.ELEMENT_UL,u.ELEMENT_OL],wL0=e=>!e||!e.selection?[]:Array.from(u.getNodeEntries(e,{unhang:!0,at:e.selection,reverse:!0})).reduce((a,[c])=>{if(!u.isNode(c))return a;const r=c.type===u.ELEMENT_LIC||c.type===J0?dL0(c):c.textStyle;return r&&!a.includes(r)&&!uL0.includes(r)&&a.push(r),a},[]),hL0=6,fL0=10,vL0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:a,maxHeight:c}=Ht(e.elements.reference,e.rects.popper.height,hL0+fL0,0);a==="top"&&(e.placement="top-start"),e.styles.popper={maxHeight:`${c}px`},e.reset=!0,e.modifiersData[l]._skip=!0},enabled:!0},q2="Mixed";var T=(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))(T||{});const gL0=e=>{const[l,a]=t.useState(!1),[c,r]=t.useState(null),[o,i]=t.useState(null),s=u.usePlateEditorState(e),m=wL0(s);let L=q2;m.length===1?L=m[0]:m.length===0&&(L="p");const d=t.useCallback(()=>{a(w=>!w)},[a]),h=T1.usePopper(c,o,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"flip",enabled:!1},vL0]});return t.useEffect(()=>{const w=v=>{if(l){const f=v.target;if(o&&o.contains(f)||c&&c.contains(f))return;a(!1)}};return document.addEventListener("pointerdown",w),()=>{document.removeEventListener("pointerdown",w)}},[l,o,a,c]),{state:{isOpen:l,toggle:d,editor:s},dropdownProps:{...h.attributes.popper,style:h.styles.popper},key:L,dropdownRef:i,triggerRef:r}},AL0=({editorId:e,textStyles:l=[]})=>{var h;const{state:{editor:a,toggle:c,isOpen:r},dropdownProps:o,triggerRef:i,dropdownRef:s,key:m}=gL0(e);let L=q2;const d=l.find(w=>{var v;return w.id===m&&((v=w.props)==null?void 0:v.label)});return d&&(L=((h=d.props)==null?void 0:h.label)||q2),t.createElement(t.Fragment,null,t.createElement(LL0,{label:L,open:r,onClick:c,ref:i}),r&&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:s,...o},l.map(w=>{var v;return t.createElement(sL0,{editor:a,type:w,key:w.id},t.createElement("span",{style:w.styles??{}},(v=w.props)==null?void 0:v.label))})))},CL0=({editorId:e,id:l,textStyles:a})=>t.createElement(I0,{id:l},t.createElement(AL0,{editorId:e,textStyles:a})),EL0=(e,l)=>a=>t.createElement(e,{...a,textStyles:l}),ML0="textstyle-custom1-plugin";class IL0 extends n0{constructor({styles:a=H0.custom1,...c}={}){super(T.custom1,{label:"Custom 1",markupElement:new xL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[ZL0(this.styles)]}}class xL0 extends t0{constructor(l=ML0,a=gV){super(l,a)}}const gV=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("p",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},ZL0=e=>u.createPluginFactory({key:T.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom1}]}})({component:l=>t.createElement(gV,{...l,styles:e})}),pL0="textstyle-custom2-plugin";class NL0 extends n0{constructor({styles:a=H0.custom2,...c}={}){super(T.custom2,{label:"Custom 2",markupElement:new SL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[yL0(this.styles)]}}class SL0 extends t0{constructor(l=pL0,a=AV){super(l,a)}}const AV=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("p",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},yL0=e=>u.createPluginFactory({key:T.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom2}]}})({component:l=>t.createElement(AV,{...l,styles:e})}),RL0="textstyle-custom3-plugin";class bL0 extends n0{constructor({styles:a=H0.custom3,...c}={}){super(T.custom3,{label:"Custom 3",markupElement:new HL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[kL0(this.styles)]}}class HL0 extends t0{constructor(l=RL0,a=CV){super(l,a)}}const CV=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("p",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},kL0=e=>u.createPluginFactory({key:T.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom3}]}})({component:l=>t.createElement(CV,{...l,styles:e})}),zL0="textstyle-heading1-plugin";class VL0 extends n0{constructor({styles:a=H0.heading1,...c}={}){super(T.heading1,{label:"Heading 1",markupElement:new TL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[jL0(this.styles)]}}class TL0 extends t0{constructor(l=zL0,a=a5){super(l,a)}}const a5=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("h1",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},jL0=e=>u.createPluginFactory({key:T.heading1,isElement:!0,component:a5,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:l=>t.createElement(a5,{...l,styles:e})}),DL0="textstyle-heading2-plugin";class FL0 extends n0{constructor({styles:a=H0.heading2,...c}={}){super(T.heading2,{label:"Heading 2",markupElement:new BL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[OL0(this.styles)]}}class BL0 extends t0{constructor(l=DL0,a=c5){super(l,a)}}const c5=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("h2",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},OL0=e=>u.createPluginFactory({key:T.heading2,isElement:!0,component:c5,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:l=>t.createElement(c5,{...l,styles:e})}),PL0="textstyle-heading3-plugin";class UL0 extends n0{constructor({styles:a=H0.heading3,...c}={}){super(T.heading3,{label:"Heading 3",markupElement:new QL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[YL0(this.styles)]}}class QL0 extends t0{constructor(l=PL0,a=r5){super(l,a)}}const r5=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("h3",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},YL0=e=>u.createPluginFactory({key:T.heading3,isElement:!0,component:r5,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:l=>t.createElement(r5,{...l,styles:e})}),GL0="textstyle-heading4-plugin";class WL0 extends n0{constructor({styles:a=H0.heading4,...c}={}){super(T.heading4,{label:"Heading 4",markupElement:new qL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[KL0(this.styles)]}}class qL0 extends t0{constructor(l=GL0,a=o5){super(l,a)}}const o5=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("h4",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},KL0=e=>u.createPluginFactory({key:T.heading4,isElement:!0,component:o5,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:l=>t.createElement(o5,{...l,styles:e})}),$L0="textstyle-imageCaption-plugin";class XL0 extends n0{constructor({styles:a=H0.imageCaption,...c}={}){super(T.imageCaption,{label:"Image Caption",markupElement:new JL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[_L0(this.styles)]}}class JL0 extends t0{constructor(l=$L0,a=i5){super(l,a)}}const i5=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("p",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},_L0=e=>u.createPluginFactory({key:T.imageCaption,isElement:!0,component:i5,deserializeHtml:{rules:[{validClassName:T.imageCaption}]}})({component:l=>t.createElement(i5,{...l,styles:e})}),ed0="textstyle-imageTitle-plugin";class td0 extends n0{constructor({styles:a=H0.imageTitle,...c}={}){super(T.imageTitle,{label:"Image Title",markupElement:new ld0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[nd0(this.styles)]}}class ld0 extends t0{constructor(l=ed0,a=s5){super(l,a)}}const s5=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("p",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},nd0=e=>u.createPluginFactory({key:T.imageTitle,isElement:!0,component:s5,deserializeHtml:{rules:[{validClassName:T.imageTitle}]}})({component:l=>t.createElement(s5,{...l,styles:e})});class EV extends n0{constructor({styles:a=H0.p,...c}={}){super(T.p,{markupElement:new IV,label:"Body Text",...c});Y(this,"styles",{});this.styles=a}plugins(){return[xV(this.styles)]}}const MV="tw-m-0 tw-px-0 tw-py-0",K2=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align,o=g([r&&j0[r],MV,D0(e)]);return t.createElement("p",{...l,className:o,style:c},a)};class IV extends t0{constructor(l=T.p,a=K2){super(l,a)}}const xV=e=>u.createPluginFactory({...u.createParagraphPlugin(),key:T.p,isElement:!0,component:K2})({component:l=>t.createElement(K2,{...l,styles:e})}),ad0="textstyle-quote-plugin";class cd0 extends n0{constructor({styles:a=H0.quote,...c}={}){super(T.quote,{label:"Quote",markupElement:new rd0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[ZV(this.styles)]}}class rd0 extends t0{constructor(l=ad0,a=$2){super(l,a)}}const $2=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("blockquote",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},ZV=e=>u.createPluginFactory({key:T.quote,isElement:!0,component:$2,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:l=>t.createElement($2,{...l,styles:e})});class pV extends n0{constructor({...a}){super(fV,{button:EL0(CL0,a.textStyles),...a});Y(this,"textStyles");this.textStyles=a.textStyles}plugins(){return this.textStyles.map(a=>a.plugins()).flat()}}const o3="[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline",NV=({attributes:e,children:l,element:a})=>{const{styles:c}=C1();return t.createElement("li",{style:i3(a,c),...e,className:o3},l)};class SV extends t0{constructor(l=u.ELEMENT_LI,a=NV){super(l,a)}}const i3=(e,l)=>({...l[yV(e)??T.p],counterIncrement:"count"}),yV=e=>{let l;if(e.type==="a")l=e.children[0].textStyle;else if(e.children)for(const a of e.children){const c=yV(a);c&&(!l||c.startsWith(l))&&(l=c)}else l=e.textStyle;return l},od0=["[&>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)_'._']"],id0=(e,l)=>{const a=u.findNodePath(e,l);if(!a)return 0;const c=u.getNodeAncestors(e,a);return Array.from(c).filter(r=>r[0].type===u.ELEMENT_LI).length},s3=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 ${od0[e%3]}`,m3={counterReset:"count"},RV=({attributes:e,children:l,element:a})=>{const c=u.usePlateEditorRef(),r=id0(c,a);return t.createElement("ol",{className:s3(r),...e,style:m3},l)};class bV extends t0{constructor(l=u.ELEMENT_OL,a=RV){super(l,a)}}const HV=({editor:e,id:l})=>t.createElement(I0,{id:l},t.createElement(u.ListToolbarButton,{tooltip:k0("Ordered list"),type:u.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(D5,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class kV extends r3{constructor(l){super({id:Re,button:HV,markupElement:new bV,...l})}}const L3="[&>li>p]:before:tw-content-['•'] [&>li>p]:before:tw-px-2 tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",zV=({attributes:e,children:l})=>t.createElement("ul",{className:L3,...e},l);class VV extends t0{constructor(l=u.ELEMENT_UL,a=zV){super(l,a)}}const TV=({editor:e,id:l})=>t.createElement(I0,{id:l},t.createElement(u.ListToolbarButton,{tooltip:k0("Bullet list"),type:u.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(T5,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class jV extends r3{constructor(l){super({id:Re,button:TV,markupElement:new VV,...l})}}class sd0{constructor(){Y(this,"toolbarButtons",{[u0.BOTTOM]:[],[u0.FLOATING]:[],[u0.TOP]:[]})}createGroupOfButtons(l){const a=[],c=[],r=[];for(const{markupElement:o,button:i,id:s,showIn:m}of l){if(!i)continue;const L={id:(o==null?void 0:o.getId())||s,button:i};m.includes(u0.BOTTOM)&&a.push(L),m.includes(u0.TOP)&&c.push(L),m.includes(u0.FLOATING)&&r.push(L)}a.length>0&&this.toolbarButtons[u0.BOTTOM].push(a),c.length>0&&this.toolbarButtons[u0.TOP].push(c),r.length>0&&this.toolbarButtons[u0.FLOATING].push(r)}at(l){return this.toolbarButtons[l]}}class DV{constructor(l){Y(this,"platePlugins",new Map);Y(this,"markupElements",{});Y(this,"inlineElements",[]);Y(this,"toolbarButtons",new sd0);Y(this,"styles",{});this.props=l}setPlugin(...l){for(const a of l){const c=Array.isArray(a)?a:[a];for(const r of c)this.addElement(r.markupElement),this.addElement(r.markupInputElement),this.addLeafElements(r.leafMarkupElements),this.addPlugin(r),this.addInline(r.inline()),r.styles&&this.addStyles(r.styles,r.id),r.textStyles&&this.addTextStylesOfSubPlugins(r.textStyles);this.hasToolbar&&this.toolbarButtons.createGroupOfButtons(c)}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 c of a)this.addElement(c)}addElement(l){if(l===void 0)return;const a=l.getId(),c=l.getNode();c&&!this.markupElements[a]&&(this.markupElements[a]=c)}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 c of a){const{key:r,component:o}=c;o&&(l[r]=o)}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 FV="reset-formatting-plugin",BV="reset-formatting",md0=e=>{!e||!e.selection||(u.removeMark(e,{key:[u.MARK_BOLD,u.MARK_ITALIC,u.MARK_CODE,u.MARK_UNDERLINE,u.MARK_STRIKETHROUGH]}),u.unwrapList(e,{}),u.setElements(e,{type:u.ELEMENT_PARAGRAPH,align:void 0}))},Ld0=u.withPlateProvider(({id:e,...l})=>{const a=u.usePlateEditorState(u.useEventPlateId(e));return t.createElement(u.ToolbarButton,{tooltip:k0("Clear formatting"),onMouseDown:()=>{md0(a)},...l})}),dd0=({id:e})=>t.createElement(I0,{id:e},t.createElement(Ld0,{icon:t.createElement(S0,{icon:t.createElement(H5,null)}),classNames:M0(),styles:y0})),OV=u.createPluginFactory({key:BV,isElement:!1});class PV extends n0{constructor(l){super(FV,{button:dd0,...l})}plugins(){return[OV()]}}const ud0="strikethrough-plugin",d3="!tw-line-through",UV=({attributes:e,children:l})=>t.createElement("span",{...e,className:d3},l);class QV extends t0{constructor(l=u.MARK_STRIKETHROUGH,a=UV){super(l,a)}}const wd0=({editor:e,id:l})=>t.createElement(I0,{id:l},t.createElement(u.MarkToolbarButton,{tooltip:k0("Strikethrough"),type:u.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(ab,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class YV extends n0{constructor(l){super(ud0,{button:wd0,markupElement:new QV,...l})}plugins(){return[u.createStrikethroughPlugin()]}}const hd0="underline-plugin",be="tw-underline",GV=({attributes:e,children:l})=>t.createElement("span",{...e,className:be},l);class WV extends t0{constructor(l=u.MARK_UNDERLINE,a=GV){super(l,a)}}const fd0=({editor:e,id:l})=>t.createElement(I0,{id:l},t.createElement(u.MarkToolbarButton,{tooltip:k0(`Underline
|
|
38
|
+
${h2("Ctrl+K")}`:"Links can only be set for a single text block."),icon:t.createElement(S0,{icon:t.createElement(V5,null)}),classNames:r,styles:y0,actionHandler:"onMouseDown"}))},aL0=e=>({...u.useElementProps({...e,elementToAttributes:a=>({href:mV(a),target:a.target||"_blank"})}),onMouseOver:a=>{a.stopPropagation()}}),cL0=e=>{const l=aL0(e),{attributes:a,children:c}=e,{styles:r}=C1();return t.createElement("a",{...a,href:l.href,target:l.target,style:r[k1]},c)};class rL0 extends t0{constructor(l=u.ELEMENT_LINK,a=cL0){super(l,a)}}const LV=u.createPluginFactory({...u.createLinkPlugin(),renderAfterEditable:lL0,options:{isUrl:Um0,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class dV extends n0{constructor({styles:a=H0[k1],...c}={}){super(k1,{button:nL0,markupElement:new rL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[LV()]}}const a3="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",uV=`${a3} tw-break-after-column tw-break-inside-avoid-column`,D0=e=>{const l=e.breakAfterColumn;return g([l==="active"&&uV,l==="inactive"&&a3])},c3=e=>g([D0(e),e.align?_t[e.align]:"tw-justify-start","tw-grid tw-grid-cols-[min-content_repeat(3,_auto)]"]),wV=({attributes:e,children:l,element:a})=>t.createElement("p",{className:c3(a),...e},t.createElement("span",{className:"tw-w-auto tw-min-w-[10px]"},l));class hV extends t0{constructor(l=u.ELEMENT_LIC,a=wV){super(l,a)}}const fV="text-style-plugin",Re="list-plugin",oL0=(e,{options:{validLiChildrenTypes:l,isSoftBreak:a}})=>{const{insertBreak:c,deleteBackward:r,deleteForward:o,deleteFragment:i}=e;return a?e.insertSoftBreak=()=>{u.insertBreakList(e)||c()}:e.insertBreak=()=>{u.insertBreakList(e)||c()},e.deleteBackward=s=>{u.deleteBackwardList(e,s)||r(s)},e.deleteForward=s=>{u.deleteForwardList(e)||o(s)},e.deleteFragment=s=>{u.deleteFragmentList(e)||i(s)},e.insertFragment=u.insertFragmentList(e),e.normalizeNode=u.normalizeList(e,{validLiChildrenTypes:l}),e},e2="textStyle",vV=u.createPluginFactory({key:e2,isLeaf:!0});class r3 extends n0{constructor(a){super(Re,{leafMarkupElements:[new hV,new SV],...a});Y(this,"isSoftBreak");this.isSoftBreak=(a==null?void 0:a.isSoftBreak)??!1}plugins(){return[u.createListPlugin({withOverrides:oL0,options:{isSoftBreak:this.isSoftBreak}}),vV()]}}const iL0=e=>u.getAboveNode(e,{match:{type:u.ELEMENT_LI},mode:"lowest"})||u.someNode(e,{match:{type:J0},mode:"lowest"}),sL0=({editor:e,type:l,children:a})=>{const c=e!=null&&e.selection?u.getMark(e,e2)===l.id:u.someNode(e,{match:{type:l}});return t.createElement("button",{"data-test-id":"textstyle-option",type:"button",className:g(["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]",c?"tw-text-box-neutral-inverse tw-bg-box-neutral":"tw-text-text"]),onMouseDown:r=>{r.preventDefault(),r.stopPropagation(),!(!e||!e.selection)&&(u.setMarks(e,{[e2]:l.id}),iL0(e)||u.toggleNodeType(e,{activeType:l.id,inactiveType:l.id}))}},a)},mL0=({label:e,open:l,onClick:a},c)=>t.createElement("button",{ref:c,"data-test-id":"textstyle-dropdown-trigger",type:"button",className:"tw-cursor-pointer tw-h-8 tw-w-full",onMouseDown:r=>{r.preventDefault(),r.stopPropagation(),a()}},t.createElement("div",{className:g(["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:g(["tw-transition-transform",l&&"tw-rotate-180"])},t.createElement(N5,null)))),LL0=t.forwardRef(mL0),dL0=e=>Array.isArray(e.children)?(e.children.find(a=>u.isText(a))??{})[e2]:u.ELEMENT_PARAGRAPH,uL0=[u.ELEMENT_LI,u.ELEMENT_UL,u.ELEMENT_OL],wL0=e=>!e||!e.selection?[]:Array.from(u.getNodeEntries(e,{unhang:!0,at:e.selection,reverse:!0})).reduce((a,[c])=>{if(!u.isNode(c))return a;const r=c.type===u.ELEMENT_LIC||c.type===J0?dL0(c):c.textStyle;return r&&!a.includes(r)&&!uL0.includes(r)&&a.push(r),a},[]),hL0=6,fL0=10,vL0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:a,maxHeight:c}=Ht(e.elements.reference,e.rects.popper.height,hL0+fL0,0);a==="top"&&(e.placement="top-start"),e.styles.popper={maxHeight:`${c}px`},e.reset=!0,e.modifiersData[l]._skip=!0},enabled:!0},q2="Mixed";var T=(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))(T||{});const gL0=e=>{const[l,a]=t.useState(!1),[c,r]=t.useState(null),[o,i]=t.useState(null),s=u.usePlateEditorState(e),m=wL0(s);let L=q2;m.length===1?L=m[0]:m.length===0&&(L="p");const d=t.useCallback(()=>{a(w=>!w)},[a]),h=T1.usePopper(c,o,{placement:"bottom-start",strategy:"fixed",modifiers:[{name:"offset",options:{offset:[0,6]}},{name:"flip",enabled:!1},vL0]});return t.useEffect(()=>{const w=v=>{if(l){const f=v.target;if(o&&o.contains(f)||c&&c.contains(f))return;a(!1)}};return document.addEventListener("pointerdown",w),()=>{document.removeEventListener("pointerdown",w)}},[l,o,a,c]),{state:{isOpen:l,toggle:d,editor:s},dropdownProps:{...h.attributes.popper,style:h.styles.popper},key:L,dropdownRef:i,triggerRef:r}},AL0=({editorId:e,textStyles:l=[]})=>{var h;const{state:{editor:a,toggle:c,isOpen:r},dropdownProps:o,triggerRef:i,dropdownRef:s,key:m}=gL0(e);let L=q2;const d=l.find(w=>{var v;return w.id===m&&((v=w.props)==null?void 0:v.label)});return d&&(L=((h=d.props)==null?void 0:h.label)||q2),t.createElement(t.Fragment,null,t.createElement(LL0,{label:L,open:r,onClick:c,ref:i}),r&&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:s,...o},l.map(w=>{var v;return t.createElement(sL0,{editor:a,type:w,key:w.id},t.createElement("span",{style:w.styles??{}},(v=w.props)==null?void 0:v.label))})))},CL0=({editorId:e,id:l,textStyles:a})=>t.createElement(I0,{id:l},t.createElement(AL0,{editorId:e,textStyles:a})),EL0=(e,l)=>a=>t.createElement(e,{...a,textStyles:l}),ML0="textstyle-custom1-plugin";class IL0 extends n0{constructor({styles:a=H0.custom1,...c}={}){super(T.custom1,{label:"Custom 1",markupElement:new xL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[ZL0(this.styles)]}}class xL0 extends t0{constructor(l=ML0,a=gV){super(l,a)}}const gV=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("p",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},ZL0=e=>u.createPluginFactory({key:T.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom1}]}})({component:l=>t.createElement(gV,{...l,styles:e})}),pL0="textstyle-custom2-plugin";class NL0 extends n0{constructor({styles:a=H0.custom2,...c}={}){super(T.custom2,{label:"Custom 2",markupElement:new SL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[yL0(this.styles)]}}class SL0 extends t0{constructor(l=pL0,a=AV){super(l,a)}}const AV=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("p",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},yL0=e=>u.createPluginFactory({key:T.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom2}]}})({component:l=>t.createElement(AV,{...l,styles:e})}),RL0="textstyle-custom3-plugin";class bL0 extends n0{constructor({styles:a=H0.custom3,...c}={}){super(T.custom3,{label:"Custom 3",markupElement:new HL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[kL0(this.styles)]}}class HL0 extends t0{constructor(l=RL0,a=CV){super(l,a)}}const CV=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("p",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},kL0=e=>u.createPluginFactory({key:T.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom3}]}})({component:l=>t.createElement(CV,{...l,styles:e})}),zL0="textstyle-heading1-plugin";class VL0 extends n0{constructor({styles:a=H0.heading1,...c}={}){super(T.heading1,{label:"Heading 1",markupElement:new TL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[jL0(this.styles)]}}class TL0 extends t0{constructor(l=zL0,a=a5){super(l,a)}}const a5=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("h1",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},jL0=e=>u.createPluginFactory({key:T.heading1,isElement:!0,component:a5,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:l=>t.createElement(a5,{...l,styles:e})}),DL0="textstyle-heading2-plugin";class FL0 extends n0{constructor({styles:a=H0.heading2,...c}={}){super(T.heading2,{label:"Heading 2",markupElement:new BL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[OL0(this.styles)]}}class BL0 extends t0{constructor(l=DL0,a=c5){super(l,a)}}const c5=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("h2",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},OL0=e=>u.createPluginFactory({key:T.heading2,isElement:!0,component:c5,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:l=>t.createElement(c5,{...l,styles:e})}),PL0="textstyle-heading3-plugin";class UL0 extends n0{constructor({styles:a=H0.heading3,...c}={}){super(T.heading3,{label:"Heading 3",markupElement:new QL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[YL0(this.styles)]}}class QL0 extends t0{constructor(l=PL0,a=r5){super(l,a)}}const r5=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("h3",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},YL0=e=>u.createPluginFactory({key:T.heading3,isElement:!0,component:r5,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:l=>t.createElement(r5,{...l,styles:e})}),GL0="textstyle-heading4-plugin";class WL0 extends n0{constructor({styles:a=H0.heading4,...c}={}){super(T.heading4,{label:"Heading 4",markupElement:new qL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[KL0(this.styles)]}}class qL0 extends t0{constructor(l=GL0,a=o5){super(l,a)}}const o5=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("h4",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},KL0=e=>u.createPluginFactory({key:T.heading4,isElement:!0,component:o5,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:l=>t.createElement(o5,{...l,styles:e})}),$L0="textstyle-imageCaption-plugin";class XL0 extends n0{constructor({styles:a=H0.imageCaption,...c}={}){super(T.imageCaption,{label:"Image Caption",markupElement:new JL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[_L0(this.styles)]}}class JL0 extends t0{constructor(l=$L0,a=i5){super(l,a)}}const i5=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("p",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},_L0=e=>u.createPluginFactory({key:T.imageCaption,isElement:!0,component:i5,deserializeHtml:{rules:[{validClassName:T.imageCaption}]}})({component:l=>t.createElement(i5,{...l,styles:e})}),ed0="textstyle-imageTitle-plugin";class td0 extends n0{constructor({styles:a=H0.imageTitle,...c}={}){super(T.imageTitle,{label:"Image Title",markupElement:new ld0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[nd0(this.styles)]}}class ld0 extends t0{constructor(l=ed0,a=s5){super(l,a)}}const s5=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("p",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},nd0=e=>u.createPluginFactory({key:T.imageTitle,isElement:!0,component:s5,deserializeHtml:{rules:[{validClassName:T.imageTitle}]}})({component:l=>t.createElement(s5,{...l,styles:e})});class EV extends n0{constructor({styles:a=H0.p,...c}={}){super(T.p,{markupElement:new IV,label:"Body Text",...c});Y(this,"styles",{});this.styles=a}plugins(){return[xV(this.styles)]}}const MV="tw-m-0 tw-px-0 tw-py-0",K2=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align,o=g([r&&j0[r],MV,D0(e)]);return t.createElement("p",{...l,className:o,style:c},a)};class IV extends t0{constructor(l=T.p,a=K2){super(l,a)}}const xV=e=>u.createPluginFactory({...u.createParagraphPlugin(),key:T.p,isElement:!0,component:K2})({component:l=>t.createElement(K2,{...l,styles:e})}),ad0="textstyle-quote-plugin";class cd0 extends n0{constructor({styles:a=H0.quote,...c}={}){super(T.quote,{label:"Quote",markupElement:new rd0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[ZV(this.styles)]}}class rd0 extends t0{constructor(l=ad0,a=$2){super(l,a)}}const $2=({element:e,attributes:l,children:a,styles:c})=>{const r=e.align;return t.createElement("blockquote",{...l,className:g([r&&j0[r],D0(e)]),style:c},a)},ZV=e=>u.createPluginFactory({key:T.quote,isElement:!0,component:$2,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:l=>t.createElement($2,{...l,styles:e})});class pV extends n0{constructor({...a}){super(fV,{button:EL0(CL0,a.textStyles),...a});Y(this,"textStyles");this.textStyles=a.textStyles}plugins(){return this.textStyles.map(a=>a.plugins()).flat()}}const o3="[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline !tw-list-item",NV=({attributes:e,children:l,element:a})=>{const{styles:c}=C1();return t.createElement("li",{style:i3(a,c),...e,className:o3},l)};class SV extends t0{constructor(l=u.ELEMENT_LI,a=NV){super(l,a)}}const i3=(e,l)=>({...l[yV(e)??T.p],counterIncrement:"count"}),yV=e=>{let l;if(e.type==="a")l=e.children[0].textStyle;else if(e.children)for(const a of e.children){const c=yV(a);c&&(!l||c.startsWith(l))&&(l=c)}else l=e.textStyle;return l},od0=["[&>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)_'._']"],id0=(e,l)=>{const a=u.findNodePath(e,l);if(!a)return 0;const c=u.getNodeAncestors(e,a);return Array.from(c).filter(r=>r[0].type===u.ELEMENT_LI).length},s3=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 ${od0[e%3]}`,m3={counterReset:"count"},RV=({attributes:e,children:l,element:a})=>{const c=u.usePlateEditorRef(),r=id0(c,a);return t.createElement("ol",{className:s3(r),...e,style:m3},l)};class bV extends t0{constructor(l=u.ELEMENT_OL,a=RV){super(l,a)}}const HV=({editor:e,id:l})=>t.createElement(I0,{id:l},t.createElement(u.ListToolbarButton,{tooltip:k0("Ordered list"),type:u.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(D5,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class kV extends r3{constructor(l){super({id:Re,button:HV,markupElement:new bV,...l})}}const L3="[&>li>p]:before:tw-content-['•'] [&>li>p]:before:tw-px-2 tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",zV=({attributes:e,children:l})=>t.createElement("ul",{className:L3,...e},l);class VV extends t0{constructor(l=u.ELEMENT_UL,a=zV){super(l,a)}}const TV=({editor:e,id:l})=>t.createElement(I0,{id:l},t.createElement(u.ListToolbarButton,{tooltip:k0("Bullet list"),type:u.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(T5,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class jV extends r3{constructor(l){super({id:Re,button:TV,markupElement:new VV,...l})}}class sd0{constructor(){Y(this,"toolbarButtons",{[u0.BOTTOM]:[],[u0.FLOATING]:[],[u0.TOP]:[]})}createGroupOfButtons(l){const a=[],c=[],r=[];for(const{markupElement:o,button:i,id:s,showIn:m}of l){if(!i)continue;const L={id:(o==null?void 0:o.getId())||s,button:i};m.includes(u0.BOTTOM)&&a.push(L),m.includes(u0.TOP)&&c.push(L),m.includes(u0.FLOATING)&&r.push(L)}a.length>0&&this.toolbarButtons[u0.BOTTOM].push(a),c.length>0&&this.toolbarButtons[u0.TOP].push(c),r.length>0&&this.toolbarButtons[u0.FLOATING].push(r)}at(l){return this.toolbarButtons[l]}}class DV{constructor(l){Y(this,"platePlugins",new Map);Y(this,"markupElements",{});Y(this,"inlineElements",[]);Y(this,"toolbarButtons",new sd0);Y(this,"styles",{});this.props=l}setPlugin(...l){for(const a of l){const c=Array.isArray(a)?a:[a];for(const r of c)this.addElement(r.markupElement),this.addElement(r.markupInputElement),this.addLeafElements(r.leafMarkupElements),this.addPlugin(r),this.addInline(r.inline()),r.styles&&this.addStyles(r.styles,r.id),r.textStyles&&this.addTextStylesOfSubPlugins(r.textStyles);this.hasToolbar&&this.toolbarButtons.createGroupOfButtons(c)}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 c of a)this.addElement(c)}addElement(l){if(l===void 0)return;const a=l.getId(),c=l.getNode();c&&!this.markupElements[a]&&(this.markupElements[a]=c)}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 c of a){const{key:r,component:o}=c;o&&(l[r]=o)}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 FV="reset-formatting-plugin",BV="reset-formatting",md0=e=>{!e||!e.selection||(u.removeMark(e,{key:[u.MARK_BOLD,u.MARK_ITALIC,u.MARK_CODE,u.MARK_UNDERLINE,u.MARK_STRIKETHROUGH]}),u.unwrapList(e,{}),u.setElements(e,{type:u.ELEMENT_PARAGRAPH,align:void 0}))},Ld0=u.withPlateProvider(({id:e,...l})=>{const a=u.usePlateEditorState(u.useEventPlateId(e));return t.createElement(u.ToolbarButton,{tooltip:k0("Clear formatting"),onMouseDown:()=>{md0(a)},...l})}),dd0=({id:e})=>t.createElement(I0,{id:e},t.createElement(Ld0,{icon:t.createElement(S0,{icon:t.createElement(H5,null)}),classNames:M0(),styles:y0})),OV=u.createPluginFactory({key:BV,isElement:!1});class PV extends n0{constructor(l){super(FV,{button:dd0,...l})}plugins(){return[OV()]}}const ud0="strikethrough-plugin",d3="!tw-line-through",UV=({attributes:e,children:l})=>t.createElement("span",{...e,className:d3},l);class QV extends t0{constructor(l=u.MARK_STRIKETHROUGH,a=UV){super(l,a)}}const wd0=({editor:e,id:l})=>t.createElement(I0,{id:l},t.createElement(u.MarkToolbarButton,{tooltip:k0("Strikethrough"),type:u.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(ab,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class YV extends n0{constructor(l){super(ud0,{button:wd0,markupElement:new QV,...l})}plugins(){return[u.createStrikethroughPlugin()]}}const hd0="underline-plugin",be="tw-underline",GV=({attributes:e,children:l})=>t.createElement("span",{...e,className:be},l);class WV extends t0{constructor(l=u.MARK_UNDERLINE,a=GV){super(l,a)}}const fd0=({editor:e,id:l})=>t.createElement(I0,{id:l},t.createElement(u.MarkToolbarButton,{tooltip:k0(`Underline
|
|
39
39
|
${h2("Ctrl+U")}`),type:u.getPluginType(e,l),icon:t.createElement(S0,{icon:t.createElement(_5,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"})),vd0=[{validNodeName:["U"]},{validStyle:{textDecoration:["underline"]}}];class qV extends n0{constructor(l){super(hd0,{button:fd0,markupElement:new WV,...l})}plugins(){return[u.createUnderlinePlugin({deserializeHtml:{rules:[...vd0,{validNodeName:["SPAN"],validClassName:be}]},options:{hotkey:["mod+u","ctrl+u"]}})]}}const KV=e=>Array.from(u.getNodeEntries(e,{at:[],match:l=>!!l.breakAfterColumn})).length,t2=(e,{key:l=P1,value:a,at:c})=>{const r=o=>u.isBlock(e,o);a?u.setElements(e,{[l]:a},{mode:"lowest",match:r,at:c}):u.unsetNodes(e,l,{match:r,mode:"lowest",at:c})},gd0=(e,l,a)=>{t2(e,{at:l,value:a})},m5=(e,l)=>{const a=Array.from(u.getNodeEntries(e,{at:[],match:c=>!!c.breakAfterColumn}));for(const[c,[,r]]of a.entries())gd0(e,r,c<l-1?"active":"inactive")},$V=(e,l,a)=>{if(a.preventDefault(),a.stopPropagation(),!!(e!=null&&e.selection)&&u.someNode(e,{match:r=>!!r.breakAfterColumn}))t2(e,{value:void 0});else{const r=KV(e),o=Math.max(l-r-1,0);if(o===0)return;const i=Array.from(u.getNodeEntries(e,{at:e.selection,match:s=>u.isBlock(e,s),mode:"lowest"})).slice(-o);for(const s of i)t2(e,{value:"active",at:s[1]})}m5(e,l)},Ad0=(e,{options:{hotkey:l}})=>a=>{var c;if(!a.defaultPrevented&&l&&Nj(l,a)){const r=e.plugins.find(i=>i.key===P1),o=((c=r==null?void 0:r.options)==null?void 0:c.columns)??1;$V(e,o,a)}},Cd0=({id:e,...l})=>{var m,L;const a=u.usePlateEditorState(u.useEventPlateId(e)),c=!!(a!=null&&a.selection)&&u.someNode(a,{match:d=>!!d.breakAfterColumn}),r=(L=(m=a==null?void 0:a.pluginsByKey.breakAfterColumn)==null?void 0:m.options)==null?void 0:L.columns,o=Number(r)||1,i=Ed0(a,o,c),s=M0(i);return t.createElement(u.ToolbarButton,{active:c,tooltip:k0(i?`Column Break
|
|
40
40
|
Shift+Ctrl+Return`:"Already at maximum numbers of columns"),onMouseDown:d=>$V(a,o,d),...l,classNames:s})},Ed0=(e,l,a)=>KV(e)+1<l||a,XV=({id:e})=>t.createElement(I0,{id:e},t.createElement(Cd0,{icon:t.createElement(S0,{icon:t.createElement($5,null)}),classNames:M0(),styles:y0})),Md0=(e,l)=>{const a=u.getStartPoint(e,l);setTimeout(()=>{u.select(e,{anchor:a,focus:a})})},Id0=e=>{var a;const l=e.plugins.find(c=>c.key===P1);return((a=l==null?void 0:l.options)==null?void 0:a.columns)??1},xd0=e=>{const{apply:l}=e,a=Id0(e);e.apply=c=>{switch(c.type){case"split_node":c.properties={...c.properties,breakAfterColumn:void 0};break;case"merge_node":const r=u.getPointBefore(e,c.path);if(!r)break;const o=u.getParentNode(e,r.path);if(t2(e,{at:r,value:void 0}),m5(e,a),o!=null&&o[0].breakAfterColumn)return Md0(e,c.path),e;break}l(c)},setTimeout(()=>m5(e,a))},P1="breakAfterColumn",u3="normal";class Zd0 extends n0{constructor(a){super("break-after-plugin",{button:XV,...a});Y(this,"columns");Y(this,"gap");this.columns=(a==null?void 0:a.columns)??1,this.gap=(a==null?void 0:a.gap)??u3}plugins(){return[JV(this.columns,this.gap)]}}const JV=(e,l)=>u.createPluginFactory({key:P1,handlers:{onKeyDown:Ad0},useHooks:xd0,options:{columns:e,gap:l,hotkey:["shift+ctrl+enter"]}})(),pd0=12,Nd0=26,Sd0=124,yd0=e=>e.map((l,a)=>({group:l,buttonGroupWidth:l.reduce((c,r)=>r.id===fV?Sd0:Nd0+c,pd0),index:a})),Rd0=(e,l)=>l.reduce((a,{group:c,buttonGroupWidth:r,index:o})=>{const i=Math.max(0,a.length-1);return a[i]=a[i]??[],(a[i]??[{actions:[],buttonGroupWidth:0}]).reduce((m,{buttonGroupWidth:L})=>m+L,0)+r<=e?a[i].push({group:c,buttonGroupWidth:r,index:o}):a.push([{group:c,buttonGroupWidth:r,index:o}]),a.filter(m=>m.length)},[]),bd0=({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),Hd0=({toolbarButtons:e,editorId:l,toolbarWidth:a})=>{const c=u.usePlateEditorRef(l),{editorWidth:r}=Qz(),{position:o}=C1(),i=a||r||0,s=yd0(e.at(o)),m=Rd0(i,s),L=rT[o];return t.createElement(L.ToolbarWrapper,{editorWidth:r,toolbarWidth:a,toolbarButtonGroups:m},m.map((d,h)=>t.createElement("div",{className:"tw-divide-x tw-divide-line tw-flex tw-w-full tw-flex-wrap",key:h},d.map(({group:w,index:v})=>t.createElement(bd0,{index:v,key:v},w.map((f,C)=>t.createElement(f.button,{editor:c,editorId:l,id:f.id,key:C.toString()})))))))},_V=e=>u.createPlugins(e.plugins,{components:u.createPlateUI(e.elements)}),w3=(e,l)=>({create:()=>_V(l),toolbar:a=>l.hasToolbar?t.createElement(Hd0,{toolbarButtons:l.buttons,editorId:e,toolbarWidth:a}):null,inline:()=>t.createElement(t.Fragment,null,l.inline.map((a,c)=>t.createElement(a,{key:c}))),styles:()=>l.getStyles}),kd0="mention-plugin",zd0=e=>l=>l.text.toLowerCase().includes(e.toLowerCase()),h3=(e,l)=>`${e}:${l}`,f3=e=>{const l=new Map;for(const a of e){const c=h3(a.data.category,a.data.id),r=a.text;l.set(c,r)}return l},eT=(e,l,a)=>e.get(l)??a;var G0=(e=>(e.GROUP="group",e.ALL="all",e.USER="user",e))(G0||{});const v3=({attributes:e,element:l,nodeProps:a,children:c})=>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},c),Vd0=({children:e,...l})=>t.createElement(v3,{...l},t.createElement("span",{style:{paddingRight:"3px",display:"inline-block",margin:"-1px 0"}},t.createElement(re,null)),e),Td0=({children:e,...l})=>t.createElement(v3,{...l},"@",e),jd0=({children:e,...l})=>t.createElement(v3,{...l},e),Dd0=({category:e,children:l,...a})=>{const c={[G0.USER]:jd0,[G0.GROUP]:Vd0,[G0.ALL]:Td0},r=c[e]??c[G0.USER];return t.createElement(r,{...a},l)},g3=e=>l=>{const{element:a,children:c}=l,r=h3(a==null?void 0:a.category,String(a==null?void 0:a.id));return t.createElement(Dd0,{category:a==null?void 0:a.category,...l},eT(e,r,String(a==null?void 0:a.id)),c)};class tT extends t0{constructor(l=u.ELEMENT_MENTION){super(l)}setNodeWithMentionable(l){return this.node=g3(f3(l)),this}}const Fd0=({image:e,category:l,text:a,id:c})=>{if(e)return t.createElement("img",{src:e,alt:`${c}-${l}-${a}`});switch(l){case G0.GROUP:return t.createElement(re,null);case G0.ALL:return t.createElement(Q5,null);default:return t.createElement(O5,null)}},Bd0=({item:e})=>{const{data:{image:l,category:a},key:c,text:r}=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(Fd0,{image:l,category:a,text:r,id:c})),t.createElement("span",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis"},r))},v7=[`
|
|
41
41
|
color: var(--text-color-weak);
|