@frontify/fondue 12.0.0-beta.281 → 12.0.0-beta.282
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/OrderedListPlugin/OrderedListMarkupElement.es.js +9 -9
- package/dist/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/OrderedListMarkupElement.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,5 +1,5 @@
|
|
|
1
|
-
import { usePlateEditorRef as s, ELEMENT_OL as c, findNodePath as l, getNodeAncestors as p, ELEMENT_LI as
|
|
2
|
-
import
|
|
1
|
+
import { usePlateEditorRef as s, ELEMENT_OL as c, findNodePath as l, getNodeAncestors as p, ELEMENT_LI as a } from "@udecode/plate";
|
|
2
|
+
import i from "react";
|
|
3
3
|
import { MarkupElement as u } from "../../MarkupElement.es.js";
|
|
4
4
|
const m = [
|
|
5
5
|
"[&>li>p]:before:tw-content-[counter(count,decimal)_'._']",
|
|
@@ -10,24 +10,24 @@ const m = [
|
|
|
10
10
|
if (!t)
|
|
11
11
|
return 0;
|
|
12
12
|
const r = p(e, t);
|
|
13
|
-
return Array.from(r).filter((n) => n[0].type ===
|
|
14
|
-
},
|
|
13
|
+
return Array.from(r).filter((n) => n[0].type === a).length;
|
|
14
|
+
}, f = (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 ${m[e % 3]}`, E = { counterReset: "count" }, L = ({
|
|
15
15
|
attributes: e,
|
|
16
16
|
children: o,
|
|
17
17
|
element: t
|
|
18
18
|
}) => {
|
|
19
19
|
const r = s(), n = d(r, t);
|
|
20
|
-
return /* @__PURE__ */
|
|
20
|
+
return /* @__PURE__ */ i.createElement("ol", { className: f(n), ...e, style: E }, o);
|
|
21
21
|
};
|
|
22
|
-
class
|
|
22
|
+
class N extends u {
|
|
23
23
|
constructor(o = c, t = L) {
|
|
24
24
|
super(o, t);
|
|
25
25
|
}
|
|
26
26
|
}
|
|
27
27
|
export {
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
E as OL_STYLES,
|
|
29
|
+
N as OrderedListMarkupElement,
|
|
30
30
|
L as OrderedListMarkupElementNode,
|
|
31
|
-
|
|
31
|
+
f as getOrderedListClasses
|
|
32
32
|
};
|
|
33
33
|
//# sourceMappingURL=OrderedListMarkupElement.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OrderedListMarkupElement.es.js","sources":["../../../../../../src/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/OrderedListMarkupElement.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n ELEMENT_LI,\n ELEMENT_OL,\n PlateEditor,\n PlateRenderLeafProps,\n TElement,\n findNodePath,\n getNodeAncestors,\n usePlateEditorRef,\n} from '@udecode/plate';\nimport React from 'react';\nimport { MarkupElement } from '../../MarkupElement';\n\nconst LIST_TYPES = [\n \"[&>li>p]:before:tw-content-[counter(count,decimal)_'._']\",\n \"[&>li>p]:before:tw-content-[counter(count,_lower-alpha)_'._']\",\n \"[&>li>p]:before:tw-content-[counter(count,lower-roman)_'._']\",\n];\n\nconst getNestingLevel = (editor: PlateEditor, element: TElement) => {\n const path = findNodePath(editor, element);\n if (!path) {\n return 0;\n }\n\n const nodeAncestors = getNodeAncestors(editor, path);\n return Array.from(nodeAncestors).filter((node) => node[0].type === ELEMENT_LI).length;\n};\n\nexport const getOrderedListClasses = (nestingLevel: number) =>\n `tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] [&>li>p]:before:tw-pr-1 ${LIST_TYPES[nestingLevel % 3]}`;\nexport const OL_STYLES = { counterReset: 'count' };\n\nexport const OrderedListMarkupElementNode = ({\n attributes,\n children,\n element,\n}: PlateRenderLeafProps & { element: TElement }) => {\n const editor = usePlateEditorRef();\n const nestingLevel = getNestingLevel(editor, element);\n\n return (\n <ol className={getOrderedListClasses(nestingLevel)} {...attributes} style={OL_STYLES}>\n {children}\n </ol>\n );\n};\n\nexport class OrderedListMarkupElement extends MarkupElement {\n constructor(id = ELEMENT_OL, node = OrderedListMarkupElementNode) {\n super(id, node);\n }\n}\n"],"names":["LIST_TYPES","getNestingLevel","editor","element","path","findNodePath","nodeAncestors","getNodeAncestors","node","ELEMENT_LI","getOrderedListClasses","nestingLevel","OL_STYLES","OrderedListMarkupElementNode","attributes","children","usePlateEditorRef","React","OrderedListMarkupElement","MarkupElement","id","ELEMENT_OL"],"mappings":";;;AAeA,MAAMA,IAAa;AAAA,EACf;AAAA,EACA;AAAA,EACA;AACJ,GAEMC,IAAkB,CAACC,GAAqBC,MAAsB;AAC1D,QAAAC,IAAOC,EAAaH,GAAQC,CAAO;AACzC,MAAI,CAACC;AACM,WAAA;AAGL,QAAAE,IAAgBC,EAAiBL,GAAQE,CAAI;AACnD,SAAO,MAAM,KAAKE,CAAa,EAAE,OAAO,CAACE,MAASA,EAAK,CAAC,EAAE,SAASC,CAAU,EAAE;AACnF,GAEaC,IAAwB,CAACC,MAClC,+
|
|
1
|
+
{"version":3,"file":"OrderedListMarkupElement.es.js","sources":["../../../../../../src/components/RichTextEditor/Plugins/ListPlugin/OrderedListPlugin/OrderedListMarkupElement.tsx"],"sourcesContent":["/* (c) Copyright Frontify Ltd., all rights reserved. */\n\nimport {\n ELEMENT_LI,\n ELEMENT_OL,\n PlateEditor,\n PlateRenderLeafProps,\n TElement,\n findNodePath,\n getNodeAncestors,\n usePlateEditorRef,\n} from '@udecode/plate';\nimport React from 'react';\nimport { MarkupElement } from '../../MarkupElement';\n\nconst LIST_TYPES = [\n \"[&>li>p]:before:tw-content-[counter(count,decimal)_'._']\",\n \"[&>li>p]:before:tw-content-[counter(count,_lower-alpha)_'._']\",\n \"[&>li>p]:before:tw-content-[counter(count,lower-roman)_'._']\",\n];\n\nconst getNestingLevel = (editor: PlateEditor, element: TElement) => {\n const path = findNodePath(editor, element);\n if (!path) {\n return 0;\n }\n\n const nodeAncestors = getNodeAncestors(editor, path);\n return Array.from(nodeAncestors).filter((node) => node[0].type === ELEMENT_LI).length;\n};\n\nexport const getOrderedListClasses = (nestingLevel: number) =>\n `tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] [&>li>p]:before:tw-pr-1 [&>li>p]:before:tw-tabular-nums ${\n LIST_TYPES[nestingLevel % 3]\n }`;\nexport const OL_STYLES = { counterReset: 'count' };\n\nexport const OrderedListMarkupElementNode = ({\n attributes,\n children,\n element,\n}: PlateRenderLeafProps & { element: TElement }) => {\n const editor = usePlateEditorRef();\n const nestingLevel = getNestingLevel(editor, element);\n\n return (\n <ol className={getOrderedListClasses(nestingLevel)} {...attributes} style={OL_STYLES}>\n {children}\n </ol>\n );\n};\n\nexport class OrderedListMarkupElement extends MarkupElement {\n constructor(id = ELEMENT_OL, node = OrderedListMarkupElementNode) {\n super(id, node);\n }\n}\n"],"names":["LIST_TYPES","getNestingLevel","editor","element","path","findNodePath","nodeAncestors","getNodeAncestors","node","ELEMENT_LI","getOrderedListClasses","nestingLevel","OL_STYLES","OrderedListMarkupElementNode","attributes","children","usePlateEditorRef","React","OrderedListMarkupElement","MarkupElement","id","ELEMENT_OL"],"mappings":";;;AAeA,MAAMA,IAAa;AAAA,EACf;AAAA,EACA;AAAA,EACA;AACJ,GAEMC,IAAkB,CAACC,GAAqBC,MAAsB;AAC1D,QAAAC,IAAOC,EAAaH,GAAQC,CAAO;AACzC,MAAI,CAACC;AACM,WAAA;AAGL,QAAAE,IAAgBC,EAAiBL,GAAQE,CAAI;AACnD,SAAO,MAAM,KAAKE,CAAa,EAAE,OAAO,CAACE,MAASA,EAAK,CAAC,EAAE,SAASC,CAAU,EAAE;AACnF,GAEaC,IAAwB,CAACC,MAClC,+GACIX,EAAWW,IAAe,CAAC,KAEtBC,IAAY,EAAE,cAAc,QAAQ,GAEpCC,IAA+B,CAAC;AAAA,EACzC,YAAAC;AAAA,EACA,UAAAC;AAAA,EACA,SAAAZ;AACJ,MAAoD;AAChD,QAAMD,IAASc,KACTL,IAAeV,EAAgBC,GAAQC,CAAO;AAGhD,SAAA,gBAAAc,EAAA,cAAC,MAAG,EAAA,WAAWP,EAAsBC,CAAY,GAAI,GAAGG,GAAY,OAAOF,EAAA,GACtEG,CACL;AAER;AAEO,MAAMG,UAAiCC,EAAc;AAAA,EACxD,YAAYC,IAAKC,GAAYb,IAAOK,GAA8B;AAC9D,UAAMO,GAAIZ,CAAI;AAAA,EAClB;AACJ;"}
|
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
|
`]},Tm0={renderAfterEditable:km0};class nV extends n0{constructor(l){super(Sm0,{button:Hm0,showIn:[u0.BOTTOM,u0.TOP],...l})}plugins(){return[u.createComboboxPlugin(),u.createEmojiPlugin(Tm0)]}}const jm0="soft-break-plugin";class aV extends n0{constructor(l){super(jm0,{...l})}plugins(){return[u.createSoftBreakPlugin()]}}const Dm0="italic-plugin",ye="tw-italic",cV=({attributes:e,children:l})=>t.createElement("span",{...e,className:ye},l);class rV extends t0{constructor(l=u.MARK_ITALIC,a=cV){super(l,a)}}const Fm0=({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(X5,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"})),Bm0=[{validNodeName:["EM","I"]},{validStyle:{fontStyle:"italic"}}];class oV extends n0{constructor(l){super(Dm0,{button:Fm0,markupElement:new rV,...l})}plugins(){return[u.createItalicPlugin({deserializeHtml:{rules:[...Bm0,{validNodeName:["SPAN"],validClassName:ye}]},options:{hotkey:["mod+i","ctrl+i"]}})]}}const Om0=e=>!!e.match(/^(https?:\/\/|mailto:|tel:).+/),Pm0=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)}),Um0=u.createComponentAs(e=>{var a;const l=qm0({...e,floatingOptions:{strategy:"fixed"}});return((a=l.style)==null?void 0:a.display)==="none"?null:u.createElementAs("div",l)});u.FloatingLink.EditRoot=Um0;u.FloatingLink.InsertRoot=Pm0;const W2=u.FloatingLink,k1="link-plugin",Qm0=()=>{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(F5,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(_5,null))))))},l3=(e,l)=>{const a=u.getAboveNode(e,{match:{type:u.ELEMENT_LINK}});return Array.isArray(a)?l(a[0]):""},Ym0=e=>l3(e,l=>{var a,c;return((c=(a=l.chosenLink)==null?void 0:a.searchResult)==null?void 0:c.link)||""}),Gm0=e=>l3(e,l=>l.url||""),iV=e=>{var l,a;return e.url||((a=(l=e.chosenLink)==null?void 0:l.searchResult)==null?void 0:a.link)||""},Wm0=e=>l3(e,iV),qm0=({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=Wm0(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)}},Km0=({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(N5,null),disabled:!i()||!s},"Save")))),$m0={url:"",text:"",newTab:A0.Unchecked},Xm0=()=>{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}},$m0);return[e,l]},Jm0=()=>{const e=u.useEditorRef(),[l,a]=Xm0();t.useEffect(()=>{const d=Ym0(e),h=Gm0(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}},_m0=()=>t.createElement(Km0,{...Jm0(),testId:"floating-link-insert"}),eL0=({readOnly:e})=>{const l=u.useFloatingLinkSelectors().isEditing();if(e)return null;const a=t.createElement(_m0,null),c=l?a:t.createElement(Qm0,null);return t.createElement(t.Fragment,null,t.createElement(W2.InsertRoot,null,a),t.createElement(W2.EditRoot,null,c))},tL0=({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(z5,null)}),classNames:r,styles:y0,actionHandler:"onMouseDown"}))},lL0=e=>({...u.useElementProps({...e,elementToAttributes:a=>({href:iV(a),target:a.target||"_blank"})}),onMouseOver:a=>{a.stopPropagation()}}),nL0=e=>{const l=lL0(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 aL0 extends t0{constructor(l=u.ELEMENT_LINK,a=nL0){super(l,a)}}const sV=u.createPluginFactory({...u.createLinkPlugin(),renderAfterEditable:eL0,options:{isUrl:Om0,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class mV extends n0{constructor({styles:a=H0[k1],...c}={}){super(k1,{button:tL0,markupElement:new aL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[sV()]}}const n3="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",LV=`${n3} tw-break-after-column tw-break-inside-avoid-column`,D0=e=>{const l=e.breakAfterColumn;return g([l==="active"&&LV,l==="inactive"&&n3])},a3=e=>g([D0(e),e.align?Jt[e.align]:"tw-justify-start","tw-grid tw-grid-cols-[min-content_repeat(3,_auto)]"]),dV=({attributes:e,children:l,element:a})=>t.createElement("p",{className:a3(a),...e},t.createElement("span",{className:"tw-w-auto tw-min-w-[10px]"},l));class uV extends t0{constructor(l=u.ELEMENT_LIC,a=dV){super(l,a)}}const wV="text-style-plugin",Re="list-plugin",cL0=(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",hV=u.createPluginFactory({key:e2,isLeaf:!0});class c3 extends n0{constructor(a){super(Re,{leafMarkupElements:[new uV,new pV],...a});Y(this,"isSoftBreak");this.isSoftBreak=(a==null?void 0:a.isSoftBreak)??!1}plugins(){return[u.createListPlugin({withOverrides:cL0,options:{isSoftBreak:this.isSoftBreak}}),hV()]}}const rL0=e=>u.getAboveNode(e,{match:{type:u.ELEMENT_LI},mode:"lowest"})||u.someNode(e,{match:{type:J0},mode:"lowest"}),oL0=({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}),rL0(e)||u.toggleNodeType(e,{activeType:l.id,inactiveType:l.id}))}},a)},iL0=({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(p5,null)))),sL0=t.forwardRef(iL0),mL0=e=>Array.isArray(e.children)?(e.children.find(a=>u.isText(a))??{})[e2]:u.ELEMENT_PARAGRAPH,LL0=[u.ELEMENT_LI,u.ELEMENT_UL,u.ELEMENT_OL],dL0=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?mL0(c):c.textStyle;return r&&!a.includes(r)&&!LL0.includes(r)&&a.push(r),a},[]),uL0=6,wL0=10,hL0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:a,maxHeight:c}=bt(e.elements.reference,e.rects.popper.height,uL0+wL0,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 fL0=e=>{const[l,a]=t.useState(!1),[c,r]=t.useState(null),[o,i]=t.useState(null),s=u.usePlateEditorState(e),m=dL0(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},hL0]});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}},vL0=({editorId:e,textStyles:l=[]})=>{var h;const{state:{editor:a,toggle:c,isOpen:r},dropdownProps:o,triggerRef:i,dropdownRef:s,key:m}=fL0(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(sL0,{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(oL0,{editor:a,type:w,key:w.id},t.createElement("span",{style:w.styles??{}},(v=w.props)==null?void 0:v.label))})))},gL0=({editorId:e,id:l,textStyles:a})=>t.createElement(I0,{id:l},t.createElement(vL0,{editorId:e,textStyles:a})),AL0=(e,l)=>a=>t.createElement(e,{...a,textStyles:l}),CL0="textstyle-custom1-plugin";class EL0 extends n0{constructor({styles:a=H0.custom1,...c}={}){super(T.custom1,{label:"Custom 1",markupElement:new ML0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[IL0(this.styles)]}}class ML0 extends t0{constructor(l=CL0,a=fV){super(l,a)}}const fV=({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)},IL0=e=>u.createPluginFactory({key:T.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom1}]}})({component:l=>t.createElement(fV,{...l,styles:e})}),xL0="textstyle-custom2-plugin";class ZL0 extends n0{constructor({styles:a=H0.custom2,...c}={}){super(T.custom2,{label:"Custom 2",markupElement:new pL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[NL0(this.styles)]}}class pL0 extends t0{constructor(l=xL0,a=vV){super(l,a)}}const vV=({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)},NL0=e=>u.createPluginFactory({key:T.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom2}]}})({component:l=>t.createElement(vV,{...l,styles:e})}),SL0="textstyle-custom3-plugin";class yL0 extends n0{constructor({styles:a=H0.custom3,...c}={}){super(T.custom3,{label:"Custom 3",markupElement:new RL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[bL0(this.styles)]}}class RL0 extends t0{constructor(l=SL0,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)},bL0=e=>u.createPluginFactory({key:T.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom3}]}})({component:l=>t.createElement(gV,{...l,styles:e})}),HL0="textstyle-heading1-plugin";class kL0 extends n0{constructor({styles:a=H0.heading1,...c}={}){super(T.heading1,{label:"Heading 1",markupElement:new zL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[VL0(this.styles)]}}class zL0 extends t0{constructor(l=HL0,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)},VL0=e=>u.createPluginFactory({key:T.heading1,isElement:!0,component:a5,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:l=>t.createElement(a5,{...l,styles:e})}),TL0="textstyle-heading2-plugin";class jL0 extends n0{constructor({styles:a=H0.heading2,...c}={}){super(T.heading2,{label:"Heading 2",markupElement:new DL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[FL0(this.styles)]}}class DL0 extends t0{constructor(l=TL0,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)},FL0=e=>u.createPluginFactory({key:T.heading2,isElement:!0,component:c5,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:l=>t.createElement(c5,{...l,styles:e})}),BL0="textstyle-heading3-plugin";class OL0 extends n0{constructor({styles:a=H0.heading3,...c}={}){super(T.heading3,{label:"Heading 3",markupElement:new PL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[UL0(this.styles)]}}class PL0 extends t0{constructor(l=BL0,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)},UL0=e=>u.createPluginFactory({key:T.heading3,isElement:!0,component:r5,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:l=>t.createElement(r5,{...l,styles:e})}),QL0="textstyle-heading4-plugin";class YL0 extends n0{constructor({styles:a=H0.heading4,...c}={}){super(T.heading4,{label:"Heading 4",markupElement:new GL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[WL0(this.styles)]}}class GL0 extends t0{constructor(l=QL0,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)},WL0=e=>u.createPluginFactory({key:T.heading4,isElement:!0,component:o5,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:l=>t.createElement(o5,{...l,styles:e})}),qL0="textstyle-imageCaption-plugin";class KL0 extends n0{constructor({styles:a=H0.imageCaption,...c}={}){super(T.imageCaption,{label:"Image Caption",markupElement:new $L0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[XL0(this.styles)]}}class $L0 extends t0{constructor(l=qL0,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)},XL0=e=>u.createPluginFactory({key:T.imageCaption,isElement:!0,component:i5,deserializeHtml:{rules:[{validClassName:T.imageCaption}]}})({component:l=>t.createElement(i5,{...l,styles:e})}),JL0="textstyle-imageTitle-plugin";class _L0 extends n0{constructor({styles:a=H0.imageTitle,...c}={}){super(T.imageTitle,{label:"Image Title",markupElement:new ed0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[td0(this.styles)]}}class ed0 extends t0{constructor(l=JL0,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)},td0=e=>u.createPluginFactory({key:T.imageTitle,isElement:!0,component:s5,deserializeHtml:{rules:[{validClassName:T.imageTitle}]}})({component:l=>t.createElement(s5,{...l,styles:e})});class AV extends n0{constructor({styles:a=H0.p,...c}={}){super(T.p,{markupElement:new EV,label:"Body Text",...c});Y(this,"styles",{});this.styles=a}plugins(){return[MV(this.styles)]}}const CV="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],CV,D0(e)]);return t.createElement("p",{...l,className:o,style:c},a)};class EV extends t0{constructor(l=T.p,a=K2){super(l,a)}}const MV=e=>u.createPluginFactory({...u.createParagraphPlugin(),key:T.p,isElement:!0,component:K2})({component:l=>t.createElement(K2,{...l,styles:e})}),ld0="textstyle-quote-plugin";class nd0 extends n0{constructor({styles:a=H0.quote,...c}={}){super(T.quote,{label:"Quote",markupElement:new ad0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[IV(this.styles)]}}class ad0 extends t0{constructor(l=ld0,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)},IV=e=>u.createPluginFactory({key:T.quote,isElement:!0,component:$2,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:l=>t.createElement($2,{...l,styles:e})});class xV extends n0{constructor({...a}){super(wV,{button:AL0(gL0,a.textStyles),...a});Y(this,"textStyles");this.textStyles=a.textStyles}plugins(){return this.textStyles.map(a=>a.plugins()).flat()}}const r3="[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline",ZV=({attributes:e,children:l,element:a})=>{const{styles:c}=C1();return t.createElement("li",{style:o3(a,c),...e,className:r3},l)};class pV extends t0{constructor(l=u.ELEMENT_LI,a=ZV){super(l,a)}}const o3=(e,l)=>({...l[NV(e)??T.p],counterIncrement:"count"}),NV=e=>{let l;if(e.type==="a")l=e.children[0].textStyle;else if(e.children)for(const a of e.children){const c=NV(a);c&&(!l||c.startsWith(l))&&(l=c)}else l=e.textStyle;return l},cd0=["[&>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)_'._']"],rd0=(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},i3=e=>`tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px] [&>li>p]:before:tw-pr-1 ${cd0[e%3]}`,s3={counterReset:"count"},SV=({attributes:e,children:l,element:a})=>{const c=u.usePlateEditorRef(),r=rd0(c,a);return t.createElement("ol",{className:i3(r),...e,style:s3},l)};class yV extends t0{constructor(l=u.ELEMENT_OL,a=SV){super(l,a)}}const RV=({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(j5,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class bV extends c3{constructor(l){super({id:Re,button:RV,markupElement:new yV,...l})}}const m3="[&>li>p]:before:tw-content-['•'] [&>li>p]:before:tw-px-2 tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",HV=({attributes:e,children:l})=>t.createElement("ul",{className:m3,...e},l);class kV extends t0{constructor(l=u.ELEMENT_UL,a=HV){super(l,a)}}const zV=({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(V5,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class VV extends c3{constructor(l){super({id:Re,button:zV,markupElement:new kV,...l})}}class od0{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 TV{constructor(l){Y(this,"platePlugins",new Map);Y(this,"markupElements",{});Y(this,"inlineElements",[]);Y(this,"toolbarButtons",new od0);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 jV="reset-formatting-plugin",DV="reset-formatting",id0=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}))},sd0=u.withPlateProvider(({id:e,...l})=>{const a=u.usePlateEditorState(u.useEventPlateId(e));return t.createElement(u.ToolbarButton,{tooltip:k0("Clear formatting"),onMouseDown:()=>{id0(a)},...l})}),md0=({id:e})=>t.createElement(I0,{id:e},t.createElement(sd0,{icon:t.createElement(S0,{icon:t.createElement(b5,null)}),classNames:M0(),styles:y0})),FV=u.createPluginFactory({key:DV,isElement:!1});class BV extends n0{constructor(l){super(jV,{button:md0,...l})}plugins(){return[FV()]}}const Ld0="strikethrough-plugin",L3="!tw-line-through",OV=({attributes:e,children:l})=>t.createElement("span",{...e,className:L3},l);class PV extends t0{constructor(l=u.MARK_STRIKETHROUGH,a=OV){super(l,a)}}const dd0=({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(lb,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class UV extends n0{constructor(l){super(Ld0,{button:dd0,markupElement:new PV,...l})}plugins(){return[u.createStrikethroughPlugin()]}}const ud0="underline-plugin",be="tw-underline",QV=({attributes:e,children:l})=>t.createElement("span",{...e,className:be},l);class YV extends t0{constructor(l=u.MARK_UNDERLINE,a=QV){super(l,a)}}const wd0=({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(z5,null)}),classNames:r,styles:y0,actionHandler:"onMouseDown"}))},lL0=e=>({...u.useElementProps({...e,elementToAttributes:a=>({href:iV(a),target:a.target||"_blank"})}),onMouseOver:a=>{a.stopPropagation()}}),nL0=e=>{const l=lL0(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 aL0 extends t0{constructor(l=u.ELEMENT_LINK,a=nL0){super(l,a)}}const sV=u.createPluginFactory({...u.createLinkPlugin(),renderAfterEditable:eL0,options:{isUrl:Om0,rangeBeforeOptions:{matchString:" ",skipInvalid:!0,afterMatch:!0},triggerFloatingLinkHotkeys:"command+k, ctrl+k"}});class mV extends n0{constructor({styles:a=H0[k1],...c}={}){super(k1,{button:tL0,markupElement:new aL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[sV()]}}const n3="tw-border-b tw-border-dashed tw-border-line-x-strong tw-pb-5",LV=`${n3} tw-break-after-column tw-break-inside-avoid-column`,D0=e=>{const l=e.breakAfterColumn;return g([l==="active"&&LV,l==="inactive"&&n3])},a3=e=>g([D0(e),e.align?Jt[e.align]:"tw-justify-start","tw-grid tw-grid-cols-[min-content_repeat(3,_auto)]"]),dV=({attributes:e,children:l,element:a})=>t.createElement("p",{className:a3(a),...e},t.createElement("span",{className:"tw-w-auto tw-min-w-[10px]"},l));class uV extends t0{constructor(l=u.ELEMENT_LIC,a=dV){super(l,a)}}const wV="text-style-plugin",Re="list-plugin",cL0=(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",hV=u.createPluginFactory({key:e2,isLeaf:!0});class c3 extends n0{constructor(a){super(Re,{leafMarkupElements:[new uV,new pV],...a});Y(this,"isSoftBreak");this.isSoftBreak=(a==null?void 0:a.isSoftBreak)??!1}plugins(){return[u.createListPlugin({withOverrides:cL0,options:{isSoftBreak:this.isSoftBreak}}),hV()]}}const rL0=e=>u.getAboveNode(e,{match:{type:u.ELEMENT_LI},mode:"lowest"})||u.someNode(e,{match:{type:J0},mode:"lowest"}),oL0=({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}),rL0(e)||u.toggleNodeType(e,{activeType:l.id,inactiveType:l.id}))}},a)},iL0=({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(p5,null)))),sL0=t.forwardRef(iL0),mL0=e=>Array.isArray(e.children)?(e.children.find(a=>u.isText(a))??{})[e2]:u.ELEMENT_PARAGRAPH,LL0=[u.ELEMENT_LI,u.ELEMENT_UL,u.ELEMENT_OL],dL0=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?mL0(c):c.textStyle;return r&&!a.includes(r)&&!LL0.includes(r)&&a.push(r),a},[]),uL0=6,wL0=10,hL0={name:"vertical-positioning",phase:"read",fn:({state:e,name:l})=>{if(e.modifiersData[l]._skip)return;const{position:a,maxHeight:c}=bt(e.elements.reference,e.rects.popper.height,uL0+wL0,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 fL0=e=>{const[l,a]=t.useState(!1),[c,r]=t.useState(null),[o,i]=t.useState(null),s=u.usePlateEditorState(e),m=dL0(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},hL0]});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}},vL0=({editorId:e,textStyles:l=[]})=>{var h;const{state:{editor:a,toggle:c,isOpen:r},dropdownProps:o,triggerRef:i,dropdownRef:s,key:m}=fL0(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(sL0,{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(oL0,{editor:a,type:w,key:w.id},t.createElement("span",{style:w.styles??{}},(v=w.props)==null?void 0:v.label))})))},gL0=({editorId:e,id:l,textStyles:a})=>t.createElement(I0,{id:l},t.createElement(vL0,{editorId:e,textStyles:a})),AL0=(e,l)=>a=>t.createElement(e,{...a,textStyles:l}),CL0="textstyle-custom1-plugin";class EL0 extends n0{constructor({styles:a=H0.custom1,...c}={}){super(T.custom1,{label:"Custom 1",markupElement:new ML0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[IL0(this.styles)]}}class ML0 extends t0{constructor(l=CL0,a=fV){super(l,a)}}const fV=({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)},IL0=e=>u.createPluginFactory({key:T.custom1,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom1}]}})({component:l=>t.createElement(fV,{...l,styles:e})}),xL0="textstyle-custom2-plugin";class ZL0 extends n0{constructor({styles:a=H0.custom2,...c}={}){super(T.custom2,{label:"Custom 2",markupElement:new pL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[NL0(this.styles)]}}class pL0 extends t0{constructor(l=xL0,a=vV){super(l,a)}}const vV=({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)},NL0=e=>u.createPluginFactory({key:T.custom2,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom2}]}})({component:l=>t.createElement(vV,{...l,styles:e})}),SL0="textstyle-custom3-plugin";class yL0 extends n0{constructor({styles:a=H0.custom3,...c}={}){super(T.custom3,{label:"Custom 3",markupElement:new RL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[bL0(this.styles)]}}class RL0 extends t0{constructor(l=SL0,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)},bL0=e=>u.createPluginFactory({key:T.custom3,isElement:!0,deserializeHtml:{rules:[{validClassName:T.custom3}]}})({component:l=>t.createElement(gV,{...l,styles:e})}),HL0="textstyle-heading1-plugin";class kL0 extends n0{constructor({styles:a=H0.heading1,...c}={}){super(T.heading1,{label:"Heading 1",markupElement:new zL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[VL0(this.styles)]}}class zL0 extends t0{constructor(l=HL0,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)},VL0=e=>u.createPluginFactory({key:T.heading1,isElement:!0,component:a5,deserializeHtml:{rules:[{validNodeName:["h1","H1"]}]}})({component:l=>t.createElement(a5,{...l,styles:e})}),TL0="textstyle-heading2-plugin";class jL0 extends n0{constructor({styles:a=H0.heading2,...c}={}){super(T.heading2,{label:"Heading 2",markupElement:new DL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[FL0(this.styles)]}}class DL0 extends t0{constructor(l=TL0,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)},FL0=e=>u.createPluginFactory({key:T.heading2,isElement:!0,component:c5,deserializeHtml:{rules:[{validNodeName:["h2","H2"]}]}})({component:l=>t.createElement(c5,{...l,styles:e})}),BL0="textstyle-heading3-plugin";class OL0 extends n0{constructor({styles:a=H0.heading3,...c}={}){super(T.heading3,{label:"Heading 3",markupElement:new PL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[UL0(this.styles)]}}class PL0 extends t0{constructor(l=BL0,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)},UL0=e=>u.createPluginFactory({key:T.heading3,isElement:!0,component:r5,deserializeHtml:{rules:[{validNodeName:["h3","H3"]}]}})({component:l=>t.createElement(r5,{...l,styles:e})}),QL0="textstyle-heading4-plugin";class YL0 extends n0{constructor({styles:a=H0.heading4,...c}={}){super(T.heading4,{label:"Heading 4",markupElement:new GL0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[WL0(this.styles)]}}class GL0 extends t0{constructor(l=QL0,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)},WL0=e=>u.createPluginFactory({key:T.heading4,isElement:!0,component:o5,deserializeHtml:{rules:[{validNodeName:["h4","H4"]}]}})({component:l=>t.createElement(o5,{...l,styles:e})}),qL0="textstyle-imageCaption-plugin";class KL0 extends n0{constructor({styles:a=H0.imageCaption,...c}={}){super(T.imageCaption,{label:"Image Caption",markupElement:new $L0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[XL0(this.styles)]}}class $L0 extends t0{constructor(l=qL0,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)},XL0=e=>u.createPluginFactory({key:T.imageCaption,isElement:!0,component:i5,deserializeHtml:{rules:[{validClassName:T.imageCaption}]}})({component:l=>t.createElement(i5,{...l,styles:e})}),JL0="textstyle-imageTitle-plugin";class _L0 extends n0{constructor({styles:a=H0.imageTitle,...c}={}){super(T.imageTitle,{label:"Image Title",markupElement:new ed0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[td0(this.styles)]}}class ed0 extends t0{constructor(l=JL0,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)},td0=e=>u.createPluginFactory({key:T.imageTitle,isElement:!0,component:s5,deserializeHtml:{rules:[{validClassName:T.imageTitle}]}})({component:l=>t.createElement(s5,{...l,styles:e})});class AV extends n0{constructor({styles:a=H0.p,...c}={}){super(T.p,{markupElement:new EV,label:"Body Text",...c});Y(this,"styles",{});this.styles=a}plugins(){return[MV(this.styles)]}}const CV="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],CV,D0(e)]);return t.createElement("p",{...l,className:o,style:c},a)};class EV extends t0{constructor(l=T.p,a=K2){super(l,a)}}const MV=e=>u.createPluginFactory({...u.createParagraphPlugin(),key:T.p,isElement:!0,component:K2})({component:l=>t.createElement(K2,{...l,styles:e})}),ld0="textstyle-quote-plugin";class nd0 extends n0{constructor({styles:a=H0.quote,...c}={}){super(T.quote,{label:"Quote",markupElement:new ad0,...c});Y(this,"styles",{});this.styles=a}plugins(){return[IV(this.styles)]}}class ad0 extends t0{constructor(l=ld0,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)},IV=e=>u.createPluginFactory({key:T.quote,isElement:!0,component:$2,deserializeHtml:{rules:[{validNodeName:["blockquote","BLOCKQUOTE"]}]}})({component:l=>t.createElement($2,{...l,styles:e})});class xV extends n0{constructor({...a}){super(wV,{button:AL0(gL0,a.textStyles),...a});Y(this,"textStyles");this.textStyles=a.textStyles}plugins(){return this.textStyles.map(a=>a.plugins()).flat()}}const r3="[&>p]:before:tw-flex [&>p]:before:tw-justify-end [&>p]:before:tw-w-[1.2em] !tw-no-underline",ZV=({attributes:e,children:l,element:a})=>{const{styles:c}=C1();return t.createElement("li",{style:o3(a,c),...e,className:r3},l)};class pV extends t0{constructor(l=u.ELEMENT_LI,a=ZV){super(l,a)}}const o3=(e,l)=>({...l[NV(e)??T.p],counterIncrement:"count"}),NV=e=>{let l;if(e.type==="a")l=e.children[0].textStyle;else if(e.children)for(const a of e.children){const c=NV(a);c&&(!l||c.startsWith(l))&&(l=c)}else l=e.textStyle;return l},cd0=["[&>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)_'._']"],rd0=(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},i3=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 ${cd0[e%3]}`,s3={counterReset:"count"},SV=({attributes:e,children:l,element:a})=>{const c=u.usePlateEditorRef(),r=rd0(c,a);return t.createElement("ol",{className:i3(r),...e,style:s3},l)};class yV extends t0{constructor(l=u.ELEMENT_OL,a=SV){super(l,a)}}const RV=({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(j5,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class bV extends c3{constructor(l){super({id:Re,button:RV,markupElement:new yV,...l})}}const m3="[&>li>p]:before:tw-content-['•'] [&>li>p]:before:tw-px-2 tw-list-none tw-pl-[10px] tw-mb-[10px] tw-ml-[15px]",HV=({attributes:e,children:l})=>t.createElement("ul",{className:m3,...e},l);class kV extends t0{constructor(l=u.ELEMENT_UL,a=HV){super(l,a)}}const zV=({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(V5,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class VV extends c3{constructor(l){super({id:Re,button:zV,markupElement:new kV,...l})}}class od0{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 TV{constructor(l){Y(this,"platePlugins",new Map);Y(this,"markupElements",{});Y(this,"inlineElements",[]);Y(this,"toolbarButtons",new od0);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 jV="reset-formatting-plugin",DV="reset-formatting",id0=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}))},sd0=u.withPlateProvider(({id:e,...l})=>{const a=u.usePlateEditorState(u.useEventPlateId(e));return t.createElement(u.ToolbarButton,{tooltip:k0("Clear formatting"),onMouseDown:()=>{id0(a)},...l})}),md0=({id:e})=>t.createElement(I0,{id:e},t.createElement(sd0,{icon:t.createElement(S0,{icon:t.createElement(b5,null)}),classNames:M0(),styles:y0})),FV=u.createPluginFactory({key:DV,isElement:!1});class BV extends n0{constructor(l){super(jV,{button:md0,...l})}plugins(){return[FV()]}}const Ld0="strikethrough-plugin",L3="!tw-line-through",OV=({attributes:e,children:l})=>t.createElement("span",{...e,className:L3},l);class PV extends t0{constructor(l=u.MARK_STRIKETHROUGH,a=OV){super(l,a)}}const dd0=({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(lb,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"}));class UV extends n0{constructor(l){super(Ld0,{button:dd0,markupElement:new PV,...l})}plugins(){return[u.createStrikethroughPlugin()]}}const ud0="underline-plugin",be="tw-underline",QV=({attributes:e,children:l})=>t.createElement("span",{...e,className:be},l);class YV extends t0{constructor(l=u.MARK_UNDERLINE,a=QV){super(l,a)}}const wd0=({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(J5,null)}),classNames:M0(),styles:y0,actionHandler:"onMouseDown"})),hd0=[{validNodeName:["U"]},{validStyle:{textDecoration:["underline"]}}];class GV extends n0{constructor(l){super(ud0,{button:wd0,markupElement:new YV,...l})}plugins(){return[u.createUnderlinePlugin({deserializeHtml:{rules:[...hd0,{validNodeName:["SPAN"],validClassName:be}]},options:{hotkey:["mod+u","ctrl+u"]}})]}}const WV=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})},fd0=(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())fd0(e,r,c<l-1?"active":"inactive")},qV=(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=WV(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)},vd0=(e,{options:{hotkey:l}})=>a=>{var c;if(!a.defaultPrevented&&l&&Zj(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;qV(e,o,a)}},gd0=({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=Ad0(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=>qV(a,o,d),...l,classNames:s})},Ad0=(e,l,a)=>WV(e)+1<l||a,KV=({id:e})=>t.createElement(I0,{id:e},t.createElement(gd0,{icon:t.createElement(S0,{icon:t.createElement(K5,null)}),classNames:M0(),styles:y0})),Cd0=(e,l)=>{const a=u.getStartPoint(e,l);setTimeout(()=>{u.select(e,{anchor:a,focus:a})})},Ed0=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},Md0=e=>{const{apply:l}=e,a=Ed0(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 Cd0(e,c.path),e;break}l(c)},setTimeout(()=>m5(e,a))},P1="breakAfterColumn",d3="normal";class Id0 extends n0{constructor(a){super("break-after-plugin",{button:KV,...a});Y(this,"columns");Y(this,"gap");this.columns=(a==null?void 0:a.columns)??1,this.gap=(a==null?void 0:a.gap)??d3}plugins(){return[$V(this.columns,this.gap)]}}const $V=(e,l)=>u.createPluginFactory({key:P1,handlers:{onKeyDown:vd0},useHooks:Md0,options:{columns:e,gap:l,hotkey:["shift+ctrl+enter"]}})(),xd0=12,Zd0=26,pd0=124,Nd0=e=>e.map((l,a)=>({group:l,buttonGroupWidth:l.reduce((c,r)=>r.id===wV?pd0:Zd0+c,xd0),index:a})),Sd0=(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)},[]),yd0=({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),Rd0=({toolbarButtons:e,editorId:l,toolbarWidth:a})=>{const c=u.usePlateEditorRef(l),{editorWidth:r}=Pz(),{position:o}=C1(),i=a||r||0,s=Nd0(e.at(o)),m=Sd0(i,s),L=aT[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(yd0,{index:v,key:v},w.map((f,C)=>t.createElement(f.button,{editor:c,editorId:l,id:f.id,key:C.toString()})))))))},XV=e=>u.createPlugins(e.plugins,{components:u.createPlateUI(e.elements)}),u3=(e,l)=>({create:()=>XV(l),toolbar:a=>l.hasToolbar?t.createElement(Rd0,{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}),bd0="mention-plugin",Hd0=e=>l=>l.text.toLowerCase().includes(e.toLowerCase()),w3=(e,l)=>`${e}:${l}`,h3=e=>{const l=new Map;for(const a of e){const c=w3(a.data.category,a.data.id),r=a.text;l.set(c,r)}return l},JV=(e,l,a)=>e.get(l)??a;var G0=(e=>(e.GROUP="group",e.ALL="all",e.USER="user",e))(G0||{});const f3=({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),kd0=({children:e,...l})=>t.createElement(f3,{...l},t.createElement("span",{style:{paddingRight:"3px",display:"inline-block",margin:"-1px 0"}},t.createElement(re,null)),e),zd0=({children:e,...l})=>t.createElement(f3,{...l},"@",e),Vd0=({children:e,...l})=>t.createElement(f3,{...l},e),Td0=({category:e,children:l,...a})=>{const c={[G0.USER]:Vd0,[G0.GROUP]:kd0,[G0.ALL]:zd0},r=c[e]??c[G0.USER];return t.createElement(r,{...a},l)},v3=e=>l=>{const{element:a,children:c}=l,r=w3(a==null?void 0:a.category,String(a==null?void 0:a.id));return t.createElement(Td0,{category:a==null?void 0:a.category,...l},JV(e,r,String(a==null?void 0:a.id)),c)};class _V extends t0{constructor(l=u.ELEMENT_MENTION){super(l)}setNodeWithMentionable(l){return this.node=v3(h3(l)),this}}const jd0=({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(U5,null);default:return t.createElement(B5,null)}},Dd0=({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(jd0,{image:l,category:a,text:r,id:c})),t.createElement("span",{className:"tw-whitespace-nowrap tw-overflow-hidden tw-text-ellipsis"},r))},f7=[`
|
|
41
41
|
color: var(--text-color-weak);
|