@payloadcms/richtext-lexical 3.0.0-beta.54 → 3.0.0-beta.56
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/{RelationshipComponent-5OU5HATX.js → RelationshipComponent-AFXEJMZQ.js} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-OAQL5GDK.js +2 -0
- package/dist/exports/client/chunk-OAQL5GDK.js.map +7 -0
- package/dist/exports/client/{chunk-MLIITFAS.js → chunk-Q5DYR7MH.js} +2 -2
- package/dist/exports/client/chunk-Q5DYR7MH.js.map +7 -0
- package/dist/exports/client/{chunk-OSR74ZNW.js → chunk-YL52LJO3.js} +2 -2
- package/dist/exports/client/chunk-YL52LJO3.js.map +7 -0
- package/dist/exports/client/component-V5QZ7EVZ.js +2 -0
- package/dist/exports/client/component-V5QZ7EVZ.js.map +7 -0
- package/dist/exports/client/{component-QWIGEOVD.js → component-VM36FRT2.js} +2 -2
- package/dist/exports/client/{component-PEFMKIXI.js → component-YNZTTMBY.js} +2 -2
- package/dist/exports/client/component-YNZTTMBY.js.map +7 -0
- package/dist/exports/client/index.d.ts +3 -1
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +7 -7
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blockquote/feature.server.d.ts +5 -0
- package/dist/features/blockquote/feature.server.d.ts.map +1 -1
- package/dist/features/blockquote/feature.server.js.map +1 -1
- package/dist/features/blocks/component/index.js +1 -1
- package/dist/features/blocks/component/index.js.map +1 -1
- package/dist/features/blocks/feature.server.d.ts.map +1 -1
- package/dist/features/blocks/feature.server.js +1 -11
- package/dist/features/blocks/feature.server.js.map +1 -1
- package/dist/features/blocks/nodes/BlocksNode.d.ts +2 -0
- package/dist/features/blocks/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/nodes/BlocksNode.js +1 -1
- package/dist/features/blocks/nodes/BlocksNode.js.map +1 -1
- package/dist/features/converters/html/feature.server.d.ts +1 -1
- package/dist/features/converters/html/feature.server.d.ts.map +1 -1
- package/dist/features/converters/html/feature.server.js.map +1 -1
- package/dist/features/heading/feature.server.d.ts +5 -1
- package/dist/features/heading/feature.server.d.ts.map +1 -1
- package/dist/features/heading/feature.server.js.map +1 -1
- package/dist/features/heading/i18n.js +2 -2
- package/dist/features/heading/i18n.js.map +1 -1
- package/dist/features/horizontalRule/nodes/HorizontalRuleNode.d.ts +5 -2
- package/dist/features/horizontalRule/nodes/HorizontalRuleNode.d.ts.map +1 -1
- package/dist/features/horizontalRule/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/link/feature.server.d.ts.map +1 -1
- package/dist/features/link/feature.server.js +1 -11
- package/dist/features/link/feature.server.js.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.d.ts.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.js +7 -1
- package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
- package/dist/features/link/nodes/LinkNode.js +1 -1
- package/dist/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/features/link/nodes/types.d.ts +7 -4
- package/dist/features/link/nodes/types.d.ts.map +1 -1
- package/dist/features/link/nodes/types.js.map +1 -1
- package/dist/features/link/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/features/link/plugins/floatingLinkEditor/LinkEditor/index.js +9 -5
- package/dist/features/link/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/lists/checklist/feature.server.js.map +1 -1
- package/dist/features/lists/htmlConverter.d.ts +1 -1
- package/dist/features/lists/htmlConverter.d.ts.map +1 -1
- package/dist/features/lists/htmlConverter.js.map +1 -1
- package/dist/features/lists/orderedList/feature.server.js.map +1 -1
- package/dist/features/lists/plugin/index.d.ts +10 -0
- package/dist/features/lists/plugin/index.d.ts.map +1 -1
- package/dist/features/lists/plugin/index.js.map +1 -1
- package/dist/features/lists/unorderedList/feature.server.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/heading/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/list/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/listItem/converter.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/converters/quote/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/blockquote/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/heading/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/listItem/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/orderedList/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/feature.server.d.ts +3 -1
- package/dist/features/migrations/slateToLexical/feature.server.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/feature.server.js +3 -1
- package/dist/features/migrations/slateToLexical/feature.server.js.map +1 -1
- package/dist/features/relationship/nodes/RelationshipNode.d.ts +6 -2
- package/dist/features/relationship/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/nodes/RelationshipNode.js +1 -1
- package/dist/features/relationship/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/toolbars/types.d.ts +30 -3
- package/dist/features/toolbars/types.d.ts.map +1 -1
- package/dist/features/toolbars/types.js.map +1 -1
- package/dist/features/typesClient.d.ts +2 -2
- package/dist/features/typesClient.d.ts.map +1 -1
- package/dist/features/typesClient.js.map +1 -1
- package/dist/features/typesServer.d.ts +26 -3
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/component/index.d.ts.map +1 -1
- package/dist/features/upload/component/index.js +34 -11
- package/dist/features/upload/component/index.js.map +1 -1
- package/dist/features/upload/feature.server.d.ts.map +1 -1
- package/dist/features/upload/feature.server.js +1 -11
- package/dist/features/upload/feature.server.js.map +1 -1
- package/dist/features/upload/nodes/UploadNode.d.ts +6 -2
- package/dist/features/upload/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/nodes/UploadNode.js +1 -1
- package/dist/features/upload/nodes/UploadNode.js.map +1 -1
- package/dist/field/index.js +8 -8
- package/dist/index.d.ts +8 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -0
- package/dist/index.js.map +1 -1
- package/dist/lexical/config/server/default.d.ts +1 -1
- package/dist/lexical/config/server/default.d.ts.map +1 -1
- package/dist/lexical/config/server/default.js.map +1 -1
- package/dist/lexical/config/types.d.ts +2 -2
- package/dist/lexical/config/types.d.ts.map +1 -1
- package/dist/lexical/config/types.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +9 -2
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.js.map +1 -1
- package/dist/nodeTypes.d.ts +31 -0
- package/dist/nodeTypes.d.ts.map +1 -0
- package/dist/nodeTypes.js +3 -0
- package/dist/nodeTypes.js.map +1 -0
- package/dist/types.d.ts +1 -1
- package/dist/types.js.map +1 -1
- package/dist/utilities/fieldsDrawer/Drawer.d.ts +18 -0
- package/dist/utilities/fieldsDrawer/Drawer.d.ts.map +1 -0
- package/dist/utilities/fieldsDrawer/Drawer.js +26 -0
- package/dist/utilities/fieldsDrawer/Drawer.js.map +1 -0
- package/dist/utilities/fieldsDrawer/DrawerContent.d.ts +4 -0
- package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -0
- package/dist/{features/link/drawer/index.js → utilities/fieldsDrawer/DrawerContent.js} +38 -40
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -0
- package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
- package/dist/utilities/generateSchemaMap.js +9 -0
- package/dist/utilities/generateSchemaMap.js.map +1 -1
- package/dist/utilities/migrateSlateToLexical/index.d.ts +15 -0
- package/dist/utilities/migrateSlateToLexical/index.d.ts.map +1 -0
- package/dist/utilities/migrateSlateToLexical/index.js +105 -0
- package/dist/utilities/migrateSlateToLexical/index.js.map +1 -0
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts +9 -0
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +1 -0
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +77 -0
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -0
- package/dist/utilities/upgradeLexicalData/index.d.ts +11 -0
- package/dist/utilities/upgradeLexicalData/index.d.ts.map +1 -0
- package/dist/utilities/upgradeLexicalData/index.js +101 -0
- package/dist/utilities/upgradeLexicalData/index.js.map +1 -0
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts +9 -0
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -0
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js +74 -0
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -0
- package/package.json +9 -9
- package/dist/exports/client/chunk-MLIITFAS.js.map +0 -7
- package/dist/exports/client/chunk-OSR74ZNW.js.map +0 -7
- package/dist/exports/client/chunk-TZLHAUCW.js +0 -2
- package/dist/exports/client/chunk-TZLHAUCW.js.map +0 -7
- package/dist/exports/client/component-CEUVAHRO.js +0 -2
- package/dist/exports/client/component-CEUVAHRO.js.map +0 -7
- package/dist/exports/client/component-PEFMKIXI.js.map +0 -7
- package/dist/features/link/drawer/index.d.ts +0 -5
- package/dist/features/link/drawer/index.d.ts.map +0 -1
- package/dist/features/link/drawer/index.js.map +0 -1
- package/dist/features/link/drawer/types.d.ts +0 -10
- package/dist/features/link/drawer/types.d.ts.map +0 -1
- package/dist/features/link/drawer/types.js +0 -3
- package/dist/features/link/drawer/types.js.map +0 -1
- package/dist/features/upload/component/ExtraFieldsDrawer/index.d.ts +0 -12
- package/dist/features/upload/component/ExtraFieldsDrawer/index.d.ts.map +0 -1
- package/dist/features/upload/component/ExtraFieldsDrawer/index.js +0 -123
- package/dist/features/upload/component/ExtraFieldsDrawer/index.js.map +0 -1
- /package/dist/exports/client/{RelationshipComponent-5OU5HATX.js.map → RelationshipComponent-AFXEJMZQ.js.map} +0 -0
- /package/dist/exports/client/{component-QWIGEOVD.js.map → component-VM36FRT2.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";import{a as fe,b as De,c as Oe,d as He}from"./chunk-MLIITFAS.js";import{a as ge,b as Ce,c as he,d as pt}from"./chunk-OSR74ZNW.js";import{a as Be,b as xe,c as Te,d as Le,e as ut}from"./chunk-TZLHAUCW.js";import{a as dt,c as mi,e as fi,f as gi,g as Ci,h as hi}from"./chunk-JIP5PWU3.js";import{a as ui,b as v}from"./chunk-3K3B6PJM.js";import{createHeadlessEditor as xi}from"@lexical/headless";import{useClientFunctions as Ti,useTableCell as Li}from"@payloadcms/ui";import{$getRoot as yi}from"lexical";import mt,{useEffect as ao,useState as ft}from"react";var lo={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 ye={namespace:"lexical",theme:lo};function Ge({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,a)=>l.clientFeatureProps.order-a.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 a={};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];a[u]=d}});let s=typeof l.feature=="function"?l.feature({clientFunctions:a,featureProviderMap:r,resolvedFeatures:n,unSanitizedEditorConfig:o}):l.feature;n.set(l.clientFeatureProps.featureKey,{...s,key:l.clientFeatureProps.featureKey,order:i}),i++}return n}var so=e=>{let t={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],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.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 Ee(e,t,o){return{admin:o,features:so(t),lexical:e,resolvedFeatureMap:t}}import{jsx as co,jsxs as bi}from"react/jsx-runtime";var Ei=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,[n,i]=mt.useState("Loading..."),{cellData:l,cellProps:{schemaPath:a}}=Li(),s=Ti(),[c,d]=ft(!1),[u,p]=ft([]),[m,f]=ft(null),g=r.get("features").sort((x,N)=>x.order-N.order),L=0;for(let x of g){let N=Array.from(r.keys()).filter(_=>_.startsWith(`feature.${x.key}.components.`));L+=1,L+=N.length}return ao(()=>{if(!c){let x=[],N=0;if(Object.entries(s).forEach(([_,C])=>{_.startsWith(`lexicalFeature.${a}.`)&&(_.includes(".components.")||x.push(C),N++)}),N===L){p(x),d(!0);let _=Ge({clientFunctions:s,schemaPath:a,unSanitizedEditorConfig:{features:x,lexical:o}});f(Ee(o||ye,_,t))}}},[t,g,c,s,a,g.length,u,m,o,r,L]),ao(()=>{if(!c)return;let x=l;if(x==null||!c||!m){i("");return}if(m?.features?.hooks?.load?.length&&m.features.hooks.load.forEach(C=>{x=C({incomingEditorState:x})}),!x||typeof x!="object"){i("");return}if(Array.isArray(x)&&!("root"in x)){i("");return}if("jsonContent"in x){i("");return}let N=xi({namespace:m.lexical.namespace,nodes:dt({editorConfig:m}),theme:m.lexical.theme});N.setEditorState(N.parseEditorState(x));let _=N.getEditorState().read(()=>yi().getTextContent())||"";i(_)},[l,o,c,m]),c?co("span",{children:n}):co(mt.Fragment,{children:Array.isArray(g)&&g.map(x=>{let _=Array.from(r.keys()).filter(C=>C.startsWith(`feature.${x.key}.components.`)).map(C=>r.get(C));return bi(mt.Fragment,{children:[_?.length?_.map(C=>C):null,x.ClientFeature]},x.key)})})};import{$isElementNode as j,$isRangeSelection as Ue,FORMAT_ELEMENT_COMMAND as We}from"lexical";import{jsx as gt,jsxs as ki}from"react/jsx-runtime";var po=()=>ki("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:[gt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),gt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),gt("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ct,jsxs as Ni}from"react/jsx-runtime";var uo=()=>Ni("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:[Ct("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ct("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ct("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as ht,jsxs as _i}from"react/jsx-runtime";var $e=()=>_i("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:[ht("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ht("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ht("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as xt,jsxs as wi}from"react/jsx-runtime";var mo=()=>wi("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:[xt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),xt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),xt("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{useAddClientFunction as Ri,useFieldProps as Si,useTableCell as vi}from"@payloadcms/ui";var fo=(e,t)=>{let{schemaPath:o}=Si(),i=vi()?.cellProps?.schemaPath||o;Ri(`lexicalFeature.${i}.${e}`,t)};var Tt=e=>t=>(fo(t.featureKey,e(t)),null);var h=e=>Tt(o=>{let r={clientFeatureProps:o};return typeof e=="function"?r.feature=({clientFunctions:n,featureProviderMap:i,resolvedFeatures:l,unSanitizedEditorConfig:a})=>{let s=e({clientFunctions:n,featureProviderMap:i,props:o,resolvedFeatures:l,unSanitizedEditorConfig:a});return s.sanitizedClientFeatureProps===null&&(s.sanitizedClientFeatureProps=o),s}:(e.sanitizedClientFeatureProps=o,r.feature=e),r});var go=e=>({type:"dropdown",ChildComponent:$e,items:e,key:"align",order:30});var Co=[go([{ChildComponent:$e,isActive:({selection:e})=>{if(!Ue(e))return!1;for(let t of e.getNodes()){if(j(t)&&t.getFormatType()==="left")continue;let o=t.getParent();if(!(j(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:e})=>e.t("lexical:align:alignLeftLabel"),onSelect:({editor:e})=>{e.dispatchCommand(We,"left")},order:1},{ChildComponent:po,isActive:({selection:e})=>{if(!Ue(e))return!1;for(let t of e.getNodes()){if(j(t)&&t.getFormatType()==="center")continue;let o=t.getParent();if(!(j(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:e})=>e.t("lexical:align:alignCenterLabel"),onSelect:({editor:e})=>{e.dispatchCommand(We,"center")},order:2},{ChildComponent:mo,isActive:({selection:e})=>{if(!Ue(e))return!1;for(let t of e.getNodes()){if(j(t)&&t.getFormatType()==="right")continue;let o=t.getParent();if(!(j(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:e})=>e.t("lexical:align:alignRightLabel"),onSelect:({editor:e})=>{e.dispatchCommand(We,"right")},order:3},{ChildComponent:uo,isActive:({selection:e})=>{if(!Ue(e))return!1;for(let t of e.getNodes()){if(j(t)&&t.getFormatType()==="justify")continue;let o=t.getParent();if(!(j(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:e})=>e.t("lexical:align:alignJustifyLabel"),onSelect:({editor:e})=>{e.dispatchCommand(We,"justify")},order:4}])],Ii=h({toolbarFixed:{groups:Co},toolbarInline:{groups:Co}});import{$createQuoteNode as bo,$isQuoteNode as yo,QuoteNode as Ai}from"@lexical/rich-text";import{$setBlocksType as ko}from"@lexical/selection";import{$getSelection as No,$isRangeSelection as Di}from"lexical";import{jsx as ho}from"react/jsx-runtime";var Lt=()=>ho("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:ho("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"})});function D(e){return{items:e,key:"basic",label:({i18n:t})=>t.t("lexical:general:slashMenuBasicGroupLabel")}}import{jsx as xo}from"react/jsx-runtime";var be=()=>xo("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:xo("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 M=e=>({type:"dropdown",ChildComponent:be,items:e,key:"text",order:25});import{$createQuoteNode as Fi,$isQuoteNode as To,QuoteNode as Pi}from"@lexical/rich-text";import{$createLineBreakNode as Mi}from"lexical";var Lo={type:"element",dependencies:[Pi],export:(e,t)=>{if(!To(e))return null;let o=t(e).split(`
|
|
1
|
+
"use client";import{a as me,b as Ae,c as De,d as Oe}from"./chunk-Q5DYR7MH.js";import{a as fe,b as ge,c as Ce,d as pt}from"./chunk-YL52LJO3.js";import{a as dt,b as He,c as he,d as xe,e as Te,f as ut}from"./chunk-OAQL5GDK.js";import{a as ct,c as di,e as pi,f as ui,g as mi,h as fi}from"./chunk-JIP5PWU3.js";import{a as ci,b as F}from"./chunk-3K3B6PJM.js";function M(e){return{items:e,key:"basic",label:({i18n:t})=>t.t("lexical:general:slashMenuBasicGroupLabel")}}import{createHeadlessEditor as gi}from"@lexical/headless";import{useClientFunctions as Ci,useTableCell as hi}from"@payloadcms/ui";import{$getRoot as xi}from"lexical";import mt,{useEffect as so,useState as ft}from"react";var io={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 Le={namespace:"lexical",theme:io};function Be({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,a)=>l.clientFeatureProps.order-a.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 a={};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];a[u]=d}});let s=typeof l.feature=="function"?l.feature({clientFunctions:a,featureProviderMap:r,resolvedFeatures:n,unSanitizedEditorConfig:o}):l.feature;n.set(l.clientFeatureProps.featureKey,{...s,key:l.clientFeatureProps.featureKey,order:i}),i++}return n}var lo=e=>{let t={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],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.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 ye(e,t,o){return{admin:o,features:lo(t),lexical:e,resolvedFeatureMap:t}}import{jsx as ao,jsxs as Li}from"react/jsx-runtime";var Ti=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,[n,i]=mt.useState("Loading..."),{cellData:l,cellProps:{schemaPath:a}}=hi(),s=Ci(),[c,d]=ft(!1),[u,p]=ft([]),[m,f]=ft(null),h=r.get("features").sort((x,_)=>x.order-_.order),L=0;for(let x of h){let _=Array.from(r.keys()).filter(w=>w.startsWith(`feature.${x.key}.components.`));L+=1,L+=_.length}return so(()=>{if(!c){let x=[],_=0;if(Object.entries(s).forEach(([w,g])=>{w.startsWith(`lexicalFeature.${a}.`)&&(w.includes(".components.")||x.push(g),_++)}),_===L){p(x),d(!0);let w=Be({clientFunctions:s,schemaPath:a,unSanitizedEditorConfig:{features:x,lexical:o}});f(ye(o||Le,w,t))}}},[t,h,c,s,a,h.length,u,m,o,r,L]),so(()=>{if(!c)return;let x=l;if(x==null||!c||!m){i("");return}if(m?.features?.hooks?.load?.length&&m.features.hooks.load.forEach(g=>{x=g({incomingEditorState:x})}),!x||typeof x!="object"){i("");return}if(Array.isArray(x)&&!("root"in x)){i("");return}if("jsonContent"in x){i("");return}let _=gi({namespace:m.lexical.namespace,nodes:ct({editorConfig:m}),theme:m.lexical.theme});_.setEditorState(_.parseEditorState(x));let w=_.getEditorState().read(()=>xi().getTextContent())||"";i(w)},[l,o,c,m]),c?ao("span",{children:n}):ao(mt.Fragment,{children:Array.isArray(h)&&h.map(x=>{let w=Array.from(r.keys()).filter(g=>g.startsWith(`feature.${x.key}.components.`)).map(g=>r.get(g));return Li(mt.Fragment,{children:[w?.length?w.map(g=>g):null,x.ClientFeature]},x.key)})})};import{$isElementNode as K,$isRangeSelection as $e,FORMAT_ELEMENT_COMMAND as Ue}from"lexical";import{jsx as gt,jsxs as yi}from"react/jsx-runtime";var co=()=>yi("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:[gt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),gt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),gt("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ct,jsxs as Ei}from"react/jsx-runtime";var po=()=>Ei("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:[Ct("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ct("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ct("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as ht,jsxs as bi}from"react/jsx-runtime";var Ge=()=>bi("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:[ht("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ht("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),ht("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as xt,jsxs as ki}from"react/jsx-runtime";var uo=()=>ki("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:[xt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),xt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),xt("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{useAddClientFunction as Ni,useFieldProps as _i,useTableCell as wi}from"@payloadcms/ui";var mo=(e,t)=>{let{schemaPath:o}=_i(),i=wi()?.cellProps?.schemaPath||o;Ni(`lexicalFeature.${i}.${e}`,t)};var Tt=e=>t=>(mo(t.featureKey,e(t)),null);var C=e=>Tt(o=>{let r={clientFeatureProps:o};return typeof e=="function"?r.feature=({clientFunctions:n,featureProviderMap:i,resolvedFeatures:l,unSanitizedEditorConfig:a})=>{let s=e({clientFunctions:n,featureProviderMap:i,props:o,resolvedFeatures:l,unSanitizedEditorConfig:a});return s.sanitizedClientFeatureProps===null&&(s.sanitizedClientFeatureProps=o),s}:(e.sanitizedClientFeatureProps=o,r.feature=e),r});var fo=e=>({type:"dropdown",ChildComponent:Ge,items:e,key:"align",order:30});var go=[fo([{ChildComponent:Ge,isActive:({selection:e})=>{if(!$e(e))return!1;for(let t of e.getNodes()){if(K(t)&&t.getFormatType()==="left")continue;let o=t.getParent();if(!(K(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:e})=>e.t("lexical:align:alignLeftLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ue,"left")},order:1},{ChildComponent:co,isActive:({selection:e})=>{if(!$e(e))return!1;for(let t of e.getNodes()){if(K(t)&&t.getFormatType()==="center")continue;let o=t.getParent();if(!(K(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:e})=>e.t("lexical:align:alignCenterLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ue,"center")},order:2},{ChildComponent:uo,isActive:({selection:e})=>{if(!$e(e))return!1;for(let t of e.getNodes()){if(K(t)&&t.getFormatType()==="right")continue;let o=t.getParent();if(!(K(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:e})=>e.t("lexical:align:alignRightLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ue,"right")},order:3},{ChildComponent:po,isActive:({selection:e})=>{if(!$e(e))return!1;for(let t of e.getNodes()){if(K(t)&&t.getFormatType()==="justify")continue;let o=t.getParent();if(!(K(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:e})=>e.t("lexical:align:alignJustifyLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ue,"justify")},order:4}])],Si=C({toolbarFixed:{groups:go},toolbarInline:{groups:go}});import{$createQuoteNode as Eo,$isQuoteNode as Lo,QuoteNode as Fi}from"@lexical/rich-text";import{$setBlocksType as bo}from"@lexical/selection";import{$getSelection as ko,$isRangeSelection as Mi}from"lexical";import{jsx as Co}from"react/jsx-runtime";var Lt=()=>Co("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:Co("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 ho}from"react/jsx-runtime";var Ee=()=>ho("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:ho("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 P=e=>({type:"dropdown",ChildComponent:Ee,items:e,key:"text",order:25});import{$createQuoteNode as Ri,$isQuoteNode as xo,QuoteNode as vi}from"@lexical/rich-text";import{$createLineBreakNode as Ii}from"lexical";var To={type:"element",dependencies:[vi],export:(e,t)=>{if(!xo(e))return null;let o=t(e).split(`
|
|
2
2
|
`),r=[];for(let n of o)r.push("> "+n);return r.join(`
|
|
3
|
-
`)},regExp:/^>\s/,replace:(e,t,o,r)=>{if(r){let i=e.getPreviousSibling();if(
|
|
3
|
+
`)},regExp:/^>\s/,replace:(e,t,o,r)=>{if(r){let i=e.getPreviousSibling();if(xo(i)){i.splice(i.getChildrenSize(),0,[Ii(),...t]),i.select(0,0),e.remove();return}}let n=Ri();n.append(...t),e.replace(n),n.select(0,0)}};var yo=[P([{ChildComponent:Lt,isActive:({selection:e})=>{if(!Mi(e))return!1;for(let t of e.getNodes())if(!Lo(t)&&!Lo(t.getParent()))return!1;return!0},key:"blockquote",label:({i18n:e})=>e.t("lexical:blockquote:label"),onSelect:({editor:e})=>{e.update(()=>{let t=ko();bo(t,()=>Eo())})},order:20}])],Pi=C({markdownTransformers:[To],nodes:[Fi],slashMenu:{groups:[M([{Icon:Lt,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:e})=>e.t("lexical:blockquote:label"),onSelect:({editor:e})=>{e.update(()=>{let t=ko();bo(t,()=>Eo())})}}])]},toolbarFixed:{groups:yo},toolbarInline:{groups:yo}});import{getTranslation as So}from"@payloadcms/translations";import{jsx as yt,jsxs as Ai}from"react/jsx-runtime";var We=()=>Ai("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:[yt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),yt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),yt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{DecoratorBlockNode as Di}from"@lexical/react/LexicalDecoratorBlockNode.js";import Oi from"bson-objectid";import Hi from"react";import{jsx as $i}from"react/jsx-runtime";var Bi=Hi.lazy(()=>import("./component-YNZTTMBY.js").then(e=>({default:e.BlockComponent}))),$=class e extends Di{__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=re(t.fields);return o.setFormat(t.format),o}static isInline(){return!1}decorate(t,o){return $i(Bi,{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 re(e){return new $({fields:{...e,id:e?.id||new Oi.default().toHexString()}})}function Gi(e){return e instanceof $}import{createCommand as Ui}from"lexical";var J=Ui("INSERT_BLOCK_COMMAND");import{useLexicalComposerContext as nl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as il,mergeRegister as ll}from"@lexical/utils";import{$getPreviousSelection as sl,$getSelection as al,$isParagraphNode as _o,$isRangeSelection as cl,COMMAND_PRIORITY_EDITOR as dl}from"lexical";import{useEffect as pl}from"react";import{useLexicalComposerContext as Wi}from"@lexical/react/LexicalComposerContext.js";import{BlocksDrawer as zi,formatDrawerSlug as Vi,useEditDepth as Ki,useModal as ji,useTranslation as Zi}from"@payloadcms/ui";import{$getNodeByKey as Xi,COMMAND_PRIORITY_EDITOR as Ji,createCommand as Yi}from"lexical";import{useCallback as qi,useEffect as Qi,useState as el}from"react";import{jsx as rl}from"react/jsx-runtime";var tl=Yi("INSERT_BLOCK_WITH_DRAWER_COMMAND"),ol=({blockType:e,editor:t,replaceNodeKey:o})=>{o?t.update(()=>{let r=Xi(o);r&&r.replace(re({id:null,blockName:"",blockType:e}))}):t.dispatchCommand(J,{id:null,blockName:"",blockType:e})},No=()=>{let[e]=Wi(),{editorConfig:t,uuid:o}=F(),[r,n]=el(null),i=Ki(),{t:l}=Zi(),{openModal:a}=ji(),s={plural:l("fields:blocks")||"Blocks",singular:l("fields:block")||"Block"},c=qi((p,m)=>{ol({blockType:m,editor:e,replaceNodeKey:r})},[e,r]),d=Vi({slug:"lexical-rich-text-blocks-"+o,depth:i}),u=t?.resolvedFeatureMap?.get("blocks")?.sanitizedClientFeatureProps?.reducedBlocks;return Qi(()=>e.registerCommand(tl,p=>(n(p?.replace?p?.replace.nodeKey:null),a(d),!0),Ji),[e,d,a]),rl(zi,{addRow:c,addRowIndex:0,blocks:u,drawerSlug:d,labels:s})};import{jsx as ul}from"react/jsx-runtime";var wo=()=>{let[e]=nl();return pl(()=>{if(!e.hasNodes([$]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return ll(e.registerCommand(J,t=>(e.update(()=>{let o=al()||sl();if(cl(o)){let r=re(t);il(r);let{focus:n}=o,i=n.getNode();_o(i)&&i.getTextContentSize()===0&&i.getParent().getChildren().filter(l=>_o(l)).length>1&&i.remove()}}),!0),dl))},[e]),ul(No,{})};var ml=C(({props:e})=>({nodes:[$],plugins:[{Component:wo,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[{items:e.reducedBlocks.map(t=>({Icon:We,key:"block-"+t.slug,keywords:["block","blocks",t.slug],label:({i18n:o})=>t.labels.singular?So(t.labels.singular,o):t.slug,onSelect:({editor:o})=>{o.dispatchCommand(J,{id:null,blockName:"",blockType:t.slug})}})),key:"blocks",label:({i18n:t})=>t.t("lexical:blocks:label")}]},toolbarFixed:{groups:[{type:"dropdown",ChildComponent:We,items:e.reducedBlocks.map((t,o)=>({ChildComponent:We,isActive:void 0,key:"block-"+t.slug,label:({i18n:r})=>t.labels.singular?So(t.labels.singular,r):t.slug,onSelect:({editor:r})=>{r.dispatchCommand(J,{id:null,blockName:"",blockType:t.slug})},order:o})),key:"blocks",order:20}]}}));import{useLexicalComposerContext as Cl}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as hl,$createTextNode as xl,$getRoot as Tl}from"lexical";import*as Mo from"react";import{useCallback as Y,useEffect as Et,useLayoutEffect as vo,useRef as bt,useState as ze}from"react";var D=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var fl=D&&"documentMode"in document?document.documentMode:null,Ro=D&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),sm=D&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),am=D&&"InputEvent"in window&&!fl?"getTargetRanges"in new window.InputEvent("input"):!1,cm=D&&/Version\/[\d.].*Safari/.test(navigator.userAgent),dm=D&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,pm=D&&/Android/.test(navigator.userAgent),um=D&&/Win/.test(navigator.platform),gl=D&&/^(?=.*Chrome).*/i.test(navigator.userAgent),mm=D&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!gl;import{jsx as q,jsxs as kt}from"react/jsx-runtime";var Ll=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)},yl=(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)},El=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, {
|
|
5
5
|
anchorPath: [${n.anchorPath.toString()}],
|
|
6
6
|
anchorOffset: ${n.anchorOffset},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
`;default:return""}})(e.name,e.value);switch(e.count){case 1:return o;case 2:return[o,o].join(`
|
|
11
11
|
`);default:return` await repeat(${e.count}, async () => {
|
|
12
12
|
${o}
|
|
13
|
-
);`}};function
|
|
13
|
+
);`}};function bl(e){return e.key.toLowerCase()==="a"&&(Ro?e.metaKey:e.ctrlKey)}function kl(e){let{anchorNode:t,focusNode:o}=e,{anchorOffset:r,focusOffset:n}=e;return r!==0&&r--,n!==0&&n--,{anchorNode:t,anchorOffset:r,focusNode:o,focusOffset:n}}function Io(e,t){let o=e,r=[];for(;o!==t;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var Fo=new Set(["Enter","Backspace","Delete","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"]);function Nl(e){let[t,o]=ze([]),[r,n]=ze(!1),[,i]=ze(""),[l,a]=ze(""),s=bt(null),c=bt(!1),d=bt(null),u=Y(()=>e,[e]),p=Y(()=>{let g=e.getRootElement(),y=window.getSelection();return g==null||y==null||y.anchorNode==null||y.focusNode==null||!g.contains(y.anchorNode)||!g.contains(y.focusNode)?null:`
|
|
14
14
|
import {
|
|
15
15
|
initializeE2E,
|
|
16
16
|
assertHTMLSnapshot,
|
|
@@ -27,12 +27,12 @@ describe('Test case', () => {
|
|
|
27
27
|
const {page} = e2e;
|
|
28
28
|
|
|
29
29
|
await page.focus('div[contenteditable="true"]');
|
|
30
|
-
${t.map(
|
|
30
|
+
${t.map(El).join(`
|
|
31
31
|
`)}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
`},[e,t]),m=q((C,y)=>{o(b=>{let E=t.length-1,S=t[E];if(S&&S.name===C){if(C==="type")return[...t.slice(0,E),{...S,value:S.value+y}];if(S.value===y)return[...t.slice(0,E),{...S,count:S.count+1}]}return[...b,{name:C,count:1,value:y}]})},[t,o]);Io(()=>{let C=b=>{if(!r)return;let E=b.key;_l(b)?m("selectAll",""):Po.has(E)?m("press",b.key):[...E].length>1?m("keydown",b.key):m("type",b.key)},y=b=>{if(!r)return;let E=b.key;!Po.has(E)&&[...E].length>1&&m("keyup",b.key)};return e.registerRootListener((b,E)=>{E!==null&&(E.removeEventListener("keydown",C),E.removeEventListener("keyup",y)),b!==null&&(b.addEventListener("keydown",C),b.addEventListener("keyup",y))})},[e,r,m]),Io(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Et(()=>{if(t){let C=p();C!==null&&a(C),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,t]),Et(()=>e.registerUpdateListener(({dirtyElements:y,dirtyLeaves:b,editorState:E})=>{if(!r)return;let S=E._selection,P=s.current,k=c.current;if(P!==S){if(b.size===0&&y.size===0&&!k){let $=window.getSelection();if($&&($.anchorNode==null||$.focusNode==null))return}s.current=S}c.current=!1;let R=p();R!==null&&a(R)}),[e,p,r,m]),Et(()=>r?e.registerUpdateListener(()=>{let y=e.getRootElement();y!==null&&i(y?.innerHTML)}):void 0,[e,r]);let f=q(C=>{r||(C.update(()=>{let y=El();y.clear();let b=yl();y.append(Ll().append(b)),b.select()}),o([])),n(y=>!y)},[r]),g=q(()=>{if(!r)return;let C=window.getSelection();if(C===null||C.anchorNode==null||C.focusNode==null)return;let{anchorNode:y,anchorOffset:b,focusNode:E,focusOffset:S}=wl(C),P=u().getRootElement(),k;y!==null&&(k=Fo(y,P));let R;E!==null&&(R=Fo(E,P)),m("snapshot",{anchorNode:y,anchorOffset:b,anchorPath:k,focusNode:E,focusOffset:S,focusPath:R})},[m,r,u]),L=q(()=>{bl(p())},[p]),x=q(()=>{kl("test.js",p())},[p]);return[Q("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:C=>{f(u()),C.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?kt("div",{className:"test-recorder-output",children:[kt("div",{className:"test-recorder-toolbar",children:[Q("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:C=>{g(),C.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Q("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:C=>{L(),C.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Q("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:C=>{x(),C.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Q("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var Ao=()=>{let[e]=Tl(),[t,o]=Rl(e);return kt(Mo.Fragment,{children:[Q("p",{children:"HI"}),t,o,Q("p",{children:"DONE"})]})};var Sl=h({plugins:[{Component:Ao,position:"bottom"}]});import{useLexicalComposerContext as vl}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Il}from"@lexical/react/LexicalTreeView.js";import{jsx as Fl}from"react/jsx-runtime";var Do=()=>{let[e]=vl();return Fl(Il,{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 Pl=h({plugins:[{Component:Do,position:"bottom"}]});import{$isRangeSelection as Ml,FORMAT_TEXT_COMMAND as Al}from"lexical";import{jsx as Oo}from"react/jsx-runtime";var Ho=()=>Oo("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:Oo("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 F=e=>({type:"buttons",items:e,key:"format",order:40});var Bo={type:"text-format",format:["bold","italic"],tag:"***"},Go={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},$o={type:"text-format",format:["bold"],tag:"**"},Uo={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Wo=[F([{ChildComponent:Ho,isActive:({selection:e})=>Ml(e)?e.hasFormat("bold"):!1,key:"bold",onSelect:({editor:e})=>{e.dispatchCommand(Al,"bold")},order:1}])],Dl=h(({featureProviderMap:e})=>{let t=[$o,Uo];return e.get("italic")&&t.push(Go,Bo),{markdownTransformers:t,toolbarFixed:{groups:Wo},toolbarInline:{groups:Wo}}});import{$isRangeSelection as Hl,FORMAT_TEXT_COMMAND as Bl}from"lexical";import{jsx as Vo,jsxs as Ol}from"react/jsx-runtime";var zo=()=>Ol("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:[Vo("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Vo("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Ko={type:"text-format",format:["code"],tag:"`"};var jo=[F([{ChildComponent:zo,isActive:({selection:e})=>Hl(e)?e.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:e})=>{e.dispatchCommand(Bl,"code")},order:7}])],Gl=h({markdownTransformers:[Ko],toolbarFixed:{groups:jo},toolbarInline:{groups:jo}});import{$isRangeSelection as $l,FORMAT_TEXT_COMMAND as Ul}from"lexical";import{jsx as Zo}from"react/jsx-runtime";var Xo=()=>Zo("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:Zo("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 Jo={type:"text-format",format:["italic"],tag:"*"},Yo={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var qo=[F([{ChildComponent:Xo,isActive:({selection:e})=>$l(e)?e.hasFormat("italic"):!1,key:"italic",onSelect:({editor:e})=>{e.dispatchCommand(Ul,"italic")},order:2}])],Wl=h({markdownTransformers:[Jo,Yo],toolbarFixed:{groups:qo},toolbarInline:{groups:qo}});import{$isRangeSelection as zl,FORMAT_TEXT_COMMAND as Kl}from"lexical";import{jsx as Qo,jsxs as Vl}from"react/jsx-runtime";var er=()=>Vl("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:[Qo("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"}),Qo("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var tr={type:"text-format",format:["strikethrough"],tag:"~~"};var or=[F([{ChildComponent:er,isActive:({selection:e})=>zl(e)?e.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:e})=>{e.dispatchCommand(Kl,"strikethrough")},order:4}])],jl=h({markdownTransformers:[tr],toolbarFixed:{groups:or},toolbarInline:{groups:or}});import{$isRangeSelection as Zl,FORMAT_TEXT_COMMAND as Xl}from"lexical";import{jsx as rr}from"react/jsx-runtime";var nr=()=>rr("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:rr("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 ir=[F([{ChildComponent:nr,isActive:({selection:e})=>Zl(e)?e.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:e})=>{e.dispatchCommand(Xl,"subscript")},order:5}])],Jl=h({toolbarFixed:{groups:ir},toolbarInline:{groups:ir}});import{$isRangeSelection as Yl,FORMAT_TEXT_COMMAND as ql}from"lexical";import{jsx as lr}from"react/jsx-runtime";var sr=()=>lr("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:lr("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 ar=[F([{ChildComponent:sr,isActive:({selection:e})=>Yl(e)?e.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:e})=>{e.dispatchCommand(ql,"superscript")},order:6}])],Ql=h({toolbarFixed:{groups:ar},toolbarInline:{groups:ar}});import{$isRangeSelection as ts,FORMAT_TEXT_COMMAND as os}from"lexical";import{jsx as cr,jsxs as es}from"react/jsx-runtime";var dr=()=>es("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:[cr("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"}),cr("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var pr=[F([{ChildComponent:dr,isActive:({selection:e})=>ts(e)?e.hasFormat("underline"):!1,key:"underline",onSelect:({editor:e})=>{e.dispatchCommand(os,"underline")},order:3}])],rs=h({toolbarFixed:{groups:pr},toolbarInline:{groups:pr}});import{$createHeadingNode as ss,$isHeadingNode as Nr,HeadingNode as as}from"@lexical/rich-text";import{$setBlocksType as cs}from"@lexical/selection";import{$getSelection as ds,$isRangeSelection as ps}from"lexical";import{jsx as ur}from"react/jsx-runtime";var mr=()=>ur("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:ur("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 fr}from"react/jsx-runtime";var gr=()=>fr("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:fr("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 Cr}from"react/jsx-runtime";var hr=()=>Cr("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:Cr("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 xr}from"react/jsx-runtime";var Tr=()=>xr("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:xr("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 Lr}from"react/jsx-runtime";var yr=()=>Lr("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:Lr("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 Er}from"react/jsx-runtime";var br=()=>Er("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:Er("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 ns,$isHeadingNode as is,HeadingNode as ls}from"@lexical/rich-text";var Nt=e=>(t,o,r)=>{let n=e(r);n&&(n.append(...o),t.replace(n),n.select(0,0))};var kr=e=>{let o=`^(${e.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[ls],export:(n,i)=>{if(!is(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Nt(n=>{let i="h"+n[1].length;return ns(i)})}};var _r=e=>{let t=ds();cs(t,()=>ss(e))},wr={h1:mr,h2:gr,h3:hr,h4:Tr,h5:yr,h6:br},us=h(({props:e})=>{let{enabledHeadingSizes:t=["h1","h2","h3","h4","h5","h6"]}=e,o=[M(t.map((r,n)=>({ChildComponent:wr[r],isActive:({selection:i})=>{if(!ps(i))return!1;for(let l of i.getNodes()){if(Nr(l)&&l.getTag()===r)continue;let a=l.getParent();if(!(Nr(a)&&a.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(()=>{_r(r)})},order:n+2})))];return{markdownTransformers:[kr(t)],nodes:[as],sanitizedClientFeatureProps:e,slashMenu:{groups:t?.length?[D(t.map(r=>({Icon:wr[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(()=>{_r(r)})}})))]:[]},toolbarFixed:{groups:t?.length?o:[]},toolbarInline:{groups:t?.length?o:[]}}});import{$isNodeSelection as Ls}from"lexical";import{jsx as Rr}from"react/jsx-runtime";var _t=()=>Rr("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:Rr("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Sr,jsxs as ms}from"react/jsx-runtime";var vr=()=>ms("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Sr("path",{d:"M5 10h10",stroke:"currentColor"}),Sr("path",{d:"M10 15V5",stroke:"currentColor"})]});var ee=e=>({type:"dropdown",ChildComponent:vr,items:e,key:"add",order:10});var Ir={type:"element",dependencies:[De],export:(e,t)=>He(e)?"---":null,regExp:/^---\s*$/,replace:e=>{let t=Oe();t&&e.replace(t)}};import{useLexicalComposerContext as fs}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as gs}from"@lexical/utils";import{$getSelection as Cs,$isRangeSelection as hs,COMMAND_PRIORITY_EDITOR as xs}from"lexical";import{useEffect as Ts}from"react";var Fr=()=>{let[e]=fs();return Ts(()=>e.registerCommand(fe,t=>{let o=Cs();if(!hs(o))return!1;if(o.focus.getNode()!==null){let n=Oe();gs(n)}return!0},xs),[e]),null};var ys=h({markdownTransformers:[Ir],nodes:[De],plugins:[{Component:Fr,position:"normal"}],slashMenu:{groups:[D([{Icon:_t,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(fe,void 0)}}])]},toolbarFixed:{groups:[ee([{ChildComponent:_t,isActive:({selection:e})=>{if(!Ls(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return He(t)},key:"horizontalRule",label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(fe,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as ks,OUTDENT_CONTENT_COMMAND as Ns}from"lexical";import{jsx as Ke,jsxs as Es}from"react/jsx-runtime";var Pr=()=>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:[Ke("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Ke("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Ke("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ke("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as je,jsxs as bs}from"react/jsx-runtime";var Mr=()=>bs("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:[je("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),je("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),je("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),je("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var Ar=e=>({type:"buttons",items:e,key:"indent",order:35});var Dr=[Ar([{ChildComponent:Pr,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(Ns,void 0)},order:1},{ChildComponent:Mr,isActive:()=>!1,key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ks,void 0)},order:2}])],_s=h({toolbarFixed:{groups:Dr},toolbarInline:{groups:Dr}});import{$findMatchingParent as za}from"@lexical/utils";import{$getSelection as Ot,$isRangeSelection as fn}from"lexical";import{jsx as Or}from"react/jsx-runtime";var Hr=()=>Or("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:Or("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 Br}from"@lexical/selection";function ie(e){let{anchor:t}=e,{focus:o}=e,r=e.anchor.getNode(),n=e.focus.getNode();return r===n?r:e.isBackward()?Br(o)?r:n:Br(t)?r:n}var wt=e=>({type:"buttons",items:e,key:"features",order:50});import{$createTextNode as Os,$isTextNode as Hs}from"lexical";import{addClassNamesToElement as ws,isHTMLAnchorElement as Rs}from"@lexical/utils";import vt from"bson-objectid";import{$applyNodeReplacement as Ss,$createTextNode as Gr,$getSelection as vs,$isElementNode as $r,$isRangeSelection as St,ElementNode as Is,createCommand as Fs}from"lexical";var Ps=new Set(["http:","https:","mailto:","sms:","tel:"]),A=class e extends Is{__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:Ms,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 vt.default().toHexString(),t.version=3);let o=W({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=Rt(o.rel,"add","noopener")),ws(o,t.theme.link),o}exportJSON(){let t={...super.exportJSON(),type:this.getType(),fields:this.getFields(),version:3},o=this.getID();return o&&(t.id=o),t}extractWithChild(t,o,r){if(!St(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($r(r)){let n=W({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(t){try{let o=new URL(t);if(!Ps.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=Rt(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Rt(o.rel,"remove","noopener"))),!1}};function Ms(e){let t=null;if(Rs(e)){let o=e.textContent;o!==null&&o!==""&&(t=W({id:new vt.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:e.getAttribute("target")==="_blank",url:e.getAttribute("href")??""}}))}return{node:t}}function W({id:e,fields:t}){return Ss(new A({id:e??new vt.default().toHexString(),fields:t}))}function I(e){return e instanceof A}var G=Fs("TOGGLE_LINK_COMMAND");function Ur(e){let t=vs();if(!St(t)&&!e.selectedNodes.length)return;let o=St(t)?t.extract():e.selectedNodes;if(e===null)o.forEach(r=>{let n=r.getParent();if(I(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=I(i)?i:As(i);if(l!==null){l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(Gr(e.text)),l.getChildren().forEach(a=>{a!==l.getLastChild()&&a.remove()}));return}}let r=null,n=null;o.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||$r(i)&&!i.isInline())){if(I(l)){n=l,l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(Gr(e.text)),l.getChildren().forEach(a=>{a!==l.getLastChild()&&a.remove()}));return}if(l.is(r)||(r=l,n=W({fields:e.fields}),I(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),I(i)){if(i.is(n))return;if(n!==null){let a=i.getChildren();for(let s=0;s<a.length;s+=1)n.append(a[s])}i.remove();return}n!==null&&n.append(i)}})}}function As(e){return Ds(e,t=>I(t))}function Ds(e,t){let o=e;for(;o!==null&&(o=o.getParent())!==null&&!t(o););return o}function Rt(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 Wr={type:"text-match",dependencies:[A],export:(e,t,o)=>{if(!I(e))return null;let r=e,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&Hs(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(e,t)=>{let[,o,r]=t,n=W({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Os(o);i.setFormat(e.getFormat()),n.append(i),e.replace(n)},trigger:")"};import{$applyNodeReplacement as Bs,$isElementNode as Gs}from"lexical";var V=class e extends A{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=ke({fields:t.fields});return o.setFormat(t.format),o.setIndent(t.indent),o.setDirection(t.direction),o}exportJSON(){return{...super.exportJSON(),type:"autolink",version:2}}insertNewAfter(t,o=!0){let r=this.getParentOrThrow().insertNewAfter(t,o);if(Gs(r)){let n=ke({fields:this.__fields});return r.append(n),n}return null}};function ke({fields:e}){return Bs(new V({id:void 0,fields:e}))}function z(e){return e instanceof V}import{useLexicalComposerContext as $s}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Us}from"@lexical/utils";import{$createTextNode as Vr,$getSelection as Ws,$isElementNode as Kr,$isLineBreakNode as jr,$isNodeSelection as Vs,$isRangeSelection as zs,$isTextNode as Ne,TextNode as Ks}from"lexical";import{useEffect as js}from"react";function It(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 zr(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 Zr(e,t){for(let o=0;o<t.length;o++){let r=t[o](e);if(r!=null)return r}return null}var Zs=/[.,;\s]/;function Xe(e){return Zs.test(e)}function Xr(e){return Xe(e[e.length-1])}function Pt(e){return Xe(e[0])}function Jr(e){let t=e.getPreviousSibling();return Kr(t)&&(t=t.getLastDescendant()),t===null||jr(t)||Ne(t)&&Xr(t.getTextContent())}function Yr(e){let t=e.getNextSibling();return Kr(t)&&(t=t.getFirstDescendant()),t===null||jr(t)||Ne(t)&&Pt(t.getTextContent())}function Xs(e,t,o,r){return(e>0?Xe(o[e-1]):Jr(r[0]))?t<o.length?Xe(o[t]):Yr(r[r.length-1]):!1}function Js(e,t,o){let r=[],n=[],i=[],l=0,a=0,s=[...e];for(;s.length>0;){let c=s[0],u=c.getTextContent().length,p=a;a+u<=t?(r.push(c),l+=u):p>=o?i.push(c):n.push(c),a+=u,s.shift()}return[l,r,n,i]}function Ys(e,t,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=ke({fields:n});if(e.length===1){let l=e[0],a;t===0?[a,l]=l.splitText(o):[,a,l]=l.splitText(t,o);let s=Vr(r.text);return s.setFormat(a.getFormat()),s.setDetail(a.getDetail()),s.setStyle(a.getStyle()),i.append(s),a.replace(i),l}else if(e.length>1){let l=e[0],a=l.getTextContent().length,s;t===0?s=l:[,s]=l.splitText(t);let c=[],d;for(let f=1;f<e.length;f++){let g=e[f],x=g.getTextContent().length,N=a,_=a+x;if(N<o)if(_<=o)c.push(g);else{let[C,y]=g.splitText(o-N);c.push(C),d=y}a+=x}let u=Ws(),p=u?u.getNodes().find(Ne):void 0,m=Vr(s.getTextContent());return m.setFormat(s.getFormat()),m.setDetail(s.getDetail()),m.setStyle(s.getStyle()),i.append(m,...c),p&&p===s&&(zs(u)?m.select(u.anchor.offset,u.focus.offset):Vs(u)&&m.select(0,m.getTextContent().length)),s.replace(i),d}}function qs(e,t,o){let r=[...e],n=r.map(s=>s.getTextContent()).join(""),i=n,l,a=0;for(;(l=Zr(i,t))!=null&&l!==null;){let s=l.index,c=l.length,d=s+c;if(Xs(a+s,a+d,n,r)){let[p,,m,f]=Js(r,a+s,a+d),g=a+s-p,L=a+d-p,x=Ys(m,g,L,l);r=x?[x,...f]:f,o(l.url,null),a=0}else a+=d;i=i.substring(d)}}function Ft(e,t,o){let r=e.getChildren(),n=r.length;for(let s=0;s<n;s++){let c=r[s];if(!Ne(c)||!c.isSimpleText()){Ze(e),o(null,e.getFields()?.url??null);return}}let i=e.getTextContent(),l=Zr(i,t);if(l===null||l.text!==i){Ze(e),o(null,e.getFields()?.url??null);return}if(!Jr(e)||!Yr(e)){Ze(e),o(null,e.getFields()?.url??null);return}let a=e.getFields()?.url;if(a!==l?.url){let s=e.getFields();s.url=l?.url,e.setFields(s),o(l.url,a??null)}}function Qs(e,t,o){let r=e.getPreviousSibling(),n=e.getNextSibling(),i=e.getTextContent();z(r)&&!Pt(i)&&(r.append(e),Ft(r,t,o),o(null,r.getFields()?.url??null)),z(n)&&!Xr(i)&&(Ze(n),Ft(n,t,o),o(null,n.getFields()?.url??null))}function Ze(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 ea(e){let t=[e],o=e.getNextSibling();for(;o!==null&&Ne(o)&&o.isSimpleText()&&(t.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return t}function ta(e,t,o){js(()=>{e.hasNodes([V])||It(!1,"LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let r=(n,i)=>{o?.(n,i)};return Us(e.registerNodeTransform(Ks,n=>{let i=n.getParentOrThrow(),l=n.getPreviousSibling();if(z(i))Ft(i,t,r);else if(!I(i)){if(n.isSimpleText()&&(Pt(n.getTextContent())||!z(l))){let a=ea(n);qs(a,t,r)}Qs(n,t,r)}}))},[e,t,o])}var oa=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)/,ra=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,na=[zr(oa,e=>e.startsWith("http")?e:`https://${e}`),zr(ra,e=>`mailto:${e}`)],qr=()=>{let[e]=$s();return ta(e,na),null};import{ClickableLinkPlugin as ia}from"@lexical/react/LexicalClickableLinkPlugin.js";import{jsx as la}from"react/jsx-runtime";var Qr=()=>la(ia,{});import{createCommand as sa}from"lexical";var Je=sa("TOGGLE_LINK_WITH_MODAL_COMMAND");import{createPortal as Ma}from"react-dom";import{useLexicalComposerContext as Ea}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as on,mergeRegister as rn}from"@lexical/utils";import{getTranslation as ba}from"@payloadcms/translations";import{formatDrawerSlug as ka,useConfig as Na,useEditDepth as _a,useModal as wa,useTranslation as Ra}from"@payloadcms/ui";import{$getSelection as nn,$isLineBreakNode as Sa,$isRangeSelection as ln,COMMAND_PRIORITY_HIGH as va,COMMAND_PRIORITY_LOW as sn,KEY_ESCAPE_COMMAND as Ia,SELECTION_CHANGE_COMMAND as Fa}from"lexical";import an,{useCallback as cn,useEffect as qe,useRef as Pa,useState as le}from"react";function Ye(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(),a=o.getBoundingClientRect(),s=i.getBoundingClientRect(),c=e.top-r,d=e.left-n;c<s.top&&(c+=l.height+e.height+r*2),d+l.width>s.right&&(d=s.right-l.width-n),c-=a.top,d-=a.left,t.style.opacity="1",t.style.transform=`translate(${d}px, ${c}px)`}import{Drawer as aa,Form as ca,FormSubmit as da,RenderFields as pa,useConfig as ua,useDocumentInfo as ma,useFieldProps as fa,useTranslation as ga}from"@payloadcms/ui";import{getFormState as en}from"@payloadcms/ui/shared";import{useCallback as Ca,useEffect as ha,useState as xa}from"react";import{v4 as Ta}from"uuid";import{jsx as Mt,jsxs as ya}from"react/jsx-runtime";var La="lexical-link-edit-drawer",tn=({drawerSlug:e,handleModalSubmit:t,stateData:o})=>{let{t:r}=ga(),{id:n}=ma(),{schemaPath:i}=fa(),l=ua(),[a,s]=xa(!1),{field:{richTextComponentMap:c}}=v(),d="feature.link.fields.fields",u=`${i}.feature.link.fields`,p=c.get(d);ha(()=>{o&&(async()=>{let g=await en({apiRoute:l.routes.api,body:{id:n,data:o,operation:"update",schemaPath:u},serverURL:l.serverURL});s(g)})()},[l.routes.api,l.serverURL,u,n,o]);let m=Ca(async({formState:f})=>await en({apiRoute:l.routes.api,body:{id:n,formState:f,operation:"update",schemaPath:u},serverURL:l.serverURL}),[l.routes.api,l.serverURL,u,n]);return Mt(aa,{className:La,slug:e,title:r("fields:editLink")??"",children:a!==!1&&ya(ca,{beforeSubmit:[m],disableValidationOnSubmit:!0,fields:Array.isArray(p)?p:[],initialState:a,onChange:[m],onSubmit:t,uuid:Ta(),children:[Mt(pa,{fieldMap:Array.isArray(p)?p:[],forceRender:!0,path:"",readOnly:!1,schemaPath:u}),Mt(da,{children:r("general:submit")})]})})};import{jsx as se,jsxs as At}from"react/jsx-runtime";function dn({anchorElem:e}){let[t]=Ea(),o=Pa(null),[r,n]=le(null),[i,l]=le(null),{uuid:a}=v(),s=Na(),{i18n:c,t:d}=Ra(),[u,p]=le({}),{closeModal:m,isModalOpen:f,toggleModal:g}=wa(),L=_a(),[x,N]=le(!1),[_,C]=le([]),[y,b]=le(!1),E=ka({slug:"lexical-rich-text-link-"+a,depth:L}),S=cn(()=>{N(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),b(!1),n(null),l(null),C([]),p({})},[N,n,l,C]),P=cn(()=>{let k=nn(),R=null;if(!ln(k)||!k){S();return}let $=ie(k);R=t.getElementByKey($.getKey())?.getBoundingClientRect();let w=on($,I),Ae=k.getNodes().filter(re=>!Sa(re)).find(re=>{let J=on(re,I);return w&&!w.is(J)||J&&!J.is(w)});if(w==null||Ae){S();return}let X={doc:void 0,linkType:void 0,newTab:void 0,url:"",...w.getFields(),id:w.getID(),text:w.getTextContent()};if(w.getFields()?.linkType==="custom")n(w.getFields()?.url??null),l(null);else{n(`/admin/collections/${w.getFields()?.doc?.relationTo}/${w.getFields()?.doc?.value}`);let re=s.collections.find(J=>J.slug===w.getFields()?.doc?.relationTo);if(!re)l(w.getFields()?.label?String(w.getFields()?.label):null),n(w.getFields()?.url?String(w.getFields()?.url):null);else{let J=d("fields:linkedTo",{label:ba(re.labels.singular,c)}).replace(/<[^>]*>?/g,"");l(J)}}p(X),N(!0),C(k?k?.getNodes():[]),z(w)?b(!0):b(!1);let me=o.current,at=window.getSelection(),{activeElement:io}=document;if(me===null)return;let ct=t.getRootElement();return at!==null&&ct!==null&&ct.contains(at.anchorNode)?(R||(R=at.getRangeAt(0).getBoundingClientRect()),R!=null&&(R.y+=40,Ye(R,me,e))):(io==null||io.className!=="link-input")&&(ct!==null&&Ye(null,me,e),n(null),l(null)),!0},[t,S,s.collections,d,c,e]);return qe(()=>rn(t.registerCommand(Je,k=>(t.dispatchCommand(G,k),P(),g(E),!0),sn)),[t,P,g,E]),qe(()=>{let k=e.parentElement,R=()=>{t.getEditorState().read(()=>{P()})};return window.addEventListener("resize",R),k?.addEventListener("scroll",R),()=>{window.removeEventListener("resize",R),k?.removeEventListener("scroll",R)}},[e.parentElement,t,P]),qe(()=>rn(t.registerUpdateListener(({editorState:k})=>{k.read(()=>{P()})}),t.registerCommand(Fa,()=>(P(),!0),sn),t.registerCommand(Ia,()=>x?(S(),!0):!1,va)),[t,P,x,S]),qe(()=>{t.getEditorState().read(()=>{P()})},[t,P]),At(an.Fragment,{children:[se("div",{className:"link-editor",ref:o,children:At("div",{className:"link-input",children:[r&&r.length>0?se("a",{href:r,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:r}):i!=null&&i.length>0?se("span",{className:"link-input__label-pure",children:i}):null,t.isEditable()&&At(an.Fragment,{children:[se("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{g(E)},onMouseDown:k=>{k.preventDefault()},tabIndex:0,type:"button"}),!y&&se("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{t.dispatchCommand(G,null)},onMouseDown:k=>{k.preventDefault()},tabIndex:0,type:"button"})]})]})}),f(E)&&se(tn,{drawerSlug:E,handleModalSubmit:(k,R)=>{m(E);let $=R,w={...$};delete w.text,t.update(()=>{let Ae=nn(),X=null;if(ln(Ae)?X=ie(Ae).getParent():_.length&&(X=_[0].getParent()),X&&z(X)){let me=W({fields:w});X.replace(me,!0)}}),t.dispatchCommand(G,{fields:w,selectedNodes:_,text:$.text})},stateData:u})]})}import{jsx as Aa}from"react/jsx-runtime";var pn=e=>{let{anchorElem:t=document.body}=e;return Ma(Aa(dn,{anchorElem:t}),t)};import{useLexicalComposerContext as Ha}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ba}from"@lexical/utils";import{$getSelection as Ga,$isElementNode as $a,$isRangeSelection as Ua,COMMAND_PRIORITY_LOW as un,PASTE_COMMAND as Wa}from"lexical";import{useEffect as Va}from"react";var Da=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,Oa=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Dt(e){if(!e)return!1;if(e==="https://"||Da.test(e)||Oa.test(e))return!0;try{return new URL(e),!0}catch{}return!1}var mn=()=>{let[e]=Ha();return Va(()=>{if(!e.hasNodes([A]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Ba(e.registerCommand(G,t=>(Ur(t),!0),un),Dt!==void 0?e.registerCommand(Wa,t=>{let o=Ga();if(!Ua(o)||o.isCollapsed()||!(t instanceof ClipboardEvent)||t.clipboardData==null)return!1;let r=t.clipboardData.getData("text");if(!Dt(r))return!1;if(!o.getNodes().some(n=>$a(n))){let n={doc:null,linkType:"custom",newTab:!1,url:r};return e.dispatchCommand(G,{fields:n,text:null}),t.preventDefault(),!0}return!1},un):()=>{})},[e]),null};var gn=[wt([{ChildComponent:Hr,isActive:({selection:e})=>{if(fn(e)){let t=ie(e);return za(t,I)!=null}return!1},isEnabled:({selection:e})=>!!(fn(e)&&Ot()?.getTextContent()?.length),key:"link",label:({i18n:e})=>e.t("lexical:link:label"),onSelect:({editor:e,isActive:t})=>{if(t)e.dispatchCommand(G,null);else{let o=null,r=[];if(e.getEditorState().read(()=>{o=Ot()?.getTextContent(),r=Ot()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};e.dispatchCommand(Je,{fields:n,selectedNodes:r,text:o})}},order:1}])],Ka=h({markdownTransformers:[Wr],nodes:[A,V],plugins:[{Component:mn,position:"normal"},{Component:qr,position:"normal"},{Component:Qr,position:"normal"},{Component:pn,position:"floatingAnchorElem"}],toolbarFixed:{groups:gn},toolbarInline:{groups:gn}});import{$isListNode as Gt,INSERT_CHECK_LIST_COMMAND as yn,ListItemNode as nc,ListNode as ic}from"@lexical/list";import{$isRangeSelection as lc}from"lexical";import{jsx as Cn,jsxs as ja}from"react/jsx-runtime";var Ht=()=>ja("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:[Cn("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Cn("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{ListPlugin as Za}from"@lexical/react/LexicalListPlugin.js";import{jsx as Xa}from"react/jsx-runtime";var ae=()=>Xa(Za,{});function ce(e){return{items:e,key:"lists",label:({i18n:t})=>t.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Qa,ListItemNode as ec,ListNode as tc}from"@lexical/list";import{$createListItemNode as Ja,$createListNode as Ya,$isListItemNode as qa,$isListNode as Bt}from"@lexical/list";var hn=4,de=e=>(t,o,r)=>{let n=t.getPreviousSibling(),i=t.getNextSibling(),l=Ja(e==="check"?r[3]==="x":void 0);if(Bt(i)&&i.getListType()===e){let s=i.getFirstChild();s!==null?s.insertBefore(l):i.append(l),t.remove()}else if(Bt(n)&&n.getListType()===e)n.append(l),t.remove();else{let s=Ya(e,e==="number"?Number(r[2]):void 0);s.append(l),t.replace(s)}l.append(...o),l.select(0,0);let a=Math.floor(r[1].length/hn);a&&l.setIndent(a)},te=(e,t,o)=>{let r=[],n=e.getChildren(),i=0;for(let l of n)if(qa(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(Bt(d)){r.push(te(d,t,o+1));continue}}let a=" ".repeat(o*hn),s=e.getListType(),c=s==="number"?`${e.getStart()+i}. `:s==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(a+c+t(l)),i++}return r.join(`
|
|
35
|
-
`)};var
|
|
34
|
+
`},[e,t]),m=Y((g,y)=>{o(E=>{let b=t.length-1,S=t[b];if(S&&S.name===g){if(g==="type")return[...t.slice(0,b),{...S,value:S.value+y}];if(S.value===y)return[...t.slice(0,b),{...S,count:S.count+1}]}return[...E,{name:g,count:1,value:y}]})},[t,o]);vo(()=>{let g=E=>{if(!r)return;let b=E.key;bl(E)?m("selectAll",""):Fo.has(b)?m("press",E.key):[...b].length>1?m("keydown",E.key):m("type",E.key)},y=E=>{if(!r)return;let b=E.key;!Fo.has(b)&&[...b].length>1&&m("keyup",E.key)};return e.registerRootListener((E,b)=>{b!==null&&(b.removeEventListener("keydown",g),b.removeEventListener("keyup",y)),E!==null&&(E.addEventListener("keydown",g),E.addEventListener("keyup",y))})},[e,r,m]),vo(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Et(()=>{if(t){let g=p();g!==null&&a(g),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,t]),Et(()=>e.registerUpdateListener(({dirtyElements:y,dirtyLeaves:E,editorState:b})=>{if(!r)return;let S=b._selection,k=s.current,R=c.current;if(k!==S){if(E.size===0&&y.size===0&&!R){let N=window.getSelection();if(N&&(N.anchorNode==null||N.focusNode==null))return}s.current=S}c.current=!1;let O=p();O!==null&&a(O)}),[e,p,r,m]),Et(()=>r?e.registerUpdateListener(()=>{let y=e.getRootElement();y!==null&&i(y?.innerHTML)}):void 0,[e,r]);let f=Y(g=>{r||(g.update(()=>{let y=Tl();y.clear();let E=xl();y.append(hl().append(E)),E.select()}),o([])),n(y=>!y)},[r]),h=Y(()=>{if(!r)return;let g=window.getSelection();if(g===null||g.anchorNode==null||g.focusNode==null)return;let{anchorNode:y,anchorOffset:E,focusNode:b,focusOffset:S}=kl(g),k=u().getRootElement(),R;y!==null&&(R=Io(y,k));let O;b!==null&&(O=Io(b,k)),m("snapshot",{anchorNode:y,anchorOffset:E,anchorPath:R,focusNode:b,focusOffset:S,focusPath:O})},[m,r,u]),L=Y(()=>{Ll(p())},[p]),x=Y(()=>{yl("test.js",p())},[p]);return[q("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:g=>{f(u()),g.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?kt("div",{className:"test-recorder-output",children:[kt("div",{className:"test-recorder-toolbar",children:[q("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:g=>{h(),g.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),q("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:g=>{L(),g.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),q("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:g=>{x(),g.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),q("pre",{id:"test-recorder",ref:d,children:l})]}):null]}var Po=()=>{let[e]=Cl(),[t,o]=Nl(e);return kt(Mo.Fragment,{children:[q("p",{children:"HI"}),t,o,q("p",{children:"DONE"})]})};var _l=C({plugins:[{Component:Po,position:"bottom"}]});import{useLexicalComposerContext as wl}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Sl}from"@lexical/react/LexicalTreeView.js";import{jsx as Rl}from"react/jsx-runtime";var Ao=()=>{let[e]=wl();return Rl(Sl,{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 vl=C({plugins:[{Component:Ao,position:"bottom"}]});import{$isRangeSelection as Il,FORMAT_TEXT_COMMAND as Fl}from"lexical";import{jsx as Do}from"react/jsx-runtime";var Oo=()=>Do("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:Do("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 I=e=>({type:"buttons",items:e,key:"format",order:40});var Ho={type:"text-format",format:["bold","italic"],tag:"***"},Bo={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Go={type:"text-format",format:["bold"],tag:"**"},$o={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Uo=[I([{ChildComponent:Oo,isActive:({selection:e})=>Il(e)?e.hasFormat("bold"):!1,key:"bold",onSelect:({editor:e})=>{e.dispatchCommand(Fl,"bold")},order:1}])],Ml=C(({featureProviderMap:e})=>{let t=[Go,$o];return e.get("italic")&&t.push(Bo,Ho),{markdownTransformers:t,toolbarFixed:{groups:Uo},toolbarInline:{groups:Uo}}});import{$isRangeSelection as Al,FORMAT_TEXT_COMMAND as Dl}from"lexical";import{jsx as Wo,jsxs as Pl}from"react/jsx-runtime";var zo=()=>Pl("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:[Wo("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Wo("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Vo={type:"text-format",format:["code"],tag:"`"};var Ko=[I([{ChildComponent:zo,isActive:({selection:e})=>Al(e)?e.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:e})=>{e.dispatchCommand(Dl,"code")},order:7}])],Ol=C({markdownTransformers:[Vo],toolbarFixed:{groups:Ko},toolbarInline:{groups:Ko}});import{$isRangeSelection as Hl,FORMAT_TEXT_COMMAND as Bl}from"lexical";import{jsx as jo}from"react/jsx-runtime";var Zo=()=>jo("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:jo("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 Xo={type:"text-format",format:["italic"],tag:"*"},Jo={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Yo=[I([{ChildComponent:Zo,isActive:({selection:e})=>Hl(e)?e.hasFormat("italic"):!1,key:"italic",onSelect:({editor:e})=>{e.dispatchCommand(Bl,"italic")},order:2}])],Gl=C({markdownTransformers:[Xo,Jo],toolbarFixed:{groups:Yo},toolbarInline:{groups:Yo}});import{$isRangeSelection as Ul,FORMAT_TEXT_COMMAND as Wl}from"lexical";import{jsx as qo,jsxs as $l}from"react/jsx-runtime";var Qo=()=>$l("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:[qo("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"}),qo("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var er={type:"text-format",format:["strikethrough"],tag:"~~"};var tr=[I([{ChildComponent:Qo,isActive:({selection:e})=>Ul(e)?e.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:e})=>{e.dispatchCommand(Wl,"strikethrough")},order:4}])],zl=C({markdownTransformers:[er],toolbarFixed:{groups:tr},toolbarInline:{groups:tr}});import{$isRangeSelection as Vl,FORMAT_TEXT_COMMAND as Kl}from"lexical";import{jsx as or}from"react/jsx-runtime";var rr=()=>or("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:or("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 nr=[I([{ChildComponent:rr,isActive:({selection:e})=>Vl(e)?e.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:e})=>{e.dispatchCommand(Kl,"subscript")},order:5}])],jl=C({toolbarFixed:{groups:nr},toolbarInline:{groups:nr}});import{$isRangeSelection as Zl,FORMAT_TEXT_COMMAND as Xl}from"lexical";import{jsx as ir}from"react/jsx-runtime";var lr=()=>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 sr=[I([{ChildComponent:lr,isActive:({selection:e})=>Zl(e)?e.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:e})=>{e.dispatchCommand(Xl,"superscript")},order:6}])],Jl=C({toolbarFixed:{groups:sr},toolbarInline:{groups:sr}});import{$isRangeSelection as ql,FORMAT_TEXT_COMMAND as Ql}from"lexical";import{jsx as ar,jsxs as Yl}from"react/jsx-runtime";var cr=()=>Yl("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:"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"}),ar("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var dr=[I([{ChildComponent:cr,isActive:({selection:e})=>ql(e)?e.hasFormat("underline"):!1,key:"underline",onSelect:({editor:e})=>{e.dispatchCommand(Ql,"underline")},order:3}])],es=C({toolbarFixed:{groups:dr},toolbarInline:{groups:dr}});import{$createHeadingNode as ns,$isHeadingNode as kr,HeadingNode as is}from"@lexical/rich-text";import{$setBlocksType as ls}from"@lexical/selection";import{$getSelection as ss,$isRangeSelection as as}from"lexical";import{jsx as pr}from"react/jsx-runtime";var ur=()=>pr("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:pr("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 mr}from"react/jsx-runtime";var fr=()=>mr("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:mr("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 Cr=()=>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 hr}from"react/jsx-runtime";var xr=()=>hr("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:hr("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 Tr}from"react/jsx-runtime";var Lr=()=>Tr("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:Tr("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 yr}from"react/jsx-runtime";var Er=()=>yr("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:yr("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 ts,$isHeadingNode as os,HeadingNode as rs}from"@lexical/rich-text";var Nt=e=>(t,o,r)=>{let n=e(r);n&&(n.append(...o),t.replace(n),n.select(0,0))};var br=e=>{let o=`^(${e.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[rs],export:(n,i)=>{if(!os(n))return null;let l=Number(n.getTag().slice(1));return"#".repeat(l)+" "+i(n)},regExp:r,replace:Nt(n=>{let i="h"+n[1].length;return ts(i)})}};var Nr=e=>{let t=ss();ls(t,()=>ns(e))},_r={h1:ur,h2:fr,h3:Cr,h4:xr,h5:Lr,h6:Er},cs=C(({props:e})=>{let{enabledHeadingSizes:t=["h1","h2","h3","h4","h5","h6"]}=e,o=[P(t.map((r,n)=>({ChildComponent:_r[r],isActive:({selection:i})=>{if(!as(i))return!1;for(let l of i.getNodes()){if(kr(l)&&l.getTag()===r)continue;let a=l.getParent();if(!(kr(a)&&a.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(()=>{Nr(r)})},order:n+2})))];return{markdownTransformers:[br(t)],nodes:[is],sanitizedClientFeatureProps:e,slashMenu:{groups:t?.length?[M(t.map(r=>({Icon:_r[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(()=>{Nr(r)})}})))]:[]},toolbarFixed:{groups:t?.length?o:[]},toolbarInline:{groups:t?.length?o:[]}}});import{$isNodeSelection as hs}from"lexical";import{jsx as wr}from"react/jsx-runtime";var _t=()=>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("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Sr,jsxs as ds}from"react/jsx-runtime";var Rr=()=>ds("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Sr("path",{d:"M5 10h10",stroke:"currentColor"}),Sr("path",{d:"M10 15V5",stroke:"currentColor"})]});var Q=e=>({type:"dropdown",ChildComponent:Rr,items:e,key:"add",order:10});var vr={type:"element",dependencies:[Ae],export:(e,t)=>Oe(e)?"---":null,regExp:/^---\s*$/,replace:e=>{let t=De();t&&e.replace(t)}};import{useLexicalComposerContext as ps}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as us}from"@lexical/utils";import{$getSelection as ms,$isRangeSelection as fs,COMMAND_PRIORITY_EDITOR as gs}from"lexical";import{useEffect as Cs}from"react";var Ir=()=>{let[e]=ps();return Cs(()=>e.registerCommand(me,t=>{let o=ms();if(!fs(o))return!1;if(o.focus.getNode()!==null){let n=De();us(n)}return!0},gs),[e]),null};var xs=C({markdownTransformers:[vr],nodes:[Ae],plugins:[{Component:Ir,position:"normal"}],slashMenu:{groups:[M([{Icon:_t,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(me,void 0)}}])]},toolbarFixed:{groups:[Q([{ChildComponent:_t,isActive:({selection:e})=>{if(!hs(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return Oe(t)},key:"horizontalRule",label:({i18n:e})=>e.t("lexical:horizontalRule:label"),onSelect:({editor:e})=>{e.dispatchCommand(me,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as ys,OUTDENT_CONTENT_COMMAND as Es}from"lexical";import{jsx as Ve,jsxs as Ts}from"react/jsx-runtime";var Fr=()=>Ts("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:[Ve("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Ve("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),Ve("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ve("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Ke,jsxs as Ls}from"react/jsx-runtime";var Mr=()=>Ls("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:[Ke("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Ke("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Ke("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Ke("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var Pr=e=>({type:"buttons",items:e,key:"indent",order:35});var Ar=[Pr([{ChildComponent:Fr,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(Es,void 0)},order:1},{ChildComponent:Mr,isActive:()=>!1,key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(ys,void 0)},order:2}])],bs=C({toolbarFixed:{groups:Ar},toolbarInline:{groups:Ar}});import{$findMatchingParent as Sa}from"@lexical/utils";import{$getSelection as Dt,$isRangeSelection as pn}from"lexical";import{jsx as Dr}from"react/jsx-runtime";var Or=()=>Dr("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:Dr("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 Hr}from"@lexical/selection";function ne(e){let{anchor:t}=e,{focus:o}=e,r=e.anchor.getNode(),n=e.focus.getNode();return r===n?r:e.isBackward()?Hr(o)?r:n:Hr(t)?r:n}var wt=e=>({type:"buttons",items:e,key:"features",order:50});import{$createTextNode as Ps,$isTextNode as As}from"lexical";import{addClassNamesToElement as ks,isHTMLAnchorElement as Ns}from"@lexical/utils";import vt from"bson-objectid";import{$applyNodeReplacement as _s,$createTextNode as Br,$getSelection as ws,$isElementNode as Gr,$isRangeSelection as Rt,ElementNode as Ss,createCommand as Rs}from"lexical";var vs=new Set(["http:","https:","mailto:","sms:","tel:"]),A=class e extends Ss{__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:Is,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 vt.default().toHexString(),t.version=3);let o=U({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=St(o.rel,"add","noopener")),ks(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(!Rt(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(Gr(r)){let n=U({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(t){try{let o=new URL(t);if(!vs.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=St(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=St(o.rel,"remove","noopener"))),!1}};function Is(e){let t=null;if(Ns(e)){let o=e.textContent;o!==null&&o!==""&&(t=U({id:new vt.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:e.getAttribute("target")==="_blank",url:e.getAttribute("href")??""}}))}return{node:t}}function U({id:e,fields:t}){return _s(new A({id:e??new vt.default().toHexString(),fields:t}))}function v(e){return e instanceof A}var G=Rs("TOGGLE_LINK_COMMAND");function $r(e){let t=ws();if(!Rt(t)&&!e.selectedNodes.length)return;let o=Rt(t)?t.extract():e.selectedNodes;if(e===null)o.forEach(r=>{let n=r.getParent();if(v(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=v(i)?i:Fs(i);if(l!==null){l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(Br(e.text)),l.getChildren().forEach(a=>{a!==l.getLastChild()&&a.remove()}));return}}let r=null,n=null;o.forEach(i=>{let l=i.getParent();if(!(l===n||l===null||Gr(i)&&!i.isInline())){if(v(l)){n=l,l.setFields(e.fields),e.text!=null&&e.text!==l.getTextContent()&&(l.append(Br(e.text)),l.getChildren().forEach(a=>{a!==l.getLastChild()&&a.remove()}));return}if(l.is(r)||(r=l,n=U({fields:e.fields}),v(l)?i.getPreviousSibling()===null?l.insertBefore(n):l.insertAfter(n):i.insertBefore(n)),v(i)){if(i.is(n))return;if(n!==null){let a=i.getChildren();for(let s=0;s<a.length;s+=1)n.append(a[s])}i.remove();return}n!==null&&n.append(i)}})}}function Fs(e){return Ms(e,t=>v(t))}function Ms(e,t){let o=e;for(;o!==null&&(o=o.getParent())!==null&&!t(o););return o}function St(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 Ur={type:"text-match",dependencies:[A],export:(e,t,o)=>{if(!v(e))return null;let r=e,{url:n}=r.getFields(),i=`[${r.getTextContent()}](${n})`,l=r.getFirstChild();return r.getChildrenSize()===1&&As(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(e,t)=>{let[,o,r]=t,n=U({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),i=Ps(o);i.setFormat(e.getFormat()),n.append(i),e.replace(n)},trigger:")"};import{$applyNodeReplacement as Ds,$isElementNode as Os}from"lexical";var W=class e extends A{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=be({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(Os(r)){let n=be({fields:this.__fields});return r.append(n),n}return null}};function be({fields:e}){return Ds(new W({id:void 0,fields:e}))}function z(e){return e instanceof W}import{useLexicalComposerContext as Hs}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Bs}from"@lexical/utils";import{$createTextNode as Wr,$getSelection as Gs,$isElementNode as Vr,$isLineBreakNode as Kr,$isNodeSelection as $s,$isRangeSelection as Us,$isTextNode as ke,TextNode as Ws}from"lexical";import{useEffect as zs}from"react";function It(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 zr(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 jr(e,t){for(let o=0;o<t.length;o++){let r=t[o](e);if(r!=null)return r}return null}var Vs=/[.,;\s]/;function Ze(e){return Vs.test(e)}function Zr(e){return Ze(e[e.length-1])}function Mt(e){return Ze(e[0])}function Xr(e){let t=e.getPreviousSibling();return Vr(t)&&(t=t.getLastDescendant()),t===null||Kr(t)||ke(t)&&Zr(t.getTextContent())}function Jr(e){let t=e.getNextSibling();return Vr(t)&&(t=t.getFirstDescendant()),t===null||Kr(t)||ke(t)&&Mt(t.getTextContent())}function Ks(e,t,o,r){return(e>0?Ze(o[e-1]):Xr(r[0]))?t<o.length?Ze(o[t]):Jr(r[r.length-1]):!1}function js(e,t,o){let r=[],n=[],i=[],l=0,a=0,s=[...e];for(;s.length>0;){let c=s[0],u=c.getTextContent().length,p=a;a+u<=t?(r.push(c),l+=u):p>=o?i.push(c):n.push(c),a+=u,s.shift()}return[l,r,n,i]}function Zs(e,t,o,r){let n={linkType:"custom",url:r.url,...r.fields},i=be({fields:n});if(e.length===1){let l=e[0],a;t===0?[a,l]=l.splitText(o):[,a,l]=l.splitText(t,o);let s=Wr(r.text);return s.setFormat(a.getFormat()),s.setDetail(a.getDetail()),s.setStyle(a.getStyle()),i.append(s),a.replace(i),l}else if(e.length>1){let l=e[0],a=l.getTextContent().length,s;t===0?s=l:[,s]=l.splitText(t);let c=[],d;for(let f=1;f<e.length;f++){let h=e[f],x=h.getTextContent().length,_=a,w=a+x;if(_<o)if(w<=o)c.push(h);else{let[g,y]=h.splitText(o-_);c.push(g),d=y}a+=x}let u=Gs(),p=u?u.getNodes().find(ke):void 0,m=Wr(s.getTextContent());return m.setFormat(s.getFormat()),m.setDetail(s.getDetail()),m.setStyle(s.getStyle()),i.append(m,...c),p&&p===s&&(Us(u)?m.select(u.anchor.offset,u.focus.offset):$s(u)&&m.select(0,m.getTextContent().length)),s.replace(i),d}}function Xs(e,t,o){let r=[...e],n=r.map(s=>s.getTextContent()).join(""),i=n,l,a=0;for(;(l=jr(i,t))!=null&&l!==null;){let s=l.index,c=l.length,d=s+c;if(Ks(a+s,a+d,n,r)){let[p,,m,f]=js(r,a+s,a+d),h=a+s-p,L=a+d-p,x=Zs(m,h,L,l);r=x?[x,...f]:f,o(l.url,null),a=0}else a+=d;i=i.substring(d)}}function Ft(e,t,o){let r=e.getChildren(),n=r.length;for(let s=0;s<n;s++){let c=r[s];if(!ke(c)||!c.isSimpleText()){je(e),o(null,e.getFields()?.url??null);return}}let i=e.getTextContent(),l=jr(i,t);if(l===null||l.text!==i){je(e),o(null,e.getFields()?.url??null);return}if(!Xr(e)||!Jr(e)){je(e),o(null,e.getFields()?.url??null);return}let a=e.getFields()?.url;if(a!==l?.url){let s=e.getFields();s.url=l?.url,e.setFields(s),o(l.url,a??null)}}function Js(e,t,o){let r=e.getPreviousSibling(),n=e.getNextSibling(),i=e.getTextContent();z(r)&&!Mt(i)&&(r.append(e),Ft(r,t,o),o(null,r.getFields()?.url??null)),z(n)&&!Zr(i)&&(je(n),Ft(n,t,o),o(null,n.getFields()?.url??null))}function je(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 Ys(e){let t=[e],o=e.getNextSibling();for(;o!==null&&ke(o)&&o.isSimpleText()&&(t.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return t}function qs(e,t,o){zs(()=>{e.hasNodes([W])||It(!1,"LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let r=(n,i)=>{o?.(n,i)};return Bs(e.registerNodeTransform(Ws,n=>{let i=n.getParentOrThrow(),l=n.getPreviousSibling();if(z(i))Ft(i,t,r);else if(!v(i)){if(n.isSimpleText()&&(Mt(n.getTextContent())||!z(l))){let a=Ys(n);Xs(a,t,r)}Js(n,t,r)}}))},[e,t,o])}var Qs=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)/,ea=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,ta=[zr(Qs,e=>e.startsWith("http")?e:`https://${e}`),zr(ea,e=>`mailto:${e}`)],Yr=()=>{let[e]=Hs();return qs(e,ta),null};import{ClickableLinkPlugin as oa}from"@lexical/react/LexicalClickableLinkPlugin.js";import{jsx as ra}from"react/jsx-runtime";var qr=()=>ra(oa,{});import{createCommand as na}from"lexical";var Xe=na("TOGGLE_LINK_WITH_MODAL_COMMAND");import{createPortal as ha}from"react-dom";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Qr,mergeRegister as en}from"@lexical/utils";import{getTranslation as la}from"@payloadcms/translations";import{formatDrawerSlug as sa,useConfig as aa,useEditDepth as ca,useModal as da,useTranslation as pa}from"@payloadcms/ui";import{$getSelection as tn,$isLineBreakNode as ua,$isRangeSelection as on,COMMAND_PRIORITY_HIGH as ma,COMMAND_PRIORITY_LOW as rn,KEY_ESCAPE_COMMAND as fa,SELECTION_CHANGE_COMMAND as ga}from"lexical";import nn,{useCallback as ln,useEffect as Ye,useRef as Ca,useState as ie}from"react";function Je(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(),a=o.getBoundingClientRect(),s=i.getBoundingClientRect(),c=e.top-r,d=e.left-n;c<s.top&&(c+=l.height+e.height+r*2),d+l.width>s.right&&(d=s.right-l.width-n),c-=a.top,d-=a.left,t.style.opacity="1",t.style.transform=`translate(${d}px, ${c}px)`}import{jsx as le,jsxs as Pt}from"react/jsx-runtime";function sn({anchorElem:e}){let[t]=ia(),o=Ca(null),[r,n]=ie(null),[i,l]=ie(null),{uuid:a}=F(),s=aa(),{i18n:c,t:d}=pa(),[u,p]=ie({}),{closeModal:m,toggleModal:f}=da(),h=ca(),[L,x]=ie(!1),[_,w]=ie([]),[g,y]=ie(!1),E=sa({slug:"lexical-rich-text-link-"+a,depth:h}),b=ln(()=>{x(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),y(!1),n(null),l(null),w([]),p({})},[x,n,l,w]),S=ln(()=>{let k=tn(),R=null;if(!on(k)||!k){b();return}let O=ne(k);R=t.getElementByKey(O.getKey())?.getBoundingClientRect();let N=Qr(O,v),Pe=k.getNodes().filter(oe=>!ua(oe)).find(oe=>{let X=Qr(oe,v);return N&&!N.is(X)||X&&!X.is(N)});if(N==null||Pe){b();return}let Z={doc:void 0,linkType:void 0,newTab:void 0,url:"",...N.getFields(),id:N.getID(),text:N.getTextContent()};if(N.getFields()?.linkType==="custom")n(N.getFields()?.url??null),l(null);else{n(`/admin/collections/${N.getFields()?.doc?.relationTo}/${N.getFields()?.doc?.value}`);let oe=s.collections.find(X=>X.slug===N.getFields()?.doc?.relationTo);if(!oe)l(N.getFields()?.label?String(N.getFields()?.label):null),n(N.getFields()?.url?String(N.getFields()?.url):null);else{let X=d("fields:linkedTo",{label:la(oe.labels.singular,c)}).replace(/<[^>]*>?/g,"");l(X)}}p(Z),x(!0),w(k?k?.getNodes():[]),z(N)?y(!0):y(!1);let ue=o.current,st=window.getSelection(),{activeElement:no}=document;if(ue===null)return;let at=t.getRootElement();return st!==null&&at!==null&&at.contains(st.anchorNode)?(R||(R=st.getRangeAt(0).getBoundingClientRect()),R!=null&&(R.y+=40,Je(R,ue,e))):(no==null||no.className!=="link-input")&&(at!==null&&Je(null,ue,e),n(null),l(null)),!0},[t,b,s.collections,d,c,e]);return Ye(()=>en(t.registerCommand(Xe,k=>(t.dispatchCommand(G,k),S(),f(E),!0),rn)),[t,S,f,E]),Ye(()=>{let k=e.parentElement,R=()=>{t.getEditorState().read(()=>{S()})};return window.addEventListener("resize",R),k?.addEventListener("scroll",R),()=>{window.removeEventListener("resize",R),k?.removeEventListener("scroll",R)}},[e.parentElement,t,S]),Ye(()=>en(t.registerUpdateListener(({editorState:k})=>{k.read(()=>{S()})}),t.registerCommand(ga,()=>(S(),!0),rn),t.registerCommand(fa,()=>L?(b(),!0):!1,ma)),[t,S,L,b]),Ye(()=>{t.getEditorState().read(()=>{S()})},[t,S]),Pt(nn.Fragment,{children:[le("div",{className:"link-editor",ref:o,children:Pt("div",{className:"link-input",children:[r&&r.length>0?le("a",{href:r,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:r}):i!=null&&i.length>0?le("span",{className:"link-input__label-pure",children:i}):null,t.isEditable()&&Pt(nn.Fragment,{children:[le("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{f(E)},onMouseDown:k=>{k.preventDefault()},tabIndex:0,type:"button"}),!g&&le("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{t.dispatchCommand(G,null)},onMouseDown:k=>{k.preventDefault()},tabIndex:0,type:"button"})]})]})}),le(dt,{className:"lexical-link-edit-drawer",data:u,drawerSlug:E,drawerTitle:d("fields:editLink"),featureKey:"link",handleDrawerSubmit:(k,R)=>{m(E);let O=R,N={...O};delete N.text,t.update(()=>{let Pe=tn(),Z=null;if(on(Pe)?Z=ne(Pe).getParent():_.length&&(Z=_[0].getParent()),Z&&z(Z)){let ue=U({fields:N});Z.replace(ue,!0)}}),t.dispatchCommand(G,{fields:N,selectedNodes:_,text:O.text})},schemaPathSuffix:"fields"})]})}import{jsx as xa}from"react/jsx-runtime";var an=e=>{let{anchorElem:t=document.body}=e;return ha(xa(sn,{anchorElem:t}),t)};import{useLexicalComposerContext as ya}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ea}from"@lexical/utils";import{$getSelection as ba,$isElementNode as ka,$isRangeSelection as Na,COMMAND_PRIORITY_LOW as cn,PASTE_COMMAND as _a}from"lexical";import{useEffect as wa}from"react";var Ta=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,La=/^[\w\-./]*(?:#\w[\w-]*)?$/;function At(e){if(!e)return!1;if(e==="https://"||Ta.test(e)||La.test(e))return!0;try{return new URL(e),!0}catch{}return!1}var dn=()=>{let[e]=ya();return wa(()=>{if(!e.hasNodes([A]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Ea(e.registerCommand(G,t=>($r(t),!0),cn),At!==void 0?e.registerCommand(_a,t=>{let o=ba();if(!Na(o)||o.isCollapsed()||!(t instanceof ClipboardEvent)||t.clipboardData==null)return!1;let r=t.clipboardData.getData("text");if(!At(r))return!1;if(!o.getNodes().some(n=>ka(n))){let n={doc:null,linkType:"custom",newTab:!1,url:r};return e.dispatchCommand(G,{fields:n,text:null}),t.preventDefault(),!0}return!1},cn):()=>{})},[e]),null};var un=[wt([{ChildComponent:Or,isActive:({selection:e})=>{if(pn(e)){let t=ne(e);return Sa(t,v)!=null}return!1},isEnabled:({selection:e})=>!!(pn(e)&&Dt()?.getTextContent()?.length),key:"link",label:({i18n:e})=>e.t("lexical:link:label"),onSelect:({editor:e,isActive:t})=>{if(t)e.dispatchCommand(G,null);else{let o=null,r=[];if(e.getEditorState().read(()=>{o=Dt()?.getTextContent(),r=Dt()?.getNodes()??[]}),!o?.length)return;let n={doc:null,linkType:"custom",newTab:!1,url:"https://"};e.dispatchCommand(Xe,{fields:n,selectedNodes:r,text:o})}},order:1}])],Ra=C({markdownTransformers:[Ur],nodes:[A,W],plugins:[{Component:dn,position:"normal"},{Component:Yr,position:"normal"},{Component:qr,position:"normal"},{Component:an,position:"floatingAnchorElem"}],toolbarFixed:{groups:un},toolbarInline:{groups:un}});import{$isListNode as Bt,INSERT_CHECK_LIST_COMMAND as xn,ListItemNode as $a,ListNode as Ua}from"@lexical/list";import{$isRangeSelection as Wa}from"lexical";import{jsx as mn,jsxs as va}from"react/jsx-runtime";var Ot=()=>va("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:[mn("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),mn("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{ListPlugin as Ia}from"@lexical/react/LexicalListPlugin.js";import{jsx as Fa}from"react/jsx-runtime";var se=()=>Fa(Ia,{});function ae(e){return{items:e,key:"lists",label:({i18n:t})=>t.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Da,ListItemNode as Oa,ListNode as Ha}from"@lexical/list";import{$createListItemNode as Ma,$createListNode as Pa,$isListItemNode as Aa,$isListNode as Ht}from"@lexical/list";var fn=4,ce=e=>(t,o,r)=>{let n=t.getPreviousSibling(),i=t.getNextSibling(),l=Ma(e==="check"?r[3]==="x":void 0);if(Ht(i)&&i.getListType()===e){let s=i.getFirstChild();s!==null?s.insertBefore(l):i.append(l),t.remove()}else if(Ht(n)&&n.getListType()===e)n.append(l),t.remove();else{let s=Pa(e,e==="number"?Number(r[2]):void 0);s.append(l),t.replace(s)}l.append(...o),l.select(0,0);let a=Math.floor(r[1].length/fn);a&&l.setIndent(a)},ee=(e,t,o)=>{let r=[],n=e.getChildren(),i=0;for(let l of n)if(Aa(l)){if(l.getChildrenSize()===1){let d=l.getFirstChild();if(Ht(d)){r.push(ee(d,t,o+1));continue}}let a=" ".repeat(o*fn),s=e.getListType(),c=s==="number"?`${e.getStart()+i}. `:s==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";r.push(a+c+t(l)),i++}return r.join(`
|
|
35
|
+
`)};var gn={type:"element",dependencies:[Ha,Oa],export:(e,t)=>Da(e)?ee(e,t,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:ce("check")};import{CheckListPlugin as Ba}from"@lexical/react/LexicalCheckListPlugin.js";import{jsx as Ga}from"react/jsx-runtime";var Cn=()=>Ga(Ba,{});var hn=[P([{ChildComponent:Ot,isActive:({selection:e})=>{if(!Wa(e))return!1;for(let t of e.getNodes()){if(Bt(t)&&t.getListType()==="check")continue;let o=t.getParent();if(Bt(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(Bt(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:e})=>e.t("lexical:checklist:label"),onSelect:({editor:e})=>{e.dispatchCommand(xn,void 0)},order:12}])],za=C(({featureProviderMap:e})=>{let t=[{Component:Cn,position:"normal"}];return!e.has("unorderedList")&&!e.has("orderedList")&&t.push({Component:se,position:"normal"}),{markdownTransformers:[gn],nodes:e.has("unorderedList")||e.has("orderedList")?[]:[Ua,$a],plugins:t,slashMenu:{groups:[ae([{Icon:Ot,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(xn,void 0)}}])]},toolbarFixed:{groups:hn},toolbarInline:{groups:hn}}});import{$isListNode as $t,INSERT_ORDERED_LIST_COMMAND as yn,ListItemNode as Xa,ListNode as Ja}from"@lexical/list";import{$isRangeSelection as Ya}from"lexical";import{jsx as Ne,jsxs as Va}from"react/jsx-runtime";var Gt=()=>Va("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:[Ne("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"}),Ne("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"}),Ne("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Ne("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Ne("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Ka,ListItemNode as ja,ListNode as Za}from"@lexical/list";var Tn={type:"element",dependencies:[Za,ja],export:(e,t)=>Ka(e)?ee(e,t,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:ce("number")};var Ln=[P([{ChildComponent:Gt,isActive:({selection:e})=>{if(!Ya(e))return!1;for(let t of e.getNodes()){if($t(t)&&t.getListType()==="number")continue;let o=t.getParent();if($t(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!($t(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(yn,void 0)},order:10}])],qa=C(({featureProviderMap:e})=>({markdownTransformers:[Tn],nodes:e.has("orderedList")?[]:[Ja,Xa],plugins:e.has("orderedList")?[]:[{Component:se,position:"normal"}],slashMenu:{groups:[ae([{Icon:Gt,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(yn,void 0)}}])]},toolbarFixed:{groups:Ln},toolbarInline:{groups:Ln}}));import{$isListNode as Wt,INSERT_UNORDERED_LIST_COMMAND as kn,ListItemNode as rc,ListNode as nc}from"@lexical/list";import{$isRangeSelection as ic}from"lexical";import{jsx as de,jsxs as Qa}from"react/jsx-runtime";var Ut=()=>Qa("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:[de("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),de("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),de("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),de("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),de("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),de("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as ec,ListItemNode as tc,ListNode as oc}from"@lexical/list";var En={type:"element",dependencies:[oc,tc],export:(e,t)=>ec(e)?ee(e,t,0):null,regExp:/^(\s*)[-*+]\s/,replace:ce("bullet")};var bn=[P([{ChildComponent:Ut,isActive:({selection:e})=>{if(!ic(e))return!1;for(let t of e.getNodes()){if(Wt(t)&&t.getListType()==="bullet")continue;let o=t.getParent();if(Wt(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(Wt(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:e})=>e.t("lexical:unorderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(kn,void 0)},order:11}])],lc=C({markdownTransformers:[En],nodes:[nc,rc],plugins:[{Component:se,position:"normal"}],slashMenu:{groups:[ae([{Icon:Ut,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:e})=>e.t("lexical:unorderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(kn,void 0)}}])]},toolbarFixed:{groups:bn},toolbarInline:{groups:bn}});function Nn({converters:e,lexicalPluginData:t}){return{root:{type:"root",children:_n({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 _n({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 sc(e,n);if(n.type==="text"||!n.type)return n;let l=e.find(a=>a.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 sc(e,t){return{...t,type:"paragraph",children:_n({converters:e,lexicalPluginNodes:t.children||[],parentNodeType:"paragraph"}),version:1}}import{addClassNamesToElement as ac}from"@lexical/utils";import{DecoratorNode as cc}from"lexical";import*as wn from"react";import{jsx as uc}from"react/jsx-runtime";var dc=wn.lazy(()=>import("./Component-7HS6FEJS.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),_e=class e extends cc{__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 pc({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return ac(o,"unknownConverted"),o}decorate(){return uc(dc,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function pc({data:e}){return new _e({data:e})}var mc=C(({clientFunctions:e})=>{let t=Object.values(e);return{hooks:{load({incomingEditorState:o}){return!o||!("jsonContent"in o)?o:Nn({converters:t,lexicalPluginData:o})}},nodes:[_e]}});var T={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},fc=T.IS_BOLD|T.IS_ITALIC|T.IS_STRIKETHROUGH|T.IS_UNDERLINE|T.IS_CODE|T.IS_SUBSCRIPT|T.IS_SUPERSCRIPT|T.IS_HIGHLIGHT,gc="\xA0",Cc=`
|
|
36
36
|
|
|
37
|
-
`,In="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Fn="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Mc=new RegExp("^[^"+Fn+"]*["+In+"]"),Ac=new RegExp("^[^"+In+"]*["+Fn+"]"),Dc={bold:T.IS_BOLD,code:T.IS_CODE,highlight:T.IS_HIGHLIGHT,italic:T.IS_ITALIC,strikethrough:T.IS_STRIKETHROUGH,subscript:T.IS_SUBSCRIPT,superscript:T.IS_SUPERSCRIPT,underline:T.IS_UNDERLINE},Oc={directionless:T.IS_DIRECTIONLESS,unmergeable:T.IS_UNMERGEABLE},Hc={center:T.IS_ALIGN_CENTER,end:T.IS_ALIGN_END,justify:T.IS_ALIGN_JUSTIFY,left:T.IS_ALIGN_LEFT,right:T.IS_ALIGN_RIGHT,start:T.IS_ALIGN_START},Bc={[T.IS_ALIGN_CENTER]:"center",[T.IS_ALIGN_END]:"end",[T.IS_ALIGN_JUSTIFY]:"justify",[T.IS_ALIGN_LEFT]:"left",[T.IS_ALIGN_RIGHT]:"right",[T.IS_ALIGN_START]:"start"},Gc={normal:T.IS_NORMAL,segmented:T.IS_SEGMENTED,token:T.IS_TOKEN},$c={[T.IS_NORMAL]:"normal",[T.IS_SEGMENTED]:"segmented",[T.IS_TOKEN]:"token"};function Mn({converters:e,slateData:t}){return{root:{type:"root",children:An({canContainParagraphs:!0,converters:e,parentNodeType:"root",slateNodes:t}),direction:"ltr",format:"",indent:0,version:1}}}function An({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?Pn(t,i):Uc(i);if(i.type==="p")return Pn(t,i);let a=t.find(s=>s.nodeTypes.includes(i.type));return a?a.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 Pn(e,t){return{type:"paragraph",children:An({canContainParagraphs:!1,converters:e,parentNodeType:"paragraph",slateNodes:t.children||[]}),direction:"ltr",format:"",indent:0,textFormat:0,version:1}}function Uc(e){return{type:"text",detail:0,format:Wc(e),mode:"normal",style:"",text:e.text,version:1}}function Wc(e){let t=0;return e.bold&&(t=t|T.IS_BOLD),e.italic&&(t=t|T.IS_ITALIC),e.strikethrough&&(t=t|T.IS_STRIKETHROUGH),e.underline&&(t=t|T.IS_UNDERLINE),e.subscript&&(t=t|T.IS_SUBSCRIPT),e.superscript&&(t=t|T.IS_SUPERSCRIPT),e.code&&(t=t|T.IS_CODE),t}import{addClassNamesToElement as Vc}from"@lexical/utils";import{DecoratorNode as zc}from"lexical";import*as Dn from"react";import{jsx as Zc}from"react/jsx-runtime";var Kc=Dn.lazy(()=>import("./Component-LAKSCIDX.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),Re=class e extends zc{__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 jc({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return Vc(o,"unknownConverted"),o}decorate(){return Zc(Kc,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function jc({data:e}){return new Re({data:e})}var Xc=h(({clientFunctions:e})=>{let t=Object.values(e);return{hooks:{load({incomingEditorState:o}){return!o||!Array.isArray(o)||"root"in o?o:Mn({converters:t,slateData:o})}},nodes:[Re]}});import{$setBlocksType as Bn}from"@lexical/selection";import{$createParagraphNode as Gn,$getSelection as $n,$isParagraphNode as On,$isRangeSelection as Jc}from"lexical";var Hn=[M([{ChildComponent:be,isActive:({selection:e})=>{if(!Jc(e))return!1;for(let t of e.getNodes())if(!On(t)&&!On(t.getParent()))return!1;return!0},key:"paragraph",label:({i18n:e})=>e.t("lexical:paragraph:label2"),onSelect:({editor:e})=>{e.update(()=>{let t=$n();Bn(t,()=>Gn())})},order:1}])],Yc=h({slashMenu:{groups:[D([{Icon:be,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:e})=>e.t("lexical:paragraph:label"),onSelect:({editor:e})=>{e.update(()=>{let t=$n();Bn(t,()=>Gn())})}}])]},toolbarFixed:{groups:Hn},toolbarInline:{groups:Hn}});import{$isNodeSelection as gd}from"lexical";import{jsx as Se,jsxs as qc}from"react/jsx-runtime";var zt=()=>qc("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:[Se("g",{clipPath:"url(#clip0_4397_10817)",children:Se("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"})}),Se("defs",{children:Se("clipPath",{id:"clip0_4397_10817",children:Se("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{useLexicalComposerContext as id}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ld}from"@lexical/utils";import{useConfig as sd}from"@payloadcms/ui";import{$getPreviousSelection as ad,$getSelection as cd,$isParagraphNode as Kn,$isRangeSelection as dd,COMMAND_PRIORITY_EDITOR as pd,createCommand as ud}from"lexical";import{useEffect as md}from"react";import{useLexicalComposerContext as Qc}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as ed}from"@payloadcms/ui";import{$getNodeByKey as td,COMMAND_PRIORITY_EDITOR as od}from"lexical";import{useCallback as rd,useEffect as Un,useState as Wn}from"react";import{jsx as Qe}from"react/jsx-runtime";var nd=({editor:e,relationTo:t,replaceNodeKey:o,value:r})=>{o?e.update(()=>{let n=td(o);n&&n.replace(he({relationTo:t,value:r}))}):e.dispatchCommand(Kt,{relationTo:t,value:r})},Vn=({enabledCollectionSlugs:e})=>{let[t]=Qc(),[o,r]=Wn(()=>e[0]),[n,i]=Wn(null),[l,a,{closeDrawer:s,isDrawerOpen:c,openDrawer:d}]=ed({collectionSlugs:e,selectedCollection:o});Un(()=>t.registerCommand(ge,p=>(i(p?.replace?p?.replace.nodeKey:null),d(),!0),od),[t,d]);let u=rd(({collectionSlug:p,docID:m})=>{nd({editor:t,relationTo:p,replaceNodeKey:n,value:m}),s()},[t,s,n]);return Un(()=>{r(e[0])},[c,e]),Qe(l,{onSelect:u})},zn=e=>e?.enabledCollectionSlugs?.length>0?Qe(Vn,{...e}):Qe(Be,{...e,children:Qe(Vn,{...e})});import{jsx as fd}from"react/jsx-runtime";var Kt=ud("INSERT_RELATIONSHIP_COMMAND"),jn=({clientProps:e})=>{let[t]=id(),{collections:o}=sd(),r=null;return e?.enabledCollections?r=e?.enabledCollections:e?.disabledCollections&&(r=o.filter(({slug:n})=>!e?.disabledCollections?.includes(n)).map(({slug:n})=>n)),md(()=>{if(!t.hasNodes([Ce]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return t.registerCommand(Kt,n=>{let i=cd()||ad();if(dd(i)){let l=he(n);ld(l);let{focus:a}=i,s=a.getNode();Kn(s)&&s.getTextContentSize()===0&&s.getParent().getChildren().filter(c=>Kn(c)).length>1&&s.remove()}return!0},pd)},[t]),fd(zn,{enabledCollectionSlugs:r})};var Cd=h({nodes:[Ce],plugins:[{Component:jn,position:"normal"}],slashMenu:{groups:[D([{Icon:zt,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(ge,{replace:!1})}}])]},toolbarFixed:{groups:[ee([{ChildComponent:zt,isActive:({selection:e})=>{if(!gd(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return pt(t)},key:"relationship",label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(ge,{replace:!1})}}])]}});import{useLexicalComposerContext as Id}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Fd,useThrottledEffect as Pd,useTranslation as Md}from"@payloadcms/ui";import*as K from"react";import{useMemo as Ad}from"react";import{mergeRegister as hd}from"@lexical/utils";import{$getSelection as xd}from"lexical";import{useCallback as Td,useEffect as et,useState as jt}from"react";import{jsx as Ld}from"react/jsx-runtime";var Zt="toolbar-popup__button",ve=({children:e,editor:t,item:o})=>{let[r,n]=jt(!0),[i,l]=jt(!1),[a,s]=jt(Zt),c=v(),d=Td(()=>{t.getEditorState().read(()=>{let u=xd();if(o.isActive){let p=o.isActive({editor:t,editorConfigContext:c,selection:u});i!==p&&l(p)}if(o.isEnabled){let p=o.isEnabled({editor:t,editorConfigContext:c,selection:u});r!==p&&n(p)}})},[i,t,c,r,o]);return et(()=>{d()},[d]),et(()=>(document.addEventListener("mouseup",d),()=>{document.removeEventListener("mouseup",d)}),[d]),et(()=>hd(t.registerUpdateListener(()=>{d()})),[t,d]),et(()=>{s([Zt,r===!1?"disabled":"",i?"active":"",o?.key?`${Zt}-`+o.key:""].filter(Boolean).join(" "))},[r,i,a,o.key]),Ld("button",{className:a,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 qn,{useCallback as Nd,useEffect as Yt}from"react";import{mergeRegister as _d}from"@lexical/utils";import{useTranslation as wd}from"@payloadcms/ui";import{$getSelection as Rd}from"lexical";import tt,{useCallback as yd,useEffect as Ie,useMemo as Ed,useRef as Jt,useState as ot}from"react";import{createPortal as bd}from"react-dom";import{jsx as Z,jsxs as Zn}from"react/jsx-runtime";var Xt="toolbar-popup__dropdown-item",Xn=tt.createContext(null);function Jn({active:e,children:t,editor:o,enabled:r,item:n,title:i}){let[l,a]=ot(Xt);Ie(()=>{a([Xt,r===!1?"disabled":"",e?"active":"",n?.key?`${Xt}-${n.key}`:""].filter(Boolean).join(" "))},[r,e,l,n.key]);let s=Jt(null),c=tt.useContext(Xn);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:d}=c;return Ie(()=>{s?.current!=null&&d(s)},[s,d]),Z("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:s,title:i,type:"button",children:t})}function kd({children:e,dropDownRef:t,itemsContainerClassNames:o,onClose:r}){let[n,i]=ot(),[l,a]=ot(),s=yd(u=>{i(p=>p!=null?[...p,u]:[u])},[i]),c=u=>{if(n==null)return;let{key:p}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&u.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?a(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&a(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=Ed(()=>({registerItem:s}),[s]);return Ie(()=>{n!=null&&l==null&&a(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),Z(Xn.Provider,{value:d,children:Z("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:t,children:e})})}function Yn({Icon:e,buttonAriaLabel:t,buttonClassName:o,children:r,disabled:n=!1,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:a}){let s=Jt(null),c=Jt(null),[d,u]=ot(!1),p=()=>{u(!1),c?.current!=null&&c.current.focus()};Ie(()=>{let f=c.current,g=s.current;if(d&&f!==null&&g!==null){let{left:L,top:x}=f.getBoundingClientRect(),N=window.scrollY||document.documentElement.scrollTop;g.style.top=`${x+N+f.offsetHeight+5}px`,g.style.left=`${Math.min(L-5,window.innerWidth-g.offsetWidth-20)}px`}},[s,c,d]),Ie(()=>{let f=c.current;if(f!==null&&d){let g=L=>{let{target:x}=L;a!=null&&s.current!=null&&s.current.contains(x)||f.contains(x)||u(!1)};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[s,c,d,a]);let m=bd(Z(kd,{dropDownRef:s,itemsContainerClassNames:i,onClose:p,children:r}),document.body);return Zn(tt.Fragment,{children:[Zn("button",{"aria-label":t,className:o+(d?" active":""),disabled:n,onClick:f=>{f.preventDefault(),u(!d)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[e&&Z(e,{}),l&&Z("span",{className:"toolbar-popup__dropdown-label",children:l}),Z("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&Z(tt.Fragment,{children:m})]})}import{jsx as Fe,jsxs as vd}from"react/jsx-runtime";var qt="toolbar-popup__dropdown",Sd=({active:e,anchorElem:t,editor:o,enabled:r,item:n})=>{let{i18n:i}=wd();if(n.Component)return n?.Component&&Fe(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)+"..."),vd(Jn,{active:e,editor:o,enabled:r,item:n,children:[n?.ChildComponent&&Fe(n.ChildComponent,{}),Fe("span",{className:"text",children:l})]},n.key)},oe=({Icon:e,anchorElem:t,classNames:o,editor:r,groupKey:n,items:i,itemsContainerClassNames:l,label:a,maxActiveItems:s,onActiveChange:c})=>{let[d,u]=qn.useState([]),[p,m]=qn.useState([]),f=v(),g=Nd(()=>{r.getEditorState().read(()=>{let L=Rd(),x=[],N=[],_=[];for(let C of i)C.isActive&&(!s||x.length<s)&&C.isActive({editor:r,editorConfigContext:f,selection:L})&&(x.push(C.key),N.push(C)),C.isEnabled?C.isEnabled({editor:r,editorConfigContext:f,selection:L})&&_.push(C.key):_.push(C.key);u(x),m(_),c&&c({activeItems:N})})},[r,f,i,s,c]);return Yt(()=>{g()},[g]),Yt(()=>(document.addEventListener("mouseup",g),()=>{document.removeEventListener("mouseup",g)}),[g]),Yt(()=>_d(r.registerUpdateListener(()=>{g()})),[r,g]),Fe(Yn,{Icon:e,buttonAriaLabel:`${n} dropdown`,buttonClassName:[qt,`${qt}-${n}`,...o||[]].filter(Boolean).join(" "),itemsContainerClassNames:[`${qt}-items`,...l||[]],label:a,children:i.length&&i.map(L=>Fe(Sd,{active:d.includes(L.key),anchorElem:t,editor:r,enabled:p.includes(L.key),item:L},L.key))},n)};import{jsx as H,jsxs as Bd}from"react/jsx-runtime";function Dd({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&H(o.Component,{anchorElem:e,editor:t,item:o},o.key):H(ve,{editor:t,item:o,children:o?.ChildComponent&&H(o.ChildComponent,{})},o.key)}function Od({anchorElem:e,editor:t,editorConfig:o,group:r,index:n}){let{i18n:i}=Md(),[l,a]=K.useState(null),[s,c]=K.useState(null);K.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),a(null)):(c(null),a(null));return}let p=u[0],m=p.key;p.label&&(m=typeof p.label=="function"?p.label({i18n:i}):p.label),m.length>25&&(m=m.substring(0,25)+"..."),a(m),c(()=>p.ChildComponent)};return Bd("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,children:[r.type==="dropdown"&&r.items.length&&(s?H(oe,{Icon:s,anchorElem:e,editor:t,groupKey:r.key,items:r.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:l,maxActiveItems:1,onActiveChange:d}):H(oe,{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=>H(Dd,{anchorElem:e,editor:t,item:u},u.key)),n<o.features.toolbarFixed?.groups.length-1&&H("div",{className:"divider"})]},r.key)}function Hd({anchorElem:e,clientProps:t,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=K.useRef(null),{y:l}=Fd(),a=Ad(()=>{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 Pd(()=>{if(!a)return;let s=i.current;if(!s)return;let c=s.getBoundingClientRect(),d=a.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))i.current.className="fixed-toolbar fixed-toolbar--overlapping",a.className="fixed-toolbar fixed-toolbar--hide";else{if(!i.current.classList.contains("fixed-toolbar--overlapping"))return;i.current.className="fixed-toolbar",a.className="fixed-toolbar"}},50,[i,a,l]),H("div",{className:"fixed-toolbar",onFocus:s=>{s.stopPropagation()},ref:i,children:o.isEditable()&&H(K.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((s,c)=>H(Od,{anchorElem:e,editor:o,editorConfig:r,group:s,index:c},s.key))})})}var Qn=e=>{if(e.parentEditor?.editorConfig){if(e.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return e.parentEditor;if(e.parentEditor)return Qn(e.parentEditor)}return!1},ei=({anchorElem:e,clientProps:t})=>{let[o]=Id(),r=v(),{editorConfig:n}=r,i=t.applyToFocusedEditor&&r.focusedEditor?.editor||o,l=t.applyToFocusedEditor&&r.focusedEditor?.editorConfig||n,a=Qn(r);return t?.disableIfParentHasFixedToolbar&&a||!l?.features?.toolbarFixed?.groups?.length?null:H(Hd,{anchorElem:e,editor:i,editorConfig:l,parentWithFixedToolbar:a})};var Gd=h({plugins:[{Component:ei,position:"aboveContainer"}]});import{useLexicalComposerContext as $d}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ri}from"@lexical/utils";import{$getSelection as ni,$isRangeSelection as ti,$isTextNode as Ud,COMMAND_PRIORITY_LOW as Wd,SELECTION_CHANGE_COMMAND as Vd}from"lexical";import{useCallback as Pe,useEffect as Me,useRef as oi,useState as zd}from"react";import*as ue from"react";import{createPortal as Kd}from"react-dom";function Qt(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 rt(e){let{alwaysDisplayOnTop:t=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=5,horizontalPosition:l="left",specialHandlingForCaret:a=!1,targetRect:s,verticalGap:c=10}=e,d=o.parentElement;if(s===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=s.top-u.height-c,g=s.left-i;l==="center"&&(g=s.left+s.width/2-u.width/2);let L=0;return!t&&f<m.top&&!a&&(L=u.height+s.height+c*2,f+=L),l==="center"?g+u.width>m.right?g=m.right-u.width-i:g<m.left&&(g=m.left+i):g+u.width>m.right&&(g=m.right-u.width-i),g-=p.left,n.style.opacity="1",a&&r!==0?(f-=p.bottom-r+u.height-3,n.style.transform=`translate(${g}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${g}px, ${f}px)`),L}import{jsx as B,jsxs as li}from"react/jsx-runtime";function jd({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&B(o.Component,{anchorElem:e,editor:t,item:o},o.key):B(ve,{editor:t,item:o,children:o?.ChildComponent&&B(o.ChildComponent,{})},o.key)}function Zd({anchorElem:e,editor:t,group:o,index:r}){let{editorConfig:n}=v(),[i,l]=ue.useState(null);ue.useEffect(()=>{o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null)},[o]);let a=({activeItems:s})=>{if(!s.length){o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null);return}let c=s[0];l(()=>c.ChildComponent)};return li("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,children:[o.type==="dropdown"&&o.items.length&&(i?B(oe,{Icon:i,anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:a}):B(oe,{anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:a})),o.type==="buttons"&&o.items.length&&o.items.map(s=>B(jd,{anchorElem:e,editor:t,item:s},s.key)),r<n.features.toolbarInline?.groups.length-1&&B("div",{className:"divider"})]},o.key)}function Xd({anchorElem:e,editor:t}){let o=oi(null),r=oi(null),{editorConfig:n}=v(),i=Pe(()=>{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=Pe(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 p=c.clientX,m=c.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||i()}}},[i]),a=Pe(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Me(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}),[o,l,a]);let s=Pe(()=>{let c=ni(),d=window.getSelection();if(o.current===null)return;let u=e.querySelector(":scope > .link-editor"),p=u!==null&&"style"in u&&u?.style?.opacity==="1",m=t.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=Qt(d,m),g=rt({alwaysDisplayOnTop:p,anchorElem:e,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&rt({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:10})}else i()},[t,i,e]);return Me(()=>{let c=e.parentElement,d=()=>{t.getEditorState().read(()=>{s()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[t,s,e]),Me(()=>(t.getEditorState().read(()=>{s()}),ri(t.registerUpdateListener(({editorState:c})=>{c.read(()=>{s()})}),t.registerCommand(Vd,()=>(s(),!1),Wd))),[t,s]),li("div",{className:"inline-toolbar-popup",ref:o,children:[B("div",{className:"caret",ref:r}),t.isEditable()&&B(ue.Fragment,{children:n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>B(Zd,{anchorElem:e,editor:t,group:c,index:d},c.key))})]})}function Jd(e,t){let[o,r]=zd(!1),n=Pe(()=>{e.getEditorState().read(()=>{if(e.isComposing())return;let i=ni(),l=window.getSelection(),a=e.getRootElement();if(l!==null&&(!ti(i)||a===null||!a.contains(l.anchorNode))){r(!1);return}if(!ti(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),d=!1;for(let u of c)if(Ud(u)){r(!0),d=!0;break}d||r(!1)}else r(!1);let s=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&s===""){r(!1);return}})},[e]);return Me(()=>(document.addEventListener("selectionchange",n),document.addEventListener("mouseup",n),()=>{document.removeEventListener("selectionchange",n),document.removeEventListener("mouseup",n)}),[n]),Me(()=>ri(e.registerUpdateListener(()=>{n()}),e.registerRootListener(()=>{e.getRootElement()===null&&r(!1)})),[e,n]),o?Kd(B(Xd,{anchorElem:t,editor:e}),t):null}var ii=({anchorElem:e})=>{let[t]=$d();return Jd(t,e)};var Yd=h({plugins:[{Component:ii,position:"floatingAnchorElem"}]});import{$isNodeSelection as Tp}from"lexical";import{jsx as eo,jsxs as qd}from"react/jsx-runtime";var to=()=>qd("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:[eo("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"}),eo("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"}),eo("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 cp,mergeRegister as dp}from"@lexical/utils";import{useConfig as pp}from"@payloadcms/ui";import{$getPreviousSelection as up,$getSelection as mp,$isParagraphNode as ai,$isRangeSelection as fp,COMMAND_PRIORITY_EDITOR as gp,createCommand as Cp}from"lexical";import{useEffect as hp}from"react";import{useLexicalComposerContext as Qd}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as ep}from"@payloadcms/ui";import{$getNodeByKey as tp,COMMAND_PRIORITY_EDITOR as op}from"lexical";import{useCallback as rp,useEffect as np,useState as ip}from"react";import{jsx as oo}from"react/jsx-runtime";var lp=({editor:e,relationTo:t,replaceNodeKey:o,value:r})=>{o?e.update(()=>{let n=tp(o);n&&n.replace(Le({data:{fields:null,relationTo:t,value:r}}))}):e.dispatchCommand(ro,{fields:null,relationTo:t,value:r})},sp=({enabledCollectionSlugs:e})=>{let[t]=Qd(),[o,r]=ip(null),[n,i,{closeDrawer:l,openDrawer:a}]=ep({collectionSlugs:e,uploads:!0});np(()=>t.registerCommand(xe,c=>(r(c?.replace?c?.replace.nodeKey:null),a(),!0),op),[t,a]);let s=rp(({collectionSlug:c,docID:d})=>{lp({editor:t,relationTo:c,replaceNodeKey:o,value:d}),l()},[t,l,o]);return oo(n,{onSelect:s})},si=e=>oo(Be,{...e,uploads:!0,children:oo(sp,{...e})});import{jsx as xp}from"react/jsx-runtime";var ro=Cp("INSERT_UPLOAD_COMMAND"),ci=({clientProps:e})=>{let[t]=ap(),{collections:o}=pp();return hp(()=>{if(!t.hasNodes([Te]))throw new Error("UploadPlugin: UploadNode not registered on editor");return dp(t.registerCommand(ro,r=>(t.update(()=>{let n=mp()||up();if(fp(n)){let i=Le({data:{id:r.id,fields:r.fields,relationTo:r.relationTo,value:r.value}});cp(i);let{focus:l}=n,a=l.getNode();ai(a)&&a.getTextContentSize()===0&&a.getParent().getChildren().filter(s=>ai(s)).length>1&&a.remove()}}),!0),gp))},[t]),xp(si,{enabledCollectionSlugs:o.map(({slug:r})=>r)})};var Lp=h({nodes:[Te],plugins:[{Component:ci,position:"normal"}],slashMenu:{groups:[D([{Icon:to,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(xe,{replace:!1})}}])]},toolbarFixed:{groups:[ee([{ChildComponent:to,isActive:({selection:e})=>{if(!Tp(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return ut(t)},key:"upload",label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(xe,{replace:!1})}}])]}});import{ShimmerEffect as yp,useClientFunctions as Ep,useFieldProps as bp}from"@payloadcms/ui";import di,{Suspense as kp,lazy as Np,useEffect as _p,useState as no}from"react";import{jsx as nt,jsxs as Sp}from"react/jsx-runtime";var wp=Np(()=>import("./Field-XBUN6QOM.js").then(e=>({default:e.RichText}))),Rp=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,{schemaPath:n}=bp(),i=Ep(),[l,a]=no(!1),[s,c]=no([]),[d,u]=no(null),p=r.get("features");p=p.sort((f,g)=>f.order-g.order);let m=0;for(let f of p){let g=Array.from(r.keys()).filter(L=>L.startsWith(`feature.${f.key}.components.`));m+=1,m+=g.length}return _p(()=>{if(!l){let f=[],g=0;if(Object.entries(i).forEach(([L,x])=>{L.startsWith(`lexicalFeature.${n}.`)&&(L.includes(".components.")||f.push(x),g++)}),g===m){c(f),a(!0);let L=Ge({clientFunctions:i,schemaPath:n,unSanitizedEditorConfig:{features:f,lexical:o}});u(Ee(o||ye,L,t))}}},[t,l,i,n,p.length,s,d,o,m]),l?nt(kp,{fallback:nt(yp,{height:"35vh"}),children:d&&nt(wp,{...e,editorConfig:d})}):nt(di.Fragment,{children:Array.isArray(p)&&p.map(f=>{let L=Array.from(r.keys()).filter(x=>x.startsWith(`feature.${f.key}.components.`)).map(x=>r.get(x));return Sp(di.Fragment,{children:[L?.length?L.map(x=>x):null,f.ClientFeature]},f.key)})})};function it(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,it(n,t));return o}if(e instanceof Set){let o=new Set;t.set(e,o);for(let r of e.values())o.add(it(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]=it(e[r],t));return o}return e}function vp(...e){return e.filter(Boolean).join(" ")}var lt=new WeakMap;function pi(e){let t=e.changedTouches[0];return t===void 0?null:[t.clientX,t.clientY]}function st(e,t){let o=lt.get(e);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=pi(l))},i=l=>{if(o===void 0)return;let{start:a}=o;if(a===null)return;let s=pi(l);for(let c of r)s!==null&&c([s[0]-a[0],s[1]-a[1]],l)};e.addEventListener("touchstart",n),e.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},lt.set(e,o)}return o.listeners.add(t),()=>{Ip(e,t)}}function Ip(e,t){let o=lt.get(e);if(o===void 0)return;let{listeners:r}=o;r.delete(t),r.size===0&&(lt.delete(e),e.removeEventListener("touchstart",o.handleTouchstart),e.removeEventListener("touchend",o.handleTouchend))}function Fp(e,t){return st(e,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&t(n,r)})}function Pp(e,t){return st(e,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&t(n,r)})}function Mp(e,t){return st(e,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&t(n,r)})}function Ap(e,t){return st(e,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&t(n,r)})}export{ke as $createAutoLinkNode,ne as $createBlockNode,W as $createLinkNode,he as $createRelationshipNode,Le as $createUploadNode,z as $isAutoLinkNode,Wi as $isBlockNode,I as $isLinkNode,pt as $isRelationshipNode,ut as $isUploadNode,Ii as AlignFeatureClient,V as AutoLinkNode,U as BlockNode,Oi as BlockquoteFeatureClient,Cl as BlocksFeatureClient,Dl as BoldFeatureClient,O as CAN_USE_DOM,sc as ChecklistFeatureClient,Oc as DETAIL_TYPE_TO_DETAIL,Pc as DOUBLE_LINE_BREAK,Bc as ELEMENT_FORMAT_TO_TYPE,Hc as ELEMENT_TYPE_TO_FORMAT,mi as ENABLE_SLASH_MENU_COMMAND,ui as EditorConfigProvider,Gd as FixedToolbarFeatureClient,us as HeadingFeatureClient,ys as HorizontalRuleFeatureClient,Ic as IS_ALL_FORMATTING,_s as IndentFeatureClient,Gl as InlineCodeFeatureClient,Yd as InlineToolbarFeatureClient,Wl as ItalicFeatureClient,Ac as LTR_REGEX,vc as LexicalPluginToLexicalFeatureClient,Ka as LinkFeatureClient,A as LinkNode,Fc as NON_BREAKING_SPACE,T as NodeFormat,gc as OrderedListFeatureClient,Yc as ParagraphFeatureClient,gi as Point,Mc as RTL_REGEX,hi as Rect,Cd as RelationshipFeatureClient,Ce as RelationshipNode,Ei as RichTextCell,Rp as RichTextField,Xc as SlateToLexicalFeatureClient,jl as StrikethroughFeatureClient,Jl as SubscriptFeatureClient,Ql as SuperscriptFeatureClient,Gc as TEXT_MODE_TO_TYPE,Dc as TEXT_TYPE_TO_FORMAT,$c as TEXT_TYPE_TO_MODE,G as TOGGLE_LINK_COMMAND,Sl as TestRecorderFeatureClient,ve as ToolbarButton,oe as ToolbarDropdown,Pl as TreeViewFeatureClient,rs as UnderlineFeatureClient,bc as UnorderedListFeatureClient,Lp as UploadFeatureClient,Te as UploadNode,Ap as addSwipeDownListener,Fp as addSwipeLeftListener,Pp as addSwipeRightListener,Mp as addSwipeUpListener,it as cloneDeep,Nt as createBlockNode,Tt as createClientComponent,h as createClientFeature,ye as defaultEditorLexicalConfig,Qt as getDOMRangeRect,dt as getEnabledNodes,ie as getSelectedNode,It as invariant,fi as isHTMLElement,Ci as isPoint,vp as joinClasses,Ee as sanitizeClientEditorConfig,so as sanitizeClientFeatures,rt as setFloatingElemPosition,Ye as setFloatingElemPositionForLinkEditor,ee as toolbarAddDropdownGroupWithItems,wt as toolbarFeatureButtonsGroupWithItems,F as toolbarFormatGroupWithItems,M as toolbarTextDropdownGroupWithItems,v as useEditorConfigContext};
|
|
37
|
+
`,Sn="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Rn="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",hc=new RegExp("^[^"+Rn+"]*["+Sn+"]"),xc=new RegExp("^[^"+Sn+"]*["+Rn+"]"),Tc={bold:T.IS_BOLD,code:T.IS_CODE,highlight:T.IS_HIGHLIGHT,italic:T.IS_ITALIC,strikethrough:T.IS_STRIKETHROUGH,subscript:T.IS_SUBSCRIPT,superscript:T.IS_SUPERSCRIPT,underline:T.IS_UNDERLINE},Lc={directionless:T.IS_DIRECTIONLESS,unmergeable:T.IS_UNMERGEABLE},yc={center:T.IS_ALIGN_CENTER,end:T.IS_ALIGN_END,justify:T.IS_ALIGN_JUSTIFY,left:T.IS_ALIGN_LEFT,right:T.IS_ALIGN_RIGHT,start:T.IS_ALIGN_START},Ec={[T.IS_ALIGN_CENTER]:"center",[T.IS_ALIGN_END]:"end",[T.IS_ALIGN_JUSTIFY]:"justify",[T.IS_ALIGN_LEFT]:"left",[T.IS_ALIGN_RIGHT]:"right",[T.IS_ALIGN_START]:"start"},bc={normal:T.IS_NORMAL,segmented:T.IS_SEGMENTED,token:T.IS_TOKEN},kc={[T.IS_NORMAL]:"normal",[T.IS_SEGMENTED]:"segmented",[T.IS_TOKEN]:"token"};function In({converters:e,slateData:t}){return{root:{type:"root",children:Fn({canContainParagraphs:!0,converters:e,parentNodeType:"root",slateNodes:t}),direction:"ltr",format:"",indent:0,version:1}}}function Fn({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?vn(t,i):Nc(i);if(i.type==="p")return vn(t,i);let a=t.find(s=>s.nodeTypes.includes(i.type));return a?a.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 vn(e,t){return{type:"paragraph",children:Fn({canContainParagraphs:!1,converters:e,parentNodeType:"paragraph",slateNodes:t.children||[]}),direction:"ltr",format:"",indent:0,textFormat:0,version:1}}function Nc(e){return{type:"text",detail:0,format:_c(e),mode:"normal",style:"",text:e.text,version:1}}function _c(e){let t=0;return e.bold&&(t=t|T.IS_BOLD),e.italic&&(t=t|T.IS_ITALIC),e.strikethrough&&(t=t|T.IS_STRIKETHROUGH),e.underline&&(t=t|T.IS_UNDERLINE),e.subscript&&(t=t|T.IS_SUBSCRIPT),e.superscript&&(t=t|T.IS_SUPERSCRIPT),e.code&&(t=t|T.IS_CODE),t}import{addClassNamesToElement as wc}from"@lexical/utils";import{DecoratorNode as Sc}from"lexical";import*as Mn from"react";import{jsx as Ic}from"react/jsx-runtime";var Rc=Mn.lazy(()=>import("./Component-LAKSCIDX.js").then(e=>({default:e.UnknownConvertedNodeComponent}))),we=class e extends Sc{__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 vc({data:t.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(t){let o=document.createElement("span");return wc(o,"unknownConverted"),o}decorate(){return Ic(Rc,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(t,o){return!1}};function vc({data:e}){return new we({data:e})}var Fc=C(({clientFunctions:e})=>{let t=Object.values(e);return{hooks:{load({incomingEditorState:o}){return!o||!Array.isArray(o)||"root"in o?o:In({converters:t,slateData:o})}},nodes:[we]}});import{$setBlocksType as Dn}from"@lexical/selection";import{$createParagraphNode as On,$getSelection as Hn,$isParagraphNode as Pn,$isRangeSelection as Mc}from"lexical";var An=[P([{ChildComponent:Ee,isActive:({selection:e})=>{if(!Mc(e))return!1;for(let t of e.getNodes())if(!Pn(t)&&!Pn(t.getParent()))return!1;return!0},key:"paragraph",label:({i18n:e})=>e.t("lexical:paragraph:label2"),onSelect:({editor:e})=>{e.update(()=>{let t=Hn();Dn(t,()=>On())})},order:1}])],Pc=C({slashMenu:{groups:[M([{Icon:Ee,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:e})=>e.t("lexical:paragraph:label"),onSelect:({editor:e})=>{e.update(()=>{let t=Hn();Dn(t,()=>On())})}}])]},toolbarFixed:{groups:An},toolbarInline:{groups:An}});import{$isNodeSelection as qc}from"lexical";import{jsx as Se,jsxs as Ac}from"react/jsx-runtime";var zt=()=>Ac("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:[Se("g",{clipPath:"url(#clip0_4397_10817)",children:Se("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"})}),Se("defs",{children:Se("clipPath",{id:"clip0_4397_10817",children:Se("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{useLexicalComposerContext as Uc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Wc}from"@lexical/utils";import{useConfig as zc}from"@payloadcms/ui";import{$getPreviousSelection as Vc,$getSelection as Kc,$isParagraphNode as Wn,$isRangeSelection as jc,COMMAND_PRIORITY_EDITOR as Zc,createCommand as Xc}from"lexical";import{useEffect as Jc}from"react";import{useLexicalComposerContext as Dc}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as Oc}from"@payloadcms/ui";import{$getNodeByKey as Hc,COMMAND_PRIORITY_EDITOR as Bc}from"lexical";import{useCallback as Gc,useEffect as Bn,useState as Gn}from"react";import{jsx as qe}from"react/jsx-runtime";var $c=({editor:e,relationTo:t,replaceNodeKey:o,value:r})=>{o?e.update(()=>{let n=Hc(o);n&&n.replace(Ce({relationTo:t,value:r}))}):e.dispatchCommand(Vt,{relationTo:t,value:r})},$n=({enabledCollectionSlugs:e})=>{let[t]=Dc(),[o,r]=Gn(()=>e[0]),[n,i]=Gn(null),[l,a,{closeDrawer:s,isDrawerOpen:c,openDrawer:d}]=Oc({collectionSlugs:e,selectedCollection:o});Bn(()=>t.registerCommand(fe,p=>(i(p?.replace?p?.replace.nodeKey:null),d(),!0),Bc),[t,d]);let u=Gc(({collectionSlug:p,docID:m})=>{$c({editor:t,relationTo:p,replaceNodeKey:n,value:m}),s()},[t,s,n]);return Bn(()=>{r(e[0])},[c,e]),qe(l,{onSelect:u})},Un=e=>e?.enabledCollectionSlugs?.length>0?qe($n,{...e}):qe(He,{...e,children:qe($n,{...e})});import{jsx as Yc}from"react/jsx-runtime";var Vt=Xc("INSERT_RELATIONSHIP_COMMAND"),zn=({clientProps:e})=>{let[t]=Uc(),{collections:o}=zc(),r=null;return e?.enabledCollections?r=e?.enabledCollections:e?.disabledCollections&&(r=o.filter(({slug:n})=>!e?.disabledCollections?.includes(n)).map(({slug:n})=>n)),Jc(()=>{if(!t.hasNodes([ge]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return t.registerCommand(Vt,n=>{let i=Kc()||Vc();if(jc(i)){let l=Ce(n);Wc(l);let{focus:a}=i,s=a.getNode();Wn(s)&&s.getTextContentSize()===0&&s.getParent().getChildren().filter(c=>Wn(c)).length>1&&s.remove()}return!0},Zc)},[t]),Yc(Un,{enabledCollectionSlugs:r})};var Qc=C({nodes:[ge],plugins:[{Component:zn,position:"normal"}],slashMenu:{groups:[M([{Icon:zt,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(fe,{replace:!1})}}])]},toolbarFixed:{groups:[Q([{ChildComponent:zt,isActive:({selection:e})=>{if(!qc(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return pt(t)},key:"relationship",label:({i18n:e})=>e.t("lexical:relationship:label"),onSelect:({editor:e})=>{e.dispatchCommand(fe,{replace:!1})}}])]}});import{useLexicalComposerContext as fd}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as gd,useThrottledEffect as Cd,useTranslation as hd}from"@payloadcms/ui";import*as V from"react";import{useMemo as xd}from"react";import{mergeRegister as ed}from"@lexical/utils";import{$getSelection as td}from"lexical";import{useCallback as od,useEffect as Qe,useState as Kt}from"react";import{jsx as rd}from"react/jsx-runtime";var jt="toolbar-popup__button",Re=({children:e,editor:t,item:o})=>{let[r,n]=Kt(!0),[i,l]=Kt(!1),[a,s]=Kt(jt),c=F(),d=od(()=>{t.getEditorState().read(()=>{let u=td();if(o.isActive){let p=o.isActive({editor:t,editorConfigContext:c,selection:u});i!==p&&l(p)}if(o.isEnabled){let p=o.isEnabled({editor:t,editorConfigContext:c,selection:u});r!==p&&n(p)}})},[i,t,c,r,o]);return Qe(()=>{d()},[d]),Qe(()=>(document.addEventListener("mouseup",d),()=>{document.removeEventListener("mouseup",d)}),[d]),Qe(()=>ed(t.registerUpdateListener(()=>{d()})),[t,d]),Qe(()=>{s([jt,r===!1?"disabled":"",i?"active":"",o?.key?`${jt}-`+o.key:""].filter(Boolean).join(" "))},[r,i,a,o.key]),rd("button",{className:a,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 Xn,{useCallback as ad,useEffect as Jt}from"react";import{mergeRegister as cd}from"@lexical/utils";import{useTranslation as dd}from"@payloadcms/ui";import{$getSelection as pd}from"lexical";import et,{useCallback as nd,useEffect as ve,useMemo as id,useRef as Xt,useState as tt}from"react";import{createPortal as ld}from"react-dom";import{jsx as j,jsxs as Vn}from"react/jsx-runtime";var Zt="toolbar-popup__dropdown-item",Kn=et.createContext(null);function jn({active:e,children:t,editor:o,enabled:r,item:n,title:i}){let[l,a]=tt(Zt);ve(()=>{a([Zt,r===!1?"disabled":"",e?"active":"",n?.key?`${Zt}-${n.key}`:""].filter(Boolean).join(" "))},[r,e,l,n.key]);let s=Xt(null),c=et.useContext(Kn);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:d}=c;return ve(()=>{s?.current!=null&&d(s)},[s,d]),j("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:s,title:i,type:"button",children:t})}function sd({children:e,dropDownRef:t,itemsContainerClassNames:o,onClose:r}){let[n,i]=tt(),[l,a]=tt(),s=nd(u=>{i(p=>p!=null?[...p,u]:[u])},[i]),c=u=>{if(n==null)return;let{key:p}=u;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&u.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?a(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&a(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=id(()=>({registerItem:s}),[s]);return ve(()=>{n!=null&&l==null&&a(n[0]),l!=null&&l?.current!=null&&l.current.focus()},[n,l]),j(Kn.Provider,{value:d,children:j("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:t,children:e})})}function Zn({Icon:e,buttonAriaLabel:t,buttonClassName:o,children:r,disabled:n=!1,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:a}){let s=Xt(null),c=Xt(null),[d,u]=tt(!1),p=()=>{u(!1),c?.current!=null&&c.current.focus()};ve(()=>{let f=c.current,h=s.current;if(d&&f!==null&&h!==null){let{left:L,top:x}=f.getBoundingClientRect(),_=window.scrollY||document.documentElement.scrollTop;h.style.top=`${x+_+f.offsetHeight+5}px`,h.style.left=`${Math.min(L-5,window.innerWidth-h.offsetWidth-20)}px`}},[s,c,d]),ve(()=>{let f=c.current;if(f!==null&&d){let h=L=>{let{target:x}=L;a!=null&&s.current!=null&&s.current.contains(x)||f.contains(x)||u(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[s,c,d,a]);let m=ld(j(sd,{dropDownRef:s,itemsContainerClassNames:i,onClose:p,children:r}),document.body);return Vn(et.Fragment,{children:[Vn("button",{"aria-label":t,className:o+(d?" active":""),disabled:n,onClick:f=>{f.preventDefault(),u(!d)},onMouseDown:f=>{f.preventDefault()},ref:c,type:"button",children:[e&&j(e,{}),l&&j("span",{className:"toolbar-popup__dropdown-label",children:l}),j("i",{className:"toolbar-popup__dropdown-caret"})]}),d&&j(et.Fragment,{children:m})]})}import{jsx as Ie,jsxs as md}from"react/jsx-runtime";var Yt="toolbar-popup__dropdown",ud=({active:e,anchorElem:t,editor:o,enabled:r,item:n})=>{let{i18n:i}=dd();if(n.Component)return n?.Component&&Ie(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)+"..."),md(jn,{active:e,editor:o,enabled:r,item:n,children:[n?.ChildComponent&&Ie(n.ChildComponent,{}),Ie("span",{className:"text",children:l})]},n.key)},te=({Icon:e,anchorElem:t,classNames:o,editor:r,groupKey:n,items:i,itemsContainerClassNames:l,label:a,maxActiveItems:s,onActiveChange:c})=>{let[d,u]=Xn.useState([]),[p,m]=Xn.useState([]),f=F(),h=ad(()=>{r.getEditorState().read(()=>{let L=pd(),x=[],_=[],w=[];for(let g of i)g.isActive&&(!s||x.length<s)&&g.isActive({editor:r,editorConfigContext:f,selection:L})&&(x.push(g.key),_.push(g)),g.isEnabled?g.isEnabled({editor:r,editorConfigContext:f,selection:L})&&w.push(g.key):w.push(g.key);u(x),m(w),c&&c({activeItems:_})})},[r,f,i,s,c]);return Jt(()=>{h()},[h]),Jt(()=>(document.addEventListener("mouseup",h),()=>{document.removeEventListener("mouseup",h)}),[h]),Jt(()=>cd(r.registerUpdateListener(()=>{h()})),[r,h]),Ie(Zn,{Icon:e,buttonAriaLabel:`${n} dropdown`,buttonClassName:[Yt,`${Yt}-${n}`,...o||[]].filter(Boolean).join(" "),itemsContainerClassNames:[`${Yt}-items`,...l||[]],label:a,children:i.length&&i.map(L=>Ie(ud,{active:d.includes(L.key),anchorElem:t,editor:r,enabled:p.includes(L.key),item:L},L.key))},n)};import{jsx as H,jsxs as Ed}from"react/jsx-runtime";function Td({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&H(o.Component,{anchorElem:e,editor:t,item:o},o.key):H(Re,{editor:t,item:o,children:o?.ChildComponent&&H(o.ChildComponent,{})},o.key)}function Ld({anchorElem:e,editor:t,editorConfig:o,group:r,index:n}){let{i18n:i}=hd(),[l,a]=V.useState(null),[s,c]=V.useState(null);V.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),a(null)):(c(null),a(null));return}let p=u[0],m=p.key;p.label&&(m=typeof p.label=="function"?p.label({i18n:i}):p.label),m.length>25&&(m=m.substring(0,25)+"..."),a(m),c(()=>p.ChildComponent)};return Ed("div",{className:`fixed-toolbar__group fixed-toolbar__group-${r.key}`,children:[r.type==="dropdown"&&r.items.length&&(s?H(te,{Icon:s,anchorElem:e,editor:t,groupKey:r.key,items:r.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:l,maxActiveItems:1,onActiveChange:d}):H(te,{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=>H(Td,{anchorElem:e,editor:t,item:u},u.key)),n<o.features.toolbarFixed?.groups.length-1&&H("div",{className:"divider"})]},r.key)}function yd({anchorElem:e,clientProps:t,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let i=V.useRef(null),{y:l}=gd(),a=xd(()=>{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 Cd(()=>{if(!a)return;let s=i.current;if(!s)return;let c=s.getBoundingClientRect(),d=a.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))i.current.className="fixed-toolbar fixed-toolbar--overlapping",a.className="fixed-toolbar fixed-toolbar--hide";else{if(!i.current.classList.contains("fixed-toolbar--overlapping"))return;i.current.className="fixed-toolbar",a.className="fixed-toolbar"}},50,[i,a,l]),H("div",{className:"fixed-toolbar",onFocus:s=>{s.stopPropagation()},ref:i,children:o.isEditable()&&H(V.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((s,c)=>H(Ld,{anchorElem:e,editor:o,editorConfig:r,group:s,index:c},s.key))})})}var Jn=e=>{if(e.parentEditor?.editorConfig){if(e.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return e.parentEditor;if(e.parentEditor)return Jn(e.parentEditor)}return!1},Yn=({anchorElem:e,clientProps:t})=>{let[o]=fd(),r=F(),{editorConfig:n}=r,i=t.applyToFocusedEditor&&r.focusedEditor?.editor||o,l=t.applyToFocusedEditor&&r.focusedEditor?.editorConfig||n,a=Jn(r);return t?.disableIfParentHasFixedToolbar&&a||!l?.features?.toolbarFixed?.groups?.length?null:H(yd,{anchorElem:e,editor:i,editorConfig:l,parentWithFixedToolbar:a})};var bd=C({plugins:[{Component:Yn,position:"aboveContainer"}]});import{useLexicalComposerContext as kd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ei}from"@lexical/utils";import{$getSelection as ti,$isRangeSelection as qn,$isTextNode as Nd,COMMAND_PRIORITY_LOW as _d,SELECTION_CHANGE_COMMAND as wd}from"lexical";import{useCallback as Fe,useEffect as Me,useRef as Qn,useState as Sd}from"react";import*as pe from"react";import{createPortal as Rd}from"react-dom";function qt(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 ot(e){let{alwaysDisplayOnTop:t=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:i=5,horizontalPosition:l="left",specialHandlingForCaret:a=!1,targetRect:s,verticalGap:c=10}=e,d=o.parentElement;if(s===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let u=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=s.top-u.height-c,h=s.left-i;l==="center"&&(h=s.left+s.width/2-u.width/2);let L=0;return!t&&f<m.top&&!a&&(L=u.height+s.height+c*2,f+=L),l==="center"?h+u.width>m.right?h=m.right-u.width-i:h<m.left&&(h=m.left+i):h+u.width>m.right&&(h=m.right-u.width-i),h-=p.left,n.style.opacity="1",a&&r!==0?(f-=p.bottom-r+u.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),L}import{jsx as B,jsxs as ri}from"react/jsx-runtime";function vd({anchorElem:e,editor:t,item:o}){return o.Component?o?.Component&&B(o.Component,{anchorElem:e,editor:t,item:o},o.key):B(Re,{editor:t,item:o,children:o?.ChildComponent&&B(o.ChildComponent,{})},o.key)}function Id({anchorElem:e,editor:t,group:o,index:r}){let{editorConfig:n}=F(),[i,l]=pe.useState(null);pe.useEffect(()=>{o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null)},[o]);let a=({activeItems:s})=>{if(!s.length){o?.type==="dropdown"&&o.items.length&&o.ChildComponent?l(()=>o.ChildComponent):l(null);return}let c=s[0];l(()=>c.ChildComponent)};return ri("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,children:[o.type==="dropdown"&&o.items.length&&(i?B(te,{Icon:i,anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:a}):B(te,{anchorElem:e,editor:t,groupKey:o.key,items:o.items,maxActiveItems:1,onActiveChange:a})),o.type==="buttons"&&o.items.length&&o.items.map(s=>B(vd,{anchorElem:e,editor:t,item:s},s.key)),r<n.features.toolbarInline?.groups.length-1&&B("div",{className:"divider"})]},o.key)}function Fd({anchorElem:e,editor:t}){let o=Qn(null),r=Qn(null),{editorConfig:n}=F(),i=Fe(()=>{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=Fe(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 p=c.clientX,m=c.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||i()}}},[i]),a=Fe(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Me(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",a),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",a)}),[o,l,a]);let s=Fe(()=>{let c=ti(),d=window.getSelection();if(o.current===null)return;let u=e.querySelector(":scope > .link-editor"),p=u!==null&&"style"in u&&u?.style?.opacity==="1",m=t.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=qt(d,m),h=ot({alwaysDisplayOnTop:p,anchorElem:e,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&ot({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:10})}else i()},[t,i,e]);return Me(()=>{let c=e.parentElement,d=()=>{t.getEditorState().read(()=>{s()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[t,s,e]),Me(()=>(t.getEditorState().read(()=>{s()}),ei(t.registerUpdateListener(({editorState:c})=>{c.read(()=>{s()})}),t.registerCommand(wd,()=>(s(),!1),_d))),[t,s]),ri("div",{className:"inline-toolbar-popup",ref:o,children:[B("div",{className:"caret",ref:r}),t.isEditable()&&B(pe.Fragment,{children:n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>B(Id,{anchorElem:e,editor:t,group:c,index:d},c.key))})]})}function Md(e,t){let[o,r]=Sd(!1),n=Fe(()=>{e.getEditorState().read(()=>{if(e.isComposing())return;let i=ti(),l=window.getSelection(),a=e.getRootElement();if(l!==null&&(!qn(i)||a===null||!a.contains(l.anchorNode))){r(!1);return}if(!qn(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),d=!1;for(let u of c)if(Nd(u)){r(!0),d=!0;break}d||r(!1)}else r(!1);let s=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&s===""){r(!1);return}})},[e]);return Me(()=>(document.addEventListener("selectionchange",n),document.addEventListener("mouseup",n),()=>{document.removeEventListener("selectionchange",n),document.removeEventListener("mouseup",n)}),[n]),Me(()=>ei(e.registerUpdateListener(()=>{n()}),e.registerRootListener(()=>{e.getRootElement()===null&&r(!1)})),[e,n]),o?Rd(B(Fd,{anchorElem:t,editor:e}),t):null}var oi=({anchorElem:e})=>{let[t]=kd();return Md(t,e)};var Pd=C({plugins:[{Component:oi,position:"floatingAnchorElem"}]});import{$isNodeSelection as op}from"lexical";import{jsx as Qt,jsxs as Ad}from"react/jsx-runtime";var eo=()=>Ad("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:[Qt("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"}),Qt("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"}),Qt("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 Vd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Kd,mergeRegister as jd}from"@lexical/utils";import{useConfig as Zd}from"@payloadcms/ui";import{$getPreviousSelection as Xd,$getSelection as Jd,$isParagraphNode as ii,$isRangeSelection as Yd,COMMAND_PRIORITY_EDITOR as qd,createCommand as Qd}from"lexical";import{useEffect as ep}from"react";import{useLexicalComposerContext as Dd}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as Od}from"@payloadcms/ui";import{$getNodeByKey as Hd,COMMAND_PRIORITY_EDITOR as Bd}from"lexical";import{useCallback as Gd,useEffect as $d,useState as Ud}from"react";import{jsx as to}from"react/jsx-runtime";var Wd=({editor:e,relationTo:t,replaceNodeKey:o,value:r})=>{o?e.update(()=>{let n=Hd(o);n&&n.replace(Te({data:{fields:null,relationTo:t,value:r}}))}):e.dispatchCommand(oo,{fields:null,relationTo:t,value:r})},zd=({enabledCollectionSlugs:e})=>{let[t]=Dd(),[o,r]=Ud(null),[n,i,{closeDrawer:l,openDrawer:a}]=Od({collectionSlugs:e,uploads:!0});$d(()=>t.registerCommand(he,c=>(r(c?.replace?c?.replace.nodeKey:null),a(),!0),Bd),[t,a]);let s=Gd(({collectionSlug:c,docID:d})=>{Wd({editor:t,relationTo:c,replaceNodeKey:o,value:d}),l()},[t,l,o]);return to(n,{onSelect:s})},ni=e=>to(He,{...e,uploads:!0,children:to(zd,{...e})});import{jsx as tp}from"react/jsx-runtime";var oo=Qd("INSERT_UPLOAD_COMMAND"),li=({clientProps:e})=>{let[t]=Vd(),{collections:o}=Zd();return ep(()=>{if(!t.hasNodes([xe]))throw new Error("UploadPlugin: UploadNode not registered on editor");return jd(t.registerCommand(oo,r=>(t.update(()=>{let n=Jd()||Xd();if(Yd(n)){let i=Te({data:{id:r.id,fields:r.fields,relationTo:r.relationTo,value:r.value}});Kd(i);let{focus:l}=n,a=l.getNode();ii(a)&&a.getTextContentSize()===0&&a.getParent().getChildren().filter(s=>ii(s)).length>1&&a.remove()}}),!0),qd))},[t]),tp(ni,{enabledCollectionSlugs:o.map(({slug:r})=>r)})};var rp=C({nodes:[xe],plugins:[{Component:li,position:"normal"}],slashMenu:{groups:[M([{Icon:eo,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(he,{replace:!1})}}])]},toolbarFixed:{groups:[Q([{ChildComponent:eo,isActive:({selection:e})=>{if(!op(e)||!e.getNodes().length)return!1;let t=e.getNodes()[0];return ut(t)},key:"upload",label:({i18n:e})=>e.t("lexical:upload:label"),onSelect:({editor:e})=>{e.dispatchCommand(he,{replace:!1})}}])]}});import{ShimmerEffect as np,useClientFunctions as ip,useFieldProps as lp}from"@payloadcms/ui";import si,{Suspense as sp,lazy as ap,useEffect as cp,useState as ro}from"react";import{jsx as rt,jsxs as up}from"react/jsx-runtime";var dp=ap(()=>import("./Field-XBUN6QOM.js").then(e=>({default:e.RichText}))),pp=e=>{let{admin:t,lexicalEditorConfig:o,richTextComponentMap:r}=e,{schemaPath:n}=lp(),i=ip(),[l,a]=ro(!1),[s,c]=ro([]),[d,u]=ro(null),p=r.get("features");p=p.sort((f,h)=>f.order-h.order);let m=0;for(let f of p){let h=Array.from(r.keys()).filter(L=>L.startsWith(`feature.${f.key}.components.`));m+=1,m+=h.length}return cp(()=>{if(!l){let f=[],h=0;if(Object.entries(i).forEach(([L,x])=>{L.startsWith(`lexicalFeature.${n}.`)&&(L.includes(".components.")||f.push(x),h++)}),h===m){c(f),a(!0);let L=Be({clientFunctions:i,schemaPath:n,unSanitizedEditorConfig:{features:f,lexical:o}});u(ye(o||Le,L,t))}}},[t,l,i,n,p.length,s,d,o,m]),l?rt(sp,{fallback:rt(np,{height:"35vh"}),children:d&&rt(dp,{...e,editorConfig:d})}):rt(si.Fragment,{children:Array.isArray(p)&&p.map(f=>{let L=Array.from(r.keys()).filter(x=>x.startsWith(`feature.${f.key}.components.`)).map(x=>r.get(x));return up(si.Fragment,{children:[L?.length?L.map(x=>x):null,f.ClientFeature]},f.key)})})};function nt(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,nt(n,t));return o}if(e instanceof Set){let o=new Set;t.set(e,o);for(let r of e.values())o.add(nt(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]=nt(e[r],t));return o}return e}function mp(...e){return e.filter(Boolean).join(" ")}var it=new WeakMap;function ai(e){let t=e.changedTouches[0];return t===void 0?null:[t.clientX,t.clientY]}function lt(e,t){let o=it.get(e);if(o===void 0){let r=new Set,n=l=>{o!==void 0&&(o.start=ai(l))},i=l=>{if(o===void 0)return;let{start:a}=o;if(a===null)return;let s=ai(l);for(let c of r)s!==null&&c([s[0]-a[0],s[1]-a[1]],l)};e.addEventListener("touchstart",n),e.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:n,listeners:r,start:null},it.set(e,o)}return o.listeners.add(t),()=>{fp(e,t)}}function fp(e,t){let o=it.get(e);if(o===void 0)return;let{listeners:r}=o;r.delete(t),r.size===0&&(it.delete(e),e.removeEventListener("touchstart",o.handleTouchstart),e.removeEventListener("touchend",o.handleTouchend))}function gp(e,t){return lt(e,(o,r)=>{let[n,i]=o;n<0&&-n>Math.abs(i)&&t(n,r)})}function Cp(e,t){return lt(e,(o,r)=>{let[n,i]=o;n>0&&n>Math.abs(i)&&t(n,r)})}function hp(e,t){return lt(e,(o,r)=>{let[n,i]=o;i<0&&-i>Math.abs(n)&&t(n,r)})}function xp(e,t){return lt(e,(o,r)=>{let[n,i]=o;i>0&&i>Math.abs(n)&&t(n,r)})}export{be as $createAutoLinkNode,re as $createBlockNode,U as $createLinkNode,Ce as $createRelationshipNode,Te as $createUploadNode,z as $isAutoLinkNode,Gi as $isBlockNode,v as $isLinkNode,pt as $isRelationshipNode,ut as $isUploadNode,Si as AlignFeatureClient,W as AutoLinkNode,$ as BlockNode,Pi as BlockquoteFeatureClient,ml as BlocksFeatureClient,Ml as BoldFeatureClient,D as CAN_USE_DOM,za as ChecklistFeatureClient,Lc as DETAIL_TYPE_TO_DETAIL,Cc as DOUBLE_LINE_BREAK,Ec as ELEMENT_FORMAT_TO_TYPE,yc as ELEMENT_TYPE_TO_FORMAT,di as ENABLE_SLASH_MENU_COMMAND,ci as EditorConfigProvider,dt as FieldsDrawer,bd as FixedToolbarFeatureClient,cs as HeadingFeatureClient,xs as HorizontalRuleFeatureClient,fc as IS_ALL_FORMATTING,bs as IndentFeatureClient,Ol as InlineCodeFeatureClient,Pd as InlineToolbarFeatureClient,Gl as ItalicFeatureClient,xc as LTR_REGEX,mc as LexicalPluginToLexicalFeatureClient,Ra as LinkFeatureClient,A as LinkNode,gc as NON_BREAKING_SPACE,T as NodeFormat,qa as OrderedListFeatureClient,Pc as ParagraphFeatureClient,ui as Point,hc as RTL_REGEX,fi as Rect,Qc as RelationshipFeatureClient,ge as RelationshipNode,Ti as RichTextCell,pp as RichTextField,Fc as SlateToLexicalFeatureClient,zl as StrikethroughFeatureClient,jl as SubscriptFeatureClient,Jl as SuperscriptFeatureClient,bc as TEXT_MODE_TO_TYPE,Tc as TEXT_TYPE_TO_FORMAT,kc as TEXT_TYPE_TO_MODE,G as TOGGLE_LINK_COMMAND,_l as TestRecorderFeatureClient,Re as ToolbarButton,te as ToolbarDropdown,vl as TreeViewFeatureClient,es as UnderlineFeatureClient,lc as UnorderedListFeatureClient,rp as UploadFeatureClient,xe as UploadNode,xp as addSwipeDownListener,gp as addSwipeLeftListener,Cp as addSwipeRightListener,hp as addSwipeUpListener,nt as cloneDeep,Nt as createBlockNode,Tt as createClientComponent,C as createClientFeature,Le as defaultEditorLexicalConfig,qt as getDOMRangeRect,ct as getEnabledNodes,ne as getSelectedNode,It as invariant,pi as isHTMLElement,mi as isPoint,mp as joinClasses,ye as sanitizeClientEditorConfig,lo as sanitizeClientFeatures,ot as setFloatingElemPosition,Je as setFloatingElemPositionForLinkEditor,M as slashMenuBasicGroupWithItems,Q as toolbarAddDropdownGroupWithItems,wt as toolbarFeatureButtonsGroupWithItems,I as toolbarFormatGroupWithItems,P as toolbarTextDropdownGroupWithItems,F as useEditorConfigContext};
|
|
38
38
|
//# sourceMappingURL=index.js.map
|