@payloadcms/richtext-lexical 3.0.0-beta.106 → 3.0.0-beta.108
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/cell/index.js +1 -1
- package/dist/cell/index.js.map +1 -1
- package/dist/exports/client/Field-ETCEVZLL.js +2 -0
- package/dist/exports/client/Field-ETCEVZLL.js.map +7 -0
- package/dist/exports/client/RelationshipComponent-F6JI75HS.js +2 -0
- package/dist/exports/client/{RelationshipComponent-Z5SZ5FFT.js.map → RelationshipComponent-F6JI75HS.js.map} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/chunk-76MVRKRT.js +2 -0
- package/dist/exports/client/chunk-76MVRKRT.js.map +7 -0
- package/dist/exports/client/{chunk-TXEIKM77.js → chunk-GD6LBQBJ.js} +2 -2
- package/dist/exports/client/chunk-GD6LBQBJ.js.map +7 -0
- package/dist/exports/client/chunk-HIGLONP6.js +2 -0
- package/dist/exports/client/chunk-HIGLONP6.js.map +7 -0
- package/dist/exports/client/{chunk-GK7ZKYHL.js → chunk-IIWHHN4J.js} +2 -2
- package/dist/exports/client/chunk-IIWHHN4J.js.map +7 -0
- package/dist/exports/client/{chunk-PY6JO5OH.js → chunk-JYCJEIVA.js} +2 -2
- package/dist/exports/client/{chunk-PY6JO5OH.js.map → chunk-JYCJEIVA.js.map} +2 -2
- package/dist/exports/client/{chunk-GTKNWSQW.js → chunk-N2PXHNGO.js} +2 -2
- package/dist/exports/client/{chunk-GTKNWSQW.js.map → chunk-N2PXHNGO.js.map} +2 -2
- package/dist/exports/client/{chunk-PECDZEZY.js → chunk-YREZUOA6.js} +2 -2
- package/dist/exports/client/{chunk-PECDZEZY.js.map → chunk-YREZUOA6.js.map} +2 -2
- package/dist/exports/client/component-4IBTSHL5.js +2 -0
- package/dist/exports/client/component-4IBTSHL5.js.map +7 -0
- package/dist/exports/client/{component-GAX6BHKZ.js → component-GQ5M6NF6.js} +2 -2
- package/dist/exports/client/component-P34B4EPY.js +2 -0
- package/dist/exports/client/component-P34B4EPY.js.map +7 -0
- package/dist/exports/client/componentInline-XX7FVAIV.js +2 -0
- package/dist/exports/client/{componentInline-HAGGWKA7.js.map → componentInline-XX7FVAIV.js.map} +2 -2
- package/dist/exports/client/index.js +7 -7
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/blockquote/markdownTransformer.js.map +1 -1
- package/dist/features/blockquote/server/index.d.ts +1 -1
- package/dist/features/blockquote/server/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/BlockContent.js +5 -4
- package/dist/features/blocks/client/component/BlockContent.js.map +1 -1
- package/dist/features/blocks/client/component/index.d.ts +1 -1
- package/dist/features/blocks/client/component/index.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +15 -5
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts +1 -1
- package/dist/features/blocks/client/componentInline/index.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +4 -4
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/index.d.ts +1 -1
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +21 -11
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts +2 -2
- package/dist/features/blocks/client/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/client/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/client/plugin/index.d.ts +2 -2
- package/dist/features/blocks/client/plugin/index.d.ts.map +1 -1
- package/dist/features/blocks/client/plugin/index.js +4 -4
- package/dist/features/blocks/client/plugin/index.js.map +1 -1
- package/dist/features/blocks/server/index.d.ts.map +1 -1
- package/dist/features/blocks/server/index.js +4 -2
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts +10 -4
- package/dist/features/blocks/server/nodes/BlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/BlocksNode.js.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts +2 -2
- package/dist/features/blocks/server/nodes/InlineBlocksNode.d.ts.map +1 -1
- package/dist/features/blocks/server/nodes/InlineBlocksNode.js.map +1 -1
- package/dist/features/blocks/server/validate.js.map +1 -1
- package/dist/features/converters/html/converter/index.js +2 -2
- package/dist/features/converters/html/converter/index.js.map +1 -1
- package/dist/features/converters/html/field/index.js.map +1 -1
- package/dist/features/debug/testRecorder/client/plugin/index.js.map +1 -1
- package/dist/features/experimental_table/client/plugins/TableActionMenuPlugin/index.js.map +1 -1
- package/dist/features/experimental_table/server/index.js +2 -2
- package/dist/features/experimental_table/server/index.js.map +1 -1
- package/dist/features/horizontalRule/client/component/index.d.ts +1 -1
- package/dist/features/horizontalRule/client/component/index.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts +2 -2
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/nodes/HorizontalRuleNode.js.map +1 -1
- package/dist/features/indent/client/index.d.ts.map +1 -1
- package/dist/features/indent/client/index.js +2 -1
- package/dist/features/indent/client/index.js.map +1 -1
- package/dist/features/link/client/index.js +1 -1
- package/dist/features/link/client/index.js.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.d.ts +1 -1
- package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.js.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.d.ts.map +1 -1
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js +3 -7
- package/dist/features/link/client/plugins/floatingLinkEditor/LinkEditor/index.js.map +1 -1
- package/dist/features/link/nodes/AutoLinkNode.js +2 -2
- package/dist/features/link/nodes/AutoLinkNode.js.map +1 -1
- package/dist/features/link/nodes/LinkNode.js +11 -6
- package/dist/features/link/nodes/LinkNode.js.map +1 -1
- package/dist/features/link/nodes/types.d.ts +3 -3
- 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/server/baseFields.d.ts +1 -1
- package/dist/features/link/server/baseFields.d.ts.map +1 -1
- package/dist/features/link/server/baseFields.js +3 -1
- package/dist/features/link/server/baseFields.js.map +1 -1
- package/dist/features/link/server/index.d.ts.map +1 -1
- package/dist/features/link/server/index.js +2 -2
- package/dist/features/link/server/index.js.map +1 -1
- package/dist/features/link/server/transformExtraFields.d.ts +1 -1
- package/dist/features/link/server/transformExtraFields.d.ts.map +1 -1
- package/dist/features/link/server/transformExtraFields.js.map +1 -1
- package/dist/features/link/server/validate.js.map +1 -1
- package/dist/features/lists/shared/markdown.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.js +1 -0
- package/dist/features/migrations/lexicalPluginToLexical/converter/index.js.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/features/migrations/lexicalPluginToLexical/nodes/unknownConvertedNode/index.js.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.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/link/converter.js.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.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unknown/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/converters/unorderedList/converter.js.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/index.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/converter/index.js +1 -0
- package/dist/features/migrations/slateToLexical/converter/index.js.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.d.ts.map +1 -1
- package/dist/features/migrations/slateToLexical/nodes/unknownConvertedNode/index.js.map +1 -1
- package/dist/features/paragraph/server/index.d.ts +1 -1
- package/dist/features/paragraph/server/index.d.ts.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.d.ts.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.js +8 -6
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/client/drawer/index.js +3 -3
- package/dist/features/relationship/client/drawer/index.js.map +1 -1
- package/dist/features/relationship/client/plugins/index.js +1 -1
- package/dist/features/relationship/client/plugins/index.js.map +1 -1
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js +1 -1
- package/dist/features/relationship/client/utils/EnabledRelationshipsCondition.js.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.d.ts.map +1 -1
- package/dist/features/relationship/server/nodes/RelationshipNode.js.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/fixed/client/Toolbar/index.js +40 -41
- package/dist/features/toolbars/fixed/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.d.ts.map +1 -1
- package/dist/features/toolbars/inline/client/Toolbar/index.js +33 -34
- package/dist/features/toolbars/inline/client/Toolbar/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js +4 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts +3 -4
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js +82 -64
- package/dist/features/toolbars/shared/ToolbarDropdown/index.js.map +1 -1
- package/dist/features/toolbars/types.d.ts +21 -11
- package/dist/features/toolbars/types.d.ts.map +1 -1
- package/dist/features/toolbars/types.js.map +1 -1
- package/dist/features/typesServer.d.ts.map +1 -1
- package/dist/features/typesServer.js.map +1 -1
- package/dist/features/upload/client/component/index.js +1 -1
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/drawer/index.d.ts.map +1 -1
- package/dist/features/upload/client/drawer/index.js +2 -0
- package/dist/features/upload/client/drawer/index.js.map +1 -1
- package/dist/features/upload/client/plugin/index.js +1 -1
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/features/upload/server/feature.server.js +3 -4
- package/dist/features/upload/server/feature.server.js.map +1 -1
- package/dist/features/upload/server/validate.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +11 -11
- package/dist/field/Field.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/field/index.js +1 -1
- package/dist/field/index.js.map +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +69 -63
- package/dist/index.js.map +1 -1
- package/dist/lexical/EditorPlugin.d.ts.map +1 -1
- package/dist/lexical/EditorPlugin.js +2 -1
- package/dist/lexical/EditorPlugin.js.map +1 -1
- package/dist/lexical/LexicalEditor.d.ts +1 -1
- package/dist/lexical/LexicalEditor.d.ts.map +1 -1
- package/dist/lexical/LexicalEditor.js +5 -5
- package/dist/lexical/LexicalEditor.js.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.js +8 -7
- package/dist/lexical/config/client/EditorConfigProvider.js.map +1 -1
- package/dist/lexical/config/client/sanitize.js +2 -2
- package/dist/lexical/config/client/sanitize.js.map +1 -1
- package/dist/lexical/config/server/loader.js.map +1 -1
- package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/server/sanitize.js +11 -11
- package/dist/lexical/config/server/sanitize.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js +2 -2
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/SlashMenu/LexicalTypeaheadMenuPlugin/types.d.ts +1 -1
- 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/lexical/plugins/SlashMenu/index.d.ts.map +1 -1
- package/dist/lexical/plugins/SlashMenu/index.js +9 -6
- package/dist/lexical/plugins/SlashMenu/index.js.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js +5 -5
- package/dist/lexical/plugins/handles/AddBlockHandlePlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/getBoundingRectWithoutTransform.js.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js +9 -4
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/index.js.map +1 -1
- package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js +3 -4
- package/dist/lexical/plugins/handles/utils/getNodeCloseToPoint.js.map +1 -1
- package/dist/lexical/utils/rect.d.ts +4 -4
- package/dist/lexical/utils/setFloatingElemPosition.d.ts +1 -1
- package/dist/lexical/utils/setFloatingElemPosition.d.ts.map +1 -1
- package/dist/lexical/utils/setFloatingElemPosition.js.map +1 -1
- package/dist/populateGraphQL/populate.js +1 -1
- package/dist/populateGraphQL/populate.js.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.js +5 -4
- package/dist/populateGraphQL/populateLexicalPopulationPromises.js.map +1 -1
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.js.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/DrawerContent.js +8 -3
- package/dist/utilities/fieldsDrawer/DrawerContent.js.map +1 -1
- package/dist/utilities/generateComponentMap.d.ts.map +1 -1
- package/dist/utilities/generateComponentMap.js +1 -0
- package/dist/utilities/generateComponentMap.js.map +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.d.ts.map +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js +1 -1
- package/dist/utilities/migrateSlateToLexical/migrateDocumentFieldsRecursively.js.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.js.map +1 -1
- package/dist/validate/validateNodes.d.ts.map +1 -1
- package/dist/validate/validateNodes.js +2 -2
- package/dist/validate/validateNodes.js.map +1 -1
- package/package.json +13 -13
- package/dist/exports/client/Field-EL5TNVZW.js +0 -2
- package/dist/exports/client/Field-EL5TNVZW.js.map +0 -7
- package/dist/exports/client/RelationshipComponent-Z5SZ5FFT.js +0 -2
- package/dist/exports/client/chunk-366OGJYE.js +0 -2
- package/dist/exports/client/chunk-366OGJYE.js.map +0 -7
- package/dist/exports/client/chunk-GK7ZKYHL.js.map +0 -7
- package/dist/exports/client/chunk-TXEIKM77.js.map +0 -7
- package/dist/exports/client/component-OVIYSCND.js +0 -2
- package/dist/exports/client/component-OVIYSCND.js.map +0 -7
- package/dist/exports/client/component-UJILB3MH.js +0 -2
- package/dist/exports/client/component-UJILB3MH.js.map +0 -7
- package/dist/exports/client/componentInline-HAGGWKA7.js +0 -2
- /package/dist/exports/client/{component-GAX6BHKZ.js.map → component-GQ5M6NF6.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";import{a as yt,b as il,c as ll,d as sl,f as al,h as cl}from"./chunk-GK7ZKYHL.js";import{a as we,b as Mt,c as Ne,d as vo,e as Ao}from"./chunk-PY6JO5OH.js";import{a as ke,b as Ze,c as Ye,d as Xe}from"./chunk-PECDZEZY.js";import{a as Le,b as Ie,c as Re,d as vt}from"./chunk-GTKNWSQW.js";import{a as se,b as Je,c as Se,d as ye,e as Me,f as At}from"./chunk-366OGJYE.js";import{a as nl,b as P}from"./chunk-TXEIKM77.js";function G(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{jsx as Oo}from"react/jsx-runtime";import{createHeadlessEditor as ul}from"@lexical/headless";import{useConfig as dl,useTableCell as ml}from"@payloadcms/ui";import{formatAdminURL as pl}from"@payloadcms/ui/shared";import{$getRoot as fl}from"lexical";import Po from"next/link.js";import hl,{useEffect as gl,useMemo as Cl}from"react";var Fo={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var ve={namespace:"lexical",theme:Fo};function qe({unSanitizedEditorConfig:t}){for(let r of t.features)if(!r?.clientFeatureProps?.featureKey||r?.clientFeatureProps?.order===void 0||r?.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.");t.features=t.features.sort((r,i)=>r.clientFeatureProps.order-i.clientFeatureProps.order);let e=new Map;for(let r of t.features)e.set(r.clientFeatureProps.featureKey,r);let o=new Map,n=0;for(let r of t.features){let i=typeof r.feature=="function"?r.feature({featureProviderMap:e,resolvedFeatures:o,unSanitizedEditorConfig:t}):r.feature;i.key=r.clientFeatureProps.featureKey,i.order=n,o.set(r.clientFeatureProps.featureKey,i),n++}return o}var Do=t=>{let e={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(e.hooks.load=e.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(e.hooks.save=e.hooks.save.concat(o.hooks.save))),o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.nodes?.length&&(e.nodes=e.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((n,r)=>{e.plugins.push({clientProps:o.sanitizedClientFeatureProps,Component:n.Component,key:o.key+r,position:n.position})}),o.toolbarInline?.groups?.length)for(let n of o.toolbarInline.groups){let r=e.toolbarInline.groups.find(i=>i.key===n.key);r?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarInline?.groups.push(r)}if(o.toolbarFixed?.groups?.length)for(let n of o.toolbarFixed.groups){let r=e.toolbarFixed.groups.find(i=>i.key===n.key);r?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarFixed?.groups.push(r)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let n of o.slashMenu.groups){let r=e.slashMenu.groups.find(i=>i.key===n.key);r?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.slashMenu.groups.push(r)}}o.markdownTransformers?.length&&(e.markdownTransformers=e.markdownTransformers.concat(o.markdownTransformers)),e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);return e};function Ae(t,e,o){return{admin:o,features:Do(t),lexical:e,resolvedFeatureMap:t}}var xl=Po.default||Po,bl=t=>{let{admin:e,field:{richTextComponentMap:o},lexicalEditorConfig:n}=t,[r,i]=hl.useState("Loading..."),{cellData:l,cellProps:s,columnIndex:a,customCellContext:c,rowData:u}=ml(),{config:{routes:{admin:d}}}=dl(),{link:m}=s||{},p="span",h={},C=m!==void 0?m:a===0;C&&(p=xl,h.href=c?.collectionSlug?pl({adminRoute:d,path:`/collections/${c?.collectionSlug}/${u.id}`}):"");let b=Cl(()=>{let x=o.get("features"),v=[];for(let E of x)v.push(E.clientFeature(E.clientFeatureProps));let A=n||ve,T=qe({unSanitizedEditorConfig:{features:v,lexical:A}});return Ae(T,A)},[o,n]);return b.admin=e,gl(()=>{let x=l;if(x==null||!b){i("");return}if(b?.features?.hooks?.load?.length&&b.features.hooks.load.forEach(T=>{x=T({incomingEditorState:x})}),!x||typeof x!="object"){i("");return}if(Array.isArray(x)&&!("root"in x)){i("");return}if("jsonContent"in x){i("");return}let v=ul({namespace:b.lexical.namespace,nodes:yt({editorConfig:b}),theme:b.lexical.theme});v.setEditorState(v.parseEditorState(x));let A=v.getEditorState().read(()=>fl().getTextContent())||"";i(A)},[l,b]),C?Oo(p,{...h,children:r}):Oo("span",{children:r})};import{$isElementNode as ne,$isRangeSelection as et,FORMAT_ELEMENT_COMMAND as tt}from"lexical";import{jsx as Ft,jsxs as _l}from"react/jsx-runtime";import"react";var $o=()=>_l("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:[Ft("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ft("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ft("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Dt,jsxs as Tl}from"react/jsx-runtime";import"react";var Ho=()=>Tl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Dt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Dt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Dt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ot,jsxs as El}from"react/jsx-runtime";import"react";var Qe=()=>El("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:[Ot("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Pt,jsxs as wl}from"react/jsx-runtime";import"react";var Bo=()=>wl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Pt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Pt("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var S=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({featureProviderMap:r,resolvedFeatures:i,unSanitizedEditorConfig:l})=>{let s=t({featureProviderMap:r,props:o,resolvedFeatures:i,unSanitizedEditorConfig:l});return s.sanitizedClientFeatureProps===null&&(s.sanitizedClientFeatureProps=o),s};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var jo=t=>({type:"dropdown",ChildComponent:Qe,items:t,key:"align",order:30});var Go=[jo([{ChildComponent:Qe,isActive:({selection:t})=>{if(!et(t))return!1;for(let e of t.getNodes()){if(ne(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ne(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(tt,"left")},order:1},{ChildComponent:$o,isActive:({selection:t})=>{if(!et(t))return!1;for(let e of t.getNodes()){if(ne(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ne(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(tt,"center")},order:2},{ChildComponent:Bo,isActive:({selection:t})=>{if(!et(t))return!1;for(let e of t.getNodes()){if(ne(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ne(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(tt,"right")},order:3},{ChildComponent:Ho,isActive:({selection:t})=>{if(!et(t))return!1;for(let e of t.getNodes()){if(ne(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ne(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(tt,"justify")},order:4}])],Nl=S({toolbarFixed:{groups:Go},toolbarInline:{groups:Go}});import{$createQuoteNode as Yo,$isQuoteNode as zo,QuoteNode as Rl}from"@lexical/rich-text";import{$setBlocksType as Xo}from"@lexical/selection";import{$getSelection as Jo,$isRangeSelection as Sl}from"lexical";import{jsx as Uo}from"react/jsx-runtime";import"react";var $t=()=>Uo("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Uo("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as Wo}from"react/jsx-runtime";import"react";var Fe=()=>Wo("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Wo("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var W=t=>({type:"dropdown",ChildComponent:Fe,items:t,key:"text",order:25});import{$createQuoteNode as kl,$isQuoteNode as Vo,QuoteNode as Ll}from"@lexical/rich-text";import{$createLineBreakNode as Il}from"lexical";var Ko={type:"element",dependencies:[Ll],export:(t,e)=>{if(!Vo(t))return null;let o=e(t).split(`
|
|
1
|
+
"use client";import{a as Mt,b as ul,c as dl,d as ml,f as fl,h as pl}from"./chunk-IIWHHN4J.js";import{a as Ne,b as vt,c as cl}from"./chunk-HIGLONP6.js";import{a as ke,b as At,c as Le,d as Oo,e as Po,f as $o}from"./chunk-JYCJEIVA.js";import{a as Ie,b as Ye,c as Xe,d as Je}from"./chunk-YREZUOA6.js";import{a as Re,b as Se,c as ye,d as Ft}from"./chunk-N2PXHNGO.js";import{a as ae,b as qe,c as Me,d as ve,e as Ae,f as Dt}from"./chunk-76MVRKRT.js";import{a as al,b as H}from"./chunk-GD6LBQBJ.js";function G(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{jsx as jo}from"react/jsx-runtime";import{createHeadlessEditor as hl}from"@lexical/headless";import{useConfig as gl,useTableCell as Cl}from"@payloadcms/ui";import{formatAdminURL as xl}from"@payloadcms/ui/shared";import{$getRoot as bl}from"lexical";import Go from"next/link.js";import _l,{useEffect as Tl,useMemo as El}from"react";var Ho={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 Fe={namespace:"lexical",theme:Ho};function Qe({unSanitizedEditorConfig:t}){for(let r of t.features)if(!r?.clientFeatureProps?.featureKey||r?.clientFeatureProps?.order===void 0||r?.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.");t.features=t.features.sort((r,i)=>r.clientFeatureProps.order-i.clientFeatureProps.order);let e=new Map;for(let r of t.features)e.set(r.clientFeatureProps.featureKey,r);let o=new Map,n=0;for(let r of t.features){let i=typeof r.feature=="function"?r.feature({featureProviderMap:e,resolvedFeatures:o,unSanitizedEditorConfig:t}):r.feature;i.key=r.clientFeatureProps.featureKey,i.order=n,o.set(r.clientFeatureProps.featureKey,i),n++}return o}var Bo=t=>{let e={enabledFeatures:[],hooks:{load:[],save:[]},markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.hooks&&(o.hooks?.load?.length&&(e.hooks.load=e.hooks.load.concat(o.hooks.load)),o.hooks?.save?.length&&(e.hooks.save=e.hooks.save.concat(o.hooks.save))),o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.nodes?.length&&(e.nodes=e.nodes.concat(o.nodes)),o.plugins?.length&&o.plugins.forEach((n,r)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:n.Component,key:o.key+r,position:n.position})}),o.toolbarInline?.groups?.length)for(let n of o.toolbarInline.groups){let r=e.toolbarInline.groups.find(i=>i.key===n.key);r?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarInline?.groups.push(r)}if(o.toolbarFixed?.groups?.length)for(let n of o.toolbarFixed.groups){let r=e.toolbarFixed.groups.find(i=>i.key===n.key);r?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarFixed?.groups.push(r)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let n of o.slashMenu.groups){let r=e.slashMenu.groups.find(i=>i.key===n.key);r?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.slashMenu.groups.push(r)}}o.markdownTransformers?.length&&(e.markdownTransformers=e.markdownTransformers.concat(o.markdownTransformers)),e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);return e};function De(t,e,o){return{admin:o,features:Bo(t),lexical:e,resolvedFeatureMap:t}}var wl=Go.default||Go,Nl=t=>{let{admin:e,field:{richTextComponentMap:o},lexicalEditorConfig:n}=t,[r,i]=_l.useState("Loading..."),{cellData:l,cellProps:s,columnIndex:a,customCellContext:c,rowData:u}=Cl(),{config:{routes:{admin:d}}}=gl(),{link:m}=s||{},f="span",p={},g=m!==void 0?m:a===0;g&&(f=wl,p.href=c?.collectionSlug?xl({adminRoute:d,path:`/collections/${c?.collectionSlug}/${u.id}`}):"");let b=El(()=>{let x=o?.get("features"),A=[];for(let E of x)A.push(E.clientFeature(E.clientFeatureProps));let v=n||Fe,T=Qe({unSanitizedEditorConfig:{features:A,lexical:v}});return De(T,v)},[o,n]);return b.admin=e,Tl(()=>{let x=l;if(x==null||!b){i("");return}if(b?.features?.hooks?.load?.length&&b.features.hooks.load.forEach(T=>{x=T({incomingEditorState:x})}),!x||typeof x!="object"){i("");return}if(Array.isArray(x)&&!("root"in x)){i("");return}if("jsonContent"in x){i("");return}let A=hl({namespace:b.lexical.namespace,nodes:Mt({editorConfig:b}),theme:b.lexical.theme});A.setEditorState(A.parseEditorState(x));let v=A.getEditorState().read(()=>bl().getTextContent())||"";i(v)},[l,b]),g?jo(f,{...p,children:r}):jo("span",{children:r})};import{$isElementNode as ie,$isRangeSelection as tt,FORMAT_ELEMENT_COMMAND as ot}from"lexical";import{jsx as Ot,jsxs as kl}from"react/jsx-runtime";import"react";var Uo=()=>kl("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:[Ot("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ot("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Pt,jsxs as Ll}from"react/jsx-runtime";import"react";var Wo=()=>Ll("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pt("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Pt("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Pt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as $t,jsxs as Il}from"react/jsx-runtime";import"react";var et=()=>Il("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[$t("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),$t("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ht,jsxs as Rl}from"react/jsx-runtime";import"react";var Vo=()=>Rl("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:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var S=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({featureProviderMap:r,resolvedFeatures:i,unSanitizedEditorConfig:l})=>{let s=t({featureProviderMap:r,props:o,resolvedFeatures:i,unSanitizedEditorConfig:l});return s.sanitizedClientFeatureProps===null&&(s.sanitizedClientFeatureProps=o),s};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Ko=t=>({type:"dropdown",ChildComponent:et,items:t,key:"align",order:30});var zo=[Ko([{ChildComponent:et,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"left")},order:1},{ChildComponent:Uo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"center")},order:2},{ChildComponent:Vo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"right")},order:3},{ChildComponent:Wo,isActive:({selection:t})=>{if(!tt(t))return!1;for(let e of t.getNodes()){if(ie(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(ie(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ot,"justify")},order:4}])],Sl=S({toolbarFixed:{groups:zo},toolbarInline:{groups:zo}});import{$createQuoteNode as er,$isQuoteNode as qo,QuoteNode as Al}from"@lexical/rich-text";import{$setBlocksType as tr}from"@lexical/selection";import{$getSelection as or,$isRangeSelection as Fl}from"lexical";import{jsx as Zo}from"react/jsx-runtime";import"react";var Bt=()=>Zo("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:Zo("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 Yo}from"react/jsx-runtime";import"react";var Oe=()=>Yo("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:Yo("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 W=t=>({type:"dropdown",ChildComponent:Oe,items:t,key:"text",order:25});import{$createQuoteNode as yl,$isQuoteNode as Xo,QuoteNode as Ml}from"@lexical/rich-text";import{$createLineBreakNode as vl}from"lexical";var Jo={type:"element",dependencies:[Ml],export:(t,e)=>{if(!Xo(t))return null;let o=e(t).split(`
|
|
2
2
|
`),n=[];for(let r of o)n.push("> "+r);return n.join(`
|
|
3
|
-
`)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let i=t.getPreviousSibling();if(Vo(i)){i.splice(i.getChildrenSize(),0,[Il(),...e]),i.select(0,0),t.remove();return}}let r=kl();r.append(...e),t.replace(r),r.select(0,0)}};var Zo=[W([{ChildComponent:$t,isActive:({selection:t})=>{if(!Sl(t))return!1;for(let e of t.getNodes())if(!zo(e)&&!zo(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Jo();Xo(e,()=>Yo())})},order:20}])],yl=S({markdownTransformers:[Ko],nodes:[Rl],slashMenu:{groups:[G([{Icon:$t,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Jo();Xo(e,()=>Yo())})}}])]},toolbarFixed:{groups:Zo},toolbarInline:{groups:Zo}});import{getTranslation as it}from"@payloadcms/translations";import{jsx as Ht,jsxs as Ml}from"react/jsx-runtime";import"react";var ot=()=>Ml("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("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Ht("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Ht("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as qo}from"react/jsx-runtime";import"react";var rt=()=>qo("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:qo("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as Ol}from"react/jsx-runtime";import Pl from"bson-objectid";import $l from"react";import{DecoratorBlockNode as vl}from"@lexical/react/LexicalDecoratorBlockNode.js";import Al from"bson-objectid";import{deepCopyObjectSimple as Fl}from"payload/shared";var De=class extends vl{__fields;constructor({fields:e,format:o,key:n}){super(o,n),this.__fields=e}static clone(e){return new this({fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Dl(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e){let o=Fl(e),n=this.getWritable();n.__fields=o}};function Dl(t){return new De({fields:{...t,id:t?.id||new Al.default().toHexString()}})}var Hl=$l.lazy(()=>import("./component-OVIYSCND.js").then(t=>({default:t.BlockComponent}))),X=class extends De{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=nt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return Ol(Hl,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function nt(t){return new X({fields:{...t,id:t?.id||new Pl.default().toHexString()}})}function Bl(t){return t instanceof X}import{c as jl}from"react/compiler-runtime";import{jsx as Gl}from"react/jsx-runtime";import{useLexicalComposerContext as Ul}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Wl,$wrapNodeInElement as Vl,mergeRegister as Kl}from"@lexical/utils";import{getTranslation as zl}from"@payloadcms/translations";import{formatDrawerSlug as Zl,useEditDepth as Yl,useFieldProps as Xl,useModal as Jl,useTranslation as ql}from"@payloadcms/ui";import{$createParagraphNode as Ql,$getNodeByKey as es,$getPreviousSelection as ts,$getSelection as Qo,$insertNodes as os,$isParagraphNode as er,$isRangeSelection as tr,$isRootOrShadowRoot as rs,COMMAND_PRIORITY_EDITOR as Bt}from"lexical";import{useEffect as ns,useState as jt}from"react";var or=()=>{let t=jl(25),[e]=Ul(),{closeModal:o,toggleModal:n}=Jl(),[r,i]=jt(null),[l,s]=jt(""),[a,c]=jt(null),{i18n:u,t:d}=ql(),{schemaPath:m}=Xl(),{uuid:p}=P(),h=Yl(),C="lexical-inlineBlocks-create-"+p,b;t[0]!==C||t[1]!==h?(b=Zl({slug:C,depth:h}),t[0]=C,t[1]=h,t[2]=b):b=t[2];let x=b,{field:v}=P(),{richTextComponentMap:A}=v,T,E;if(t[3]!==e||t[4]!==a||t[5]!==n||t[6]!==x?(T=()=>{if(!e.hasNodes([X]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Kl(e.registerCommand(we,N=>(e.update(()=>{let g=Qo()||ts();if(tr(g)){let f=nt(N);Wl(f);let{focus:I}=g,k=I.getNode();er(k)&&k.getTextContentSize()===0&&k.getParent().getChildren().filter(w=>er(w)).length>1&&k.remove()}}),!0),Bt),e.registerCommand(Mt,N=>{if(a){let f=es(a);return f?(f.setFields(N),c(null),!0):!1}let g=Ao(N);return os([g]),rs(g.getParentOrThrow())&&Vl(g,Ql).selectEnd(),!0},Bt),e.registerCommand(Ne,N=>{let{fields:g,nodeKey:f}=N;if(i(g??null),c(f??null),s(g?.blockType??""),f)return n(x),!0;let I;return I=null,e.getEditorState().read(()=>{let k=Qo();tr(k)&&(I=k)}),I&&n(x),!0},Bt))},E=[e,a,n,x],t[3]=e,t[4]=a,t[5]=n,t[6]=x,t[7]=T,t[8]=E):(T=t[7],E=t[8]),ns(T,E),!r)return null;let _=`${m}.lexical_internal_feature.blocks.lexical_inline_blocks.lexical_inline_blocks.${r?.blockType}`,L="lexical_internal_feature.blocks.fields.lexical_inline_blocks",y,R;if(t[9]!==A||t[10]!==r||t[11]!==u||t[12]!==d||t[13]!==o||t[14]!==x||t[15]!==l||t[16]!==e||t[17]!==_){R=Symbol.for("react.early_return_sentinel");e:{let N=A.has(L)?A.get(L)[0]:null,g=N?N.blocks.find(k=>k.slug===r?.blockType):null;if(!N){R=null;break e}let f=g?.labels?.singular?zl(g?.labels?.singular,u):g?.slug,I;t[20]!==o||t[21]!==x||t[22]!==l||t[23]!==e?(I=(k,w)=>{o(x),w&&(w.blockType=l,e.dispatchCommand(Mt,w))},t[20]=o,t[21]=x,t[22]=l,t[23]=e,t[24]=I):I=t[24],y=Gl(se,{data:r,drawerSlug:x,drawerTitle:d(`lexical:blocks:inlineBlocks:${r?.id?"edit":"create"}`,{label:f??d("lexical:blocks:inlineBlocks:label")}),featureKey:"blocks",fieldMapOverride:g?.fields,handleDrawerSubmit:I,schemaFieldsPathOverride:_,schemaPathSuffix:r?.blockType})}t[9]=A,t[10]=r,t[11]=u,t[12]=d,t[13]=o,t[14]=x,t[15]=l,t[16]=e,t[17]=_,t[18]=y,t[19]=R}else y=t[18],R=t[19];return R!==Symbol.for("react.early_return_sentinel")?R:y};var is=S(({props:t})=>({nodes:[X,vo],plugins:[{Component:or,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:[t.clientBlockSlugs?.length?{items:t.clientBlockSlugs.map(e=>({Icon:ot,key:"block-"+e,keywords:["block","blocks",e],label:({i18n:o,richTextComponentMap:n})=>{let l=n.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(a=>a.slug===e);return l.labels.singular?it(l.labels.singular,o):l.slug},onSelect:({editor:o})=>{o.dispatchCommand(we,{id:null,blockName:"",blockType:e})}})),key:"blocks",label:({i18n:e})=>e.t("lexical:blocks:label")}:null,t.clientInlineBlockSlugs?.length?{items:t.clientInlineBlockSlugs.map(e=>({Icon:rt,key:"inlineBlocks-"+e,keywords:["inlineBlock","inline block",e],label:({i18n:o,richTextComponentMap:n})=>{let l=n.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(a=>a.slug===e);return l.labels.singular?it(l.labels.singular,o):l.slug},onSelect:({editor:o})=>{o.dispatchCommand(Ne,{fields:{id:null,blockName:"",blockType:e}})}})),key:"inlineBlocks",label:({i18n:e})=>e.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[t.clientBlockSlugs?.length?{type:"dropdown",ChildComponent:ot,items:t.clientBlockSlugs.map((e,o)=>({ChildComponent:ot,isActive:void 0,key:"block-"+e,label:({i18n:n,richTextComponentMap:r})=>{let s=r.get("lexical_internal_feature.blocks.fields.lexical_blocks")[0].blocks.find(c=>c.slug===e);return s.labels.singular?it(s.labels.singular,n):s.slug},onSelect:({editor:n})=>{n.dispatchCommand(we,{id:null,blockName:"",blockType:e})},order:o})),key:"blocks",order:20}:null,t.clientInlineBlockSlugs?.length?{type:"dropdown",ChildComponent:rt,items:t.clientInlineBlockSlugs.map((e,o)=>({ChildComponent:rt,isActive:void 0,key:"inlineBlock-"+e,label:({i18n:n,richTextComponentMap:r})=>{let s=r.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")[0].blocks.find(c=>c.slug===e);return s.labels.singular?it(s.labels.singular,n):s.slug},onSelect:({editor:n})=>{n.dispatchCommand(Ne,{fields:{blockType:e}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{jsx as ce,jsxs as Wt}from"react/jsx-runtime";import{useLexicalComposerContext as as}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as cs,$createTextNode as us,$getRoot as ds}from"lexical";import*as sr from"react";import{useCallback as ae,useEffect as Gt,useLayoutEffect as nr,useRef as Ut,useState as lt}from"react";var K=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var ls=K&&"documentMode"in document?document.documentMode:null,rr=K&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),z1=K&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Z1=K&&"InputEvent"in window&&!ls?"getTargetRanges"in new window.InputEvent("input"):!1,Y1=K&&/Version\/[\d.].*Safari/.test(navigator.userAgent),X1=K&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,J1=K&&/Android/.test(navigator.userAgent),q1=K&&/Win/.test(navigator.platform),ss=K&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Q1=K&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!ss;var ms=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},ps=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},fs=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"press":return` await page.keyboard.press('${r}');`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"type":return` await page.keyboard.type('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
3
|
+
`)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let i=t.getPreviousSibling();if(Xo(i)){i.splice(i.getChildrenSize(),0,[vl(),...e]),i.select(0,0),t.remove();return}}let r=yl();r.append(...e),t.replace(r),r.select(0,0)}};var Qo=[W([{ChildComponent:Bt,isActive:({selection:t})=>{if(!Fl(t))return!1;for(let e of t.getNodes())if(!qo(e)&&!qo(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=or();tr(e,()=>er())})},order:20}])],Dl=S({markdownTransformers:[Jo],nodes:[Al],slashMenu:{groups:[G([{Icon:Bt,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=or();tr(e,()=>er())})}}])]},toolbarFixed:{groups:Qo},toolbarInline:{groups:Qo}});import{getTranslation as it}from"@payloadcms/translations";import{jsx as jt,jsxs as Ol}from"react/jsx-runtime";import"react";var rt=()=>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:[jt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),jt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),jt("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as rr}from"react/jsx-runtime";import"react";var nt=()=>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("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{c as Pl}from"react/compiler-runtime";import{jsx as $l}from"react/jsx-runtime";import{useLexicalComposerContext as Hl}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Bl,$wrapNodeInElement as jl,mergeRegister as Gl}from"@lexical/utils";import{getTranslation as Ul}from"@payloadcms/translations";import{formatDrawerSlug as Wl,useEditDepth as Vl,useFieldProps as Kl,useModal as zl,useTranslation as Zl}from"@payloadcms/ui";import{$createParagraphNode as Yl,$getNodeByKey as Xl,$getPreviousSelection as Jl,$getSelection as nr,$insertNodes as ql,$isParagraphNode as ir,$isRangeSelection as lr,$isRootOrShadowRoot as Ql,COMMAND_PRIORITY_EDITOR as Gt}from"lexical";import{useEffect as es,useState as Ut}from"react";var sr=()=>{let t=Pl(25),[e]=Hl(),{closeModal:o,toggleModal:n}=zl(),[r,i]=Ut(null),[l,s]=Ut(""),[a,c]=Ut(null),{i18n:u,t:d}=Zl(),{schemaPath:m}=Kl(),{uuid:f}=H(),p=Vl(),g="lexical-inlineBlocks-create-"+f,b;t[0]!==g||t[1]!==p?(b=Wl({slug:g,depth:p}),t[0]=g,t[1]=p,t[2]=b):b=t[2];let x=b,{field:A}=H(),{richTextComponentMap:v}=A,T,E;if(t[3]!==e||t[4]!==a||t[5]!==n||t[6]!==x?(T=()=>{if(!e.hasNodes([Ne]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Gl(e.registerCommand(ke,N=>(e.update(()=>{let C=nr()||Jl();if(lr(C)){let h=vt(N);Bl(h);let{focus:I}=C,k=I.getNode();ir(k)&&k.getTextContentSize()===0&&k.getParentOrThrow().getChildren().filter(w=>ir(w)).length>1&&k.remove()}}),!0),Gt),e.registerCommand(At,N=>{if(a){let h=Xl(a);return!h||!$o(h)?!1:(h.setFields(N),c(null),!0)}let C=Po(N);return ql([C]),Ql(C.getParentOrThrow())&&jl(C,Yl).selectEnd(),!0},Gt),e.registerCommand(Le,N=>{let{fields:C,nodeKey:h}=N;if(i(C??null),c(h??null),s(C?.blockType??""),h)return n(x),!0;let I;return I=null,e.getEditorState().read(()=>{let k=nr();lr(k)&&(I=k)}),I&&n(x),!0},Gt))},E=[e,a,n,x],t[3]=e,t[4]=a,t[5]=n,t[6]=x,t[7]=T,t[8]=E):(T=t[7],E=t[8]),es(T,E),!r)return null;let _=`${m}.lexical_internal_feature.blocks.lexical_inline_blocks.lexical_inline_blocks.${r?.blockType}`,L="lexical_internal_feature.blocks.fields.lexical_inline_blocks",y,R;if(t[9]!==v||t[10]!==r||t[11]!==u||t[12]!==d||t[13]!==o||t[14]!==x||t[15]!==l||t[16]!==e||t[17]!==_){R=Symbol.for("react.early_return_sentinel");e:{let N=v?.has(L)?v.get(L)[0]:null,C=N?N.blocks.find(k=>k.slug===r?.blockType):null;if(!N){R=null;break e}let h=C?.labels?.singular?Ul(C?.labels?.singular,u):C?.slug,I;t[20]!==o||t[21]!==x||t[22]!==l||t[23]!==e?(I=(k,w)=>{o(x),w&&(w.blockType=l,e.dispatchCommand(At,w))},t[20]=o,t[21]=x,t[22]=l,t[23]=e,t[24]=I):I=t[24],y=$l(ae,{data:r,drawerSlug:x,drawerTitle:d(`lexical:blocks:inlineBlocks:${r?.id?"edit":"create"}`,{label:h??d("lexical:blocks:inlineBlocks:label")}),featureKey:"blocks",fieldMapOverride:C?.fields,handleDrawerSubmit:I,schemaFieldsPathOverride:_,schemaPathSuffix:r?.blockType})}t[9]=v,t[10]=r,t[11]=u,t[12]=d,t[13]=o,t[14]=x,t[15]=l,t[16]=e,t[17]=_,t[18]=y,t[19]=R}else y=t[18],R=t[19];return R!==Symbol.for("react.early_return_sentinel")?R:y};var ts=S(({props:t})=>({nodes:[Ne,Oo],plugins:[{Component:sr,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:[t.clientBlockSlugs?.length?{items:t.clientBlockSlugs.map(e=>({Icon:rt,key:"block-"+e,keywords:["block","blocks",e],label:({i18n:o,richTextComponentMap:n})=>{if(!n)return e;let l=(n.get("lexical_internal_feature.blocks.fields.lexical_blocks")?.[0]).blocks.find(a=>a.slug===e);return l?.labels?.singular?it(l.labels.singular,o):l?.slug},onSelect:({editor:o})=>{o.dispatchCommand(ke,{blockName:"",blockType:e})}})),key:"blocks",label:({i18n:e})=>e.t("lexical:blocks:label")}:null,t.clientInlineBlockSlugs?.length?{items:t.clientInlineBlockSlugs.map(e=>({Icon:nt,key:"inlineBlocks-"+e,keywords:["inlineBlock","inline block",e],label:({i18n:o,richTextComponentMap:n})=>{if(!n)return e;let l=(n.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")?.[0]).blocks.find(a=>a.slug===e);return l?.labels?.singular?it(l.labels.singular,o):l?.slug},onSelect:({editor:o})=>{o.dispatchCommand(Le,{fields:{blockName:"",blockType:e}})}})),key:"inlineBlocks",label:({i18n:e})=>e.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[t.clientBlockSlugs?.length?{type:"dropdown",ChildComponent:rt,items:t.clientBlockSlugs.map((e,o)=>({ChildComponent:rt,isActive:void 0,key:"block-"+e,label:({i18n:n,richTextComponentMap:r})=>{if(!r)return e;let s=(r.get("lexical_internal_feature.blocks.fields.lexical_blocks")?.[0]).blocks.find(c=>c.slug===e);return s?.labels?.singular?it(s.labels.singular,n):s?.slug},onSelect:({editor:n})=>{n.dispatchCommand(ke,{blockName:"",blockType:e})},order:o})),key:"blocks",order:20}:null,t.clientInlineBlockSlugs?.length?{type:"dropdown",ChildComponent:nt,items:t.clientInlineBlockSlugs.map((e,o)=>({ChildComponent:nt,isActive:void 0,key:"inlineBlock-"+e,label:({i18n:n,richTextComponentMap:r})=>{if(!r)return e;let s=(r.get("lexical_internal_feature.blocks.fields.lexical_inline_blocks")?.[0]).blocks.find(c=>c.slug===e);return s?.labels?.singular?it(s.labels.singular,n):s?.slug},onSelect:({editor:n})=>{n.dispatchCommand(Le,{fields:{blockType:e}})},order:o})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}));import{jsx as ue,jsxs as Kt}from"react/jsx-runtime";import{useLexicalComposerContext as ns}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as is,$createTextNode as ls,$getRoot as ss}from"lexical";import*as mr from"react";import{useCallback as ce,useEffect as Wt,useLayoutEffect as cr,useRef as Vt,useState as lt}from"react";var K=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";var os=K&&"documentMode"in document?document.documentMode:null,ar=K&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),F1=K&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),D1=K&&"InputEvent"in window&&!os?"getTargetRanges"in new window.InputEvent("input"):!1,O1=K&&/Version\/[\d.].*Safari/.test(navigator.userAgent),P1=K&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,$1=K&&/Android/.test(navigator.userAgent),H1=K&&/Win/.test(navigator.platform),rs=K&&/^(?=.*Chrome).*/i.test(navigator.userAgent),B1=K&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!rs;var as=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},cs=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},us=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"press":return` await page.keyboard.press('${r}');`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"type":return` await page.keyboard.type('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
4
4
|
await assertSelection(page, {
|
|
5
5
|
anchorPath: [${r.anchorPath.toString()}],
|
|
6
6
|
anchorOffset: ${r.anchorOffset},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
|
|
11
11
|
`);default:return` await repeat(${t.count}, async () => {
|
|
12
12
|
${o}
|
|
13
|
-
);`}};function
|
|
13
|
+
);`}};function ds(t){return t.key.toLowerCase()==="a"&&(ar?t.metaKey:t.ctrlKey)}function ms(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:n,focusOffset:r}=t;return n!==0&&n--,r!==0&&r--,{anchorNode:e,anchorOffset:n,focusNode:o,focusOffset:r}}function ur(t,e){let o=t,n=[];for(;o!==e;)o!=null&&n.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return n}var dr=new Set(["Enter","Backspace","Delete","Escape","ArrowLeft","ArrowRight","ArrowUp","ArrowDown"]);function fs(t){let[e,o]=lt([]),[n,r]=lt(!1),[,i]=lt(""),[l,s]=lt(""),a=Vt(null),c=Vt(!1),u=Vt(null),d=ce(()=>t,[t]),m=ce(()=>{let T=t.getRootElement(),E=window.getSelection();return T==null||E==null||E.anchorNode==null||E.focusNode==null||!T.contains(E.anchorNode)||!T.contains(E.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
|
-
${e.map(
|
|
30
|
+
${e.map(us).join(`
|
|
31
31
|
`)}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
`},[t,e]),p=ae((T,E)=>{o(_=>{let L=e.length-1,y=e[L];if(y&&y.name===T){if(T==="type")return[...e.slice(0,L),{...y,value:y.value+E}];if(y.value===E)return[...e.slice(0,L),{...y,count:y.count+1}]}return[..._,{name:T,count:1,value:E}]})},[e,o]);nr(()=>{let T=_=>{if(!n)return;let L=_.key;hs(_)?p("selectAll",""):lr.has(L)?p("press",_.key):[...L].length>1?p("keydown",_.key):p("type",_.key)},E=_=>{if(!n)return;let L=_.key;!lr.has(L)&&[...L].length>1&&p("keyup",_.key)};return t.registerRootListener((_,L)=>{L!==null&&(L.removeEventListener("keydown",T),L.removeEventListener("keyup",E)),_!==null&&(_.addEventListener("keydown",T),_.addEventListener("keyup",E))})},[t,n,p]),nr(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),Gt(()=>{if(e){let T=m();T!==null&&s(T),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),Gt(()=>t.registerUpdateListener(({dirtyElements:E,dirtyLeaves:_,editorState:L})=>{if(!n)return;let y=L._selection,R=a.current,N=c.current;if(R!==y){if(_.size===0&&E.size===0&&!N){let f=window.getSelection();if(f&&(f.anchorNode==null||f.focusNode==null))return}a.current=y}c.current=!1;let g=m();g!==null&&s(g)}),[t,m,n,p]),Gt(()=>n?t.registerUpdateListener(()=>{let E=t.getRootElement();E!==null&&i(E?.innerHTML)}):void 0,[t,n]);let h=ae(T=>{n||(T.update(()=>{let E=ds();E.clear();let _=us();E.append(cs().append(_)),_.select()}),o([])),r(E=>!E)},[n]),C=ae(()=>{if(!n)return;let T=window.getSelection();if(T===null||T.anchorNode==null||T.focusNode==null)return;let{anchorNode:E,anchorOffset:_,focusNode:L,focusOffset:y}=gs(T),R=d().getRootElement(),N;E!==null&&(N=ir(E,R));let g;L!==null&&(g=ir(L,R)),p("snapshot",{anchorNode:E,anchorOffset:_,anchorPath:N,focusNode:L,focusOffset:y,focusPath:g})},[p,n,d]),b=ae(()=>{ms(m())},[m]),x=ae(()=>{ps("test.js",m())},[m]);return[ce("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:T=>{h(d()),T.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?Wt("div",{className:"test-recorder-output",children:[Wt("div",{className:"test-recorder-toolbar",children:[ce("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:T=>{C(),T.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),ce("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:T=>{b(),T.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),ce("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:T=>{x(),T.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),ce("pre",{id:"test-recorder",ref:u,children:l})]}):null]}var ar=()=>{let[t]=as(),[e,o]=Cs(t);return Wt(sr.Fragment,{children:[ce("p",{children:"HI"}),e,o,ce("p",{children:"DONE"})]})};var xs=S({plugins:[{Component:ar,position:"bottom"}]});import{c as bs}from"react/compiler-runtime";import{jsx as _s}from"react/jsx-runtime";import{useLexicalComposerContext as Ts}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Es}from"@lexical/react/LexicalTreeView.js";import"react";var cr=()=>{let t=bs(2),[e]=Ts(),o;return t[0]!==e?(o=_s(Es,{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"}),t[0]=e,t[1]=o):o=t[1],o};var ws=S({plugins:[{Component:cr,position:"bottom"}]});import{$isRangeSelection as Ns,FORMAT_TEXT_COMMAND as ks}from"lexical";import{jsx as ur}from"react/jsx-runtime";import"react";var dr=()=>ur("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:ur("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 U=t=>({type:"buttons",items:t,key:"format",order:40});var mr={type:"text-format",format:["bold","italic"],tag:"***"},pr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},fr={type:"text-format",format:["bold"],tag:"**"},hr={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var gr=[U([{ChildComponent:dr,isActive:({selection:t})=>Ns(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(ks,"bold")},order:1}])],Ls=S(({featureProviderMap:t})=>{let e=[fr,hr];return t.get("italic")&&e.push(pr,mr),{markdownTransformers:e,toolbarFixed:{groups:gr},toolbarInline:{groups:gr}}});import{$isRangeSelection as Rs,FORMAT_TEXT_COMMAND as Ss}from"lexical";import{jsx as Cr,jsxs as Is}from"react/jsx-runtime";import"react";var xr=()=>Is("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:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Cr("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var br={type:"text-format",format:["code"],tag:"`"};var _r=[U([{ChildComponent:xr,isActive:({selection:t})=>Rs(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Ss,"code")},order:7}])],ys=S({markdownTransformers:[br],toolbarFixed:{groups:_r},toolbarInline:{groups:_r}});import{$isRangeSelection as Ms,FORMAT_TEXT_COMMAND as vs}from"lexical";import{jsx as Tr}from"react/jsx-runtime";import"react";var Er=()=>Tr("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tr("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var wr={type:"text-format",format:["italic"],tag:"*"},Nr={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var kr=[U([{ChildComponent:Er,isActive:({selection:t})=>Ms(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(vs,"italic")},order:2}])],As=S({markdownTransformers:[wr,Nr],toolbarFixed:{groups:kr},toolbarInline:{groups:kr}});import{$isRangeSelection as Ds,FORMAT_TEXT_COMMAND as Os}from"lexical";import{jsx as Lr,jsxs as Fs}from"react/jsx-runtime";import"react";var Ir=()=>Fs("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:"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"}),Lr("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Rr={type:"text-format",format:["strikethrough"],tag:"~~"};var Sr=[U([{ChildComponent:Ir,isActive:({selection:t})=>Ds(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Os,"strikethrough")},order:4}])],Ps=S({markdownTransformers:[Rr],toolbarFixed:{groups:Sr},toolbarInline:{groups:Sr}});import{$isRangeSelection as $s,FORMAT_TEXT_COMMAND as Hs}from"lexical";import{jsx as yr}from"react/jsx-runtime";import"react";var Mr=()=>yr("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:yr("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var vr=[U([{ChildComponent:Mr,isActive:({selection:t})=>$s(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Hs,"subscript")},order:5}])],Bs=S({toolbarFixed:{groups:vr},toolbarInline:{groups:vr}});import{$isRangeSelection as js,FORMAT_TEXT_COMMAND as Gs}from"lexical";import{jsx as Ar}from"react/jsx-runtime";import"react";var Fr=()=>Ar("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ar("path",{d:"M10.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 Dr=[U([{ChildComponent:Fr,isActive:({selection:t})=>js(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Gs,"superscript")},order:6}])],Us=S({toolbarFixed:{groups:Dr},toolbarInline:{groups:Dr}});import{$isRangeSelection as Vs,FORMAT_TEXT_COMMAND as Ks}from"lexical";import{jsx as Or,jsxs as Ws}from"react/jsx-runtime";import"react";var Pr=()=>Ws("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:"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"}),Or("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var $r=[U([{ChildComponent:Pr,isActive:({selection:t})=>Vs(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Ks,"underline")},order:3}])],zs=S({toolbarFixed:{groups:$r},toolbarInline:{groups:$r}});import{$createHeadingNode as Js,$isHeadingNode as qr,HeadingNode as qs}from"@lexical/rich-text";import{$setBlocksType as Qs}from"@lexical/selection";import{$getSelection as ea,$isRangeSelection as ta}from"lexical";import{jsx as Hr}from"react/jsx-runtime";import"react";var Br=()=>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:"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 jr}from"react/jsx-runtime";import"react";var Gr=()=>jr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jr("path",{d:"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 Ur}from"react/jsx-runtime";import"react";var Wr=()=>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.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 Vr}from"react/jsx-runtime";import"react";var Kr=()=>Vr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Vr("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.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 zr}from"react/jsx-runtime";import"react";var Zr=()=>zr("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:zr("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";import"react";var Xr=()=>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 Zs,$isHeadingNode as Ys,HeadingNode as Xs}from"@lexical/rich-text";var Vt=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var Jr=t=>{let o=`^(${t.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[Xs],export:(r,i)=>{if(!Ys(r))return null;let l=Number(r.getTag().slice(1));return"#".repeat(l)+" "+i(r)},regExp:n,replace:Vt(r=>{let i="h"+r[1].length;return Zs(i)})}};var Qr=t=>{let e=ea();Qs(e,()=>Js(t))},en={h1:Br,h2:Gr,h3:Wr,h4:Kr,h5:Zr,h6:Xr},oa=S(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[W(e.map((n,r)=>({ChildComponent:en[n],isActive:({selection:i})=>{if(!ta(i))return!1;for(let l of i.getNodes()){if(qr(l)&&l.getTag()===n)continue;let s=l.getParent();if(!(qr(s)&&s.getTag()===n))return!1}return!0},key:n,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{Qr(n)})},order:r+2})))];return{markdownTransformers:[Jr(e)],nodes:[qs],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[G(e.map(n=>({Icon:en[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{Qr(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as da}from"lexical";import{jsx as tn}from"react/jsx-runtime";import"react";var Kt=()=>tn("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:tn("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as on,jsxs as ra}from"react/jsx-runtime";import"react";var rn=()=>ra("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[on("path",{d:"M5 10h10",stroke:"currentColor"}),on("path",{d:"M10 15V5",stroke:"currentColor"})]});var J=t=>({type:"dropdown",ChildComponent:rn,items:t,key:"add",order:10});var nn={type:"element",dependencies:[Ze],export:(t,e)=>Xe(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Ye();e&&t.replace(e)}};import{c as na}from"react/compiler-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as la}from"@lexical/utils";import{$getSelection as sa,$isRangeSelection as aa,COMMAND_PRIORITY_EDITOR as ca}from"lexical";import{useEffect as ua}from"react";var ln=()=>{let t=na(3),[e]=ia(),o,n;return t[0]!==e?(o=()=>e.registerCommand(ke,r=>{let i=sa();if(!aa(i))return!1;if(i.focus.getNode()!==null){let s=Ye();la(s)}return!0},ca),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ua(o,n),null};var ma=S({markdownTransformers:[nn],nodes:[Ze],plugins:[{Component:ln,position:"normal"}],slashMenu:{groups:[G([{Icon:Kt,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(ke,void 0)}}])]},toolbarFixed:{groups:[J([{ChildComponent:Kt,isActive:({selection:t})=>{if(!da(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Xe(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(ke,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as ha,OUTDENT_CONTENT_COMMAND as ga}from"lexical";import{jsx as st,jsxs as pa}from"react/jsx-runtime";import"react";var sn=()=>pa("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:[st("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as at,jsxs as fa}from"react/jsx-runtime";import"react";var an=()=>fa("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[at("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var cn=t=>({type:"buttons",items:t,key:"indent",order:35});var un=[cn([{ChildComponent:sn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes())if("__indent"in e&&e.__indent>0||e.getParent()&&"__indent"in e.getParent()&&e.getParent().__indent>0)return!0;return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ga,void 0)},order:1},{ChildComponent:an,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ha,void 0)},order:2}])],Ca=S({toolbarFixed:{groups:un},toolbarInline:{groups:un}});import{$findMatchingParent as Ic}from"@lexical/utils";import{$getSelection as eo,$isRangeSelection as Bn}from"lexical";import{jsx as dn}from"react/jsx-runtime";import"react";var mn=()=>dn("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:dn("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 pn}from"@lexical/selection";function pe(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?pn(o)?n:r:pn(e)?n:r}var zt=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Ra,$isTextNode as Sa}from"lexical";import{addClassNamesToElement as xa,isHTMLAnchorElement as ba}from"@lexical/utils";import Xt from"bson-objectid";import{$applyNodeReplacement as _a,$createTextNode as fn,$getSelection as Ta,$isElementNode as hn,$isRangeSelection as Yt,createCommand as Ea,ElementNode as wa}from"lexical";var Na=new Set(["http:","https:","mailto:","sms:","tel:"]),V=class t extends wa{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:void 0},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:ka,priority:1})}}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Xt.default().toHexString(),e.version=3);let o=q({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){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=Zt(o.rel,"add","noopener")),xa(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,n){if(!Yt(o))return!1;let r=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(hn(n)){let r=q({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!Na.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,n){let r=this.__fields?.url,i=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Zt(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Zt(o.rel,"remove","noopener"))),!1}};function ka(t){let e=null;if(ba(t)){let o=t.textContent;o!==null&&o!==""&&(e=q({id:new Xt.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function q({id:t,fields:e}){return _a(new V({id:t??new Xt.default().toHexString(),fields:e}))}function j(t){return t instanceof V}var Y=Ea("TOGGLE_LINK_COMMAND");function gn(t){let e=Ta();if(!Yt(e)&&!t.selectedNodes.length)return;let o=Yt(e)?e.extract():t.selectedNodes;if(t===null)o.forEach(n=>{let r=n.getParent();if(j(r)){let i=r.getChildren();for(let l=0;l<i.length;l+=1)r.insertBefore(i[l]);r.remove()}});else{if(o.length===1){let i=o[0],l=j(i)?i:La(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(fn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let n=null,r=null;o.forEach(i=>{let l=i.getParent();if(!(l===r||l===null||hn(i)&&!i.isInline())){if(j(l)){r=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(fn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(n)||(n=l,r=q({fields:t.fields}),j(l)?i.getPreviousSibling()===null?l.insertBefore(r):l.insertAfter(r):i.insertBefore(r)),j(i)){if(i.is(r))return;if(r!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)r.append(s[a])}i.remove();return}r!==null&&r.append(i)}})}}function La(t){return Ia(t,e=>j(e))}function Ia(t,e){let o=t;for(;o!==null&&(o=o.getParent())!==null&&!e(o););return o}function Zt(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let i=new RegExp(o,"g");r=r.replace(i,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let i=new RegExp(o,"g");n=r.replace(i,"").trim()}return n}var Cn={type:"text-match",dependencies:[V],export:(t,e,o)=>{if(!j(t))return null;let n=t,{url:r}=n.getFields(),i=`[${n.getTextContent()}](${r})`,l=n.getFirstChild();return n.getChildrenSize()===1&&Sa(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,n]=e,r=q({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),i=Ra(o);i.setFormat(t.getFormat()),r.append(i),t.replace(r)},trigger:")"};import{$applyNodeReplacement as ya,$isElementNode as Ma}from"lexical";var Q=class t extends V{static clone(e){return new t({id:void 0,fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2);let o=Oe({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(Ma(n)){let r=Oe({fields:this.__fields});return n.append(r),r}return null}};function Oe({fields:t}){return ya(new Q({id:void 0,fields:t}))}function ee(t){return t instanceof Q}import{c as va}from"react/compiler-runtime";import{useLexicalComposerContext as Aa}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Fa}from"@lexical/utils";import{$createTextNode as xn,$getSelection as Da,$isElementNode as _n,$isLineBreakNode as Tn,$isNodeSelection as Oa,$isRangeSelection as Pa,$isTextNode as Pe,TextNode as $a}from"lexical";import{useEffect as Ha}from"react";function bn(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function En(t,e){for(let o=0;o<e.length;o++){let n=e[o](t);if(n!=null)return n}return null}var Ba=/[.,;\s]/;function ut(t){return Ba.test(t)}function wn(t){return ut(t[t.length-1])}function qt(t){return ut(t[0])}function ja(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Nn(t){let e=t.getPreviousSibling();return _n(e)&&(e=e.getLastDescendant()),e===null||Tn(e)||Pe(e)&&wn(e.getTextContent())}function kn(t){let e=t.getNextSibling();return _n(e)&&(e=e.getFirstDescendant()),e===null||Tn(e)||Pe(e)&&qt(e.getTextContent())}function Ga(t,e,o,n){return(t>0?ut(o[t-1]):Nn(n[0]))?e<o.length?ut(o[e]):kn(n[n.length-1]):!1}function Ua(t,e,o){let n=[],r=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let c=a[0],d=c.getTextContent().length,m=s;s+d<=e?(n.push(c),l+=d):m>=o?i.push(c):r.push(c),s+=d,a.shift()}return[l,n,r,i]}function Wa(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},i=Oe({fields:r});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=xn(n.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let c=[],u;for(let h=1;h<t.length;h++){let C=t[h],x=C.getTextContent().length,v=s,A=s+x;if(v<o)if(A<=o)c.push(C);else{let[T,E]=C.splitText(o-v);c.push(T),u=E}s+=x}let d=Da(),m=d?d.getNodes().find(Pe):void 0,p=xn(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...c),m&&m===a&&(Pa(d)?p.select(d.anchor.offset,d.focus.offset):Oa(d)&&p.select(0,p.getTextContent().length)),a.replace(i),u}}function Va(t,e,o){let n=[...t],r=n.map(a=>a.getTextContent()).join(""),i=r,l,s=0;for(;(l=En(i,e))!=null&&l!==null;){let a=l.index,c=l.length,u=a+c;if(Ga(s+a,s+u,r,n)){let[m,,p,h]=Ua(n,s+a,s+u),C=s+a-m,b=s+u-m,x=Wa(p,C,b,l);n=x?[x,...h]:h,o(l.url,null),s=0}else s+=u;i=i.substring(u)}}function Jt(t,e,o){let n=t.getChildren(),r=n.length;for(let a=0;a<r;a++){let c=n[a];if(!Pe(c)||!c.isSimpleText()){ct(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=En(i,e);if(l===null||l.text!==i){ct(t),o(null,t.getFields()?.url??null);return}if(!Nn(t)||!kn(t)){ct(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function Ka(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),i=t.getTextContent();if(ee(n)){let l=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:"):!1;(!qt(i)||ja(i,l))&&(n.append(t),Jt(n,e,o),o(null,n.getFields()?.url??null))}ee(r)&&!wn(i)&&(ct(r),Jt(r,e,o),o(null,r.getFields()?.url??null))}function ct(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function za(t){let e=[t],o=t.getNextSibling();for(;o!==null&&Pe(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Za(t,e,o){let n=va(5),r,i;n[0]!==t||n[1]!==o||n[2]!==e?(r=()=>{if(!t.hasNodes([Q]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return Fa(t.registerNodeTransform($a,s=>{let a=s.getParentOrThrow(),c=s.getPreviousSibling();if(ee(a))Jt(a,e,l);else if(!j(a)){if(s.isSimpleText()&&(qt(s.getTextContent())||!ee(c))){let u=za(s);Va(u,e,l)}Ka(s,e,l)}}))},i=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=r,n[4]=i):(r=n[3],i=n[4]),Ha(r,i)}var Ya=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Xa=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Ja=[bn(Ya,t=>t.startsWith("http")?t:`https://${t}`),bn(Xa,t=>`mailto:${t}`)],Ln=()=>{let[t]=Aa();return Za(t,Ja),null};import{jsx as qa}from"react/jsx-runtime";import{ClickableLinkPlugin as Qa}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var In=()=>qa(Qa,{});import{jsx as hc}from"react/jsx-runtime";import"react";import{createPortal as gc}from"react-dom";import{jsx as ie,jsxs as Qt}from"react/jsx-runtime";import{useLexicalComposerContext as tc}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as Rn,mergeRegister as Sn}from"@lexical/utils";import{getTranslation as oc}from"@payloadcms/translations";import{CloseMenuIcon as rc,EditIcon as nc,formatDrawerSlug as ic,useConfig as lc,useEditDepth as sc,useModal as ac,useTranslation as cc}from"@payloadcms/ui";import{$getSelection as yn,$isLineBreakNode as uc,$isRangeSelection as Mn,COMMAND_PRIORITY_HIGH as dc,COMMAND_PRIORITY_LOW as vn,KEY_ESCAPE_COMMAND as mc,SELECTION_CHANGE_COMMAND as pc}from"lexical";import An,{useCallback as Fn,useEffect as pt,useRef as fc,useState as fe}from"react";function dt(t,e,o,n=10,r=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),c=t.top-n,u=t.left-r;c<a.top&&(c+=l.height+t.height+n*2),u+l.width>a.right&&(u=a.right-l.width-r),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as ec}from"lexical";var mt=ec("TOGGLE_LINK_WITH_MODAL_COMMAND");function Dn({anchorElem:t}){let[e]=tc(),o=fc(null),[n,r]=fe(null),[i,l]=fe(null),{uuid:s}=P(),{config:a}=lc(),{i18n:c,t:u}=cc(),[d,m]=fe(null),{closeModal:p,toggleModal:h}=ac(),C=sc(),[b,x]=fe(!1),[v,A]=fe([]),[T,E]=fe(!1),_=ic({slug:"lexical-rich-text-link-"+s,depth:C}),L=Fn(()=>{x(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),E(!1),r(null),l(null),A([]),m(null)},[x,r,l,A]),y=Fn(()=>{let R=yn(),N=null;if(!Mn(R)||!R){L();return}let g=pe(R);N=e.getElementByKey(g.getKey())?.getBoundingClientRect();let f=Rn(g,j),I=R.getNodes().filter(H=>!uc(H)).find(H=>{let B=Rn(H,j);return f&&!f.is(B)||B&&!B.is(f)});if(f==null||I){L();return}let k={doc:void 0,linkType:void 0,newTab:void 0,url:"",...f.getFields(),id:f.getID(),text:f.getTextContent()};if(f.getFields()?.linkType==="custom")r(f.getFields()?.url??null),l(null);else{r(`/admin/collections/${f.getFields()?.doc?.relationTo}/${f.getFields()?.doc?.value}`);let H=a.collections.find(B=>B.slug===f.getFields()?.doc?.relationTo);if(!H)l(f.getFields()?.label?String(f.getFields()?.label):null),r(f.getFields()?.url?String(f.getFields()?.url):null);else{let B=u("fields:linkedTo",{label:oc(H.labels.singular,c)}).replace(/<[^>]*>?/g,"");l(B)}}m(k),x(!0),A(R?R?.getNodes():[]),ee(f)?E(!0):E(!1);let w=o.current,M=window.getSelection(),{activeElement:F}=document;if(w===null)return;let O=e.getRootElement();return M!==null&&O!==null&&O.contains(M.anchorNode)?(N||(N=M.getRangeAt(0).getBoundingClientRect()),N!=null&&(N.y+=40,dt(N,w,t))):(F==null||F.className!=="link-input")&&(O!==null&&dt(null,w,t),r(null),l(null)),!0},[e,L,a.collections,u,c,t]);return pt(()=>Sn(e.registerCommand(mt,R=>(e.dispatchCommand(Y,R),y(),h(_),!0),vn)),[e,y,h,_]),pt(()=>{let R=t.parentElement,N=()=>{e.getEditorState().read(()=>{y()})};return window.addEventListener("resize",N),R?.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),R?.removeEventListener("scroll",N)}},[t.parentElement,e,y]),pt(()=>Sn(e.registerUpdateListener(({editorState:R})=>{R.read(()=>{y()})}),e.registerCommand(pc,()=>(y(),!0),vn),e.registerCommand(mc,()=>b?(L(),!0):!1,dc)),[e,y,b,L]),pt(()=>{e.getEditorState().read(()=>{y()})},[e,y]),Qt(An.Fragment,{children:[ie("div",{className:"link-editor",ref:o,children:Qt("div",{className:"link-input",children:[n&&n.length>0?ie("a",{href:n,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:n}):i!=null&&i.length>0?ie("span",{className:"link-input__label-pure",children:i}):null,e.isEditable()&&Qt(An.Fragment,{children:[ie("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{h(_)},onMouseDown:R=>{R.preventDefault()},tabIndex:0,type:"button",children:ie(nc,{})}),!T&&ie("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(Y,null)},onMouseDown:R=>{R.preventDefault()},tabIndex:0,type:"button",children:ie(rc,{})})]})]})}),ie(se,{className:"lexical-link-edit-drawer",data:d,drawerSlug:_,drawerTitle:u("fields:editLink"),featureKey:"link",handleDrawerSubmit:(R,N)=>{p(_);let g=N,f={...g};delete f.text,e.update(()=>{let I=yn(),k=null;if(Mn(I)?k=pe(I).getParent():v.length&&(k=v[0].getParent()),k&&ee(k)){let w=q({fields:f});k.replace(w,!0)}}),e.dispatchCommand(Y,{fields:f,selectedNodes:v,text:g.text})},schemaPathSuffix:"fields"})]})}var On=t=>{let{anchorElem:e=document.body}=t;return gc(hc(Dn,{anchorElem:e}),e)};import{c as bc}from"react/compiler-runtime";import{useLexicalComposerContext as _c}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Tc}from"@lexical/utils";import{$getSelection as Ec,$isElementNode as wc,$isRangeSelection as Nc,COMMAND_PRIORITY_LOW as $n,PASTE_COMMAND as kc}from"lexical";import{useEffect as Lc}from"react";var Cc=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,xc=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Pn(t){if(!t)return!1;if(t==="https://"||Cc.test(t)||xc.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Hn=()=>{let t=bc(3),[e]=_c(),o,n;return t[0]!==e?(o=()=>{if(!e.hasNodes([V]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Tc(e.registerCommand(Y,r=>(gn(r),!0),$n),e.registerCommand(kc,r=>{let i=Ec();if(!Nc(i)||i.isCollapsed()||!(r instanceof ClipboardEvent)||r.clipboardData==null)return!1;let l=r.clipboardData.getData("text");if(!Pn(l))return!1;if(!i.getNodes().some(s=>wc(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(Y,{fields:s,text:null}),r.preventDefault(),!0}return!1},$n))},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Lc(o,n),null};var jn=[zt([{ChildComponent:mn,isActive:({selection:t})=>{if(Bn(t)){let e=pe(t);return Ic(e,j)!=null}return!1},isEnabled:({selection:t})=>!!(Bn(t)&&eo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(Y,null);else{let o=null,n=[];if(t.getEditorState().read(()=>{o=eo()?.getTextContent(),n=eo()?.getNodes()??[]}),!o?.length)return;let r={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(mt,{fields:r,selectedNodes:n,text:o})}},order:1}])],Rc=S({markdownTransformers:[Cn],nodes:[V,Q],plugins:[{Component:Hn,position:"normal"},{Component:Ln,position:"normal"},{Component:In,position:"normal"},{Component:On,position:"floatingAnchorElem"}],toolbarFixed:{groups:jn},toolbarInline:{groups:jn}});import{$isListNode as ro,INSERT_CHECK_LIST_COMMAND as zn,ListItemNode as Bc,ListNode as jc}from"@lexical/list";import{$isRangeSelection as Gc}from"lexical";import{jsx as Gn,jsxs as Sc}from"react/jsx-runtime";import"react";var to=()=>Sc("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:[Gn("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Gn("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as yc}from"react/jsx-runtime";import{ListPlugin as Mc}from"@lexical/react/LexicalListPlugin.js";import"react";var he=()=>yc(Mc,{});function ge(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Dc,ListItemNode as Oc,ListNode as Pc}from"@lexical/list";import{$createListItemNode as vc,$createListNode as Ac,$isListItemNode as Fc,$isListNode as oo}from"@lexical/list";var Un=4,Ce=t=>(e,o,n)=>{let r=e.getPreviousSibling(),i=e.getNextSibling(),l=vc(t==="check"?n[3]==="x":void 0);if(oo(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(oo(r)&&r.getListType()===t)r.append(l),e.remove();else{let a=Ac(t,t==="number"?Number(n[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(n[1].length/Un);s&&l.setIndent(s)},ue=(t,e,o)=>{let n=[],r=t.getChildren(),i=0;for(let l of r)if(Fc(l)){if(l.getChildrenSize()===1){let u=l.getFirstChild();if(oo(u)){n.push(ue(u,e,o+1));continue}}let s=" ".repeat(o*Un),a=t.getListType(),c=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";n.push(s+c+e(l)),i++}return n.join(`
|
|
35
|
-
`)};var Wn={type:"element",dependencies:[Pc,Oc],export:(t,e)=>Dc(t)?ue(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Ce("check")};import{jsx as $c}from"react/jsx-runtime";import{CheckListPlugin as Hc}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Vn=()=>$c(Hc,{});var Kn=[W([{ChildComponent:to,isActive:({selection:t})=>{if(!Gc(t))return!1;for(let e of t.getNodes()){if(ro(e)&&e.getListType()==="check")continue;let o=e.getParent();if(ro(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(ro(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(zn,void 0)},order:12}])],Uc=S(({featureProviderMap:t})=>{let e=[{Component:Vn,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:he,position:"normal"}),{markdownTransformers:[Wn],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[jc,Bc],plugins:e,slashMenu:{groups:[ge([{Icon:to,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(zn,void 0)}}])]},toolbarFixed:{groups:Kn},toolbarInline:{groups:Kn}}});import{$isListNode as io,INSERT_ORDERED_LIST_COMMAND as Xn,ListItemNode as Zc,ListNode as Yc}from"@lexical/list";import{$isRangeSelection as Xc}from"lexical";import{jsx as $e,jsxs as Wc}from"react/jsx-runtime";import"react";var no=()=>Wc("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:[$e("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"}),$e("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"}),$e("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),$e("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),$e("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Vc,ListItemNode as Kc,ListNode as zc}from"@lexical/list";var Zn={type:"element",dependencies:[zc,Kc],export:(t,e)=>Vc(t)?ue(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Ce("number")};var Yn=[W([{ChildComponent:no,isActive:({selection:t})=>{if(!Xc(t))return!1;for(let e of t.getNodes()){if(io(e)&&e.getListType()==="number")continue;let o=e.getParent();if(io(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(io(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Xn,void 0)},order:10}])],Jc=S(({featureProviderMap:t})=>({markdownTransformers:[Zn],nodes:t.has("orderedList")?[]:[Yc,Zc],plugins:t.has("orderedList")?[]:[{Component:he,position:"normal"}],slashMenu:{groups:[ge([{Icon:no,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Xn,void 0)}}])]},toolbarFixed:{groups:Yn},toolbarInline:{groups:Yn}}));import{$isListNode as so,INSERT_UNORDERED_LIST_COMMAND as Qn,ListItemNode as ou,ListNode as ru}from"@lexical/list";import{$isRangeSelection as nu}from"lexical";import{jsx as xe,jsxs as qc}from"react/jsx-runtime";import"react";var lo=()=>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:[xe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),xe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),xe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),xe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),xe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),xe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Qc,ListItemNode as eu,ListNode as tu}from"@lexical/list";var Jn={type:"element",dependencies:[tu,eu],export:(t,e)=>Qc(t)?ue(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Ce("bullet")};var qn=[W([{ChildComponent:lo,isActive:({selection:t})=>{if(!nu(t))return!1;for(let e of t.getNodes()){if(so(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(so(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(so(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qn,void 0)},order:11}])],iu=S({markdownTransformers:[Jn],nodes:[ru,ou],plugins:[{Component:he,position:"normal"}],slashMenu:{groups:[ge([{Icon:lo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qn,void 0)}}])]},toolbarFixed:{groups:qn},toolbarInline:{groups:qn}});import{jsx as lu}from"react/jsx-runtime";import{addClassNamesToElement as su}from"@lexical/utils";import{DecoratorNode as au}from"lexical";import*as ei from"react";var cu=ei.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),He=class t extends au{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return uu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return su(o,"unknownConverted"),o}decorate(){return lu(cu,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function uu({data:t}){return new He({data:t})}var du=S(()=>({nodes:[He]}));import{jsx as mu}from"react/jsx-runtime";import{addClassNamesToElement as pu}from"@lexical/utils";import{DecoratorNode as fu}from"lexical";import*as ti from"react";var hu=ti.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Be=class t extends fu{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return gu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return pu(o,"unknownConverted"),o}decorate(){return mu(hu,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function gu({data:t}){return new Be({data:t})}var Cu=S(()=>({nodes:[Be]}));import{$setBlocksType as ni}from"@lexical/selection";import{$createParagraphNode as ii,$getSelection as li,$isParagraphNode as oi,$isRangeSelection as xu}from"lexical";var ri=[W([{ChildComponent:Fe,isActive:({selection:t})=>{if(!xu(t))return!1;for(let e of t.getNodes())if(!oi(e)&&!oi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=li();ni(e,()=>ii())})},order:1}])],bu=S({slashMenu:{groups:[G([{Icon:Fe,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=li();ni(e,()=>ii())})}}])]},toolbarFixed:{groups:ri},toolbarInline:{groups:ri}});import{$isNodeSelection as Hu}from"lexical";import{jsx as je,jsxs as _u}from"react/jsx-runtime";import"react";var ao=()=>_u("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("g",{clipPath:"url(#clip0_4397_10817)",children:je("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"})}),je("defs",{children:je("clipPath",{id:"clip0_4397_10817",children:je("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as Iu}from"react/compiler-runtime";import{jsx as Ru}from"react/jsx-runtime";import{useLexicalComposerContext as Su}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as yu}from"@lexical/utils";import{useConfig as Mu}from"@payloadcms/ui";import{$getPreviousSelection as vu,$getSelection as Au,$isParagraphNode as di,$isRangeSelection as Fu,COMMAND_PRIORITY_EDITOR as Du,createCommand as Ou}from"lexical";import{useEffect as Pu}from"react";import{c as Tu}from"react/compiler-runtime";import{jsx as ft}from"react/jsx-runtime";import{useLexicalComposerContext as Eu}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as wu}from"@payloadcms/ui";import{$getNodeByKey as Nu,COMMAND_PRIORITY_EDITOR as ku}from"lexical";import{useEffect as si,useState as ai}from"react";var Lu=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=Nu(o);r&&r.replace(Re({relationTo:e,value:n}))}):t.dispatchCommand(co,{relationTo:e,value:n})},ci=t=>{let e=Tu(21),{enabledCollectionSlugs:o}=t,[n]=Eu(),r;e[0]!==o?(r=()=>o[0],e[0]=o,e[1]=r):r=e[1];let[i,l]=ai(r),[s,a]=ai(null),c;e[2]!==o||e[3]!==i?(c={collectionSlugs:o,selectedCollection:i},e[2]=o,e[3]=i,e[4]=c):c=e[4];let[u,d,m]=wu(c),{closeDrawer:p,isDrawerOpen:h,openDrawer:C}=m,b,x;e[5]!==n||e[6]!==C?(b=()=>n.registerCommand(Le,L=>(a(L?.replace?L?.replace.nodeKey:null),C(),!0),ku),x=[n,C],e[5]=n,e[6]=C,e[7]=b,e[8]=x):(b=e[7],x=e[8]),si(b,x);let v;e[9]!==n||e[10]!==s||e[11]!==p?(v=L=>{let{collectionSlug:y,docID:R}=L;Lu({editor:n,relationTo:y,replaceNodeKey:s,value:R}),p()},e[9]=n,e[10]=s,e[11]=p,e[12]=v):v=e[12];let A=v,T;e[13]!==o?(T=()=>{l(o[0])},e[13]=o,e[14]=T):T=e[14];let E;e[15]!==h||e[16]!==o?(E=[h,o],e[15]=h,e[16]=o,e[17]=E):E=e[17],si(T,E);let _;return e[18]!==A||e[19]!==u?(_=ft(u,{onSelect:A}),e[18]=A,e[19]=u,e[20]=_):_=e[20],_},ui=t=>t?.enabledCollectionSlugs?.length>0?ft(ci,{...t}):ft(Je,{...t,children:ft(ci,{...t})});var co=Ou("INSERT_RELATIONSHIP_COMMAND"),mi=t=>{let e=Iu(10),{clientProps:o}=t,[n]=Su(),{config:r}=Mu(),{collections:i}=r,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let u;if(e[0]!==o||e[1]!==i){let d;e[3]!==o?(d=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o,e[4]=d):d=e[4],u=i.filter(d).map($u),e[0]=o,e[1]=i,e[2]=u}else u=e[2];l=u}let s,a;e[5]!==n?(s=()=>{if(!n.hasNodes([Ie]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(co,u=>{let d=Au()||vu();if(Fu(d)){let m=Re(u);yu(m);let{focus:p}=d,h=p.getNode();di(h)&&h.getTextContentSize()===0&&h.getParent().getChildren().filter(C=>di(C)).length>1&&h.remove()}return!0},Du)},a=[n],e[5]=n,e[6]=s,e[7]=a):(s=e[6],a=e[7]),Pu(s,a);let c;return e[8]!==l?(c=Ru(ui,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function $u(t){let{slug:e}=t;return e}var Bu=S({nodes:[Ie],plugins:[{Component:mi,position:"normal"}],slashMenu:{groups:[G([{Icon:ao,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Le,{replace:!1})}}])]},toolbarFixed:{groups:[J([{ChildComponent:ao,isActive:({selection:t})=>{if(!Hu(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vt(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Le,{replace:!1})}}])]}});import{c as ed}from"react/compiler-runtime";import{jsx as z,jsxs as td}from"react/jsx-runtime";import{useLexicalComposerContext as od}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as rd,useThrottledEffect as nd,useTranslation as id}from"@payloadcms/ui";import*as te from"react";import{useMemo as ld}from"react";import{jsx as ju}from"react/jsx-runtime";import{mergeRegister as Gu}from"@lexical/utils";import{$getSelection as Uu}from"lexical";import{useCallback as Wu,useEffect as ht,useState as uo}from"react";var mo="toolbar-popup__button",Ge=({children:t,editor:e,item:o})=>{let[n,r]=uo(!0),[i,l]=uo(!1),[s,a]=uo(mo),c=P(),u=Wu(()=>{e.getEditorState().read(()=>{let d=Uu();if(o.isActive){let m=o.isActive({editor:e,editorConfigContext:c,selection:d});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:e,editorConfigContext:c,selection:d});n!==m&&r(m)}})},[i,e,c,n,o]);return ht(()=>{u()},[u]),ht(()=>(document.addEventListener("mouseup",u),()=>{document.removeEventListener("mouseup",u)}),[u]),ht(()=>Gu(e.registerUpdateListener(()=>{u()})),[e,u]),ht(()=>{a([mo,n===!1?"disabled":"",i?"active":"",o?.key?`${mo}-`+o.key:""].filter(Boolean).join(" "))},[n,i,s,o.key]),ju("button",{className:s,onClick:()=>{if(n!==!1)return e._updateTags=new Set([...e._updateTags,"toolbar"]),e.focus(()=>{o.onSelect({editor:e,isActive:i})}),!0},onMouseDown:d=>{d.preventDefault()},type:"button",children:t})};import{c as bi}from"react/compiler-runtime";import{jsx as We,jsxs as Yu}from"react/jsx-runtime";import Ci,{useEffect as xi}from"react";import{mergeRegister as Xu}from"@lexical/utils";import{useTranslation as Ju}from"@payloadcms/ui";import{$getSelection as qu}from"lexical";import{jsx as le,jsxs as pi}from"react/jsx-runtime";import gt,{useCallback as Vu,useEffect as Ue,useMemo as Ku,useRef as fo,useState as Ct}from"react";import{createPortal as zu}from"react-dom";var po="toolbar-popup__dropdown-item",fi=gt.createContext(null);function hi({active:t,children:e,editor:o,enabled:n,item:r,title:i}){let[l,s]=Ct(po);Ue(()=>{s([po,n===!1?"disabled":"",t?"active":"",r?.key?`${po}-${r.key}`:""].filter(Boolean).join(" "))},[n,t,l,r.key]);let a=fo(null),c=gt.useContext(fi);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return Ue(()=>{a?.current!=null&&u(a)},[a,u]),le("button",{className:l,onClick:()=>{n!==!1&&(o._updateTags=new Set([...o._updateTags,"toolbar"]),o.focus(()=>{r.onSelect({editor:o,isActive:t})}))},onMouseDown:d=>{d.preventDefault()},ref:a,title:i,type:"button",children:e})}function Zu({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:n}){let[r,i]=Ct(),[l,s]=Ct(),a=Vu(d=>{i(m=>m!=null?[...m,d]:[d])},[i]),c=d=>{if(r==null)return;let{key:m}=d;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&d.preventDefault(),m==="Escape"||m==="Tab"?n():m==="ArrowUp"?s(p=>{if(p==null)return r[0];let h=r.indexOf(p)-1;return r[h===-1?r.length-1:h]}):m==="ArrowDown"&&s(p=>p==null?r[0]:r[r.indexOf(p)+1])},u=Ku(()=>({registerItem:a}),[a]);return Ue(()=>{r!=null&&l==null&&s(r[0]),l!=null&&l?.current!=null&&l.current.focus()},[r,l]),le(fi.Provider,{value:u,children:le("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function gi({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,Icon:r,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=fo(null),c=fo(null),[u,d]=Ct(!1),m=()=>{d(!1),c?.current!=null&&c.current.focus()};Ue(()=>{let h=c.current,C=a.current;if(u&&h!==null&&C!==null){let{left:b,top:x}=h.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;C.style.top=`${x+v+h.offsetHeight+5}px`,C.style.left=`${Math.min(b-5,window.innerWidth-C.offsetWidth-20)}px`}},[a,c,u]),Ue(()=>{let h=c.current;if(h!==null&&u){let C=b=>{let{target:x}=b;s!=null&&a.current!=null&&a.current.contains(x)||h.contains(x)||d(!1)};return document.addEventListener("click",C),()=>{document.removeEventListener("click",C)}}},[a,c,u,s]);let p=zu(le(Zu,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return pi(gt.Fragment,{children:[pi("button",{"aria-label":t,className:e+(u?" active":""),disabled:n,onClick:h=>{h.preventDefault(),d(!u)},onMouseDown:h=>{h.preventDefault()},ref:c,type:"button",children:[r&&le(r,{}),l&&le("span",{className:"toolbar-popup__dropdown-label",children:l}),le("i",{className:"toolbar-popup__dropdown-caret"})]}),u&&le(gt.Fragment,{children:p})]})}var ho="toolbar-popup__dropdown",Qu=t=>{let e=bi(19),{active:o,anchorElem:n,editor:r,enabled:i,item:l}=t,{i18n:s}=Ju(),{field:a}=P(),{richTextComponentMap:c}=a;if(l.Component){let p;return e[0]!==l||e[1]!==o||e[2]!==n||e[3]!==r||e[4]!==i?(p=l?.Component&&We(l.Component,{active:o,anchorElem:n,editor:r,enabled:i,item:l},l.key),e[0]=l,e[1]=o,e[2]=n,e[3]=r,e[4]=i,e[5]=p):p=e[5],p}let u=l.key;if(l.label){let p;e[6]!==l||e[7]!==s||e[8]!==c?(p=typeof l.label=="function"?l.label({i18n:s,richTextComponentMap:c}):l.label,e[6]=l,e[7]=s,e[8]=c,e[9]=p):p=e[9],u=p}u.length>25&&(u=u.substring(0,25)+"...");let d;e[10]!==l?(d=l?.ChildComponent&&We(l.ChildComponent,{}),e[10]=l,e[11]=d):d=e[11];let m;return e[12]!==u||e[13]!==d||e[14]!==o||e[15]!==r||e[16]!==i||e[17]!==l?(m=Yu(hi,{active:o,editor:r,enabled:i,item:l,children:[d,We("span",{className:"text",children:u})]},l.key),e[12]=u,e[13]=d,e[14]=o,e[15]=r,e[16]=i,e[17]=l,e[18]=m):m=e[18],m},de=t=>{let e=bi(40),{anchorElem:o,classNames:n,editor:r,groupKey:i,Icon:l,items:s,itemsContainerClassNames:a,label:c,maxActiveItems:u,onActiveChange:d}=t,m;e[0]===Symbol.for("react.memo_cache_sentinel")?(m=[],e[0]=m):m=e[0];let[p,h]=Ci.useState(m),C;e[1]===Symbol.for("react.memo_cache_sentinel")?(C=[],e[1]=C):C=e[1];let[b,x]=Ci.useState(C),v=P(),A;e[2]!==r||e[3]!==s||e[4]!==u||e[5]!==v||e[6]!==d?(A=()=>{r.getEditorState().read(()=>{let M=qu(),F=[],O=[],H=[];for(let B of s)B.isActive&&(!u||F.length<u)&&B.isActive({editor:r,editorConfigContext:v,selection:M})&&(F.push(B.key),O.push(B)),B.isEnabled?B.isEnabled({editor:r,editorConfigContext:v,selection:M})&&H.push(B.key):H.push(B.key);h(F),x(H),d&&d({activeItems:O})})},e[2]=r,e[3]=s,e[4]=u,e[5]=v,e[6]=d,e[7]=A):A=e[7];let T=A,E,_;e[8]!==T?(E=()=>{T()},_=[T],e[8]=T,e[9]=E,e[10]=_):(E=e[9],_=e[10]),xi(E,_);let L,y;e[11]!==r||e[12]!==T?(L=()=>Xu(r.registerUpdateListener(()=>{T()})),y=[r,T],e[11]=r,e[12]=T,e[13]=L,e[14]=y):(L=e[13],y=e[14]),xi(L,y);let R=`${i} dropdown`,N=`${ho}-${i}`,g;e[15]!==n?(g=n||[],e[15]=n,e[16]=g):g=e[16];let f;e[17]!==N||e[18]!==g?(f=[ho,N,...g].filter(Boolean),e[17]=N,e[18]=g,e[19]=f):f=e[19];let I=f.join(" "),k;e[20]!==a?(k=a||[],e[20]=a,e[21]=k):k=e[21];let w;if(e[22]!==k||e[23]!==s||e[24]!==p||e[25]!==o||e[26]!==r||e[27]!==b||e[28]!==R||e[29]!==I||e[30]!==l||e[31]!==c||e[32]!==i){let M;e[34]!==s||e[35]!==p||e[36]!==o||e[37]!==r||e[38]!==b?(M=s.length&&s.map(F=>We(Qu,{active:p.includes(F.key),anchorElem:o,editor:r,enabled:b.includes(F.key),item:F},F.key)),e[34]=s,e[35]=p,e[36]=o,e[37]=r,e[38]=b,e[39]=M):M=e[39],w=We(gi,{buttonAriaLabel:R,buttonClassName:I,Icon:l,itemsContainerClassNames:[`${ho}-items`,...k],label:c,children:M},i),e[22]=k,e[23]=s,e[24]=p,e[25]=o,e[26]=r,e[27]=b,e[28]=R,e[29]=I,e[30]=l,e[31]=c,e[32]=i,e[33]=w}else w=e[33];return w};function sd({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&z(o.Component,{anchorElem:t,editor:e,item:o},o.key):z(Ge,{editor:e,item:o,children:o?.ChildComponent&&z(o.ChildComponent,{})},o.key)}function ad(t){let e=ed(27),{anchorElem:o,editor:n,editorConfig:r,group:i,index:l}=t,{i18n:s}=id(),{field:a}=P(),{richTextComponentMap:c}=a,[u,d]=te.useState(null),[m,p]=te.useState(null),h,C;e[0]!==i?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?p(()=>i.ChildComponent):p(null)},C=[i],e[0]=i,e[1]=h,e[2]=C):(h=e[1],C=e[2]),te.useEffect(h,C);let b;e[3]!==i||e[4]!==s||e[5]!==c?(b=_=>{let{activeItems:L}=_;if(!L.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(p(()=>i.ChildComponent),d(null)):(p(null),d(null));return}let y=L[0],R=y.key;y.label&&(R=typeof y.label=="function"?y.label({i18n:s,richTextComponentMap:c}):y.label),R.length>25&&(R=R.substring(0,25)+"..."),d(R),p(()=>y.ChildComponent)},e[3]=i,e[4]=s,e[5]=c,e[6]=b):b=e[6];let x=b,v=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,A;e[7]!==i.type||e[8]!==i.items||e[9]!==i.key||e[10]!==m||e[11]!==o||e[12]!==n||e[13]!==u||e[14]!==x?(A=i.type==="dropdown"&&i.items.length&&(m?z(de,{anchorElem:o,editor:n,groupKey:i.key,Icon:m,items:i.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:x}):z(de,{anchorElem:o,editor:n,groupKey:i.key,items:i.items,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:x})),e[7]=i.type,e[8]=i.items,e[9]=i.key,e[10]=m,e[11]=o,e[12]=n,e[13]=u,e[14]=x,e[15]=A):A=e[15];let T;e[16]!==i||e[17]!==o||e[18]!==n?(T=i.type==="buttons"&&i.items.length&&i.items.map(_=>z(sd,{anchorElem:o,editor:n,item:_},_.key)),e[16]=i,e[17]=o,e[18]=n,e[19]=T):T=e[19];let E;return e[20]!==r.features.toolbarFixed||e[21]!==l||e[22]!==A||e[23]!==T||e[24]!==v||e[25]!==i.key?(E=td("div",{className:v,children:[A,T,l<r.features.toolbarFixed?.groups.length-1&&z("div",{className:"divider"})]},i.key),e[20]=r.features.toolbarFixed,e[21]=l,e[22]=A,e[23]=T,e[24]=v,e[25]=i.key,e[26]=E):E=e[26],E}function cd({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let i=te.useRef(null),{y:l}=rd(),s=ld(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let c=r.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return nd(()=>{if(!s)return;let a=i.current;if(!a)return;let c=a.getBoundingClientRect(),u=s.getBoundingClientRect();if(!(c.bottom<u.top||c.top>u.bottom))i.current.className="fixed-toolbar fixed-toolbar--overlapping",s.className="fixed-toolbar fixed-toolbar--hide";else{if(!i.current.classList.contains("fixed-toolbar--overlapping"))return;i.current.className="fixed-toolbar",s.className="fixed-toolbar"}},50,[i,s,l]),z("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&z(te.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((a,c)=>z(ad,{anchorElem:t,editor:o,editorConfig:n,group:a,index:c},a.key))})})}var _i=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return _i(t.parentEditor)}return!1},Ti=({anchorElem:t,clientProps:e})=>{let[o]=od(),n=P(),{editorConfig:r}=n,i=e.applyToFocusedEditor&&n.focusedEditor?.editor||o,l=e.applyToFocusedEditor&&n.focusedEditor?.editorConfig||r,s=_i(n);return e?.disableIfParentHasFixedToolbar&&s||!l?.features?.toolbarFixed?.groups?.length?null:z(cd,{anchorElem:t,editor:i,editorConfig:l,parentWithFixedToolbar:s})};var ud=S({plugins:[{Component:Ti,position:"aboveContainer"}]});import{c as dd}from"react/compiler-runtime";import{jsx as Z,jsxs as Ni}from"react/jsx-runtime";import{useLexicalComposerContext as md}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ki}from"@lexical/utils";import{$getSelection as Li,$isRangeSelection as Ei,$isTextNode as pd,COMMAND_PRIORITY_LOW as fd,SELECTION_CHANGE_COMMAND as hd}from"lexical";import{useCallback as Ve,useEffect as Ke,useRef as wi,useState as gd}from"react";import*as be from"react";import{createPortal as Cd}from"react-dom";function go(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function xt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:c=10}=t,u=o.parentElement;if(a===null||u==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let d=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),h=a.top-d.height-c,C=a.left-i;l==="center"&&(C=a.left+a.width/2-d.width/2);let b=0;return!e&&h<p.top&&!s&&(b=d.height+a.height+c*2,h+=b),l==="center"?C+d.width>p.right?C=p.right-d.width-i:C<p.left&&(C=p.left+i):C+d.width>p.right&&(C=p.right-d.width-i),C-=m.left,r.style.opacity="1",s&&n!==0?(h-=m.bottom-n+d.height-3,r.style.transform=`translate(${C}px, ${h}px) rotate(180deg)`):(h-=m.top,r.style.transform=`translate(${C}px, ${h}px)`),b}function xd({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&Z(o.Component,{anchorElem:t,editor:e,item:o},o.key):Z(Ge,{editor:e,item:o,children:o?.ChildComponent&&Z(o.ChildComponent,{})},o.key)}function bd(t){let e=dd(24),{anchorElem:o,editor:n,group:r,index:i}=t,{editorConfig:l}=P(),[s,a]=be.useState(null),c,u;e[0]!==r?(c=()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(null)},u=[r],e[0]=r,e[1]=c,e[2]=u):(c=e[1],u=e[2]),be.useEffect(c,u);let d;e[3]!==r?(d=x=>{let{activeItems:v}=x;if(!v.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(null);return}let A=v[0];a(()=>A.ChildComponent)},e[3]=r,e[4]=d):d=e[4];let m=d,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${r.key}`,h;e[5]!==r.type||e[6]!==r.items||e[7]!==r.key||e[8]!==s||e[9]!==o||e[10]!==n||e[11]!==m?(h=r.type==="dropdown"&&r.items.length&&(s?Z(de,{anchorElem:o,editor:n,groupKey:r.key,Icon:s,items:r.items,maxActiveItems:1,onActiveChange:m}):Z(de,{anchorElem:o,editor:n,groupKey:r.key,items:r.items,maxActiveItems:1,onActiveChange:m})),e[5]=r.type,e[6]=r.items,e[7]=r.key,e[8]=s,e[9]=o,e[10]=n,e[11]=m,e[12]=h):h=e[12];let C;e[13]!==r||e[14]!==o||e[15]!==n?(C=r.type==="buttons"&&r.items.length&&r.items.map(x=>Z(xd,{anchorElem:o,editor:n,item:x},x.key)),e[13]=r,e[14]=o,e[15]=n,e[16]=C):C=e[16];let b;return e[17]!==l.features.toolbarInline||e[18]!==i||e[19]!==h||e[20]!==C||e[21]!==p||e[22]!==r.key?(b=Ni("div",{className:p,children:[h,C,i<l.features.toolbarInline?.groups.length-1&&Z("div",{className:"divider"})]},r.key),e[17]=l.features.toolbarInline,e[18]=i,e[19]=h,e[20]=C,e[21]=p,e[22]=r.key,e[23]=b):b=e[23],b}function _d({anchorElem:t,editor:e}){let o=wi(null),n=wi(null),{editorConfig:r}=P(),i=Ve(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),l=Ve(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";if(!u||!d){let m=c.clientX,p=c.clientY,h=document.elementFromPoint(m,p);o.current.contains(h)||i()}}},[i]),s=Ve(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Ke(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ve(()=>{let c=Li(),u=window.getSelection();if(o.current===null)return;let d=t.querySelector(":scope > .link-editor"),m=d!==null&&"style"in d&&d?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&p!==null&&p.contains(u.anchorNode)){let h=go(u,p),C=xt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:h});n.current&&xt({anchorElem:o.current,anchorFlippedOffset:C,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:h,verticalGap:8})}else i()},[e,i,t]);return Ke(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,a,t]),Ke(()=>(e.getEditorState().read(()=>{a()}),ki(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{a()})}),e.registerCommand(hd,()=>(a(),!1),fd))),[e,a]),Ni("div",{className:"inline-toolbar-popup",ref:o,children:[Z("div",{className:"caret",ref:n}),e.isEditable()&&Z(be.Fragment,{children:r?.features&&r.features?.toolbarInline?.groups.map((c,u)=>Z(bd,{anchorElem:t,editor:e,group:c,index:u},c.key))})]})}function Td(t,e){let[o,n]=gd(!1),r=Ve(()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let i=Li(),l=window.getSelection(),s=t.getRootElement();if(l!==null&&(!Ei(i)||s===null||!s.contains(l.anchorNode))){n(!1);return}if(!Ei(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),u=!1;for(let d of c)if(pd(d)){n(!0),u=!0;break}u||n(!1)}else n(!1);let a=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&a===""){n(!1);return}})},[t]);return Ke(()=>(document.addEventListener("selectionchange",r),document.addEventListener("mouseup",r),()=>{document.removeEventListener("selectionchange",r),document.removeEventListener("mouseup",r)}),[r]),Ke(()=>ki(t.registerUpdateListener(()=>{r()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),[t,r]),o?Cd(Z(_d,{anchorElem:e,editor:t}),e):null}var Ii=({anchorElem:t})=>{let[e]=md();return Td(e,t)};var Ed=S({plugins:[{Component:Ii,position:"floatingAnchorElem"}]});import{TableCellNode as Wm,TableNode as Vm,TableRowNode as Km}from"@lexical/table";import{jsx as Ri}from"react/jsx-runtime";import"react";var Co=()=>Ri("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ri("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as $,jsxs as oe}from"react/jsx-runtime";import{useLexicalComposerContext as Mi}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Nd}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as kd,$deleteTableRow__EXPERIMENTAL as Ld,$getNodeTriplet as Id,$getTableCellNodeFromLexicalNode as Rd,$getTableColumnIndexFromTableCellNode as Sd,$getTableNodeFromLexicalNodeOrThrow as bt,$getTableRowIndexFromTableCellNode as yd,$insertTableColumn__EXPERIMENTAL as Md,$insertTableRow__EXPERIMENTAL as vd,$isTableCellNode as ze,$isTableRowNode as _o,$isTableSelection as Tt,$unmergeCell as Ad,getTableObserverFromTableElement as Fd,TableCellHeaderStates as _e,TableCellNode as Dd}from"@lexical/table";import{useScrollInfo as Od}from"@payloadcms/ui";import{$createParagraphNode as Pd,$getRoot as $d,$getSelection as Et,$isElementNode as Hd,$isParagraphNode as vi,$isRangeSelection as To,$isTextNode as Bd}from"lexical";import*as Eo from"react";import{useCallback as re,useEffect as me,useRef as _t,useState as Te}from"react";import{createPortal as Ai}from"react-dom";import{jsx as xo,jsxs as wd}from"react/jsx-runtime";import"react";var Si=()=>wd("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[xo("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),xo("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),xo("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function bo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function jd(t){let e=t.getNodes(),o=[],n=null,r=null,i=0;for(let l=0;l<e.length;l++){let s=e[l];if(ze(s)){let a=s.getParentOrThrow();if(!_o(a))throw new Error("Expected CellNode to have a RowNode parent");if(n!==a){if(r!==null&&i!==r)return!1;n!==null&&(r=i),n=a,i=0}let c=s.__colSpan;for(let u=0;u<c;u++)o[i+u]===void 0&&(o[i+u]=0),o[i+u]+=s.__rowSpan;i+=c}}return(r===null||i===r)&&o.every(l=>l===o[0])}function Gd(){let t=Et();if(To(t)&&!t.isCollapsed()||Tt(t)&&!t.anchor.is(t.focus)||!To(t)&&!Tt(t))return!1;let[e]=Id(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function yi(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!vi(e)||!e.isEmpty())}function Ud(t){let e=t.getLastDescendant();Bd(e)?e.select():Hd(e)?e.selectEnd():e!==null&&e.selectNext()}function Wd({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=Mi(),l=_t(null),[s,a]=Te(r),[c,u]=Te({columns:1,rows:1}),[d,m]=Te(!1),[p,h]=Te(!1),{y:C}=Od();me(()=>i.registerMutationListener(Dd,g=>{g.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),me(()=>{i.getEditorState().read(()=>{let g=Et();if(Tt(g)){let f=bo(g);u(bo(g)),m(jd(g)&&(f.columns>1||f.rows>1))}h(Gd())})},[i]),me(()=>{let g=e.current,f=l.current,I=i.getRootElement();if(g!=null&&f!=null&&I!=null){let k=I.getBoundingClientRect(),w=g.getBoundingClientRect();f.style.opacity="1";let M=f.getBoundingClientRect(),F=5,O=w.right+F;if(O+M.width>window.innerWidth||O+M.width>k.right){let B=w.left-M.width-F;O=(B<0?F:B)+window.pageXOffset}f.style.left=`${O+window.pageXOffset}px`;let H=w.top;if(H+M.height>window.innerHeight){let B=w.bottom-M.height;H=(B<0?F:B)+window.pageYOffset}f.style.top=`${H}px`}},[e,l,i,C]),me(()=>{function g(f){l.current!=null&&e.current!=null&&!l.current.contains(f.target)&&!e.current.contains(f.target)&&n(!1)}return window.addEventListener("click",g),()=>window.removeEventListener("click",g)},[n,e]);let b=re(()=>{i.update(()=>{if(s.isAttached()){let f=bt(s),I=i.getElementByKey(f.getKey());if(!I)throw new Error("Expected to find tableElement in DOM");let k=Fd(I);k!==null&&k.clearHighlight(),f.markDirty(),a(s.getLatest())}$d().selectStart()})},[i,s]),x=()=>{i.update(()=>{let g=Et();if(Tt(g)){let{columns:f,rows:I}=bo(g),k=g.getNodes(),w=null;for(let M=0;M<k.length;M++){let F=k[M];if(ze(F))if(w===null){F.setColSpan(f).setRowSpan(I),w=F;let O=yi(F),H;O&&vi(H=F.getFirstChild())&&H.remove()}else ze(w)&&(yi(F)||w.append(...F.getChildren()),F.remove())}w!==null&&(w.getChildrenSize()===0&&w.append(Pd()),Ud(w)),o()}})},v=()=>{i.update(()=>{Ad()})},A=re(g=>{i.update(()=>{vd(g),o()})},[i,o]),T=re(g=>{i.update(()=>{for(let f=0;f<c.columns;f++)Md(g);o()})},[i,o,c.columns]),E=re(()=>{i.update(()=>{Ld(),o()})},[i,o]),_=re(()=>{i.update(()=>{bt(s).remove(),b(),o()})},[i,s,b,o]),L=re(()=>{i.update(()=>{kd(),o()})},[i,o]),y=re(()=>{i.update(()=>{let g=bt(s),f=yd(s),I=g.getChildren();if(f>=I.length||f<0)throw new Error("Expected table cell to be inside of table row.");let k=I[f];if(!_o(k))throw new Error("Expected table row");k.getChildren().forEach(w=>{if(!ze(w))throw new Error("Expected table cell");w.toggleHeaderStyle(_e.ROW)}),b(),o()})},[i,s,b,o]),R=re(()=>{i.update(()=>{let g=bt(s),f=Sd(s),I=g.getChildren(),k=Math.max(...I.map(w=>w.getChildren().length));if(f>=k||f<0)throw new Error("Expected table cell to be inside of table row.");for(let w=0;w<I.length;w++){let M=I[w];if(!_o(M))throw new Error("Expected table row");let F=M.getChildren();if(f>=F.length)continue;let O=F[f];if(!ze(O))throw new Error("Expected table cell");O.toggleHeaderStyle(_e.COLUMN)}b(),o()})},[i,s,b,o]),N=null;return t&&(d?N=$("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>x(),type:"button",children:"Merge cells"}):p&&(N=$("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),Ai(oe("div",{className:"table-action-menu-dropdown",onClick:g=>{g.stopPropagation()},ref:l,children:[N?oe(Eo.Fragment,{children:[N,$("hr",{})]}):null,$("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>A(!1),type:"button",children:oe("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),$("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>A(!0),type:"button",children:oe("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),$("hr",{}),$("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>T(!1),type:"button",children:oe("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),$("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>T(!0),type:"button",children:oe("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),$("hr",{}),$("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>L(),type:"button",children:$("span",{className:"text",children:"Delete column"})}),$("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>E(),type:"button",children:$("span",{className:"text",children:"Delete row"})}),$("button",{className:"item","data-test-id":"table-delete",onClick:()=>_(),type:"button",children:$("span",{className:"text",children:"Delete table"})}),$("hr",{}),$("button",{className:"item",onClick:()=>y(),type:"button",children:oe("span",{className:"text",children:[(s.__headerState&_e.ROW)===_e.ROW?"Remove":"Add"," ","row header"]})}),$("button",{className:"item","data-test-id":"table-column-header",onClick:()=>R(),type:"button",children:oe("span",{className:"text",children:[(s.__headerState&_e.COLUMN)===_e.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function Vd({anchorElem:t,cellMerge:e}){let[o]=Mi(),n=_t(null),r=_t(null),[i,l]=Te(!1),[s,a]=Te(null),c=re(()=>{let d=n.current,m=Et(),p=window.getSelection(),h=document.activeElement;if(m==null||d==null){a(null);return}let C=o.getRootElement();if(To(m)&&C!==null&&p!==null&&C.contains(p.anchorNode)){let b=Rd(m.anchor.getNode());if(b==null){a(null);return}if(o.getElementByKey(b.getKey())==null){a(null);return}a(b)}else h||a(null)},[o]);me(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),me(()=>{let d=n.current;if(d!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),h=d.getBoundingClientRect(),C=t.getBoundingClientRect(),b=p.top-C.top+4,x=p.right-h.width-10-C.left;d.style.opacity="1",d.style.transform=`translate(${x}px, ${b}px)`}else d.style.opacity="0",d.style.transform="translate(-10000px, -10000px)"}},[n,s,o,t]);let u=_t(s);return me(()=>{u.current!==s&&l(!1),u.current=s},[u,s]),$("div",{className:"table-cell-action-button-container",ref:n,children:s!=null&&oe(Eo.Fragment,{children:[$("button",{className:"table-cell-action-button",onClick:d=>{d.stopPropagation(),l(!i)},ref:r,type:"button",children:$(Si,{})}),i&&$(Wd,{cellMerge:e,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Fi=({anchorElem:t})=>{let e=Nd();return Ai(e?$(Vd,{anchorElem:t??document.body,cellMerge:!0}):null,t??document.body)};import{jsx as kt,jsxs as Kd}from"react/jsx-runtime";import{useLexicalComposerContext as zd}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Zd}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Yd,$getTableNodeFromLexicalNodeOrThrow as wo,$getTableRowIndexFromTableCellNode as Xd,$isTableCellNode as Di,$isTableRowNode as Jd,getDOMCellFromTarget as qd}from"@lexical/table";import{calculateZoomLevel as Oi}from"@lexical/utils";import{$getNearestNodeFromDOMNode as No}from"lexical";import*as Pi from"react";import{useCallback as Ee,useEffect as Qd,useMemo as em,useRef as wt,useState as Nt}from"react";import{createPortal as tm}from"react-dom";var om=33,rm=50;function nm({editor:t}){let e=wt(null),o=wt(null),n=wt(null),r=P(),i=wt(null),[l,s]=Nt(null),[a,c]=Nt(null),[u,d]=Nt(!1),[m,p]=Nt(null),h=Ee(()=>{c(null),e.current=null,p(null),i.current=null,n.current=null},[]),C=N=>(N.buttons&1)===1;Qd(()=>{let N=k=>{setTimeout(()=>{let w=k.target;if(m){s({x:k.clientX,y:k.clientY});return}if(d(C(k)),!(o.current&&o.current.contains(w))&&e.current!==w){e.current=w;let M=qd(w);M&&a!==M?t.update(()=>{let F=No(M.elem);if(!F)throw new Error("TableCellResizer: Table cell node not found.");let O=wo(F),H=t.getElementByKey(O.getKey());if(!H)throw new Error("TableCellResizer: Table element not found.");e.current=w,n.current=H.getBoundingClientRect(),c(M)}):M==null&&h()}},0)},g=k=>{setTimeout(()=>{d(!0)},0)},f=k=>{setTimeout(()=>{d(!1)},0)},I=t.registerRootListener((k,w)=>{k?.addEventListener("mousemove",N),k?.addEventListener("mousedown",g),k?.addEventListener("mouseup",f),w?.removeEventListener("mousemove",N),w?.removeEventListener("mousedown",g),w?.removeEventListener("mouseup",f)});return()=>{I()}},[a,m,t,h]);let b=N=>N==="bottom",x=Ee(N=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let g=No(a.elem);if(!Di(g))throw new Error("TableCellResizer: Table cell node not found.");let f=wo(g),I=Xd(g),k=f.getChildren();if(I>=k.length||I<0)throw new Error("Expected table cell to be inside of table row.");let w=k[I];if(!Jd(w))throw new Error("Expected table row");let M=w.getHeight();if(M===void 0){let O=w.getChildren();M=Math.min(...O.map(H=>A(H,t)??1/0))}let F=Math.max(M+N,om);w.setHeight(F)},{tag:"skip-scroll-into-view"})},[a,t]),v=(N,g)=>{let f=N.getWidth();if(f!==void 0)return f;let I=g.getElementByKey(N.getKey());if(I==null)return;let k=getComputedStyle(I);return I.clientWidth-parseFloat(k.paddingLeft)-parseFloat(k.paddingRight)},A=(N,g)=>g.getElementByKey(N.getKey())?.clientHeight,T=(N,g)=>{for(let f=0;f<g.length;f++)for(let I=0;I<g[f].length;I++)if(g[f][I].cell===N)return I},E=Ee(N=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let g=No(a.elem);if(!Di(g))throw new Error("TableCellResizer: Table cell node not found.");let f=wo(g),[I]=Yd(f,null,null),k=T(g,I);if(k===void 0)throw new Error("TableCellResizer: Table column not found.");for(let w=0;w<I.length;w++){let M=I[w][k];if(M.startRow===w&&(k===I[w].length-1||I[w][k].cell!==I[w][k+1].cell)){let F=v(M.cell,t);if(F===void 0)continue;let O=Math.max(F+N,rm);M.cell.setWidth(O)}}},{tag:"skip-scroll-into-view"})},[a,t]),_=Ee(N=>{let g=f=>{if(f.preventDefault(),f.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:I,y:k}=i.current;if(a===null)return;let w=Oi(f.target);if(b(N)){let M=(f.clientY-k)/w;x(M)}else{let M=(f.clientX-I)/w;E(M)}h(),document.removeEventListener("mouseup",g)}};return g},[a,h,E,x]),L=Ee(N=>g=>{if(g.preventDefault(),g.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:g.clientX,y:g.clientY},s(i.current),p(N),document.addEventListener("mouseup",_(N))},[a,_]),R=Ee(()=>{if(a){let{height:N,left:g,top:f,width:I}=a.elem.getBoundingClientRect(),k=Oi(a.elem),w=10,M={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${w}px`,left:`${window.pageXOffset+g}px`,top:`${window.pageYOffset+f+N-w/2}px`,width:`${I}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${N}px`,left:`${window.pageXOffset+g+I-w/2}px`,top:`${window.pageYOffset+f}px`,width:`${w}px`}},F=n.current;return m&&l&&F&&(b(m)?(M[m].left=`${window.pageXOffset+F.left}px`,M[m].top=`${window.pageYOffset+l.y/k}px`,M[m].height="3px",M[m].width=`${F.width}px`):(M[m].top=`${window.pageYOffset+F.top}px`,M[m].left=`${window.pageXOffset+l.x/k}px`,M[m].width="3px",M[m].height=`${F.height}px`),M[m].backgroundColor="#adf"),M}return{bottom:null,left:null,right:null,top:null}},[a,m,l])();return kt("div",{ref:o,children:a!=null&&!u&&Kd(Pi.Fragment,{children:[kt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:L("right"),style:R.right||void 0}),kt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:L("bottom"),style:R.bottom||void 0})]})})}var $i=()=>{let[t]=zd(),e=Zd();return em(()=>e?tm(kt(nm,{editor:t}),document.body):null,[t,e])};import{jsx as ko,jsxs as dm,Fragment as mm}from"react/jsx-runtime";import{useLexicalComposerContext as pm}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as fm,$getTableRowIndexFromTableCellNode as hm,$insertTableColumn__EXPERIMENTAL as gm,$insertTableRow__EXPERIMENTAL as Cm,$isTableCellNode as xm,$isTableNode as ji,TableNode as bm}from"@lexical/table";import{$findMatchingParent as _m,mergeRegister as Tm}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Gi}from"lexical";import{useEffect as Ui,useRef as Wi,useState as Lt}from"react";import"react";import{createPortal as Em}from"react-dom";import{useMemo as cm,useRef as um}from"react";var im="Expected a function",lm=Math.max,sm=Math.min;function am(t,e,o){let n,r,i=0,l,s=!1,a=!1,c,u,d,m=!0;if(typeof t!="function")throw new TypeError(im);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,c=a?lm(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(_){let L=n,y=l;return n=l=void 0,i=_,u=t.apply(y,L),u}function h(_){return i=_,d=setTimeout(x,e),s?p(_):u}function C(_){let L=_-r,y=_-i,R=e-L;return a?sm(R,c-y):R}function b(_){let L=_-r,y=_-i;return r===void 0||L>=e||L<0||a&&y>=c}function x(){let _=Date.now();if(b(_))return v(_);d=setTimeout(x,C(_))}function v(_){return d=void 0,m&&n?p(_):(n=l=void 0,u)}function A(){d!==void 0&&clearTimeout(d),i=0,n=r=l=d=void 0}function T(){return d===void 0?u:v(Date.now())}function E(){let _=Date.now(),L=b(_);if(n=arguments,l=this,r=_,L){if(d===void 0)return h(r);if(a)return clearTimeout(d),d=setTimeout(x,e),p(r)}return d===void 0&&(d=setTimeout(x,e)),u}return E.cancel=A,E.flush=T,E}var Hi=am;function Bi(t,e,o){let n=um(null);return n.current=t,cm(()=>Hi((...r)=>{n.current&&n.current(...r)},e,{maxWait:o}),[e,o])}var Vi=20;function wm({anchorElem:t}){let[e]=pm(),o=P(),[n,r]=Lt(!1),[i,l]=Lt(!1),[s,a]=Lt(!1),[c,u]=Lt({}),d=Wi(new Set),m=Wi(null),p=Bi(C=>{let{isOutside:b,tableDOMNode:x}=Nm(C,o.editorConfig?.lexical);if(b){r(!1),l(!1);return}if(!x)return;m.current=x;let v=null,A=null,T=null;if(e.update(()=>{let E=Gi(x);if(xm(E)){let _=_m(E,L=>ji(L));if(!ji(_))return;if(T=e.getElementByKey(_?.getKey()),T){let L=_.getChildrenSize(),y=_.getChildAtIndex(0)?.getChildrenSize(),R=hm(E),N=fm(E);R===L-1?v=E:N===y-1&&(A=E)}}}),T){let{bottom:E,height:_,right:L,width:y,x:R,y:N}=T.getBoundingClientRect(),{left:g,y:f}=t.getBoundingClientRect();v?(l(!1),r(!0),u({height:Vi,left:R-g,top:E-f+5,width:y})):A&&(l(!0),r(!1),u({height:_,left:L-g+5,top:N-f,width:Vi}))}},50,250);Ui(()=>{if(s)return document.addEventListener("mousemove",p),()=>{r(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Ui(()=>Tm(e.registerMutationListener(bm,C=>{e.getEditorState().read(()=>{for(let[b,x]of C)switch(x){case"created":d.current.add(b),a(d.current.size>0);break;case"destroyed":d.current.delete(b),a(d.current.size>0);break;default:break}})},{skipInitialization:!1})),[e]);let h=C=>{e.update(()=>{m.current&&(Gi(m.current)?.selectEnd(),C?(Cm(),r(!1)):(gm(),l(!1)))})};return dm(mm,{children:[n&&ko("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c}}),i&&ko("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c}})]})}function Nm(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function Ki({anchorElem:t=document.body}){return Em(ko(wm,{anchorElem:t}),t)}import{c as km}from"react/compiler-runtime";import{jsx as Lo,jsxs as Lm}from"react/jsx-runtime";import{useLexicalComposerContext as Im}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Rm}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Sm,TableNode as ym}from"@lexical/table";import{mergeRegister as Mm}from"@lexical/utils";import{formatDrawerSlug as vm,useEditDepth as Am,useModal as Fm}from"@payloadcms/ui";import{$getSelection as Dm,$isRangeSelection as Om,COMMAND_PRIORITY_EDITOR as Pm,createCommand as $m}from"lexical";import{createContext as Hm,useContext as Bm,useEffect as jm,useMemo as Gm,useState as Um}from"react";import*as zi from"react";var It=$m("OPEN_EMBED_DRAWER_COMMAND"),Zi=Hm({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Yi({children:t}){let[e,o]=Um({cellEditorConfig:null,cellEditorPlugins:null});return Lo(Zi.Provider,{value:Gm(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var Xi=()=>{let t=km(18),[e]=Im(),o=Bm(Zi),{closeModal:n,toggleModal:r}=Fm(),i=Am(),{uuid:l}=P(),s="lexical-table-create-"+l,a;t[0]!==s||t[1]!==i?(a=vm({slug:s,depth:i}),t[0]=s,t[1]=i,t[2]=a):a=t[2];let c=a,u;t[3]!==e||t[4]!==r||t[5]!==c?(u=()=>{if(!e.hasNodes([ym]))throw new Error("TablePlugin: TableNode is not registered on editor");return Mm(e.registerCommand(It,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=Dm();Om(C)&&(h=C)}),h&&r(c),!0},Pm))},t[3]=e,t[4]=r,t[5]=c,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==e||t[9]!==r?(d=[o,e,r],t[7]=o,t[8]=e,t[9]=r,t[10]=d):d=t[10],jm(u,d);let m;t[11]!==n||t[12]!==c||t[13]!==e?(m=(h,C)=>{n(c),!(!C.columns||!C.rows)&&e.dispatchCommand(Sm,{columns:String(C.columns),rows:String(C.rows)})},t[11]=n,t[12]=c,t[13]=e,t[14]=m):m=t[14];let p;return t[15]!==c||t[16]!==m?(p=Lm(zi.Fragment,{children:[Lo(se,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPathSuffix:"fields"}),Lo(Rm,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[15]=c,t[16]=m,t[17]=p):p=t[17],p};var zm=S({nodes:[Vm,Wm,Km],plugins:[{Component:Xi,position:"normal"},{Component:$i,position:"normal"},{Component:Fi,position:"floatingAnchorElem"},{Component:Ki,position:"floatingAnchorElem"}],providers:[Yi],slashMenu:{groups:[G([{Icon:Co,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(It,{})}}])]},toolbarFixed:{groups:[J([{ChildComponent:Co,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(It,{})}}])]}});import{$isNodeSelection as Cp}from"lexical";import{jsx as Io,jsxs as Zm}from"react/jsx-runtime";import"react";var Ro=()=>Zm("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:[Io("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"}),Io("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"}),Io("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{c as np}from"react/compiler-runtime";import{jsx as ip}from"react/jsx-runtime";import{useLexicalComposerContext as lp}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as sp,mergeRegister as ap}from"@lexical/utils";import{useConfig as cp}from"@payloadcms/ui";import{$getPreviousSelection as up,$getSelection as dp,$isParagraphNode as qi,$isRangeSelection as mp,COMMAND_PRIORITY_EDITOR as pp,createCommand as fp}from"lexical";import{useEffect as hp}from"react";import{c as Ym}from"react/compiler-runtime";import{jsx as So}from"react/jsx-runtime";import{useLexicalComposerContext as Xm}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as Jm}from"@payloadcms/ui";import{$getNodeByKey as qm,COMMAND_PRIORITY_EDITOR as Qm}from"lexical";import{useEffect as ep,useState as tp}from"react";var op=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=qm(o);r&&r.replace(Me({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(yo,{fields:null,relationTo:e,value:n})},rp=t=>{let e=Ym(13),{enabledCollectionSlugs:o}=t,[n]=Xm(),[r,i]=tp(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let[s,a,c]=Jm(l),{closeDrawer:u,openDrawer:d}=c,m,p;e[2]!==n||e[3]!==d?(m=()=>n.registerCommand(Se,x=>(i(x?.replace?x?.replace.nodeKey:null),d(),!0),Qm),p=[n,d],e[2]=n,e[3]=d,e[4]=m,e[5]=p):(m=e[4],p=e[5]),ep(m,p);let h;e[6]!==n||e[7]!==r||e[8]!==u?(h=x=>{let{collectionSlug:v,docID:A}=x;op({editor:n,relationTo:v,replaceNodeKey:r,value:A}),u()},e[6]=n,e[7]=r,e[8]=u,e[9]=h):h=e[9];let C=h,b;return e[10]!==C||e[11]!==s?(b=So(s,{onSelect:C}),e[10]=C,e[11]=s,e[12]=b):b=e[12],b},Ji=t=>So(Je,{...t,uploads:!0,children:So(rp,{...t})});var yo=fp("INSERT_UPLOAD_COMMAND"),Qi=t=>{let e=np(5),[o]=lp(),{config:n}=cp(),{collections:r}=n,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([ye]))throw new Error("UploadPlugin: UploadNode not registered on editor");return ap(o.registerCommand(yo,a=>(o.update(()=>{let c=dp()||up();if(mp(c)){let u=Me({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});sp(u);let{focus:d}=c,m=d.getNode();qi(m)&&m.getTextContentSize()===0&&m.getParent().getChildren().filter(p=>qi(p)).length>1&&m.remove()}}),!0),pp))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),hp(i,l);let s;return e[3]!==r?(s=ip(Ji,{enabledCollectionSlugs:r.map(gp)}),e[3]=r,e[4]=s):s=e[4],s};function gp(t){let{slug:e}=t;return e}var xp=S({nodes:[ye],plugins:[{Component:Qi,position:"normal"}],slashMenu:{groups:[G([{Icon:Ro,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Se,{replace:!1})}}])]},toolbarFixed:{groups:[J([{ChildComponent:Ro,isActive:({selection:t})=>{if(!Cp(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return At(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Se,{replace:!1})}}])]}});import{c as bp}from"react/compiler-runtime";import{jsx as Mo}from"react/jsx-runtime";import{ShimmerEffect as _p}from"@payloadcms/ui";import{lazy as Tp,Suspense as Ep,useEffect as wp,useState as Np}from"react";var kp=Tp(()=>import("./Field-EL5TNVZW.js").then(t=>({default:t.RichText}))),Lp=t=>{let e=bp(11),{admin:o,field:n,lexicalEditorConfig:r}=t,i;e[0]!==o?(i=o===void 0?{}:o,e[0]=o,e[1]=i):i=e[1];let l=i,{richTextComponentMap:s}=n,[a,c]=Np(null),u,d;e[2]!==a||e[3]!==s||e[4]!==r||e[5]!==l?(u=()=>{if(a)return;let p=s.get("features"),h=[];for(let x of p)h.push(x.clientFeature(x.clientFeatureProps));let C=r||ve,b=qe({unSanitizedEditorConfig:{features:h,lexical:C}});c(Ae(b,C,l))},d=[r,s,l,a],e[2]=a,e[3]=s,e[4]=r,e[5]=l,e[6]=u,e[7]=d):(u=e[6],d=e[7]),wp(u,d);let m;return e[8]!==a||e[9]!==t?(m=Mo(Ep,{fallback:Mo(_p,{height:"35vh"}),children:a&&Mo(kp,{...t,editorConfig:a})}),e[8]=a,e[9]=t,e[10]=m):m=e[10],m};function Ip(...t){return t.filter(Boolean).join(" ")}var Rt=new WeakMap;function el(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function St(t,e){let o=Rt.get(t);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=el(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=el(l);for(let c of n)a!==null&&c([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",r),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:r,listeners:n,start:null},Rt.set(t,o)}return o.listeners.add(e),()=>{Rp(t,e)}}function Rp(t,e){let o=Rt.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Rt.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Sp(t,e){return St(t,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&e(r,n)})}function yp(t,e){return St(t,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&e(r,n)})}function Mp(t,e){return St(t,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&e(r,n)})}function vp(t,e){return St(t,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&e(r,n)})}var D={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},Ap=D.IS_BOLD|D.IS_ITALIC|D.IS_STRIKETHROUGH|D.IS_UNDERLINE|D.IS_CODE|D.IS_SUBSCRIPT|D.IS_SUPERSCRIPT|D.IS_HIGHLIGHT,Fp="\xA0",Dp=`
|
|
34
|
+
`},[t,e]),f=ce((T,E)=>{o(_=>{let L=e.length-1,y=e[L];if(y&&y.name===T){if(T==="type")return[...e.slice(0,L),{...y,value:y.value+E}];if(y.value===E)return[...e.slice(0,L),{...y,count:y.count+1}]}return[..._,{name:T,count:1,value:E}]})},[e,o]);cr(()=>{let T=_=>{if(!n)return;let L=_.key;ds(_)?f("selectAll",""):dr.has(L)?f("press",_.key):[...L].length>1?f("keydown",_.key):f("type",_.key)},E=_=>{if(!n)return;let L=_.key;!dr.has(L)&&[...L].length>1&&f("keyup",_.key)};return t.registerRootListener((_,L)=>{L!==null&&(L.removeEventListener("keydown",T),L.removeEventListener("keyup",E)),_!==null&&(_.addEventListener("keydown",T),_.addEventListener("keyup",E))})},[t,n,f]),cr(()=>{u.current&&u.current.scrollTo(0,u.current.scrollHeight)},[m]),Wt(()=>{if(e){let T=m();T!==null&&s(T),u.current&&u.current.scrollTo(0,u.current.scrollHeight)}},[m,e]),Wt(()=>t.registerUpdateListener(({dirtyElements:E,dirtyLeaves:_,editorState:L})=>{if(!n)return;let y=L._selection,R=a.current,N=c.current;if(R!==y){if(_.size===0&&E.size===0&&!N){let h=window.getSelection();if(h&&(h.anchorNode==null||h.focusNode==null))return}a.current=y}c.current=!1;let C=m();C!==null&&s(C)}),[t,m,n,f]),Wt(()=>n?t.registerUpdateListener(()=>{let E=t.getRootElement();E!==null&&i(E?.innerHTML)}):void 0,[t,n]);let p=ce(T=>{n||(T.update(()=>{let E=ss();E.clear();let _=ls();E.append(is().append(_)),_.select()}),o([])),r(E=>!E)},[n]),g=ce(()=>{if(!n)return;let T=window.getSelection();if(T===null||T.anchorNode==null||T.focusNode==null)return;let{anchorNode:E,anchorOffset:_,focusNode:L,focusOffset:y}=ms(T),R=d().getRootElement(),N;E!==null&&(N=ur(E,R));let C;L!==null&&(C=ur(L,R)),f("snapshot",{anchorNode:E,anchorOffset:_,anchorPath:N,focusNode:L,focusOffset:y,focusPath:C})},[f,n,d]),b=ce(()=>{as(m())},[m]),x=ce(()=>{cs("test.js",m())},[m]);return[ue("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:T=>{p(d()),T.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?Kt("div",{className:"test-recorder-output",children:[Kt("div",{className:"test-recorder-toolbar",children:[ue("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:T=>{g(),T.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),ue("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:T=>{b(),T.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),ue("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:T=>{x(),T.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),ue("pre",{id:"test-recorder",ref:u,children:l})]}):null]}var fr=()=>{let[t]=ns(),[e,o]=fs(t);return Kt(mr.Fragment,{children:[ue("p",{children:"HI"}),e,o,ue("p",{children:"DONE"})]})};var ps=S({plugins:[{Component:fr,position:"bottom"}]});import{c as hs}from"react/compiler-runtime";import{jsx as gs}from"react/jsx-runtime";import{useLexicalComposerContext as Cs}from"@lexical/react/LexicalComposerContext.js";import{TreeView as xs}from"@lexical/react/LexicalTreeView.js";import"react";var pr=()=>{let t=hs(2),[e]=Cs(),o;return t[0]!==e?(o=gs(xs,{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"}),t[0]=e,t[1]=o):o=t[1],o};var bs=S({plugins:[{Component:pr,position:"bottom"}]});import{$isRangeSelection as _s,FORMAT_TEXT_COMMAND as Ts}from"lexical";import{jsx as hr}from"react/jsx-runtime";import"react";var gr=()=>hr("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:hr("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 U=t=>({type:"buttons",items:t,key:"format",order:40});var Cr={type:"text-format",format:["bold","italic"],tag:"***"},xr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},br={type:"text-format",format:["bold"],tag:"**"},_r={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Tr=[U([{ChildComponent:gr,isActive:({selection:t})=>_s(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Ts,"bold")},order:1}])],Es=S(({featureProviderMap:t})=>{let e=[br,_r];return t.get("italic")&&e.push(xr,Cr),{markdownTransformers:e,toolbarFixed:{groups:Tr},toolbarInline:{groups:Tr}}});import{$isRangeSelection as Ns,FORMAT_TEXT_COMMAND as ks}from"lexical";import{jsx as Er,jsxs as ws}from"react/jsx-runtime";import"react";var wr=()=>ws("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:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),Er("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Nr={type:"text-format",format:["code"],tag:"`"};var kr=[U([{ChildComponent:wr,isActive:({selection:t})=>Ns(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(ks,"code")},order:7}])],Ls=S({markdownTransformers:[Nr],toolbarFixed:{groups:kr},toolbarInline:{groups:kr}});import{$isRangeSelection as Is,FORMAT_TEXT_COMMAND as Rs}from"lexical";import{jsx as Lr}from"react/jsx-runtime";import"react";var Ir=()=>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:"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 Rr={type:"text-format",format:["italic"],tag:"*"},Sr={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var yr=[U([{ChildComponent:Ir,isActive:({selection:t})=>Is(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Rs,"italic")},order:2}])],Ss=S({markdownTransformers:[Rr,Sr],toolbarFixed:{groups:yr},toolbarInline:{groups:yr}});import{$isRangeSelection as Ms,FORMAT_TEXT_COMMAND as vs}from"lexical";import{jsx as Mr,jsxs as ys}from"react/jsx-runtime";import"react";var vr=()=>ys("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:[Mr("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"}),Mr("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Ar={type:"text-format",format:["strikethrough"],tag:"~~"};var Fr=[U([{ChildComponent:vr,isActive:({selection:t})=>Ms(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(vs,"strikethrough")},order:4}])],As=S({markdownTransformers:[Ar],toolbarFixed:{groups:Fr},toolbarInline:{groups:Fr}});import{$isRangeSelection as Fs,FORMAT_TEXT_COMMAND as Ds}from"lexical";import{jsx as Dr}from"react/jsx-runtime";import"react";var Or=()=>Dr("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:Dr("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 Pr=[U([{ChildComponent:Or,isActive:({selection:t})=>Fs(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Ds,"subscript")},order:5}])],Os=S({toolbarFixed:{groups:Pr},toolbarInline:{groups:Pr}});import{$isRangeSelection as Ps,FORMAT_TEXT_COMMAND as $s}from"lexical";import{jsx as $r}from"react/jsx-runtime";import"react";var Hr=()=>$r("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:$r("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 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 Br=[U([{ChildComponent:Hr,isActive:({selection:t})=>Ps(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand($s,"superscript")},order:6}])],Hs=S({toolbarFixed:{groups:Br},toolbarInline:{groups:Br}});import{$isRangeSelection as js,FORMAT_TEXT_COMMAND as Gs}from"lexical";import{jsx as jr,jsxs as Bs}from"react/jsx-runtime";import"react";var Gr=()=>Bs("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:[jr("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"}),jr("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var Ur=[U([{ChildComponent:Gr,isActive:({selection:t})=>js(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Gs,"underline")},order:3}])],Us=S({toolbarFixed:{groups:Ur},toolbarInline:{groups:Ur}});import{$createHeadingNode as zs,$isHeadingNode as rn,HeadingNode as Zs}from"@lexical/rich-text";import{$setBlocksType as Ys}from"@lexical/selection";import{$getSelection as Xs,$isRangeSelection as Js}from"lexical";import{jsx as Wr}from"react/jsx-runtime";import"react";var Vr=()=>Wr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Wr("path",{d:"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 Kr}from"react/jsx-runtime";import"react";var zr=()=>Kr("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:Kr("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 Zr}from"react/jsx-runtime";import"react";var Yr=()=>Zr("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:Zr("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";import"react";var Jr=()=>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 qr}from"react/jsx-runtime";import"react";var Qr=()=>qr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:qr("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 en}from"react/jsx-runtime";import"react";var tn=()=>en("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:en("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 Ws,$isHeadingNode as Vs,HeadingNode as Ks}from"@lexical/rich-text";var zt=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var on=t=>{let o=`^(${t.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[Ks],export:(r,i)=>{if(!Vs(r))return null;let l=Number(r.getTag().slice(1));return"#".repeat(l)+" "+i(r)},regExp:n,replace:zt(r=>{let i="h"+r[1].length;return Ws(i)})}};var nn=t=>{let e=Xs();Ys(e,()=>zs(t))},ln={h1:Vr,h2:zr,h3:Yr,h4:Jr,h5:Qr,h6:tn},qs=S(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[W(e.map((n,r)=>({ChildComponent:ln[n],isActive:({selection:i})=>{if(!Js(i))return!1;for(let l of i.getNodes()){if(rn(l)&&l.getTag()===n)continue;let s=l.getParent();if(!(rn(s)&&s.getTag()===n))return!1}return!0},key:n,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{nn(n)})},order:r+2})))];return{markdownTransformers:[on(e)],nodes:[Zs],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[G(e.map(n=>({Icon:ln[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{nn(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as sa}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var Zt=()=>sn("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:sn("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as an,jsxs as Qs}from"react/jsx-runtime";import"react";var cn=()=>Qs("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[an("path",{d:"M5 10h10",stroke:"currentColor"}),an("path",{d:"M10 15V5",stroke:"currentColor"})]});var X=t=>({type:"dropdown",ChildComponent:cn,items:t,key:"add",order:10});var un={type:"element",dependencies:[Ye],export:(t,e)=>Je(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Xe();e&&t.replace(e)}};import{c as ea}from"react/compiler-runtime";import{useLexicalComposerContext as ta}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as oa}from"@lexical/utils";import{$getSelection as ra,$isRangeSelection as na,COMMAND_PRIORITY_EDITOR as ia}from"lexical";import{useEffect as la}from"react";var dn=()=>{let t=ea(3),[e]=ta(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Ie,r=>{let i=ra();if(!na(i))return!1;if(i.focus.getNode()!==null){let s=Xe();oa(s)}return!0},ia),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),la(o,n),null};var aa=S({markdownTransformers:[un],nodes:[Ye],plugins:[{Component:dn,position:"normal"}],slashMenu:{groups:[G([{Icon:Zt,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ie,void 0)}}])]},toolbarFixed:{groups:[X([{ChildComponent:Zt,isActive:({selection:t})=>{if(!sa(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Je(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ie,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as da,OUTDENT_CONTENT_COMMAND as ma}from"lexical";import{jsx as st,jsxs as ca}from"react/jsx-runtime";import"react";var mn=()=>ca("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:[st("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),st("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as at,jsxs as ua}from"react/jsx-runtime";import"react";var fn=()=>ua("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[at("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),at("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});var pn=t=>({type:"buttons",items:t,key:"indent",order:35});var hn=[pn([{ChildComponent:mn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(ma,void 0)},order:1},{ChildComponent:fn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(da,void 0)},order:2}])],fa=S({toolbarFixed:{groups:hn},toolbarInline:{groups:hn}});import{$findMatchingParent as wc}from"@lexical/utils";import{$getSelection as oo,$isRangeSelection as Vn}from"lexical";import{jsx as gn}from"react/jsx-runtime";import"react";var Cn=()=>gn("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:gn("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 xn}from"@lexical/selection";function pe(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?xn(o)?n:r:xn(e)?n:r}var Yt=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Na,$isTextNode as ka}from"lexical";import{addClassNamesToElement as pa,isHTMLAnchorElement as ha}from"@lexical/utils";import qt from"bson-objectid";import{$applyNodeReplacement as ga,$createTextNode as bn,$getSelection as Ca,$isElementNode as _n,$isRangeSelection as Jt,createCommand as xa,ElementNode as ba}from"lexical";var _a=new Set(["http:","https:","mailto:","sms:","tel:"]),V=class t extends ba{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:""},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Ta,priority:1})}}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new qt.default().toHexString(),e.version=3);let o=J({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){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=Xt(o.rel,"add","noopener")),pa(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,n){if(!Jt(o))return!1;let r=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(_n(n)){let r=J({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!_a.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,n){let r=this.__fields?.url,i=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=Xt(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Xt(o.rel,"remove","noopener"))),!1}};function Ta(t){let e=null;if(ha(t)){let o=t.textContent;o!==null&&o!==""&&(e=J({id:new qt.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function J({id:t,fields:e}){return ga(new V({id:t??new qt.default().toHexString(),fields:e}))}function j(t){return t instanceof V}var Y=xa("TOGGLE_LINK_COMMAND");function Tn(t){let e=Ca();if(!Jt(e)&&!t.selectedNodes?.length)return;let o=Jt(e)?e.extract():t.selectedNodes;if(t===null)o?.forEach(n=>{let r=n.getParent();if(j(r)){let i=r.getChildren();for(let l=0;l<i.length;l+=1)r.insertBefore(i[l]);r.remove()}});else{if(o?.length===1){let i=o[0],l=j(i)?i:Ea(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(bn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let n=null,r=null;o?.forEach(i=>{let l=i.getParent();if(!(l===r||l===null||_n(i)&&!i.isInline())){if(j(l)){r=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(bn(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(n)||(n=l,r=J({fields:t.fields}),j(l)?i.getPreviousSibling()===null?l.insertBefore(r):l.insertAfter(r):i.insertBefore(r)),j(i)){if(i.is(r))return;if(r!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)r.append(s[a])}i.remove();return}r!==null&&r.append(i)}})}}function Ea(t){return wa(t,e=>j(e))}function wa(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Xt(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let i=new RegExp(o,"g");r=r.replace(i,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let i=new RegExp(o,"g");n=r.replace(i,"").trim()}return n}var En={type:"text-match",dependencies:[V],export:(t,e,o)=>{if(!j(t))return null;let n=t,{url:r}=n.getFields(),i=`[${n.getTextContent()}](${r})`,l=n.getFirstChild();return n.getChildrenSize()===1&&ka(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,n]=e,r=J({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),i=Na(o);i.setFormat(t.getFormat()),r.append(i),t.replace(r)},trigger:")"};import{$applyNodeReplacement as La,$isElementNode as Ia}from"lexical";var q=class t extends V{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2);let o=Pe({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(Ia(n)){let r=Pe({fields:this.__fields});return n.append(r),r}return null}};function Pe({fields:t}){return La(new q({id:"",fields:t}))}function Q(t){return t instanceof q}import{c as Ra}from"react/compiler-runtime";import{useLexicalComposerContext as Sa}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ya}from"@lexical/utils";import{$createTextNode as wn,$getSelection as Ma,$isElementNode as kn,$isLineBreakNode as Ln,$isNodeSelection as va,$isRangeSelection as Aa,$isTextNode as $e,TextNode as Fa}from"lexical";import{useEffect as Da}from"react";function Nn(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function In(t,e){for(let o=0;o<e.length;o++){let n=e[o](t);if(n!=null)return n}return null}var Oa=/[.,;\s]/;function ut(t){return Oa.test(t)}function Rn(t){return ut(t[t.length-1])}function eo(t){return ut(t[0])}function Pa(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Sn(t){let e=t.getPreviousSibling();return kn(e)&&(e=e.getLastDescendant()),e===null||Ln(e)||$e(e)&&Rn(e.getTextContent())}function yn(t){let e=t.getNextSibling();return kn(e)&&(e=e.getFirstDescendant()),e===null||Ln(e)||$e(e)&&eo(e.getTextContent())}function $a(t,e,o,n){return(t>0?ut(o[t-1]):Sn(n[0]))?e<o.length?ut(o[e]):yn(n[n.length-1]):!1}function Ha(t,e,o){let n=[],r=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let c=a[0],d=c.getTextContent().length,m=s;s+d<=e?(n.push(c),l+=d):m>=o?i.push(c):r.push(c),s+=d,a.shift()}return[l,n,r,i]}function Ba(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},i=Pe({fields:r});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=wn(n.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let c=[],u;for(let p=1;p<t.length;p++){let g=t[p],x=g.getTextContent().length,A=s,v=s+x;if(A<o)if(v<=o)c.push(g);else{let[T,E]=g.splitText(o-A);c.push(T),u=E}s+=x}let d=Ma(),m=d?d.getNodes().find($e):void 0,f=wn(a.getTextContent());return f.setFormat(a.getFormat()),f.setDetail(a.getDetail()),f.setStyle(a.getStyle()),i.append(f,...c),m&&m===a&&(Aa(d)?f.select(d.anchor.offset,d.focus.offset):va(d)&&f.select(0,f.getTextContent().length)),a.replace(i),u}}function ja(t,e,o){let n=[...t],r=n.map(a=>a.getTextContent()).join(""),i=r,l,s=0;for(;(l=In(i,e))!=null&&l!==null;){let a=l.index,c=l.length,u=a+c;if($a(s+a,s+u,r,n)){let[m,,f,p]=Ha(n,s+a,s+u),g=s+a-m,b=s+u-m,x=Ba(f,g,b,l);n=x?[x,...p]:p,o(l.url,null),s=0}else s+=u;i=i.substring(u)}}function Qt(t,e,o){let n=t.getChildren(),r=n.length;for(let a=0;a<r;a++){let c=n[a];if(!$e(c)||!c.isSimpleText()){ct(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=In(i,e);if(l===null||l.text!==i){ct(t),o(null,t.getFields()?.url??null);return}if(!Sn(t)||!yn(t)){ct(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function Ga(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),i=t.getTextContent();if(Q(n)){let l=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:"):!1;(!eo(i)||Pa(i,l))&&(n.append(t),Qt(n,e,o),o(null,n.getFields()?.url??null))}Q(r)&&!Rn(i)&&(ct(r),Qt(r,e,o),o(null,r.getFields()?.url??null))}function ct(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function Ua(t){let e=[t],o=t.getNextSibling();for(;o!==null&&$e(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Wa(t,e,o){let n=Ra(5),r,i;n[0]!==t||n[1]!==o||n[2]!==e?(r=()=>{if(!t.hasNodes([q]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return ya(t.registerNodeTransform(Fa,s=>{let a=s.getParentOrThrow(),c=s.getPreviousSibling();if(Q(a))Qt(a,e,l);else if(!j(a)){if(s.isSimpleText()&&(eo(s.getTextContent())||!Q(c))){let u=Ua(s);ja(u,e,l)}Ga(s,e,l)}}))},i=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=r,n[4]=i):(r=n[3],i=n[4]),Da(r,i)}var Va=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Ka=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,za=[Nn(Va,t=>t.startsWith("http")?t:`https://${t}`),Nn(Ka,t=>`mailto:${t}`)],Mn=()=>{let[t]=Sa();return Wa(t,za),null};import{jsx as Za}from"react/jsx-runtime";import{ClickableLinkPlugin as Ya}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var vn=()=>Za(Ya,{});import{jsx as dc}from"react/jsx-runtime";import"react";import{createPortal as mc}from"react-dom";import{jsx as le,jsxs as to}from"react/jsx-runtime";import{useLexicalComposerContext as Ja}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as An,mergeRegister as Fn}from"@lexical/utils";import{getTranslation as qa}from"@payloadcms/translations";import{CloseMenuIcon as Qa,EditIcon as ec,formatDrawerSlug as tc,useConfig as oc,useEditDepth as rc,useModal as nc,useTranslation as ic}from"@payloadcms/ui";import{$getSelection as Dn,$isLineBreakNode as lc,$isRangeSelection as On,COMMAND_PRIORITY_HIGH as sc,COMMAND_PRIORITY_LOW as Pn,KEY_ESCAPE_COMMAND as ac,SELECTION_CHANGE_COMMAND as cc}from"lexical";import $n,{useCallback as Hn,useEffect as ft,useRef as uc,useState as he}from"react";function dt(t,e,o,n=10,r=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),c=t.top-n,u=t.left-r;c<a.top&&(c+=l.height+t.height+n*2),u+l.width>a.right&&(u=a.right-l.width-r),c-=s.top,u-=s.left,e.style.opacity="1",e.style.transform=`translate(${u}px, ${c}px)`}import{createCommand as Xa}from"lexical";var mt=Xa("TOGGLE_LINK_WITH_MODAL_COMMAND");function Bn({anchorElem:t}){let[e]=Ja(),o=uc(null),[n,r]=he(null),[i,l]=he(null),{uuid:s}=H(),{config:a}=oc(),{i18n:c,t:u}=ic(),[d,m]=he(),{closeModal:f,toggleModal:p}=nc(),g=rc(),[b,x]=he(!1),[A,v]=he([]),[T,E]=he(!1),_=tc({slug:"lexical-rich-text-link-"+s,depth:g}),L=Hn(()=>{x(!1),o&&o.current&&(o.current.style.opacity="0",o.current.style.transform="translate(-10000px, -10000px)"),E(!1),r(null),l(null),v([]),m(void 0)},[x,r,l,v]),y=Hn(()=>{let R=Dn(),N;if(!On(R)||!R){L();return}let C=pe(R);N=e.getElementByKey(C.getKey())?.getBoundingClientRect();let h=An(C,j),I=R.getNodes().filter(P=>!lc(P)).find(P=>{let $=An(P,j);return h&&!h.is($)||$&&!$.is(h)});if(h==null||I){L();return}let k={...h.getFields(),id:h.getID(),text:h.getTextContent()};if(h.getFields()?.linkType==="custom")r(h.getFields()?.url??null),l(null);else{r(`/admin/collections/${h.getFields()?.doc?.relationTo}/${h.getFields()?.doc?.value}`);let P=a.collections.find($=>$.slug===h.getFields()?.doc?.relationTo);if(!P)l(h.getFields()?.label?String(h.getFields()?.label):null),r(h.getFields()?.url?String(h.getFields()?.url):null);else{let $=u("fields:linkedTo",{label:qa(P.labels.singular,c)}).replace(/<[^>]*>?/g,"");l($)}}m(k),x(!0),v(R?R?.getNodes():[]),Q(h)?E(!0):E(!1);let w=o.current,M=window.getSelection(),{activeElement:F}=document;if(w===null)return;let O=e.getRootElement();return M!==null&&O!==null&&O.contains(M.anchorNode)?(N||(N=M.getRangeAt(0).getBoundingClientRect()),N!=null&&(N.y+=40,dt(N,w,t))):(F==null||F.className!=="link-input")&&(O!==null&&dt(null,w,t),r(null),l(null)),!0},[e,L,a.collections,u,c,t]);return ft(()=>Fn(e.registerCommand(mt,R=>(e.dispatchCommand(Y,R),y(),p(_),!0),Pn)),[e,y,p,_]),ft(()=>{let R=t.parentElement,N=()=>{e.getEditorState().read(()=>{y()})};return window.addEventListener("resize",N),R?.addEventListener("scroll",N),()=>{window.removeEventListener("resize",N),R?.removeEventListener("scroll",N)}},[t.parentElement,e,y]),ft(()=>Fn(e.registerUpdateListener(({editorState:R})=>{R.read(()=>{y()})}),e.registerCommand(cc,()=>(y(),!0),Pn),e.registerCommand(ac,()=>b?(L(),!0):!1,sc)),[e,y,b,L]),ft(()=>{e.getEditorState().read(()=>{y()})},[e,y]),to($n.Fragment,{children:[le("div",{className:"link-editor",ref:o,children:to("div",{className:"link-input",children:[n&&n.length>0?le("a",{href:n,rel:"noopener noreferrer",target:"_blank",children:i!=null&&i.length>0?i:n}):i!=null&&i.length>0?le("span",{className:"link-input__label-pure",children:i}):null,e.isEditable()&&to($n.Fragment,{children:[le("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{p(_)},onMouseDown:R=>{R.preventDefault()},tabIndex:0,type:"button",children:le(ec,{})}),!T&&le("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(Y,null)},onMouseDown:R=>{R.preventDefault()},tabIndex:0,type:"button",children:le(Qa,{})})]})]})}),le(ae,{className:"lexical-link-edit-drawer",data:d,drawerSlug:_,drawerTitle:u("fields:editLink"),featureKey:"link",handleDrawerSubmit:(R,N)=>{f(_);let C=N,h={...C};delete h.text,e.update(()=>{let I=Dn(),k=null;if(On(I)?k=pe(I).getParent():A.length&&(k=A[0].getParent()),k&&Q(k)){let w=J({fields:h});k.replace(w,!0)}}),e.dispatchCommand(Y,{fields:h,selectedNodes:A,text:C.text})},schemaPathSuffix:"fields"})]})}var jn=t=>{let{anchorElem:e=document.body}=t;return mc(dc(Bn,{anchorElem:e}),e)};import{c as hc}from"react/compiler-runtime";import{useLexicalComposerContext as gc}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Cc}from"@lexical/utils";import{$getSelection as xc,$isElementNode as bc,$isRangeSelection as _c,COMMAND_PRIORITY_LOW as Un,PASTE_COMMAND as Tc}from"lexical";import{useEffect as Ec}from"react";var fc=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,pc=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Gn(t){if(!t)return!1;if(t==="https://"||fc.test(t)||pc.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Wn=()=>{let t=hc(3),[e]=gc(),o,n;return t[0]!==e?(o=()=>{if(!e.hasNodes([V]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Cc(e.registerCommand(Y,r=>(Tn(r),!0),Un),e.registerCommand(Tc,r=>{let i=xc();if(!_c(i)||i.isCollapsed()||!(r instanceof ClipboardEvent)||r.clipboardData==null)return!1;let l=r.clipboardData.getData("text");if(!Gn(l))return!1;if(!i.getNodes().some(s=>bc(s))){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(Y,{fields:s,text:null}),r.preventDefault(),!0}return!1},Un))},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Ec(o,n),null};var Kn=[Yt([{ChildComponent:Cn,isActive:({selection:t})=>{if(Vn(t)){let e=pe(t);return wc(e,j)!=null}return!1},isEnabled:({selection:t})=>!!(Vn(t)&&oo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(Y,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=oo()?.getTextContent(),n=oo()?.getNodes()??[]}),!o?.length)return;let r={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(mt,{fields:r,selectedNodes:n,text:o})}},order:1}])],Nc=S({markdownTransformers:[En],nodes:[V,q],plugins:[{Component:Wn,position:"normal"},{Component:Mn,position:"normal"},{Component:vn,position:"normal"},{Component:jn,position:"floatingAnchorElem"}],toolbarFixed:{groups:Kn},toolbarInline:{groups:Kn}});import{$isListNode as io,INSERT_CHECK_LIST_COMMAND as qn,ListItemNode as Oc,ListNode as Pc}from"@lexical/list";import{$isRangeSelection as $c}from"lexical";import{jsx as zn,jsxs as kc}from"react/jsx-runtime";import"react";var ro=()=>kc("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:[zn("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),zn("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Lc}from"react/jsx-runtime";import{ListPlugin as Ic}from"@lexical/react/LexicalListPlugin.js";import"react";var ge=()=>Lc(Ic,{});function Ce(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Mc,ListItemNode as vc,ListNode as Ac}from"@lexical/list";import{$createListItemNode as Rc,$createListNode as Sc,$isListItemNode as yc,$isListNode as no}from"@lexical/list";var Zn=4,xe=t=>(e,o,n)=>{let r=e.getPreviousSibling(),i=e.getNextSibling(),l=Rc(t==="check"?n[3]==="x":void 0);if(no(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(no(r)&&r.getListType()===t)r.append(l),e.remove();else{let a=Sc(t,t==="number"?Number(n[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(n[1].length/Zn);s&&l.setIndent(s)},de=(t,e,o)=>{let n=[],r=t.getChildren(),i=0;for(let l of r)if(yc(l)){if(l.getChildrenSize()===1){let u=l.getFirstChild();if(no(u)){n.push(de(u,e,o+1));continue}}let s=" ".repeat(o*Zn),a=t.getListType(),c=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";n.push(s+c+e(l)),i++}return n.join(`
|
|
35
|
+
`)};var Yn={type:"element",dependencies:[Ac,vc],export:(t,e)=>Mc(t)?de(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:xe("check")};import{jsx as Fc}from"react/jsx-runtime";import{CheckListPlugin as Dc}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Xn=()=>Fc(Dc,{});var Jn=[W([{ChildComponent:ro,isActive:({selection:t})=>{if(!$c(t))return!1;for(let e of t.getNodes()){if(io(e)&&e.getListType()==="check")continue;let o=e.getParent();if(io(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(io(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(qn,void 0)},order:12}])],Hc=S(({featureProviderMap:t})=>{let e=[{Component:Xn,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:ge,position:"normal"}),{markdownTransformers:[Yn],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Pc,Oc],plugins:e,slashMenu:{groups:[Ce([{Icon:ro,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(qn,void 0)}}])]},toolbarFixed:{groups:Jn},toolbarInline:{groups:Jn}}});import{$isListNode as so,INSERT_ORDERED_LIST_COMMAND as ti,ListItemNode as Wc,ListNode as Vc}from"@lexical/list";import{$isRangeSelection as Kc}from"lexical";import{jsx as He,jsxs as Bc}from"react/jsx-runtime";import"react";var lo=()=>Bc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[He("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),He("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),He("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),He("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as jc,ListItemNode as Gc,ListNode as Uc}from"@lexical/list";var Qn={type:"element",dependencies:[Uc,Gc],export:(t,e)=>jc(t)?de(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:xe("number")};var ei=[W([{ChildComponent:lo,isActive:({selection:t})=>{if(!Kc(t))return!1;for(let e of t.getNodes()){if(so(e)&&e.getListType()==="number")continue;let o=e.getParent();if(so(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(so(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ti,void 0)},order:10}])],zc=S(({featureProviderMap:t})=>({markdownTransformers:[Qn],nodes:t.has("orderedList")?[]:[Vc,Wc],plugins:t.has("orderedList")?[]:[{Component:ge,position:"normal"}],slashMenu:{groups:[Ce([{Icon:lo,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(ti,void 0)}}])]},toolbarFixed:{groups:ei},toolbarInline:{groups:ei}}));import{$isListNode as co,INSERT_UNORDERED_LIST_COMMAND as ni,ListItemNode as qc,ListNode as Qc}from"@lexical/list";import{$isRangeSelection as eu}from"lexical";import{jsx as be,jsxs as Zc}from"react/jsx-runtime";import"react";var ao=()=>Zc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[be("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),be("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),be("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),be("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Yc,ListItemNode as Xc,ListNode as Jc}from"@lexical/list";var oi={type:"element",dependencies:[Jc,Xc],export:(t,e)=>Yc(t)?de(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:xe("bullet")};var ri=[W([{ChildComponent:ao,isActive:({selection:t})=>{if(!eu(t))return!1;for(let e of t.getNodes()){if(co(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(co(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(co(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ni,void 0)},order:11}])],tu=S({markdownTransformers:[oi],nodes:[Qc,qc],plugins:[{Component:ge,position:"normal"}],slashMenu:{groups:[Ce([{Icon:ao,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ni,void 0)}}])]},toolbarFixed:{groups:ri},toolbarInline:{groups:ri}});import{jsx as ou}from"react/jsx-runtime";import{addClassNamesToElement as ru}from"@lexical/utils";import{DecoratorNode as nu}from"lexical";import*as ii from"react";var iu=ii.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Be=class t extends nu{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return lu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return ru(o,"unknownConverted"),o}decorate(){return ou(iu,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function lu({data:t}){return new Be({data:t})}var su=S(()=>({nodes:[Be]}));import{jsx as au}from"react/jsx-runtime";import{addClassNamesToElement as cu}from"@lexical/utils";import{DecoratorNode as uu}from"lexical";import*as li from"react";var du=li.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),je=class t extends uu{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return mu({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return cu(o,"unknownConverted"),o}decorate(){return au(du,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function mu({data:t}){return new je({data:t})}var fu=S(()=>({nodes:[je]}));import{$setBlocksType as ci}from"@lexical/selection";import{$createParagraphNode as ui,$getSelection as di,$isParagraphNode as si,$isRangeSelection as pu}from"lexical";var ai=[W([{ChildComponent:Oe,isActive:({selection:t})=>{if(!pu(t))return!1;for(let e of t.getNodes())if(!si(e)&&!si(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=di();ci(e,()=>ui())})},order:1}])],hu=S({slashMenu:{groups:[G([{Icon:Oe,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=di();ci(e,()=>ui())})}}])]},toolbarFixed:{groups:ai},toolbarInline:{groups:ai}});import{$isNodeSelection as Du}from"lexical";import{jsx as Ge,jsxs as gu}from"react/jsx-runtime";import"react";var uo=()=>gu("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ge("g",{clipPath:"url(#clip0_4397_10817)",children:Ge("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),Ge("defs",{children:Ge("clipPath",{id:"clip0_4397_10817",children:Ge("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as wu}from"react/compiler-runtime";import{jsx as Nu}from"react/jsx-runtime";import{useLexicalComposerContext as ku}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Lu}from"@lexical/utils";import{useConfig as Iu}from"@payloadcms/ui";import{$getPreviousSelection as Ru,$getSelection as Su,$isParagraphNode as gi,$isRangeSelection as yu,COMMAND_PRIORITY_EDITOR as Mu,createCommand as vu}from"lexical";import{useEffect as Au}from"react";import{c as Cu}from"react/compiler-runtime";import{jsx as pt}from"react/jsx-runtime";import{useLexicalComposerContext as xu}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as bu}from"@payloadcms/ui";import{$getNodeByKey as _u,COMMAND_PRIORITY_EDITOR as Tu}from"lexical";import{useEffect as mi,useState as fi}from"react";var Eu=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=_u(o);r&&r.replace(ye({relationTo:e,value:n}))}):t.dispatchCommand(mo,{relationTo:e,value:n})},pi=t=>{let e=Cu(21),{enabledCollectionSlugs:o}=t,[n]=xu(),r;e[0]!==o?(r=()=>o?.[0],e[0]=o,e[1]=r):r=e[1];let[i,l]=fi(r),[s,a]=fi(null),c;e[2]!==o||e[3]!==i?(c={collectionSlugs:o,selectedCollection:i},e[2]=o,e[3]=i,e[4]=c):c=e[4];let[u,d,m]=bu(c),{closeDrawer:f,isDrawerOpen:p,openDrawer:g}=m,b,x;e[5]!==n||e[6]!==g?(b=()=>n.registerCommand(Re,L=>(a(L?.replace?L?.replace.nodeKey:null),g(),!0),Tu),x=[n,g],e[5]=n,e[6]=g,e[7]=b,e[8]=x):(b=e[7],x=e[8]),mi(b,x);let A;e[9]!==n||e[10]!==s||e[11]!==f?(A=L=>{let{collectionSlug:y,docID:R}=L;Eu({editor:n,relationTo:y,replaceNodeKey:s,value:R}),f()},e[9]=n,e[10]=s,e[11]=f,e[12]=A):A=e[12];let v=A,T;e[13]!==o?(T=()=>{l(o?.[0])},e[13]=o,e[14]=T):T=e[14];let E;e[15]!==p||e[16]!==o?(E=[p,o],e[15]=p,e[16]=o,e[17]=E):E=e[17],mi(T,E);let _;return e[18]!==v||e[19]!==u?(_=pt(u,{onSelect:v}),e[18]=v,e[19]=u,e[20]=_):_=e[20],_},hi=t=>(t?.enabledCollectionSlugs?.length??-1)>0?pt(pi,{...t}):pt(qe,{...t,children:pt(pi,{...t})});var mo=vu("INSERT_RELATIONSHIP_COMMAND"),Ci=t=>{let e=wu(10),{clientProps:o}=t,[n]=ku(),{config:r}=Iu(),{collections:i}=r,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let u;if(e[0]!==o||e[1]!==i){let d;e[3]!==o?(d=m=>{let{slug:f}=m;return!o?.disabledCollections?.includes(f)},e[3]=o,e[4]=d):d=e[4],u=i.filter(d).map(Fu),e[0]=o,e[1]=i,e[2]=u}else u=e[2];l=u}let s,a;e[5]!==n?(s=()=>{if(!n.hasNodes([Se]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(mo,u=>{let d=Su()||Ru();if(yu(d)){let m=ye(u);Lu(m);let{focus:f}=d,p=f.getNode();gi(p)&&p.getTextContentSize()===0&&p.getParentOrThrow().getChildren().filter(g=>gi(g)).length>1&&p.remove()}return!0},Mu)},a=[n],e[5]=n,e[6]=s,e[7]=a):(s=e[6],a=e[7]),Au(s,a);let c;return e[8]!==l?(c=Nu(hi,{enabledCollectionSlugs:l}),e[8]=l,e[9]=c):c=e[9],c};function Fu(t){let{slug:e}=t;return e}var Ou=S({nodes:[Se],plugins:[{Component:Ci,position:"normal"}],slashMenu:{groups:[G([{Icon:uo,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Re,{replace:!1})}}])]},toolbarFixed:{groups:[X([{ChildComponent:uo,isActive:({selection:t})=>{if(!Du(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ft(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Re,{replace:!1})}}])]}});import{c as Xu}from"react/compiler-runtime";import{jsx as z,jsxs as Ju}from"react/jsx-runtime";import{useLexicalComposerContext as qu}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as Qu,useThrottledEffect as ed,useTranslation as td}from"@payloadcms/ui";import*as ee from"react";import{useMemo as od}from"react";import{jsx as Pu}from"react/jsx-runtime";import{mergeRegister as $u}from"@lexical/utils";import{$getSelection as Hu}from"lexical";import{useCallback as Bu,useEffect as ht,useState as fo}from"react";var po="toolbar-popup__button",Ue=({children:t,editor:e,item:o})=>{let[n,r]=fo(!0),[i,l]=fo(!1),[s,a]=fo(po),c=H(),u=Bu(()=>{e.getEditorState().read(()=>{let d=Hu();if(d){if(o.isActive){let m=o.isActive({editor:e,editorConfigContext:c,selection:d});i!==m&&l(m)}if(o.isEnabled){let m=o.isEnabled({editor:e,editorConfigContext:c,selection:d});n!==m&&r(m)}}})},[i,e,c,n,o]);return ht(()=>{u()},[u]),ht(()=>(document.addEventListener("mouseup",u),()=>{document.removeEventListener("mouseup",u)}),[u]),ht(()=>$u(e.registerUpdateListener(()=>{u()})),[e,u]),ht(()=>{a([po,n===!1?"disabled":"",i?"active":"",o?.key?`${po}-`+o.key:""].filter(Boolean).join(" "))},[n,i,s,o.key]),Pu("button",{className:s,onClick:()=>{if(n!==!1)return e._updateTags=new Set([...e._updateTags,"toolbar"]),e.focus(()=>{o.onSelect?.({editor:e,isActive:i})}),!0},onMouseDown:d=>{d.preventDefault()},type:"button",children:t})};import{c as wi}from"react/compiler-runtime";import{jsx as Ve,jsxs as Vu}from"react/jsx-runtime";import Co,{useEffect as Ei}from"react";import{mergeRegister as Ku}from"@lexical/utils";import{useTranslation as zu}from"@payloadcms/ui";import{$getSelection as Zu}from"lexical";import{jsx as se,jsxs as xi}from"react/jsx-runtime";import gt,{useCallback as ju,useEffect as We,useMemo as Gu,useRef as go,useState as Ct}from"react";import{createPortal as Uu}from"react-dom";var ho="toolbar-popup__dropdown-item",bi=gt.createContext(null);function _i({active:t,children:e,editor:o,enabled:n,item:r,title:i}){let[l,s]=Ct(ho);We(()=>{s([ho,n===!1?"disabled":"",t?"active":"",r?.key?`${ho}-${r.key}`:""].filter(Boolean).join(" "))},[n,t,l,r.key]);let a=go(null),c=gt.useContext(bi);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:u}=c;return We(()=>{a?.current!=null&&u(a)},[a,u]),se("button",{className:l,onClick:()=>{n!==!1&&(o._updateTags=new Set([...o._updateTags,"toolbar"]),o.focus(()=>{r.onSelect?.({editor:o,isActive:t})}))},onMouseDown:d=>{d.preventDefault()},ref:a,title:i,type:"button",children:e})}function Wu({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:n}){let[r,i]=Ct(),[l,s]=Ct(),a=ju(d=>{i(m=>m!=null?[...m,d]:[d])},[i]),c=d=>{if(r==null)return;let{key:m}=d;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&d.preventDefault(),m==="Escape"||m==="Tab"?n():m==="ArrowUp"?s(f=>{if(f==null)return r[0];let p=r.indexOf(f)-1;return r[p===-1?r.length-1:p]}):m==="ArrowDown"&&s(f=>f==null?r[0]:r[r.indexOf(f)+1])},u=Gu(()=>({registerItem:a}),[a]);return We(()=>{r!=null&&l==null&&s(r[0]),l!=null&&l?.current!=null&&l.current.focus()},[r,l]),se(bi.Provider,{value:u,children:se("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Ti({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,Icon:r,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=go(null),c=go(null),[u,d]=Ct(!1),m=()=>{d(!1),c?.current!=null&&c.current.focus()};We(()=>{let p=c.current,g=a.current;if(u&&p!==null&&g!==null){let{left:b,top:x}=p.getBoundingClientRect(),A=window.scrollY||document.documentElement.scrollTop;g.style.top=`${x+A+p.offsetHeight+5}px`,g.style.left=`${Math.min(b-5,window.innerWidth-g.offsetWidth-20)}px`}},[a,c,u]),We(()=>{let p=c.current;if(p!==null&&u){let g=b=>{let{target:x}=b;s!=null&&a.current!=null&&a.current.contains(x)||p.contains(x)||d(!1)};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[a,c,u,s]);let f=Uu(se(Wu,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return xi(gt.Fragment,{children:[xi("button",{"aria-label":t,className:e+(u?" active":""),disabled:n,onClick:p=>{p.preventDefault(),d(!u)},onMouseDown:p=>{p.preventDefault()},ref:c,type:"button",children:[r&&se(r,{}),l&&se("span",{className:"toolbar-popup__dropdown-label",children:l}),se("i",{className:"toolbar-popup__dropdown-caret"})]}),u&&se(gt.Fragment,{children:f})]})}var xo="toolbar-popup__dropdown",Yu=t=>{let e=wi(19),{active:o,anchorElem:n,editor:r,enabled:i,item:l}=t,{i18n:s}=zu(),{field:a}=H(),{richTextComponentMap:c}=a;if(l.Component){let f;return e[0]!==l||e[1]!==o||e[2]!==n||e[3]!==r||e[4]!==i?(f=l?.Component&&Ve(l.Component,{active:o,anchorElem:n,editor:r,enabled:i,item:l},l.key),e[0]=l,e[1]=o,e[2]=n,e[3]=r,e[4]=i,e[5]=f):f=e[5],f}let u=l.key;if(l.label){let f;e[6]!==l||e[7]!==s||e[8]!==c?(f=typeof l.label=="function"?l.label({i18n:s,richTextComponentMap:c}):l.label,e[6]=l,e[7]=s,e[8]=c,e[9]=f):f=e[9],u=f}u.length>25&&(u=u.substring(0,25)+"...");let d;e[10]!==l?(d=l?.ChildComponent&&Ve(l.ChildComponent,{}),e[10]=l,e[11]=d):d=e[11];let m;return e[12]!==u||e[13]!==d||e[14]!==o||e[15]!==r||e[16]!==i||e[17]!==l?(m=Vu(_i,{active:o,editor:r,enabled:i,item:l,children:[d,Ve("span",{className:"text",children:u})]},l.key),e[12]=u,e[13]=d,e[14]=o,e[15]=r,e[16]=i,e[17]=l,e[18]=m):m=e[18],m},me=t=>{let e=wi(42),{anchorElem:o,classNames:n,editor:r,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:c,onActiveChange:u}=t,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[m,f]=Co.useState(d),p;e[1]===Symbol.for("react.memo_cache_sentinel")?(p=[],e[1]=p):p=e[1];let[g,b]=Co.useState(p),[x,A]=Co.useState(!0),v=H(),{items:T,key:E}=i,_;e[2]!==r||e[3]!==T||e[4]!==c||e[5]!==v||e[6]!==i||e[7]!==u?(_=()=>{r.getEditorState().read(()=>{let $=Zu();if(!$)return;let re=[],Do=[],yt=[];for(let ne of T)ne.isActive&&(!c||re.length<c)&&ne.isActive({editor:r,editorConfigContext:v,selection:$})&&(re.push(ne.key),Do.push(ne)),ne.isEnabled?ne.isEnabled({editor:r,editorConfigContext:v,selection:$})&&yt.push(ne.key):yt.push(ne.key);i.isEnabled&&A(i.isEnabled({editor:r,editorConfigContext:v,selection:$})),f(re),b(yt),u&&u({activeItems:Do})})},e[2]=r,e[3]=T,e[4]=c,e[5]=v,e[6]=i,e[7]=u,e[8]=_):_=e[8];let L=_,y,R;e[9]!==L?(y=()=>{L()},R=[L],e[9]=L,e[10]=y,e[11]=R):(y=e[10],R=e[11]),Ei(y,R);let N,C;e[12]!==r||e[13]!==L?(N=()=>Ku(r.registerUpdateListener(()=>{L()})),C=[r,L],e[12]=r,e[13]=L,e[14]=N,e[15]=C):(N=e[14],C=e[15]),Ei(N,C);let h=`${E} dropdown`,I=`${xo}-${E}`,k;e[16]!==n?(k=n||[],e[16]=n,e[17]=k):k=e[17];let w;e[18]!==I||e[19]!==k?(w=[xo,I,...k].filter(Boolean),e[18]=I,e[19]=k,e[20]=w):w=e[20];let M=w.join(" "),F=!x,O;e[21]!==s?(O=s||[],e[21]=s,e[22]=O):O=e[22];let P;if(e[23]!==O||e[24]!==T||e[25]!==m||e[26]!==o||e[27]!==r||e[28]!==g||e[29]!==h||e[30]!==M||e[31]!==F||e[32]!==l||e[33]!==a||e[34]!==E){let $;e[36]!==T||e[37]!==m||e[38]!==o||e[39]!==r||e[40]!==g?($=T.length&&T.map(re=>Ve(Yu,{active:m.includes(re.key),anchorElem:o,editor:r,enabled:g.includes(re.key),item:re},re.key)),e[36]=T,e[37]=m,e[38]=o,e[39]=r,e[40]=g,e[41]=$):$=e[41],P=Ve(Ti,{buttonAriaLabel:h,buttonClassName:M,disabled:F,Icon:l,itemsContainerClassNames:[`${xo}-items`,...O],label:a,children:$},E),e[23]=O,e[24]=T,e[25]=m,e[26]=o,e[27]=r,e[28]=g,e[29]=h,e[30]=M,e[31]=F,e[32]=l,e[33]=a,e[34]=E,e[35]=P}else P=e[35];return P};function rd({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&z(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?z(Ue,{editor:e,item:o,children:z(o.ChildComponent,{})},o.key):null}function nd(t){let e=Xu(25),{anchorElem:o,editor:n,editorConfig:r,group:i,index:l}=t,{i18n:s}=td(),{field:a}=H(),{richTextComponentMap:c}=a,[u,d]=ee.useState(void 0),[m,f]=ee.useState(void 0),p,g;e[0]!==i?(p=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},g=[i],e[0]=i,e[1]=p,e[2]=g):(p=e[1],g=e[2]),ee.useEffect(p,g);let b;e[3]!==i||e[4]!==s||e[5]!==c?(b=_=>{let{activeItems:L}=_;if(!L.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),d(void 0)):(f(void 0),d(void 0));return}let y=L[0],R=y.key;y.label&&(R=typeof y.label=="function"?y.label({i18n:s,richTextComponentMap:c}):y.label),R.length>25&&(R=R.substring(0,25)+"..."),d(R),f(()=>y.ChildComponent)},e[3]=i,e[4]=s,e[5]=c,e[6]=b):b=e[6];let x=b,A=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,v;e[7]!==i||e[8]!==m||e[9]!==o||e[10]!==n||e[11]!==u||e[12]!==x?(v=i.type==="dropdown"&&i.items.length&&(m?z(me,{anchorElem:o,editor:n,group:i,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:x}):z(me,{anchorElem:o,editor:n,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:u,maxActiveItems:1,onActiveChange:x})),e[7]=i,e[8]=m,e[9]=o,e[10]=n,e[11]=u,e[12]=x,e[13]=v):v=e[13];let T;e[14]!==i||e[15]!==o||e[16]!==n?(T=i.type==="buttons"&&i.items.length&&i.items.map(_=>z(rd,{anchorElem:o,editor:n,item:_},_.key)),e[14]=i,e[15]=o,e[16]=n,e[17]=T):T=e[17];let E;return e[18]!==r.features.toolbarFixed||e[19]!==l||e[20]!==v||e[21]!==T||e[22]!==A||e[23]!==i.key?(E=Ju("div",{className:A,children:[v,T,l<r.features.toolbarFixed?.groups.length-1&&z("div",{className:"divider"})]},i.key),e[18]=r.features.toolbarFixed,e[19]=l,e[20]=v,e[21]=T,e[22]=A,e[23]=i.key,e[24]=E):E=e[24],E}function id({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let i=ee.useRef(null),{y:l}=Qu(),s=od(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let c=r.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return ed(()=>{if(!s)return;let a=i.current;if(!a)return;let c=a.getBoundingClientRect(),u=s.getBoundingClientRect();if(!(c.bottom<u.top||c.top>u.bottom))a.className="fixed-toolbar fixed-toolbar--overlapping",s.className="fixed-toolbar fixed-toolbar--hide";else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.className="fixed-toolbar",s.className="fixed-toolbar"}},50,[i,s,l]),z("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&z(ee.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((a,c)=>z(nd,{anchorElem:t,editor:o,editorConfig:n,group:a,index:c},a.key))})})}var Ni=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Ni(t.parentEditor)}return!1},ki=({anchorElem:t,clientProps:e})=>{let[o]=qu(),n=H(),{editorConfig:r}=n,i=e.applyToFocusedEditor&&n.focusedEditor?.editor||o,l=e.applyToFocusedEditor&&n.focusedEditor?.editorConfig||r,s=Ni(n);return e?.disableIfParentHasFixedToolbar&&s||!l?.features?.toolbarFixed?.groups?.length?null:z(id,{anchorElem:t,editor:i,editorConfig:l,parentWithFixedToolbar:s})};var ld=S({plugins:[{Component:ki,position:"aboveContainer"}]});import{c as sd}from"react/compiler-runtime";import{jsx as Z,jsxs as Ri}from"react/jsx-runtime";import{useLexicalComposerContext as ad}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Si}from"@lexical/utils";import{$getSelection as yi,$isRangeSelection as Li,$isTextNode as cd,COMMAND_PRIORITY_LOW as ud,SELECTION_CHANGE_COMMAND as dd}from"lexical";import{useCallback as Ke,useEffect as ze,useRef as Ii,useState as md}from"react";import*as _e from"react";import{createPortal as fd}from"react-dom";function bo(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function xt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:c=10}=t,u=o.parentElement;if(a===null||u==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let d=r.getBoundingClientRect(),m=o.getBoundingClientRect(),f=u.getBoundingClientRect(),p=a.top-d.height-c,g=a.left-i;l==="center"&&(g=a.left+a.width/2-d.width/2);let b=0;return!e&&p<f.top&&!s&&(b=d.height+a.height+c*2,p+=b),l==="center"?g+d.width>f.right?g=f.right-d.width-i:g<f.left&&(g=f.left+i):g+d.width>f.right&&(g=f.right-d.width-i),g-=m.left,r.style.opacity="1",s&&n!==0?(p-=m.bottom-n+d.height-3,r.style.transform=`translate(${g}px, ${p}px) rotate(180deg)`):(p-=m.top,r.style.transform=`translate(${g}px, ${p}px)`),b}function pd({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&Z(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?Z(Ue,{editor:e,item:o,children:Z(o.ChildComponent,{})},o.key):null}function hd(t){let e=sd(22),{anchorElem:o,editor:n,group:r,index:i}=t,{editorConfig:l}=H(),[s,a]=_e.useState(),c,u;e[0]!==r?(c=()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0)},u=[r],e[0]=r,e[1]=c,e[2]=u):(c=e[1],u=e[2]),_e.useEffect(c,u);let d;e[3]!==r?(d=x=>{let{activeItems:A}=x;if(!A.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0);return}let v=A[0];a(()=>v.ChildComponent)},e[3]=r,e[4]=d):d=e[4];let m=d,f=`inline-toolbar-popup__group inline-toolbar-popup__group-${r.key}`,p;e[5]!==r||e[6]!==s||e[7]!==o||e[8]!==n||e[9]!==m?(p=r.type==="dropdown"&&r.items.length&&(s?Z(me,{anchorElem:o,editor:n,group:r,Icon:s,maxActiveItems:1,onActiveChange:m}):Z(me,{anchorElem:o,editor:n,group:r,maxActiveItems:1,onActiveChange:m})),e[5]=r,e[6]=s,e[7]=o,e[8]=n,e[9]=m,e[10]=p):p=e[10];let g;e[11]!==r||e[12]!==o||e[13]!==n?(g=r.type==="buttons"&&r.items.length&&r.items.map(x=>Z(pd,{anchorElem:o,editor:n,item:x},x.key)),e[11]=r,e[12]=o,e[13]=n,e[14]=g):g=e[14];let b;return e[15]!==l.features.toolbarInline||e[16]!==i||e[17]!==p||e[18]!==g||e[19]!==f||e[20]!==r.key?(b=Ri("div",{className:f,children:[p,g,i<l.features.toolbarInline?.groups.length-1&&Z("div",{className:"divider"})]},r.key),e[15]=l.features.toolbarInline,e[16]=i,e[17]=p,e[18]=g,e[19]=f,e[20]=r.key,e[21]=b):b=e[21],b}function gd({anchorElem:t,editor:e}){let o=Ii(null),n=Ii(null),{editorConfig:r}=H(),i=Ke(()=>{if(o?.current){let c=o.current.style.opacity==="0",u=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),u||(o.current.style.pointerEvents="none")}},[o]),l=Ke(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let u=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";if(!u||!d){let m=c.clientX,f=c.clientY,p=document.elementFromPoint(m,f);o.current.contains(p)||i()}}},[i]),s=Ke(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ze(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ke(()=>{let c=yi(),u=window.getSelection();if(o.current===null)return;let d=t.querySelector(":scope > .link-editor"),m=d!==null&&"style"in d&&d?.style?.opacity==="1",f=e.getRootElement();if(c!==null&&u!==null&&!u.isCollapsed&&f!==null&&f.contains(u.anchorNode)){let p=bo(u,f),g=xt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:p});n.current&&xt({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:p,verticalGap:8})}else i()},[e,i,t]);return ze(()=>{let c=t.parentElement,u=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",u),c&&c.addEventListener("scroll",u),()=>{window.removeEventListener("resize",u),c&&c.removeEventListener("scroll",u)}},[e,a,t]),ze(()=>(e.getEditorState().read(()=>{a()}),Si(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{a()})}),e.registerCommand(dd,()=>(a(),!1),ud))),[e,a]),Ri("div",{className:"inline-toolbar-popup",ref:o,children:[Z("div",{className:"caret",ref:n}),e.isEditable()&&Z(_e.Fragment,{children:r?.features&&r.features?.toolbarInline?.groups.map((c,u)=>Z(hd,{anchorElem:t,editor:e,group:c,index:u},c.key))})]})}function Cd(t,e){let[o,n]=md(!1),r=Ke(()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let i=yi(),l=window.getSelection(),s=t.getRootElement();if(l!==null&&(!Li(i)||s===null||!s.contains(l.anchorNode))){n(!1);return}if(!Li(i))return;if(i.getTextContent()!==""){let c=i.getNodes(),u=!1;for(let d of c)if(cd(d)){n(!0),u=!0;break}u||n(!1)}else n(!1);let a=i.getTextContent().replace(/\n/g,"");if(!i.isCollapsed()&&a===""){n(!1);return}})},[t]);return ze(()=>(document.addEventListener("selectionchange",r),document.addEventListener("mouseup",r),()=>{document.removeEventListener("selectionchange",r),document.removeEventListener("mouseup",r)}),[r]),ze(()=>Si(t.registerUpdateListener(()=>{r()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),[t,r]),o?fd(Z(gd,{anchorElem:e,editor:t}),e):null}var Mi=({anchorElem:t})=>{let[e]=ad();return Cd(e,t)};var xd=S({plugins:[{Component:Mi,position:"floatingAnchorElem"}]});import{TableCellNode as Bm,TableNode as jm,TableRowNode as Gm}from"@lexical/table";import{jsx as vi}from"react/jsx-runtime";import"react";var _o=()=>vi("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:vi("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as B,jsxs as te}from"react/jsx-runtime";import{useLexicalComposerContext as Di}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as _d}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Td,$deleteTableRow__EXPERIMENTAL as Ed,$getNodeTriplet as wd,$getTableCellNodeFromLexicalNode as Nd,$getTableColumnIndexFromTableCellNode as kd,$getTableNodeFromLexicalNodeOrThrow as bt,$getTableRowIndexFromTableCellNode as Ld,$insertTableColumn__EXPERIMENTAL as Id,$insertTableRow__EXPERIMENTAL as Rd,$isTableCellNode as Ze,$isTableRowNode as wo,$isTableSelection as Tt,$unmergeCell as Sd,getTableObserverFromTableElement as yd,TableCellHeaderStates as Te,TableCellNode as Md}from"@lexical/table";import{useScrollInfo as vd}from"@payloadcms/ui";import{$createParagraphNode as Ad,$getRoot as Fd,$getSelection as Et,$isElementNode as Dd,$isParagraphNode as Oi,$isRangeSelection as No,$isTextNode as Od}from"lexical";import*as ko from"react";import{useCallback as oe,useEffect as fe,useRef as _t,useState as Ee}from"react";import{createPortal as Pi}from"react-dom";import{jsx as To,jsxs as bd}from"react/jsx-runtime";import"react";var Ai=()=>bd("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[To("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),To("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),To("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Eo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function Pd(t){let e=t.getNodes(),o=[],n=null,r=null,i=0;for(let l=0;l<e.length;l++){let s=e[l];if(Ze(s)){let a=s.getParentOrThrow();if(!wo(a))throw new Error("Expected CellNode to have a RowNode parent");if(n!==a){if(r!==null&&i!==r)return!1;n!==null&&(r=i),n=a,i=0}let c=s.__colSpan;for(let u=0;u<c;u++)o[i+u]===void 0&&(o[i+u]=0),o[i+u]+=s.__rowSpan;i+=c}}return(r===null||i===r)&&o.every(l=>l===o[0])}function $d(){let t=Et();if(No(t)&&!t.isCollapsed()||Tt(t)&&!t.anchor.is(t.focus)||!No(t)&&!Tt(t))return!1;let[e]=wd(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Fi(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Oi(e)||!e.isEmpty())}function Hd(t){let e=t.getLastDescendant();Od(e)?e.select():Dd(e)?e.selectEnd():e!==null&&e.selectNext()}function Bd({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=Di(),l=_t(null),[s,a]=Ee(r),[c,u]=Ee({columns:1,rows:1}),[d,m]=Ee(!1),[f,p]=Ee(!1),{y:g}=vd();fe(()=>i.registerMutationListener(Md,C=>{C.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),fe(()=>{i.getEditorState().read(()=>{let C=Et();if(Tt(C)){let h=Eo(C);u(Eo(C)),m(Pd(C)&&(h.columns>1||h.rows>1))}p($d())})},[i]),fe(()=>{let C=e.current,h=l.current,I=i.getRootElement();if(C!=null&&h!=null&&I!=null){let k=I.getBoundingClientRect(),w=C.getBoundingClientRect();h.style.opacity="1";let M=h.getBoundingClientRect(),F=5,O=w.right+F;if(O+M.width>window.innerWidth||O+M.width>k.right){let $=w.left-M.width-F;O=($<0?F:$)+window.pageXOffset}h.style.left=`${O+window.pageXOffset}px`;let P=w.top;if(P+M.height>window.innerHeight){let $=w.bottom-M.height;P=($<0?F:$)+window.pageYOffset}h.style.top=`${P}px`}},[e,l,i,g]),fe(()=>{function C(h){l.current!=null&&e.current!=null&&!l.current.contains(h.target)&&!e.current.contains(h.target)&&n(!1)}return window.addEventListener("click",C),()=>window.removeEventListener("click",C)},[n,e]);let b=oe(()=>{i.update(()=>{if(s.isAttached()){let h=bt(s),I=i.getElementByKey(h.getKey());if(!I)throw new Error("Expected to find tableElement in DOM");let k=yd(I);k!==null&&k.clearHighlight(),h.markDirty(),a(s.getLatest())}Fd().selectStart()})},[i,s]),x=()=>{i.update(()=>{let C=Et();if(Tt(C)){let{columns:h,rows:I}=Eo(C),k=C.getNodes(),w=null;for(let M=0;M<k.length;M++){let F=k[M];if(Ze(F))if(w===null){F.setColSpan(h).setRowSpan(I),w=F;let O=Fi(F),P;O&&Oi(P=F.getFirstChild())&&P.remove()}else Ze(w)&&(Fi(F)||w.append(...F.getChildren()),F.remove())}w!==null&&(w.getChildrenSize()===0&&w.append(Ad()),Hd(w)),o()}})},A=()=>{i.update(()=>{Sd()})},v=oe(C=>{i.update(()=>{Rd(C),o()})},[i,o]),T=oe(C=>{i.update(()=>{for(let h=0;h<c.columns;h++)Id(C);o()})},[i,o,c.columns]),E=oe(()=>{i.update(()=>{Ed(),o()})},[i,o]),_=oe(()=>{i.update(()=>{bt(s).remove(),b(),o()})},[i,s,b,o]),L=oe(()=>{i.update(()=>{Td(),o()})},[i,o]),y=oe(()=>{i.update(()=>{let C=bt(s),h=Ld(s),I=C.getChildren();if(h>=I.length||h<0)throw new Error("Expected table cell to be inside of table row.");let k=I[h];if(!wo(k))throw new Error("Expected table row");k.getChildren().forEach(w=>{if(!Ze(w))throw new Error("Expected table cell");w.toggleHeaderStyle(Te.ROW)}),b(),o()})},[i,s,b,o]),R=oe(()=>{i.update(()=>{let C=bt(s),h=kd(s),I=C.getChildren(),k=Math.max(...I.map(w=>w.getChildren().length));if(h>=k||h<0)throw new Error("Expected table cell to be inside of table row.");for(let w=0;w<I.length;w++){let M=I[w];if(!wo(M))throw new Error("Expected table row");let F=M.getChildren();if(h>=F.length)continue;let O=F[h];if(!Ze(O))throw new Error("Expected table cell");O.toggleHeaderStyle(Te.COLUMN)}b(),o()})},[i,s,b,o]),N=null;return t&&(d?N=B("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>x(),type:"button",children:"Merge cells"}):f&&(N=B("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>A(),type:"button",children:"Unmerge cells"}))),Pi(te("div",{className:"table-action-menu-dropdown",onClick:C=>{C.stopPropagation()},ref:l,children:[N?te(ko.Fragment,{children:[N,B("hr",{})]}):null,B("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>v(!1),type:"button",children:te("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),B("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>v(!0),type:"button",children:te("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>T(!1),type:"button",children:te("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),B("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>T(!0),type:"button",children:te("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),B("hr",{}),B("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>L(),type:"button",children:B("span",{className:"text",children:"Delete column"})}),B("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>E(),type:"button",children:B("span",{className:"text",children:"Delete row"})}),B("button",{className:"item","data-test-id":"table-delete",onClick:()=>_(),type:"button",children:B("span",{className:"text",children:"Delete table"})}),B("hr",{}),B("button",{className:"item",onClick:()=>y(),type:"button",children:te("span",{className:"text",children:[(s.__headerState&Te.ROW)===Te.ROW?"Remove":"Add"," ","row header"]})}),B("button",{className:"item","data-test-id":"table-column-header",onClick:()=>R(),type:"button",children:te("span",{className:"text",children:[(s.__headerState&Te.COLUMN)===Te.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function jd({anchorElem:t,cellMerge:e}){let[o]=Di(),n=_t(null),r=_t(null),[i,l]=Ee(!1),[s,a]=Ee(null),c=oe(()=>{let d=n.current,m=Et(),f=window.getSelection(),p=document.activeElement;if(m==null||d==null){a(null);return}let g=o.getRootElement();if(No(m)&&g!==null&&f!==null&&g.contains(f.anchorNode)){let b=Nd(m.anchor.getNode());if(b==null){a(null);return}if(o.getElementByKey(b.getKey())==null){a(null);return}a(b)}else p||a(null)},[o]);fe(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{c()})})),fe(()=>{let d=n.current;if(d!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let f=m.getBoundingClientRect(),p=d.getBoundingClientRect(),g=t.getBoundingClientRect(),b=f.top-g.top+4,x=f.right-p.width-10-g.left;d.style.opacity="1",d.style.transform=`translate(${x}px, ${b}px)`}else d.style.opacity="0",d.style.transform="translate(-10000px, -10000px)"}},[n,s,o,t]);let u=_t(s);return fe(()=>{u.current!==s&&l(!1),u.current=s},[u,s]),B("div",{className:"table-cell-action-button-container",ref:n,children:s!=null&&te(ko.Fragment,{children:[B("button",{className:"table-cell-action-button",onClick:d=>{d.stopPropagation(),l(!i)},ref:r,type:"button",children:B(Ai,{})}),i&&B(Bd,{cellMerge:e,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var $i=({anchorElem:t})=>{let e=_d();return Pi(e?B(jd,{anchorElem:t??document.body,cellMerge:!0}):null,t??document.body)};import{jsx as kt,jsxs as Gd}from"react/jsx-runtime";import{useLexicalComposerContext as Ud}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Wd}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Vd,$getTableNodeFromLexicalNodeOrThrow as Lo,$getTableRowIndexFromTableCellNode as Kd,$isTableCellNode as Hi,$isTableRowNode as zd,getDOMCellFromTarget as Zd}from"@lexical/table";import{calculateZoomLevel as Bi}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Io}from"lexical";import*as ji from"react";import{useCallback as we,useEffect as Yd,useMemo as Xd,useRef as wt,useState as Nt}from"react";import{createPortal as Jd}from"react-dom";var qd=33,Qd=50;function em({editor:t}){let e=wt(null),o=wt(null),n=wt(null),r=H(),i=wt(null),[l,s]=Nt(null),[a,c]=Nt(null),[u,d]=Nt(!1),[m,f]=Nt(null),p=we(()=>{c(null),e.current=null,f(null),i.current=null,n.current=null},[]),g=N=>(N.buttons&1)===1;Yd(()=>{let N=k=>{setTimeout(()=>{let w=k.target;if(m){s({x:k.clientX,y:k.clientY});return}if(d(g(k)),!(o.current&&o.current.contains(w))&&e.current!==w){e.current=w;let M=Zd(w);M&&a!==M?t.update(()=>{let F=Io(M.elem);if(!F)throw new Error("TableCellResizer: Table cell node not found.");let O=Lo(F),P=t.getElementByKey(O.getKey());if(!P)throw new Error("TableCellResizer: Table element not found.");e.current=w,n.current=P.getBoundingClientRect(),c(M)}):M==null&&p()}},0)},C=k=>{setTimeout(()=>{d(!0)},0)},h=k=>{setTimeout(()=>{d(!1)},0)},I=t.registerRootListener((k,w)=>{k?.addEventListener("mousemove",N),k?.addEventListener("mousedown",C),k?.addEventListener("mouseup",h),w?.removeEventListener("mousemove",N),w?.removeEventListener("mousedown",C),w?.removeEventListener("mouseup",h)});return()=>{I()}},[a,m,t,p]);let b=N=>N==="bottom",x=we(N=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let C=Io(a.elem);if(!Hi(C))throw new Error("TableCellResizer: Table cell node not found.");let h=Lo(C),I=Kd(C),k=h.getChildren();if(I>=k.length||I<0)throw new Error("Expected table cell to be inside of table row.");let w=k[I];if(!zd(w))throw new Error("Expected table row");let M=w.getHeight();if(M===void 0){let O=w.getChildren();M=Math.min(...O.map(P=>v(P,t)??1/0))}let F=Math.max(M+N,qd);w.setHeight(F)},{tag:"skip-scroll-into-view"})},[a,t]),A=(N,C)=>{let h=N.getWidth();if(h!==void 0)return h;let I=C.getElementByKey(N.getKey());if(I==null)return;let k=getComputedStyle(I);return I.clientWidth-parseFloat(k.paddingLeft)-parseFloat(k.paddingRight)},v=(N,C)=>C.getElementByKey(N.getKey())?.clientHeight,T=(N,C)=>{for(let h=0;h<C.length;h++)for(let I=0;I<C[h].length;I++)if(C[h][I].cell===N)return I},E=we(N=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let C=Io(a.elem);if(!Hi(C))throw new Error("TableCellResizer: Table cell node not found.");let h=Lo(C),[I]=Vd(h,null,null),k=T(C,I);if(k===void 0)throw new Error("TableCellResizer: Table column not found.");for(let w=0;w<I.length;w++){let M=I[w][k];if(M.startRow===w&&(k===I[w].length-1||I[w][k].cell!==I[w][k+1].cell)){let F=A(M.cell,t);if(F===void 0)continue;let O=Math.max(F+N,Qd);M.cell.setWidth(O)}}},{tag:"skip-scroll-into-view"})},[a,t]),_=we(N=>{let C=h=>{if(h.preventDefault(),h.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:I,y:k}=i.current;if(a===null)return;let w=Bi(h.target);if(b(N)){let M=(h.clientY-k)/w;x(M)}else{let M=(h.clientX-I)/w;E(M)}p(),document.removeEventListener("mouseup",C)}};return C},[a,p,E,x]),L=we(N=>C=>{if(C.preventDefault(),C.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:C.clientX,y:C.clientY},s(i.current),f(N),document.addEventListener("mouseup",_(N))},[a,_]),R=we(()=>{if(a){let{height:N,left:C,top:h,width:I}=a.elem.getBoundingClientRect(),k=Bi(a.elem),w=10,M={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${w}px`,left:`${window.pageXOffset+C}px`,top:`${window.pageYOffset+h+N-w/2}px`,width:`${I}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${N}px`,left:`${window.pageXOffset+C+I-w/2}px`,top:`${window.pageYOffset+h}px`,width:`${w}px`}},F=n.current;return m&&l&&F&&(b(m)?(M[m].left=`${window.pageXOffset+F.left}px`,M[m].top=`${window.pageYOffset+l.y/k}px`,M[m].height="3px",M[m].width=`${F.width}px`):(M[m].top=`${window.pageYOffset+F.top}px`,M[m].left=`${window.pageXOffset+l.x/k}px`,M[m].width="3px",M[m].height=`${F.height}px`),M[m].backgroundColor="#adf"),M}return{bottom:null,left:null,right:null,top:null}},[a,m,l])();return kt("div",{ref:o,children:a!=null&&!u&&Gd(ji.Fragment,{children:[kt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:L("right"),style:R.right||void 0}),kt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:L("bottom"),style:R.bottom||void 0})]})})}var Gi=()=>{let[t]=Ud(),e=Wd();return Xd(()=>e?Jd(kt(em,{editor:t}),document.body):null,[t,e])};import{jsx as Ro,jsxs as sm,Fragment as am}from"react/jsx-runtime";import{useLexicalComposerContext as cm}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as um,$getTableRowIndexFromTableCellNode as dm,$insertTableColumn__EXPERIMENTAL as mm,$insertTableRow__EXPERIMENTAL as fm,$isTableCellNode as pm,$isTableNode as Vi,TableNode as hm}from"@lexical/table";import{$findMatchingParent as gm,mergeRegister as Cm}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ki}from"lexical";import{useEffect as zi,useRef as Zi,useState as Lt}from"react";import"react";import{createPortal as xm}from"react-dom";import{useMemo as im,useRef as lm}from"react";var tm="Expected a function",om=Math.max,rm=Math.min;function nm(t,e,o){let n,r,i=0,l,s=!1,a=!1,c,u,d,m=!0;if(typeof t!="function")throw new TypeError(tm);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,c=a?om(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function f(_){let L=n,y=l;return n=l=void 0,i=_,u=t.apply(y,L),u}function p(_){return i=_,d=setTimeout(x,e),s?f(_):u}function g(_){let L=_-r,y=_-i,R=e-L;return a?rm(R,c-y):R}function b(_){let L=_-r,y=_-i;return r===void 0||L>=e||L<0||a&&y>=c}function x(){let _=Date.now();if(b(_))return A(_);d=setTimeout(x,g(_))}function A(_){return d=void 0,m&&n?f(_):(n=l=void 0,u)}function v(){d!==void 0&&clearTimeout(d),i=0,n=r=l=d=void 0}function T(){return d===void 0?u:A(Date.now())}function E(){let _=Date.now(),L=b(_);if(n=arguments,l=this,r=_,L){if(d===void 0)return p(r);if(a)return clearTimeout(d),d=setTimeout(x,e),f(r)}return d===void 0&&(d=setTimeout(x,e)),u}return E.cancel=v,E.flush=T,E}var Ui=nm;function Wi(t,e,o){let n=lm(null);return n.current=t,im(()=>Ui((...r)=>{n.current&&n.current(...r)},e,{maxWait:o}),[e,o])}var Yi=20;function bm({anchorElem:t}){let[e]=cm(),o=H(),[n,r]=Lt(!1),[i,l]=Lt(!1),[s,a]=Lt(!1),[c,u]=Lt({}),d=Zi(new Set),m=Zi(null),f=Wi(g=>{let{isOutside:b,tableDOMNode:x}=_m(g,o.editorConfig?.lexical);if(b){r(!1),l(!1);return}if(!x)return;m.current=x;let A=null,v=null,T=null;if(e.update(()=>{let E=Ki(x);if(pm(E)){let _=gm(E,L=>Vi(L));if(!Vi(_))return;if(T=e.getElementByKey(_?.getKey()),T){let L=_.getChildrenSize(),y=_.getChildAtIndex(0)?.getChildrenSize(),R=dm(E),N=um(E);R===L-1?A=E:N===y-1&&(v=E)}}}),T){let{bottom:E,height:_,right:L,width:y,x:R,y:N}=T.getBoundingClientRect(),{left:C,y:h}=t.getBoundingClientRect();A?(l(!1),r(!0),u({height:Yi,left:R-C,top:E-h+5,width:y})):v&&(l(!0),r(!1),u({height:_,left:L-C+5,top:N-h,width:Yi}))}},50,250);zi(()=>{if(s)return document.addEventListener("mousemove",f),()=>{r(!1),l(!1),document.removeEventListener("mousemove",f)}},[s,f]),zi(()=>Cm(e.registerMutationListener(hm,g=>{e.getEditorState().read(()=>{for(let[b,x]of g)switch(x){case"created":d.current.add(b),a(d.current.size>0);break;case"destroyed":d.current.delete(b),a(d.current.size>0);break;default:break}})},{skipInitialization:!1})),[e]);let p=g=>{e.update(()=>{m.current&&(Ki(m.current)?.selectEnd(),g?(fm(),r(!1)):(mm(),l(!1)))})};return sm(am,{children:[n&&Ro("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>p(!0),style:{...c}}),i&&Ro("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>p(!1),style:{...c}})]})}function _m(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function Xi({anchorElem:t=document.body}){return xm(Ro(bm,{anchorElem:t}),t)}import{c as Tm}from"react/compiler-runtime";import{jsx as So,jsxs as Em}from"react/jsx-runtime";import{useLexicalComposerContext as wm}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Nm}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as km,TableNode as Lm}from"@lexical/table";import{mergeRegister as Im}from"@lexical/utils";import{formatDrawerSlug as Rm,useEditDepth as Sm,useModal as ym}from"@payloadcms/ui";import{$getSelection as Mm,$isRangeSelection as vm,COMMAND_PRIORITY_EDITOR as Am,createCommand as Fm}from"lexical";import{createContext as Dm,useContext as Om,useEffect as Pm,useMemo as $m,useState as Hm}from"react";import*as Ji from"react";var It=Fm("OPEN_EMBED_DRAWER_COMMAND"),qi=Dm({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function Qi({children:t}){let[e,o]=Hm({cellEditorConfig:null,cellEditorPlugins:null});return So(qi.Provider,{value:$m(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var el=()=>{let t=Tm(18),[e]=wm(),o=Om(qi),{closeModal:n,toggleModal:r}=ym(),i=Sm(),{uuid:l}=H(),s="lexical-table-create-"+l,a;t[0]!==s||t[1]!==i?(a=Rm({slug:s,depth:i}),t[0]=s,t[1]=i,t[2]=a):a=t[2];let c=a,u;t[3]!==e||t[4]!==r||t[5]!==c?(u=()=>{if(!e.hasNodes([Lm]))throw new Error("TablePlugin: TableNode is not registered on editor");return Im(e.registerCommand(It,()=>{let p;return p=null,e.getEditorState().read(()=>{let g=Mm();vm(g)&&(p=g)}),p&&r(c),!0},Am))},t[3]=e,t[4]=r,t[5]=c,t[6]=u):u=t[6];let d;t[7]!==o||t[8]!==e||t[9]!==r?(d=[o,e,r],t[7]=o,t[8]=e,t[9]=r,t[10]=d):d=t[10],Pm(u,d);let m;t[11]!==n||t[12]!==c||t[13]!==e?(m=(p,g)=>{n(c),!(!g.columns||!g.rows)&&e.dispatchCommand(km,{columns:String(g.columns),rows:String(g.rows)})},t[11]=n,t[12]=c,t[13]=e,t[14]=m):m=t[14];let f;return t[15]!==c||t[16]!==m?(f=Em(Ji.Fragment,{children:[So(ae,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPathSuffix:"fields"}),So(Nm,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[15]=c,t[16]=m,t[17]=f):f=t[17],f};var Um=S({nodes:[jm,Bm,Gm],plugins:[{Component:el,position:"normal"},{Component:Gi,position:"normal"},{Component:$i,position:"floatingAnchorElem"},{Component:Xi,position:"floatingAnchorElem"}],providers:[Qi],slashMenu:{groups:[G([{Icon:_o,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(It,{})}}])]},toolbarFixed:{groups:[X([{ChildComponent:_o,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(It,{})}}])]}});import{$isNodeSelection as pf}from"lexical";import{jsx as yo,jsxs as Wm}from"react/jsx-runtime";import"react";var Mo=()=>Wm("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:[yo("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"}),yo("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"}),yo("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{c as ef}from"react/compiler-runtime";import{jsx as tf}from"react/jsx-runtime";import{useLexicalComposerContext as of}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as rf,mergeRegister as nf}from"@lexical/utils";import{useConfig as lf}from"@payloadcms/ui";import{$getPreviousSelection as sf,$getSelection as af,$isParagraphNode as ol,$isRangeSelection as cf,COMMAND_PRIORITY_EDITOR as uf,createCommand as df}from"lexical";import{useEffect as mf}from"react";import{c as Vm}from"react/compiler-runtime";import{jsx as vo}from"react/jsx-runtime";import{useLexicalComposerContext as Km}from"@lexical/react/LexicalComposerContext.js";import{useListDrawer as zm}from"@payloadcms/ui";import{$getNodeByKey as Zm,COMMAND_PRIORITY_EDITOR as Ym}from"lexical";import{useEffect as Xm,useState as Jm}from"react";var qm=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=Zm(o);r&&r.replace(Ae({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(Ao,{fields:null,relationTo:e,value:n})},Qm=t=>{let e=Vm(13),{enabledCollectionSlugs:o}=t,[n]=Km(),[r,i]=Jm(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let[s,a,c]=zm(l),{closeDrawer:u,openDrawer:d}=c,m,f;e[2]!==n||e[3]!==d?(m=()=>n.registerCommand(Me,x=>(i(x?.replace?x?.replace.nodeKey:null),d(),!0),Ym),f=[n,d],e[2]=n,e[3]=d,e[4]=m,e[5]=f):(m=e[4],f=e[5]),Xm(m,f);let p;e[6]!==n||e[7]!==r||e[8]!==u?(p=x=>{let{collectionSlug:A,docID:v}=x;qm({editor:n,relationTo:A,replaceNodeKey:r,value:v}),u()},e[6]=n,e[7]=r,e[8]=u,e[9]=p):p=e[9];let g=p,b;return e[10]!==g||e[11]!==s?(b=vo(s,{onSelect:g}),e[10]=g,e[11]=s,e[12]=b):b=e[12],b},tl=t=>vo(qe,{...t,uploads:!0,children:vo(Qm,{...t})});var Ao=df("INSERT_UPLOAD_COMMAND"),rl=t=>{let e=ef(5),[o]=of(),{config:n}=lf(),{collections:r}=n,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return nf(o.registerCommand(Ao,a=>(o.update(()=>{let c=af()||sf();if(cf(c)){let u=Ae({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});rf(u);let{focus:d}=c,m=d.getNode();ol(m)&&m.getTextContentSize()===0&&m.getParentOrThrow().getChildren().filter(f=>ol(f)).length>1&&m.remove()}}),!0),uf))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),mf(i,l);let s;return e[3]!==r?(s=tf(tl,{enabledCollectionSlugs:r.map(ff)}),e[3]=r,e[4]=s):s=e[4],s};function ff(t){let{slug:e}=t;return e}var hf=S({nodes:[ve],plugins:[{Component:rl,position:"normal"}],slashMenu:{groups:[G([{Icon:Mo,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Me,{replace:!1})}}])]},toolbarFixed:{groups:[X([{ChildComponent:Mo,isActive:({selection:t})=>{if(!pf(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Dt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Me,{replace:!1})}}])]}});import{c as gf}from"react/compiler-runtime";import{jsx as Fo}from"react/jsx-runtime";import{ShimmerEffect as Cf}from"@payloadcms/ui";import{lazy as xf,Suspense as bf,useEffect as _f,useState as Tf}from"react";var Ef=xf(()=>import("./Field-ETCEVZLL.js").then(t=>({default:t.RichText}))),wf=t=>{let e=gf(11),{admin:o,field:n,lexicalEditorConfig:r}=t,i;e[0]!==o?(i=o===void 0?{}:o,e[0]=o,e[1]=i):i=e[1];let l=i,{richTextComponentMap:s}=n,[a,c]=Tf(null),u,d;e[2]!==a||e[3]!==s||e[4]!==r||e[5]!==l?(u=()=>{if(a)return;let f=s?.get("features"),p=[];for(let x of f)p.push(x.clientFeature(x.clientFeatureProps));let g=r||Fe,b=Qe({unSanitizedEditorConfig:{features:p,lexical:g}});c(De(b,g,l))},d=[r,s,l,a],e[2]=a,e[3]=s,e[4]=r,e[5]=l,e[6]=u,e[7]=d):(u=e[6],d=e[7]),_f(u,d);let m;return e[8]!==a||e[9]!==t?(m=Fo(bf,{fallback:Fo(Cf,{height:"35vh"}),children:a&&Fo(Ef,{...t,editorConfig:a})}),e[8]=a,e[9]=t,e[10]=m):m=e[10],m};function Nf(...t){return t.filter(Boolean).join(" ")}var Rt=new WeakMap;function nl(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function St(t,e){let o=Rt.get(t);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=nl(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=nl(l);for(let c of n)a!==null&&c([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",r),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:r,listeners:n,start:null},Rt.set(t,o)}return o.listeners.add(e),()=>{kf(t,e)}}function kf(t,e){let o=Rt.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Rt.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Lf(t,e){return St(t,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&e(r,n)})}function If(t,e){return St(t,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&e(r,n)})}function Rf(t,e){return St(t,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&e(r,n)})}function Sf(t,e){return St(t,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&e(r,n)})}var D={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},yf=D.IS_BOLD|D.IS_ITALIC|D.IS_STRIKETHROUGH|D.IS_UNDERLINE|D.IS_CODE|D.IS_SUBSCRIPT|D.IS_SUPERSCRIPT|D.IS_HIGHLIGHT,Mf="\xA0",vf=`
|
|
36
36
|
|
|
37
|
-
`,
|
|
37
|
+
`,il="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",ll="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Af=new RegExp("^[^"+ll+"]*["+il+"]"),Ff=new RegExp("^[^"+il+"]*["+ll+"]"),Df={bold:D.IS_BOLD,code:D.IS_CODE,highlight:D.IS_HIGHLIGHT,italic:D.IS_ITALIC,strikethrough:D.IS_STRIKETHROUGH,subscript:D.IS_SUBSCRIPT,superscript:D.IS_SUPERSCRIPT,underline:D.IS_UNDERLINE},Of={directionless:D.IS_DIRECTIONLESS,unmergeable:D.IS_UNMERGEABLE},Pf={center:D.IS_ALIGN_CENTER,end:D.IS_ALIGN_END,justify:D.IS_ALIGN_JUSTIFY,left:D.IS_ALIGN_LEFT,right:D.IS_ALIGN_RIGHT,start:D.IS_ALIGN_START},$f={[D.IS_ALIGN_CENTER]:"center",[D.IS_ALIGN_END]:"end",[D.IS_ALIGN_JUSTIFY]:"justify",[D.IS_ALIGN_LEFT]:"left",[D.IS_ALIGN_RIGHT]:"right",[D.IS_ALIGN_START]:"start"},Hf={normal:D.IS_NORMAL,segmented:D.IS_SEGMENTED,token:D.IS_TOKEN},Bf={[D.IS_NORMAL]:"normal",[D.IS_SEGMENTED]:"segmented",[D.IS_TOKEN]:"token"};export{Pe as $createAutoLinkNode,vt as $createBlockNode,J as $createLinkNode,ye as $createRelationshipNode,Ae as $createUploadNode,Q as $isAutoLinkNode,cl as $isBlockNode,j as $isLinkNode,Ft as $isRelationshipNode,Dt as $isUploadNode,Sl as AlignFeatureClient,q as AutoLinkNode,Ne as BlockNode,Dl as BlockquoteFeatureClient,ts as BlocksFeatureClient,Es as BoldFeatureClient,K as CAN_USE_DOM,Hc as ChecklistFeatureClient,Of as DETAIL_TYPE_TO_DETAIL,vf as DOUBLE_LINE_BREAK,$f as ELEMENT_FORMAT_TO_TYPE,Pf as ELEMENT_TYPE_TO_FORMAT,fl as ENABLE_SLASH_MENU_COMMAND,al as EditorConfigProvider,ae as FieldsDrawer,ld as FixedToolbarFeatureClient,qs as HeadingFeatureClient,aa as HorizontalRuleFeatureClient,yf as IS_ALL_FORMATTING,fa as IndentFeatureClient,Ls as InlineCodeFeatureClient,xd as InlineToolbarFeatureClient,Ss as ItalicFeatureClient,Ff as LTR_REGEX,su as LexicalPluginToLexicalFeatureClient,Nc as LinkFeatureClient,V as LinkNode,Mf as NON_BREAKING_SPACE,D as NodeFormat,zc as OrderedListFeatureClient,hu as ParagraphFeatureClient,dl as Point,Af as RTL_REGEX,pl as Rect,Ou as RelationshipFeatureClient,Se as RelationshipNode,Nl as RichTextCell,wf as RichTextField,fu as SlateToLexicalFeatureClient,As as StrikethroughFeatureClient,Os as SubscriptFeatureClient,Hs as SuperscriptFeatureClient,Hf as TEXT_MODE_TO_TYPE,Df as TEXT_TYPE_TO_FORMAT,Bf as TEXT_TYPE_TO_MODE,Y as TOGGLE_LINK_COMMAND,Um as TableFeatureClient,ps as TestRecorderFeatureClient,Ue as ToolbarButton,me as ToolbarDropdown,bs as TreeViewFeatureClient,Us as UnderlineFeatureClient,tu as UnorderedListFeatureClient,hf as UploadFeatureClient,ve as UploadNode,Sf as addSwipeDownListener,Lf as addSwipeLeftListener,If as addSwipeRightListener,Rf as addSwipeUpListener,zt as createBlockNode,S as createClientFeature,Fe as defaultEditorLexicalConfig,bo as getDOMRangeRect,Mt as getEnabledNodes,pe as getSelectedNode,ul as isHTMLElement,ml as isPoint,Nf as joinClasses,De as sanitizeClientEditorConfig,Bo as sanitizeClientFeatures,xt as setFloatingElemPosition,dt as setFloatingElemPositionForLinkEditor,G as slashMenuBasicGroupWithItems,X as toolbarAddDropdownGroupWithItems,Yt as toolbarFeatureButtonsGroupWithItems,U as toolbarFormatGroupWithItems,W as toolbarTextDropdownGroupWithItems,H as useEditorConfigContext};
|
|
38
38
|
//# sourceMappingURL=index.js.map
|