@payloadcms/richtext-lexical 3.0.0-beta.63 → 3.0.0-beta.65
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/exports/client/chunk-XMCXIHWD.js +2 -0
- package/dist/exports/client/chunk-XMCXIHWD.js.map +7 -0
- package/dist/exports/client/{component-X4T7AVHY.js → component-VQ4OUM2Q.js} +2 -2
- package/dist/exports/client/index.js +3 -3
- package/dist/exports/client/index.js.map +2 -2
- package/dist/features/experimental_table/plugins/TablePlugin/index.d.ts.map +1 -1
- package/dist/features/experimental_table/plugins/TablePlugin/index.js +0 -1
- package/dist/features/experimental_table/plugins/TablePlugin/index.js.map +1 -1
- package/dist/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +2 -2
- package/dist/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/field/index.js +3 -3
- package/dist/utilities/fieldsDrawer/Drawer.d.ts +2 -2
- package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +2 -4
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +15 -15
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +15 -15
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
- package/package.json +9 -9
- package/dist/exports/client/chunk-M6Q5FGTK.js +0 -2
- package/dist/exports/client/chunk-M6Q5FGTK.js.map +0 -7
- /package/dist/exports/client/{component-X4T7AVHY.js.map → component-VQ4OUM2Q.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{a as ke,b as Xe,c as Ze,d as Je}from"./chunk-Q5DYR7MH.js";import{a as Re,b as _e,c as Se,d as St}from"./chunk-LGMNC5KQ.js";import{a as we,b as Ye,c as ve,d as Ie,e as Fe,f as vt}from"./chunk-M6Q5FGTK.js";import{a as _t,c as Yi,e as qi,f as Qi,g as el,h as tl}from"./chunk-SVDDFJRT.js";import{a as Ji,b as G}from"./chunk-QZIAQPM7.js";function $(e){return{items:e,key:"basic",label:({i18n:t})=>t.t("lexical:general:slashMenuBasicGroupLabel")}}import{createHeadlessEditor as ol}from"@lexical/headless";import{useClientFunctions as rl,useTableCell as nl}from"@payloadcms/ui";import{$getRoot as il}from"lexical";import It,{useEffect as Po,useState as Ft}from"react";var Fo={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var Me={namespace:"lexical",theme:Fo};function qe({clientFunctions:e,schemaPath:t,unSanitizedEditorConfig:o}){for(let l of o.features)if(!l?.clientFeatureProps?.featureKey||l?.clientFeatureProps?.order===void 0||l?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");o.features=o.features.sort((l,s)=>l.clientFeatureProps.order-s.clientFeatureProps.order);let r=new Map(o.features.map(l=>[l.clientFeatureProps.featureKey,l])),n=new Map,i=0;for(let l of o.features){let s={};Object.entries(e).forEach(([c,d])=>{if(c.startsWith(`lexicalFeature.${t}.${l.clientFeatureProps.featureKey}.components.`)){let u=c.split(`${t}.${l.clientFeatureProps.featureKey}.components.`)[1];s[u]=d}});let a=typeof l.feature=="function"?l.feature({clientFunctions:s,featureProviderMap:r,resolvedFeatures:n,unSanitizedEditorConfig:o}):l.feature;n.set(l.clientFeatureProps.featureKey,{...a,key:l.clientFeatureProps.featureKey,order:i}),i++}return n}var Mo=e=>{let t={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!e?.size)return t;e.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(t.hooks.load=t.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(t.hooks.save=t.hooks.save.concat(o.hooks.save))),o.providers?.length&&(t.providers=t.providers.concat(o.providers)),o.nodes?.length&&(t.nodes=t.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((r,n)=>{t.plugins.push({Component:r.Component,clientProps:o.sanitizedClientFeatureProps,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=t.toolbarInline.groups.find(i=>i.key===r.key);n?t.toolbarInline.groups=t.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=t.toolbarFixed.groups.find(i=>i.key===r.key);n?t.toolbarFixed.groups=t.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(t.slashMenu.dynamicGroups=t.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=t.slashMenu.groups.find(i=>i.key===r.key);n?t.slashMenu.groups=t.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.slashMenu.groups.push(n)}}o.markdownTransformers?.length&&(t.markdownTransformers=t.markdownTransformers.concat(o.markdownTransformers)),t.enabledFeatures.push(o.key)}),t.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),t.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of t.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of t.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return t};function Pe(e,t,o){return{admin:o,features:Mo(t),lexical:e,resolvedFeatureMap:t}}import{jsx as Ao,jsxs as sl}from"react/jsx-runtime";var ll=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,[n,i]=It.useState("Loading..."),{cellData:l,cellProps:{schemaPath:s}}=nl(),a=rl(),[c,d]=Ft(!1),[u,m]=Ft([]),[f,C]=Ft(null),h=r.get("features").sort((T,I)=>T.order-I.order),E=0;for(let T of h){let I=Array.from(r.keys()).filter(M=>M.startsWith(`feature.${T.key}.components.`));E+=1,E+=I.length}return Po(()=>{if(!c){let T=[],I=0;if(Object.entries(a).forEach(([M,x])=>{M.startsWith(`lexicalFeature.${s}.`)&&(M.includes(".lexical_internal_components.")||T.push(x),I++)}),I===E){m(T),d(!0);let M=qe({clientFunctions:a,schemaPath:s,unSanitizedEditorConfig:{features:T,lexical:o}});C(Pe(o||Me,M,t))}}},[t,h,c,a,s,h.length,u,f,o,r,E]),Po(()=>{if(!c)return;let T=l;if(T==null||!c||!f){i("");return}if(f?.features?.hooks?.load?.length&&f.features.hooks.load.forEach(x=>{T=x({incomingEditorState:T})}),!T||typeof T!="object"){i("");return}if(Array.isArray(T)&&!("root"in T)){i("");return}if("jsonContent"in T){i("");return}let I=ol({namespace:f.lexical.namespace,nodes:_t({editorConfig:f}),theme:f.lexical.theme});I.setEditorState(I.parseEditorState(T));let M=I.getEditorState().read(()=>il().getTextContent())||"";i(M)},[l,o,c,f]),c?Ao("span",{children:n}):Ao(It.Fragment,{children:Array.isArray(h)&&h.map(T=>{let M=Array.from(r.keys()).filter(x=>x.startsWith(`lexical_internal_feature.${T.key}.lexical_internal_components.`)).map(x=>r.get(x));return sl(It.Fragment,{children:[M?.length?M.map(x=>x):null,T.ClientFeature]},T.key)})})};import{$isElementNode as ne,$isRangeSelection as et,FORMAT_ELEMENT_COMMAND as tt}from"lexical";import{jsx as Mt,jsxs as al}from"react/jsx-runtime";var Do=()=>al("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Pt,jsxs as cl}from"react/jsx-runtime";var Oo=()=>cl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Pt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Pt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as At,jsxs as dl}from"react/jsx-runtime";var Qe=()=>dl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[At("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),At("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),At("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Dt,jsxs as ul}from"react/jsx-runtime";var Ho=()=>ul("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Dt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Dt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Dt("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{useAddClientFunction as pl,useFieldProps as ml,useTableCell as fl}from"@payloadcms/ui";var $o=(e,t)=>{let{schemaPath:o}=ml(),i=fl()?.cellProps?.schemaPath||o;pl(`lexicalFeature.${i}.${e}`,t)};var Ot=e=>t=>($o(t.featureKey,e(t)),null);var b=e=>Ot(o=>{let r={clientFeatureProps:o};return typeof e=="function"?r.feature=({clientFunctions:n,featureProviderMap:i,resolvedFeatures:l,unSanitizedEditorConfig:s})=>{let a=e({clientFunctions:n,featureProviderMap:i,props:o,resolvedFeatures:l,unSanitizedEditorConfig:s});return a.sanitizedClientFeatureProps===null&&(a.sanitizedClientFeatureProps=o),a}:(e.sanitizedClientFeatureProps=o,r.feature=e),r});var Bo=e=>({type:"dropdown",ChildComponent:Qe,items:e,key:"align",order:30});var Go=[Bo([{ChildComponent:Qe,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="left")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:e})=>e.t("lexical:align:alignLeftLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"left")},order:1},{ChildComponent:Do,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="center")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:e})=>e.t("lexical:align:alignCenterLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"center")},order:2},{ChildComponent:Ho,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="right")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:e})=>e.t("lexical:align:alignRightLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"right")},order:3},{ChildComponent:Oo,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="justify")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:e})=>e.t("lexical:align:alignJustifyLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"justify")},order:4}])],gl=b({toolbarFixed:{groups:Go},toolbarInline:{groups:Go}});import{$createQuoteNode as Xo,$isQuoteNode as Ko,QuoteNode as Tl}from"@lexical/rich-text";import{$setBlocksType as Zo}from"@lexical/selection";import{$getSelection as Jo,$isRangeSelection as bl}from"lexical";import{jsx as Uo}from"react/jsx-runtime";var Ht=()=>Uo("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Uo("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Wo}from"react/jsx-runtime";var Ae=()=>Wo("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Wo("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var z=e=>({type:"dropdown",ChildComponent:Ae,items:e,key:"text",order:25});import{$createQuoteNode as Cl,$isQuoteNode as zo,QuoteNode as hl}from"@lexical/rich-text";import{$createLineBreakNode as xl}from"lexical";var Vo={type:"element",dependencies:[hl],export:(e,t)=>{if(!zo(e))return null;let o=t(e).split(`
|
|
1
|
+
"use client";import{a as ke,b as Xe,c as Ze,d as Je}from"./chunk-Q5DYR7MH.js";import{a as Re,b as _e,c as Se,d as St}from"./chunk-LGMNC5KQ.js";import{a as we,b as Ye,c as ve,d as Ie,e as Fe,f as vt}from"./chunk-XMCXIHWD.js";import{a as _t,c as Yi,e as qi,f as Qi,g as el,h as tl}from"./chunk-SVDDFJRT.js";import{a as Ji,b as G}from"./chunk-QZIAQPM7.js";function $(e){return{items:e,key:"basic",label:({i18n:t})=>t.t("lexical:general:slashMenuBasicGroupLabel")}}import{createHeadlessEditor as ol}from"@lexical/headless";import{useClientFunctions as rl,useTableCell as nl}from"@payloadcms/ui";import{$getRoot as il}from"lexical";import It,{useEffect as Po,useState as Ft}from"react";var Fo={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var Me={namespace:"lexical",theme:Fo};function qe({clientFunctions:e,schemaPath:t,unSanitizedEditorConfig:o}){for(let l of o.features)if(!l?.clientFeatureProps?.featureKey||l?.clientFeatureProps?.order===void 0||l?.clientFeatureProps?.order===null)throw new Error("A Feature you have installed does not return the client props as clientFeatureProps. Please make sure to always return those props, even if they are null, as other important props like order and featureKey are later on injected.");o.features=o.features.sort((l,s)=>l.clientFeatureProps.order-s.clientFeatureProps.order);let r=new Map(o.features.map(l=>[l.clientFeatureProps.featureKey,l])),n=new Map,i=0;for(let l of o.features){let s={};Object.entries(e).forEach(([c,d])=>{if(c.startsWith(`lexicalFeature.${t}.${l.clientFeatureProps.featureKey}.components.`)){let u=c.split(`${t}.${l.clientFeatureProps.featureKey}.components.`)[1];s[u]=d}});let a=typeof l.feature=="function"?l.feature({clientFunctions:s,featureProviderMap:r,resolvedFeatures:n,unSanitizedEditorConfig:o}):l.feature;n.set(l.clientFeatureProps.featureKey,{...a,key:l.clientFeatureProps.featureKey,order:i}),i++}return n}var Mo=e=>{let t={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!e?.size)return t;e.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(t.hooks.load=t.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(t.hooks.save=t.hooks.save.concat(o.hooks.save))),o.providers?.length&&(t.providers=t.providers.concat(o.providers)),o.nodes?.length&&(t.nodes=t.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((r,n)=>{t.plugins.push({Component:r.Component,clientProps:o.sanitizedClientFeatureProps,key:o.key+n,position:r.position})}),o.toolbarInline?.groups?.length)for(let r of o.toolbarInline.groups){let n=t.toolbarInline.groups.find(i=>i.key===r.key);n?t.toolbarInline.groups=t.toolbarInline.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.toolbarInline?.groups.push(n)}if(o.toolbarFixed?.groups?.length)for(let r of o.toolbarFixed.groups){let n=t.toolbarFixed.groups.find(i=>i.key===r.key);n?t.toolbarFixed.groups=t.toolbarFixed.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.toolbarFixed?.groups.push(n)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(t.slashMenu.dynamicGroups=t.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let r of o.slashMenu.groups){let n=t.slashMenu.groups.find(i=>i.key===r.key);n?t.slashMenu.groups=t.slashMenu.groups.filter(i=>i.key!==r.key):n={...r,items:[]},r?.items?.length&&(n.items=n.items.concat(r.items)),t.slashMenu.groups.push(n)}}o.markdownTransformers?.length&&(t.markdownTransformers=t.markdownTransformers.concat(o.markdownTransformers)),t.enabledFeatures.push(o.key)}),t.toolbarInline.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0),t.toolbarFixed.groups.sort((o,r)=>o.order&&r.order?o.order-r.order:o.order?-1:r.order?1:0);for(let o of t.toolbarInline.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let o of t.toolbarFixed.groups)o.items.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);return t};function Pe(e,t,o){return{admin:o,features:Mo(t),lexical:e,resolvedFeatureMap:t}}import{jsx as Ao,jsxs as sl}from"react/jsx-runtime";var ll=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,[n,i]=It.useState("Loading..."),{cellData:l,cellProps:{schemaPath:s}}=nl(),a=rl(),[c,d]=Ft(!1),[u,m]=Ft([]),[f,C]=Ft(null),h=r.get("features").sort((T,I)=>T.order-I.order),E=0;for(let T of h){let I=Array.from(r.keys()).filter(M=>M.startsWith(`feature.${T.key}.components.`));E+=1,E+=I.length}return Po(()=>{if(!c){let T=[],I=0;if(Object.entries(a).forEach(([M,x])=>{M.startsWith(`lexicalFeature.${s}.`)&&(M.includes(".lexical_internal_components.")||T.push(x),I++)}),I===E){m(T),d(!0);let M=qe({clientFunctions:a,schemaPath:s,unSanitizedEditorConfig:{features:T,lexical:o}});C(Pe(o||Me,M,t))}}},[t,h,c,a,s,h.length,u,f,o,r,E]),Po(()=>{if(!c)return;let T=l;if(T==null||!c||!f){i("");return}if(f?.features?.hooks?.load?.length&&f.features.hooks.load.forEach(x=>{T=x({incomingEditorState:T})}),!T||typeof T!="object"){i("");return}if(Array.isArray(T)&&!("root"in T)){i("");return}if("jsonContent"in T){i("");return}let I=ol({namespace:f.lexical.namespace,nodes:_t({editorConfig:f}),theme:f.lexical.theme});I.setEditorState(I.parseEditorState(T));let M=I.getEditorState().read(()=>il().getTextContent())||"";i(M)},[l,o,c,f]),c?Ao("span",{children:n}):Ao(It.Fragment,{children:Array.isArray(h)&&h.map(T=>{let M=Array.from(r.keys()).filter(x=>x.startsWith(`lexical_internal_feature.${T.key}.lexical_internal_components.`)).map(x=>r.get(x));return sl(It.Fragment,{children:[M?.length?M.map(x=>x):null,T.ClientFeature]},T.key)})})};import{$isElementNode as ne,$isRangeSelection as et,FORMAT_ELEMENT_COMMAND as tt}from"lexical";import{jsx as Mt,jsxs as al}from"react/jsx-runtime";var Do=()=>al("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Pt,jsxs as cl}from"react/jsx-runtime";var Oo=()=>cl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Pt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Pt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as At,jsxs as dl}from"react/jsx-runtime";var Qe=()=>dl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[At("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),At("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),At("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Dt,jsxs as ul}from"react/jsx-runtime";var Ho=()=>ul("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Dt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Dt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Dt("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{useAddClientFunction as pl,useFieldProps as ml,useTableCell as fl}from"@payloadcms/ui";var $o=(e,t)=>{let{schemaPath:o}=ml(),i=fl()?.cellProps?.schemaPath||o;pl(`lexicalFeature.${i}.${e}`,t)};var Ot=e=>t=>($o(t.featureKey,e(t)),null);var b=e=>Ot(o=>{let r={clientFeatureProps:o};return typeof e=="function"?r.feature=({clientFunctions:n,featureProviderMap:i,resolvedFeatures:l,unSanitizedEditorConfig:s})=>{let a=e({clientFunctions:n,featureProviderMap:i,props:o,resolvedFeatures:l,unSanitizedEditorConfig:s});return a.sanitizedClientFeatureProps===null&&(a.sanitizedClientFeatureProps=o),a}:(e.sanitizedClientFeatureProps=o,r.feature=e),r});var Bo=e=>({type:"dropdown",ChildComponent:Qe,items:e,key:"align",order:30});var Go=[Bo([{ChildComponent:Qe,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="left")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:e})=>e.t("lexical:align:alignLeftLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"left")},order:1},{ChildComponent:Do,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="center")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:e})=>e.t("lexical:align:alignCenterLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"center")},order:2},{ChildComponent:Ho,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="right")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:e})=>e.t("lexical:align:alignRightLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"right")},order:3},{ChildComponent:Oo,isActive:({selection:e})=>{if(!et(e))return!1;for(let t of e.getNodes()){if(ne(t)&&t.getFormatType()==="justify")continue;let o=t.getParent();if(!(ne(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:e})=>e.t("lexical:align:alignJustifyLabel"),onSelect:({editor:e})=>{e.dispatchCommand(tt,"justify")},order:4}])],gl=b({toolbarFixed:{groups:Go},toolbarInline:{groups:Go}});import{$createQuoteNode as Xo,$isQuoteNode as Ko,QuoteNode as Tl}from"@lexical/rich-text";import{$setBlocksType as Zo}from"@lexical/selection";import{$getSelection as Jo,$isRangeSelection as bl}from"lexical";import{jsx as Uo}from"react/jsx-runtime";var Ht=()=>Uo("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Uo("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Wo}from"react/jsx-runtime";var Ae=()=>Wo("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Wo("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var z=e=>({type:"dropdown",ChildComponent:Ae,items:e,key:"text",order:25});import{$createQuoteNode as Cl,$isQuoteNode as zo,QuoteNode as hl}from"@lexical/rich-text";import{$createLineBreakNode as xl}from"lexical";var Vo={type:"element",dependencies:[hl],export:(e,t)=>{if(!zo(e))return null;let o=t(e).split(`
|
|
2
2
|
`),r=[];for(let n of o)r.push("> "+n);return r.join(`
|
|
3
3
|
`)},regExp:/^>\s/,replace:(e,t,o,r)=>{if(r){let i=e.getPreviousSibling();if(zo(i)){i.splice(i.getChildrenSize(),0,[xl(),...t]),i.select(0,0),e.remove();return}}let n=Cl();n.append(...t),e.replace(n),n.select(0,0)}};var jo=[z([{ChildComponent:Ht,isActive:({selection:e})=>{if(!bl(e))return!1;for(let t of e.getNodes())if(!Ko(t)&&!Ko(t.getParent()))return!1;return!0},key:"blockquote",label:({i18n:e})=>e.t("lexical:blockquote:label"),onSelect:({editor:e})=>{e.update(()=>{let t=Jo();Zo(t,()=>Xo())})},order:20}])],El=b({markdownTransformers:[Vo],nodes:[Tl],slashMenu:{groups:[$([{Icon:Ht,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:e})=>e.t("lexical:blockquote:label"),onSelect:({editor:e})=>{e.update(()=>{let t=Jo();Zo(t,()=>Xo())})}}])]},toolbarFixed:{groups:jo},toolbarInline:{groups:jo}});import{getTranslation as er}from"@payloadcms/translations";import{jsx as $t,jsxs as yl}from"react/jsx-runtime";var ot=()=>yl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[$t("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),$t("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),$t("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{DecoratorBlockNode as Ll}from"@lexical/react/LexicalDecoratorBlockNode.js";import Nl from"bson-objectid";import kl from"react";import{jsx as _l}from"react/jsx-runtime";var wl=kl.lazy(()=>import("./component-Z5R2PHH3.js").then(e=>({default:e.BlockComponent}))),J=class e extends Ll{__fields;constructor({fields:t,format:o,key:r}){super(o,r),this.__fields=t}static clone(t){return new e({fields:t.__fields,format:t.__format,key:t.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(t){t.version===1&&(t={...t,fields:{...t.fields.data},version:2});let o=me(t.fields);return o.setFormat(t.format),o}static isInline(){return!1}decorate(t,o){return _l(wl,{formData:this.getFields(),nodeKey:this.getKey()})}exportDOM(){let t=document.createElement("div"),o=document.createTextNode(this.getTextContent());return t.append(o),{element:t}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(t){let o=JSON.parse(JSON.stringify(t)),r=this.getWritable();r.__fields=o}};function me(e){return new J({fields:{...e,id:e?.id||new Nl.default().toHexString()}})}function Rl(e){return e instanceof J}import{createCommand as Sl}from"lexical";var le=Sl("INSERT_BLOCK_COMMAND");import{useLexicalComposerContext as Vl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Kl,mergeRegister as jl}from"@lexical/utils";import{$getPreviousSelection as Xl,$getSelection as Zl,$isParagraphNode as qo,$isRangeSelection as Jl,COMMAND_PRIORITY_EDITOR as Yl}from"lexical";import{useEffect as ql}from"react";import{useLexicalComposerContext as vl}from"@lexical/react/LexicalComposerContext.js";import{BlocksDrawer as Il,formatDrawerSlug as Fl,useEditDepth as Ml,useModal as Pl,useTranslation as Al}from"@payloadcms/ui";import{$getNodeByKey as Dl,COMMAND_PRIORITY_EDITOR as Ol,createCommand as Hl}from"lexical";import{useCallback as $l,useEffect as Bl,useState as Gl}from"react";import{jsx as zl}from"react/jsx-runtime";var Ul=Hl("INSERT_BLOCK_WITH_DRAWER_COMMAND"),Wl=({blockType:e,editor:t,replaceNodeKey:o})=>{o?t.update(()=>{let r=Dl(o);r&&r.replace(me({id:null,blockName:"",blockType:e}))}):t.dispatchCommand(le,{id:null,blockName:"",blockType:e})},Yo=()=>{let[e]=vl(),{editorConfig:t,uuid:o}=G(),[r,n]=Gl(null),i=Ml(),{t:l}=Al(),{openModal:s}=Pl(),a={plural:l("fields:blocks")||"Blocks",singular:l("fields:block")||"Block"},c=$l((m,f)=>{Wl({blockType:f,editor:e,replaceNodeKey:r})},[e,r]),d=Fl({slug:"lexical-rich-text-blocks-"+o,depth:i}),u=t?.resolvedFeatureMap?.get("blocks")?.sanitizedClientFeatureProps?.reducedBlocks;return Bl(()=>e.registerCommand(Ul,m=>(n(m?.replace?m?.replace.nodeKey:null),s(d),!0),Ol),[e,d,s]),zl(Il,{addRow:c,addRowIndex:0,blocks:u,drawerSlug:d,labels:a})};import{jsx as Ql}from"react/jsx-runtime";var Qo=()=>{let[e]=Vl();return ql(()=>{if(!e.hasNodes([J]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return jl(e.registerCommand(le,t=>(e.update(()=>{let o=Zl()||Xl();if(Jl(o)){let r=me(t);Kl(r);let{focus:n}=o,i=n.getNode();qo(i)&&i.getTextContentSize()===0&&i.getParent().getChildren().filter(l=>qo(l)).length>1&&i.remove()}}),!0),Yl))},[e]),Ql(Yo,{})};var es=b(({props:e})=>({nodes:[J],plugins:[{Component:Qo,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[{items:e.reducedBlocks.map(t=>({Icon:ot,key:"block-"+t.slug,keywords:["block","blocks",t.slug],label:({i18n:o})=>t.labels.singular?er(t.labels.singular,o):t.slug,onSelect:({editor:o})=>{o.dispatchCommand(le,{id:null,blockName:"",blockType:t.slug})}})),key:"blocks",label:({i18n:t})=>t.t("lexical:blocks:label")}]},toolbarFixed:{groups:[{type:"dropdown",ChildComponent:ot,items:e.reducedBlocks.map((t,o)=>({ChildComponent:ot,isActive:void 0,key:"block-"+t.slug,label:({i18n:r})=>t.labels.singular?er(t.labels.singular,r):t.slug,onSelect:({editor:r})=>{r.dispatchCommand(le,{id:null,blockName:"",blockType:t.slug})},order:o})),key:"blocks",order:20}]}}));import{useLexicalComposerContext as rs}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as ns,$createTextNode as is,$getRoot as ls}from"lexical";import*as ir from"react";import{useCallback as se,useEffect as Bt,useLayoutEffect as or,useRef as Gt,useState as rt}from"react";var K=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var ts=K&&"documentMode"in document?document.documentMode:null,tr=K&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),qf=K&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Qf=K&&"InputEvent"in window&&!ts?"getTargetRanges"in new window.InputEvent("input"):!1,eg=K&&/Version\/[\d.].*Safari/.test(navigator.userAgent),tg=K&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,og=K&&/Android/.test(navigator.userAgent),rg=K&&/Win/.test(navigator.platform),os=K&&/^(?=.*Chrome).*/i.test(navigator.userAgent),ng=K&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!os;import{jsx as ae,jsxs as Ut}from"react/jsx-runtime";var ss=e=>{let t=document.createElement("textarea");t.value=e||"",t.style.position="absolute",t.style.opacity="0",document.body?.appendChild(t),t.focus(),t.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(t)},as=(e,t)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(t||"")),o.setAttribute("download",e),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},cs=e=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"press":return` await page.keyboard.press('${n}');`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"type":return` await page.keyboard.type('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
4
4
|
await assertSelection(page, {
|
|
@@ -31,8 +31,8 @@ ${t.map(cs).join(`
|
|
|
31
31
|
`)}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
`},[e,t]),f=se((x,_)=>{o(S=>{let F=t.length-1,P=t[F];if(P&&P.name===x){if(x==="type")return[...t.slice(0,F),{...P,value:P.value+_}];if(P.value===_)return[...t.slice(0,F),{...P,count:P.count+1}]}return[...S,{name:x,count:1,value:_}]})},[t,o]);or(()=>{let x=S=>{if(!r)return;let F=S.key;ds(S)?f("selectAll",""):nr.has(F)?f("press",S.key):[...F].length>1?f("keydown",S.key):f("type",S.key)},_=S=>{if(!r)return;let F=S.key;!nr.has(F)&&[...F].length>1&&f("keyup",S.key)};return e.registerRootListener((S,F)=>{F!==null&&(F.removeEventListener("keydown",x),F.removeEventListener("keyup",_)),S!==null&&(S.addEventListener("keydown",x),S.addEventListener("keyup",_))})},[e,r,f]),or(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[m]),Bt(()=>{if(t){let x=m();x!==null&&s(x),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[m,t]),Bt(()=>e.registerUpdateListener(({dirtyElements:_,dirtyLeaves:S,editorState:F})=>{if(!r)return;let P=F._selection,L=a.current,N=c.current;if(L!==P){if(S.size===0&&_.size===0&&!N){let p=window.getSelection();if(p&&(p.anchorNode==null||p.focusNode==null))return}a.current=P}c.current=!1;let g=m();g!==null&&s(g)}),[e,m,r,f]),Bt(()=>r?e.registerUpdateListener(()=>{let _=e.getRootElement();_!==null&&i(_?.innerHTML)}):void 0,[e,r]);let C=se(x=>{r||(x.update(()=>{let _=ls();_.clear();let S=is();_.append(ns().append(S)),S.select()}),o([])),n(_=>!_)},[r]),h=se(()=>{if(!r)return;let x=window.getSelection();if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:_,anchorOffset:S,focusNode:F,focusOffset:P}=us(x),L=u().getRootElement(),N;_!==null&&(N=rr(_,L));let g;F!==null&&(g=rr(F,L)),f("snapshot",{anchorNode:_,anchorOffset:S,anchorPath:N,focusNode:F,focusOffset:P,focusPath:g})},[f,r,u]),E=se(()=>{ss(m())},[m]),T=se(()=>{as("test.js",m())},[m]);return[ae("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:x=>{C(u()),x.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Ut("div",{className:"test-recorder-output",children:[Ut("div",{className:"test-recorder-toolbar",children:[ae("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{h(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),ae("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{E(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),ae("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{T(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),ae("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var lr=()=>{let[e]=rs(),[t,o]=ps(e);return Ut(ir.Fragment,{children:[ae("p",{children:"HI"}),t,o,ae("p",{children:"DONE"})]})};var ms=b({plugins:[{Component:lr,position:"bottom"}]});import{useLexicalComposerContext as fs}from"@lexical/react/LexicalComposerContext.js";import{TreeView as gs}from"@lexical/react/LexicalTreeView.js";import{jsx as Cs}from"react/jsx-runtime";var sr=()=>{let[e]=fs();return Cs(gs,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"})};var hs=b({plugins:[{Component:sr,position:"bottom"}]});import{$isRangeSelection as xs,FORMAT_TEXT_COMMAND as Ts}from"lexical";import{jsx as ar}from"react/jsx-runtime";var cr=()=>ar("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ar("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var B=e=>({type:"buttons",items:e,key:"format",order:40});var dr={type:"text-format",format:["bold","italic"],tag:"***"},ur={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},pr={type:"text-format",format:["bold"],tag:"**"},mr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var fr=[B([{ChildComponent:cr,isActive:({selection:e})=>xs(e)?e.hasFormat("bold"):!1,key:"bold",onSelect:({editor:e})=>{e.dispatchCommand(Ts,"bold")},order:1}])],bs=b(({featureProviderMap:e})=>{let t=[pr,mr];return e.get("italic")&&t.push(ur,dr),{markdownTransformers:t,toolbarFixed:{groups:fr},toolbarInline:{groups:fr}}});import{$isRangeSelection as ys,FORMAT_TEXT_COMMAND as Ls}from"lexical";import{jsx as gr,jsxs as Es}from"react/jsx-runtime";var Cr=()=>Es("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[gr("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),gr("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var hr={type:"text-format",format:["code"],tag:"`"};var xr=[B([{ChildComponent:Cr,isActive:({selection:e})=>ys(e)?e.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:e})=>{e.dispatchCommand(Ls,"code")},order:7}])],Ns=b({markdownTransformers:[hr],toolbarFixed:{groups:xr},toolbarInline:{groups:xr}});import{$isRangeSelection as ks,FORMAT_TEXT_COMMAND as ws}from"lexical";import{jsx as Tr}from"react/jsx-runtime";var br=()=>Tr("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tr("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var Er={type:"text-format",format:["italic"],tag:"*"},yr={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Lr=[B([{ChildComponent:br,isActive:({selection:e})=>ks(e)?e.hasFormat("italic"):!1,key:"italic",onSelect:({editor:e})=>{e.dispatchCommand(ws,"italic")},order:2}])],Rs=b({markdownTransformers:[Er,yr],toolbarFixed:{groups:Lr},toolbarInline:{groups:Lr}});import{$isRangeSelection as Ss,FORMAT_TEXT_COMMAND as vs}from"lexical";import{jsx as Nr,jsxs as _s}from"react/jsx-runtime";var kr=()=>_s("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Nr("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),Nr("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var wr={type:"text-format",format:["strikethrough"],tag:"~~"};var Rr=[B([{ChildComponent:kr,isActive:({selection:e})=>Ss(e)?e.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:e})=>{e.dispatchCommand(vs,"strikethrough")},order:4}])],Is=b({markdownTransformers:[wr],toolbarFixed:{groups:Rr},toolbarInline:{groups:Rr}});import{$isRangeSelection as Fs,FORMAT_TEXT_COMMAND as Ms}from"lexical";import{jsx as _r}from"react/jsx-runtime";var Sr=()=>_r("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_r("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var vr=[B([{ChildComponent:Sr,isActive:({selection:e})=>Fs(e)?e.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:e})=>{e.dispatchCommand(Ms,"subscript")},order:5}])],Ps=b({toolbarFixed:{groups:vr},toolbarInline:{groups:vr}});import{$isRangeSelection as As,FORMAT_TEXT_COMMAND as Ds}from"lexical";import{jsx as Ir}from"react/jsx-runtime";var Fr=()=>Ir("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ir("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Mr=[B([{ChildComponent:Fr,isActive:({selection:e})=>As(e)?e.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:e})=>{e.dispatchCommand(Ds,"superscript")},order:6}])],Os=b({toolbarFixed:{groups:Mr},toolbarInline:{groups:Mr}});import{$isRangeSelection as $s,FORMAT_TEXT_COMMAND as Bs}from"lexical";import{jsx as Pr,jsxs as Hs}from"react/jsx-runtime";var Ar=()=>Hs("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pr("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),Pr("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Dr=[B([{ChildComponent:Ar,isActive:({selection:e})=>$s(e)?e.hasFormat("underline"):!1,key:"underline",onSelect:({editor:e})=>{e.dispatchCommand(Bs,"underline")},order:3}])],Gs=b({toolbarFixed:{groups:Dr},toolbarInline:{groups:Dr}});import{$createHeadingNode as Vs,$isHeadingNode as Jr,HeadingNode as Ks}from"@lexical/rich-text";import{$setBlocksType as js}from"@lexical/selection";import{$getSelection as Xs,$isRangeSelection as Zs}from"lexical";import{jsx as Or}from"react/jsx-runtime";var Hr=()=>Or("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Or("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as $r}from"react/jsx-runtime";var Br=()=>$r("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:$r("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as Gr}from"react/jsx-runtime";var Ur=()=>Gr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Gr("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as Wr}from"react/jsx-runtime";var zr=()=>Wr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Wr("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as Vr}from"react/jsx-runtime";var Kr=()=>Vr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Vr("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as jr}from"react/jsx-runtime";var Xr=()=>jr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jr("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as Us,$isHeadingNode as Ws,HeadingNode as zs}from"@lexical/rich-text";var Wt=e=>(t,o,r)=>{let n=e(r);n&&(n.append(...o),t.replace(n),n.select(0,0))};var Zr=e=>{let o=`^(${e.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[zs],export:(n,i)=>{if(!Ws(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Wt(n=>{let i="h"+n[1].length;return Us(i)})}};var Yr=e=>{let t=Xs();js(t,()=>Vs(e))},qr={h1:Hr,h2:Br,h3:Ur,h4:zr,h5:Kr,h6:Xr},Js=b(({props:e})=>{let{enabledHeadingSizes:t=["h1","h2","h3","h4","h5","h6"]}=e,o=[z(t.map((r,n)=>({ChildComponent:qr[r],isActive:({selection:i})=>{if(!Zs(i))return!1;for(let l of i.getNodes()){if(Jr(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(Jr(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{Yr(r)})},order:n+2})))];return{markdownTransformers:[Zr(t)],nodes:[Ks],sanitizedClientFeatureProps:e,slashMenu:{groups:t?.length?[$(t.map(r=>({Icon:qr[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{Yr(r)})}})))]:[]},toolbarFixed:{groups:t?.length?o:[]},toolbarInline:{groups:t?.length?o:[]}}});import{$isNodeSelection as na}from"lexical";import{jsx as Qr}from"react/jsx-runtime";var zt=()=>Qr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Qr("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as en,jsxs as Ys}from"react/jsx-runtime";var tn=()=>Ys("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[en("path",{d:"M5 10h10",stroke:"currentColor"}),en("path",{d:"M10 15V5",stroke:"currentColor"})]});var Y=e=>({type:"dropdown",ChildComponent:tn,items:e,key:"add",order:10});var on={type:"element",dependencies:[Xe],export:(e,t)=>Je(e)?"---":null,regExp:/^---\s*$/,replace:e=>{let t=Ze();t&&e.replace(t)}};import{useLexicalComposerContext as qs}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Qs}from"@lexical/utils";import{$getSelection as ea,$isRangeSelection as ta,COMMAND_PRIORITY_EDITOR as oa}from"lexical";import{useEffect as ra}from"react";var rn=()=>{let[e]=qs();return ra(()=>e.registerCommand(ke,t=>{let o=ea();if(!ta(o))return!1;if(o.focus.getNode()!==null){let n=Ze();Qs(n)}return!0},oa),[e]),null};var ia=b({markdownTransformers:[on],nodes:[Xe],plugins:[{Component:rn,position:"normal"}],slashMenu:{groups:[$([{Icon:zt,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(ke,void 0)}}])]},toolbarFixed:{groups:[Y([{ChildComponent:zt,isActive:({selection:e})=>{if(!na(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Je(t)},key:"horizontalRule",label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(ke,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as aa,OUTDENT_CONTENT_COMMAND as ca}from"lexical";import{jsx as nt,jsxs as la}from"react/jsx-runtime";var nn=()=>la("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[nt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),nt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),nt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),nt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as it,jsxs as sa}from"react/jsx-runtime";var ln=()=>sa("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[it("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),it("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),it("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),it("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var sn=e=>({type:"buttons",items:e,key:"indent",order:35});var an=[sn([{ChildComponent:nn,isActive:()=>!1,isEnabled:({selection:e})=>{if(!e||!e?.getNodes()?.length)return!1;for(let t of e.getNodes())if("__indent"in t&&t.__indent>0||t.getParent()&&"__indent"in t.getParent()&&t.getParent().__indent>0)return!0;return!1},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ca,void 0)},order:1},{ChildComponent:ln,isActive:()=>!1,key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(aa,void 0)},order:2}])],da=b({toolbarFixed:{groups:an},toolbarInline:{groups:an}});import{$findMatchingParent as Cc}from"@lexical/utils";import{$getSelection as Qt,$isRangeSelection as On}from"lexical";import{jsx as cn}from"react/jsx-runtime";var dn=()=>cn("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:cn("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as un}from"@lexical/selection";function fe(e){let{anchor:t}=e,{focus:o}=e,r=e.anchor.getNode(),n=e.focus.getNode();return r===n?r:e.isBackward()?un(o)?r:n:un(t)?r:n}var Vt=e=>({type:"buttons",items:e,key:"features",order:50});import{$createTextNode as Ea,$isTextNode as ya}from"lexical";import{addClassNamesToElement as ua,isHTMLAnchorElement as pa}from"@lexical/utils";import Xt from"bson-objectid";import{$applyNodeReplacement as ma,$createTextNode as pn,$getSelection as fa,$isElementNode as mn,$isRangeSelection as jt,ElementNode as ga,createCommand as Ca}from"lexical";var ha=new Set(["http:","https:","mailto:","sms:","tel:"]),V=class e extends ga{__fields;__id;constructor({id:t,fields:o={doc:null,linkType:"custom",newTab:!1,url:void 0},key:r}){super(r),this.__fields=o,this.__id=t}static clone(t){return new e({id:t.__id,fields:t.__fields,key:t.__key})}static getType(){return"link"}static importDOM(){return{a:t=>({conversion:xa,priority:1})}}static importJSON(t){t.version===1&&typeof t.fields?.doc?.value=="object"&&t.fields?.doc?.value?.id&&(t.fields.doc.value=t.fields.doc.value.id,t.version=2),t.version===2&&!t.id&&(t.id=new Xt.default().toHexString(),t.version=3);let o=q({id:t.id,fields:t.fields});return o.setFormat(t.format),o.setIndent(t.indent),o.setDirection(t.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(t){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=Kt(o.rel,"add","noopener")),ua(o,t.theme.link),o}exportJSON(){let t={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(t.id=o),t}extractWithChild(t,o,r){if(!jt(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(t,o=!0){let r=this.getParentOrThrow().insertNewAfter(t,o);if(mn(r)){let n=q({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(t){try{let o=new URL(t);if(!ha.has(o.protocol))return"about:blank"}catch{return"https://"}return t}setFields(t){let o=this.getWritable();o.__fields=t}updateDOM(t,o,r){let n=this.__fields?.url,i=this.__fields?.newTab;return n!=null&&n!==t.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&t.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==t.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Kt(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Kt(o.rel,"remove","noopener"))),!1}};function xa(e){let t=null;if(pa(e)){let o=e.textContent;o!==null&&o!==""&&(t=q({id:new Xt.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:e.getAttribute("target")==="_blank",url:e.getAttribute("href")??""}}))}return{node:t}}function q({id:e,fields:t}){return ma(new V({id:e??new Xt.default().toHexString(),fields:t}))}function H(e){return e instanceof V}var Z=Ca("TOGGLE_LINK_COMMAND");function fn(e){let t=fa();if(!jt(t)&&!e.selectedNodes.length)return;let o=jt(t)?t.extract():e.selectedNodes;if(e===null)o.forEach(r=>{let n=r.getParent();if(H(n)){let i=n.getChildren();for(let l=0;l<i.length;l+=1)n.insertBefore(i[l]);n.remove()}});else{if(o.length===1){let i=o[0],l=H(i)?i:Ta(i);if(l!==null){l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(pn(e.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||mn(i)&&!i.isInline())){if(H(l)){n=l,l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(pn(e.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=q({fields:e.fields}),H(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),H(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)n.append(s[a])}i.remove();return}n!==null&&n.append(i)}})}}function Ta(e){return ba(e,t=>H(t))}function ba(e,t){let o=e;for(;o!==null&&(o=o.getParent())!==null&&!t(o););return o}function Kt(e,t,o){let r,n=`${e}`;if(t==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var gn={type:"text-match",dependencies:[V],export:(e,t,o)=>{if(!H(e))return null;let r=e,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&ya(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(e,t)=>{let[,o,r]=t,n=q({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Ea(o);i.setFormat(e.getFormat()),n.append(i),e.replace(n)},trigger:")"};import{$applyNodeReplacement as La,$isElementNode as Na}from"lexical";var Q=class e extends V{static clone(t){return new e({id:void 0,fields:t.__fields,key:t.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(t){t.version===1&&typeof t.fields?.doc?.value=="object"&&t.fields?.doc?.value?.id&&(t.fields.doc.value=t.fields.doc.value.id,t.version=2);let o=De({fields:t.fields});return o.setFormat(t.format),o.setIndent(t.indent),o.setDirection(t.direction),o}exportJSON(){let t=super.exportJSON();return{type:"autolink",children:t.children,direction:t.direction,fields:t.fields,format:t.format,indent:t.indent,version:2}}insertNewAfter(t,o=!0){let r=this.getParentOrThrow().insertNewAfter(t,o);if(Na(r)){let n=De({fields:this.__fields});return r.append(n),n}return null}};function De({fields:e}){return La(new Q({id:void 0,fields:e}))}function ee(e){return e instanceof Q}import{useLexicalComposerContext as ka}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as wa}from"@lexical/utils";import{$createTextNode as Cn,$getSelection as Ra,$isElementNode as xn,$isLineBreakNode as Tn,$isNodeSelection as _a,$isRangeSelection as Sa,$isTextNode as Oe,TextNode as va}from"lexical";import{useEffect as Ia}from"react";function ce(e,t,...o){if(!e)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+t)}function hn(e,t=o=>o){return o=>{let r=e.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:t(r[0])}}}function bn(e,t){for(let o=0;o<t.length;o++){let r=t[o](e);if(r!=null)return r}return null}var Fa=/[.,;\s]/;function st(e){return Fa.test(e)}function En(e){return st(e[e.length-1])}function Jt(e){return st(e[0])}function Ma(e){return/^\.[a-z\d]+/i.test(e)}function yn(e){let t=e.getPreviousSibling();return xn(t)&&(t=t.getLastDescendant()),t===null||Tn(t)||Oe(t)&&En(t.getTextContent())}function Ln(e){let t=e.getNextSibling();return xn(t)&&(t=t.getFirstDescendant()),t===null||Tn(t)||Oe(t)&&Jt(t.getTextContent())}function Pa(e,t,o,r){return(e>0?st(o[e-1]):yn(r[0]))?t<o.length?st(o[t]):Ln(r[r.length-1]):!1}function Aa(e,t,o){let r=[],n=[],i=[],l=0,s=0,a=[...e];for(;a.length>0;){let c=a[0],u=c.getTextContent().length,m=s;s+u<=t?(r.push(c),l+=u):m>=o?i.push(c):n.push(c),s+=u,a.shift()}return[l,r,n,i]}function Da(e,t,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=De({fields:n});if(e.length===1){let l=e[0],s;t===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(t,o);let a=Cn(r.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(e.length>1){let l=e[0],s=l.getTextContent().length,a;t===0?a=l:[,a]=l.splitText(t);let c=[],d;for(let C=1;C<e.length;C++){let h=e[C],T=h.getTextContent().length,I=s,M=s+T;if(I<o)if(M<=o)c.push(h);else{let[x,_]=h.splitText(o-I);c.push(x),d=_}s+=T}let u=Ra(),m=u?u.getNodes().find(Oe):void 0,f=Cn(a.getTextContent());return f.setFormat(a.getFormat()),f.setDetail(a.getDetail()),f.setStyle(a.getStyle()),i.append(f,...c),m&&m===a&&(Sa(u)?f.select(u.anchor.offset,u.focus.offset):_a(u)&&f.select(0,f.getTextContent().length)),a.replace(i),d}}function Oa(e,t,o){let r=[...e],n=r.map(a=>a.getTextContent()).join(""),i=n,l,s=0;for(;(l=bn(i,t))!=null&&l!==null;){let a=l.index,c=l.length,d=a+c;if(Pa(s+a,s+d,n,r)){let[m,,f,C]=Aa(r,s+a,s+d),h=s+a-m,E=s+d-m,T=Da(f,h,E,l);r=T?[T,...C]:C,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function Zt(e,t,o){let r=e.getChildren(),n=r.length;for(let a=0;a<n;a++){let c=r[a];if(!Oe(c)||!c.isSimpleText()){lt(e),o(null,e.getFields()?.url??null);return}}let i=e.getTextContent(),l=bn(i,t);if(l===null||l.text!==i){lt(e),o(null,e.getFields()?.url??null);return}if(!yn(e)||!Ln(e)){lt(e),o(null,e.getFields()?.url??null);return}let s=e.getFields()?.url;if(s!==l?.url){let a=e.getFields();a.url=l?.url,e.setFields(a),o(l.url,s??null)}}function Ha(e,t,o){let r=e.getPreviousSibling(),n=e.getNextSibling(),i=e.getTextContent();ee(r)&&(!Jt(i)||Ma(i))&&(r.append(e),Zt(r,t,o),o(null,r.getFields()?.url??null)),ee(n)&&!En(i)&&(lt(n),Zt(n,t,o),o(null,n.getFields()?.url??null))}function lt(e){let t=e.getChildren(),o=t.length;for(let r=o-1;r>=0;r--)e.insertAfter(t[r]);return e.remove(),t.map(r=>r.getLatest())}function $a(e){let t=[e],o=e.getNextSibling();for(;o!==null&&Oe(o)&&o.isSimpleText()&&(t.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return t}function Ba(e,t,o){Ia(()=>{e.hasNodes([Q])||ce(!1,"LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let r=(n,i)=>{o?.(n,i)};return wa(e.registerNodeTransform(va,n=>{let i=n.getParentOrThrow(),l=n.getPreviousSibling();if(ee(i))Zt(i,t,r);else if(!H(i)){if(n.isSimpleText()&&(Jt(n.getTextContent())||!ee(l))){let s=$a(n);Oa(s,t,r)}Ha(n,t,r)}}))},[e,t,o])}var Ga=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Ua=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Wa=[hn(Ga,e=>e.startsWith("http")?e:`https://${e}`),hn(Ua,e=>`mailto:${e}`)],Nn=()=>{let[e]=ka();return Ba(e,Wa),null};import{ClickableLinkPlugin as za}from"@lexical/react/LexicalClickableLinkPlugin.js";import{jsx as Va}from"react/jsx-runtime";var kn=()=>Va(za,{});import{createCommand as Ka}from"lexical";var at=Ka("TOGGLE_LINK_WITH_MODAL_COMMAND");import{createPortal as ic}from"react-dom";import{useLexicalComposerContext as ja}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as wn,mergeRegister as Rn}from"@lexical/utils";import{getTranslation as Xa}from"@payloadcms/translations";import{formatDrawerSlug as Za,useConfig as Ja,useEditDepth as Ya,useModal as qa,useTranslation as Qa}from"@payloadcms/ui";import{$getSelection as _n,$isLineBreakNode as ec,$isRangeSelection as Sn,COMMAND_PRIORITY_HIGH as tc,COMMAND_PRIORITY_LOW as vn,KEY_ESCAPE_COMMAND as oc,SELECTION_CHANGE_COMMAND as rc}from"lexical";import In,{useCallback as Fn,useEffect as dt,useRef as nc,useState as ge}from"react";function ct(e,t,o,r=10,n=5){let i=o.parentElement;if(e===null||i==null){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let l=t.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),c=e.top-r,d=e.left-n;c<a.top&&(c+=l.height+e.height+r*2),d+l.width>a.right&&(d=a.right-l.width-n),c-=s.top,d-=s.left,t.style.opacity="1",t.style.transform=`translate(${d}px, ${c}px)`}import{jsx as Ce,jsxs as Yt}from"react/jsx-runtime";function Mn({anchorElem:e}){let[t]=ja(),o=nc(null),[r,n]=ge(null),[i,l]=ge(null),{uuid:s}=G(),a=Ja(),{i18n:c,t:d}=Qa(),[u,m]=ge({}),{closeModal:f,toggleModal:C}=qa(),h=Ya(),[E,T]=ge(!1),[I,M]=ge([]),[x,_]=ge(!1),S=Za({slug:"lexical-rich-text-link-"+s,depth:h}),F=Fn(()=>{T(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),_(!1),n(null),l(null),M([]),m({})},[T,n,l,M]),P=Fn(()=>{let L=_n(),N=null;if(!Sn(L)||!L){F();return}let g=fe(L);N=t.getElementByKey(g.getKey())?.getBoundingClientRect();let p=wn(g,H),R=L.getNodes().filter(U=>!ec(U)).find(U=>{let W=wn(U,H);return p&&!p.is(W)||W&&!W.is(p)});if(p==null||R){F();return}let k={doc:void 0,linkType:void 0,newTab:void 0,url:"",...p.getFields(),id:p.getID(),text:p.getTextContent()};if(p.getFields()?.linkType==="custom")n(p.getFields()?.url??null),l(null);else{n(`/admin/collections/${p.getFields()?.doc?.relationTo}/${p.getFields()?.doc?.value}`);let U=a.collections.find(W=>W.slug===p.getFields()?.doc?.relationTo);if(!U)l(p.getFields()?.label?String(p.getFields()?.label):null),n(p.getFields()?.url?String(p.getFields()?.url):null);else{let W=d("fields:linkedTo",{label:Xa(U.labels.singular,c)}).replace(/<[^>]*>?/g,"");l(W)}}m(k),T(!0),M(L?L?.getNodes():[]),ee(p)?_(!0):_(!1);let y=o.current,v=window.getSelection(),{activeElement:A}=document;if(y===null)return;let O=t.getRootElement();return v!==null&&O!==null&&O.contains(v.anchorNode)?(N||(N=v.getRangeAt(0).getBoundingClientRect()),N!=null&&(N.y+=40,ct(N,y,e))):(A==null||A.className!=="link-input")&&(O!==null&&ct(null,y,e),n(null),l(null)),!0},[t,F,a.collections,d,c,e]);return dt(()=>Rn(t.registerCommand(at,L=>(t.dispatchCommand(Z,L),P(),C(S),!0),vn)),[t,P,C,S]),dt(()=>{let L=e.parentElement,N=()=>{t.getEditorState().read(()=>{P()})};return window.addEventListener("resize",N),L?.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),L?.removeEventListener("scroll",N)}},[e.parentElement,t,P]),dt(()=>Rn(t.registerUpdateListener(({editorState:L})=>{L.read(()=>{P()})}),t.registerCommand(rc,()=>(P(),!0),vn),t.registerCommand(oc,()=>E?(F(),!0):!1,tc)),[t,P,E,F]),dt(()=>{t.getEditorState().read(()=>{P()})},[t,P]),Yt(In.Fragment,{children:[Ce("div",{className:"link-editor",ref:o,children:Yt("div",{className:"link-input",children:[r&&r.length>0?Ce("a",{href:r,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:r}):i!=null&&i.length>0?Ce("span",{className:"link-input__label-pure",children:i}):null,t.isEditable()&&Yt(In.Fragment,{children:[Ce("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{C(S)},onMouseDown:L=>{L.preventDefault()},tabIndex:0,type:"button"}),!x&&Ce("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{t.dispatchCommand(Z,null)},onMouseDown:L=>{L.preventDefault()},tabIndex:0,type:"button"})]})]})}),Ce(we,{className:"lexical-link-edit-drawer",data:u,drawerSlug:S,drawerTitle:d("fields:editLink"),featureKey:"link",handleDrawerSubmit:(L,N)=>{f(S);let g=N,p={...g};delete p.text,t.update(()=>{let R=_n(),k=null;if(Sn(R)?k=fe(R).getParent():I.length&&(k=I[0].getParent()),k&&ee(k)){let y=q({fields:p});k.replace(y,!0)}}),t.dispatchCommand(Z,{fields:p,selectedNodes:I,text:g.text})},schemaPathSuffix:"fields"})]})}import{jsx as lc}from"react/jsx-runtime";var Pn=e=>{let{anchorElem:t=document.body}=e;return ic(lc(Mn,{anchorElem:t}),t)};import{useLexicalComposerContext as cc}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as dc}from"@lexical/utils";import{$getSelection as uc,$isElementNode as pc,$isRangeSelection as mc,COMMAND_PRIORITY_LOW as An,PASTE_COMMAND as fc}from"lexical";import{useEffect as gc}from"react";var sc=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,ac=/^[\w\-./]*(?:#\w[\w-]*)?$/;function qt(e){if(!e)return!1;if(e==="https://"||sc.test(e)||ac.test(e))return!0;try{return new URL(e),!0}catch{}return!1}var Dn=()=>{let[e]=cc();return gc(()=>{if(!e.hasNodes([V]))throw new Error("LinkPlugin: LinkNode not registered on editor");return dc(e.registerCommand(Z,t=>(fn(t),!0),An),qt!==void 0?e.registerCommand(fc,t=>{let o=uc();if(!mc(o)||o.isCollapsed()||!(t instanceof ClipboardEvent)||t.clipboardData==null)return!1;let r=t.clipboardData.getData("text");if(!qt(r))return!1;if(!o.getNodes().some(n=>pc(n))){let n={doc:null,linkType:"custom",newTab:!1,url:r};return e.dispatchCommand(Z,{fields:n,text:null}),t.preventDefault(),!0}return!1},An):()=>{})},[e]),null};var Hn=[Vt([{ChildComponent:dn,isActive:({selection:e})=>{if(On(e)){let t=fe(e);return Cc(t,H)!=null}return!1},isEnabled:({selection:e})=>!!(On(e)&&Qt()?.getTextContent()?.length),key:"link",label:({i18n:e})=>e.t("lexical:link:label"),onSelect:({editor:e,isActive:t})=>{if(t)e.dispatchCommand(Z,null);else{let o=null,r=[];if(e.getEditorState().read(()=>{o=Qt()?.getTextContent(),r=Qt()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};e.dispatchCommand(at,{fields:n,selectedNodes:r,text:o})}},order:1}])],hc=b({markdownTransformers:[gn],nodes:[V,Q],plugins:[{Component:Dn,position:"normal"},{Component:Nn,position:"normal"},{Component:kn,position:"normal"},{Component:Pn,position:"floatingAnchorElem"}],toolbarFixed:{groups:Hn},toolbarInline:{groups:Hn}});import{$isListNode as oo,INSERT_CHECK_LIST_COMMAND as zn,ListItemNode as Sc,ListNode as vc}from"@lexical/list";import{$isRangeSelection as Ic}from"lexical";import{jsx as $n,jsxs as xc}from"react/jsx-runtime";var eo=()=>xc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[$n("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),$n("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{ListPlugin as Tc}from"@lexical/react/LexicalListPlugin.js";import{jsx as bc}from"react/jsx-runtime";var he=()=>bc(Tc,{});function xe(e){return{items:e,key:"lists",label:({i18n:t})=>t.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Nc,ListItemNode as kc,ListNode as wc}from"@lexical/list";import{$createListItemNode as Ec,$createListNode as yc,$isListItemNode as Lc,$isListNode as to}from"@lexical/list";var Bn=4,Te=e=>(t,o,r)=>{let n=t.getPreviousSibling(),i=t.getNextSibling(),l=Ec(e==="check"?r[3]==="x":void 0);if(to(i)&&i.getListType()===e){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),t.remove()}else if(to(n)&&n.getListType()===e)n.append(l),t.remove();else{let a=yc(e,e==="number"?Number(r[2]):void 0);a.append(l),t.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/Bn);s&&l.setIndent(s)},de=(e,t,o)=>{let r=[],n=e.getChildren(),i=0;for(let l of n)if(Lc(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(to(d)){r.push(de(d,t,o+1));continue}}let s=" ".repeat(o*Bn),a=e.getListType(),c=a==="number"?`${e.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+c+t(l)),i++}return r.join(`
|
|
34
|
+
`},[e,t]),f=se((x,_)=>{o(S=>{let F=t.length-1,P=t[F];if(P&&P.name===x){if(x==="type")return[...t.slice(0,F),{...P,value:P.value+_}];if(P.value===_)return[...t.slice(0,F),{...P,count:P.count+1}]}return[...S,{name:x,count:1,value:_}]})},[t,o]);or(()=>{let x=S=>{if(!r)return;let F=S.key;ds(S)?f("selectAll",""):nr.has(F)?f("press",S.key):[...F].length>1?f("keydown",S.key):f("type",S.key)},_=S=>{if(!r)return;let F=S.key;!nr.has(F)&&[...F].length>1&&f("keyup",S.key)};return e.registerRootListener((S,F)=>{F!==null&&(F.removeEventListener("keydown",x),F.removeEventListener("keyup",_)),S!==null&&(S.addEventListener("keydown",x),S.addEventListener("keyup",_))})},[e,r,f]),or(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[m]),Bt(()=>{if(t){let x=m();x!==null&&s(x),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[m,t]),Bt(()=>e.registerUpdateListener(({dirtyElements:_,dirtyLeaves:S,editorState:F})=>{if(!r)return;let P=F._selection,L=a.current,N=c.current;if(L!==P){if(S.size===0&&_.size===0&&!N){let p=window.getSelection();if(p&&(p.anchorNode==null||p.focusNode==null))return}a.current=P}c.current=!1;let g=m();g!==null&&s(g)}),[e,m,r,f]),Bt(()=>r?e.registerUpdateListener(()=>{let _=e.getRootElement();_!==null&&i(_?.innerHTML)}):void 0,[e,r]);let C=se(x=>{r||(x.update(()=>{let _=ls();_.clear();let S=is();_.append(ns().append(S)),S.select()}),o([])),n(_=>!_)},[r]),h=se(()=>{if(!r)return;let x=window.getSelection();if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:_,anchorOffset:S,focusNode:F,focusOffset:P}=us(x),L=u().getRootElement(),N;_!==null&&(N=rr(_,L));let g;F!==null&&(g=rr(F,L)),f("snapshot",{anchorNode:_,anchorOffset:S,anchorPath:N,focusNode:F,focusOffset:P,focusPath:g})},[f,r,u]),E=se(()=>{ss(m())},[m]),T=se(()=>{as("test.js",m())},[m]);return[ae("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:x=>{C(u()),x.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Ut("div",{className:"test-recorder-output",children:[Ut("div",{className:"test-recorder-toolbar",children:[ae("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{h(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),ae("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{E(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),ae("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{T(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),ae("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var lr=()=>{let[e]=rs(),[t,o]=ps(e);return Ut(ir.Fragment,{children:[ae("p",{children:"HI"}),t,o,ae("p",{children:"DONE"})]})};var ms=b({plugins:[{Component:lr,position:"bottom"}]});import{useLexicalComposerContext as fs}from"@lexical/react/LexicalComposerContext.js";import{TreeView as gs}from"@lexical/react/LexicalTreeView.js";import{jsx as Cs}from"react/jsx-runtime";var sr=()=>{let[e]=fs();return Cs(gs,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"})};var hs=b({plugins:[{Component:sr,position:"bottom"}]});import{$isRangeSelection as xs,FORMAT_TEXT_COMMAND as Ts}from"lexical";import{jsx as ar}from"react/jsx-runtime";var cr=()=>ar("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ar("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var B=e=>({type:"buttons",items:e,key:"format",order:40});var dr={type:"text-format",format:["bold","italic"],tag:"***"},ur={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},pr={type:"text-format",format:["bold"],tag:"**"},mr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var fr=[B([{ChildComponent:cr,isActive:({selection:e})=>xs(e)?e.hasFormat("bold"):!1,key:"bold",onSelect:({editor:e})=>{e.dispatchCommand(Ts,"bold")},order:1}])],bs=b(({featureProviderMap:e})=>{let t=[pr,mr];return e.get("italic")&&t.push(ur,dr),{markdownTransformers:t,toolbarFixed:{groups:fr},toolbarInline:{groups:fr}}});import{$isRangeSelection as ys,FORMAT_TEXT_COMMAND as Ls}from"lexical";import{jsx as gr,jsxs as Es}from"react/jsx-runtime";var Cr=()=>Es("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[gr("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),gr("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var hr={type:"text-format",format:["code"],tag:"`"};var xr=[B([{ChildComponent:Cr,isActive:({selection:e})=>ys(e)?e.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:e})=>{e.dispatchCommand(Ls,"code")},order:7}])],Ns=b({markdownTransformers:[hr],toolbarFixed:{groups:xr},toolbarInline:{groups:xr}});import{$isRangeSelection as ks,FORMAT_TEXT_COMMAND as ws}from"lexical";import{jsx as Tr}from"react/jsx-runtime";var br=()=>Tr("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tr("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var Er={type:"text-format",format:["italic"],tag:"*"},yr={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Lr=[B([{ChildComponent:br,isActive:({selection:e})=>ks(e)?e.hasFormat("italic"):!1,key:"italic",onSelect:({editor:e})=>{e.dispatchCommand(ws,"italic")},order:2}])],Rs=b({markdownTransformers:[Er,yr],toolbarFixed:{groups:Lr},toolbarInline:{groups:Lr}});import{$isRangeSelection as Ss,FORMAT_TEXT_COMMAND as vs}from"lexical";import{jsx as Nr,jsxs as _s}from"react/jsx-runtime";var kr=()=>_s("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Nr("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),Nr("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var wr={type:"text-format",format:["strikethrough"],tag:"~~"};var Rr=[B([{ChildComponent:kr,isActive:({selection:e})=>Ss(e)?e.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:e})=>{e.dispatchCommand(vs,"strikethrough")},order:4}])],Is=b({markdownTransformers:[wr],toolbarFixed:{groups:Rr},toolbarInline:{groups:Rr}});import{$isRangeSelection as Fs,FORMAT_TEXT_COMMAND as Ms}from"lexical";import{jsx as _r}from"react/jsx-runtime";var Sr=()=>_r("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_r("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var vr=[B([{ChildComponent:Sr,isActive:({selection:e})=>Fs(e)?e.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:e})=>{e.dispatchCommand(Ms,"subscript")},order:5}])],Ps=b({toolbarFixed:{groups:vr},toolbarInline:{groups:vr}});import{$isRangeSelection as As,FORMAT_TEXT_COMMAND as Ds}from"lexical";import{jsx as Ir}from"react/jsx-runtime";var Fr=()=>Ir("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ir("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var Mr=[B([{ChildComponent:Fr,isActive:({selection:e})=>As(e)?e.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:e})=>{e.dispatchCommand(Ds,"superscript")},order:6}])],Os=b({toolbarFixed:{groups:Mr},toolbarInline:{groups:Mr}});import{$isRangeSelection as $s,FORMAT_TEXT_COMMAND as Bs}from"lexical";import{jsx as Pr,jsxs as Hs}from"react/jsx-runtime";var Ar=()=>Hs("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pr("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),Pr("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Dr=[B([{ChildComponent:Ar,isActive:({selection:e})=>$s(e)?e.hasFormat("underline"):!1,key:"underline",onSelect:({editor:e})=>{e.dispatchCommand(Bs,"underline")},order:3}])],Gs=b({toolbarFixed:{groups:Dr},toolbarInline:{groups:Dr}});import{$createHeadingNode as Vs,$isHeadingNode as Jr,HeadingNode as Ks}from"@lexical/rich-text";import{$setBlocksType as js}from"@lexical/selection";import{$getSelection as Xs,$isRangeSelection as Zs}from"lexical";import{jsx as Or}from"react/jsx-runtime";var Hr=()=>Or("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Or("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as $r}from"react/jsx-runtime";var Br=()=>$r("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:$r("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as Gr}from"react/jsx-runtime";var Ur=()=>Gr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Gr("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as Wr}from"react/jsx-runtime";var zr=()=>Wr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Wr("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as Vr}from"react/jsx-runtime";var Kr=()=>Vr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Vr("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as jr}from"react/jsx-runtime";var Xr=()=>jr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jr("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as Us,$isHeadingNode as Ws,HeadingNode as zs}from"@lexical/rich-text";var Wt=e=>(t,o,r)=>{let n=e(r);n&&(n.append(...o),t.replace(n),n.select(0,0))};var Zr=e=>{let o=`^(${e.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[zs],export:(n,i)=>{if(!Ws(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Wt(n=>{let i="h"+n[1].length;return Us(i)})}};var Yr=e=>{let t=Xs();js(t,()=>Vs(e))},qr={h1:Hr,h2:Br,h3:Ur,h4:zr,h5:Kr,h6:Xr},Js=b(({props:e})=>{let{enabledHeadingSizes:t=["h1","h2","h3","h4","h5","h6"]}=e,o=[z(t.map((r,n)=>({ChildComponent:qr[r],isActive:({selection:i})=>{if(!Zs(i))return!1;for(let l of i.getNodes()){if(Jr(l)&&l.getTag()===r)continue;let s=l.getParent();if(!(Jr(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{Yr(r)})},order:n+2})))];return{markdownTransformers:[Zr(t)],nodes:[Ks],sanitizedClientFeatureProps:e,slashMenu:{groups:t?.length?[$(t.map(r=>({Icon:qr[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{Yr(r)})}})))]:[]},toolbarFixed:{groups:t?.length?o:[]},toolbarInline:{groups:t?.length?o:[]}}});import{$isNodeSelection as na}from"lexical";import{jsx as Qr}from"react/jsx-runtime";var zt=()=>Qr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Qr("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as en,jsxs as Ys}from"react/jsx-runtime";var tn=()=>Ys("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[en("path",{d:"M5 10h10",stroke:"currentColor"}),en("path",{d:"M10 15V5",stroke:"currentColor"})]});var Y=e=>({type:"dropdown",ChildComponent:tn,items:e,key:"add",order:10});var on={type:"element",dependencies:[Xe],export:(e,t)=>Je(e)?"---":null,regExp:/^---\s*$/,replace:e=>{let t=Ze();t&&e.replace(t)}};import{useLexicalComposerContext as qs}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Qs}from"@lexical/utils";import{$getSelection as ea,$isRangeSelection as ta,COMMAND_PRIORITY_EDITOR as oa}from"lexical";import{useEffect as ra}from"react";var rn=()=>{let[e]=qs();return ra(()=>e.registerCommand(ke,t=>{let o=ea();if(!ta(o))return!1;if(o.focus.getNode()!==null){let n=Ze();Qs(n)}return!0},oa),[e]),null};var ia=b({markdownTransformers:[on],nodes:[Xe],plugins:[{Component:rn,position:"normal"}],slashMenu:{groups:[$([{Icon:zt,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(ke,void 0)}}])]},toolbarFixed:{groups:[Y([{ChildComponent:zt,isActive:({selection:e})=>{if(!na(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Je(t)},key:"horizontalRule",label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(ke,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as aa,OUTDENT_CONTENT_COMMAND as ca}from"lexical";import{jsx as nt,jsxs as la}from"react/jsx-runtime";var nn=()=>la("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[nt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),nt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),nt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),nt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as it,jsxs as sa}from"react/jsx-runtime";var ln=()=>sa("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[it("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),it("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),it("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),it("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var sn=e=>({type:"buttons",items:e,key:"indent",order:35});var an=[sn([{ChildComponent:nn,isActive:()=>!1,isEnabled:({selection:e})=>{if(!e||!e?.getNodes()?.length)return!1;for(let t of e.getNodes())if("__indent"in t&&t.__indent>0||t.getParent()&&"__indent"in t.getParent()&&t.getParent().__indent>0)return!0;return!1},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ca,void 0)},order:1},{ChildComponent:ln,isActive:()=>!1,key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(aa,void 0)},order:2}])],da=b({toolbarFixed:{groups:an},toolbarInline:{groups:an}});import{$findMatchingParent as Cc}from"@lexical/utils";import{$getSelection as Qt,$isRangeSelection as On}from"lexical";import{jsx as cn}from"react/jsx-runtime";var dn=()=>cn("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:cn("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as un}from"@lexical/selection";function fe(e){let{anchor:t}=e,{focus:o}=e,r=e.anchor.getNode(),n=e.focus.getNode();return r===n?r:e.isBackward()?un(o)?r:n:un(t)?r:n}var Vt=e=>({type:"buttons",items:e,key:"features",order:50});import{$createTextNode as Ea,$isTextNode as ya}from"lexical";import{addClassNamesToElement as ua,isHTMLAnchorElement as pa}from"@lexical/utils";import Xt from"bson-objectid";import{$applyNodeReplacement as ma,$createTextNode as pn,$getSelection as fa,$isElementNode as mn,$isRangeSelection as jt,ElementNode as ga,createCommand as Ca}from"lexical";var ha=new Set(["http:","https:","mailto:","sms:","tel:"]),V=class e extends ga{__fields;__id;constructor({id:t,fields:o={doc:null,linkType:"custom",newTab:!1,url:void 0},key:r}){super(r),this.__fields=o,this.__id=t}static clone(t){return new e({id:t.__id,fields:t.__fields,key:t.__key})}static getType(){return"link"}static importDOM(){return{a:t=>({conversion:xa,priority:1})}}static importJSON(t){t.version===1&&typeof t.fields?.doc?.value=="object"&&t.fields?.doc?.value?.id&&(t.fields.doc.value=t.fields.doc.value.id,t.version=2),t.version===2&&!t.id&&(t.id=new Xt.default().toHexString(),t.version=3);let o=q({id:t.id,fields:t.fields});return o.setFormat(t.format),o.setIndent(t.indent),o.setDirection(t.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(t){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=Kt(o.rel,"add","noopener")),ua(o,t.theme.link),o}exportJSON(){let t={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(t.id=o),t}extractWithChild(t,o,r){if(!jt(o))return!1;let n=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(t,o=!0){let r=this.getParentOrThrow().insertNewAfter(t,o);if(mn(r)){let n=q({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(t){try{let o=new URL(t);if(!ha.has(o.protocol))return"about:blank"}catch{return"https://"}return t}setFields(t){let o=this.getWritable();o.__fields=t}updateDOM(t,o,r){let n=this.__fields?.url,i=this.__fields?.newTab;return n!=null&&n!==t.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),this.__fields?.linkType==="internal"&&t.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==t.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Kt(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Kt(o.rel,"remove","noopener"))),!1}};function xa(e){let t=null;if(pa(e)){let o=e.textContent;o!==null&&o!==""&&(t=q({id:new Xt.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:e.getAttribute("target")==="_blank",url:e.getAttribute("href")??""}}))}return{node:t}}function q({id:e,fields:t}){return ma(new V({id:e??new Xt.default().toHexString(),fields:t}))}function H(e){return e instanceof V}var Z=Ca("TOGGLE_LINK_COMMAND");function fn(e){let t=fa();if(!jt(t)&&!e.selectedNodes.length)return;let o=jt(t)?t.extract():e.selectedNodes;if(e===null)o.forEach(r=>{let n=r.getParent();if(H(n)){let i=n.getChildren();for(let l=0;l<i.length;l+=1)n.insertBefore(i[l]);n.remove()}});else{if(o.length===1){let i=o[0],l=H(i)?i:Ta(i);if(l!==null){l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(pn(e.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let r=null,n=null;o.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||mn(i)&&!i.isInline())){if(H(l)){n=l,l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(pn(e.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(r)||(r=l,n=q({fields:e.fields}),H(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),H(i)){if(i.is(n))return;if(n!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)n.append(s[a])}i.remove();return}n!==null&&n.append(i)}})}}function Ta(e){return ba(e,t=>H(t))}function ba(e,t){let o=e;for(;o!==null&&(o=o.getParent())!==null&&!t(o););return o}function Kt(e,t,o){let r,n=`${e}`;if(t==="add"){if(n.includes(o)){let i=new RegExp(o,"g");n=n.replace(i,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let i=new RegExp(o,"g");r=n.replace(i,"").trim()}return r}var gn={type:"text-match",dependencies:[V],export:(e,t,o)=>{if(!H(e))return null;let r=e,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&ya(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(e,t)=>{let[,o,r]=t,n=q({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Ea(o);i.setFormat(e.getFormat()),n.append(i),e.replace(n)},trigger:")"};import{$applyNodeReplacement as La,$isElementNode as Na}from"lexical";var Q=class e extends V{static clone(t){return new e({id:void 0,fields:t.__fields,key:t.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(t){t.version===1&&typeof t.fields?.doc?.value=="object"&&t.fields?.doc?.value?.id&&(t.fields.doc.value=t.fields.doc.value.id,t.version=2);let o=De({fields:t.fields});return o.setFormat(t.format),o.setIndent(t.indent),o.setDirection(t.direction),o}exportJSON(){let t=super.exportJSON();return{type:"autolink",children:t.children,direction:t.direction,fields:t.fields,format:t.format,indent:t.indent,version:2}}insertNewAfter(t,o=!0){let r=this.getParentOrThrow().insertNewAfter(t,o);if(Na(r)){let n=De({fields:this.__fields});return r.append(n),n}return null}};function De({fields:e}){return La(new Q({id:void 0,fields:e}))}function ee(e){return e instanceof Q}import{useLexicalComposerContext as ka}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as wa}from"@lexical/utils";import{$createTextNode as Cn,$getSelection as Ra,$isElementNode as xn,$isLineBreakNode as Tn,$isNodeSelection as _a,$isRangeSelection as Sa,$isTextNode as Oe,TextNode as va}from"lexical";import{useEffect as Ia}from"react";function ce(e,t,...o){if(!e)throw new Error("Internal Lexical error: invariant() is meant to be replaced at compile time. There is no runtime version. Error: "+t)}function hn(e,t=o=>o){return o=>{let r=e.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:t(r[0])}}}function bn(e,t){for(let o=0;o<t.length;o++){let r=t[o](e);if(r!=null)return r}return null}var Fa=/[.,;\s]/;function st(e){return Fa.test(e)}function En(e){return st(e[e.length-1])}function Jt(e){return st(e[0])}function Ma(e){return/^\.[a-z\d]+/i.test(e)}function yn(e){let t=e.getPreviousSibling();return xn(t)&&(t=t.getLastDescendant()),t===null||Tn(t)||Oe(t)&&En(t.getTextContent())}function Ln(e){let t=e.getNextSibling();return xn(t)&&(t=t.getFirstDescendant()),t===null||Tn(t)||Oe(t)&&Jt(t.getTextContent())}function Pa(e,t,o,r){return(e>0?st(o[e-1]):yn(r[0]))?t<o.length?st(o[t]):Ln(r[r.length-1]):!1}function Aa(e,t,o){let r=[],n=[],i=[],l=0,s=0,a=[...e];for(;a.length>0;){let c=a[0],u=c.getTextContent().length,m=s;s+u<=t?(r.push(c),l+=u):m>=o?i.push(c):n.push(c),s+=u,a.shift()}return[l,r,n,i]}function Da(e,t,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=De({fields:n});if(e.length===1){let l=e[0],s;t===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(t,o);let a=Cn(r.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(e.length>1){let l=e[0],s=l.getTextContent().length,a;t===0?a=l:[,a]=l.splitText(t);let c=[],d;for(let C=1;C<e.length;C++){let h=e[C],T=h.getTextContent().length,I=s,M=s+T;if(I<o)if(M<=o)c.push(h);else{let[x,_]=h.splitText(o-I);c.push(x),d=_}s+=T}let u=Ra(),m=u?u.getNodes().find(Oe):void 0,f=Cn(a.getTextContent());return f.setFormat(a.getFormat()),f.setDetail(a.getDetail()),f.setStyle(a.getStyle()),i.append(f,...c),m&&m===a&&(Sa(u)?f.select(u.anchor.offset,u.focus.offset):_a(u)&&f.select(0,f.getTextContent().length)),a.replace(i),d}}function Oa(e,t,o){let r=[...e],n=r.map(a=>a.getTextContent()).join(""),i=n,l,s=0;for(;(l=bn(i,t))!=null&&l!==null;){let a=l.index,c=l.length,d=a+c;if(Pa(s+a,s+d,n,r)){let[m,,f,C]=Aa(r,s+a,s+d),h=s+a-m,E=s+d-m,T=Da(f,h,E,l);r=T?[T,...C]:C,o(l.url,null),s=0}else s+=d;i=i.substring(d)}}function Zt(e,t,o){let r=e.getChildren(),n=r.length;for(let a=0;a<n;a++){let c=r[a];if(!Oe(c)||!c.isSimpleText()){lt(e),o(null,e.getFields()?.url??null);return}}let i=e.getTextContent(),l=bn(i,t);if(l===null||l.text!==i){lt(e),o(null,e.getFields()?.url??null);return}if(!yn(e)||!Ln(e)){lt(e),o(null,e.getFields()?.url??null);return}let s=e.getFields()?.url;if(s!==l?.url){let a=e.getFields();a.url=l?.url,e.setFields(a),o(l.url,s??null)}}function Ha(e,t,o){let r=e.getPreviousSibling(),n=e.getNextSibling(),i=e.getTextContent();ee(r)&&(!Jt(i)||Ma(i))&&(r.append(e),Zt(r,t,o),o(null,r.getFields()?.url??null)),ee(n)&&!En(i)&&(lt(n),Zt(n,t,o),o(null,n.getFields()?.url??null))}function lt(e){let t=e.getChildren(),o=t.length;for(let r=o-1;r>=0;r--)e.insertAfter(t[r]);return e.remove(),t.map(r=>r.getLatest())}function $a(e){let t=[e],o=e.getNextSibling();for(;o!==null&&Oe(o)&&o.isSimpleText()&&(t.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return t}function Ba(e,t,o){Ia(()=>{e.hasNodes([Q])||ce(!1,"LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let r=(n,i)=>{o?.(n,i)};return wa(e.registerNodeTransform(va,n=>{let i=n.getParentOrThrow(),l=n.getPreviousSibling();if(ee(i))Zt(i,t,r);else if(!H(i)){if(n.isSimpleText()&&(Jt(n.getTextContent())||!ee(l))){let s=$a(n);Oa(s,t,r)}Ha(n,t,r)}}))},[e,t,o])}var Ga=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Ua=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Wa=[hn(Ga,e=>e.startsWith("http")?e:`https://${e}`),hn(Ua,e=>`mailto:${e}`)],Nn=()=>{let[e]=ka();return Ba(e,Wa),null};import{ClickableLinkPlugin as za}from"@lexical/react/LexicalClickableLinkPlugin.js";import{jsx as Va}from"react/jsx-runtime";var kn=()=>Va(za,{});import{createCommand as Ka}from"lexical";var at=Ka("TOGGLE_LINK_WITH_MODAL_COMMAND");import{createPortal as ic}from"react-dom";import{useLexicalComposerContext as ja}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as wn,mergeRegister as Rn}from"@lexical/utils";import{getTranslation as Xa}from"@payloadcms/translations";import{formatDrawerSlug as Za,useConfig as Ja,useEditDepth as Ya,useModal as qa,useTranslation as Qa}from"@payloadcms/ui";import{$getSelection as _n,$isLineBreakNode as ec,$isRangeSelection as Sn,COMMAND_PRIORITY_HIGH as tc,COMMAND_PRIORITY_LOW as vn,KEY_ESCAPE_COMMAND as oc,SELECTION_CHANGE_COMMAND as rc}from"lexical";import In,{useCallback as Fn,useEffect as dt,useRef as nc,useState as ge}from"react";function ct(e,t,o,r=10,n=5){let i=o.parentElement;if(e===null||i==null){t.style.opacity="0",t.style.transform="translate(-10000px, -10000px)";return}let l=t.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),c=e.top-r,d=e.left-n;c<a.top&&(c+=l.height+e.height+r*2),d+l.width>a.right&&(d=a.right-l.width-n),c-=s.top,d-=s.left,t.style.opacity="1",t.style.transform=`translate(${d}px, ${c}px)`}import{jsx as Ce,jsxs as Yt}from"react/jsx-runtime";function Mn({anchorElem:e}){let[t]=ja(),o=nc(null),[r,n]=ge(null),[i,l]=ge(null),{uuid:s}=G(),a=Ja(),{i18n:c,t:d}=Qa(),[u,m]=ge(null),{closeModal:f,toggleModal:C}=qa(),h=Ya(),[E,T]=ge(!1),[I,M]=ge([]),[x,_]=ge(!1),S=Za({slug:"lexical-rich-text-link-"+s,depth:h}),F=Fn(()=>{T(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),_(!1),n(null),l(null),M([]),m(null)},[T,n,l,M]),P=Fn(()=>{let L=_n(),N=null;if(!Sn(L)||!L){F();return}let g=fe(L);N=t.getElementByKey(g.getKey())?.getBoundingClientRect();let p=wn(g,H),R=L.getNodes().filter(U=>!ec(U)).find(U=>{let W=wn(U,H);return p&&!p.is(W)||W&&!W.is(p)});if(p==null||R){F();return}let k={doc:void 0,linkType:void 0,newTab:void 0,url:"",...p.getFields(),id:p.getID(),text:p.getTextContent()};if(p.getFields()?.linkType==="custom")n(p.getFields()?.url??null),l(null);else{n(`/admin/collections/${p.getFields()?.doc?.relationTo}/${p.getFields()?.doc?.value}`);let U=a.collections.find(W=>W.slug===p.getFields()?.doc?.relationTo);if(!U)l(p.getFields()?.label?String(p.getFields()?.label):null),n(p.getFields()?.url?String(p.getFields()?.url):null);else{let W=d("fields:linkedTo",{label:Xa(U.labels.singular,c)}).replace(/<[^>]*>?/g,"");l(W)}}m(k),T(!0),M(L?L?.getNodes():[]),ee(p)?_(!0):_(!1);let y=o.current,v=window.getSelection(),{activeElement:A}=document;if(y===null)return;let O=t.getRootElement();return v!==null&&O!==null&&O.contains(v.anchorNode)?(N||(N=v.getRangeAt(0).getBoundingClientRect()),N!=null&&(N.y+=40,ct(N,y,e))):(A==null||A.className!=="link-input")&&(O!==null&&ct(null,y,e),n(null),l(null)),!0},[t,F,a.collections,d,c,e]);return dt(()=>Rn(t.registerCommand(at,L=>(t.dispatchCommand(Z,L),P(),C(S),!0),vn)),[t,P,C,S]),dt(()=>{let L=e.parentElement,N=()=>{t.getEditorState().read(()=>{P()})};return window.addEventListener("resize",N),L?.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),L?.removeEventListener("scroll",N)}},[e.parentElement,t,P]),dt(()=>Rn(t.registerUpdateListener(({editorState:L})=>{L.read(()=>{P()})}),t.registerCommand(rc,()=>(P(),!0),vn),t.registerCommand(oc,()=>E?(F(),!0):!1,tc)),[t,P,E,F]),dt(()=>{t.getEditorState().read(()=>{P()})},[t,P]),Yt(In.Fragment,{children:[Ce("div",{className:"link-editor",ref:o,children:Yt("div",{className:"link-input",children:[r&&r.length>0?Ce("a",{href:r,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:r}):i!=null&&i.length>0?Ce("span",{className:"link-input__label-pure",children:i}):null,t.isEditable()&&Yt(In.Fragment,{children:[Ce("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{C(S)},onMouseDown:L=>{L.preventDefault()},tabIndex:0,type:"button"}),!x&&Ce("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{t.dispatchCommand(Z,null)},onMouseDown:L=>{L.preventDefault()},tabIndex:0,type:"button"})]})]})}),Ce(we,{className:"lexical-link-edit-drawer",data:u,drawerSlug:S,drawerTitle:d("fields:editLink"),featureKey:"link",handleDrawerSubmit:(L,N)=>{f(S);let g=N,p={...g};delete p.text,t.update(()=>{let R=_n(),k=null;if(Sn(R)?k=fe(R).getParent():I.length&&(k=I[0].getParent()),k&&ee(k)){let y=q({fields:p});k.replace(y,!0)}}),t.dispatchCommand(Z,{fields:p,selectedNodes:I,text:g.text})},schemaPathSuffix:"fields"})]})}import{jsx as lc}from"react/jsx-runtime";var Pn=e=>{let{anchorElem:t=document.body}=e;return ic(lc(Mn,{anchorElem:t}),t)};import{useLexicalComposerContext as cc}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as dc}from"@lexical/utils";import{$getSelection as uc,$isElementNode as pc,$isRangeSelection as mc,COMMAND_PRIORITY_LOW as An,PASTE_COMMAND as fc}from"lexical";import{useEffect as gc}from"react";var sc=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,ac=/^[\w\-./]*(?:#\w[\w-]*)?$/;function qt(e){if(!e)return!1;if(e==="https://"||sc.test(e)||ac.test(e))return!0;try{return new URL(e),!0}catch{}return!1}var Dn=()=>{let[e]=cc();return gc(()=>{if(!e.hasNodes([V]))throw new Error("LinkPlugin: LinkNode not registered on editor");return dc(e.registerCommand(Z,t=>(fn(t),!0),An),qt!==void 0?e.registerCommand(fc,t=>{let o=uc();if(!mc(o)||o.isCollapsed()||!(t instanceof ClipboardEvent)||t.clipboardData==null)return!1;let r=t.clipboardData.getData("text");if(!qt(r))return!1;if(!o.getNodes().some(n=>pc(n))){let n={doc:null,linkType:"custom",newTab:!1,url:r};return e.dispatchCommand(Z,{fields:n,text:null}),t.preventDefault(),!0}return!1},An):()=>{})},[e]),null};var Hn=[Vt([{ChildComponent:dn,isActive:({selection:e})=>{if(On(e)){let t=fe(e);return Cc(t,H)!=null}return!1},isEnabled:({selection:e})=>!!(On(e)&&Qt()?.getTextContent()?.length),key:"link",label:({i18n:e})=>e.t("lexical:link:label"),onSelect:({editor:e,isActive:t})=>{if(t)e.dispatchCommand(Z,null);else{let o=null,r=[];if(e.getEditorState().read(()=>{o=Qt()?.getTextContent(),r=Qt()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};e.dispatchCommand(at,{fields:n,selectedNodes:r,text:o})}},order:1}])],hc=b({markdownTransformers:[gn],nodes:[V,Q],plugins:[{Component:Dn,position:"normal"},{Component:Nn,position:"normal"},{Component:kn,position:"normal"},{Component:Pn,position:"floatingAnchorElem"}],toolbarFixed:{groups:Hn},toolbarInline:{groups:Hn}});import{$isListNode as oo,INSERT_CHECK_LIST_COMMAND as zn,ListItemNode as Sc,ListNode as vc}from"@lexical/list";import{$isRangeSelection as Ic}from"lexical";import{jsx as $n,jsxs as xc}from"react/jsx-runtime";var eo=()=>xc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[$n("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),$n("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{ListPlugin as Tc}from"@lexical/react/LexicalListPlugin.js";import{jsx as bc}from"react/jsx-runtime";var he=()=>bc(Tc,{});function xe(e){return{items:e,key:"lists",label:({i18n:t})=>t.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Nc,ListItemNode as kc,ListNode as wc}from"@lexical/list";import{$createListItemNode as Ec,$createListNode as yc,$isListItemNode as Lc,$isListNode as to}from"@lexical/list";var Bn=4,Te=e=>(t,o,r)=>{let n=t.getPreviousSibling(),i=t.getNextSibling(),l=Ec(e==="check"?r[3]==="x":void 0);if(to(i)&&i.getListType()===e){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),t.remove()}else if(to(n)&&n.getListType()===e)n.append(l),t.remove();else{let a=yc(e,e==="number"?Number(r[2]):void 0);a.append(l),t.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(r[1].length/Bn);s&&l.setIndent(s)},de=(e,t,o)=>{let r=[],n=e.getChildren(),i=0;for(let l of n)if(Lc(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(to(d)){r.push(de(d,t,o+1));continue}}let s=" ".repeat(o*Bn),a=e.getListType(),c=a==="number"?`${e.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(s+c+t(l)),i++}return r.join(`
|
|
35
35
|
`)};var Gn={type:"element",dependencies:[wc,kc],export:(e,t)=>Nc(e)?de(e,t,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Te("check")};import{CheckListPlugin as Rc}from"@lexical/react/LexicalCheckListPlugin.js";import{jsx as _c}from"react/jsx-runtime";var Un=()=>_c(Rc,{});var Wn=[z([{ChildComponent:eo,isActive:({selection:e})=>{if(!Ic(e))return!1;for(let t of e.getNodes()){if(oo(t)&&t.getListType()==="check")continue;let o=t.getParent();if(oo(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(oo(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:e})=>e.t("lexical:checklist:label"),onSelect:({editor:e})=>{e.dispatchCommand(zn,void 0)},order:12}])],Fc=b(({featureProviderMap:e})=>{let t=[{Component:Un,position:"normal"}];return!e.has("unorderedList")&&!e.has("orderedList")&&t.push({Component:he,position:"normal"}),{markdownTransformers:[Gn],nodes:e.has("unorderedList")||e.has("orderedList")?[]:[vc,Sc],plugins:t,slashMenu:{groups:[xe([{Icon:eo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(zn,void 0)}}])]},toolbarFixed:{groups:Wn},toolbarInline:{groups:Wn}}});import{$isListNode as no,INSERT_ORDERED_LIST_COMMAND as jn,ListItemNode as Oc,ListNode as Hc}from"@lexical/list";import{$isRangeSelection as $c}from"lexical";import{jsx as He,jsxs as Mc}from"react/jsx-runtime";var ro=()=>Mc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[He("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),He("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),He("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Pc,ListItemNode as Ac,ListNode as Dc}from"@lexical/list";var Vn={type:"element",dependencies:[Dc,Ac],export:(e,t)=>Pc(e)?de(e,t,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Te("number")};var Kn=[z([{ChildComponent:ro,isActive:({selection:e})=>{if(!$c(e))return!1;for(let t of e.getNodes()){if(no(t)&&t.getListType()==="number")continue;let o=t.getParent();if(no(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(no(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(jn,void 0)},order:10}])],Bc=b(({featureProviderMap:e})=>({markdownTransformers:[Vn],nodes:e.has("orderedList")?[]:[Hc,Oc],plugins:e.has("orderedList")?[]:[{Component:he,position:"normal"}],slashMenu:{groups:[xe([{Icon:ro,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(jn,void 0)}}])]},toolbarFixed:{groups:Kn},toolbarInline:{groups:Kn}}));import{$isListNode as lo,INSERT_UNORDERED_LIST_COMMAND as Jn,ListItemNode as Vc,ListNode as Kc}from"@lexical/list";import{$isRangeSelection as jc}from"lexical";import{jsx as be,jsxs as Gc}from"react/jsx-runtime";var io=()=>Gc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[be("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),be("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),be("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Uc,ListItemNode as Wc,ListNode as zc}from"@lexical/list";var Xn={type:"element",dependencies:[zc,Wc],export:(e,t)=>Uc(e)?de(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:Te("bullet")};var Zn=[z([{ChildComponent:io,isActive:({selection:e})=>{if(!jc(e))return!1;for(let t of e.getNodes()){if(lo(t)&&t.getListType()==="bullet")continue;let o=t.getParent();if(lo(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(lo(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:e})=>e.t("lexical:unorderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Jn,void 0)},order:11}])],Xc=b({markdownTransformers:[Xn],nodes:[Kc,Vc],plugins:[{Component:he,position:"normal"}],slashMenu:{groups:[xe([{Icon:io,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:e})=>e.t("lexical:unorderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Jn,void 0)}}])]},toolbarFixed:{groups:Zn},toolbarInline:{groups:Zn}});function Yn({converters:e,lexicalPluginData:t}){return{root:{type:"root",children:qn({converters:e,lexicalPluginNodes:t?.jsonContent?.root?.children||[],parentNodeType:"root"}),direction:t?.jsonContent?.root?.direction||"ltr",format:t?.jsonContent?.root?.format||"",indent:t?.jsonContent?.root?.indent||0,version:1}}}function qn({converters:e,lexicalPluginNodes:t,parentNodeType:o}){if(!t?.length)return[];let r=e.find(n=>n.nodeTypes.includes("unknown"));return t.map((n,i)=>{if(n.type==="paragraph")return Zc(e,n);if(n.type==="text"||!n.type)return n;let l=e.find(s=>s.nodeTypes.includes(n.type));return l?l.converter({childIndex:i,converters:e,lexicalPluginNode:n,parentNodeType:o}):(console.warn("lexicalPluginToLexical > No converter found for node type: "+n.type),r?.converter({childIndex:i,converters:e,lexicalPluginNode:n,parentNodeType:o}))})||[]}function Zc(e,t){return{...t,type:"paragraph",children:qn({converters:e,lexicalPluginNodes:t.children||[],parentNodeType:"paragraph"}),version:1}}import{addClassNamesToElement as Jc}from"@lexical/utils";import{DecoratorNode as Yc}from"lexical";import*as Qn from"react";import{jsx as ed}from"react/jsx-runtime";var qc=Qn.lazy(()=>import("./Component-7HS6FEJS.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),$e=class e extends Yc{__data;constructor({data:t,key:o}){super(o),this.__data=t}static clone(t){return new e({data:t.__data,key:t.__key})}static getType(){return"unknownConverted"}static importJSON(t){return Qc({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return Jc(o,"unknownConverted"),o}decorate(){return ed(qc,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function Qc({data:e}){return new $e({data:e})}var td=b(({clientFunctions:e})=>{let t=Object.values(e);return{hooks:{load({incomingEditorState:o}){return!o||!("jsonContent"in o)?o:Yn({converters:t,lexicalPluginData:o})}},nodes:[$e]}});var w={DOM_ELEMENT_TYPE:1,DOM_TEXT_TYPE:3,NO_DIRTY_NODES:0,HAS_DIRTY_NODES:1,FULL_RECONCILE:2,IS_NORMAL:0,IS_TOKEN:1,IS_SEGMENTED:2,IS_INERT:3,IS_BOLD:1,IS_ITALIC:2,IS_STRIKETHROUGH:4,IS_UNDERLINE:8,IS_CODE:16,IS_SUBSCRIPT:32,IS_SUPERSCRIPT:64,IS_HIGHLIGHT:128,IS_DIRECTIONLESS:1,IS_UNMERGEABLE:2,IS_ALIGN_LEFT:1,IS_ALIGN_CENTER:2,IS_ALIGN_RIGHT:3,IS_ALIGN_JUSTIFY:4,IS_ALIGN_START:5,IS_ALIGN_END:6},od=w.IS_BOLD|w.IS_ITALIC|w.IS_STRIKETHROUGH|w.IS_UNDERLINE|w.IS_CODE|w.IS_SUBSCRIPT|w.IS_SUPERSCRIPT|w.IS_HIGHLIGHT,rd="\xA0",nd=`
|
|
36
36
|
|
|
37
|
-
`,ei="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ti="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",id=new RegExp("^[^"+ti+"]*["+ei+"]"),ld=new RegExp("^[^"+ei+"]*["+ti+"]"),sd={bold:w.IS_BOLD,code:w.IS_CODE,highlight:w.IS_HIGHLIGHT,italic:w.IS_ITALIC,strikethrough:w.IS_STRIKETHROUGH,subscript:w.IS_SUBSCRIPT,superscript:w.IS_SUPERSCRIPT,underline:w.IS_UNDERLINE},ad={directionless:w.IS_DIRECTIONLESS,unmergeable:w.IS_UNMERGEABLE},cd={center:w.IS_ALIGN_CENTER,end:w.IS_ALIGN_END,justify:w.IS_ALIGN_JUSTIFY,left:w.IS_ALIGN_LEFT,right:w.IS_ALIGN_RIGHT,start:w.IS_ALIGN_START},dd={[w.IS_ALIGN_CENTER]:"center",[w.IS_ALIGN_END]:"end",[w.IS_ALIGN_JUSTIFY]:"justify",[w.IS_ALIGN_LEFT]:"left",[w.IS_ALIGN_RIGHT]:"right",[w.IS_ALIGN_START]:"start"},ud={normal:w.IS_NORMAL,segmented:w.IS_SEGMENTED,token:w.IS_TOKEN},pd={[w.IS_NORMAL]:"normal",[w.IS_SEGMENTED]:"segmented",[w.IS_TOKEN]:"token"};function ri({converters:e,slateData:t}){return{root:{type:"root",children:ni({canContainParagraphs:!0,converters:e,parentNodeType:"root",slateNodes:t}),direction:"ltr",format:"",indent:0,version:1}}}function ni({canContainParagraphs:e,converters:t,parentNodeType:o,slateNodes:r}){if(!t?.length)return[];let n=t.find(i=>i.nodeTypes.includes("unknown"));return r.map((i,l)=>{if(!("type"in i))return e?oi(t,i):md(i);if(i.type==="p")return oi(t,i);let s=t.find(a=>a.nodeTypes.includes(i.type));return s?s.converter({childIndex:l,converters:t,parentNodeType:o,slateNode:i}):(console.warn("slateToLexical > No converter found for node type: "+i.type),n?.converter({childIndex:l,converters:t,parentNodeType:o,slateNode:i}))})||[]}function oi(e,t){return{type:"paragraph",children:ni({canContainParagraphs:!1,converters:e,parentNodeType:"paragraph",slateNodes:t.children||[]}),direction:"ltr",format:"",indent:0,textFormat:0,version:1}}function md(e){return{type:"text",detail:0,format:fd(e),mode:"normal",style:"",text:e.text,version:1}}function fd(e){let t=0;return e.bold&&(t=t|w.IS_BOLD),e.italic&&(t=t|w.IS_ITALIC),e.strikethrough&&(t=t|w.IS_STRIKETHROUGH),e.underline&&(t=t|w.IS_UNDERLINE),e.subscript&&(t=t|w.IS_SUBSCRIPT),e.superscript&&(t=t|w.IS_SUPERSCRIPT),e.code&&(t=t|w.IS_CODE),t}import{addClassNamesToElement as gd}from"@lexical/utils";import{DecoratorNode as Cd}from"lexical";import*as ii from"react";import{jsx as Td}from"react/jsx-runtime";var hd=ii.lazy(()=>import("./Component-LAKSCIDX.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),Be=class e extends Cd{__data;constructor({data:t,key:o}){super(o),this.__data=t}static clone(t){return new e({data:t.__data,key:t.__key})}static getType(){return"unknownConverted"}static importJSON(t){return xd({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return gd(o,"unknownConverted"),o}decorate(){return Td(hd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function xd({data:e}){return new Be({data:e})}var bd=b(({clientFunctions:e})=>{let t=Object.values(e);return{hooks:{load({incomingEditorState:o}){return!o||!Array.isArray(o)||"root"in o?o:ri({converters:t,slateData:o})}},nodes:[Be]}});import{$setBlocksType as ai}from"@lexical/selection";import{$createParagraphNode as ci,$getSelection as di,$isParagraphNode as li,$isRangeSelection as Ed}from"lexical";var si=[z([{ChildComponent:Ae,isActive:({selection:e})=>{if(!Ed(e))return!1;for(let t of e.getNodes())if(!li(t)&&!li(t.getParent()))return!1;return!0},key:"paragraph",label:({i18n:e})=>e.t("lexical:paragraph:label2"),onSelect:({editor:e})=>{e.update(()=>{let t=di();ai(t,()=>ci())})},order:1}])],yd=b({slashMenu:{groups:[$([{Icon:Ae,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:e})=>e.t("lexical:paragraph:label"),onSelect:({editor:e})=>{e.update(()=>{let t=di();ai(t,()=>ci())})}}])]},toolbarFixed:{groups:si},toolbarInline:{groups:si}});import{$isNodeSelection as Bd}from"lexical";import{jsx as Ge,jsxs as Ld}from"react/jsx-runtime";var so=()=>Ld("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ge("g",{clipPath:"url(#clip0_4397_10817)",children:Ge("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),Ge("defs",{children:Ge("clipPath",{id:"clip0_4397_10817",children:Ge("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{useLexicalComposerContext as vd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Id}from"@lexical/utils";import{useConfig as Fd}from"@payloadcms/ui";import{$getPreviousSelection as Md,$getSelection as Pd,$isParagraphNode as gi,$isRangeSelection as Ad,COMMAND_PRIORITY_EDITOR as Dd,createCommand as Od}from"lexical";import{useEffect as Hd}from"react";import{useLexicalComposerContext as Nd}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as kd}from"@payloadcms/ui";import{$getNodeByKey as wd,COMMAND_PRIORITY_EDITOR as Rd}from"lexical";import{useCallback as _d,useEffect as ui,useState as pi}from"react";import{jsx as ut}from"react/jsx-runtime";var Sd=({editor:e,relationTo:t,replaceNodeKey:o,value:r})=>{o?e.update(()=>{let n=wd(o);n&&n.replace(Se({relationTo:t,value:r}))}):e.dispatchCommand(ao,{relationTo:t,value:r})},mi=({enabledCollectionSlugs:e})=>{let[t]=Nd(),[o,r]=pi(()=>e[0]),[n,i]=pi(null),[l,s,{closeDrawer:a,isDrawerOpen:c,openDrawer:d}]=kd({collectionSlugs:e,selectedCollection:o});ui(()=>t.registerCommand(Re,m=>(i(m?.replace?m?.replace.nodeKey:null),d(),!0),Rd),[t,d]);let u=_d(({collectionSlug:m,docID:f})=>{Sd({editor:t,relationTo:m,replaceNodeKey:n,value:f}),a()},[t,a,n]);return ui(()=>{r(e[0])},[c,e]),ut(l,{onSelect:u})},fi=e=>e?.enabledCollectionSlugs?.length>0?ut(mi,{...e}):ut(Ye,{...e,children:ut(mi,{...e})});import{jsx as $d}from"react/jsx-runtime";var ao=Od("INSERT_RELATIONSHIP_COMMAND"),Ci=({clientProps:e})=>{let[t]=vd(),{collections:o}=Fd(),r=null;return e?.enabledCollections?r=e?.enabledCollections:e?.disabledCollections&&(r=o.filter(({slug:n})=>!e?.disabledCollections?.includes(n)).map(({slug:n})=>n)),Hd(()=>{if(!t.hasNodes([_e]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return t.registerCommand(ao,n=>{let i=Pd()||Md();if(Ad(i)){let l=Se(n);Id(l);let{focus:s}=i,a=s.getNode();gi(a)&&a.getTextContentSize()===0&&a.getParent().getChildren().filter(c=>gi(c)).length>1&&a.remove()}return!0},Dd)},[t]),$d(fi,{enabledCollectionSlugs:r})};var Gd=b({nodes:[_e],plugins:[{Component:Ci,position:"normal"}],slashMenu:{groups:[$([{Icon:so,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(Re,{replace:!1})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:so,isActive:({selection:e})=>{if(!Bd(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return St(t)},key:"relationship",label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(Re,{replace:!1})}}])]}});import{useLexicalComposerContext as ou}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as ru,useThrottledEffect as nu,useTranslation as iu}from"@payloadcms/ui";import*as te from"react";import{useMemo as lu}from"react";import{mergeRegister as Ud}from"@lexical/utils";import{$getSelection as Wd}from"lexical";import{useCallback as zd,useEffect as pt,useState as co}from"react";import{jsx as Vd}from"react/jsx-runtime";var uo="toolbar-popup__button",Ue=({children:e,editor:t,item:o})=>{let[r,n]=co(!0),[i,l]=co(!1),[s,a]=co(uo),c=G(),d=zd(()=>{t.getEditorState().read(()=>{let u=Wd();if(o.isActive){let m=o.isActive({editor:t,editorConfigContext:c,selection:u});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:t,editorConfigContext:c,selection:u});r!==m&&n(m)}})},[i,t,c,r,o]);return pt(()=>{d()},[d]),pt(()=>(document.addEventListener("mouseup",d),()=>{document.removeEventListener("mouseup",d)}),[d]),pt(()=>Ud(t.registerUpdateListener(()=>{d()})),[t,d]),pt(()=>{a([uo,r===!1?"disabled":"",i?"active":"",o?.key?`${uo}-`+o.key:""].filter(Boolean).join(" "))},[r,i,s,o.key]),Vd("button",{className:s,onClick:()=>{if(r!==!1)return t._updateTags=new Set([...t._updateTags,"toolbar"]),t.focus(()=>{o.onSelect({editor:t,isActive:i})}),!0},onMouseDown:u=>{u.preventDefault()},type:"button",children:e})};import Ei,{useCallback as Jd,useEffect as fo}from"react";import{mergeRegister as Yd}from"@lexical/utils";import{useTranslation as qd}from"@payloadcms/ui";import{$getSelection as Qd}from"lexical";import mt,{useCallback as Kd,useEffect as We,useMemo as jd,useRef as mo,useState as ft}from"react";import{createPortal as Xd}from"react-dom";import{jsx as ie,jsxs as hi}from"react/jsx-runtime";var po="toolbar-popup__dropdown-item",xi=mt.createContext(null);function Ti({active:e,children:t,editor:o,enabled:r,item:n,title:i}){let[l,s]=ft(po);We(()=>{s([po,r===!1?"disabled":"",e?"active":"",n?.key?`${po}-${n.key}`:""].filter(Boolean).join(" "))},[r,e,l,n.key]);let a=mo(null),c=mt.useContext(xi);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:d}=c;return We(()=>{a?.current!=null&&d(a)},[a,d]),ie("button",{className:l,onClick:()=>{r!==!1&&(o._updateTags=new Set([...o._updateTags,"toolbar"]),o.focus(()=>{n.onSelect({editor:o,isActive:e})}))},onMouseDown:u=>{u.preventDefault()},ref:a,title:i,type:"button",children:t})}function Zd({children:e,dropDownRef:t,itemsContainerClassNames:o,onClose:r}){let[n,i]=ft(),[l,s]=ft(),a=Kd(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),c=u=>{if(n==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(f=>{if(f==null)return n[0];let C=n.indexOf(f)-1;return n[C===-1?n.length-1:C]}):m==="ArrowDown"&&s(f=>f==null?n[0]:n[n.indexOf(f)+1])},d=jd(()=>({registerItem:a}),[a]);return We(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),ie(xi.Provider,{value:d,children:ie("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:t,children:e})})}function bi({Icon:e,buttonAriaLabel:t,buttonClassName:o,children:r,disabled:n=!1,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=mo(null),c=mo(null),[d,u]=ft(!1),m=()=>{u(!1),c?.current!=null&&c.current.focus()};We(()=>{let C=c.current,h=a.current;if(d&&C!==null&&h!==null){let{left:E,top:T}=C.getBoundingClientRect(),I=window.scrollY||document.documentElement.scrollTop;h.style.top=`${T+I+C.offsetHeight+5}px`,h.style.left=`${Math.min(E-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,c,d]),We(()=>{let C=c.current;if(C!==null&&d){let h=E=>{let{target:T}=E;s!=null&&a.current!=null&&a.current.contains(T)||C.contains(T)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,c,d,s]);let f=Xd(ie(Zd,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:r}),document.body);return hi(mt.Fragment,{children:[hi("button",{"aria-label":t,className:o+(d?" active":""),disabled:n,onClick:C=>{C.preventDefault(),u(!d)},onMouseDown:C=>{C.preventDefault()},ref:c,type:"button",children:[e&&ie(e,{}),l&&ie("span",{className:"toolbar-popup__dropdown-label",children:l}),ie("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&ie(mt.Fragment,{children:f})]})}import{jsx as ze,jsxs as tu}from"react/jsx-runtime";var go="toolbar-popup__dropdown",eu=({active:e,anchorElem:t,editor:o,enabled:r,item:n})=>{let{i18n:i}=qd();if(n.Component)return n?.Component&&ze(n.Component,{active:e,anchorElem:t,editor:o,enabled:r,item:n},n.key);let l=n.key;return n.label&&(l=typeof n.label=="function"?n.label({i18n:i}):n.label),l.length>25&&(l=l.substring(0,25)+"..."),tu(Ti,{active:e,editor:o,enabled:r,item:n,children:[n?.ChildComponent&&ze(n.ChildComponent,{}),ze("span",{className:"text",children:l})]},n.key)},ue=({Icon:e,anchorElem:t,classNames:o,editor:r,groupKey:n,items:i,itemsContainerClassNames:l,label:s,maxActiveItems:a,onActiveChange:c})=>{let[d,u]=Ei.useState([]),[m,f]=Ei.useState([]),C=G(),h=Jd(()=>{r.getEditorState().read(()=>{let E=Qd(),T=[],I=[],M=[];for(let x of i)x.isActive&&(!a||T.length<a)&&x.isActive({editor:r,editorConfigContext:C,selection:E})&&(T.push(x.key),I.push(x)),x.isEnabled?x.isEnabled({editor:r,editorConfigContext:C,selection:E})&&M.push(x.key):M.push(x.key);u(T),f(M),c&&c({activeItems:I})})},[r,C,i,a,c]);return fo(()=>{h()},[h]),fo(()=>(document.addEventListener("mouseup",h),()=>{document.removeEventListener("mouseup",h)}),[h]),fo(()=>Yd(r.registerUpdateListener(()=>{h()})),[r,h]),ze(bi,{Icon:e,buttonAriaLabel:`${n} dropdown`,buttonClassName:[go,`${go}-${n}`,...o||[]].filter(Boolean).join(" "),itemsContainerClassNames:[`${go}-items`,...l||[]],label:s,children:i.length&&i.map(E=>ze(eu,{active:d.includes(E.key),anchorElem:t,editor:r,enabled:m.includes(E.key),item:E},E.key))},n)};import{jsx as j,jsxs as du}from"react/jsx-runtime";function su({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&j(o.Component,{anchorElem:e,editor:t,item:o},o.key):j(Ue,{editor:t,item:o,children:o?.ChildComponent&&j(o.ChildComponent,{})},o.key)}function au({anchorElem:e,editor:t,editorConfig:o,group:r,index:n}){let{i18n:i}=iu(),[l,s]=te.useState(null),[a,c]=te.useState(null);te.useEffect(()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?c(()=>r.ChildComponent):c(null)},[r]);let d=({activeItems:u})=>{if(!u.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?(c(()=>r.ChildComponent),s(null)):(c(null),s(null));return}let m=u[0],f=m.key;m.label&&(f=typeof m.label=="function"?m.label({i18n:i}):m.label),f.length>25&&(f=f.substring(0,25)+"..."),s(f),c(()=>m.ChildComponent)};return du("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,children:[r.type==="dropdown"&&r.items.length&&(a?j(ue,{Icon:a,anchorElem:e,editor:t,groupKey:r.key,items:r.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:l,maxActiveItems:1,onActiveChange:d}):j(ue,{anchorElem:e,editor:t,groupKey:r.key,items:r.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:l,maxActiveItems:1,onActiveChange:d})),r.type==="buttons"&&r.items.length&&r.items.map(u=>j(su,{anchorElem:e,editor:t,item:u},u.key)),n<o.features.toolbarFixed?.groups.length-1&&j("div",{className:"divider"})]},r.key)}function cu({anchorElem:e,clientProps:t,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=te.useRef(null),{y:l}=ru(),s=lu(()=>{if(!n||t?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[t?.disableIfParentHasFixedToolbar,n]);return nu(()=>{if(!s)return;let a=i.current;if(!a)return;let c=a.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))i.current.className="fixed-toolbar fixed-toolbar--overlapping",s.className="fixed-toolbar fixed-toolbar--hide";else{if(!i.current.classList.contains("fixed-toolbar--overlapping"))return;i.current.className="fixed-toolbar",s.className="fixed-toolbar"}},50,[i,s,l]),j("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&j(te.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,c)=>j(au,{anchorElem:e,editor:o,editorConfig:r,group:a,index:c},a.key))})})}var yi=e=>{if(e.parentEditor?.editorConfig){if(e.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return e.parentEditor;if(e.parentEditor)return yi(e.parentEditor)}return!1},Li=({anchorElem:e,clientProps:t})=>{let[o]=ou(),r=G(),{editorConfig:n}=r,i=t.applyToFocusedEditor&&r.focusedEditor?.editor||o,l=t.applyToFocusedEditor&&r.focusedEditor?.editorConfig||n,s=yi(r);return t?.disableIfParentHasFixedToolbar&&s||!l?.features?.toolbarFixed?.groups?.length?null:j(cu,{anchorElem:e,editor:i,editorConfig:l,parentWithFixedToolbar:s})};var uu=b({plugins:[{Component:Li,position:"aboveContainer"}]});import{useLexicalComposerContext as pu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as wi}from"@lexical/utils";import{$getSelection as Ri,$isRangeSelection as Ni,$isTextNode as mu,COMMAND_PRIORITY_LOW as fu,SELECTION_CHANGE_COMMAND as gu}from"lexical";import{useCallback as Ve,useEffect as Ke,useRef as ki,useState as Cu}from"react";import*as Ee from"react";import{createPortal as hu}from"react-dom";function Co(e,t){let o=e.getRangeAt(0),r;if(e.anchorNode===t){let n=t;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function gt(e){let{alwaysDisplayOnTop:t=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=5,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:c=10}=e,d=o.parentElement;if(a===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),m=o.getBoundingClientRect(),f=d.getBoundingClientRect(),C=a.top-u.height-c,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let E=0;return!t&&C<f.top&&!s&&(E=u.height+a.height+c*2,C+=E),l==="center"?h+u.width>f.right?h=f.right-u.width-i:h<f.left&&(h=f.left+i):h+u.width>f.right&&(h=f.right-u.width-i),h-=m.left,n.style.opacity="1",s&&r!==0?(C-=m.bottom-r+u.height-3,n.style.transform=`translate(${h}px, ${C}px) rotate(180deg)`):(C-=m.top,n.style.transform=`translate(${h}px, ${C}px)`),E}import{jsx as X,jsxs as Si}from"react/jsx-runtime";function xu({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&X(o.Component,{anchorElem:e,editor:t,item:o},o.key):X(Ue,{editor:t,item:o,children:o?.ChildComponent&&X(o.ChildComponent,{})},o.key)}function Tu({anchorElem:e,editor:t,group:o,index:r}){let{editorConfig:n}=G(),[i,l]=Ee.useState(null);Ee.useEffect(()=>{o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null)},[o]);let s=({activeItems:a})=>{if(!a.length){o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null);return}let c=a[0];l(()=>c.ChildComponent)};return Si("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,children:[o.type==="dropdown"&&o.items.length&&(i?X(ue,{Icon:i,anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:s}):X(ue,{anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:s})),o.type==="buttons"&&o.items.length&&o.items.map(a=>X(xu,{anchorElem:e,editor:t,item:a},a.key)),r<n.features.toolbarInline?.groups.length-1&&X("div",{className:"divider"})]},o.key)}function bu({anchorElem:e,editor:t}){let o=ki(null),r=ki(null),{editorConfig:n}=G(),i=Ve(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=Ve(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!d||!u){let m=c.clientX,f=c.clientY,C=document.elementFromPoint(m,f);o.current.contains(C)||i()}}},[i]),s=Ve(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ke(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ve(()=>{let c=Ri(),d=window.getSelection();if(o.current===null)return;let u=e.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",f=t.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&f!==null&&f.contains(d.anchorNode)){let C=Co(d,f),h=gt({alwaysDisplayOnTop:m,anchorElem:e,floatingElem:o.current,horizontalPosition:"center",targetRect:C});r.current&>({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:C,verticalGap:10})}else i()},[t,i,e]);return Ke(()=>{let c=e.parentElement,d=()=>{t.getEditorState().read(()=>{a()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[t,a,e]),Ke(()=>(t.getEditorState().read(()=>{a()}),wi(t.registerUpdateListener(({editorState:c})=>{c.read(()=>{a()})}),t.registerCommand(gu,()=>(a(),!1),fu))),[t,a]),Si("div",{className:"inline-toolbar-popup",ref:o,children:[X("div",{className:"caret",ref:r}),t.isEditable()&&X(Ee.Fragment,{children:n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>X(Tu,{anchorElem:e,editor:t,group:c,index:d},c.key))})]})}function Eu(e,t){let[o,r]=Cu(!1),n=Ve(()=>{e.getEditorState().read(()=>{if(e.isComposing())return;let i=Ri(),l=window.getSelection(),s=e.getRootElement();if(l!==null&&(!Ni(i)||s===null||!s.contains(l.anchorNode))){r(!1);return}if(!Ni(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),d=!1;for(let u of c)if(mu(u)){r(!0),d=!0;break}d||r(!1)}else r(!1);let a=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&a===""){r(!1);return}})},[e]);return Ke(()=>(document.addEventListener("selectionchange",n),document.addEventListener("mouseup",n),()=>{document.removeEventListener("selectionchange",n),document.removeEventListener("mouseup",n)}),[n]),Ke(()=>wi(e.registerUpdateListener(()=>{n()}),e.registerRootListener(()=>{e.getRootElement()===null&&r(!1)})),[e,n]),o?hu(X(bu,{anchorElem:t,editor:e}),t):null}var _i=({anchorElem:e})=>{let[t]=pu();return Eu(t,e)};var yu=b({plugins:[{Component:_i,position:"floatingAnchorElem"}]});import{TableCellNode as Ep,TableNode as yp,TableRowNode as Lp}from"@lexical/table";import{jsx as vi}from"react/jsx-runtime";var ho=()=>vi("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:vi("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{useLexicalComposerContext as Mi}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Nu}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as ku,$deleteTableRow__EXPERIMENTAL as wu,$getNodeTriplet as Ru,$getTableCellNodeFromLexicalNode as _u,$getTableColumnIndexFromTableCellNode as Su,$getTableNodeFromLexicalNodeOrThrow as Ct,$getTableRowIndexFromTableCellNode as vu,$insertTableColumn__EXPERIMENTAL as Iu,$insertTableRow__EXPERIMENTAL as Fu,$isTableCellNode as je,$isTableRowNode as bo,$isTableSelection as xt,$unmergeCell as Mu,TableCellHeaderStates as ye,TableCellNode as Pu,getTableObserverFromTableElement as Au}from"@lexical/table";import{useScrollInfo as Du}from"@payloadcms/ui";import{$createParagraphNode as Ou,$getRoot as Hu,$getSelection as Tt,$isElementNode as $u,$isParagraphNode as Pi,$isRangeSelection as Eo,$isTextNode as Bu}from"lexical";import*as yo from"react";import{useCallback as oe,useEffect as pe,useRef as ht,useState as Le}from"react";import{createPortal as Ai}from"react-dom";import{jsx as xo,jsxs as Lu}from"react/jsx-runtime";var Ii=()=>Lu("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[xo("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),xo("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),xo("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});import{jsx as D,jsxs as re}from"react/jsx-runtime";function To(e){let t=e.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function Gu(e){let t=e.getNodes(),o=[],r=null,n=null,i=0;for(let l=0;l<t.length;l++){let s=t[l];if(je(s)){let a=s.getParentOrThrow();if(ce(bo(a),"Expected CellNode to have a RowNode parent"),r!==a){if(n!==null&&i!==n)return!1;r!==null&&(n=i),r=a,i=0}let c=s.__colSpan;for(let d=0;d<c;d++)o[i+d]===void 0&&(o[i+d]=0),o[i+d]+=s.__rowSpan;i+=c}}return(n===null||i===n)&&o.every(l=>l===o[0])}function Uu(){let e=Tt();if(Eo(e)&&!e.isCollapsed()||xt(e)&&!e.anchor.is(e.focus)||!Eo(e)&&!xt(e))return!1;let[t]=Ru(e.anchor);return t.__colSpan>1||t.__rowSpan>1}function Fi(e){if(e.getChildrenSize()!==1)return!1;let t=e.getFirstChildOrThrow();return!(!Pi(t)||!t.isEmpty())}function Wu(e){let t=e.getLastDescendant();Bu(t)?t.select():$u(t)?t.selectEnd():t!==null&&t.selectNext()}function zu({cellMerge:e,contextRef:t,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Mi(),l=ht(null),[s,a]=Le(n),[c,d]=Le({columns:1,rows:1}),[u,m]=Le(!1),[f,C]=Le(!1),{y:h}=Du();pe(()=>i.registerMutationListener(Pu,g=>{g.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})}),[i,s]),pe(()=>{i.getEditorState().read(()=>{let g=Tt();if(xt(g)){let p=To(g);d(To(g)),m(Gu(g)&&(p.columns>1||p.rows>1))}C(Uu())})},[i]),pe(()=>{let g=t.current,p=l.current,R=i.getRootElement();if(g!=null&&p!=null&&R!=null){let k=R.getBoundingClientRect(),y=g.getBoundingClientRect();p.style.opacity="1";let v=p.getBoundingClientRect(),A=5,O=y.right+A;if(O+v.width>window.innerWidth||O+v.width>k.right){let W=y.left-v.width-A;O=(W<0?A:W)+window.pageXOffset}p.style.left=`${O+window.pageXOffset}px`;let U=y.top;if(U+v.height>window.innerHeight){let W=y.bottom-v.height;U=(W<0?A:W)+window.pageYOffset}p.style.top=`${U}px`}},[t,l,i,h]),pe(()=>{function g(p){l.current!=null&&t.current!=null&&!l.current.contains(p.target)&&!t.current.contains(p.target)&&r(!1)}return window.addEventListener("click",g),()=>window.removeEventListener("click",g)},[r,t]);let E=oe(()=>{i.update(()=>{if(s.isAttached()){let p=Ct(s),R=i.getElementByKey(p.getKey());if(!R)throw new Error("Expected to find tableElement in DOM");let k=Au(R);k!==null&&k.clearHighlight(),p.markDirty(),a(s.getLatest())}Hu().selectStart()})},[i,s]),T=()=>{i.update(()=>{let g=Tt();if(xt(g)){let{columns:p,rows:R}=To(g),k=g.getNodes(),y=null;for(let v=0;v<k.length;v++){let A=k[v];if(je(A))if(y===null){A.setColSpan(p).setRowSpan(R),y=A;let O=Fi(A),U;O&&Pi(U=A.getFirstChild())&&U.remove()}else je(y)&&(Fi(A)||y.append(...A.getChildren()),A.remove())}y!==null&&(y.getChildrenSize()===0&&y.append(Ou()),Wu(y)),o()}})},I=()=>{i.update(()=>{Mu()})},M=oe(g=>{i.update(()=>{Fu(g),o()})},[i,o]),x=oe(g=>{i.update(()=>{for(let p=0;p<c.columns;p++)Iu(g);o()})},[i,o,c.columns]),_=oe(()=>{i.update(()=>{wu(),o()})},[i,o]),S=oe(()=>{i.update(()=>{Ct(s).remove(),E(),o()})},[i,s,E,o]),F=oe(()=>{i.update(()=>{ku(),o()})},[i,o]),P=oe(()=>{i.update(()=>{let g=Ct(s),p=vu(s),R=g.getChildren();if(p>=R.length||p<0)throw new Error("Expected table cell to be inside of table row.");let k=R[p];if(!bo(k))throw new Error("Expected table row");k.getChildren().forEach(y=>{if(!je(y))throw new Error("Expected table cell");y.toggleHeaderStyle(ye.ROW)}),E(),o()})},[i,s,E,o]),L=oe(()=>{i.update(()=>{let g=Ct(s),p=Su(s),R=g.getChildren(),k=Math.max(...R.map(y=>y.getChildren().length));if(p>=k||p<0)throw new Error("Expected table cell to be inside of table row.");for(let y=0;y<R.length;y++){let v=R[y];if(!bo(v))throw new Error("Expected table row");let A=v.getChildren();if(p>=A.length)continue;let O=A[p];if(!je(O))throw new Error("Expected table cell");O.toggleHeaderStyle(ye.COLUMN)}E(),o()})},[i,s,E,o]),N=null;return e&&(u?N=D("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>T(),type:"button",children:"Merge cells"}):f&&(N=D("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>I(),type:"button",children:"Unmerge cells"}))),Ai(re("div",{className:"table-action-menu-dropdown",onClick:g=>{g.stopPropagation()},ref:l,children:[N?re(yo.Fragment,{children:[N,D("hr",{})]}):null,D("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>M(!1),type:"button",children:re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),D("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>M(!0),type:"button",children:re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),D("hr",{}),D("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),D("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),D("hr",{}),D("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>F(),type:"button",children:D("span",{className:"text",children:"Delete column"})}),D("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>_(),type:"button",children:D("span",{className:"text",children:"Delete row"})}),D("button",{className:"item","data-test-id":"table-delete",onClick:()=>S(),type:"button",children:D("span",{className:"text",children:"Delete table"})}),D("hr",{}),D("button",{className:"item",onClick:()=>P(),type:"button",children:re("span",{className:"text",children:[(s.__headerState&ye.ROW)===ye.ROW?"Remove":"Add"," ","row header"]})}),D("button",{className:"item","data-test-id":"table-column-header",onClick:()=>L(),type:"button",children:re("span",{className:"text",children:[(s.__headerState&ye.COLUMN)===ye.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Vu({anchorElem:e,cellMerge:t}){let[o]=Mi(),r=ht(null),n=ht(null),[i,l]=Le(!1),[s,a]=Le(null),c=oe(()=>{let u=r.current,m=Tt(),f=window.getSelection(),C=document.activeElement;if(m==null||u==null){a(null);return}let h=o.getRootElement();if(Eo(m)&&h!==null&&f!==null&&h.contains(f.anchorNode)){let E=_u(m.anchor.getNode());if(E==null){a(null);return}if(o.getElementByKey(E.getKey())==null){a(null);return}a(E)}else C||a(null)},[o]);pe(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),pe(()=>{let u=r.current;if(u!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let f=m.getBoundingClientRect(),C=u.getBoundingClientRect(),h=e.getBoundingClientRect(),E=f.top-h.top+4,T=f.right-C.width-10-h.left;u.style.opacity="1",u.style.transform=`translate(${T}px, ${E}px)`}else u.style.opacity="0",u.style.transform="translate(-10000px, -10000px)"}},[r,s,o,e]);let d=ht(s);return pe(()=>{d.current!==s&&l(!1),d.current=s},[d,s]),D("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&re(yo.Fragment,{children:[D("button",{className:"table-cell-action-button",onClick:u=>{u.stopPropagation(),l(!i)},ref:n,type:"button",children:D(Ii,{})}),i&&D(zu,{cellMerge:t,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Di=({anchorElem:e})=>{let t=Nu();return Ai(t?D(Vu,{anchorElem:e??document.body,cellMerge:!0}):null,e??document.body)};import{useLexicalComposerContext as Ku}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ju}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Xu,$getTableNodeFromLexicalNodeOrThrow as Lo,$getTableRowIndexFromTableCellNode as Zu,$isTableCellNode as Oi,$isTableRowNode as Ju,getDOMCellFromTarget as Yu}from"@lexical/table";import{calculateZoomLevel as Hi}from"@lexical/utils";import{$getNearestNodeFromDOMNode as No}from"lexical";import*as $i from"react";import{useCallback as Ne,useEffect as qu,useMemo as Qu,useRef as bt,useState as Et}from"react";import{createPortal as ep}from"react-dom";import{jsx as yt,jsxs as np}from"react/jsx-runtime";var tp=33,op=50;function rp({editor:e}){let t=bt(null),o=bt(null),r=bt(null),n=bt(null),[i,l]=Et(null),[s,a]=Et(null),[c,d]=Et(!1),[u,m]=Et(null),f=Ne(()=>{a(null),t.current=null,m(null),n.current=null,r.current=null},[]),C=L=>(L.buttons&1)===1;qu(()=>{let L=p=>{setTimeout(()=>{let R=p.target;if(u){l({x:p.clientX,y:p.clientY});return}if(d(C(p)),!(o.current&&o.current.contains(R))&&t.current!==R){t.current=R;let k=Yu(R);k&&s!==k?e.update(()=>{let y=No(k.elem);if(!y)throw new Error("TableCellResizer: Table cell node not found.");let v=Lo(y),A=e.getElementByKey(v.getKey());if(!A)throw new Error("TableCellResizer: Table element not found.");t.current=R,r.current=A.getBoundingClientRect(),a(k)}):k==null&&f()}},0)},N=p=>{setTimeout(()=>{d(!0)},0)},g=p=>{setTimeout(()=>{d(!1)},0)};return document.addEventListener("mousemove",L),document.addEventListener("mousedown",N),document.addEventListener("mouseup",g),()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mousedown",N),document.removeEventListener("mouseup",g)}},[s,u,e,f]);let h=L=>L==="bottom",E=Ne(L=>{if(!s)throw new Error("TableCellResizer: Expected active cell.");e.update(()=>{let N=No(s.elem);if(!Oi(N))throw new Error("TableCellResizer: Table cell node not found.");let g=Lo(N),p=Zu(N),R=g.getChildren();if(p>=R.length||p<0)throw new Error("Expected table cell to be inside of table row.");let k=R[p];if(!Ju(k))throw new Error("Expected table row");let y=k.getHeight();if(y===void 0){let A=k.getChildren();y=Math.min(...A.map(O=>I(O,e)??1/0))}let v=Math.max(y+L,tp);k.setHeight(v)},{tag:"skip-scroll-into-view"})},[s,e]),T=(L,N)=>{let g=L.getWidth();if(g!==void 0)return g;let p=N.getElementByKey(L.getKey());if(p==null)return;let R=getComputedStyle(p);return p.clientWidth-parseFloat(R.paddingLeft)-parseFloat(R.paddingRight)},I=(L,N)=>N.getElementByKey(L.getKey())?.clientHeight,M=(L,N)=>{for(let g=0;g<N.length;g++)for(let p=0;p<N[g].length;p++)if(N[g][p].cell===L)return p},x=Ne(L=>{if(!s)throw new Error("TableCellResizer: Expected active cell.");e.update(()=>{let N=No(s.elem);if(!Oi(N))throw new Error("TableCellResizer: Table cell node not found.");let g=Lo(N),[p]=Xu(g,null,null),R=M(N,p);if(R===void 0)throw new Error("TableCellResizer: Table column not found.");for(let k=0;k<p.length;k++){let y=p[k][R];if(y.startRow===k&&(R===p[k].length-1||p[k][R].cell!==p[k][R+1].cell)){let v=T(y.cell,e);if(v===void 0)continue;let A=Math.max(v+L,op);y.cell.setWidth(A)}}},{tag:"skip-scroll-into-view"})},[s,e]),_=Ne(L=>{let N=g=>{if(g.preventDefault(),g.stopPropagation(),!s)throw new Error("TableCellResizer: Expected active cell.");if(n.current){let{x:p,y:R}=n.current;if(s===null)return;let k=Hi(g.target);if(h(L)){let y=(g.clientY-R)/k;E(y)}else{let y=(g.clientX-p)/k;x(y)}f(),document.removeEventListener("mouseup",N)}};return N},[s,f,x,E]),S=Ne(L=>N=>{if(N.preventDefault(),N.stopPropagation(),!s)throw new Error("TableCellResizer: Expected active cell.");n.current={x:N.clientX,y:N.clientY},l(n.current),m(L),document.addEventListener("mouseup",_(L))},[s,_]),P=Ne(()=>{if(s){let{height:L,left:N,top:g,width:p}=s.elem.getBoundingClientRect(),R=Hi(s.elem),k=10,y={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${k}px`,left:`${window.pageXOffset+N}px`,top:`${window.pageYOffset+g+L-k/2}px`,width:`${p}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${L}px`,left:`${window.pageXOffset+N+p-k/2}px`,top:`${window.pageYOffset+g}px`,width:`${k}px`}},v=r.current;return u&&i&&v&&(h(u)?(y[u].left=`${window.pageXOffset+v.left}px`,y[u].top=`${window.pageYOffset+i.y/R}px`,y[u].height="3px",y[u].width=`${v.width}px`):(y[u].top=`${window.pageYOffset+v.top}px`,y[u].left=`${window.pageXOffset+i.x/R}px`,y[u].width="3px",y[u].height=`${v.height}px`),y[u].backgroundColor="#adf"),y}return{bottom:null,left:null,right:null,top:null}},[s,u,i])();return yt("div",{ref:o,children:s!=null&&!c&&np($i.Fragment,{children:[yt("div",{className:"TableCellResizer__resizer TableCellResizer__ui",onMouseDown:S("right"),style:P.right||void 0}),yt("div",{className:"TableCellResizer__resizer TableCellResizer__ui",onMouseDown:S("bottom"),style:P.bottom||void 0})]})})}var Bi=()=>{let[e]=Ku(),t=ju();return Qu(()=>t?ep(yt(rp,{editor:e}),document.body):null,[e,t])};import{useLexicalComposerContext as ip}from"@lexical/react/LexicalComposerContext";import{TablePlugin as lp}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as sp,TableNode as ap}from"@lexical/table";import{mergeRegister as cp}from"@lexical/utils";import{useModal as dp}from"@payloadcms/ui";import{$getSelection as up,$isRangeSelection as pp,COMMAND_PRIORITY_EDITOR as mp,createCommand as fp}from"lexical";import{createContext as gp,useContext as Cp,useEffect as hp,useMemo as xp,useState as Tp}from"react";import*as Gi from"react";import{jsx as wo,jsxs as bp}from"react/jsx-runtime";var Lt=fp("OPEN_EMBED_DRAWER_COMMAND"),Ui=gp({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}}),ko="lexical-table-create";function Wi({children:e}){let[t,o]=Tp({cellEditorConfig:null,cellEditorPlugins:null});return wo(Ui.Provider,{value:xp(()=>({cellEditorConfig:t.cellEditorConfig,cellEditorPlugins:t.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[t.cellEditorConfig,t.cellEditorPlugins]),children:e})}var zi=()=>{let[e]=ip(),t=Cp(Ui),{closeModal:o,toggleModal:r}=dp();return hp(()=>(e.hasNodes([ap])||ce(!1,"TablePlugin: TableNode is not registered on editor"),cp(e.registerCommand(Lt,()=>{let n=null;return e.getEditorState().read(()=>{let i=up();pp(i)&&(n=i)}),n&&r(ko),!0},mp))),[t,e,r]),bp(Gi.Fragment,{children:[wo(we,{data:{},drawerSlug:ko,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:(n,i)=>{o(ko),!(!i.columns||!i.rows)&&e.dispatchCommand(sp,{columns:String(i.columns),rows:String(i.rows)})},schemaPathSuffix:"fields"}),wo(lp,{hasCellBackgroundColor:!1,hasCellMerge:!0})]})};var Np=b({nodes:[yp,Ep,Lp],plugins:[{Component:zi,position:"normal"},{Component:Bi,position:"normal"},{Component:Di,position:"floatingAnchorElem"}],providers:[Wi],slashMenu:{groups:[$([{Icon:ho,key:"table",keywords:["table"],label:"Table",onSelect:({editor:e})=>{e.dispatchCommand(Lt,{})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:ho,key:"table",label:"Table",onSelect:({editor:e})=>{e.dispatchCommand(Lt,{})}}])]}});import{$isNodeSelection as Kp}from"lexical";import{jsx as Ro,jsxs as kp}from"react/jsx-runtime";var _o=()=>kp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ro("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Ro("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"#currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Ro("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{useLexicalComposerContext as Ap}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Dp,mergeRegister as Op}from"@lexical/utils";import{useConfig as Hp}from"@payloadcms/ui";import{$getPreviousSelection as $p,$getSelection as Bp,$isParagraphNode as Ki,$isRangeSelection as Gp,COMMAND_PRIORITY_EDITOR as Up,createCommand as Wp}from"lexical";import{useEffect as zp}from"react";import{useLexicalComposerContext as wp}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as Rp}from"@payloadcms/ui";import{$getNodeByKey as _p,COMMAND_PRIORITY_EDITOR as Sp}from"lexical";import{useCallback as vp,useEffect as Ip,useState as Fp}from"react";import{jsx as So}from"react/jsx-runtime";var Mp=({editor:e,relationTo:t,replaceNodeKey:o,value:r})=>{o?e.update(()=>{let n=_p(o);n&&n.replace(Fe({data:{fields:null,relationTo:t,value:r}}))}):e.dispatchCommand(vo,{fields:null,relationTo:t,value:r})},Pp=({enabledCollectionSlugs:e})=>{let[t]=wp(),[o,r]=Fp(null),[n,i,{closeDrawer:l,openDrawer:s}]=Rp({collectionSlugs:e,uploads:!0});Ip(()=>t.registerCommand(ve,c=>(r(c?.replace?c?.replace.nodeKey:null),s(),!0),Sp),[t,s]);let a=vp(({collectionSlug:c,docID:d})=>{Mp({editor:t,relationTo:c,replaceNodeKey:o,value:d}),l()},[t,l,o]);return So(n,{onSelect:a})},Vi=e=>So(Ye,{...e,uploads:!0,children:So(Pp,{...e})});import{jsx as Vp}from"react/jsx-runtime";var vo=Wp("INSERT_UPLOAD_COMMAND"),ji=({clientProps:e})=>{let[t]=Ap(),{collections:o}=Hp();return zp(()=>{if(!t.hasNodes([Ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Op(t.registerCommand(vo,r=>(t.update(()=>{let n=Bp()||$p();if(Gp(n)){let i=Fe({data:{id:r.id,fields:r.fields,relationTo:r.relationTo,value:r.value}});Dp(i);let{focus:l}=n,s=l.getNode();Ki(s)&&s.getTextContentSize()===0&&s.getParent().getChildren().filter(a=>Ki(a)).length>1&&s.remove()}}),!0),Up))},[t]),Vp(Vi,{enabledCollectionSlugs:o.map(({slug:r})=>r)})};var jp=b({nodes:[Ie],plugins:[{Component:ji,position:"normal"}],slashMenu:{groups:[$([{Icon:_o,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(ve,{replace:!1})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:_o,isActive:({selection:e})=>{if(!Kp(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return vt(t)},key:"upload",label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(ve,{replace:!1})}}])]}});import{ShimmerEffect as Xp,useClientFunctions as Zp,useFieldProps as Jp}from"@payloadcms/ui";import Xi,{Suspense as Yp,lazy as qp,useEffect as Qp,useState as Io}from"react";import{jsx as Nt,jsxs as om}from"react/jsx-runtime";var em=qp(()=>import("./Field-5KHQLTCU.js").then(e=>({default:e.RichText}))),tm=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,{schemaPath:n}=Jp(),i=Zp(),[l,s]=Io(!1),[a,c]=Io([]),[d,u]=Io(null),m=r.get("features");m=m.sort((C,h)=>C.order-h.order);let f=0;for(let C of m){let h=Array.from(r.keys()).filter(E=>E.startsWith(`lexical_internal_feature.${C.key}.lexical_internal_components.`));f+=1,f+=h.length}return Qp(()=>{if(!l){let C=[],h=0;if(Object.entries(i).forEach(([E,T])=>{E.startsWith(`lexicalFeature.${n}.`)&&(E.includes(".lexical_internal_components.")||C.push(T),h++)}),h===f){c(C),s(!0);let E=qe({clientFunctions:i,schemaPath:n,unSanitizedEditorConfig:{features:C,lexical:o}});u(Pe(o||Me,E,t))}}},[t,l,i,n,m.length,a,d,o,f]),l?Nt(Yp,{fallback:Nt(Xp,{height:"35vh"}),children:d&&Nt(em,{...e,editorConfig:d})}):Nt(Xi.Fragment,{children:Array.isArray(m)&&m.map(C=>{let E=Array.from(r.keys()).filter(T=>T.startsWith(`lexical_internal_feature.${C.key}.lexical_internal_components.`)).map(T=>r.get(T));return om(Xi.Fragment,{children:[E?.length?E.map(T=>T):null,C.ClientFeature]},C.key)})})};function kt(e,t=new WeakMap){if(e===null)return null;if(t.has(e))return t.get(e);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){let o=new Map;t.set(e,o);for(let[r,n]of e.entries())o.set(r,kt(n,t));return o}if(e instanceof Set){let o=new Set;t.set(e,o);for(let r of e.values())o.add(kt(r,t));return o}if(typeof e=="object"&&e!==null){if("$$typeof"in e&&typeof e.$$typeof=="symbol")return e;let o=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));t.set(e,o);for(let r in e)(Object.prototype.hasOwnProperty.call(e,r)||Object.getOwnPropertySymbols(e).includes(r))&&(o[r]=kt(e[r],t));return o}return e}function rm(...e){return e.filter(Boolean).join(" ")}var wt=new WeakMap;function Zi(e){let t=e.changedTouches[0];return t===void 0?null:[t.clientX,t.clientY]}function Rt(e,t){let o=wt.get(e);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=Zi(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=Zi(l);for(let c of r)a!==null&&c([a[0]-s[0],a[1]-s[1]],l)};e.addEventListener("touchstart",n),e.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},wt.set(e,o)}return o.listeners.add(t),()=>{nm(e,t)}}function nm(e,t){let o=wt.get(e);if(o===void 0)return;let{listeners:r}=o;r.delete(t),r.size===0&&(wt.delete(e),e.removeEventListener("touchstart",o.handleTouchstart),e.removeEventListener("touchend",o.handleTouchend))}function im(e,t){return Rt(e,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&t(n,r)})}function lm(e,t){return Rt(e,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&t(n,r)})}function sm(e,t){return Rt(e,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&t(n,r)})}function am(e,t){return Rt(e,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&t(n,r)})}export{De as $createAutoLinkNode,me as $createBlockNode,q as $createLinkNode,Se as $createRelationshipNode,Fe as $createUploadNode,ee as $isAutoLinkNode,Rl as $isBlockNode,H as $isLinkNode,St as $isRelationshipNode,vt as $isUploadNode,gl as AlignFeatureClient,Q as AutoLinkNode,J as BlockNode,El as BlockquoteFeatureClient,es as BlocksFeatureClient,bs as BoldFeatureClient,K as CAN_USE_DOM,Fc as ChecklistFeatureClient,ad as DETAIL_TYPE_TO_DETAIL,nd as DOUBLE_LINE_BREAK,dd as ELEMENT_FORMAT_TO_TYPE,cd as ELEMENT_TYPE_TO_FORMAT,Yi as ENABLE_SLASH_MENU_COMMAND,Ji as EditorConfigProvider,we as FieldsDrawer,uu as FixedToolbarFeatureClient,Js as HeadingFeatureClient,ia as HorizontalRuleFeatureClient,od as IS_ALL_FORMATTING,da as IndentFeatureClient,Ns as InlineCodeFeatureClient,yu as InlineToolbarFeatureClient,Rs as ItalicFeatureClient,ld as LTR_REGEX,td as LexicalPluginToLexicalFeatureClient,hc as LinkFeatureClient,V as LinkNode,rd as NON_BREAKING_SPACE,w as NodeFormat,Bc as OrderedListFeatureClient,yd as ParagraphFeatureClient,Qi as Point,id as RTL_REGEX,tl as Rect,Gd as RelationshipFeatureClient,_e as RelationshipNode,ll as RichTextCell,tm as RichTextField,bd as SlateToLexicalFeatureClient,Is as StrikethroughFeatureClient,Ps as SubscriptFeatureClient,Os as SuperscriptFeatureClient,ud as TEXT_MODE_TO_TYPE,sd as TEXT_TYPE_TO_FORMAT,pd as TEXT_TYPE_TO_MODE,Z as TOGGLE_LINK_COMMAND,Np as TableFeatureClient,ms as TestRecorderFeatureClient,Ue as ToolbarButton,ue as ToolbarDropdown,hs as TreeViewFeatureClient,Gs as UnderlineFeatureClient,Xc as UnorderedListFeatureClient,jp as UploadFeatureClient,Ie as UploadNode,am as addSwipeDownListener,im as addSwipeLeftListener,lm as addSwipeRightListener,sm as addSwipeUpListener,kt as cloneDeep,Wt as createBlockNode,Ot as createClientComponent,b as createClientFeature,Me as defaultEditorLexicalConfig,Co as getDOMRangeRect,_t as getEnabledNodes,fe as getSelectedNode,ce as invariant,qi as isHTMLElement,el as isPoint,rm as joinClasses,Pe as sanitizeClientEditorConfig,Mo as sanitizeClientFeatures,gt as setFloatingElemPosition,ct as setFloatingElemPositionForLinkEditor,$ as slashMenuBasicGroupWithItems,Y as toolbarAddDropdownGroupWithItems,Vt as toolbarFeatureButtonsGroupWithItems,B as toolbarFormatGroupWithItems,z as toolbarTextDropdownGroupWithItems,G as useEditorConfigContext};
|
|
37
|
+
`,ei="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ti="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",id=new RegExp("^[^"+ti+"]*["+ei+"]"),ld=new RegExp("^[^"+ei+"]*["+ti+"]"),sd={bold:w.IS_BOLD,code:w.IS_CODE,highlight:w.IS_HIGHLIGHT,italic:w.IS_ITALIC,strikethrough:w.IS_STRIKETHROUGH,subscript:w.IS_SUBSCRIPT,superscript:w.IS_SUPERSCRIPT,underline:w.IS_UNDERLINE},ad={directionless:w.IS_DIRECTIONLESS,unmergeable:w.IS_UNMERGEABLE},cd={center:w.IS_ALIGN_CENTER,end:w.IS_ALIGN_END,justify:w.IS_ALIGN_JUSTIFY,left:w.IS_ALIGN_LEFT,right:w.IS_ALIGN_RIGHT,start:w.IS_ALIGN_START},dd={[w.IS_ALIGN_CENTER]:"center",[w.IS_ALIGN_END]:"end",[w.IS_ALIGN_JUSTIFY]:"justify",[w.IS_ALIGN_LEFT]:"left",[w.IS_ALIGN_RIGHT]:"right",[w.IS_ALIGN_START]:"start"},ud={normal:w.IS_NORMAL,segmented:w.IS_SEGMENTED,token:w.IS_TOKEN},pd={[w.IS_NORMAL]:"normal",[w.IS_SEGMENTED]:"segmented",[w.IS_TOKEN]:"token"};function ri({converters:e,slateData:t}){return{root:{type:"root",children:ni({canContainParagraphs:!0,converters:e,parentNodeType:"root",slateNodes:t}),direction:"ltr",format:"",indent:0,version:1}}}function ni({canContainParagraphs:e,converters:t,parentNodeType:o,slateNodes:r}){if(!t?.length)return[];let n=t.find(i=>i.nodeTypes.includes("unknown"));return r.map((i,l)=>{if(!("type"in i))return e?oi(t,i):md(i);if(i.type==="p")return oi(t,i);let s=t.find(a=>a.nodeTypes.includes(i.type));return s?s.converter({childIndex:l,converters:t,parentNodeType:o,slateNode:i}):(console.warn("slateToLexical > No converter found for node type: "+i.type),n?.converter({childIndex:l,converters:t,parentNodeType:o,slateNode:i}))})||[]}function oi(e,t){return{type:"paragraph",children:ni({canContainParagraphs:!1,converters:e,parentNodeType:"paragraph",slateNodes:t.children||[]}),direction:"ltr",format:"",indent:0,textFormat:0,version:1}}function md(e){return{type:"text",detail:0,format:fd(e),mode:"normal",style:"",text:e.text,version:1}}function fd(e){let t=0;return e.bold&&(t=t|w.IS_BOLD),e.italic&&(t=t|w.IS_ITALIC),e.strikethrough&&(t=t|w.IS_STRIKETHROUGH),e.underline&&(t=t|w.IS_UNDERLINE),e.subscript&&(t=t|w.IS_SUBSCRIPT),e.superscript&&(t=t|w.IS_SUPERSCRIPT),e.code&&(t=t|w.IS_CODE),t}import{addClassNamesToElement as gd}from"@lexical/utils";import{DecoratorNode as Cd}from"lexical";import*as ii from"react";import{jsx as Td}from"react/jsx-runtime";var hd=ii.lazy(()=>import("./Component-LAKSCIDX.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),Be=class e extends Cd{__data;constructor({data:t,key:o}){super(o),this.__data=t}static clone(t){return new e({data:t.__data,key:t.__key})}static getType(){return"unknownConverted"}static importJSON(t){return xd({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return gd(o,"unknownConverted"),o}decorate(){return Td(hd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function xd({data:e}){return new Be({data:e})}var bd=b(({clientFunctions:e})=>{let t=Object.values(e);return{hooks:{load({incomingEditorState:o}){return!o||!Array.isArray(o)||"root"in o?o:ri({converters:t,slateData:o})}},nodes:[Be]}});import{$setBlocksType as ai}from"@lexical/selection";import{$createParagraphNode as ci,$getSelection as di,$isParagraphNode as li,$isRangeSelection as Ed}from"lexical";var si=[z([{ChildComponent:Ae,isActive:({selection:e})=>{if(!Ed(e))return!1;for(let t of e.getNodes())if(!li(t)&&!li(t.getParent()))return!1;return!0},key:"paragraph",label:({i18n:e})=>e.t("lexical:paragraph:label2"),onSelect:({editor:e})=>{e.update(()=>{let t=di();ai(t,()=>ci())})},order:1}])],yd=b({slashMenu:{groups:[$([{Icon:Ae,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:e})=>e.t("lexical:paragraph:label"),onSelect:({editor:e})=>{e.update(()=>{let t=di();ai(t,()=>ci())})}}])]},toolbarFixed:{groups:si},toolbarInline:{groups:si}});import{$isNodeSelection as Bd}from"lexical";import{jsx as Ge,jsxs as Ld}from"react/jsx-runtime";var so=()=>Ld("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ge("g",{clipPath:"url(#clip0_4397_10817)",children:Ge("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),Ge("defs",{children:Ge("clipPath",{id:"clip0_4397_10817",children:Ge("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{useLexicalComposerContext as vd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Id}from"@lexical/utils";import{useConfig as Fd}from"@payloadcms/ui";import{$getPreviousSelection as Md,$getSelection as Pd,$isParagraphNode as gi,$isRangeSelection as Ad,COMMAND_PRIORITY_EDITOR as Dd,createCommand as Od}from"lexical";import{useEffect as Hd}from"react";import{useLexicalComposerContext as Nd}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as kd}from"@payloadcms/ui";import{$getNodeByKey as wd,COMMAND_PRIORITY_EDITOR as Rd}from"lexical";import{useCallback as _d,useEffect as ui,useState as pi}from"react";import{jsx as ut}from"react/jsx-runtime";var Sd=({editor:e,relationTo:t,replaceNodeKey:o,value:r})=>{o?e.update(()=>{let n=wd(o);n&&n.replace(Se({relationTo:t,value:r}))}):e.dispatchCommand(ao,{relationTo:t,value:r})},mi=({enabledCollectionSlugs:e})=>{let[t]=Nd(),[o,r]=pi(()=>e[0]),[n,i]=pi(null),[l,s,{closeDrawer:a,isDrawerOpen:c,openDrawer:d}]=kd({collectionSlugs:e,selectedCollection:o});ui(()=>t.registerCommand(Re,m=>(i(m?.replace?m?.replace.nodeKey:null),d(),!0),Rd),[t,d]);let u=_d(({collectionSlug:m,docID:f})=>{Sd({editor:t,relationTo:m,replaceNodeKey:n,value:f}),a()},[t,a,n]);return ui(()=>{r(e[0])},[c,e]),ut(l,{onSelect:u})},fi=e=>e?.enabledCollectionSlugs?.length>0?ut(mi,{...e}):ut(Ye,{...e,children:ut(mi,{...e})});import{jsx as $d}from"react/jsx-runtime";var ao=Od("INSERT_RELATIONSHIP_COMMAND"),Ci=({clientProps:e})=>{let[t]=vd(),{collections:o}=Fd(),r=null;return e?.enabledCollections?r=e?.enabledCollections:e?.disabledCollections&&(r=o.filter(({slug:n})=>!e?.disabledCollections?.includes(n)).map(({slug:n})=>n)),Hd(()=>{if(!t.hasNodes([_e]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return t.registerCommand(ao,n=>{let i=Pd()||Md();if(Ad(i)){let l=Se(n);Id(l);let{focus:s}=i,a=s.getNode();gi(a)&&a.getTextContentSize()===0&&a.getParent().getChildren().filter(c=>gi(c)).length>1&&a.remove()}return!0},Dd)},[t]),$d(fi,{enabledCollectionSlugs:r})};var Gd=b({nodes:[_e],plugins:[{Component:Ci,position:"normal"}],slashMenu:{groups:[$([{Icon:so,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(Re,{replace:!1})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:so,isActive:({selection:e})=>{if(!Bd(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return St(t)},key:"relationship",label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(Re,{replace:!1})}}])]}});import{useLexicalComposerContext as ou}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as ru,useThrottledEffect as nu,useTranslation as iu}from"@payloadcms/ui";import*as te from"react";import{useMemo as lu}from"react";import{mergeRegister as Ud}from"@lexical/utils";import{$getSelection as Wd}from"lexical";import{useCallback as zd,useEffect as pt,useState as co}from"react";import{jsx as Vd}from"react/jsx-runtime";var uo="toolbar-popup__button",Ue=({children:e,editor:t,item:o})=>{let[r,n]=co(!0),[i,l]=co(!1),[s,a]=co(uo),c=G(),d=zd(()=>{t.getEditorState().read(()=>{let u=Wd();if(o.isActive){let m=o.isActive({editor:t,editorConfigContext:c,selection:u});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:t,editorConfigContext:c,selection:u});r!==m&&n(m)}})},[i,t,c,r,o]);return pt(()=>{d()},[d]),pt(()=>(document.addEventListener("mouseup",d),()=>{document.removeEventListener("mouseup",d)}),[d]),pt(()=>Ud(t.registerUpdateListener(()=>{d()})),[t,d]),pt(()=>{a([uo,r===!1?"disabled":"",i?"active":"",o?.key?`${uo}-`+o.key:""].filter(Boolean).join(" "))},[r,i,s,o.key]),Vd("button",{className:s,onClick:()=>{if(r!==!1)return t._updateTags=new Set([...t._updateTags,"toolbar"]),t.focus(()=>{o.onSelect({editor:t,isActive:i})}),!0},onMouseDown:u=>{u.preventDefault()},type:"button",children:e})};import Ei,{useCallback as Jd,useEffect as fo}from"react";import{mergeRegister as Yd}from"@lexical/utils";import{useTranslation as qd}from"@payloadcms/ui";import{$getSelection as Qd}from"lexical";import mt,{useCallback as Kd,useEffect as We,useMemo as jd,useRef as mo,useState as ft}from"react";import{createPortal as Xd}from"react-dom";import{jsx as ie,jsxs as hi}from"react/jsx-runtime";var po="toolbar-popup__dropdown-item",xi=mt.createContext(null);function Ti({active:e,children:t,editor:o,enabled:r,item:n,title:i}){let[l,s]=ft(po);We(()=>{s([po,r===!1?"disabled":"",e?"active":"",n?.key?`${po}-${n.key}`:""].filter(Boolean).join(" "))},[r,e,l,n.key]);let a=mo(null),c=mt.useContext(xi);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:d}=c;return We(()=>{a?.current!=null&&d(a)},[a,d]),ie("button",{className:l,onClick:()=>{r!==!1&&(o._updateTags=new Set([...o._updateTags,"toolbar"]),o.focus(()=>{n.onSelect({editor:o,isActive:e})}))},onMouseDown:u=>{u.preventDefault()},ref:a,title:i,type:"button",children:t})}function Zd({children:e,dropDownRef:t,itemsContainerClassNames:o,onClose:r}){let[n,i]=ft(),[l,s]=ft(),a=Kd(u=>{i(m=>m!=null?[...m,u]:[u])},[i]),c=u=>{if(n==null)return;let{key:m}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&u.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(f=>{if(f==null)return n[0];let C=n.indexOf(f)-1;return n[C===-1?n.length-1:C]}):m==="ArrowDown"&&s(f=>f==null?n[0]:n[n.indexOf(f)+1])},d=jd(()=>({registerItem:a}),[a]);return We(()=>{n!=null&&l==null&&s(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),ie(xi.Provider,{value:d,children:ie("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:t,children:e})})}function bi({Icon:e,buttonAriaLabel:t,buttonClassName:o,children:r,disabled:n=!1,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=mo(null),c=mo(null),[d,u]=ft(!1),m=()=>{u(!1),c?.current!=null&&c.current.focus()};We(()=>{let C=c.current,h=a.current;if(d&&C!==null&&h!==null){let{left:E,top:T}=C.getBoundingClientRect(),I=window.scrollY||document.documentElement.scrollTop;h.style.top=`${T+I+C.offsetHeight+5}px`,h.style.left=`${Math.min(E-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,c,d]),We(()=>{let C=c.current;if(C!==null&&d){let h=E=>{let{target:T}=E;s!=null&&a.current!=null&&a.current.contains(T)||C.contains(T)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,c,d,s]);let f=Xd(ie(Zd,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:r}),document.body);return hi(mt.Fragment,{children:[hi("button",{"aria-label":t,className:o+(d?" active":""),disabled:n,onClick:C=>{C.preventDefault(),u(!d)},onMouseDown:C=>{C.preventDefault()},ref:c,type:"button",children:[e&&ie(e,{}),l&&ie("span",{className:"toolbar-popup__dropdown-label",children:l}),ie("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&ie(mt.Fragment,{children:f})]})}import{jsx as ze,jsxs as tu}from"react/jsx-runtime";var go="toolbar-popup__dropdown",eu=({active:e,anchorElem:t,editor:o,enabled:r,item:n})=>{let{i18n:i}=qd();if(n.Component)return n?.Component&&ze(n.Component,{active:e,anchorElem:t,editor:o,enabled:r,item:n},n.key);let l=n.key;return n.label&&(l=typeof n.label=="function"?n.label({i18n:i}):n.label),l.length>25&&(l=l.substring(0,25)+"..."),tu(Ti,{active:e,editor:o,enabled:r,item:n,children:[n?.ChildComponent&&ze(n.ChildComponent,{}),ze("span",{className:"text",children:l})]},n.key)},ue=({Icon:e,anchorElem:t,classNames:o,editor:r,groupKey:n,items:i,itemsContainerClassNames:l,label:s,maxActiveItems:a,onActiveChange:c})=>{let[d,u]=Ei.useState([]),[m,f]=Ei.useState([]),C=G(),h=Jd(()=>{r.getEditorState().read(()=>{let E=Qd(),T=[],I=[],M=[];for(let x of i)x.isActive&&(!a||T.length<a)&&x.isActive({editor:r,editorConfigContext:C,selection:E})&&(T.push(x.key),I.push(x)),x.isEnabled?x.isEnabled({editor:r,editorConfigContext:C,selection:E})&&M.push(x.key):M.push(x.key);u(T),f(M),c&&c({activeItems:I})})},[r,C,i,a,c]);return fo(()=>{h()},[h]),fo(()=>(document.addEventListener("mouseup",h),()=>{document.removeEventListener("mouseup",h)}),[h]),fo(()=>Yd(r.registerUpdateListener(()=>{h()})),[r,h]),ze(bi,{Icon:e,buttonAriaLabel:`${n} dropdown`,buttonClassName:[go,`${go}-${n}`,...o||[]].filter(Boolean).join(" "),itemsContainerClassNames:[`${go}-items`,...l||[]],label:s,children:i.length&&i.map(E=>ze(eu,{active:d.includes(E.key),anchorElem:t,editor:r,enabled:m.includes(E.key),item:E},E.key))},n)};import{jsx as j,jsxs as du}from"react/jsx-runtime";function su({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&j(o.Component,{anchorElem:e,editor:t,item:o},o.key):j(Ue,{editor:t,item:o,children:o?.ChildComponent&&j(o.ChildComponent,{})},o.key)}function au({anchorElem:e,editor:t,editorConfig:o,group:r,index:n}){let{i18n:i}=iu(),[l,s]=te.useState(null),[a,c]=te.useState(null);te.useEffect(()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?c(()=>r.ChildComponent):c(null)},[r]);let d=({activeItems:u})=>{if(!u.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?(c(()=>r.ChildComponent),s(null)):(c(null),s(null));return}let m=u[0],f=m.key;m.label&&(f=typeof m.label=="function"?m.label({i18n:i}):m.label),f.length>25&&(f=f.substring(0,25)+"..."),s(f),c(()=>m.ChildComponent)};return du("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,children:[r.type==="dropdown"&&r.items.length&&(a?j(ue,{Icon:a,anchorElem:e,editor:t,groupKey:r.key,items:r.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:l,maxActiveItems:1,onActiveChange:d}):j(ue,{anchorElem:e,editor:t,groupKey:r.key,items:r.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:l,maxActiveItems:1,onActiveChange:d})),r.type==="buttons"&&r.items.length&&r.items.map(u=>j(su,{anchorElem:e,editor:t,item:u},u.key)),n<o.features.toolbarFixed?.groups.length-1&&j("div",{className:"divider"})]},r.key)}function cu({anchorElem:e,clientProps:t,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=te.useRef(null),{y:l}=ru(),s=lu(()=>{if(!n||t?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[t?.disableIfParentHasFixedToolbar,n]);return nu(()=>{if(!s)return;let a=i.current;if(!a)return;let c=a.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))i.current.className="fixed-toolbar fixed-toolbar--overlapping",s.className="fixed-toolbar fixed-toolbar--hide";else{if(!i.current.classList.contains("fixed-toolbar--overlapping"))return;i.current.className="fixed-toolbar",s.className="fixed-toolbar"}},50,[i,s,l]),j("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&j(te.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((a,c)=>j(au,{anchorElem:e,editor:o,editorConfig:r,group:a,index:c},a.key))})})}var yi=e=>{if(e.parentEditor?.editorConfig){if(e.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return e.parentEditor;if(e.parentEditor)return yi(e.parentEditor)}return!1},Li=({anchorElem:e,clientProps:t})=>{let[o]=ou(),r=G(),{editorConfig:n}=r,i=t.applyToFocusedEditor&&r.focusedEditor?.editor||o,l=t.applyToFocusedEditor&&r.focusedEditor?.editorConfig||n,s=yi(r);return t?.disableIfParentHasFixedToolbar&&s||!l?.features?.toolbarFixed?.groups?.length?null:j(cu,{anchorElem:e,editor:i,editorConfig:l,parentWithFixedToolbar:s})};var uu=b({plugins:[{Component:Li,position:"aboveContainer"}]});import{useLexicalComposerContext as pu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as wi}from"@lexical/utils";import{$getSelection as Ri,$isRangeSelection as Ni,$isTextNode as mu,COMMAND_PRIORITY_LOW as fu,SELECTION_CHANGE_COMMAND as gu}from"lexical";import{useCallback as Ve,useEffect as Ke,useRef as ki,useState as Cu}from"react";import*as Ee from"react";import{createPortal as hu}from"react-dom";function Co(e,t){let o=e.getRangeAt(0),r;if(e.anchorNode===t){let n=t;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function gt(e){let{alwaysDisplayOnTop:t=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=5,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:c=10}=e,d=o.parentElement;if(a===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),m=o.getBoundingClientRect(),f=d.getBoundingClientRect(),C=a.top-u.height-c,h=a.left-i;l==="center"&&(h=a.left+a.width/2-u.width/2);let E=0;return!t&&C<f.top&&!s&&(E=u.height+a.height+c*2,C+=E),l==="center"?h+u.width>f.right?h=f.right-u.width-i:h<f.left&&(h=f.left+i):h+u.width>f.right&&(h=f.right-u.width-i),h-=m.left,n.style.opacity="1",s&&r!==0?(C-=m.bottom-r+u.height-3,n.style.transform=`translate(${h}px, ${C}px) rotate(180deg)`):(C-=m.top,n.style.transform=`translate(${h}px, ${C}px)`),E}import{jsx as X,jsxs as Si}from"react/jsx-runtime";function xu({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&X(o.Component,{anchorElem:e,editor:t,item:o},o.key):X(Ue,{editor:t,item:o,children:o?.ChildComponent&&X(o.ChildComponent,{})},o.key)}function Tu({anchorElem:e,editor:t,group:o,index:r}){let{editorConfig:n}=G(),[i,l]=Ee.useState(null);Ee.useEffect(()=>{o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null)},[o]);let s=({activeItems:a})=>{if(!a.length){o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null);return}let c=a[0];l(()=>c.ChildComponent)};return Si("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,children:[o.type==="dropdown"&&o.items.length&&(i?X(ue,{Icon:i,anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:s}):X(ue,{anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:s})),o.type==="buttons"&&o.items.length&&o.items.map(a=>X(xu,{anchorElem:e,editor:t,item:a},a.key)),r<n.features.toolbarInline?.groups.length-1&&X("div",{className:"divider"})]},o.key)}function bu({anchorElem:e,editor:t}){let o=ki(null),r=ki(null),{editorConfig:n}=G(),i=Ve(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),l=Ve(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";if(!d||!u){let m=c.clientX,f=c.clientY,C=document.elementFromPoint(m,f);o.current.contains(C)||i()}}},[i]),s=Ve(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ke(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ve(()=>{let c=Ri(),d=window.getSelection();if(o.current===null)return;let u=e.querySelector(":scope > .link-editor"),m=u!==null&&"style"in u&&u?.style?.opacity==="1",f=t.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&f!==null&&f.contains(d.anchorNode)){let C=Co(d,f),h=gt({alwaysDisplayOnTop:m,anchorElem:e,floatingElem:o.current,horizontalPosition:"center",targetRect:C});r.current&>({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:C,verticalGap:10})}else i()},[t,i,e]);return Ke(()=>{let c=e.parentElement,d=()=>{t.getEditorState().read(()=>{a()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[t,a,e]),Ke(()=>(t.getEditorState().read(()=>{a()}),wi(t.registerUpdateListener(({editorState:c})=>{c.read(()=>{a()})}),t.registerCommand(gu,()=>(a(),!1),fu))),[t,a]),Si("div",{className:"inline-toolbar-popup",ref:o,children:[X("div",{className:"caret",ref:r}),t.isEditable()&&X(Ee.Fragment,{children:n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>X(Tu,{anchorElem:e,editor:t,group:c,index:d},c.key))})]})}function Eu(e,t){let[o,r]=Cu(!1),n=Ve(()=>{e.getEditorState().read(()=>{if(e.isComposing())return;let i=Ri(),l=window.getSelection(),s=e.getRootElement();if(l!==null&&(!Ni(i)||s===null||!s.contains(l.anchorNode))){r(!1);return}if(!Ni(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),d=!1;for(let u of c)if(mu(u)){r(!0),d=!0;break}d||r(!1)}else r(!1);let a=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&a===""){r(!1);return}})},[e]);return Ke(()=>(document.addEventListener("selectionchange",n),document.addEventListener("mouseup",n),()=>{document.removeEventListener("selectionchange",n),document.removeEventListener("mouseup",n)}),[n]),Ke(()=>wi(e.registerUpdateListener(()=>{n()}),e.registerRootListener(()=>{e.getRootElement()===null&&r(!1)})),[e,n]),o?hu(X(bu,{anchorElem:t,editor:e}),t):null}var _i=({anchorElem:e})=>{let[t]=pu();return Eu(t,e)};var yu=b({plugins:[{Component:_i,position:"floatingAnchorElem"}]});import{TableCellNode as Ep,TableNode as yp,TableRowNode as Lp}from"@lexical/table";import{jsx as vi}from"react/jsx-runtime";var ho=()=>vi("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:vi("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{useLexicalComposerContext as Mi}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Nu}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as ku,$deleteTableRow__EXPERIMENTAL as wu,$getNodeTriplet as Ru,$getTableCellNodeFromLexicalNode as _u,$getTableColumnIndexFromTableCellNode as Su,$getTableNodeFromLexicalNodeOrThrow as Ct,$getTableRowIndexFromTableCellNode as vu,$insertTableColumn__EXPERIMENTAL as Iu,$insertTableRow__EXPERIMENTAL as Fu,$isTableCellNode as je,$isTableRowNode as bo,$isTableSelection as xt,$unmergeCell as Mu,TableCellHeaderStates as ye,TableCellNode as Pu,getTableObserverFromTableElement as Au}from"@lexical/table";import{useScrollInfo as Du}from"@payloadcms/ui";import{$createParagraphNode as Ou,$getRoot as Hu,$getSelection as Tt,$isElementNode as $u,$isParagraphNode as Pi,$isRangeSelection as Eo,$isTextNode as Bu}from"lexical";import*as yo from"react";import{useCallback as oe,useEffect as pe,useRef as ht,useState as Le}from"react";import{createPortal as Ai}from"react-dom";import{jsx as xo,jsxs as Lu}from"react/jsx-runtime";var Ii=()=>Lu("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[xo("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),xo("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),xo("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});import{jsx as D,jsxs as re}from"react/jsx-runtime";function To(e){let t=e.getShape();return{columns:t.toX-t.fromX+1,rows:t.toY-t.fromY+1}}function Gu(e){let t=e.getNodes(),o=[],r=null,n=null,i=0;for(let l=0;l<t.length;l++){let s=t[l];if(je(s)){let a=s.getParentOrThrow();if(ce(bo(a),"Expected CellNode to have a RowNode parent"),r!==a){if(n!==null&&i!==n)return!1;r!==null&&(n=i),r=a,i=0}let c=s.__colSpan;for(let d=0;d<c;d++)o[i+d]===void 0&&(o[i+d]=0),o[i+d]+=s.__rowSpan;i+=c}}return(n===null||i===n)&&o.every(l=>l===o[0])}function Uu(){let e=Tt();if(Eo(e)&&!e.isCollapsed()||xt(e)&&!e.anchor.is(e.focus)||!Eo(e)&&!xt(e))return!1;let[t]=Ru(e.anchor);return t.__colSpan>1||t.__rowSpan>1}function Fi(e){if(e.getChildrenSize()!==1)return!1;let t=e.getFirstChildOrThrow();return!(!Pi(t)||!t.isEmpty())}function Wu(e){let t=e.getLastDescendant();Bu(t)?t.select():$u(t)?t.selectEnd():t!==null&&t.selectNext()}function zu({cellMerge:e,contextRef:t,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[i]=Mi(),l=ht(null),[s,a]=Le(n),[c,d]=Le({columns:1,rows:1}),[u,m]=Le(!1),[f,C]=Le(!1),{y:h}=Du();pe(()=>i.registerMutationListener(Pu,g=>{g.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})}),[i,s]),pe(()=>{i.getEditorState().read(()=>{let g=Tt();if(xt(g)){let p=To(g);d(To(g)),m(Gu(g)&&(p.columns>1||p.rows>1))}C(Uu())})},[i]),pe(()=>{let g=t.current,p=l.current,R=i.getRootElement();if(g!=null&&p!=null&&R!=null){let k=R.getBoundingClientRect(),y=g.getBoundingClientRect();p.style.opacity="1";let v=p.getBoundingClientRect(),A=5,O=y.right+A;if(O+v.width>window.innerWidth||O+v.width>k.right){let W=y.left-v.width-A;O=(W<0?A:W)+window.pageXOffset}p.style.left=`${O+window.pageXOffset}px`;let U=y.top;if(U+v.height>window.innerHeight){let W=y.bottom-v.height;U=(W<0?A:W)+window.pageYOffset}p.style.top=`${U}px`}},[t,l,i,h]),pe(()=>{function g(p){l.current!=null&&t.current!=null&&!l.current.contains(p.target)&&!t.current.contains(p.target)&&r(!1)}return window.addEventListener("click",g),()=>window.removeEventListener("click",g)},[r,t]);let E=oe(()=>{i.update(()=>{if(s.isAttached()){let p=Ct(s),R=i.getElementByKey(p.getKey());if(!R)throw new Error("Expected to find tableElement in DOM");let k=Au(R);k!==null&&k.clearHighlight(),p.markDirty(),a(s.getLatest())}Hu().selectStart()})},[i,s]),T=()=>{i.update(()=>{let g=Tt();if(xt(g)){let{columns:p,rows:R}=To(g),k=g.getNodes(),y=null;for(let v=0;v<k.length;v++){let A=k[v];if(je(A))if(y===null){A.setColSpan(p).setRowSpan(R),y=A;let O=Fi(A),U;O&&Pi(U=A.getFirstChild())&&U.remove()}else je(y)&&(Fi(A)||y.append(...A.getChildren()),A.remove())}y!==null&&(y.getChildrenSize()===0&&y.append(Ou()),Wu(y)),o()}})},I=()=>{i.update(()=>{Mu()})},M=oe(g=>{i.update(()=>{Fu(g),o()})},[i,o]),x=oe(g=>{i.update(()=>{for(let p=0;p<c.columns;p++)Iu(g);o()})},[i,o,c.columns]),_=oe(()=>{i.update(()=>{wu(),o()})},[i,o]),S=oe(()=>{i.update(()=>{Ct(s).remove(),E(),o()})},[i,s,E,o]),F=oe(()=>{i.update(()=>{ku(),o()})},[i,o]),P=oe(()=>{i.update(()=>{let g=Ct(s),p=vu(s),R=g.getChildren();if(p>=R.length||p<0)throw new Error("Expected table cell to be inside of table row.");let k=R[p];if(!bo(k))throw new Error("Expected table row");k.getChildren().forEach(y=>{if(!je(y))throw new Error("Expected table cell");y.toggleHeaderStyle(ye.ROW)}),E(),o()})},[i,s,E,o]),L=oe(()=>{i.update(()=>{let g=Ct(s),p=Su(s),R=g.getChildren(),k=Math.max(...R.map(y=>y.getChildren().length));if(p>=k||p<0)throw new Error("Expected table cell to be inside of table row.");for(let y=0;y<R.length;y++){let v=R[y];if(!bo(v))throw new Error("Expected table row");let A=v.getChildren();if(p>=A.length)continue;let O=A[p];if(!je(O))throw new Error("Expected table cell");O.toggleHeaderStyle(ye.COLUMN)}E(),o()})},[i,s,E,o]),N=null;return e&&(u?N=D("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>T(),type:"button",children:"Merge cells"}):f&&(N=D("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>I(),type:"button",children:"Unmerge cells"}))),Ai(re("div",{className:"table-action-menu-dropdown",onClick:g=>{g.stopPropagation()},ref:l,children:[N?re(yo.Fragment,{children:[N,D("hr",{})]}):null,D("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>M(!1),type:"button",children:re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),D("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>M(!0),type:"button",children:re("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),D("hr",{}),D("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),D("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:re("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),D("hr",{}),D("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>F(),type:"button",children:D("span",{className:"text",children:"Delete column"})}),D("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>_(),type:"button",children:D("span",{className:"text",children:"Delete row"})}),D("button",{className:"item","data-test-id":"table-delete",onClick:()=>S(),type:"button",children:D("span",{className:"text",children:"Delete table"})}),D("hr",{}),D("button",{className:"item",onClick:()=>P(),type:"button",children:re("span",{className:"text",children:[(s.__headerState&ye.ROW)===ye.ROW?"Remove":"Add"," ","row header"]})}),D("button",{className:"item","data-test-id":"table-column-header",onClick:()=>L(),type:"button",children:re("span",{className:"text",children:[(s.__headerState&ye.COLUMN)===ye.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Vu({anchorElem:e,cellMerge:t}){let[o]=Mi(),r=ht(null),n=ht(null),[i,l]=Le(!1),[s,a]=Le(null),c=oe(()=>{let u=r.current,m=Tt(),f=window.getSelection(),C=document.activeElement;if(m==null||u==null){a(null);return}let h=o.getRootElement();if(Eo(m)&&h!==null&&f!==null&&h.contains(f.anchorNode)){let E=_u(m.anchor.getNode());if(E==null){a(null);return}if(o.getElementByKey(E.getKey())==null){a(null);return}a(E)}else C||a(null)},[o]);pe(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),pe(()=>{let u=r.current;if(u!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let f=m.getBoundingClientRect(),C=u.getBoundingClientRect(),h=e.getBoundingClientRect(),E=f.top-h.top+4,T=f.right-C.width-10-h.left;u.style.opacity="1",u.style.transform=`translate(${T}px, ${E}px)`}else u.style.opacity="0",u.style.transform="translate(-10000px, -10000px)"}},[r,s,o,e]);let d=ht(s);return pe(()=>{d.current!==s&&l(!1),d.current=s},[d,s]),D("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&re(yo.Fragment,{children:[D("button",{className:"table-cell-action-button",onClick:u=>{u.stopPropagation(),l(!i)},ref:n,type:"button",children:D(Ii,{})}),i&&D(zu,{cellMerge:t,contextRef:n,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Di=({anchorElem:e})=>{let t=Nu();return Ai(t?D(Vu,{anchorElem:e??document.body,cellMerge:!0}):null,e??document.body)};import{useLexicalComposerContext as Ku}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ju}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Xu,$getTableNodeFromLexicalNodeOrThrow as Lo,$getTableRowIndexFromTableCellNode as Zu,$isTableCellNode as Oi,$isTableRowNode as Ju,getDOMCellFromTarget as Yu}from"@lexical/table";import{calculateZoomLevel as Hi}from"@lexical/utils";import{$getNearestNodeFromDOMNode as No}from"lexical";import*as $i from"react";import{useCallback as Ne,useEffect as qu,useMemo as Qu,useRef as bt,useState as Et}from"react";import{createPortal as ep}from"react-dom";import{jsx as yt,jsxs as np}from"react/jsx-runtime";var tp=33,op=50;function rp({editor:e}){let t=bt(null),o=bt(null),r=bt(null),n=bt(null),[i,l]=Et(null),[s,a]=Et(null),[c,d]=Et(!1),[u,m]=Et(null),f=Ne(()=>{a(null),t.current=null,m(null),n.current=null,r.current=null},[]),C=L=>(L.buttons&1)===1;qu(()=>{let L=p=>{setTimeout(()=>{let R=p.target;if(u){l({x:p.clientX,y:p.clientY});return}if(d(C(p)),!(o.current&&o.current.contains(R))&&t.current!==R){t.current=R;let k=Yu(R);k&&s!==k?e.update(()=>{let y=No(k.elem);if(!y)throw new Error("TableCellResizer: Table cell node not found.");let v=Lo(y),A=e.getElementByKey(v.getKey());if(!A)throw new Error("TableCellResizer: Table element not found.");t.current=R,r.current=A.getBoundingClientRect(),a(k)}):k==null&&f()}},0)},N=p=>{setTimeout(()=>{d(!0)},0)},g=p=>{setTimeout(()=>{d(!1)},0)};return document.addEventListener("mousemove",L),document.addEventListener("mousedown",N),document.addEventListener("mouseup",g),()=>{document.removeEventListener("mousemove",L),document.removeEventListener("mousedown",N),document.removeEventListener("mouseup",g)}},[s,u,e,f]);let h=L=>L==="bottom",E=Ne(L=>{if(!s)throw new Error("TableCellResizer: Expected active cell.");e.update(()=>{let N=No(s.elem);if(!Oi(N))throw new Error("TableCellResizer: Table cell node not found.");let g=Lo(N),p=Zu(N),R=g.getChildren();if(p>=R.length||p<0)throw new Error("Expected table cell to be inside of table row.");let k=R[p];if(!Ju(k))throw new Error("Expected table row");let y=k.getHeight();if(y===void 0){let A=k.getChildren();y=Math.min(...A.map(O=>I(O,e)??1/0))}let v=Math.max(y+L,tp);k.setHeight(v)},{tag:"skip-scroll-into-view"})},[s,e]),T=(L,N)=>{let g=L.getWidth();if(g!==void 0)return g;let p=N.getElementByKey(L.getKey());if(p==null)return;let R=getComputedStyle(p);return p.clientWidth-parseFloat(R.paddingLeft)-parseFloat(R.paddingRight)},I=(L,N)=>N.getElementByKey(L.getKey())?.clientHeight,M=(L,N)=>{for(let g=0;g<N.length;g++)for(let p=0;p<N[g].length;p++)if(N[g][p].cell===L)return p},x=Ne(L=>{if(!s)throw new Error("TableCellResizer: Expected active cell.");e.update(()=>{let N=No(s.elem);if(!Oi(N))throw new Error("TableCellResizer: Table cell node not found.");let g=Lo(N),[p]=Xu(g,null,null),R=M(N,p);if(R===void 0)throw new Error("TableCellResizer: Table column not found.");for(let k=0;k<p.length;k++){let y=p[k][R];if(y.startRow===k&&(R===p[k].length-1||p[k][R].cell!==p[k][R+1].cell)){let v=T(y.cell,e);if(v===void 0)continue;let A=Math.max(v+L,op);y.cell.setWidth(A)}}},{tag:"skip-scroll-into-view"})},[s,e]),_=Ne(L=>{let N=g=>{if(g.preventDefault(),g.stopPropagation(),!s)throw new Error("TableCellResizer: Expected active cell.");if(n.current){let{x:p,y:R}=n.current;if(s===null)return;let k=Hi(g.target);if(h(L)){let y=(g.clientY-R)/k;E(y)}else{let y=(g.clientX-p)/k;x(y)}f(),document.removeEventListener("mouseup",N)}};return N},[s,f,x,E]),S=Ne(L=>N=>{if(N.preventDefault(),N.stopPropagation(),!s)throw new Error("TableCellResizer: Expected active cell.");n.current={x:N.clientX,y:N.clientY},l(n.current),m(L),document.addEventListener("mouseup",_(L))},[s,_]),P=Ne(()=>{if(s){let{height:L,left:N,top:g,width:p}=s.elem.getBoundingClientRect(),R=Hi(s.elem),k=10,y={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${k}px`,left:`${window.pageXOffset+N}px`,top:`${window.pageYOffset+g+L-k/2}px`,width:`${p}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${L}px`,left:`${window.pageXOffset+N+p-k/2}px`,top:`${window.pageYOffset+g}px`,width:`${k}px`}},v=r.current;return u&&i&&v&&(h(u)?(y[u].left=`${window.pageXOffset+v.left}px`,y[u].top=`${window.pageYOffset+i.y/R}px`,y[u].height="3px",y[u].width=`${v.width}px`):(y[u].top=`${window.pageYOffset+v.top}px`,y[u].left=`${window.pageXOffset+i.x/R}px`,y[u].width="3px",y[u].height=`${v.height}px`),y[u].backgroundColor="#adf"),y}return{bottom:null,left:null,right:null,top:null}},[s,u,i])();return yt("div",{ref:o,children:s!=null&&!c&&np($i.Fragment,{children:[yt("div",{className:"TableCellResizer__resizer TableCellResizer__ui",onMouseDown:S("right"),style:P.right||void 0}),yt("div",{className:"TableCellResizer__resizer TableCellResizer__ui",onMouseDown:S("bottom"),style:P.bottom||void 0})]})})}var Bi=()=>{let[e]=Ku(),t=ju();return Qu(()=>t?ep(yt(rp,{editor:e}),document.body):null,[e,t])};import{useLexicalComposerContext as ip}from"@lexical/react/LexicalComposerContext";import{TablePlugin as lp}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as sp,TableNode as ap}from"@lexical/table";import{mergeRegister as cp}from"@lexical/utils";import{useModal as dp}from"@payloadcms/ui";import{$getSelection as up,$isRangeSelection as pp,COMMAND_PRIORITY_EDITOR as mp,createCommand as fp}from"lexical";import{createContext as gp,useContext as Cp,useEffect as hp,useMemo as xp,useState as Tp}from"react";import*as Gi from"react";import{jsx as wo,jsxs as bp}from"react/jsx-runtime";var Lt=fp("OPEN_EMBED_DRAWER_COMMAND"),Ui=gp({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}}),ko="lexical-table-create";function Wi({children:e}){let[t,o]=Tp({cellEditorConfig:null,cellEditorPlugins:null});return wo(Ui.Provider,{value:xp(()=>({cellEditorConfig:t.cellEditorConfig,cellEditorPlugins:t.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[t.cellEditorConfig,t.cellEditorPlugins]),children:e})}var zi=()=>{let[e]=ip(),t=Cp(Ui),{closeModal:o,toggleModal:r}=dp();return hp(()=>(e.hasNodes([ap])||ce(!1,"TablePlugin: TableNode is not registered on editor"),cp(e.registerCommand(Lt,()=>{let n=null;return e.getEditorState().read(()=>{let i=up();pp(i)&&(n=i)}),n&&r(ko),!0},mp))),[t,e,r]),bp(Gi.Fragment,{children:[wo(we,{drawerSlug:ko,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:(n,i)=>{o(ko),!(!i.columns||!i.rows)&&e.dispatchCommand(sp,{columns:String(i.columns),rows:String(i.rows)})},schemaPathSuffix:"fields"}),wo(lp,{hasCellBackgroundColor:!1,hasCellMerge:!0})]})};var Np=b({nodes:[yp,Ep,Lp],plugins:[{Component:zi,position:"normal"},{Component:Bi,position:"normal"},{Component:Di,position:"floatingAnchorElem"}],providers:[Wi],slashMenu:{groups:[$([{Icon:ho,key:"table",keywords:["table"],label:"Table",onSelect:({editor:e})=>{e.dispatchCommand(Lt,{})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:ho,key:"table",label:"Table",onSelect:({editor:e})=>{e.dispatchCommand(Lt,{})}}])]}});import{$isNodeSelection as Kp}from"lexical";import{jsx as Ro,jsxs as kp}from"react/jsx-runtime";var _o=()=>kp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ro("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Ro("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"#currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Ro("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{useLexicalComposerContext as Ap}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Dp,mergeRegister as Op}from"@lexical/utils";import{useConfig as Hp}from"@payloadcms/ui";import{$getPreviousSelection as $p,$getSelection as Bp,$isParagraphNode as Ki,$isRangeSelection as Gp,COMMAND_PRIORITY_EDITOR as Up,createCommand as Wp}from"lexical";import{useEffect as zp}from"react";import{useLexicalComposerContext as wp}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as Rp}from"@payloadcms/ui";import{$getNodeByKey as _p,COMMAND_PRIORITY_EDITOR as Sp}from"lexical";import{useCallback as vp,useEffect as Ip,useState as Fp}from"react";import{jsx as So}from"react/jsx-runtime";var Mp=({editor:e,relationTo:t,replaceNodeKey:o,value:r})=>{o?e.update(()=>{let n=_p(o);n&&n.replace(Fe({data:{fields:null,relationTo:t,value:r}}))}):e.dispatchCommand(vo,{fields:null,relationTo:t,value:r})},Pp=({enabledCollectionSlugs:e})=>{let[t]=wp(),[o,r]=Fp(null),[n,i,{closeDrawer:l,openDrawer:s}]=Rp({collectionSlugs:e,uploads:!0});Ip(()=>t.registerCommand(ve,c=>(r(c?.replace?c?.replace.nodeKey:null),s(),!0),Sp),[t,s]);let a=vp(({collectionSlug:c,docID:d})=>{Mp({editor:t,relationTo:c,replaceNodeKey:o,value:d}),l()},[t,l,o]);return So(n,{onSelect:a})},Vi=e=>So(Ye,{...e,uploads:!0,children:So(Pp,{...e})});import{jsx as Vp}from"react/jsx-runtime";var vo=Wp("INSERT_UPLOAD_COMMAND"),ji=({clientProps:e})=>{let[t]=Ap(),{collections:o}=Hp();return zp(()=>{if(!t.hasNodes([Ie]))throw new Error("UploadPlugin: UploadNode not registered on editor");return Op(t.registerCommand(vo,r=>(t.update(()=>{let n=Bp()||$p();if(Gp(n)){let i=Fe({data:{id:r.id,fields:r.fields,relationTo:r.relationTo,value:r.value}});Dp(i);let{focus:l}=n,s=l.getNode();Ki(s)&&s.getTextContentSize()===0&&s.getParent().getChildren().filter(a=>Ki(a)).length>1&&s.remove()}}),!0),Up))},[t]),Vp(Vi,{enabledCollectionSlugs:o.map(({slug:r})=>r)})};var jp=b({nodes:[Ie],plugins:[{Component:ji,position:"normal"}],slashMenu:{groups:[$([{Icon:_o,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(ve,{replace:!1})}}])]},toolbarFixed:{groups:[Y([{ChildComponent:_o,isActive:({selection:e})=>{if(!Kp(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return vt(t)},key:"upload",label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(ve,{replace:!1})}}])]}});import{ShimmerEffect as Xp,useClientFunctions as Zp,useFieldProps as Jp}from"@payloadcms/ui";import Xi,{Suspense as Yp,lazy as qp,useEffect as Qp,useState as Io}from"react";import{jsx as Nt,jsxs as om}from"react/jsx-runtime";var em=qp(()=>import("./Field-5KHQLTCU.js").then(e=>({default:e.RichText}))),tm=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,{schemaPath:n}=Jp(),i=Zp(),[l,s]=Io(!1),[a,c]=Io([]),[d,u]=Io(null),m=r.get("features");m=m.sort((C,h)=>C.order-h.order);let f=0;for(let C of m){let h=Array.from(r.keys()).filter(E=>E.startsWith(`lexical_internal_feature.${C.key}.lexical_internal_components.`));f+=1,f+=h.length}return Qp(()=>{if(!l){let C=[],h=0;if(Object.entries(i).forEach(([E,T])=>{E.startsWith(`lexicalFeature.${n}.`)&&(E.includes(".lexical_internal_components.")||C.push(T),h++)}),h===f){c(C),s(!0);let E=qe({clientFunctions:i,schemaPath:n,unSanitizedEditorConfig:{features:C,lexical:o}});u(Pe(o||Me,E,t))}}},[t,l,i,n,m.length,a,d,o,f]),l?Nt(Yp,{fallback:Nt(Xp,{height:"35vh"}),children:d&&Nt(em,{...e,editorConfig:d})}):Nt(Xi.Fragment,{children:Array.isArray(m)&&m.map(C=>{let E=Array.from(r.keys()).filter(T=>T.startsWith(`lexical_internal_feature.${C.key}.lexical_internal_components.`)).map(T=>r.get(T));return om(Xi.Fragment,{children:[E?.length?E.map(T=>T):null,C.ClientFeature]},C.key)})})};function kt(e,t=new WeakMap){if(e===null)return null;if(t.has(e))return t.get(e);if(e instanceof Date)return new Date(e.getTime());if(e instanceof RegExp)return new RegExp(e.source,e.flags);if(e instanceof Map){let o=new Map;t.set(e,o);for(let[r,n]of e.entries())o.set(r,kt(n,t));return o}if(e instanceof Set){let o=new Set;t.set(e,o);for(let r of e.values())o.add(kt(r,t));return o}if(typeof e=="object"&&e!==null){if("$$typeof"in e&&typeof e.$$typeof=="symbol")return e;let o=Array.isArray(e)?[]:Object.create(Object.getPrototypeOf(e));t.set(e,o);for(let r in e)(Object.prototype.hasOwnProperty.call(e,r)||Object.getOwnPropertySymbols(e).includes(r))&&(o[r]=kt(e[r],t));return o}return e}function rm(...e){return e.filter(Boolean).join(" ")}var wt=new WeakMap;function Zi(e){let t=e.changedTouches[0];return t===void 0?null:[t.clientX,t.clientY]}function Rt(e,t){let o=wt.get(e);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=Zi(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=Zi(l);for(let c of r)a!==null&&c([a[0]-s[0],a[1]-s[1]],l)};e.addEventListener("touchstart",n),e.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},wt.set(e,o)}return o.listeners.add(t),()=>{nm(e,t)}}function nm(e,t){let o=wt.get(e);if(o===void 0)return;let{listeners:r}=o;r.delete(t),r.size===0&&(wt.delete(e),e.removeEventListener("touchstart",o.handleTouchstart),e.removeEventListener("touchend",o.handleTouchend))}function im(e,t){return Rt(e,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&t(n,r)})}function lm(e,t){return Rt(e,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&t(n,r)})}function sm(e,t){return Rt(e,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&t(n,r)})}function am(e,t){return Rt(e,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&t(n,r)})}export{De as $createAutoLinkNode,me as $createBlockNode,q as $createLinkNode,Se as $createRelationshipNode,Fe as $createUploadNode,ee as $isAutoLinkNode,Rl as $isBlockNode,H as $isLinkNode,St as $isRelationshipNode,vt as $isUploadNode,gl as AlignFeatureClient,Q as AutoLinkNode,J as BlockNode,El as BlockquoteFeatureClient,es as BlocksFeatureClient,bs as BoldFeatureClient,K as CAN_USE_DOM,Fc as ChecklistFeatureClient,ad as DETAIL_TYPE_TO_DETAIL,nd as DOUBLE_LINE_BREAK,dd as ELEMENT_FORMAT_TO_TYPE,cd as ELEMENT_TYPE_TO_FORMAT,Yi as ENABLE_SLASH_MENU_COMMAND,Ji as EditorConfigProvider,we as FieldsDrawer,uu as FixedToolbarFeatureClient,Js as HeadingFeatureClient,ia as HorizontalRuleFeatureClient,od as IS_ALL_FORMATTING,da as IndentFeatureClient,Ns as InlineCodeFeatureClient,yu as InlineToolbarFeatureClient,Rs as ItalicFeatureClient,ld as LTR_REGEX,td as LexicalPluginToLexicalFeatureClient,hc as LinkFeatureClient,V as LinkNode,rd as NON_BREAKING_SPACE,w as NodeFormat,Bc as OrderedListFeatureClient,yd as ParagraphFeatureClient,Qi as Point,id as RTL_REGEX,tl as Rect,Gd as RelationshipFeatureClient,_e as RelationshipNode,ll as RichTextCell,tm as RichTextField,bd as SlateToLexicalFeatureClient,Is as StrikethroughFeatureClient,Ps as SubscriptFeatureClient,Os as SuperscriptFeatureClient,ud as TEXT_MODE_TO_TYPE,sd as TEXT_TYPE_TO_FORMAT,pd as TEXT_TYPE_TO_MODE,Z as TOGGLE_LINK_COMMAND,Np as TableFeatureClient,ms as TestRecorderFeatureClient,Ue as ToolbarButton,ue as ToolbarDropdown,hs as TreeViewFeatureClient,Gs as UnderlineFeatureClient,Xc as UnorderedListFeatureClient,jp as UploadFeatureClient,Ie as UploadNode,am as addSwipeDownListener,im as addSwipeLeftListener,lm as addSwipeRightListener,sm as addSwipeUpListener,kt as cloneDeep,Wt as createBlockNode,Ot as createClientComponent,b as createClientFeature,Me as defaultEditorLexicalConfig,Co as getDOMRangeRect,_t as getEnabledNodes,fe as getSelectedNode,ce as invariant,qi as isHTMLElement,el as isPoint,rm as joinClasses,Pe as sanitizeClientEditorConfig,Mo as sanitizeClientFeatures,gt as setFloatingElemPosition,ct as setFloatingElemPositionForLinkEditor,$ as slashMenuBasicGroupWithItems,Y as toolbarAddDropdownGroupWithItems,Vt as toolbarFeatureButtonsGroupWithItems,B as toolbarFormatGroupWithItems,z as toolbarTextDropdownGroupWithItems,G as useEditorConfigContext};
|
|
38
38
|
//# sourceMappingURL=index.js.map
|