@payloadcms/richtext-lexical 4.0.0-internal.38b7f1d → 4.0.0-internal.c2b57ce
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/exports/client/{Field-PJW7KUJG.js → Field-VMNLDBRS.js} +2 -2
- package/dist/exports/client/Field-VMNLDBRS.js.map +7 -0
- package/dist/exports/client/{RelationshipComponent-5RONAYJM.js → RelationshipComponent-RZL743CS.js} +2 -2
- package/dist/exports/client/{RelationshipComponent-5RONAYJM.js.map → RelationshipComponent-RZL743CS.js.map} +2 -2
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-44G3K3W7.js → chunk-74RUDY7K.js} +2 -2
- package/dist/exports/client/{chunk-44G3K3W7.js.map → chunk-74RUDY7K.js.map} +2 -2
- package/dist/exports/client/component-2ZTDKRVK.js +2 -0
- package/dist/exports/client/{component-53Y3RYR5.js.map → component-2ZTDKRVK.js.map} +2 -2
- package/dist/exports/client/componentInline-JYKBUUPZ.js +2 -0
- package/dist/exports/client/index.js +4 -4
- package/dist/exports/client/index.js.map +3 -3
- package/dist/features/align/client/toolbarAlignGroup.d.ts.map +1 -1
- package/dist/features/blocks/client/component/index.js +2 -2
- package/dist/features/blocks/client/component/index.js.map +1 -1
- package/dist/features/blocks/client/componentInline/components/InlineBlockContainer.d.ts.map +1 -1
- package/dist/features/blocks/client/componentInline/index.js +2 -2
- package/dist/features/blocks/client/componentInline/index.js.map +1 -1
- package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -1
- package/dist/features/blocks/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -1
- package/dist/features/blocks/server/validate.d.ts.map +1 -1
- package/dist/features/converters/htmlToLexical/index.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/table.js +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/table.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/async/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/shared/cssColors.d.ts.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/table.js +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/table.js.map +1 -1
- package/dist/features/converters/lexicalToHtml/sync/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToJSX/converter/converters/upload.js.map +1 -1
- package/dist/features/converters/lexicalToMarkdown/index.d.ts.map +1 -1
- package/dist/features/converters/markdownToLexical/index.d.ts.map +1 -1
- package/dist/features/format/shared/toolbarFormatGroup.d.ts.map +1 -1
- package/dist/features/indent/client/toolbarIndentGroup.d.ts.map +1 -1
- package/dist/features/link/client/plugins/autoLink/index.d.ts.map +1 -1
- package/dist/features/link/markdownTransformer.d.ts.map +1 -1
- package/dist/features/link/server/baseFields.d.ts.map +1 -1
- package/dist/features/link/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/link/server/validate.d.ts.map +1 -1
- package/dist/features/lists/shared/markdown.d.ts.map +1 -1
- package/dist/features/relationship/client/components/RelationshipComponent.js +2 -2
- package/dist/features/relationship/client/components/RelationshipComponent.js.map +1 -1
- package/dist/features/relationship/client/components/index.css +2 -2
- package/dist/features/relationship/client/drawer/index.d.ts.map +1 -1
- package/dist/features/relationship/client/utils/useEnabledRelationships.d.ts.map +1 -1
- package/dist/features/relationship/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/shared/toolbar/addDropdownGroup.d.ts.map +1 -1
- package/dist/features/shared/toolbar/featureButtonsGroup.d.ts.map +1 -1
- package/dist/features/shared/toolbar/textDropdownGroup.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarButton/index.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.d.ts.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js +1 -2
- package/dist/features/toolbars/shared/ToolbarDropdown/DropDown.js.map +1 -1
- package/dist/features/toolbars/shared/ToolbarDropdown/index.d.ts.map +1 -1
- package/dist/features/upload/client/component/index.css +4 -2
- package/dist/features/upload/client/component/index.js +3 -3
- 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/server/graphQLPopulationPromise.d.ts.map +1 -1
- package/dist/features/upload/server/validate.d.ts.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +3 -4
- package/dist/field/Field.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/lexical/config/client/EditorConfigProvider.d.ts.map +1 -1
- package/dist/lexical/config/client/sanitize.d.ts.map +1 -1
- package/dist/lexical/config/server/sanitize.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/DraggableBlockPlugin/debounce.d.ts.map +1 -1
- package/dist/lexical/plugins/handles/utils/calculateDistanceFromScrollerElem.d.ts.map +1 -1
- package/dist/lexical/theme/EditorTheme.css +2 -2
- package/dist/lexical/utils/markdown/createBlockNode.d.ts.map +1 -1
- package/dist/populateGraphQL/populateLexicalPopulationPromises.d.ts.map +1 -1
- package/dist/populateGraphQL/recursivelyPopulateFieldsForGraphQL.d.ts.map +1 -1
- package/dist/utilities/editorConfigFactory.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDocumentDrawer.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalDrawer.d.ts.map +1 -1
- package/dist/utilities/fieldsDrawer/useLexicalListDrawer.d.ts.map +1 -1
- package/dist/utilities/generateImportMap.d.ts.map +1 -1
- package/dist/utilities/generateSchemaMap.d.ts.map +1 -1
- package/dist/utilities/getDefaultSanitizedEditorConfig.d.ts.map +1 -1
- package/dist/utilities/recurseNodeTree.d.ts.map +1 -1
- package/dist/utilities/upgradeLexicalData/upgradeDocumentFieldsRecursively.d.ts.map +1 -1
- package/dist/utilities/useLexicalFeature.d.ts.map +1 -1
- package/dist/validate/index.d.ts.map +1 -1
- package/package.json +12 -12
- package/dist/exports/client/Field-PJW7KUJG.js.map +0 -7
- package/dist/exports/client/component-53Y3RYR5.js +0 -2
- package/dist/exports/client/componentInline-PM4PLNUK.js +0 -2
- /package/dist/exports/client/{componentInline-PM4PLNUK.js.map → componentInline-JYKBUUPZ.js.map} +0 -0
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use client";import{a as ke,c as bt,d as kt,e as _t}from"./chunk-
|
|
1
|
+
"use client";import{a as ke,c as bt,d as kt,e as _t}from"./chunk-74RUDY7K.js";import{a as Qe}from"./chunk-DBWINSQN.js";import{a as Bo,b as et}from"./chunk-QJ5EETIB.js";import{a as Fe}from"./chunk-INBEEENE.js";import{a as eu}from"./chunk-WSAPGI3Z.js";import{b as Wt,c as zt,d as se,e as xr,f as Po,g as jo,h as tu,i as ou,k as nu,m as ru,p as lu}from"./chunk-FTT5KJ6W.js";import{a as Qc,b as G}from"./chunk-BZZVLW4U.js";function X(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{c as uu}from"react/compiler-runtime";import{useLexicalComposerContext as du}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as _e}from"@lexical/react/LexicalDecoratorBlockNode";import{$findMatchingParent as mu}from"@lexical/utils";import{$getSelection as pu,$isElementNode as pe,$isNodeSelection as fu,$isRangeSelection as Tt,COMMAND_PRIORITY_LOW as hu,FORMAT_ELEMENT_COMMAND as wt}from"lexical";import{useEffect as gu}from"react";import{jsx as Cr}from"react/jsx-runtime";import"react";var iu="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m3 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5M7.5 15a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",br=({className:t})=>Cr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Cr("path",{clipRule:"evenodd",d:iu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as kr}from"react/jsx-runtime";import"react";var su="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",_r=({className:t})=>kr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:kr("path",{clipRule:"evenodd",d:su,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Tr}from"react/jsx-runtime";import"react";var au="M5 7.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m0 4a.5.5 0 0 1 .5-.5h7a.5.5 0 0 1 0 1h-7a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h9a.5.5 0 0 0 0-1z",Kt=({className:t})=>Tr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Tr("path",{clipRule:"evenodd",d:au,fill:"currentColor",fillRule:"evenodd"})});import{jsx as wr}from"react/jsx-runtime";import"react";var cu="M19 7.5a.5.5 0 0 0-.5-.5h-13a.5.5 0 0 0 0 1h13a.5.5 0 0 0 .5-.5m0 4a.5.5 0 0 0-.5-.5h-7a.5.5 0 0 0 0 1h7a.5.5 0 0 0 .5-.5m-.5 3.5a.5.5 0 0 1 0 1h-9a.5.5 0 0 1 0-1z",Sr=({className:t})=>wr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:wr("path",{clipRule:"evenodd",d:cu,fill:"currentColor",fillRule:"evenodd"})});var $=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a})=>{let m=t({config:r,featureClientImportMap:l,featureClientSchemaMap:s,featureProviderMap:i,field:d,props:o,resolvedFeatures:c,schemaPath:u,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var Er=t=>({type:"dropdown",ChildComponent:Kt,iconOnly:!0,items:t,key:"align",order:30});var Me=t=>pe(t)?t.getFormatType():t.__format,Nr=[Er([{ChildComponent:Kt,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||_e(e))&&Me(e)==="left")continue;let o=e.getParent();if(!((pe(o)||_e(o))&&Me(o)==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(wt,"left")},order:1},{ChildComponent:br,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||_e(e))&&Me(e)==="center")continue;let o=e.getParent();if(!((pe(o)||_e(o))&&Me(o)==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(wt,"center")},order:2},{ChildComponent:Sr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||_e(e))&&Me(e)==="right")continue;let o=e.getParent();if(!((pe(o)||_e(o))&&Me(o)==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(wt,"right")},order:3},{ChildComponent:_r,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if((pe(e)||_e(e))&&Me(e)==="justify")continue;let o=e.getParent();if(!((pe(o)||_e(o))&&Me(o)==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(wt,"justify")},order:4}])],xu=()=>{let t=uu(3),[e]=du(),o,n;return t[0]!==e?(o=()=>e.registerCommand(wt,ku,hu),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),gu(o,n),null},Cu=$({plugins:[{Component:xu,position:"normal"}],toolbarFixed:{groups:Nr},toolbarInline:{groups:Nr}});function bu(t){return(pe(t)||_e(t))&&!t.isInline()}function ku(t){let e=pu();if(!Tt(e)&&!fu(e))return!1;let o=e.getNodes();for(let n of o){let r=mu(n,bu);r!==null&&r.setFormat(t)}return!0}import{$createQuoteNode as $r,$isQuoteNode as Ir,QuoteNode as Eu}from"@lexical/rich-text";import{$setBlocksType as Ar}from"@lexical/selection";import{$getSelection as Dr,$isRangeSelection as Nu}from"lexical";import{jsx as Lr}from"react/jsx-runtime";import"react";var _u="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",Ho=({className:t})=>Lr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Lr("path",{d:_u,fill:"currentColor"})});import{jsx as yr}from"react/jsx-runtime";import"react";var Tu={16:"M3 3.5a.5.5 0 0 1 .5-.5h9a.5.5 0 0 1 .5.5V5a.5.5 0 0 1-1 0V4H8.5v8h1a.5.5 0 0 1 0 1h-3a.5.5 0 0 1 0-1h1V4H4v1a.5.5 0 0 1-1 0z",24:"M6 6.5a.5.5 0 0 1 .5-.5h11a.5.5 0 0 1 .5.5V9a.5.5 0 0 1-1 0V7h-4.5v10h2a.5.5 0 0 1 0 1h-5a.5.5 0 0 1 0-1h2V7H7v2a.5.5 0 0 1-1 0z"},St=({className:t,size:e=24})=>yr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:yr("path",{clipRule:"evenodd",d:Tu[e],fill:"currentColor",fillRule:"evenodd"})});var te=t=>({type:"dropdown",ChildComponent:St,items:t,key:"text",order:25});import{$createQuoteNode as wu,$isQuoteNode as vr,QuoteNode as Su}from"@lexical/rich-text";var Rr={type:"element",dependencies:[Su],export:(t,e)=>{if(!vr(t))return null;let o=e(t).split(`
|
|
2
2
|
`),n=[];for(let r of o)n.push("> "+r);return n.join(`
|
|
3
3
|
`)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let l=t.getPreviousSibling();if(vr(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let r=wu();r.append(...e),t.replace(r),r.select(0,0)}};var Mr=[te([{ChildComponent:Ho,isActive:({selection:t})=>{if(!Nu(t))return!1;for(let e of t.getNodes())if(!Ir(e)&&!Ir(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Dr();Ar(e,()=>$r())})},order:20}])],Lu=$({markdownTransformers:[Rr],nodes:[Eu],slashMenu:{groups:[X([{Icon:Ho,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Dr();Ar(e,()=>$r())})}}])]},toolbarFixed:{groups:Mr},toolbarInline:{groups:Mr}});import{getTranslation as to}from"@payloadcms/translations";import{jsx as Or}from"react/jsx-runtime";import"react";var yu="M10.5 7C11.3284 7 12 7.67157 12 8.5V11.5C12 11.7329 11.9453 11.9527 11.8506 12.1494C12.0473 12.0547 12.2671 12 12.5 12H15.5C16.3284 12 17 12.6716 17 13.5V16.5C17 17.3284 16.3284 18 15.5 18H12.5C12.1151 18 11.7655 17.8535 11.5 17.6152C11.2345 17.8535 10.8849 18 10.5 18H7.5C6.67157 18 6 17.3284 6 16.5V13.5C6 13.1154 6.14578 12.7655 6.38379 12.5C6.14578 12.2345 6 11.8846 6 11.5V8.5C6 7.67157 6.67157 7 7.5 7H10.5ZM12.5 13C12.2239 13 12 13.2239 12 13.5V16.5C12 16.7761 12.2239 17 12.5 17H15.5C15.7761 17 16 16.7761 16 16.5V13.5C16 13.2239 15.7761 13 15.5 13H12.5ZM7.5 13C7.22386 13 7 13.2239 7 13.5V16.5C7 16.7761 7.22386 17 7.5 17H10.5C10.7761 17 11 16.7761 11 16.5V13.5C11 13.2239 10.7761 13 10.5 13H7.5ZM7.5 8C7.22386 8 7 8.22386 7 8.5V11.5C7 11.7761 7.22386 12 7.5 12H10.5C10.7761 12 11 11.7761 11 11.5V8.5C11 8.22386 10.7761 8 10.5 8H7.5ZM17.5 5C18.3284 5 19 5.67157 19 6.5V9.5C19 10.3284 18.3284 11 17.5 11H14.5C13.6716 11 13 10.3284 13 9.5V6.5C13 5.67157 13.6716 5 14.5 5H17.5ZM14.5 6C14.2239 6 14 6.22386 14 6.5V9.5C14 9.77614 14.2239 10 14.5 10H17.5C17.7761 10 18 9.77614 18 9.5V6.5C18 6.22386 17.7761 6 17.5 6H14.5Z",Uo=({className:t})=>Or("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Or("path",{d:yu,fill:"currentColor"})});import{jsx as Fr}from"react/jsx-runtime";import"react";var vu="M17 8C18.1046 8 19 8.89543 19 10V14L18.9893 14.2041C18.8938 15.1457 18.1457 15.8938 17.2041 15.9893L17 16H7L6.7959 15.9893C5.78722 15.887 5 15.0357 5 14V10C5 8.89543 5.89543 8 7 8H17ZM7 9C6.44772 9 6 9.44772 6 10V14C6 14.5523 6.44772 15 7 15H17C17.5523 15 18 14.5523 18 14V10C18 9.44772 17.5523 9 17 9H7ZM9 11C9.55228 11 10 11.4477 10 12C10 12.5523 9.55228 13 9 13C8.44772 13 8 12.5523 8 12C8 11.4477 8.44772 11 9 11ZM12 11C12.5523 11 13 11.4477 13 12C13 12.5523 12.5523 13 12 13C11.4477 13 11 12.5523 11 12C11 11.4477 11.4477 11 12 11ZM15 11C15.5523 11 16 11.4477 16 12C16 12.5523 15.5523 13 15 13C14.4477 13 14 12.5523 14 12C14 11.4477 14.4477 11 15 11Z",Go=({className:t})=>Fr("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Fr("path",{clipRule:"evenodd",d:vu,fill:"currentColor",fillRule:"evenodd"})});import{jsx as Ru}from"react/jsx-runtime";import"react";function Br(t,e){let{admin:o,imageAltText:n,imageURL:r}=t,l=o?.images,s,i;if(l?.icon?(s=typeof l.icon=="string"?l.icon:l.icon.url,i=typeof l.icon=="string"?void 0:l.icon.alt):l?.thumbnail?(s=typeof l.thumbnail=="string"?l.thumbnail:l.thumbnail.url,i=typeof l.thumbnail=="string"?void 0:l.thumbnail.alt):(s=r,i=n),!s)return e;let d=i??"Block Image";return()=>Ru("img",{alt:d,className:"lexical-block-custom-image",src:s,style:{maxHeight:20,maxWidth:20}})}import{$parseSerializedNode as Jr}from"lexical";import{JSOX as Vo}from"jsox";function Jt({propsString:t}){let e={},o="",n=!0;for(let r=0;r<t.length;r++){let l=t[r];if(n)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):n=!1):o+=l;else{let s=Iu(t,r);e[o]=s.value,r=s.newIndex,o="",n=!0}}return o&&(e[o]=!0),e}function Iu(t,e){let o=t[e];return o==='"'?Pr(t,e):o==="'"?Pr(t,e,!0):o==="{"?$u(t,e):o==="["?Mu(t,e):Du(t,e)}function Mu(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="["?o++:t[r]==="]"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Vo.parse(`[${n}]`)}}function Pr(t,e,o=!1){let n="",r=e+1;for(;r<t.length&&(t[r]!==(o?"'":'"')||t[r-1]==="\\");)n+=t[r],r++;return{newIndex:r,value:n}}function $u(t,e){let o=1,n="",r=e+1;for(;r<t.length&&o>0;)t[r]==="{"?o++:t[r]==="}"&&o--,o>0&&(n+=t[r]),r++;return{newIndex:r,value:Au(n)}}function Au(t){return t[0]!=="{"?Vo.parse(t):Vo.parse(t.replace(/(\w+):/g,'"$1":'))}function Du(t,e){let o="",n=e;for(;n<t.length&&t[n]!==" ";)o+=t[n],n++;return{newIndex:n-1,value:o}}function Et({props:t}){let e=[];for(let[o,n]of Object.entries(t))typeof n=="string"?e.push(`${o}="${Ou(n)}"`):typeof n=="number"?e.push(`${o}={${n}}`):typeof n=="boolean"?n&&e.push(`${o}`):n!==null&&typeof n=="object"&&(Array.isArray(n)?e.push(`${o}={[${n.map(r=>JSON.stringify(r,jr)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(n,jr)}}`));return e.join(" ")}function Ou(t){return t.replace(/"/g,""")}function jr(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Xt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:n,startMatch:r,trimChildren:l}){let s="",i="",d=e.slice(n),c=!1,u=0,a=0,m=null,p=!1,h=0,f=d[0].slice(0,r.index),g=0,_=n;e:for(let[R,b]of d.entries()){let x=l?b.trim():b,C=0;if(l)for(let T=0;T<b.length&&b[T]===" ";T++)C++;let k=0;for(R===0&&(k=(r.index??0)+r[0].length-C);k<x.length;){let T=x[k],I=x[k+1];if(c){if(T==="`"&&h++,h%2===0)if(T==="<"&&I==="/"){if(u--,u<0){i[i.length-1]===`
|
|
4
4
|
`&&(i=i.slice(0,-1)),_=R;for(let N=k;N<x.length;N++)if(x[N]===">"){g=N+1;break}break e}}else if(T==="/"&&I===">"){if(u--,u<0){i[i.length-1]===`
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
`,o&&u<0){let T=x.match(o);if(T?.index!==void 0){_=R,g=T.index+T[0].length-1;break}}if(R===d.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
|
|
8
8
|
`)+`
|
|
9
9
|
|
|
10
|
-
. Start match: `+JSON.stringify(r))}return{afterEndLine:d[_].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:n+_,endlineLastCharIndex:g,propsString:s}}import{jsx as kd}from"react/jsx-runtime";import _d from"bson-objectid";import{$applyNodeReplacement as Td}from"lexical";import"react";import{DecoratorBlockNode as Fu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Bu}from"@lexical/utils";import Pu from"bson-objectid";import{$applyNodeReplacement as ju}from"lexical";var Nt=class extends Fu{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:n,key:r}){super(n,r),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,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=Hu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Bu(o,e?.theme?.block),o}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}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let n=this.getWritable();n.__fields=e,o||n.__cacheBuster++}};function Hu(t){return ju(new Nt({fields:{...t,id:t?.id||new Pu.default().toHexString()}}))}import{jsx as V,jsxs as Lt,Fragment as Xu}from"react/jsx-runtime";import{useLexicalComposerContext as Zu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Yu}from"@lexical/react/useLexicalEditable";import{getTranslation as qu}from"@payloadcms/translations";import{Button as Vr,Collapsible as Qu,Drawer as ed,EditDepthProvider as td,ErrorPill as od,Form as nd,formatDrawerSlug as rd,FormSubmit as ld,MoreIcon as id,Pill as sd,Popup as ad,PopupList as Wo,RenderFields as cd,SectionTitle as ud,useConfig as dd,useDocumentForm as md,useDocumentInfo as Wr,useEditDepth as pd,useFormSubmitted as fd,useServerFunctions as hd,useTranslation as gd,XIcon as xd}from"@payloadcms/ui";import{abortAndIgnore as zo}from"@payloadcms/ui/shared";import{$getNodeByKey as Yt,$getRoot as Cd,SKIP_DOM_SELECTION_TAG as Ko}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as qt,reduceFieldsToValues as zr}from"payload/shared";import Be,{useCallback as Jo,useEffect as Qt,useMemo as Pe,useRef as Xo}from"react";import{v4 as bd}from"uuid";import{c as Uu}from"react/compiler-runtime";import{jsx as Zt,jsxs as Gu}from"react/jsx-runtime";import{useLexicalEditable as Vu}from"@lexical/react/useLexicalEditable";import{RenderFields as Wu,useFormSubmitted as zu}from"@payloadcms/ui";import Ku,{createContext as Ju}from"react";var Hr=Ju({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ae=()=>Ku.use(Hr),Ur=t=>{let e=Uu(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,u=zu()&&i>0,a=Vu(),m;e[0]!==o||e[1]!==i||e[2]!==u?(m=f=>{let{children:g,..._}=f;return Zt(o,{errorCount:i,fieldHasErrors:u,..._,children:g})},e[0]=o,e[1]=i,e[2]=u,e[3]=m):m=e[3];let p=m,h={...l,BlockCollapsible:p};return n?Gu(Hr,{value:h,children:[n,Zt(s,{})]}):Zt(p,{children:Zt(Wu,{fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function Gr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var Kr=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=fd(),{id:d,collectionSlug:c,globalSlug:u}=Wr(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=G(),{fields:g}=md(),_=Xo(new AbortController),L=pd(),[R,b]=Be.useState(0),{config:x}=dd(),C=rd({slug:`lexical-blocks-create-${f}-${l.id}`,depth:L}),{toggleDrawer:k}=Fe(C),{getDocPreferences:T,setDocFieldPreferences:I}=Wr(),[N]=Zu(),S=Yu(),E=l.blockType,{getFormState:w}=hd(),v=`${h}.lexical_internal_feature.blocks.lexical_blocks.${E}.fields`,[y,M]=Be.useState(()=>{let P=p?.[l.id]?.formState;if(!P)return!1;let q=Object.fromEntries(Object.entries(P).map(([U,W])=>[U,U in l?{...W,initialValue:l[U],value:l[U]}:W]));return q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},q}),A=Xo(!1),D=Xo(e);Qt(()=>{A.current?(D.current!==e&&M(!1),D.current=e):A.current=!0},[e]);let[F]=Be.useState(()=>bd()),[B,Y]=Be.useState(()=>{if(!r)return y?._components?.customComponents?.BlockLabel??void 0}),[J,Ze]=Be.useState(()=>{if(!n)return y?._components?.customComponents?.Block??void 0}),Ie=Pe(()=>n?V(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):J,[n,o,l,s,J]),Ce=Pe(()=>r?V(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):B,[r,o,l,s,B]);Qt(()=>{let P=new AbortController;return l&&!y&&(async()=>{let{state:U}=await w({id:d,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:qt(g,{excludeFiles:!0}),globalSlug:u,initialBlockData:l,operation:"update",readOnly:!S,renderAllFields:!0,schemaPath:v,signal:P.signal});if(U){U.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let W=zr(qt(U,{excludeFiles:!0}),!0);N.update(()=>{let z=Yt(s);if(z&&$e(z)){let ie=W;ie.blockType=E,z.setFields(ie,!0)}},{tag:Ko}),M(U),r||Y(U._components?.customComponents?.BlockLabel??void 0),n||Ze(U._components?.customComponents?.Block??void 0)}})(),()=>{zo(P)}},[w,v,S,d,r,n,l,N,s,y,c,u,T,g,E]);let[le,be]=Be.useState(p?.[l.id]?.collapsed??!1),Gt=`${h}.lexical_internal_feature.blocks.lexical_blocks.${E}`,ce=a.blocks?.[Gt]?.[0],ee=ce.blockReferences?typeof ce?.blockReferences?.[0]=="string"?x.blocksMap[ce?.blockReferences?.[0]]:ce?.blockReferences?.[0]:ce?.blocks?.[0],{i18n:gt,t:ue}=gd(),xt=Jo(async({formState:P,submit:q})=>{zo(_.current);let U=new AbortController;_.current=U;let{state:W}=await w({id:d,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:qt(g,{excludeFiles:!0}),formState:P,globalSlug:u,initialBlockFormState:P,operation:"update",readOnly:!S,renderAllFields:!!q,schemaPath:v,signal:U.signal});if(!W)return P;P.blockName&&(W.blockName=P.blockName);let z=zr(Gr({fields:qt(W,{excludeFiles:!0})}),!0);if(setTimeout(()=>{N.update(()=>{let ie=Yt(s);if(ie&&$e(ie)){let qe=z;qe.blockType=E,ie.setFields(qe,!0)}},{tag:Ko})},0),q){r||Y(W._components?.customComponents?.BlockLabel??void 0),n||Ze(W._components?.customComponents?.Block??void 0);let ie=0;for(let qe of Object.values(W))qe?.valid===!1&&ie++;b(ie)}return W},[w,d,c,T,u,v,E,g,S,N,s,n,r]);Qt(()=>()=>{zo(_.current)},[]);let Vt=Jo(()=>{N.update(()=>{Yt(s)?.remove()})},[N,s]),[cr,Jc]=Be.useState(0);Qt(()=>{let P=()=>{N.getEditorState().read(()=>{let U=Cd().getChildren(),W=0;for(let z of U)if($e(z)){if(z.getKey()===s){Jc(W);return}W++}})};return P(),N.registerUpdateListener(()=>{P()})},[N,s]);let Ye=ee?.labels?.singular?qu(ee.labels.singular,gt):ee?.slug,ur=Jo(P=>{T().then(q=>{let W=q?.fields?.[m.name]?.collapsed,z=W&&W?.length?W:[];P?z.includes(l.id)||z.push(l.id):z.includes(l.id)&&z.splice(z.indexOf(l.id),1),I(m.name,{collapsed:z,hello:"hi"})})},[T,m.name,I,l.id]),dr=Pe(()=>()=>V(Vr,{buttonStyle:"icon-label",className:`${o}__editButton`,disabled:!S,el:"button",icon:"edit",onClick:P=>(P.preventDefault(),P.stopPropagation(),k(),!1),onMouseDown:P=>{P.preventDefault()},round:!0,size:"medium",tooltip:ue("lexical:blocks:inlineBlocks:edit",{label:Ye})}),[o,S,ue,Ye,k]),mr=Pe(()=>()=>V(Vr,{buttonStyle:"icon-label",className:`${o}__removeButton`,disabled:!S,icon:"x",onClick:P=>{P.preventDefault(),Vt()},round:!0,tooltip:"Remove Block"}),[o,S,Vt]),Oo=Pe(()=>({Actions:P,children:q,className:U,collapsibleProps:W,disableBlockName:z,editButton:ie,errorCount:qe,fieldHasErrors:Fo,Label:hr,Pill:gr,removeButton:Zc,showDragHandle:Yc=!0,showRowNumber:qc=!0})=>V("div",{className:`${o}__container ${o}-${E}`,children:V(Qu,{actions:typeof P<"u"?P:S?V(ad,{button:V(id,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",render:({close:Ct})=>Lt(Wo.ButtonGroup,{buttonSize:"medium",children:[(Ie&&ie!==!1||!Ie&&ie)&&V(Wo.Button,{onClick:()=>{k(),Ct()},children:ue("general:edit")}),Zc!==!1&&Lt(Wo.Button,{onClick:()=>{Vt(),Ct()},children:[V(xd,{}),ue("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Fo?`${o}__row--has-errors`:`${o}__row--no-errors`,U].filter(Boolean).join(" "),collapsibleStyle:Fo?"error":"default",dragHandleProps:Yc?{id:s,attributes:{role:"button",tabIndex:0},listeners:{}}:void 0,header:V("div",{className:`${o}__block-header`,children:typeof hr<"u"?hr:typeof Ce<"u"?Ce:Lt("div",{className:`${o}__block-label`,children:[qc&&V("span",{className:`${o}__block-number`,children:String(cr+1).padStart(2,"0")}),typeof gr<"u"?gr:V(sd,{className:`${o}__block-pill ${o}__block-pill-${E}`,pillStyle:"white",size:"small",children:Ye??E}),!z&&!ee?.admin?.disableBlockName&&V(ud,{path:"blockName",readOnly:!S}),Fo&&V(od,{count:qe??0,i18n:gt,withMessage:!0})]})}),isCollapsed:le,onToggle:Ct=>{ur(Ct),be(Ct)},...W||{},children:q},0)}),[Ie,Ce,Ye,o,ee?.admin?.disableBlockName,E,gt,le,ur,S,s,Vt,cr,ue,k]),pr=l?.id,fr=Pe(()=>()=>V(td,{children:V(ed,{className:"",slug:C,title:ue(`lexical:blocks:inlineBlocks:${pr?"edit":"create"}`,{label:Ye??ue("lexical:blocks:inlineBlocks:label")}),children:y?Lt(Xu,{children:[V(cd,{fields:ee?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!S}),V(ld,{programmaticSubmit:!0,children:ue("fields:saveChanges")})]}):null})}),[y,C,pr,Ye,ue,S,ee?.fields,v]),Xc=Pe(()=>y?V("div",{"data-block-drawer-slug":C,style:{display:"contents"},children:V(nd,{beforeSubmit:[async({formState:P})=>await xt({formState:P,submit:!0})],el:"div",fields:ee?.fields??[],initialState:y,onChange:[xt],onSubmit:(P,q)=>{q.blockType=E,N.update(()=>{let U=Yt(s);U&&$e(U)&&U.setFields(q,!0)},{tag:Ko}),k()},submitted:i,uuid:F,children:V(Ur,{baseClass:o,BlockDrawer:fr,Collapsible:Oo,CustomBlock:Ie,CustomLabel:Ce,EditButton:dr,errorCount:R,formSchema:ee?.fields??[],initialState:y,nodeKey:s,RemoveButton:mr})})}):null,[Oo,fr,Ie,Ce,E,C,mr,dr,o,N,R,k,ee?.fields,F,y,s,xt,i]);return ee?Xc:V(Oo,{disableBlockName:!0,fieldHasErrors:!0,children:Lt("div",{className:`${o}-not-found`,children:["Error: Block '",E,"' not found in the config but exists in the lexical data"]})})};var de=class extends Nt{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=je(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return kd(Kr,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return Td(new de({fields:{...t,id:t?.id||new _d.default().toHexString()}}))}function $e(t){return t instanceof de}import{createHeadlessEditor as wd}from"@lexical/headless";function Zo(t,e){return({editorState:n})=>{let r=wd({nodes:t});try{r.setEditorState(r.parseEditorState(n))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return r.getEditorState().read(()=>{l=zt(e)}),l}}import{createHeadlessEditor as Sd}from"@lexical/headless";function eo(t,e){return({markdown:n})=>{let r=Sd({nodes:t});return r.update(()=>{Wt(n,e)},{discrete:!0}),r.getEditorState().toJSON()}}function Ed(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Zr=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=Xr(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=Xr(n,!0);r&&(o=o.concat(r))}return o};function Xr(t,e){if(!t.jsx)return null;let o=Ed(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[bt],export:s=>{if(!_t(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=Zo(r,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${i.blockType}${u?" "+Et({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+Et({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=Xt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:d,propsString:c}=Xt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=eo(r,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:i,props:c?Jt({propsString:c}):{}});if(a===!1)return;let m=kt({blockType:t.slug,...a});s.replace(m)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[de],export:s=>{if(!$e(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=Zo(r,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
|
|
10
|
+
. Start match: `+JSON.stringify(r))}return{afterEndLine:d[_].trim().slice(g),beforeStartLine:f,content:i,endLineIndex:n+_,endlineLastCharIndex:g,propsString:s}}import{jsx as kd}from"react/jsx-runtime";import _d from"bson-objectid";import{$applyNodeReplacement as Td}from"lexical";import"react";import{DecoratorBlockNode as Fu}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as Bu}from"@lexical/utils";import Pu from"bson-objectid";import{$applyNodeReplacement as ju}from"lexical";var Nt=class extends Fu{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:n,key:r}){super(n,r),this.__fields=o,this.__cacheBuster=e||0}static clone(e){return new this({cacheBuster:e.__cacheBuster,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=Hu(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return Bu(o,e?.theme?.block),o}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}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let n=this.getWritable();n.__fields=e,o||n.__cacheBuster++}};function Hu(t){return ju(new Nt({fields:{...t,id:t?.id||new Pu.default().toHexString()}}))}import{jsx as V,jsxs as Lt,Fragment as Xu}from"react/jsx-runtime";import{useLexicalComposerContext as Zu}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Yu}from"@lexical/react/useLexicalEditable";import{getTranslation as qu}from"@payloadcms/translations";import{Button as Vr,Collapsible as Qu,Drawer as ed,EditDepthProvider as td,ErrorPill as od,Form as nd,formatDrawerSlug as rd,FormSubmit as ld,MoreIcon as id,Pill as sd,Popup as ad,PopupList as Wo,RenderFields as cd,SectionTitle as ud,useConfig as dd,useDocumentForm as md,useDocumentInfo as Wr,useEditDepth as pd,useFormSubmitted as fd,useServerFunctions as hd,useTranslation as gd,XIcon as xd}from"@payloadcms/ui";import{abortAndIgnore as zo}from"@payloadcms/ui/shared";import{$getNodeByKey as Yt,$getRoot as Cd,SKIP_DOM_SELECTION_TAG as Ko}from"lexical";import{deepCopyObjectSimpleWithoutReactComponents as qt,reduceFieldsToValues as zr}from"payload/shared";import Be,{useCallback as Jo,useEffect as Qt,useMemo as Pe,useRef as Xo}from"react";import{v4 as bd}from"uuid";import{c as Uu}from"react/compiler-runtime";import{jsx as Zt,jsxs as Gu}from"react/jsx-runtime";import{useLexicalEditable as Vu}from"@lexical/react/useLexicalEditable";import{RenderFields as Wu,useFormSubmitted as zu}from"@payloadcms/ui";import Ku,{createContext as Ju}from"react";var Hr=Ju({baseClass:"LexicalEditorTheme__block",BlockCollapsible:()=>null,BlockDrawer:()=>null,EditButton:()=>null,errorCount:0,formSchema:[],initialState:!1,nodeKey:"",RemoveButton:()=>null}),ae=()=>Ku.use(Hr),Ur=t=>{let e=Uu(4),{Collapsible:o,CustomBlock:n,CustomLabel:r,...l}=t,{BlockDrawer:s,errorCount:i,formSchema:d}=l,u=zu()&&i>0,a=Vu(),m;e[0]!==o||e[1]!==i||e[2]!==u?(m=f=>{let{children:g,..._}=f;return Zt(o,{errorCount:i,fieldHasErrors:u,..._,children:g})},e[0]=o,e[1]=i,e[2]=u,e[3]=m):m=e[3];let p=m,h={...l,BlockCollapsible:p};return n?Gu(Hr,{value:h,children:[n,Zt(s,{})]}):Zt(p,{children:Zt(Wu,{fields:d,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0,readOnly:!a})})};function Gr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var Kr=t=>{let{cacheBuster:e,className:o,CustomBlock:n,CustomLabel:r,formData:l,nodeKey:s}=t,i=fd(),{id:d,collectionSlug:c,globalSlug:u}=Wr(),{fieldProps:{featureClientSchemaMap:a,field:m,initialLexicalFormState:p,schemaPath:h},uuid:f}=G(),{fields:g}=md(),_=Xo(new AbortController),L=pd(),[R,b]=Be.useState(0),{config:x}=dd(),C=rd({slug:`lexical-blocks-create-${f}-${l.id}`,depth:L}),{toggleDrawer:k}=Fe(C),{getDocPreferences:T,setDocFieldPreferences:I}=Wr(),[N]=Zu(),S=Yu(),E=l.blockType,{getFormState:w}=hd(),v=`${h}.lexical_internal_feature.blocks.lexical_blocks.${E}.fields`,[y,M]=Be.useState(()=>{let P=p?.[l.id]?.formState;if(!P)return!1;let q=Object.fromEntries(Object.entries(P).map(([U,W])=>[U,U in l?{...W,initialValue:l[U],value:l[U]}:W]));return q.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName},q}),A=Xo(!1),D=Xo(e);Qt(()=>{A.current?(D.current!==e&&M(!1),D.current=e):A.current=!0},[e]);let[F]=Be.useState(()=>bd()),[B,Y]=Be.useState(()=>{if(!r)return y?._components?.customComponents?.BlockLabel??void 0}),[J,Ze]=Be.useState(()=>{if(!n)return y?._components?.customComponents?.Block??void 0}),Ie=Pe(()=>n?V(n,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):J,[n,o,l,s,J]),Ce=Pe(()=>r?V(r,{className:o,formData:l,isEditor:!0,isJSXConverter:!1,nodeKey:s,useBlockComponentContext:ae}):B,[r,o,l,s,B]);Qt(()=>{let P=new AbortController;return l&&!y&&(async()=>{let{state:U}=await w({id:d,collectionSlug:c,data:l,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:qt(g,{excludeFiles:!0}),globalSlug:u,initialBlockData:l,operation:"update",readOnly:!S,renderAllFields:!0,schemaPath:v,signal:P.signal});if(U){U.blockName={initialValue:l.blockName,passesCondition:!0,valid:!0,value:l.blockName};let W=zr(qt(U,{excludeFiles:!0}),!0);N.update(()=>{let z=Yt(s);if(z&&$e(z)){let ie=W;ie.blockType=E,z.setFields(ie,!0)}},{tag:Ko}),M(U),r||Y(U._components?.customComponents?.BlockLabel??void 0),n||Ze(U._components?.customComponents?.Block??void 0)}})(),()=>{zo(P)}},[w,v,S,d,r,n,l,N,s,y,c,u,T,g,E]);let[le,be]=Be.useState(p?.[l.id]?.collapsed??!1),Gt=`${h}.lexical_internal_feature.blocks.lexical_blocks.${E}`,ce=a.blocks?.[Gt]?.[0],ee=ce.blockReferences?typeof ce?.blockReferences?.[0]=="string"?x.blocksMap[ce?.blockReferences?.[0]]:ce?.blockReferences?.[0]:ce?.blocks?.[0],{i18n:gt,t:ue}=gd(),xt=Jo(async({formState:P,submit:q})=>{zo(_.current);let U=new AbortController;_.current=U;let{state:W}=await w({id:d,collectionSlug:c,docPermissions:{fields:!0},docPreferences:await T(),documentFormState:qt(g,{excludeFiles:!0}),formState:P,globalSlug:u,initialBlockFormState:P,operation:"update",readOnly:!S,renderAllFields:!!q,schemaPath:v,signal:U.signal});if(!W)return P;P.blockName&&(W.blockName=P.blockName);let z=zr(Gr({fields:qt(W,{excludeFiles:!0})}),!0);if(setTimeout(()=>{N.update(()=>{let ie=Yt(s);if(ie&&$e(ie)){let qe=z;qe.blockType=E,ie.setFields(qe,!0)}},{tag:Ko})},0),q){r||Y(W._components?.customComponents?.BlockLabel??void 0),n||Ze(W._components?.customComponents?.Block??void 0);let ie=0;for(let qe of Object.values(W))qe?.valid===!1&&ie++;b(ie)}return W},[w,d,c,T,u,v,E,g,S,N,s,n,r]);Qt(()=>()=>{zo(_.current)},[]);let Vt=Jo(()=>{N.update(()=>{Yt(s)?.remove()})},[N,s]),[cr,Jc]=Be.useState(0);Qt(()=>{let P=()=>{N.getEditorState().read(()=>{let U=Cd().getChildren(),W=0;for(let z of U)if($e(z)){if(z.getKey()===s){Jc(W);return}W++}})};return P(),N.registerUpdateListener(()=>{P()})},[N,s]);let Ye=ee?.labels?.singular?qu(ee.labels.singular,gt):ee?.slug,ur=Jo(P=>{T().then(q=>{let W=q?.fields?.[m.name]?.collapsed,z=W&&W?.length?W:[];P?z.includes(l.id)||z.push(l.id):z.includes(l.id)&&z.splice(z.indexOf(l.id),1),I(m.name,{collapsed:z,hello:"hi"})})},[T,m.name,I,l.id]),dr=Pe(()=>()=>V(Vr,{buttonStyle:"ghost",className:`${o}__editButton`,disabled:!S,el:"button",icon:"edit",onClick:P=>(P.preventDefault(),P.stopPropagation(),k(),!1),onMouseDown:P=>{P.preventDefault()},round:!0,size:"medium",tooltip:ue("lexical:blocks:inlineBlocks:edit",{label:Ye})}),[o,S,ue,Ye,k]),mr=Pe(()=>()=>V(Vr,{buttonStyle:"ghost",className:`${o}__removeButton`,disabled:!S,icon:"x",onClick:P=>{P.preventDefault(),Vt()},round:!0,tooltip:"Remove Block"}),[o,S,Vt]),Oo=Pe(()=>({Actions:P,children:q,className:U,collapsibleProps:W,disableBlockName:z,editButton:ie,errorCount:qe,fieldHasErrors:Fo,Label:hr,Pill:gr,removeButton:Zc,showDragHandle:Yc=!0,showRowNumber:qc=!0})=>V("div",{className:`${o}__container ${o}-${E}`,children:V(Qu,{actions:typeof P<"u"?P:S?V(ad,{button:V(id,{}),buttonClassName:`${o}__actions-button`,caret:!1,horizontalAlign:"right",render:({close:Ct})=>Lt(Wo.ButtonGroup,{buttonSize:"medium",children:[(Ie&&ie!==!1||!Ie&&ie)&&V(Wo.Button,{onClick:()=>{k(),Ct()},children:ue("general:edit")}),Zc!==!1&&Lt(Wo.Button,{onClick:()=>{Vt(),Ct()},children:[V(xd,{}),ue("general:remove")]})]}),size:"large"}):null,className:[`${o}__row`,Fo?`${o}__row--has-errors`:`${o}__row--no-errors`,U].filter(Boolean).join(" "),collapsibleStyle:Fo?"error":"default",dragHandleProps:Yc?{id:s,attributes:{role:"button",tabIndex:0},listeners:{}}:void 0,header:V("div",{className:`${o}__block-header`,children:typeof hr<"u"?hr:typeof Ce<"u"?Ce:Lt("div",{className:`${o}__block-label`,children:[qc&&V("span",{className:`${o}__block-number`,children:String(cr+1).padStart(2,"0")}),typeof gr<"u"?gr:V(sd,{className:`${o}__block-pill ${o}__block-pill-${E}`,pillStyle:"white",size:"small",children:Ye??E}),!z&&!ee?.admin?.disableBlockName&&V(ud,{path:"blockName",readOnly:!S}),Fo&&V(od,{count:qe??0,i18n:gt,withMessage:!0})]})}),isCollapsed:le,onToggle:Ct=>{ur(Ct),be(Ct)},...W||{},children:q},0)}),[Ie,Ce,Ye,o,ee?.admin?.disableBlockName,E,gt,le,ur,S,s,Vt,cr,ue,k]),pr=l?.id,fr=Pe(()=>()=>V(td,{children:V(ed,{className:"",slug:C,title:ue(`lexical:blocks:inlineBlocks:${pr?"edit":"create"}`,{label:Ye??ue("lexical:blocks:inlineBlocks:label")}),children:y?Lt(Xu,{children:[V(cd,{fields:ee?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!S}),V(ld,{programmaticSubmit:!0,children:ue("fields:saveChanges")})]}):null})}),[y,C,pr,Ye,ue,S,ee?.fields,v]),Xc=Pe(()=>y?V("div",{"data-block-drawer-slug":C,style:{display:"contents"},children:V(nd,{beforeSubmit:[async({formState:P})=>await xt({formState:P,submit:!0})],el:"div",fields:ee?.fields??[],initialState:y,onChange:[xt],onSubmit:(P,q)=>{q.blockType=E,N.update(()=>{let U=Yt(s);U&&$e(U)&&U.setFields(q,!0)},{tag:Ko}),k()},submitted:i,uuid:F,children:V(Ur,{baseClass:o,BlockDrawer:fr,Collapsible:Oo,CustomBlock:Ie,CustomLabel:Ce,EditButton:dr,errorCount:R,formSchema:ee?.fields??[],initialState:y,nodeKey:s,RemoveButton:mr})})}):null,[Oo,fr,Ie,Ce,E,C,mr,dr,o,N,R,k,ee?.fields,F,y,s,xt,i]);return ee?Xc:V(Oo,{disableBlockName:!0,fieldHasErrors:!0,children:Lt("div",{className:`${o}-not-found`,children:["Error: Block '",E,"' not found in the config but exists in the lexical data"]})})};var de=class extends Nt{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=je(e.fields);return o.setFormat(e.format),o}decorate(...[e,o,n,r]){return kd(Kr,{cacheBuster:this.getCacheBuster(),className:o.theme.block??"LexicalEditorTheme__block",CustomBlock:n,CustomLabel:r,formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function je(t){return Td(new de({fields:{...t,id:t?.id||new _d.default().toHexString()}}))}function $e(t){return t instanceof de}import{createHeadlessEditor as wd}from"@lexical/headless";function Zo(t,e){return({editorState:n})=>{let r=wd({nodes:t});try{r.setEditorState(r.parseEditorState(n))}catch(s){console.error("getLexicalToMarkdown: ERROR parsing editor state",s)}let l="";return r.getEditorState().read(()=>{l=zt(e)}),l}}import{createHeadlessEditor as Sd}from"@lexical/headless";function eo(t,e){return({markdown:n})=>{let r=Sd({nodes:t});return r.update(()=>{Wt(n,e)},{discrete:!0}),r.getEditorState().toJSON()}}function Ed(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Zr=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let n of t){let r=Xr(n,!1);r&&(o=o.concat(r))}if(e?.length)for(let n of e){let r=Xr(n,!0);r&&(o=o.concat(r))}return o};function Xr(t,e){if(!t.jsx)return null;let o=Ed(t.slug),n=[];return e?(n.push(({allNodes:r,allTransformers:l})=>({type:"text-match",dependencies:[bt],export:s=>{if(!_t(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=Zo(r,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${i.blockType}${u?" "+Et({props:a}):""}>${c.children}</${i.blockType}>`:`<${i.blockType}${u?" "+Et({props:a}):""}/>`},getEndIndex:(s,i)=>{let{endlineLastCharIndex:d}=Xt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:i,trimChildren:!1});return d},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(s,i){let{content:d,propsString:c}=Xt({isEndOptional:!1,lines:[s.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...i,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let u=eo(r,l),a=t.jsx.import({children:d,closeMatch:null,htmlToLexical:null,markdownToLexical:u,openMatch:i,props:c?Jt({propsString:c}):{}});if(a===!1)return;let m=kt({blockType:t.slug,...a});s.replace(m)}})),n):(n.push(({allNodes:r,allTransformers:l})=>({dependencies:[de],export:s=>{if(!$e(s)||s.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let i=s.getFields(),d=Zo(r,l),c=t.jsx.export({fields:i,lexicalToMarkdown:d});if(c===!1)return null;if(typeof c=="string")return c;let u=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
|
|
11
11
|
`))for(let h of m.split(`
|
|
12
12
|
`)){let f="";!t?.jsx?.doNotTrimChildren&&h!==""&&(f=" "),f+=h+`
|
|
13
13
|
`,p+=f}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
|
|
@@ -55,9 +55,9 @@ ${e.map(Qd).join(`
|
|
|
55
55
|
`}isInline(){return!1}updateDOM(){return!1}};function Em(){return{node:li()}}function li(){return Tm(new yt)}import{$applyNodeReplacement as Nm}from"lexical";import"react";var we=class extends yt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return nt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function nt(){return Nm(new we)}function Ge(t){return t instanceof we}var ii={type:"element",dependencies:[we],export:(t,e)=>Ge(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=nt();e&&t.replace(e)}};import{c as Lm}from"react/compiler-runtime";import{useLexicalComposerContext as ym}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as si,$insertNodeToNearestRoot as vm}from"@lexical/utils";import{$getRoot as Rm,$getSelection as ai,$isRangeSelection as ci,$isRootOrShadowRoot as ui,COMMAND_PRIORITY_EDITOR as Im}from"lexical";import{useEffect as Mm}from"react";var ln="LexicalEditorTheme__hrSelected",di=()=>{let t=Lm(3),[e]=ym(),o,n;return t[0]!==e?(o=()=>{let r=e.registerCommand(vt,$m,Im),l=e.registerUpdateListener(s=>{let{editorState:i}=s;i.read(()=>{let c=Rm().getChildren(),u=ai(),a=[];for(let b=0;b<c.length;b++){let x=c[b];if(Ge(x)){let C=e.getElementByKey(x.getKey());C&&a.push({element:C,index:b})}}if(a.length===0)return;if(!ci(u)||u.isCollapsed()){for(let{element:b}of a)b.classList.remove(ln);return}let m=u.anchor.getNode(),p=u.focus.getNode(),h=si(m,Am)||m,f=si(p,Dm)||p,g=c.indexOf(h),_=c.indexOf(f);if(g===-1||_===-1)return;let L=Math.min(g,_),R=Math.max(g,_);for(let{element:b,index:x}of a)x>=L&&x<=R?b.classList.add(ln):b.classList.remove(ln)})});return()=>{r(),l()}},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Mm(o,n),null};function $m(t){let e=ai();if(!ci(e))return!1;if(e.focus.getNode()!==null){let n=nt();vm(n)}return!0}function Am(t){return ui(t.getParent())}function Dm(t){return ui(t.getParent())}var Fm=$({markdownTransformers:[ii],nodes:[we],plugins:[{Component:di,position:"normal"}],slashMenu:{groups:[X([{Icon:rn,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(vt,void 0)}}])]},toolbarFixed:{groups:[Te([{ChildComponent:rn,isActive:({selection:t})=>{if(!Om(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ge(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(vt,void 0)}}])]}});import{$findMatchingParent as Ti}from"@lexical/utils";import{$isElementNode as Zm,INDENT_CONTENT_COMMAND as Ym,OUTDENT_CONTENT_COMMAND as qm}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var Bm="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",mi=({className:t})=>sn("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:sn("g",{transform:"scale(-1, 1) translate(-24, 0)",children:sn("path",{clipRule:"evenodd",d:Bm,fill:"currentColor",fillRule:"evenodd"})})});import{jsx as pi}from"react/jsx-runtime";import"react";var Pm="M7.854 6.146a.5.5 0 1 0-.708.708L8.293 8H5.5a.5.5 0 0 0 0 1h2.793l-1.147 1.146a.5.5 0 0 0 .708.708l2-2a.5.5 0 0 0 0-.708zM11.5 8a.5.5 0 0 0 0 1h7a.5.5 0 0 0 0-1zM5 12.5a.5.5 0 0 1 .5-.5h13a.5.5 0 0 1 0 1h-13a.5.5 0 0 1-.5-.5m.5 3.5a.5.5 0 0 0 0 1h13a.5.5 0 0 0 0-1z",fi=({className:t})=>pi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:pi("path",{clipRule:"evenodd",d:Pm,fill:"currentColor",fillRule:"evenodd"})});import{jsx as jm}from"react/jsx-runtime";import{useLexicalComposerContext as Hm}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Um}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Gm,mergeRegister as hi}from"@lexical/utils";import{$getSelection as Vm,$isElementNode as bi,$isRangeSelection as Wm,COMMAND_PRIORITY_LOW as gi,INDENT_CONTENT_COMMAND as xi,KEY_TAB_COMMAND as zm,OUTDENT_CONTENT_COMMAND as Km,TabNode as Jm}from"lexical";import{useEffect as Ci}from"react";var ki=({clientProps:t})=>{let[e]=Hm(),{disabledNodes:o,disableTabNode:n}=t;return Ci(()=>{if(!(!e||!o?.length))return hi(e.registerCommand(xi,()=>Xm(r=>{if(!o.includes(r.getType())){let l=r.getIndent();r.setIndent(l+1)}}),gi),e.registerUpdateListener(({dirtyElements:r,editorState:l})=>{e.update(()=>{for(let[s]of r){let i=l._nodeMap.get(s);bi(i)&&o.includes(i.getType())&&i.getIndent()>0&&i.setIndent(0)}})}))},[e,o]),Ci(()=>{if(!(!e||!n))return hi(e.registerCommand(zm,r=>(r.preventDefault(),e.dispatchCommand(r.shiftKey?Km:xi,void 0)),gi),e.registerNodeTransform(Jm,r=>{r.remove()}))},[e,n]),jm(Um,{})};function Xm(t){let e=Vm();if(!Wm(e))return!1;let o=new Set,n=e.getNodes();for(let r=0;r<n.length;r++){let l=n[r],s=l.getKey();if(o.has(s))continue;let i=Gm(l,c=>bi(c)&&!c.isInline());if(i===null)continue;let d=i.getKey();i.canIndent()&&!o.has(d)&&(o.add(d),t(i))}return o.size>0}var _i=t=>({type:"buttons",items:t,key:"indent",order:35});var wi=({disabledNodes:t})=>[_i([{ChildComponent:mi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Si(r)&&r.getIndent()>0;return o.some(r=>n(r)||!!Ti(r,n))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(qm,void 0)},order:1},{ChildComponent:fi,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],n=r=>Si(r)&&!(t??[]).includes(r.getType());return o.some(r=>n(r)||!!Ti(r,n))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Ym,void 0)},order:2}])],Qm=$(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:ki,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:wi({disabledNodes:e})},toolbarInline:{groups:wi({disabledNodes:e})}}}),Si=t=>Zm(t)&&t.canIndent();import{$findMatchingParent as xf}from"@lexical/utils";import{$getSelection as Cn,$isRangeSelection as ls}from"lexical";import{jsx as Ei}from"react/jsx-runtime";import"react";var ep={16:"M8.38 6.381a.29.29 0 0 1 .347-.056q.293.161.541.408a2.5 2.5 0 0 1 0 3.535l-2 2a2.5 2.5 0 0 1-3.535-3.535l.571-.573c.25-.249.692-.107.81.224a.46.46 0 0 1-.098.478l-.576.578a1.5 1.5 0 1 0 2.121 2.12l2-2a1.5 1.5 0 0 0 0-2.12c-.23-.23-.493-.509-.358-.805a.9.9 0 0 1 .178-.254m.352-2.648a2.5 2.5 0 1 1 3.535 3.535l-.471.47c-.253.254-.717.082-.819-.261a.44.44 0 0 1 .102-.435l.481-.481A1.5 1.5 0 0 0 9.44 4.44l-2 2a1.5 1.5 0 0 0 0 2.12c.136.138.168.365.031.502l-.182.181c-.154.154-.403.179-.557.025a2.5 2.5 0 0 1 0-3.535z",24:"M12.4436 10.3708C12.6861 10.5041 12.9148 10.6721 13.1204 10.8776C14.2919 12.0492 14.2918 13.9482 13.1204 15.1198L11.1204 17.1198C9.94879 18.2914 8.04975 18.2914 6.87817 17.1198C5.70664 15.9482 5.70661 14.0492 6.87817 12.8776L8.1477 11.6071C8.4098 11.345 8.89329 11.5392 8.97388 11.9011C9.00617 12.0462 8.96861 12.2012 8.86353 12.3063L7.5852 13.5847C6.80417 14.3657 6.80419 15.6317 7.5852 16.4128C8.36625 17.1938 9.63228 17.1938 10.4133 16.4128L12.4133 14.4128C13.1942 13.6317 13.1943 12.3657 12.4133 11.5847C12.4042 11.5755 12.3953 11.5662 12.386 11.5573C12.2925 11.468 12.1984 11.3736 12.1614 11.2497C12.0724 10.9515 12.1448 10.6149 12.3801 10.3796C12.397 10.3628 12.4228 10.3594 12.4436 10.3708ZM12.8782 6.87764C14.0497 5.70615 15.9488 5.70616 17.1204 6.87764C18.2919 8.04919 18.2919 9.94825 17.1204 11.1198L15.8508 12.3903C15.5887 12.6522 15.1053 12.4581 15.0247 12.0964C14.9924 11.9512 15.0308 11.7963 15.136 11.6911L16.4133 10.4128C17.1943 9.63175 17.1943 8.3657 16.4133 7.58467C15.6323 6.80371 14.3662 6.8037 13.5852 7.58467L11.5852 9.58467C10.8046 10.3657 10.8044 11.6319 11.5852 12.4128C11.5943 12.4219 11.6042 12.4303 11.6135 12.4392C11.7064 12.5278 11.7999 12.622 11.8372 12.7448C11.9276 13.044 11.8545 13.3827 11.6184 13.6188C11.6023 13.6347 11.5778 13.6383 11.5579 13.6276C11.3146 13.4942 11.0843 13.3259 10.8782 13.1198C9.7068 11.9484 9.707 10.0492 10.8782 8.87764L12.8782 6.87764Z"},ro=({className:t,size:e=24})=>Ei("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Ei("path",{d:ep[e],fill:"currentColor"})});import{$isAtNodeEnd as Ni}from"@lexical/selection";function rt(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?Ni(o)?n:r:Ni(e)?n:r}var an=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as pp}from"lexical";function cn(t){let e=/^(?:(?:https?|mailto|ftp|tel|file|sms):|[^&:/?#]*(?:[/?#]|$))/gi,o=/^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[a-z\d+/]+=*$/i;return t=String(t).trim(),t.match(e)!=null||t.match(o)!=null?t:"https://"}var tp=/^(?:[a-zA-Z][a-zA-Z\d+.-]*:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|www\.[A-Za-z\d]+(?:\.[A-Za-z\d]+)+|(?:tel|mailto):[\w+.-]+)(?:\/[+~%/\w-]*)?(?:\?[-;&=%\w]*)?(?:#\w+)?$/,op=/^(?:\/[\w\-./]*(?:\?[-;&=%\w]*)?(?:#[\w-]+)?|#[\w\-]+)$/;function Li(t){if(!t||t.includes(" ")||/^[a-z][a-z\d+.-]*:\/[^/]/i.test(t))return!1;if(t==="https://"||tp.test(t)||op.test(t))return!0;try{let e=new URL(t);return!(["ftp:","http:","https:"].includes(e.protocol)&&!e.hostname.includes("."))}catch{}return!1}import{addClassNamesToElement as np,isHTMLAnchorElement as rp}from"@lexical/utils";import mn from"bson-objectid";import{$applyNodeReplacement as lp,$createTextNode as yi,$getSelection as ip,$isElementNode as vi,$isRangeSelection as dn,createCommand as sp,ElementNode as ap}from"lexical";var cp=new Set(["http:","https:","mailto:","sms:","tel:"]),oe=class extends ap{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new this({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:up,priority:1})}}static importJSON(e){let o=Se({}).updateFromJSON(e);return 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 mn.default().toHexString(),e.version=3),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=un(o.rel,"add","noopener")),np(o,e.theme.link),o}exportJSON(){let e=this.getFields();e?.linkType==="internal"?delete e.url:e?.linkType==="custom"&&delete e.doc;let o={...super.exportJSON(),type:"link",fields:e,version:3},n=this.getID();return n&&(o.id=n),o}extractWithChild(e,o,n){if(!dn(o))return!1;let r=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(l)&&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(vi(n)){let r=Se({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!cp.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();return o.__fields=e,o}setID(e){let o=this.getWritable();return o.__id=e,o}updateDOM(e,o,n){let r=this.__fields?.url,l=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=""),l!==e.__fields?.newTab&&(l??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=un(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=un(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function up(t){let e=null;if(rp(t)){let o=t.textContent;o!==null&&o!==""&&(e=Se({id:new mn.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function Se({id:t,fields:e}){return lp(new oe({id:t??new mn.default().toHexString(),fields:e}))}function K(t){return t instanceof oe}var fe=sp("TOGGLE_LINK_COMMAND");function pn(t){let e=ip();if(!dn(e)&&(t===null||!t.selectedNodes?.length))return;let o=dn(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let s=l.getParent();K(s)&&(s.getChildren().forEach(d=>{s.insertBefore(d)}),s.remove())});return}if(o?.length===1){let l=o[0],s=K(l)?l:dp(l);if(s!==null){s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(yi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}}let n=null,r=null;o?.forEach(l=>{let s=l.getParent();if(!(s===r||s===null||vi(l)&&!l.isInline())){if(K(s)){r=s,s.setFields(t.fields),t.text!=null&&t.text!==s.getTextContent()&&(s.append(yi(t.text)),s.getChildren().forEach(i=>{i!==s.getLastChild()&&i.remove()}));return}if(s.is(n)||(n=s,r=Se({fields:t.fields}),K(s)?l.getPreviousSibling()===null?s.insertBefore(r):s.insertAfter(r):l.insertBefore(r)),K(l)){if(l.is(r))return;if(r!==null){let i=l.getChildren();r.append(...i)}l.remove();return}r!==null&&r.append(l)}})}function dp(t){return mp(t,e=>K(e))}function mp(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function un(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let l=new RegExp(o,"g");r=r.replace(l,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let l=new RegExp(o,"g");n=r.replace(l,"").trim()}return n}var fp=(t,e)=>{let[,o,n]=e,r=Se({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),l=pp(o);return l.setFormat(t.getFormat()),r.append(l),t.replace(r),l},hp=t=>({type:"text-match",dependencies:[oe],export:(e,o)=>{if(!K(e))return null;let n=e,r=n.getFields(),l;return r.linkType==="internal"?t?.internalDocToHref?l=cn(t.internalDocToHref({linkNode:n.exportJSON()})):(console.warn("Lexical \u2192 Markdown converter: found internal link but internalDocToHref is not provided \u2014 link will have an empty href"),l=""):l=cn(r.url??""),`[${o(n)}](${l})`},importRegExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/(?<!!)\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:fp,trigger:")"}),Ri=hp();import{$applyNodeReplacement as gp,$isElementNode as xp}from"lexical";var Ee=class extends oe{static clone(e){return new this({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=Rt({}).updateFromJSON(e);return 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),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(xp(n)){let r=Rt({fields:this.__fields});return n.append(r),r}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function Rt({fields:t}){return gp(new Ee({id:"",fields:t}))}function Ne(t){return t instanceof Ee}import{c as Cp}from"react/compiler-runtime";import{useLexicalComposerContext as bp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as kp}from"@lexical/utils";import{$createTextNode as Ii,$getSelection as _p,$isElementNode as $i,$isLineBreakNode as Ai,$isNodeSelection as Tp,$isRangeSelection as wp,$isTextNode as It,TextNode as Sp}from"lexical";import{useEffect as Ep}from"react";function Mi(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 Di(t,e){for(let o of e){let n=o(t);if(n!=null)return n}return null}var Np=/[.,;\s]/;function io(t){return t!==void 0&&Np.test(t)}function Oi(t){return io(t[t.length-1])}function hn(t){return io(t[0])}function Lp(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Fi(t){let e=t.getPreviousSibling();return $i(e)&&(e=e.getLastDescendant()),e===null||Ai(e)||It(e)&&Oi(e.getTextContent())}function Bi(t){let e=t.getNextSibling();return $i(e)&&(e=e.getFirstDescendant()),e===null||Ai(e)||It(e)&&hn(e.getTextContent())}function yp(t,e,o,n){return(t>0?io(o[t-1]):Fi(n[0]))?e<o.length?io(o[e]):Bi(n[n.length-1]):!1}function vp(t,e,o){let n=[],r=[],l=[],s=0,i=0,d=[...t];for(;d.length>0;){let c=d[0],a=c.getTextContent().length,m=i;i+a<=e?(n.push(c),s+=a):m>=o?l.push(c):r.push(c),i+=a,d.shift()}return[s,n,r,l]}function Rp(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},l=Rt({fields:r});if(t.length===1){let s=t[0],i;if(e===0?[i]=s.splitText(o):[,i]=s.splitText(e,o),i){let d=Ii(n.text);d.setFormat(i.getFormat()),d.setDetail(i.getDetail()),d.setStyle(i.getStyle()),l.append(d),i.replace(l)}return s}else if(t.length>1){let s=t[0],i=s.getTextContent().length,d;e===0?d=s:[,d]=s.splitText(e);let c=[],u;if(t.forEach(a=>{let p=a.getTextContent().length,h=i,f=i+p;if(h<o)if(f<=o)c.push(a);else{let[g,_]=a.splitText(o-h);g&&c.push(g),u=_}i+=p}),d){let a=_p(),m=a?a.getNodes().find(It):void 0,p=Ii(d.getTextContent());return p.setFormat(d.getFormat()),p.setDetail(d.getDetail()),p.setStyle(d.getStyle()),l.append(p,...c),m&&m===d&&(wp(a)?p.select(a.anchor.offset,a.focus.offset):Tp(a)&&p.select(0,p.getTextContent().length)),d.replace(l),u}}}function Ip(t,e,o){let n=[...t],r=n.map(d=>d.getTextContent()).join(""),l=r,s,i=0;for(;(s=Di(l,e))!=null&&s!==null;){let d=s.index,c=s.length,u=d+c;if(yp(i+d,i+u,r,n)){let[m,,p,h]=vp(n,i+d,i+u),f=i+d-m,g=i+u-m,_=Rp(p,f,g,s);n=_?[_,...h]:h,o(s.url,null),i=0}else i+=u;l=l.substring(u)}}function fn(t,e,o){let n=t.getChildren(),r=n.length;for(let d=0;d<r;d++){let c=n[d];if(!It(c)||!c.isSimpleText()){lo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),s=Di(l,e);if(s===null||s.text!==l){lo(t),o(null,t.getFields()?.url??null);return}if(!Fi(t)||!Bi(t)){lo(t),o(null,t.getFields()?.url??null);return}let i=t.getFields()?.url;if(i!==s?.url){let d=t.getFields();d.url=s?.url,t.setFields(d),o(s.url,i??null)}}function Mp(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),l=t.getTextContent();if(Ne(n)){let s=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:")??!1:!1;(!hn(l)||Lp(l,s))&&(n.append(t),fn(n,e,o),o(null,n.getFields()?.url??null))}Ne(r)&&!Oi(l)&&(lo(r),fn(r,e,o),o(null,r.getFields()?.url??null))}function lo(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 $p(t){let e=[t],o=t.getNextSibling();for(;o!==null&&It(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Ap(t,e,o){let n=Cp(5),r,l;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([Ee]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let s=(i,d)=>{o?.(i,d)};return kp(t.registerNodeTransform(Sp,i=>{let d=i.getParentOrThrow(),c=i.getPreviousSibling();if(Ne(d))fn(d,e,s);else if(!K(d)){if(i.isSimpleText()&&(hn(i.getTextContent())||!Ne(c))){let u=$p(i);Ip(u,e,s)}Mp(i,e,s)}}))},l=[t,e,o],n[0]=t,n[1]=e,n[2]=o,n[3]=r,n[4]=l):(r=n[3],l=n[4]),Ep(r,l)}var Dp=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Op=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Fp=[Mi(Dp,t=>t.startsWith("http")?t:`https://${t}`),Mi(Op,t=>`mailto:${t}`)],Pi=()=>{let[t]=bp();return Ap(t,Fp),null};import{jsx as Bp}from"react/jsx-runtime";import{ClickableLinkPlugin as Pp}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var ji=()=>Bp(Pp,{});import{jsx as lf}from"react/jsx-runtime";import"react";import{createPortal as sf}from"react-dom";import{jsx as ne,jsxs as Ve,Fragment as gn}from"react/jsx-runtime";import{useLexicalComposerContext as Up}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as Gp}from"@lexical/react/useLexicalEditable";import{$findMatchingParent as zi,mergeRegister as Ki}from"@lexical/utils";import{getTranslation as xn}from"@payloadcms/translations";import{ExternalLinkIcon as Ji,formatDrawerSlug as Vp,useConfig as Wp,useEditDepth as zp,useLocale as Kp,useTranslation as Jp,WriteIcon as Xp}from"@payloadcms/ui";import{requests as Zp}from"@payloadcms/ui/shared";import{$getSelection as Xi,$isLineBreakNode as Yp,$isRangeSelection as Zi,COMMAND_PRIORITY_HIGH as qp,COMMAND_PRIORITY_LOW as Yi,getDOMSelection as Qp,KEY_ESCAPE_COMMAND as ef,SELECTION_CHANGE_COMMAND as tf}from"lexical";import{formatAdminURL as of}from"payload/shared";import nf,{useCallback as qi,useEffect as co,useLayoutEffect as rf,useRef as Qi,useState as We}from"react";import{jsx as Hi}from"react/jsx-runtime";import"react";var jp="M12.5 5C12.6326 5 12.7597 5.05272 12.8535 5.14648L16.8535 9.14648C16.9965 9.28948 17.0393 9.50457 16.9619 9.69141C16.8845 9.87821 16.7022 10 16.5 10H12.5C12.2239 10 12 9.77614 12 9.5V6H8.5C8.22386 6 8 6.22386 8 6.5V17.5C8 17.7761 8.22386 18 8.5 18H15.5C15.7761 18 16 17.7761 16 17.5V11.5C16 11.2239 16.2239 11 16.5 11C16.7761 11 17 11.2239 17 11.5V17.5C17 18.3284 16.3284 19 15.5 19H8.5C7.67157 19 7 18.3284 7 17.5V6.5C7 5.67157 7.67157 5 8.5 5H12.5ZM13 9H15.293L13 6.70703V9Z",Ui=({className:t})=>Hi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Hi("path",{d:jp,fill:"currentColor"})});import{jsx as Gi}from"react/jsx-runtime";import"react";var Vi={default:"M6 5a.5.5 0 0 0-.5.5v1a.5.5 0 0 0 .496.5h12.008a.5.5 0 0 0 .496-.5v-1A.5.5 0 0 0 18 5zM4.5 6.5a1.5 1.5 0 0 0 1.037 1.427L5.725 10H5a.5.5 0 0 0 0 1h.816l.653 7.181A2 2 0 0 0 8.46 20h7.078a2 2 0 0 0 1.992-1.819L18.184 11H19a.5.5 0 0 0 0-1h-.725l.188-2.073A1.5 1.5 0 0 0 19.5 6.5v-1A1.5 1.5 0 0 0 18 4H6a1.5 1.5 0 0 0-1.5 1.5zm2.965 11.59L6.548 8h10.905l-.918 10.09a1 1 0 0 1-.996.91H8.461a1 1 0 0 1-.996-.91M11 10.5a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0zm3 0a.5.5 0 0 0-1 0v6a.5.5 0 0 0 1 0z",small:"M6.5 7a1 1 0 0 1 1-1h9a1 1 0 0 1 1 1v1a1 1 0 0 1-1 1h-.039l-.08 1H17a.5.5 0 0 1 0 1h-.7l-.455 5.62A1.5 1.5 0 0 1 14.35 18h-4.7a1.5 1.5 0 0 1-1.495-1.38L7.7 11H7a.5.5 0 0 1 0-1h.62l-.081-1H7.5a1 1 0 0 1-1-1zm9.494 1h.506V7h-9v1zm-.536 1H8.542l.61 7.54a.5.5 0 0 0 .498.46h4.7a.5.5 0 0 0 .499-.46zM11.5 11.5a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0zm2 0a.5.5 0 0 0-1 0v3a.5.5 0 0 0 1 0z"},Wi=({className:t,small:e})=>Gi("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Gi("path",{clipRule:"evenodd",d:e?Vi.small:Vi.default,fill:"currentColor",fillRule:"evenodd"})});function so(t,e,o,n=10,r=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let s=o.getBoundingClientRect(),i=l.getBoundingClientRect(),d=t.top-n,c=t.left-r;e.style.width="max-content",e.style.maxWidth="none";let u=e.scrollWidth,a=i.right-c,m=c-i.left,p;if(u<=a)p=e.getBoundingClientRect();else{let h=m+t.width,f=m>a,_=Math.min(u,f?h:a);_<u&&(e.style.width=`${_}px`,e.style.maxWidth=`${_}px`,e.offsetHeight),f&&(c=t.right-_),p=e.getBoundingClientRect()}d<i.top&&(d+=p.height+t.height+n*2),c+p.width>i.right&&(c=i.right-p.width-r),d-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${d}px)`}import{createCommand as Hp}from"lexical";var ao=Hp("TOGGLE_LINK_WITH_MODAL_COMMAND");function es(t){t.preventDefault()}function ts({anchorElem:t}){let[e]=Up(),[o,n]=We(),r=Qi(null),l=Qi(null),[s,i]=We(null),[d,c]=We(null),{fieldProps:{schemaPath:u},uuid:a}=G(),m=Gp(),{config:p,getEntityConfig:h}=Wp(),{i18n:f,t:g}=Jp(),[_,L]=We(),R=zp(),[b,x]=We(!1),[C,k]=We([]),T=Kp(),[I,N]=We(!1),S=Vp({slug:"lexical-rich-text-link-"+a,depth:R}),{toggleDrawer:E}=Fe(S),w=qi(()=>{x(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),N(!1),i(null),c(null),k([]),L(void 0)},[x,i,c,k]),v=qi(()=>{let y=Xi(),M;if(!Zi(y)||!y){w();return}let A=rt(y);M=e.getElementByKey(A.getKey())?.getBoundingClientRect();let D=zi(A,K),F=y.getNodes().filter(le=>!Yp(le)).find(le=>{let be=zi(le,K);return D&&!D.is(be)||be&&!be.is(D)});if(D==null||F){w();return}n(D);let B=D.getFields(),Y={...B,id:D.getID(),text:D.getTextContent()};if(B?.linkType==="custom")i(B?.url??null),c(null);else{i(`${p.routes.admin==="/"?"":p.routes.admin}/collections/${B?.doc?.relationTo}/${B?.doc?.value}`);let le=B?.doc?.relationTo?h({collectionSlug:B?.doc?.relationTo}):void 0;if(!le)c(B?.label?String(B?.label):null),i(B?.url?String(B?.url):null);else{let be=typeof B.doc?.value=="object"?B.doc.value.id:B.doc?.value,Gt=B.doc?.relationTo;if(!be||!Gt)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let ar=g("fields:linkedTo",{label:`${xn(le.labels.singular,f)} - ${g("lexical:link:loadingWithEllipsis",f)}`}).replace(/<[^>]*>?/g,"");c(ar),Zp.get(of({apiRoute:p.routes.api,path:`/${Gt}/${be}`,serverURL:p.serverURL}),{headers:{"Accept-Language":f.language},params:{depth:0,locale:T?.code}}).then(async ce=>{if(!ce.ok)throw new Error(`HTTP error! Status: ${ce.status}`);let ee=await ce.json(),gt=le?.admin?.useAsTitle||"id",ue=ee[gt],xt=g("fields:linkedTo",{label:`${xn(le.labels.singular,f)} - ${ue}`}).replace(/<[^>]*>?/g,"");c(xt)}).catch(()=>{let ce=g("fields:linkedTo",{label:`${xn(le.labels.singular,f)} - ${g("general:untitled",f)} - ID: ${be}`}).replace(/<[^>]*>?/g,"");c(ce)})}}L(Y),x(!0),k(y?y?.getNodes():[]),Ne(D)?N(!0):N(!1);let J=r.current,Ze=Qp(e._window),{activeElement:Ie}=document;if(J===null)return;let Ce=e.getRootElement();return Ze!==null&&Ce!==null&&Ce.contains(Ze.anchorNode)?(M||(M=Ze.getRangeAt(0).getBoundingClientRect()),M!=null&&(M.y+=40,l.current=M)):(Ie==null||Ie.className!=="link-input")&&(Ce!==null&&so(null,J,t),i(null),c(null)),!0},[e,w,p.routes.admin,p.routes.api,p.serverURL,h,g,f,T?.code,t]);return co(()=>Ki(e.registerCommand(ao,y=>(e.dispatchCommand(fe,y),v(),E(),!0),Yi)),[e,v,E,S]),co(()=>{let y=t.parentElement,M=()=>{e.getEditorState().read(()=>{v()})};return window.addEventListener("resize",M),y?.addEventListener("scroll",M),()=>{window.removeEventListener("resize",M),y?.removeEventListener("scroll",M)}},[t.parentElement,e,v]),co(()=>Ki(e.registerUpdateListener(({editorState:y})=>{y.read(()=>{v()})}),e.registerCommand(tf,()=>(v(),!0),Yi),e.registerCommand(ef,()=>b?(w(),!0):!1,qp)),[e,v,b,w]),co(()=>{e.getEditorState().read(()=>{v()})},[e,v]),rf(()=>{!b||!r.current||!t||!l.current||so(l.current,r.current,t)},[s,d,b,t,o]),Ve(nf.Fragment,{children:[ne("div",{className:"link-editor","data-theme":"dark",ref:r,children:Ve("div",{className:"link-input",children:[o?.__fields?.linkType==="custom"?ne(ro,{}):ne(Ui,{}),s&&s.length>0?Ve("a",{className:"link-input__url",href:s,rel:"noopener noreferrer",target:"_blank",children:[d!=null&&d.length>0?d:s,o?.__fields.newTab?Ve(gn,{children:[ne(Ji,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):d!=null&&d.length>0?Ve(gn,{children:[ne("span",{className:"link-input__label-pure",children:d}),o?.__fields.newTab?Ve(gn,{children:[ne(Ji,{size:16})," ",ne("div",{className:"link-input__divider"})," "]}):null]}):null,m&&Ve("div",{className:"link-input__actions",children:[ne("button",{"aria-label":"Edit link",className:"link-edit",onClick:y=>{y.preventDefault(),E()},onMouseDown:es,tabIndex:0,type:"button",children:ne(Xp,{})}),!I&&ne("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(fe,null)},onMouseDown:es,tabIndex:0,type:"button",children:ne(Wi,{small:!0})})]})]})}),ne(Bo,{className:"lexical-link-edit-drawer",data:_,drawerSlug:S,drawerTitle:g("fields:editLink"),featureKey:"link",handleDrawerSubmit:(y,M)=>{let A=M,D={...A};delete D.text,e.update(()=>{let F=Xi(),B=null;if(Zi(F)?B=rt(F).getParent():C.length&&(B=C[0]?.getParent()??null),B&&Ne(B)){let Y=Se({fields:D});B.replace(Y,!0)}}),e.dispatchCommand(fe,{fields:D,selectedNodes:C,text:A.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var os=t=>{let{anchorElem:e=document.body}=t;return sf(lf(ts,{anchorElem:e}),e)};import{c as af}from"react/compiler-runtime";import{useLexicalComposerContext as cf}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as uf}from"@lexical/utils";import{$getSelection as df,$isElementNode as mf,$isRangeSelection as pf,COMMAND_PRIORITY_LOW as ns,PASTE_COMMAND as ff}from"lexical";import{useEffect as hf}from"react";var rs=t=>{let e=af(5),{clientProps:o}=t,[n]=cf(),r,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==n?(r=()=>{if(!n.hasNodes([oe]))throw new Error("LinkPlugin: LinkNode not registered on editor");return uf(n.registerCommand(fe,s=>s===null?(pn(null),!0):(s.fields?.linkType||(s.fields.linkType=o.defaultLinkType),s.fields?.url||(s.fields.url=o.defaultLinkURL),pn(s),!0),ns),n.registerCommand(ff,s=>{let i=df();if(!pf(i)||i.isCollapsed()||!(s instanceof ClipboardEvent)||s.clipboardData==null)return!1;let d=s.clipboardData.getData("text");if(!Li(d))return!1;if(!i.getNodes().some(gf)){let c={doc:null,linkType:"custom",newTab:!1,url:d};return n.dispatchCommand(fe,{fields:c,text:null}),s.preventDefault(),!0}return!1},ns))},l=[o.defaultLinkType,o.defaultLinkURL,n],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=n,e[3]=r,e[4]=l):(r=e[3],l=e[4]),hf(r,l),null};function gf(t){return mf(t)}var is=[an([{ChildComponent:ro,isActive:({selection:t})=>{if(ls(t)){let e=rt(t);return xf(e,K)!=null}return!1},isEnabled:({selection:t})=>!!(ls(t)&&Cn()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(fe,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=Cn()?.getTextContent(),n=Cn()?.getNodes()??[]}),!o?.length)return;let r={doc:null};t.dispatchCommand(ao,{fields:r,selectedNodes:n,text:o})}},order:1}])],Cf=$(({props:t})=>({markdownTransformers:[Ri],nodes:[oe,t?.disableAutoLinks===!0?null:Ee].filter(Boolean),plugins:[{Component:rs,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:Pi,position:"normal"},{Component:ji,position:"normal"},{Component:os,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:is},toolbarInline:{groups:is}}));import{$isListNode as _n,INSERT_CHECK_LIST_COMMAND as ms,ListItemNode as Rf,ListNode as If}from"@lexical/list";import{$isRangeSelection as Mf}from"lexical";import{jsx as ss}from"react/jsx-runtime";import"react";var bf={16:"M5.584 8.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM13 10a.5.5 0 0 1 0 1H8a.5.5 0 0 1 0-1zM5.583 3.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.076l-1-1a.5.5 0 0 1 .708-.707l.568.569zM13 5a.5.5 0 1 1 0 1H8a.5.5 0 0 1 0-1z",24:"M9.084 15.223a.5.5 0 1 1 .832.554l-2 3a.5.5 0 0 1-.77.076l-1-1a.5.5 0 1 1 .708-.707l.568.569zM17.5 17a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zm-8.416-6.777a.5.5 0 0 1 .832.554l-2 3a.5.5 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.707l.568.568zM17.5 12a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1zM9.084 5.223a.5.5 0 0 1 .832.554l-2 3a.502.502 0 0 1-.77.077l-1-1a.5.5 0 1 1 .708-.708l.568.569zM17.5 7a.5.5 0 0 1 0 1h-6a.5.5 0 0 1 0-1z"},bn=({className:t,size:e=24})=>ss("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ss("path",{d:bf[e],fill:"currentColor"})});import{jsx as kf}from"react/jsx-runtime";import{ListPlugin as _f}from"@lexical/react/LexicalListPlugin.js";import"react";var lt=()=>kf(_f,{});function uo(t,e){return t==="ordered"?!e.has("unorderedList"):t==="checklist"?!e.has("unorderedList")&&!e.has("orderedList"):!1}function it(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Ef,ListItemNode as Nf,ListNode as Lf}from"@lexical/list";import{$createListItemNode as Tf,$createListNode as wf,$isListItemNode as Sf,$isListNode as kn}from"@lexical/list";var as=4,st=t=>(e,o,n)=>{let r=e.getPreviousSibling(),l=e.getNextSibling(),s=Tf(t==="check"?n[3]==="x":void 0);if(kn(l)&&l.getListType()===t){let d=l.getFirstChild();d!==null?d.insertBefore(s):l.append(s),e.remove()}else if(kn(r)&&r.getListType()===t)r.append(s),e.remove();else{let d=wf(t,t==="number"?Number(n[2]):void 0);d.append(s),e.replace(d)}s.append(...o),s.select(0,0);let i=Math.floor(n[1].length/as);i&&s.setIndent(i)},ze=(t,e,o)=>{let n=[],r=t.getChildren(),l=0;for(let s of r)if(Sf(s)){if(s.getChildrenSize()===1){let u=s.getFirstChild();if(kn(u)){n.push(ze(u,e,o+1));continue}}let i=" ".repeat(o*as),d=t.getListType(),c=d==="number"?`${t.getStart()+l}. `:d==="check"?`- [${s.getChecked()?"x":" "}] `:"- ";n.push(i+c+e(s)),l++}return n.join(`
|
|
56
56
|
`)};var cs={type:"element",dependencies:[Lf,Nf],export:(t,e)=>Ef(t)?ze(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:st("check")};import{jsx as yf}from"react/jsx-runtime";import{CheckListPlugin as vf}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var us=()=>yf(vf,{});var ds=[te([{ChildComponent:bn,isActive:({selection:t})=>{if(!Mf(t))return!1;for(let e of t.getNodes()){if(_n(e)&&e.getListType()==="check")continue;let o=e.getParent();if(_n(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(_n(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(ms,void 0)},order:12}])],$f=$(({featureProviderMap:t})=>{let e=[{Component:us,position:"normal"}],o=uo("checklist",t);return o&&e.push({Component:lt,position:"normal"}),{markdownTransformers:[cs],nodes:o?[If,Rf]:[],plugins:e,slashMenu:{groups:[it([{Icon:bn,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:n})=>n.t("lexical:checklist:label"),onSelect:({editor:n})=>{n.dispatchCommand(ms,void 0)}}])]},toolbarFixed:{groups:ds},toolbarInline:{groups:ds}}});import{$isListNode as wn,INSERT_ORDERED_LIST_COMMAND as gs,ListItemNode as Bf,ListNode as Pf}from"@lexical/list";import{$isRangeSelection as jf}from"lexical";import{jsx as ps}from"react/jsx-runtime";import"react";var Af={16:"M5.6 9.01a.5.5 0 0 1 .4.49v1a.5.5 0 0 1-.276.447L4 11.81V12h1.5a.5.5 0 0 1 0 1h-2a.5.5 0 0 1-.5-.5v-1l.005-.07a.5.5 0 0 1 .271-.377L5 10.19V10H3.5a.5.5 0 0 1 0-1h2zM12.5 12a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zm0-4.5a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1zM4.6 3.01a.5.5 0 0 1 .4.49v3a.5.5 0 0 1-1 0V4h-.5a.5.5 0 0 1 0-1h1zM12.5 3a.5.5 0 0 1 0 1h-4a.5.5 0 0 1 0-1z",24:"M11 7a.5.5 0 0 1 .5-.5h6a.5.5 0 0 1 0 1h-6A.5.5 0 0 1 11 7M6 7a.5.5 0 0 1 .5-.5h1A.5.5 0 0 1 8 7v3.5a.5.5 0 1 1-1 0v-3h-.5A.5.5 0 0 1 6 7m0 6.5a.5.5 0 0 1 .5-.5h2a.5.5 0 0 1 .5.5V15a.5.5 0 0 1-.276.447L7 16.31v.191h1.5a.5.5 0 0 1 0 1h-2A.5.5 0 0 1 6 17v-1a.5.5 0 0 1 .276-.447L8 14.69V14H6.5a.5.5 0 0 1-.5-.5m5.5 3a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1zm0-5a.5.5 0 1 0 0 1h6a.5.5 0 0 0 0-1z"},Tn=({className:t,size:e=24})=>ps("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:ps("path",{clipRule:"evenodd",d:Af[e],fill:"currentColor",fillRule:"evenodd"})});import{$isListNode as Df,ListItemNode as Of,ListNode as Ff}from"@lexical/list";var fs={type:"element",dependencies:[Ff,Of],export:(t,e)=>Df(t)?ze(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:st("number")};var hs=[te([{ChildComponent:Tn,isActive:({selection:t})=>{if(!jf(t))return!1;for(let e of t.getNodes()){if(wn(e)&&e.getListType()==="number")continue;let o=e.getParent();if(wn(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(wn(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(gs,void 0)},order:10}])],Hf=$(({featureProviderMap:t})=>{let e=uo("ordered",t);return{markdownTransformers:[fs],nodes:e?[Pf,Bf]:[],plugins:e?[{Component:lt,position:"normal"}]:[],slashMenu:{groups:[it([{Icon:Tn,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:o})=>o.t("lexical:orderedList:label"),onSelect:({editor:o})=>{o.dispatchCommand(gs,void 0)}}])]},toolbarFixed:{groups:hs},toolbarInline:{groups:hs}}});import{$isListNode as En,INSERT_UNORDERED_LIST_COMMAND as ks,ListItemNode as zf,ListNode as Kf}from"@lexical/list";import{$isRangeSelection as Jf}from"lexical";import{jsx as xs}from"react/jsx-runtime";import"react";var Uf="M7 16C7.55228 16 8 16.4477 8 17C8 17.5523 7.55228 18 7 18C6.44772 18 6 17.5523 6 17C6 16.4477 6.44772 16 7 16ZM17.5 16.5C17.7761 16.5 18 16.7239 18 17C18 17.2761 17.7761 17.5 17.5 17.5H10.5C10.2239 17.5 10 17.2761 10 17C10 16.7239 10.2239 16.5 10.5 16.5H17.5ZM7 11C7.55228 11 8 11.4477 8 12C8 12.5523 7.55228 13 7 13C6.44772 13 6 12.5523 6 12C6 11.4477 6.44772 11 7 11ZM17.5 11.5C17.7761 11.5 18 11.7239 18 12C18 12.2761 17.7761 12.5 17.5 12.5H10.5C10.2239 12.5 10 12.2761 10 12C10 11.7239 10.2239 11.5 10.5 11.5H17.5ZM7 6C7.55228 6 8 6.44772 8 7C8 7.55228 7.55228 8 7 8C6.44772 8 6 7.55228 6 7C6 6.44772 6.44772 6 7 6ZM17.5 6.5C17.7761 6.5 18 6.72386 18 7C18 7.27614 17.7761 7.5 17.5 7.5H10.5C10.2239 7.5 10 7.27614 10 7C10 6.72386 10.2239 6.5 10.5 6.5H17.5Z",Sn=({className:t})=>xs("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:xs("path",{d:Uf,fill:"currentColor"})});import{$isListNode as Gf,ListItemNode as Vf,ListNode as Wf}from"@lexical/list";var Cs={type:"element",dependencies:[Wf,Vf],export:(t,e)=>Gf(t)?ze(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:st("bullet")};var bs=[te([{ChildComponent:Sn,isActive:({selection:t})=>{if(!Jf(t))return!1;for(let e of t.getNodes()){if(En(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(En(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!(En(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ks,void 0)},order:11}])],Xf=$({markdownTransformers:[Cs],nodes:[Kf,zf],plugins:[{Component:lt,position:"normal"}],slashMenu:{groups:[it([{Icon:Sn,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(ks,void 0)}}])]},toolbarFixed:{groups:bs},toolbarInline:{groups:bs}});import{$setBlocksType as ws}from"@lexical/selection";import{$createParagraphNode as Ss,$getSelection as Es,$isParagraphNode as _s,$isRangeSelection as Zf}from"lexical";var Ts=[te([{ChildComponent:St,isActive:({selection:t})=>{if(!Zf(t))return!1;for(let e of t.getNodes())if(!_s(e)&&!_s(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Es();ws(e,()=>Ss())})},order:1}])],Yf=$({slashMenu:{groups:[X([{Icon:St,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Es();ws(e,()=>Ss())})}}])]},toolbarFixed:{groups:Ts},toolbarInline:{groups:Ts}});import{c as k0}from"react/compiler-runtime";import{jsx as Ws}from"react/jsx-runtime";import{useLexicalComposerContext as _0}from"@lexical/react/LexicalComposerContext";import{useEffect as T0,useState as w0}from"react";import{jsx as Vs,Fragment as b0}from"react/jsx-runtime";import"react";import{jsx as qf}from"react/jsx-runtime";var Ns={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return qf("blockquote",{children:o})}};import{jsx as Qf}from"react/jsx-runtime";var Ls={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return Qf(n,{children:o})}};import{jsx as e0}from"react/jsx-runtime";var ys={horizontalrule:e0("hr",{})};import{jsx as t0}from"react/jsx-runtime";var vs={linebreak:t0("br",{})};import{jsx as Rs}from"react/jsx-runtime";var Is=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return Rs("a",{href:e.fields.url,rel:r,target:l,children:n})},link:({node:e,nodesToJSX:o})=>{let n=o({nodes:e.children}),r=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,s=e.fields.url??"";return e.fields.linkType==="internal"&&(t?s=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),s="#")),Rs("a",{href:s,rel:r,target:l,children:n})}});import{jsx as at,jsxs as o0,Fragment as n0}from"react/jsx-runtime";import{v4 as r0}from"uuid";var Ms={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.tag;return at(n,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let n=t.children.some(l=>l.type==="list"),r=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=r0();return at("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${n?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:n?r:o0(n0,{children:[at("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),at("label",{htmlFor:l,children:r}),at("br",{})]})})}else return at("li",{className:`${n?"nestedListItem":""}`,style:n?{listStyleType:"none"}:void 0,value:t?.value,children:r})}};import{jsx as Nn}from"react/jsx-runtime";var $s={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?Nn("p",{children:o}):Nn("p",{children:Nn("br",{})})}};var As={tab:" "};import{jsx as Mt}from"react/jsx-runtime";var Ds={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("div",{className:"lexical-table-container",children:Mt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Mt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),n=t.headerState>0?"th":"td",r=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},s=t.colSpan&&t.colSpan>1?t.colSpan:void 0,i=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return Mt(n,{className:`lexical-table-cell ${r}`,colSpan:s,rowSpan:i,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Mt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Ke}from"react/jsx-runtime";import"react";var O={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},l0=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,i0="\xA0",s0=`
|
|
57
57
|
|
|
58
|
-
`,Os="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Fs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",a0=new RegExp("^[^"+Fs+"]*["+Os+"]"),c0=new RegExp("^[^"+Os+"]*["+Fs+"]"),u0={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},d0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},m0={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},p0={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},f0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},h0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Bs={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Ke("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Ke("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Ke("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Ke("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Ke("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Ke("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Ke("sup",{children:e})),e}};import{jsx as $t}from"react/jsx-runtime";var Ps={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return $t("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return $t("img",{alt:n,height:o.height,src:r,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let d=i?.url;l.push($t("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push($t("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),$t("picture",{children:l})}};var ct={...$s,...Bs,...vs,...Ns,...Ds,...Ls,...ys,...Ms,...Is({}),...Ps,...As};import{jsx as po,Fragment as g0}from"react/jsx-runtime";import mo from"react";function js(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let n=t?.root?.children[0];if(!n?.children||n?.children?.length===0)o=!0;else if(n?.children?.length===1){let r=n?.children[0];r?.type==="text"&&(r?.text?.length||(o=!0))}}return!o}function x0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let n=typeof t.html=="function"?t.html(o):t.html;return po("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function Hs(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,n={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return mo.createElement(t.Block,n)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},n=typeof t.html=="function"?t.html(o):t.html;return po("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function C0(t){let e={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Hs(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Hs(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=x0(r))}return e}function Us({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(js(e)){let l=r?C0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Gs({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return po(g0,{})}function Gs({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,d)=>{let c;i.type==="block"?(c=t?.blocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(c=t?.inlineBlocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):c=t[i.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:i,nodesToJSX:p=>Gs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:r}}),parent:r}):c:u=po("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),mo.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return mo.cloneElement(u,{key:d,style:m})}return mo.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}function Ln({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:ct}):i=e:i=ct;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Us({converters:i,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?Vs(b0,{children:d}):Vs("div",{className:t??"payload-richtext",children:d})}function zs(){let t=k0(7),[e]=_0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=w0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;r(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),T0(l,s);let i;return t[5]!==n?(i=Ws("div",{className:"debug-jsx-converter",children:Ws(Ln,{converters:ct,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var S0=$({plugins:[{Component:zs,position:"bottom"}]});var H={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},E0={text:{"text-red":{css:{color:`light-dark(${H.red[600]}, ${H.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${H.orange[600]}, ${H.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${H.yellow[700]}, ${H.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${H.green[700]}, ${H.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${H.blue[600]}, ${H.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${H.purple[600]}, ${H.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${H.pink[600]}, ${H.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${H.red[400]}, ${H.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${H.orange[400]}, ${H.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${H.yellow[300]}, ${H.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${H.green[400]}, ${H.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${H.blue[400]}, ${H.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${H.purple[400]}, ${H.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${H.pink[400]}, ${H.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as ph}from"lexical";import{jsx as Ks}from"react/jsx-runtime";import"react";var N0="M9.5 6C9.77614 6 10 6.22386 10 6.5C10 6.77614 9.77614 7 9.5 7H7.5C7.22386 7 7 7.22386 7 7.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V14.5C17 14.2239 17.2239 14 17.5 14C17.7761 14 18 14.2239 18 14.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V7.5C6 6.67157 6.67157 6 7.5 6H9.5ZM17.5 6C17.7761 6 18 6.22386 18 6.5V11.5C18 11.7761 17.7761 12 17.5 12C17.2239 12 17 11.7761 17 11.5V7.70703L12.8535 11.8535C12.6583 12.0488 12.3417 12.0488 12.1465 11.8535C11.9512 11.6583 11.9512 11.3417 12.1465 11.1465L16.293 7H12.5C12.2239 7 12 6.77614 12 6.5C12 6.22386 12.2239 6 12.5 6H17.5Z",yn=({className:t})=>Ks("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ks("path",{d:N0,fill:"currentColor"})});import{jsx as I0}from"react/jsx-runtime";import{$applyNodeReplacement as M0}from"lexical";import*as Xs from"react";import{DecoratorBlockNode as L0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as y0}from"@lexical/utils";import{$applyNodeReplacement as v0}from"lexical";function R0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Js({relationTo:o,value:e})}:null}var At=class extends L0{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:R0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=Js(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return y0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Js(t){return v0(new At({data:t}))}var $0=Xs.lazy(()=>import("./RelationshipComponent-5RONAYJM.js").then(t=>({default:t.RelationshipComponent})));function A0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Je({relationTo:o,value:e})}:null}var Le=class extends At{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:A0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=Je(o);return n.setFormat(e.format),n}decorate(e,o){return I0($0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Je(t){return M0(new Le({data:t}))}function vn(t){return t instanceof Le}import{c as th}from"react/compiler-runtime";import{jsx as oh}from"react/jsx-runtime";import{useLexicalComposerContext as nh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as rh}from"@lexical/utils";import{$getPreviousSelection as lh,$getSelection as ih,$isParagraphNode as sh,$isRangeSelection as ah,COMMAND_PRIORITY_EDITOR as ch,createCommand as uh}from"lexical";import{useEffect as dh}from"react";import{c as qs}from"react/compiler-runtime";import{jsx as Rn}from"react/jsx-runtime";import{useLexicalComposerContext as Qs}from"@lexical/react/LexicalComposerContext.js";import{toast as z0}from"@payloadcms/ui";import{$getNodeByKey as K0,COMMAND_PRIORITY_EDITOR as ea}from"lexical";import{useEffect as ta,useState as J0}from"react";import{c as D0}from"react/compiler-runtime";import{jsx as O0}from"react/jsx-runtime";import{useLexicalComposerContext as F0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as B0,useModal as P0}from"@payloadcms/ui";import{$getNodeByKey as Zs,$getPreviousSelection as j0,$getRoot as H0,$getSelection as U0,$isRangeSelection as G0,$setSelection as V0}from"lexical";import{useEffect as W0,useState as Ys}from"react";var Dt=t=>{let e=D0(23),[o]=F0(),[n,r]=Ys(null),[l,s]=Ys(!1),[i,d,c]=B0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=P0(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let N=U0()??j0();r(N)},e[0]=f):f=e[0];let g=f,_;e[1]!==o||e[2]!==n?(_=()=>{n&&o.update(()=>{if(G0(n)){let{anchor:N,focus:S}=n;Zs(N.key)&&Zs(S.key)&&V0(n.clone())}else H0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=_):_=e[3];let L=_,R;e[4]!==u?(R=()=>{u()},e[4]=u,e[5]=R):R=e[5];let b=R,x,C;e[6]!==a||e[7]!==h||e[8]!==L||e[9]!==l?(x=()=>{if(!l)return;let N=h[a];N&&!N?.isOpen&&(s(!1),setTimeout(()=>{L()},1))},C=[h,a,L,l],e[6]=a,e[7]=h,e[8]=L,e[9]=l,e[10]=x,e[11]=C):(x=e[10],C=e[11]),W0(x,C);let k;e[12]!==d?(k=N=>O0(d,{...N,onClick:()=>{g()}}),e[12]=d,e[13]=k):k=e[13];let T;e[14]!==p?(T=()=>{g(),p(),s(!0)},e[14]=p,e[15]=T):T=e[15];let I;return e[16]!==i||e[17]!==b||e[18]!==m||e[19]!==a||e[20]!==k||e[21]!==T?(I={closeListDrawer:b,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:T},e[16]=i,e[17]=b,e[18]=m,e[19]=a,e[20]=k,e[21]=T,e[22]=I):I=e[22],I};var X0=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=K0(o);r&&r.replace(Je({relationTo:e,value:n}))}):t.dispatchCommand(In,{relationTo:e,value:n})},Z0=t=>{let e=qs(14),{enabledCollectionSlugs:o}=t,[n]=Qs(),[r,l]=J0(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=Dt(i),a,m;e[3]!==n||e[4]!==u?(a=()=>n.registerCommand(Qe,g=>(l(g?.replace?g?.replace.nodeKey:null),u(),!0),ea),m=[n,u],e[3]=n,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),ta(a,m);let p;e[7]!==d||e[8]!==n||e[9]!==r?(p=g=>{let{collectionSlug:_,doc:L}=g;X0({editor:n,relationTo:_,replaceNodeKey:r,value:L.id}),d()},e[7]=d,e[8]=n,e[9]=r,e[10]=p):p=e[10];let h=p,f;return e[11]!==c||e[12]!==h?(f=Rn(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},Y0=()=>{let t=qs(3),[e]=Qs(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Qe,q0,ea),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ta(o,n),null},oa=({enabledCollectionSlugs:t})=>t?.length?Rn(Z0,{enabledCollectionSlugs:t}):Rn(Y0,{});function q0(){return z0.error("No relationship collections enabled"),!0}import{useConfig as Q0,useEntityVisibility as eh}from"@payloadcms/ui";import*as na from"react";var fo=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:n=!1}=t||{},{config:{collections:r}}=Q0(),{visibleEntities:l}=eh();return na.useMemo(()=>{let i=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of r){let{slug:m,admin:{enableRichTextRelationship:p},upload:h}=a;if(l?.collections.includes(m)){if(n){if(!p||!h)continue}else if(h||!p)continue;c&&!c.has(m)||u&&u.has(m)||(i.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:i}},[r,l,n,o,e])};var In=uh("INSERT_RELATIONSHIP_COMMAND"),ra=t=>{let e=th(8),{clientProps:o}=t,[n]=nh(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=fo(s),d,c;e[3]!==n?(d=()=>{if(!n.hasNodes([Le]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(In,mh,ch)},c=[n],e[3]=n,e[4]=d,e[5]=c):(d=e[4],c=e[5]),dh(d,c);let u;return e[6]!==i?(u=oh(oa,{enabledCollectionSlugs:i}),e[6]=i,e[7]=u):u=e[7],u};function mh(t){let e=ih()||lh();if(ah(e)){let o=Je(t),{focus:n}=e,r=n.getNode();rh(o),sh(r)&&!r.__first&&r.remove()}return!0}var fh=$({nodes:[Le],plugins:[{Component:ra,position:"normal"}],slashMenu:{groups:[X([{Icon:yn,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]},toolbarFixed:{groups:[Te([{ChildComponent:yn,isActive:({selection:t})=>{if(!ph(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vn(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]}});import{c as Uh}from"react/compiler-runtime";import{jsx as he,jsxs as Gh}from"react/jsx-runtime";import{useLexicalComposerContext as Vh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as fa}from"@lexical/react/useLexicalEditable";import{useScrollInfo as Wh,useThrottledEffect as zh,useTranslation as Kh}from"@payloadcms/ui";import*as Co from"react";import{useMemo as On}from"react";import{jsx as hh,jsxs as gh}from"react/jsx-runtime";import{Tooltip as xh,useTranslation as Ch}from"@payloadcms/ui";import{$addUpdateTag as bh}from"lexical";import{useCallback as la,useEffect as kh,useMemo as ia,useRef as _h,useState as Th}from"react";var Mn="toolbar-popup__button",Ot=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=Ch(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=G(),[d,c]=Th(!1),u=_h(null);kh(()=>{u.current?.removeAttribute("data-pressing")},[t]);let a=ia(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,f=>f.toUpperCase()),[s,l,i,r]),m=ia(()=>[Mn,n?"":"disabled",t?"active":"",r.key?`${Mn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),p=la(()=>{n&&o.focus(()=>{o.update(()=>{bh("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),h=la(f=>{f.preventDefault(),f.currentTarget.setAttribute("data-pressing","")},[]);return gh("button",{"aria-label":a,className:m,"data-button-key":r.key,disabled:!n,onClick:p,onMouseDown:h,onPointerEnter:()=>c(!0),onPointerLeave:()=>{c(!1),u.current?.removeAttribute("data-pressing")},ref:u,type:"button",children:[hh(xh,{className:`${Mn}__tooltip`,show:d,children:a}),e]})};import{c as vh}from"react/compiler-runtime";import{jsx as ut}from"react/jsx-runtime";import Rh,{useMemo as Ih}from"react";import{useTranslation as Mh}from"@payloadcms/ui";import{jsx as Ae,jsxs as sa}from"react/jsx-runtime";import{Button as wh}from"@payloadcms/ui";import{$addUpdateTag as Sh,isDOMNode as Eh}from"lexical";import ho,{useCallback as Nh,useEffect as go,useMemo as ca,useRef as $n,useState as An}from"react";import{createPortal as Lh}from"react-dom";var aa="toolbar-popup__dropdown-item",ua=ho.createContext(null);function da({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let d=ca(()=>[aa,n===!1?"disabled":"",t?"active":"",l?.key?`${aa}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),c=$n(null),u=ho.use(ua);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return go(()=>{c?.current!=null&&a(c)},[c,a]),Ae(wh,{"aria-label":i,buttonStyle:"none",className:d,disabled:n===!1,extraButtonProps:{"data-item-key":s},icon:r,iconPosition:"left",iconStyle:"none",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{Sh("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function yh({children:t,dropdownKey:e,dropDownRef:o,itemsContainerClassNames:n,onClose:r}){let[l,s]=An(),[i,d]=An(),c=Nh(m=>{s(p=>p!=null?[...p,m]:[m])},[s]),u=m=>{if(l==null)return;let{key:p}=m;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&m.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?d(h=>{if(h==null)return l[0];let f=l.indexOf(h)-1;return l[f===-1?l.length-1:f]}):p==="ArrowDown"&&d(h=>h==null?l[0]:l[l.indexOf(h)+1])},a=ca(()=>({registerItem:c}),[c]);return go(()=>{l!=null&&i==null&&d(l[0]),i!=null&&i?.current!=null&&i.current.focus()},[l,i]),Ae(ua,{value:a,children:Ae("div",{className:(n??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":e,"data-theme":"dark",onKeyDown:u,ref:o,children:t})})}function ma({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=$n(null),u=$n(null),[a,m]=An(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};go(()=>{let f=u.current,g=c.current;if(a&&f!==null&&g!==null){let{left:_,top:L}=f.getBoundingClientRect(),R=window.scrollY||document.documentElement.scrollTop;g.style.top=`${L+R+f.offsetHeight+5}px`,g.style.left=`${Math.min(_-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,u,a]),go(()=>{let f=u.current;if(f!==null&&a){let g=_=>{let L=_.target;Eh(L)&&(d&&c.current&&c.current.contains(L)||f.contains(L)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,u,a,d]);let h=Lh(Ae(yh,{dropdownKey:r,dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return sa(ho.Fragment,{children:[sa("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":r,disabled:n,onClick:f=>{f.preventDefault(),m(!a)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[l&&Ae(l,{}),i&&Ae("span",{className:"toolbar-popup__dropdown-label",children:i}),Ae("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Ae(ho.Fragment,{children:h})]})}var Dn="toolbar-popup__dropdown",$h=t=>{let e=vh(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:d}=Mh(),{fieldProps:c}=G(),{featureClientSchemaMap:u,schemaPath:a}=c;if(i.Component){let p;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(p=i?.Component&&ut(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=p):p=e[5],p}let m;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==u||e[10]!==d||e[11]!==s||e[12]!==i||e[13]!==a){let p=i.key,h;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:u,i18n:d,schemaPath:a}):i.label),p.length>25?h=p.substring(0,25)+"...":h=p,m=ut(da,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?ut(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?p:void 0,children:ut("span",{className:"text",children:h})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=u,e[10]=d,e[11]=s,e[12]=i,e[13]=a,e[14]=m}else m=e[14];return m},Ah=Rh.memo($h),Ft=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:d,key:c}=n,u=Ih(()=>d?.length?d.map(a=>ut(Ah,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[d,r.activeItemKeys,r.enabledItemKeys,t,o]);return ut(ma,{buttonAriaLabel:`${c} dropdown`,buttonClassName:[Dn,`${Dn}-${c}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:c,Icon:l,itemsContainerClassNames:[`${Dn}-items`,...s||[]],label:i,children:u},c)};import{mergeRegister as Dh}from"@lexical/utils";import{$getSelection as Oh}from"lexical";import{useCallback as Fh,useDeferredValue as Bh,useEffect as Ph,useRef as pa,useState as jh}from"react";function Hh(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let n of t){let r=[];for(let l of n.items)e.set(l.key,{active:!1,enabled:!0}),r.push(l.key);o.set(n.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:r})}return{groupStates:o,itemStates:e}}function xo(t,e){let[o,n]=jh(()=>Hh(e)),r=Bh(o),l=G(),s=pa(l);s.current=l;let i=pa(e);i.current=e;let d=xr(),c=Fh(()=>{t.getEditorState().read(()=>{let u=Oh();if(!u)return;let a=i.current;if(!a?.length)return;let m=s.current,p=new Map,h=new Map;for(let f of a){let g=[],_=[],L=[],R=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let x of f.items){let C=x.isActive?(!R||g.length<R)&&x.isActive({editor:t,editorConfigContext:m,selection:u}):!1,k=x.isEnabled?x.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;C&&(g.push(x.key),_.push(x)),k&&L.push(x.key),p.set(x.key,{active:C,enabled:k})}let b=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;h.set(f.key,{activeItemKeys:g,activeItems:_,enabledGroup:b,enabledItemKeys:L})}n({groupStates:h,itemStates:p})})},[t]);return Ph(()=>{d(c);let u=()=>d(c),a=Dh(t.registerUpdateListener(u));return document.addEventListener("mouseup",u),()=>{a(),document.removeEventListener("mouseup",u)}},[t,d,c]),r}function Jh({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&he(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?he(Ot,{active:t,editor:o,enabled:n,item:r,children:he(r.ChildComponent,{})},r.key):null}function Xh({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=Kh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:d}}=G(),c=l.groupStates.get(n.key),u=On(()=>{if(n.type!=="dropdown")return;let m=c?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,c?.activeItems]),a=On(()=>{if(n.type!=="dropdown")return;let m=c?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let p=m[0],h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:s,schemaPath:d}):p.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[n,c?.activeItems,s,i,d]);return Gh("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&c?he(Ft,{anchorElem:t,editor:e,group:n,groupState:c,Icon:u,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(m=>{let p=l.itemStates.get(m.key);return he(Jh,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&he("div",{className:"divider"})]},n.key)}function Zh({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=Co.useRef(null),s=fa(),{y:i}=Wh(),d=xo(o,n?.features?.toolbarFixed?.groups),c=On(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let a=r.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return zh(()=>{if(!c)return;let u=l.current;if(!u)return;let a=u.getBoundingClientRect(),m=c.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),c.classList.remove("fixed-toolbar--hide"),c.classList.add("fixed-toolbar")}},50,[l,c,i]),he("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:s&&he(Co.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((u,a)=>he(Xh,{anchorElem:t,editor:o,editorConfig:n,group:u,index:a,toolbarStates:d},u.key))})})}var ha=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ha(t.parentEditor)}return!1},ga=t=>{let e=Uh(6),{clientProps:o}=t,[n]=Vh(),r=G();if(!fa())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,d=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,c,u;if(e[0]!==o||e[1]!==i||e[2]!==d||e[3]!==r){u=Symbol.for("react.early_return_sentinel");e:{let a=ha(r);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=he(Zh,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=d,e[3]=r,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var Yh=$({plugins:[{Component:ga,position:"aboveContainer"}]});import{c as qh}from"react/compiler-runtime";import{jsx as ye,jsxs as ba}from"react/jsx-runtime";import{useLexicalComposerContext as Qh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as e5}from"@lexical/react/useLexicalEditable";import{mergeRegister as ka}from"@lexical/utils";import{$getSelection as _a,$isRangeSelection as xa,$isTextNode as t5,COMMAND_PRIORITY_LOW as o5,getDOMSelection as Ta,SELECTION_CHANGE_COMMAND as n5}from"lexical";import{useCallback as ko,useEffect as Bt,useMemo as r5,useRef as Ca,useState as l5}from"react";import"react";import{createPortal as i5}from"react-dom";function Fn(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 bo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),h=d.top-a.height-c,f=d.left-l;s==="center"&&(f=d.left+d.width/2-a.width/2);let g=0;return!e&&h<p.top&&!i&&(g=a.height+d.height+c*2,h+=g),s==="center"?f+a.width>p.right?f=p.right-a.width-l:f<p.left&&(f=p.left+l):f+a.width>p.right&&(f=p.right-a.width-l),f-=m.left,r.style.opacity="1",i&&n!==0?(h-=m.bottom-n+a.height-3,r.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=m.top,r.style.transform=`translate(${f}px, ${h}px)`),g}function s5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&ye(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?ye(Ot,{active:t,editor:o,enabled:n,item:r,children:ye(r.ChildComponent,{})},r.key):null}function a5({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=G(),s=r.groupStates.get(o.key),i=r5(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return ba("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?ye(Ft,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(d=>{let c=r.itemStates.get(d.key);return ye(s5,{active:c?.active??!1,anchorElem:t,editor:e,enabled:c?.enabled??!0,item:d},d.key)}):null,n<l.features.toolbarInline?.groups.length-1&&ye("div",{className:"divider"})]},o.key)}function c5({anchorElem:t,editor:e}){let o=Ca(null),n=Ca(null),{editorConfig:r}=G(),l=xo(e,r?.features?.toolbarInline?.groups),s=ko(()=>{if(o?.current){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=ko(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let p=u.clientX,h=u.clientY,f=document.elementFromPoint(p,h);o.current.contains(f)||s()}}},[s]),d=ko(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Bt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d)}),[o,i,d]);let c=ko(()=>{let u=_a(),a=Ta(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(u!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=Fn(a,h),g=bo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&bo({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Bt(()=>{let u=t.parentElement,a=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",a),u&&u.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),u&&u.removeEventListener("scroll",a)}},[e,c,t]),Bt(()=>(e.getEditorState().read(()=>{c()}),ka(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(n5,()=>(c(),!1),o5))),[e,c]),ba("div",{className:"inline-toolbar-popup",ref:o,children:[ye("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((u,a)=>ye(a5,{anchorElem:t,editor:e,group:u,index:a,toolbarStates:l},u.key))]})}function u5(t,e){let o=qh(12),[n,r]=l5(!1),l=e5(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=_a(),h=Ta(t._window),f=t.getRootElement();if(h!==null&&(!xa(p)||f===null||!f.contains(h.anchorNode))){r(!1);return}if(!xa(p))return;if(p.getTextContent()!==""){let _=p.getNodes(),L=!1;for(let R of _)if(t5(R)){r(!0),L=!0;break}L||r(!1)}else r(!1);let g=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&g===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,d,c;o[2]!==i?(d=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),c=[i],o[2]=i,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Bt(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>ka(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Bt(u,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=i5(ye(c5,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var wa=t=>{let{anchorElem:e}=t,[o]=Qh();return u5(o,e)};var d5=$({plugins:[{Component:wa,position:"floatingAnchorElem"}]});import{TableCellNode as t2,TableNode as o2,TableRowNode as n2}from"@lexical/table";import{jsx as Sa}from"react/jsx-runtime";import"react";var m5={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Bn=({className:t,size:e=24})=>Sa("svg",{className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Sa("path",{clipRule:"evenodd",d:m5[e],fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as p5,$createTableNode as f5,$createTableRowNode as h5,$isTableCellNode as Ea,$isTableNode as Pn,$isTableRowNode as jn,TableCellHeaderStates as _o,TableCellNode as g5,TableNode as x5,TableRowNode as C5}from"@lexical/table";import{$isParagraphNode as b5,$isTextNode as k5}from"lexical";var La=/^\|(.+)\|\s?$/,_5=/^(\| ?:?-*:? ?)+\|\s?$/,ya=({allTransformers:t})=>({type:"element",dependencies:[x5,C5,g5],export:e=>{if(!Pn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!jn(n))continue;let l=!1;for(let s of n.getChildren())Ea(s)&&(r.push(zt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===_o.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
|
|
58
|
+
`,Os="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",Fs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",a0=new RegExp("^[^"+Fs+"]*["+Os+"]"),c0=new RegExp("^[^"+Os+"]*["+Fs+"]"),u0={bold:O.IS_BOLD,code:O.IS_CODE,highlight:O.IS_HIGHLIGHT,italic:O.IS_ITALIC,strikethrough:O.IS_STRIKETHROUGH,subscript:O.IS_SUBSCRIPT,superscript:O.IS_SUPERSCRIPT,underline:O.IS_UNDERLINE},d0={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},m0={center:O.IS_ALIGN_CENTER,end:O.IS_ALIGN_END,justify:O.IS_ALIGN_JUSTIFY,left:O.IS_ALIGN_LEFT,right:O.IS_ALIGN_RIGHT,start:O.IS_ALIGN_START},p0={[O.IS_ALIGN_CENTER]:"center",[O.IS_ALIGN_END]:"end",[O.IS_ALIGN_JUSTIFY]:"justify",[O.IS_ALIGN_LEFT]:"left",[O.IS_ALIGN_RIGHT]:"right",[O.IS_ALIGN_START]:"start"},f0={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},h0={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var Bs={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Ke("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Ke("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Ke("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Ke("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Ke("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Ke("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Ke("sup",{children:e})),e}};import{jsx as $t}from"react/jsx-runtime";var Ps={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,n=e.fields?.alt||o?.alt||"",r=o.url;if(!o.mimeType.startsWith("image"))return $t("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return $t("img",{alt:n,height:o.height,src:r,width:o.width});let l=[];for(let s in o.sizes){let i=o.sizes[s];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let d=i?.url;l.push($t("source",{media:`(max-width: ${i.width}px)`,srcSet:d,type:i.mimeType},s))}return l.push($t("img",{alt:n,height:o?.height,src:r,width:o?.width},"image")),$t("picture",{children:l})}};var ct={...$s,...Bs,...vs,...Ns,...Ds,...Ls,...ys,...Ms,...Is({}),...Ps,...As};import{jsx as po,Fragment as g0}from"react/jsx-runtime";import mo from"react";function js(t){if(!!!t?.root?.children?.length)return!1;let o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let n=t?.root?.children[0];if(!n?.children||n?.children?.length===0)o=!0;else if(n?.children?.length===1){let r=n?.children[0];r?.type==="text"&&(r?.text?.length||(o=!0))}}return!o}function x0(t){return e=>{let o={...e,isEditor:!1,isJSXConverter:!0};if(t.Component)return t.Component(o);if(t.html){let n=typeof t.html=="function"?t.html(o):t.html;return po("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function Hs(t){return e=>{if(t.Component){let o={...e,isEditor:!1,isJSXConverter:!0};return t.Component(o)}if(t.Block){let o=e.node,n={childIndex:e.childIndex,converters:e.converters,formData:o.fields??{},isEditor:!1,isJSXConverter:!0,node:o,nodesToJSX:e.nodesToJSX,parent:e.parent};return mo.createElement(t.Block,n)}if(t.html){let o={...e,isEditor:!1,isJSXConverter:!0},n=typeof t.html=="function"?t.html(o):t.html;return po("span",{dangerouslySetInnerHTML:{__html:n}})}return null}}function C0(t){let e={};for(let[o,n]of Object.entries(t)){if(!n||typeof n!="object")continue;if(o==="blocks"){e.blocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.blocks[l]=Hs(i))}continue}if(o==="inlineBlocks"){e.inlineBlocks={};for(let[l,s]of Object.entries(n)){let i=s;(i.Component||i.Block||i.html)&&(e.inlineBlocks[l]=Hs(i))}continue}let r=n;(r.Component||r.html)&&(e[o]=x0(r))}return e}function Us({converters:t,data:e,disableIndent:o,disableTextAlign:n,nodeMap:r}){if(js(e)){let l=r?C0(r):void 0,s=l?{...t,...l,blocks:{...t.blocks,...l.blocks},inlineBlocks:{...t.inlineBlocks,...l.inlineBlocks}}:t;return Gs({converters:s,disableIndent:o,disableTextAlign:n,nodes:e.root.children,parent:e.root})}return po(g0,{})}function Gs({converters:t,disableIndent:e,disableTextAlign:o,nodes:n,parent:r}){let l=t.unknown;return n.map((i,d)=>{let c;i.type==="block"?(c=t?.blocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${i?.fields?.blockType} block, but no converter is provided`)):i.type==="inlineBlock"?(c=t?.inlineBlocks?.[i?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${i?.fields?.blockType} inline block, but no converter is provided`)):c=t[i.type];try{!c&&l&&(c=l);let u;c?u=typeof c=="function"?c({childIndex:d,converters:t,node:i,nodesToJSX:p=>Gs({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...i,parent:r}}),parent:r}):c:u=po("span",{children:"unknown node"},d);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(i.type))&&"format"in i&&i.format)switch(i.format){case"center":a.textAlign="center";break;case"end":a.textAlign="right";break;case"justify":a.textAlign="justify";break;case"left":break;case"right":a.textAlign="right";break;case"start":a.textAlign="left";break}if(!e&&(!Array.isArray(e)||!e?.includes(i.type))&&"indent"in i&&i.indent&&i.type!=="listitem"&&(a.paddingInlineStart=`${Number(i.indent)*40}px`),mo.isValidElement(u)){if(a.textAlign||a.paddingInlineStart){let m={...a,...u?.props?.style??{}};return mo.cloneElement(u,{key:d,style:m})}return mo.cloneElement(u,{key:d})}return u}catch(u){return console.error("Error converting lexical node to JSX:",u,"node:",i),null}}).filter(Boolean)}function Ln({className:t,converters:e,data:o,disableContainer:n,disableIndent:r,disableTextAlign:l,nodeMap:s}){if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:ct}):i=e:i=ct;let d=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&Us({converters:i,data:o,disableIndent:r,disableTextAlign:l,nodeMap:s});return n?Vs(b0,{children:d}):Vs("div",{className:t??"payload-richtext",children:d})}function zs(){let t=k0(7),[e]=_0(),o;t[0]!==e?(o=()=>e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[n,r]=w0(o),l,s;t[2]!==e?(l=()=>e.registerUpdateListener(d=>{let{editorState:c}=d;r(c.toJSON())}),s=[e],t[2]=e,t[3]=l,t[4]=s):(l=t[3],s=t[4]),T0(l,s);let i;return t[5]!==n?(i=Ws("div",{className:"debug-jsx-converter",children:Ws(Ln,{converters:ct,data:n})}),t[5]=n,t[6]=i):i=t[6],i}var S0=$({plugins:[{Component:zs,position:"bottom"}]});var H={amber:{50:"oklch(0.987 0.022 95.277)",100:"oklch(0.962 0.059 95.617)",200:"oklch(0.924 0.12 95.746)",300:"oklch(0.879 0.169 91.605)",400:"oklch(0.828 0.189 84.429)",500:"oklch(0.769 0.188 70.08)",600:"oklch(0.666 0.179 58.318)",700:"oklch(0.555 0.163 48.998)",800:"oklch(0.473 0.137 46.201)",900:"oklch(0.414 0.112 45.904)",950:"oklch(0.279 0.077 45.635)"},black:"#000",blue:{50:"oklch(0.97 0.014 254.604)",100:"oklch(0.932 0.032 255.585)",200:"oklch(0.882 0.059 254.128)",300:"oklch(0.809 0.105 251.813)",400:"oklch(0.707 0.165 254.624)",500:"oklch(0.623 0.214 259.815)",600:"oklch(0.546 0.245 262.881)",700:"oklch(0.488 0.243 264.376)",800:"oklch(0.424 0.199 265.638)",900:"oklch(0.379 0.146 265.522)",950:"oklch(0.282 0.091 267.935)"},current:"currentColor",cyan:{50:"oklch(0.984 0.019 200.873)",100:"oklch(0.956 0.045 203.388)",200:"oklch(0.917 0.08 205.041)",300:"oklch(0.865 0.127 207.078)",400:"oklch(0.789 0.154 211.53)",500:"oklch(0.715 0.143 215.221)",600:"oklch(0.609 0.126 221.723)",700:"oklch(0.52 0.105 223.128)",800:"oklch(0.45 0.085 224.283)",900:"oklch(0.398 0.07 227.392)",950:"oklch(0.302 0.056 229.695)"},emerald:{50:"oklch(0.979 0.021 166.113)",100:"oklch(0.95 0.052 163.051)",200:"oklch(0.905 0.093 164.15)",300:"oklch(0.845 0.143 164.978)",400:"oklch(0.765 0.177 163.223)",500:"oklch(0.696 0.17 162.48)",600:"oklch(0.596 0.145 163.225)",700:"oklch(0.508 0.118 165.612)",800:"oklch(0.432 0.095 166.913)",900:"oklch(0.378 0.077 168.94)",950:"oklch(0.262 0.051 172.552)"},fuchsia:{50:"oklch(0.977 0.017 320.058)",100:"oklch(0.952 0.037 318.852)",200:"oklch(0.903 0.076 319.62)",300:"oklch(0.833 0.145 321.434)",400:"oklch(0.74 0.238 322.16)",500:"oklch(0.667 0.295 322.15)",600:"oklch(0.591 0.293 322.896)",700:"oklch(0.518 0.253 323.949)",800:"oklch(0.452 0.211 324.591)",900:"oklch(0.401 0.17 325.612)",950:"oklch(0.293 0.136 325.661)"},gray:{50:"oklch(0.985 0.002 247.839)",100:"oklch(0.967 0.003 264.542)",200:"oklch(0.928 0.006 264.531)",300:"oklch(0.872 0.01 258.338)",400:"oklch(0.707 0.022 261.325)",500:"oklch(0.551 0.027 264.364)",600:"oklch(0.446 0.03 256.802)",700:"oklch(0.373 0.034 259.733)",800:"oklch(0.278 0.033 256.848)",900:"oklch(0.21 0.034 264.665)",950:"oklch(0.13 0.028 261.692)"},green:{50:"oklch(0.982 0.018 155.826)",100:"oklch(0.962 0.044 156.743)",200:"oklch(0.925 0.084 155.995)",300:"oklch(0.871 0.15 154.449)",400:"oklch(0.792 0.209 151.711)",500:"oklch(0.723 0.219 149.579)",600:"oklch(0.627 0.194 149.214)",700:"oklch(0.527 0.154 150.069)",800:"oklch(0.448 0.119 151.328)",900:"oklch(0.393 0.095 152.535)",950:"oklch(0.266 0.065 152.934)"},indigo:{50:"oklch(0.962 0.018 272.314)",100:"oklch(0.93 0.034 272.788)",200:"oklch(0.87 0.065 274.039)",300:"oklch(0.785 0.115 274.713)",400:"oklch(0.673 0.182 276.935)",500:"oklch(0.585 0.233 277.117)",600:"oklch(0.511 0.262 276.966)",700:"oklch(0.457 0.24 277.023)",800:"oklch(0.398 0.195 277.366)",900:"oklch(0.359 0.144 278.697)",950:"oklch(0.257 0.09 281.288)"},inherit:"inherit",lime:{50:"oklch(0.986 0.031 120.757)",100:"oklch(0.967 0.067 122.328)",200:"oklch(0.938 0.127 124.321)",300:"oklch(0.897 0.196 126.665)",400:"oklch(0.841 0.238 128.85)",500:"oklch(0.768 0.233 130.85)",600:"oklch(0.648 0.2 131.684)",700:"oklch(0.532 0.157 131.589)",800:"oklch(0.453 0.124 130.933)",900:"oklch(0.405 0.101 131.063)",950:"oklch(0.274 0.072 132.109)"},neutral:{50:"oklch(0.985 0 0)",100:"oklch(0.97 0 0)",200:"oklch(0.922 0 0)",300:"oklch(0.87 0 0)",400:"oklch(0.708 0 0)",500:"oklch(0.556 0 0)",600:"oklch(0.439 0 0)",700:"oklch(0.371 0 0)",800:"oklch(0.269 0 0)",900:"oklch(0.205 0 0)",950:"oklch(0.145 0 0)"},orange:{50:"oklch(0.98 0.016 73.684)",100:"oklch(0.954 0.038 75.164)",200:"oklch(0.901 0.076 70.697)",300:"oklch(0.837 0.128 66.29)",400:"oklch(0.75 0.183 55.934)",500:"oklch(0.705 0.213 47.604)",600:"oklch(0.646 0.222 41.116)",700:"oklch(0.553 0.195 38.402)",800:"oklch(0.47 0.157 37.304)",900:"oklch(0.408 0.123 38.172)",950:"oklch(0.266 0.079 36.259)"},pink:{50:"oklch(0.971 0.014 343.198)",100:"oklch(0.948 0.028 342.258)",200:"oklch(0.899 0.061 343.231)",300:"oklch(0.823 0.12 346.018)",400:"oklch(0.718 0.202 349.761)",500:"oklch(0.656 0.241 354.308)",600:"oklch(0.592 0.249 0.584)",700:"oklch(0.525 0.223 3.958)",800:"oklch(0.459 0.187 3.815)",900:"oklch(0.408 0.153 2.432)",950:"oklch(0.284 0.109 3.907)"},purple:{50:"oklch(0.977 0.014 308.299)",100:"oklch(0.946 0.033 307.174)",200:"oklch(0.902 0.063 306.703)",300:"oklch(0.827 0.119 306.383)",400:"oklch(0.714 0.203 305.504)",500:"oklch(0.627 0.265 303.9)",600:"oklch(0.558 0.288 302.321)",700:"oklch(0.496 0.265 301.924)",800:"oklch(0.438 0.218 303.724)",900:"oklch(0.381 0.176 304.987)",950:"oklch(0.291 0.149 302.717)"},red:{50:"oklch(0.971 0.013 17.38)",100:"oklch(0.936 0.032 17.717)",200:"oklch(0.885 0.062 18.334)",300:"oklch(0.808 0.114 19.571)",400:"oklch(0.704 0.191 22.216)",500:"oklch(0.637 0.237 25.331)",600:"oklch(0.577 0.245 27.325)",700:"oklch(0.505 0.213 27.518)",800:"oklch(0.444 0.177 26.899)",900:"oklch(0.396 0.141 25.723)",950:"oklch(0.258 0.092 26.042)"},rose:{50:"oklch(0.969 0.015 12.422)",100:"oklch(0.941 0.03 12.58)",200:"oklch(0.892 0.058 10.001)",300:"oklch(0.81 0.117 11.638)",400:"oklch(0.712 0.194 13.428)",500:"oklch(0.645 0.246 16.439)",600:"oklch(0.586 0.253 17.585)",700:"oklch(0.514 0.222 16.935)",800:"oklch(0.455 0.188 13.697)",900:"oklch(0.41 0.159 10.272)",950:"oklch(0.271 0.105 12.094)"},sky:{50:"oklch(0.977 0.013 236.62)",100:"oklch(0.951 0.026 236.824)",200:"oklch(0.901 0.058 230.902)",300:"oklch(0.828 0.111 230.318)",400:"oklch(0.746 0.16 232.661)",500:"oklch(0.685 0.169 237.323)",600:"oklch(0.588 0.158 241.966)",700:"oklch(0.5 0.134 242.749)",800:"oklch(0.443 0.11 240.79)",900:"oklch(0.391 0.09 240.876)",950:"oklch(0.293 0.066 243.157)"},slate:{50:"oklch(0.984 0.003 247.858)",100:"oklch(0.968 0.007 247.896)",200:"oklch(0.929 0.013 255.508)",300:"oklch(0.869 0.022 252.894)",400:"oklch(0.704 0.04 256.788)",500:"oklch(0.554 0.046 257.417)",600:"oklch(0.446 0.043 257.281)",700:"oklch(0.372 0.044 257.287)",800:"oklch(0.279 0.041 260.031)",900:"oklch(0.208 0.042 265.755)",950:"oklch(0.129 0.042 264.695)"},stone:{50:"oklch(0.985 0.001 106.423)",100:"oklch(0.97 0.001 106.424)",200:"oklch(0.923 0.003 48.717)",300:"oklch(0.869 0.005 56.366)",400:"oklch(0.709 0.01 56.259)",500:"oklch(0.553 0.013 58.071)",600:"oklch(0.444 0.011 73.639)",700:"oklch(0.374 0.01 67.558)",800:"oklch(0.268 0.007 34.298)",900:"oklch(0.216 0.006 56.043)",950:"oklch(0.147 0.004 49.25)"},teal:{50:"oklch(0.984 0.014 180.72)",100:"oklch(0.953 0.051 180.801)",200:"oklch(0.91 0.096 180.426)",300:"oklch(0.855 0.138 181.071)",400:"oklch(0.777 0.152 181.912)",500:"oklch(0.704 0.14 182.503)",600:"oklch(0.6 0.118 184.704)",700:"oklch(0.511 0.096 186.391)",800:"oklch(0.437 0.078 188.216)",900:"oklch(0.386 0.063 188.416)",950:"oklch(0.277 0.046 192.524)"},transparent:"transparent",violet:{50:"oklch(0.969 0.016 293.756)",100:"oklch(0.943 0.029 294.588)",200:"oklch(0.894 0.057 293.283)",300:"oklch(0.811 0.111 293.571)",400:"oklch(0.702 0.183 293.541)",500:"oklch(0.606 0.25 292.717)",600:"oklch(0.541 0.281 293.009)",700:"oklch(0.491 0.27 292.581)",800:"oklch(0.432 0.232 292.759)",900:"oklch(0.38 0.189 293.745)",950:"oklch(0.283 0.141 291.089)"},white:"#fff",yellow:{50:"oklch(0.987 0.026 102.212)",100:"oklch(0.973 0.071 103.193)",200:"oklch(0.945 0.129 101.54)",300:"oklch(0.905 0.182 98.111)",400:"oklch(0.852 0.199 91.936)",500:"oklch(0.795 0.184 86.047)",600:"oklch(0.681 0.162 75.834)",700:"oklch(0.554 0.135 66.442)",800:"oklch(0.476 0.114 61.907)",900:"oklch(0.421 0.095 57.708)",950:"oklch(0.286 0.066 53.813)"},zinc:{50:"oklch(0.985 0 0)",100:"oklch(0.967 0.001 286.375)",200:"oklch(0.92 0.004 286.32)",300:"oklch(0.871 0.006 286.286)",400:"oklch(0.705 0.015 286.067)",500:"oklch(0.552 0.016 285.938)",600:"oklch(0.442 0.017 285.786)",700:"oklch(0.37 0.013 285.805)",800:"oklch(0.274 0.006 286.033)",900:"oklch(0.21 0.006 285.885)",950:"oklch(0.141 0.005 285.823)"}},E0={text:{"text-red":{css:{color:`light-dark(${H.red[600]}, ${H.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${H.orange[600]}, ${H.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${H.yellow[700]}, ${H.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${H.green[700]}, ${H.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${H.blue[600]}, ${H.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${H.purple[600]}, ${H.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${H.pink[600]}, ${H.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${H.red[400]}, ${H.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${H.orange[400]}, ${H.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${H.yellow[300]}, ${H.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${H.green[400]}, ${H.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${H.blue[400]}, ${H.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${H.purple[400]}, ${H.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${H.pink[400]}, ${H.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as ph}from"lexical";import{jsx as Ks}from"react/jsx-runtime";import"react";var N0="M9.5 6C9.77614 6 10 6.22386 10 6.5C10 6.77614 9.77614 7 9.5 7H7.5C7.22386 7 7 7.22386 7 7.5V16.5C7 16.7761 7.22386 17 7.5 17H16.5C16.7761 17 17 16.7761 17 16.5V14.5C17 14.2239 17.2239 14 17.5 14C17.7761 14 18 14.2239 18 14.5V16.5C18 17.3284 17.3284 18 16.5 18H7.5C6.67157 18 6 17.3284 6 16.5V7.5C6 6.67157 6.67157 6 7.5 6H9.5ZM17.5 6C17.7761 6 18 6.22386 18 6.5V11.5C18 11.7761 17.7761 12 17.5 12C17.2239 12 17 11.7761 17 11.5V7.70703L12.8535 11.8535C12.6583 12.0488 12.3417 12.0488 12.1465 11.8535C11.9512 11.6583 11.9512 11.3417 12.1465 11.1465L16.293 7H12.5C12.2239 7 12 6.77614 12 6.5C12 6.22386 12.2239 6 12.5 6H17.5Z",yn=({className:t})=>Ks("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:Ks("path",{d:N0,fill:"currentColor"})});import{jsx as I0}from"react/jsx-runtime";import{$applyNodeReplacement as M0}from"lexical";import*as Xs from"react";import{DecoratorBlockNode as L0}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as y0}from"@lexical/utils";import{$applyNodeReplacement as v0}from"lexical";function R0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Js({relationTo:o,value:e})}:null}var At=class extends L0{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"relationship"}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:R0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=Js(o);return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return y0(o,e?.theme?.relationship),o}decorate(e,o){return null}exportDOM(){let e=document.createElement("div");e.setAttribute("data-lexical-relationship-id",String(typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value)),e.setAttribute("data-lexical-relationship-relationTo",this.__data?.relationTo);let o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"relationship",version:2}}getData(){return this.getLatest().__data}getTextContent(){return`${this.__data?.relationTo} relation to ${typeof this.__data?.value=="object"?this.__data?.value?.id:this.__data?.value}`}setData(e){let o=this.getWritable();o.__data=e}};function Js(t){return v0(new At({data:t}))}var $0=Xs.lazy(()=>import("./RelationshipComponent-RZL743CS.js").then(t=>({default:t.RelationshipComponent})));function A0(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Je({relationTo:o,value:e})}:null}var Le=class extends At{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{div:e=>!e.hasAttribute("data-lexical-relationship-relationTo")||!e.hasAttribute("data-lexical-relationship-id")?null:{conversion:A0,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},n=Je(o);return n.setFormat(e.format),n}decorate(e,o){return I0($0,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Je(t){return M0(new Le({data:t}))}function vn(t){return t instanceof Le}import{c as th}from"react/compiler-runtime";import{jsx as oh}from"react/jsx-runtime";import{useLexicalComposerContext as nh}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as rh}from"@lexical/utils";import{$getPreviousSelection as lh,$getSelection as ih,$isParagraphNode as sh,$isRangeSelection as ah,COMMAND_PRIORITY_EDITOR as ch,createCommand as uh}from"lexical";import{useEffect as dh}from"react";import{c as qs}from"react/compiler-runtime";import{jsx as Rn}from"react/jsx-runtime";import{useLexicalComposerContext as Qs}from"@lexical/react/LexicalComposerContext.js";import{toast as z0}from"@payloadcms/ui";import{$getNodeByKey as K0,COMMAND_PRIORITY_EDITOR as ea}from"lexical";import{useEffect as ta,useState as J0}from"react";import{c as D0}from"react/compiler-runtime";import{jsx as O0}from"react/jsx-runtime";import{useLexicalComposerContext as F0}from"@lexical/react/LexicalComposerContext";import{useListDrawer as B0,useModal as P0}from"@payloadcms/ui";import{$getNodeByKey as Zs,$getPreviousSelection as j0,$getRoot as H0,$getSelection as U0,$isRangeSelection as G0,$setSelection as V0}from"lexical";import{useEffect as W0,useState as Ys}from"react";var Dt=t=>{let e=D0(23),[o]=F0(),[n,r]=Ys(null),[l,s]=Ys(!1),[i,d,c]=B0(t),{closeDrawer:u,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:h}=P0(),f;e[0]===Symbol.for("react.memo_cache_sentinel")?(f=()=>{let N=U0()??j0();r(N)},e[0]=f):f=e[0];let g=f,_;e[1]!==o||e[2]!==n?(_=()=>{n&&o.update(()=>{if(G0(n)){let{anchor:N,focus:S}=n;Zs(N.key)&&Zs(S.key)&&V0(n.clone())}else H0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=_):_=e[3];let L=_,R;e[4]!==u?(R=()=>{u()},e[4]=u,e[5]=R):R=e[5];let b=R,x,C;e[6]!==a||e[7]!==h||e[8]!==L||e[9]!==l?(x=()=>{if(!l)return;let N=h[a];N&&!N?.isOpen&&(s(!1),setTimeout(()=>{L()},1))},C=[h,a,L,l],e[6]=a,e[7]=h,e[8]=L,e[9]=l,e[10]=x,e[11]=C):(x=e[10],C=e[11]),W0(x,C);let k;e[12]!==d?(k=N=>O0(d,{...N,onClick:()=>{g()}}),e[12]=d,e[13]=k):k=e[13];let T;e[14]!==p?(T=()=>{g(),p(),s(!0)},e[14]=p,e[15]=T):T=e[15];let I;return e[16]!==i||e[17]!==b||e[18]!==m||e[19]!==a||e[20]!==k||e[21]!==T?(I={closeListDrawer:b,isListDrawerOpen:m,ListDrawer:i,listDrawerSlug:a,ListDrawerToggler:k,openListDrawer:T},e[16]=i,e[17]=b,e[18]=m,e[19]=a,e[20]=k,e[21]=T,e[22]=I):I=e[22],I};var X0=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=K0(o);r&&r.replace(Je({relationTo:e,value:n}))}):t.dispatchCommand(In,{relationTo:e,value:n})},Z0=t=>{let e=qs(14),{enabledCollectionSlugs:o}=t,[n]=Qs(),[r,l]=J0(null),s=o?.[0],i;e[0]!==o||e[1]!==s?(i={collectionSlugs:o,selectedCollection:s},e[0]=o,e[1]=s,e[2]=i):i=e[2];let{closeListDrawer:d,ListDrawer:c,openListDrawer:u}=Dt(i),a,m;e[3]!==n||e[4]!==u?(a=()=>n.registerCommand(Qe,g=>(l(g?.replace?g?.replace.nodeKey:null),u(),!0),ea),m=[n,u],e[3]=n,e[4]=u,e[5]=a,e[6]=m):(a=e[5],m=e[6]),ta(a,m);let p;e[7]!==d||e[8]!==n||e[9]!==r?(p=g=>{let{collectionSlug:_,doc:L}=g;X0({editor:n,relationTo:_,replaceNodeKey:r,value:L.id}),d()},e[7]=d,e[8]=n,e[9]=r,e[10]=p):p=e[10];let h=p,f;return e[11]!==c||e[12]!==h?(f=Rn(c,{onSelect:h}),e[11]=c,e[12]=h,e[13]=f):f=e[13],f},Y0=()=>{let t=qs(3),[e]=Qs(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Qe,q0,ea),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ta(o,n),null},oa=({enabledCollectionSlugs:t})=>t?.length?Rn(Z0,{enabledCollectionSlugs:t}):Rn(Y0,{});function q0(){return z0.error("No relationship collections enabled"),!0}import{useConfig as Q0,useEntityVisibility as eh}from"@payloadcms/ui";import*as na from"react";var fo=t=>{let{collectionSlugsBlacklist:e,collectionSlugsWhitelist:o,uploads:n=!1}=t||{},{config:{collections:r}}=Q0(),{visibleEntities:l}=eh();return na.useMemo(()=>{let i=[],d=[],c=o?new Set(o):null,u=e?new Set(e):null;for(let a of r){let{slug:m,admin:{enableRichTextRelationship:p},upload:h}=a;if(l?.collections.includes(m)){if(n){if(!p||!h)continue}else if(h||!p)continue;c&&!c.has(m)||u&&u.has(m)||(i.push(m),d.push(a))}}return{enabledCollections:d,enabledCollectionSlugs:i}},[r,l,n,o,e])};var In=uh("INSERT_RELATIONSHIP_COMMAND"),ra=t=>{let e=th(8),{clientProps:o}=t,[n]=nh(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=fo(s),d,c;e[3]!==n?(d=()=>{if(!n.hasNodes([Le]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(In,mh,ch)},c=[n],e[3]=n,e[4]=d,e[5]=c):(d=e[4],c=e[5]),dh(d,c);let u;return e[6]!==i?(u=oh(oa,{enabledCollectionSlugs:i}),e[6]=i,e[7]=u):u=e[7],u};function mh(t){let e=ih()||lh();if(ah(e)){let o=Je(t),{focus:n}=e,r=n.getNode();rh(o),sh(r)&&!r.__first&&r.remove()}return!0}var fh=$({nodes:[Le],plugins:[{Component:ra,position:"normal"}],slashMenu:{groups:[X([{Icon:yn,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]},toolbarFixed:{groups:[Te([{ChildComponent:yn,isActive:({selection:t})=>{if(!ph(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return vn(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(Qe,{replace:!1})}}])]}});import{c as Uh}from"react/compiler-runtime";import{jsx as he,jsxs as Gh}from"react/jsx-runtime";import{useLexicalComposerContext as Vh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as fa}from"@lexical/react/useLexicalEditable";import{useScrollInfo as Wh,useThrottledEffect as zh,useTranslation as Kh}from"@payloadcms/ui";import*as Co from"react";import{useMemo as On}from"react";import{jsx as hh,jsxs as gh}from"react/jsx-runtime";import{Tooltip as xh,useTranslation as Ch}from"@payloadcms/ui";import{$addUpdateTag as bh}from"lexical";import{useCallback as la,useEffect as kh,useMemo as ia,useRef as _h,useState as Th}from"react";var Mn="toolbar-popup__button",Ot=({active:t=!1,children:e,editor:o,enabled:n=!0,item:r})=>{let{i18n:l}=Ch(),{fieldProps:{featureClientSchemaMap:s,schemaPath:i}}=G(),[d,c]=Th(!1),u=_h(null);kh(()=>{u.current?.removeAttribute("data-pressing")},[t]);let a=ia(()=>r.label?typeof r.label=="function"?r.label({featureClientSchemaMap:s,i18n:l,schemaPath:i}):r.label:r.key.replace(/([a-z])([A-Z])/g,"$1 $2").replace(/^./,f=>f.toUpperCase()),[s,l,i,r]),m=ia(()=>[Mn,n?"":"disabled",t?"active":"",r.key?`${Mn}-${r.key}`:""].filter(Boolean).join(" "),[t,n,r.key]),p=la(()=>{n&&o.focus(()=>{o.update(()=>{bh("toolbar")}),r.onSelect?.({editor:o,isActive:t})})},[o,r,t,n]),h=la(f=>{f.preventDefault(),f.currentTarget.setAttribute("data-pressing","")},[]);return gh("button",{"aria-label":a,className:m,"data-button-key":r.key,disabled:!n,onClick:p,onMouseDown:h,onPointerEnter:()=>c(!0),onPointerLeave:()=>{c(!1),u.current?.removeAttribute("data-pressing")},ref:u,type:"button",children:[hh(xh,{className:`${Mn}__tooltip`,show:d,children:a}),e]})};import{c as vh}from"react/compiler-runtime";import{jsx as ut}from"react/jsx-runtime";import Rh,{useMemo as Ih}from"react";import{useTranslation as Mh}from"@payloadcms/ui";import{jsx as Ae,jsxs as sa}from"react/jsx-runtime";import{Button as wh}from"@payloadcms/ui";import{$addUpdateTag as Sh,isDOMNode as Eh}from"lexical";import ho,{useCallback as Nh,useEffect as go,useMemo as ca,useRef as $n,useState as An}from"react";import{createPortal as Lh}from"react-dom";var aa="toolbar-popup__dropdown-item",ua=ho.createContext(null);function da({active:t,children:e,editor:o,enabled:n,Icon:r,item:l,itemKey:s,tooltip:i}){let d=ca(()=>[aa,n===!1?"disabled":"",t?"active":"",l?.key?`${aa}-${l.key}`:""].filter(Boolean).join(" "),[n,t,l.key]),c=$n(null),u=ho.use(ua);if(u===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=u;return go(()=>{c?.current!=null&&a(c)},[c,a]),Ae(wh,{"aria-label":i,buttonStyle:"ghost",className:d,disabled:n===!1,extraButtonProps:{"data-item-key":s},icon:r,iconPosition:"left",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{Sh("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:i,type:"button",children:e})}function yh({children:t,dropdownKey:e,dropDownRef:o,itemsContainerClassNames:n,onClose:r}){let[l,s]=An(),[i,d]=An(),c=Nh(m=>{s(p=>p!=null?[...p,m]:[m])},[s]),u=m=>{if(l==null)return;let{key:p}=m;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&m.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?d(h=>{if(h==null)return l[0];let f=l.indexOf(h)-1;return l[f===-1?l.length-1:f]}):p==="ArrowDown"&&d(h=>h==null?l[0]:l[l.indexOf(h)+1])},a=ca(()=>({registerItem:c}),[c]);return go(()=>{l!=null&&i==null&&d(l[0]),i!=null&&i?.current!=null&&i.current.focus()},[l,i]),Ae(ua,{value:a,children:Ae("div",{className:(n??["toolbar-popup__dropdown-items"]).join(" "),"data-dropdown-key":e,"data-theme":"dark",onKeyDown:u,ref:o,children:t})})}function ma({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,dropdownKey:r,Icon:l,itemsContainerClassNames:s,label:i,stopCloseOnClickSelf:d}){let c=$n(null),u=$n(null),[a,m]=An(!1),p=()=>{m(!1),u?.current!=null&&u.current.focus()};go(()=>{let f=u.current,g=c.current;if(a&&f!==null&&g!==null){let{left:_,top:L}=f.getBoundingClientRect(),R=window.scrollY||document.documentElement.scrollTop;g.style.top=`${L+R+f.offsetHeight+5}px`,g.style.left=`${Math.min(_-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,u,a]),go(()=>{let f=u.current;if(f!==null&&a){let g=_=>{let L=_.target;Eh(L)&&(d&&c.current&&c.current.contains(L)||f.contains(L)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,u,a,d]);let h=Lh(Ae(yh,{dropdownKey:r,dropDownRef:c,itemsContainerClassNames:s,onClose:p,children:o}),document.body);return sa(ho.Fragment,{children:[sa("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":r,disabled:n,onClick:f=>{f.preventDefault(),m(!a)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[l&&Ae(l,{}),i&&Ae("span",{className:"toolbar-popup__dropdown-label",children:i}),Ae("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Ae(ho.Fragment,{children:h})]})}var Dn="toolbar-popup__dropdown",$h=t=>{let e=vh(15),{active:o,anchorElem:n,editor:r,enabled:l,iconOnly:s,item:i}=t,{i18n:d}=Mh(),{fieldProps:c}=G(),{featureClientSchemaMap:u,schemaPath:a}=c;if(i.Component){let p;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==l||e[4]!==i?(p=i?.Component&&ut(i.Component,{active:o,anchorElem:n,editor:r,enabled:l,item:i},i.key),e[0]=o,e[1]=n,e[2]=r,e[3]=l,e[4]=i,e[5]=p):p=e[5],p}let m;if(e[6]!==o||e[7]!==r||e[8]!==l||e[9]!==u||e[10]!==d||e[11]!==s||e[12]!==i||e[13]!==a){let p=i.key,h;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:u,i18n:d,schemaPath:a}):i.label),p.length>25?h=p.substring(0,25)+"...":h=p,m=ut(da,{active:o,editor:r,enabled:l,Icon:i?.ChildComponent?ut(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:s?p:void 0,children:ut("span",{className:"text",children:h})},i.key),e[6]=o,e[7]=r,e[8]=l,e[9]=u,e[10]=d,e[11]=s,e[12]=i,e[13]=a,e[14]=m}else m=e[14];return m},Ah=Rh.memo($h),Ft=({anchorElem:t,classNames:e,editor:o,group:n,groupState:r,Icon:l,itemsContainerClassNames:s,label:i})=>{let{items:d,key:c}=n,u=Ih(()=>d?.length?d.map(a=>ut(Ah,{active:r.activeItemKeys.includes(a.key),anchorElem:t,editor:o,enabled:r.enabledItemKeys.includes(a.key),iconOnly:n.iconOnly,item:a},a.key)):null,[d,r.activeItemKeys,r.enabledItemKeys,t,o]);return ut(ma,{buttonAriaLabel:`${c} dropdown`,buttonClassName:[Dn,`${Dn}-${c}`,...e||[]].filter(Boolean).join(" "),disabled:!r.enabledGroup,dropdownKey:c,Icon:l,itemsContainerClassNames:[`${Dn}-items`,...s||[]],label:i,children:u},c)};import{mergeRegister as Dh}from"@lexical/utils";import{$getSelection as Oh}from"lexical";import{useCallback as Fh,useDeferredValue as Bh,useEffect as Ph,useRef as pa,useState as jh}from"react";function Hh(t){let e=new Map,o=new Map;if(!t?.length)return{groupStates:o,itemStates:e};for(let n of t){let r=[];for(let l of n.items)e.set(l.key,{active:!1,enabled:!0}),r.push(l.key);o.set(n.key,{activeItemKeys:[],activeItems:[],enabledGroup:!0,enabledItemKeys:r})}return{groupStates:o,itemStates:e}}function xo(t,e){let[o,n]=jh(()=>Hh(e)),r=Bh(o),l=G(),s=pa(l);s.current=l;let i=pa(e);i.current=e;let d=xr(),c=Fh(()=>{t.getEditorState().read(()=>{let u=Oh();if(!u)return;let a=i.current;if(!a?.length)return;let m=s.current,p=new Map,h=new Map;for(let f of a){let g=[],_=[],L=[],R=f.type==="dropdown"?f.maxActiveItems??1:void 0;for(let x of f.items){let C=x.isActive?(!R||g.length<R)&&x.isActive({editor:t,editorConfigContext:m,selection:u}):!1,k=x.isEnabled?x.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;C&&(g.push(x.key),_.push(x)),k&&L.push(x.key),p.set(x.key,{active:C,enabled:k})}let b=f.type==="dropdown"&&f.isEnabled?f.isEnabled({editor:t,editorConfigContext:m,selection:u}):!0;h.set(f.key,{activeItemKeys:g,activeItems:_,enabledGroup:b,enabledItemKeys:L})}n({groupStates:h,itemStates:p})})},[t]);return Ph(()=>{d(c);let u=()=>d(c),a=Dh(t.registerUpdateListener(u));return document.addEventListener("mouseup",u),()=>{a(),document.removeEventListener("mouseup",u)}},[t,d,c]),r}function Jh({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&he(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?he(Ot,{active:t,editor:o,enabled:n,item:r,children:he(r.ChildComponent,{})},r.key):null}function Xh({anchorElem:t,editor:e,editorConfig:o,group:n,index:r,toolbarStates:l}){let{i18n:s}=Kh(),{fieldProps:{featureClientSchemaMap:i,schemaPath:d}}=G(),c=l.groupStates.get(n.key),u=On(()=>{if(n.type!=="dropdown")return;let m=c?.activeItems?.[0];return m?m.ChildComponent:n.ChildComponent},[n,c?.activeItems]),a=On(()=>{if(n.type!=="dropdown")return;let m=c?.activeItems;if(!m?.length)return;if(m.length>1)return s.t("lexical:general:toolbarItemsActive",{count:m.length});let p=m[0],h=p.key;return p.label&&(h=typeof p.label=="function"?p.label({featureClientSchemaMap:i,i18n:s,schemaPath:d}):p.label),h.length>25&&(h=h.substring(0,25)+"..."),h},[n,c?.activeItems,s,i,d]);return Gh("div",{className:`fixed-toolbar__group fixed-toolbar__group-${n.key}`,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length&&c?he(Ft,{anchorElem:t,editor:e,group:n,groupState:c,Icon:u,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a}):null,n.type==="buttons"&&n.items.length?n.items.map(m=>{let p=l.itemStates.get(m.key);return he(Jh,{active:p?.active??!1,anchorElem:t,editor:e,enabled:p?.enabled??!0,item:m},m.key)}):null,r<o.features.toolbarFixed?.groups.length-1&&he("div",{className:"divider"})]},n.key)}function Zh({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let l=Co.useRef(null),s=fa(),{y:i}=Wh(),d=xo(o,n?.features?.toolbarFixed?.groups),c=On(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let a=r.editorContainerRef.current.previousElementSibling;for(;a;){if(a.classList.contains("fixed-toolbar"))return a;a=a.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return zh(()=>{if(!c)return;let u=l.current;if(!u)return;let a=u.getBoundingClientRect(),m=c.getBoundingClientRect();if(!(a.bottom<m.top||a.top>m.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),c.classList.remove("fixed-toolbar"),c.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!u.classList.contains("fixed-toolbar--overlapping"))return;u.classList.remove("fixed-toolbar--overlapping"),u.classList.add("fixed-toolbar"),c.classList.remove("fixed-toolbar--hide"),c.classList.add("fixed-toolbar")}},50,[l,c,i]),he("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:s&&he(Co.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((u,a)=>he(Xh,{anchorElem:t,editor:o,editorConfig:n,group:u,index:a,toolbarStates:d},u.key))})})}var ha=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return ha(t.parentEditor)}return!1},ga=t=>{let e=Uh(6),{clientProps:o}=t,[n]=Vh(),r=G();if(!fa())return null;let{editorConfig:s}=r,i=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,d=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||s,c,u;if(e[0]!==o||e[1]!==i||e[2]!==d||e[3]!==r){u=Symbol.for("react.early_return_sentinel");e:{let a=ha(r);if(o?.disableIfParentHasFixedToolbar&&a){u=null;break e}if(!d?.features?.toolbarFixed?.groups?.length){u=null;break e}c=he(Zh,{anchorElem:document.body,clientProps:o,editor:i,editorConfig:d,parentWithFixedToolbar:a})}e[0]=o,e[1]=i,e[2]=d,e[3]=r,e[4]=c,e[5]=u}else c=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:c};var Yh=$({plugins:[{Component:ga,position:"aboveContainer"}]});import{c as qh}from"react/compiler-runtime";import{jsx as ye,jsxs as ba}from"react/jsx-runtime";import{useLexicalComposerContext as Qh}from"@lexical/react/LexicalComposerContext.js";import{useLexicalEditable as e5}from"@lexical/react/useLexicalEditable";import{mergeRegister as ka}from"@lexical/utils";import{$getSelection as _a,$isRangeSelection as xa,$isTextNode as t5,COMMAND_PRIORITY_LOW as o5,getDOMSelection as Ta,SELECTION_CHANGE_COMMAND as n5}from"lexical";import{useCallback as ko,useEffect as Bt,useMemo as r5,useRef as Ca,useState as l5}from"react";import"react";import{createPortal as i5}from"react-dom";function Fn(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 bo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:l=32,horizontalPosition:s="left",specialHandlingForCaret:i=!1,targetRect:d,verticalGap:c=10}=t,u=o.parentElement;if(d===null||u==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let a=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=u.getBoundingClientRect(),h=d.top-a.height-c,f=d.left-l;s==="center"&&(f=d.left+d.width/2-a.width/2);let g=0;return!e&&h<p.top&&!i&&(g=a.height+d.height+c*2,h+=g),s==="center"?f+a.width>p.right?f=p.right-a.width-l:f<p.left&&(f=p.left+l):f+a.width>p.right&&(f=p.right-a.width-l),f-=m.left,r.style.opacity="1",i&&n!==0?(h-=m.bottom-n+a.height-3,r.style.transform=`translate(${f}px, ${h}px) rotate(180deg)`):(h-=m.top,r.style.transform=`translate(${f}px, ${h}px)`),g}function s5({active:t,anchorElem:e,editor:o,enabled:n,item:r}){return r.Component?r?.Component&&ye(r.Component,{anchorElem:e,editor:o,item:r},r.key):r.ChildComponent?ye(Ot,{active:t,editor:o,enabled:n,item:r,children:ye(r.ChildComponent,{})},r.key):null}function a5({anchorElem:t,editor:e,group:o,index:n,toolbarStates:r}){let{editorConfig:l}=G(),s=r.groupStates.get(o.key),i=r5(()=>o.type!=="dropdown"?void 0:s?.activeItems?.[0]?.ChildComponent??o.ChildComponent,[o,s?.activeItems]);return ba("div",{className:`inline-toolbar-popup__group inline-toolbar-popup__group-${o.key}`,"data-toolbar-group-key":o.key,children:[o.type==="dropdown"&&o.items.length&&s?ye(Ft,{anchorElem:t,editor:e,group:o,groupState:s,Icon:i}):null,o.type==="buttons"&&o.items.length?o.items.map(d=>{let c=r.itemStates.get(d.key);return ye(s5,{active:c?.active??!1,anchorElem:t,editor:e,enabled:c?.enabled??!0,item:d},d.key)}):null,n<l.features.toolbarInline?.groups.length-1&&ye("div",{className:"divider"})]},o.key)}function c5({anchorElem:t,editor:e}){let o=Ca(null),n=Ca(null),{editorConfig:r}=G(),l=xo(e,r?.features?.toolbarInline?.groups),s=ko(()=>{if(o?.current){let u=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),a||(o.current.style.pointerEvents="none")}},[o]),i=ko(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let a=o.current.style.opacity==="0",m=o.current.style.pointerEvents==="none";if(!a||!m){let p=u.clientX,h=u.clientY,f=document.elementFromPoint(p,h);o.current.contains(f)||s()}}},[s]),d=ko(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Bt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",d),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",d)}),[o,i,d]);let c=ko(()=>{let u=_a(),a=Ta(e._window);if(o.current===null)return;let m=t.querySelector(":scope > .link-editor"),p=m!==null&&"style"in m&&m?.style?.opacity==="1",h=e.getRootElement();if(u!==null&&a!==null&&!a.isCollapsed&&h!==null&&h.contains(a.anchorNode)){let f=Fn(a,h),g=bo({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&bo({anchorElem:o.current,anchorFlippedOffset:g,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else s()},[e,s,t]);return Bt(()=>{let u=t.parentElement,a=()=>{e.getEditorState().read(()=>{c()})};return window.addEventListener("resize",a),u&&u.addEventListener("scroll",a),()=>{window.removeEventListener("resize",a),u&&u.removeEventListener("scroll",a)}},[e,c,t]),Bt(()=>(e.getEditorState().read(()=>{c()}),ka(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{c()})}),e.registerCommand(n5,()=>(c(),!1),o5))),[e,c]),ba("div",{className:"inline-toolbar-popup",ref:o,children:[ye("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((u,a)=>ye(a5,{anchorElem:t,editor:e,group:u,index:a,toolbarStates:l},u.key))]})}function u5(t,e){let o=qh(12),[n,r]=l5(!1),l=e5(),s;o[0]!==t?(s=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=_a(),h=Ta(t._window),f=t.getRootElement();if(h!==null&&(!xa(p)||f===null||!f.contains(h.anchorNode))){r(!1);return}if(!xa(p))return;if(p.getTextContent()!==""){let _=p.getNodes(),L=!1;for(let R of _)if(t5(R)){r(!0),L=!0;break}L||r(!1)}else r(!1);let g=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&g===""){r(!1);return}})},o[0]=t,o[1]=s):s=o[1];let i=s,d,c;o[2]!==i?(d=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),c=[i],o[2]=i,o[3]=d,o[4]=c):(d=o[3],c=o[4]),Bt(d,c);let u,a;if(o[5]!==t||o[6]!==i?(u=()=>ka(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),a=[t,i],o[5]=t,o[6]=i,o[7]=u,o[8]=a):(u=o[7],a=o[8]),Bt(u,a),!n||!l)return null;let m;return o[9]!==e||o[10]!==t?(m=i5(ye(c5,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=m):m=o[11],m}var wa=t=>{let{anchorElem:e}=t,[o]=Qh();return u5(o,e)};var d5=$({plugins:[{Component:wa,position:"floatingAnchorElem"}]});import{TableCellNode as t2,TableNode as o2,TableRowNode as n2}from"@lexical/table";import{jsx as Sa}from"react/jsx-runtime";import"react";var m5={16:"M7 4h4.5a.5.5 0 0 1 .5.5V6H7zM6 4H4.5a.5.5 0 0 0-.5.5V6h2zm0 3H4v2h2zm0 3H4v1.5a.5.5 0 0 0 .5.5H6zm1 2h4.5a.5.5 0 0 0 .5-.5V10H7zm0-3V7h5v2zM3 4.5A1.5 1.5 0 0 1 4.5 3h7A1.5 1.5 0 0 1 13 4.5v7a1.5 1.5 0 0 1-1.5 1.5h-7A1.5 1.5 0 0 1 3 11.5z",24:"M17.204 6.51A2 2 0 0 1 19 8.5V16l-.011.204a2 2 0 0 1-1.785 1.785L17 18H7l-.204-.01a2 2 0 0 1-1.786-1.786L5 16V8.5a2 2 0 0 1 1.796-1.99L7 6.5h10zM6 16a1 1 0 0 0 1 1h2v-2.5H6zm4-1.5V17h7a1 1 0 0 0 .995-.898L18 16v-1.5zm-4-1h3V11H6zm4-2.5v2.5h8V11zM7 7.5a1 1 0 0 0-.995.897L6 8.5V10h3V7.5zm3 2.5h8V8.5a1 1 0 0 0-1-1h-7z"},Bn=({className:t,size:e=24})=>Sa("svg",{className:["icon",t].filter(Boolean).join(" "),fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Sa("path",{clipRule:"evenodd",d:m5[e],fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as p5,$createTableNode as f5,$createTableRowNode as h5,$isTableCellNode as Ea,$isTableNode as Pn,$isTableRowNode as jn,TableCellHeaderStates as _o,TableCellNode as g5,TableNode as x5,TableRowNode as C5}from"@lexical/table";import{$isParagraphNode as b5,$isTextNode as k5}from"lexical";var La=/^\|(.+)\|\s?$/,_5=/^(\| ?:?-*:? ?)+\|\s?$/,ya=({allTransformers:t})=>({type:"element",dependencies:[x5,C5,g5],export:e=>{if(!Pn(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!jn(n))continue;let l=!1;for(let s of n.getChildren())Ea(s)&&(r.push(zt(t,s).replace(/\n/g,"\\n").trim()),s.__headerState===_o.ROW&&(l=!0));o.push(`| ${r.join(" | ")} |`),l&&o.push(`| ${r.map(s=>"---").join(" | ")} |`)}return o.join(`
|
|
59
59
|
`)},regExp:La,replace:(e,o,n)=>{let r=n[0];if(!r)return;if(_5.test(r)){let a=e.getPreviousSibling();if(!a||!Pn(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!jn(p))return;p.getChildren().forEach(h=>{Ea(h)&&h.setHeaderStyles(_o.ROW,_o.ROW)}),e.remove();return}let l=Na(r,t);if(l==null)return;let s=[l],i=e.getPreviousSibling(),d=l.length;for(;i&&!(!b5(i)||i.getChildrenSize()!==1);){let a=i.getFirstChild();if(!k5(a))break;let m=Na(a.getTextContent(),t);if(m==null)break;d=Math.max(d,m.length),s.unshift(m);let p=i.getPreviousSibling();i.remove(),i=p}let c=f5();for(let a of s){let m=h5();c.append(m);for(let p=0;p<d;p++)m.append(p<a.length?a[p]:va("",t))}let u=e.getPreviousSibling();Pn(u)&&T5(u)===d?(u.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function T5(t){let e=t.getFirstChild();return jn(e)?e.getChildrenSize():0}var va=(t,e)=>{t=t.replace(/\\n/g,`
|
|
60
|
-
`);let o=p5(_o.NO_STATUS);return Wt(t,e,o),o},Na=(t,e)=>{let o=t.match(La);return!o||!o[1]?null:o[1].split("|").map(n=>va(n,e))};import{c as S5}from"react/compiler-runtime";import{jsx as j,jsxs as ve}from"react/jsx-runtime";import{useLexicalComposerContext as Da}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as E5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Ma,$deleteTableColumnAtSelection as N5,$deleteTableRowAtSelection as L5,$getNodeTriplet as y5,$getTableCellNodeFromLexicalNode as $a,$getTableColumnIndexFromTableCellNode as v5,$getTableNodeFromLexicalNodeOrThrow as Oe,$getTableRowIndexFromTableCellNode as R5,$insertTableColumnAtSelection as I5,$insertTableRowAtSelection as M5,$isTableCellNode as Oa,$isTableSelection as Pt,$mergeCells as $5,$unmergeCell as A5,getTableElement as Hn,getTableObserverFromTableElement as Un,TableCellHeaderStates as De,TableCellNode as D5}from"@lexical/table";import{mergeRegister as O5}from"@lexical/utils";import{useScrollInfo as F5}from"@payloadcms/ui";import{$getSelection as wo,$isElementNode as B5,$isRangeSelection as Gn,$isTextNode as P5,$setSelection as j5,COMMAND_PRIORITY_CRITICAL as H5,getDOMSelection as U5,isDOMNode as G5,SELECTION_CHANGE_COMMAND as V5}from"lexical";import*as Vn from"react";import{useCallback as me,useEffect as dt,useRef as To,useState as mt}from"react";import{createPortal as Fa}from"react-dom";import{jsx as Ra}from"react/jsx-runtime";import"react";var w5={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},Ia=({className:t,size:e=24})=>Ra("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Ra("path",{clipRule:"evenodd",d:w5[e],fill:"currentColor",fillRule:"evenodd"})});function Aa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function W5(){let t=wo();if(Gn(t)&&!t.isCollapsed()||Pt(t)&&!t.anchor.is(t.focus)||!Gn(t)&&!Pt(t))return!1;let[e]=y5(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function z5(t){let e=t.getLastDescendant();P5(e)?e.select():B5(e)?e.selectEnd():e!==null&&e.selectNext()}function K5({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=Da(),s=To(null),[i,d]=mt(r),[c,u]=mt({columns:1,rows:1}),[a,m]=mt(!1),[p,h]=mt(!1),{y:f}=F5();dt(()=>l.registerMutationListener(D5,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),dt(()=>{l.getEditorState().read(()=>{let w=wo();if(Pt(w)){let v=Aa(w);u(Aa(w)),m(v.columns>1||v.rows>1)}h(W5())})},[l]),dt(()=>{let w=e.current,v=s.current,y=l.getRootElement();if(w!=null&&v!=null&&y!=null){let M=y.getBoundingClientRect(),A=w.getBoundingClientRect();v.style.opacity="1";let D=v.getBoundingClientRect(),F=5,B=A.right+F;if(B+D.width>window.innerWidth||B+D.width>M.right){let J=A.left-D.width-F;B=(J<0?F:J)+window.pageXOffset}v.style.left=`${B+window.pageXOffset}px`;let Y=A.top;if(Y+D.height>window.innerHeight){let J=A.bottom-D.height;Y=J<0?F:J}v.style.top=`${Y}px`}},[e,s,l,f]),dt(()=>{function w(v){s.current!=null&&e.current!=null&&G5(v.target)&&!s.current.contains(v.target)&&!e.current.contains(v.target)&&n(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[n,e]);let g=me(()=>{l.update(()=>{if(i.isAttached()){let w=Oe(i),v=Hn(w,l.getElementByKey(w.getKey()));if(v===null)throw new Error("Expected to find tableElement in DOM");let y=Un(v);y!==null&&y.$clearHighlight(),w.markDirty(),d(i.getLatest())}j5(null)})},[l,i]),_=()=>{l.update(()=>{let w=wo();if(!Pt(w))return;let y=w.getNodes().filter(Oa),M=$5(y);M&&(z5(M),o())})},L=()=>{l.update(()=>{A5()})},R=me(w=>{l.update(()=>{for(let v=0;v<c.rows;v++)M5(w);o()})},[l,o,c.rows]),b=me(w=>{l.update(()=>{for(let v=0;v<c.columns;v++)I5(w);o()})},[l,o,c.columns]),x=me(()=>{l.update(()=>{L5(),o()})},[l,o]),C=me(()=>{l.update(()=>{Oe(i).remove(),g(),o()})},[l,i,g,o]),k=me(()=>{l.update(()=>{N5(),o()})},[l,o]),T=me(()=>{l.update(()=>{let w=Oe(i),v=R5(i),[y]=Ma(w,null,null),M=new Set,A=i.getHeaderStyles()^De.ROW;if(y[v])for(let D=0;D<y[v].length;D++){let F=y[v][D];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles(A,De.ROW)))}g(),o()})},[l,i,g,o]),I=me(()=>{l.update(()=>{let w=Oe(i),v=v5(i),[y]=Ma(w,null,null),M=new Set,A=i.getHeaderStyles()^De.COLUMN;if(y)for(let D=0;D<y.length;D++){let F=y?.[D]?.[v];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles(A,De.COLUMN)))}g(),o()})},[l,i,g,o]),N=me(()=>{l.update(()=>{if(i.isAttached()){let w=Oe(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),S=me(()=>{l.update(()=>{if(i.isAttached()){let w=Oe(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),E=null;return t&&(a?E=j("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:j("span",{className:"text",children:"Merge cells"})}):p&&(E=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>L(),type:"button",children:j("span",{className:"text",children:"Unmerge cells"})}))),Fa(ve("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[E?ve(Vn.Fragment,{children:[E,j("hr",{})]}):null,j("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>N(),type:"button",children:j("span",{className:"text",children:"Toggle row striping"})}),j("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>S(),type:"button",children:j("span",{className:"text",children:"Toggle first column freeze"})}),j("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>R(!1),type:"button",children:ve("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),j("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>R(!0),type:"button",children:ve("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:ve("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),j("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:ve("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>k(),type:"button",children:j("span",{className:"text",children:"Delete column"})}),j("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>x(),type:"button",children:j("span",{className:"text",children:"Delete row"})}),j("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:j("span",{className:"text",children:"Delete table"})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:ve("span",{className:"text",children:[(i.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),j("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:ve("span",{className:"text",children:[(i.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function J5({anchorElem:t,cellMerge:e}){let[o]=Da(),n=To(null),r=To(null),[l,s]=mt(!1),[i,d]=mt(null),c=me(()=>{let a=n.current,m=wo(),p=U5(o._window),h=document.activeElement;function f(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return f();let g=o.getRootElement(),_=null,L=null;if(Gn(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let b=$a(m.anchor.getNode());if(b==null||(L=o.getElementByKey(b.getKey()),L==null||!b.isAttached()))return f();let x=Oe(b),C=Hn(x,o.getElementByKey(x.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Un(C),d(b)}else if(Pt(m)){let b=$a(m.anchor.getNode());if(!Oa(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let x=Oe(b),C=Hn(x,o.getElementByKey(x.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Un(C),L=o.getElementByKey(b.getKey())}else if(!h)return f();if(_===null||L===null)return f();let R=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",R),a.classList.toggle("table-cell-action-button-container--inactive",!R),R){let b=L.getBoundingClientRect(),x=t.getBoundingClientRect(),C=b.top-x.top,k=b.right-x.left;a.style.transform=`translate(${k}px, ${C}px)`}},[o,t]);dt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return O5(o.registerUpdateListener(p),o.registerCommand(V5,p,H5),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=To(i);return dt(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),j("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&ve(Vn.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:j(Ia,{})}),l&&j(K5,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var Ba=t=>{let e=S5(3),{anchorElem:o}=t,n=E5(),r;return e[0]!==o||e[1]!==n?(r=Fa(n?j(J5,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as X5}from"react/compiler-runtime";import{jsx as Eo,jsxs as Z5}from"react/jsx-runtime";import{useLexicalComposerContext as Y5}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as q5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Q5,$getTableNodeFromLexicalNodeOrThrow as Wn,$getTableRowIndexFromTableCellNode as eg,$isTableCellNode as Pa,$isTableRowNode as tg,getDOMCellFromTarget as og,getTableElement as ng,TableNode as ja}from"@lexical/table";import{calculateZoomLevel as Ha,mergeRegister as rg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as zn,isHTMLElement as lg,SKIP_SCROLL_INTO_VIEW_TAG as Ua}from"lexical";import*as Va from"react";import{useCallback as jt,useEffect as Kn,useRef as So,useState as pt}from"react";import{createPortal as ig}from"react-dom";var sg=33,Ga=92;function ag({editor:t}){let e=So(null),o=So(null),n=So(null),[r,l]=pt(!1),s=G(),i=So(null),[d,c]=pt(null),[u,a]=pt(null),[m,p]=pt(!1),[h,f]=pt(null),g=jt(()=>{a(null),e.current=null,f(null),i.current=null,n.current=null},[]),_=S=>(S.buttons&1)===1;Kn(()=>{let S=new Set;return rg(t.registerMutationListener(ja,E=>{for(let[w,v]of E)v==="destroyed"?S.delete(w):S.add(w);l(S.size>0)}),t.registerNodeTransform(ja,E=>{if(E.getColWidths())return E;let w=E.getColumnCount(),v=Ga;return E.setColWidths(Array(w).fill(v)),E}))},[t]),Kn(()=>{if(!r)return;let S=y=>{let M=y.target;if(lg(M)){if(h){c({x:y.clientX,y:y.clientY});return}if(p(_(y)),!(o.current&&o.current.contains(M))&&e.current!==M){e.current=M;let A=og(M);A&&u!==A?t.getEditorState().read(()=>{let D=zn(A.elem);if(!D)throw new Error("TableCellResizer: Table cell node not found.");let F=Wn(D),B=ng(F,t.getElementByKey(F.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=M,n.current=B.getBoundingClientRect(),a(A)},{editor:t}):A==null&&g()}}},E=y=>{p(!0)},w=y=>{p(!1)},v=t.registerRootListener((y,M)=>{M?.removeEventListener("mousemove",S),M?.removeEventListener("mousedown",E),M?.removeEventListener("mouseup",w),y?.addEventListener("mousemove",S),y?.addEventListener("mousedown",E),y?.addEventListener("mouseup",w)});return()=>{v()}},[u,h,t,r,g]);let L=S=>S==="bottom",R=jt(S=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let E=zn(u.elem);if(!Pa(E))throw new Error("TableCellResizer: Table cell node not found.");let w=Wn(E),v=eg(E),y=w.getChildren(),A=E.getColSpan()===w.getColumnCount()?v:v+E.getRowSpan()-1;if(A>=y.length||A<0)throw new Error("Expected table cell to be inside of table row.");let D=y[A];if(!tg(D))throw new Error("Expected table row");let F=D.getHeight();if(F===void 0){let Y=D.getChildren();F=Math.min(...Y.map(J=>b(J,t)??1/0))}let B=Math.max(F+S,sg);D.setHeight(B)},{tag:Ua})},[u,t]),b=(S,E)=>E.getElementByKey(S.getKey())?.clientHeight,x=(S,E)=>{let w;return E.forEach(v=>{v.forEach((y,M)=>{y.cell===S&&(w=M)})}),w},C=jt(S=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let E=zn(u.elem);if(!Pa(E))throw new Error("TableCellResizer: Table cell node not found.");let w=Wn(E),[v]=Q5(w,null,null),y=x(E,v);if(y===void 0)throw new Error("TableCellResizer: Table column not found.");let M=w.getColWidths();if(!M)return;let A=M[y];if(A===void 0)return;let D=[...M],F=Math.max(A+S,Ga);D[y]=F,w.setColWidths(D)},{tag:Ua})},[u,t]),k=jt(S=>{let E=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:v,y}=i.current;if(u===null)return;let M=Ha(w.target);if(L(S)){let A=(w.clientY-y)/M;R(A)}else{let A=(w.clientX-v)/M;C(A)}g(),document.removeEventListener("mouseup",E)}};return E},[u,g,C,R]),T=jt(S=>E=>{if(E.preventDefault(),E.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:E.clientX,y:E.clientY},c(i.current),f(S),document.addEventListener("mouseup",k(S))},[u,k]),[I,N]=pt({bottom:null,left:null,right:null,top:null});return Kn(()=>{if(u){let{height:S,left:E,top:w,width:v}=u.elem.getBoundingClientRect(),y=Ha(u.elem),M=10,A={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${M}px`,left:`${window.scrollX+E}px`,top:`${window.scrollY+w+S-M/2}px`,width:`${v}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${S}px`,left:`${window.scrollX+E+v-M/2}px`,top:`${window.scrollY+w}px`,width:`${M}px`}},D=n.current;h&&d&&D&&(L(h)?(A[h].left=`${window.scrollX+D.left}px`,A[h].top=`${window.scrollY+d.y/y}px`,A[h].height="3px",A[h].width=`${D.width}px`):(A[h].top=`${window.scrollY+D.top}px`,A[h].left=`${window.scrollX+d.x/y}px`,A[h].width="3px",A[h].height=`${D.height}px`),A[h].backgroundColor="#adf"),N(A)}else N({bottom:null,left:null,right:null,top:null})},[u,h,d]),Eo("div",{ref:o,children:u!=null&&!m&&Z5(Va.Fragment,{children:[Eo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),Eo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var Wa=()=>{let t=X5(3),[e]=Y5(),o=q5(),n;return t[0]!==e||t[1]!==o?(n=o?ig(Eo(ag,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],n};import{c as gg}from"react/compiler-runtime";import{jsx as Jn,jsxs as xg,Fragment as Cg}from"react/jsx-runtime";import{useLexicalComposerContext as bg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Qa}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as kg,$getTableColumnIndexFromTableCellNode as _g,$getTableRowIndexFromTableCellNode as Tg,$insertTableColumnAtSelection as wg,$insertTableRowAtSelection as Sg,$isTableCellNode as Eg,$isTableNode as Ja,getTableElement as Ng,TableNode as Lg}from"@lexical/table";import{$findMatchingParent as yg,mergeRegister as vg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Xa,isHTMLElement as Rg}from"lexical";import{useEffect as Za,useMemo as Ig,useRef as Ya,useState as No}from"react";import"react";import{createPortal as Mg}from"react-dom";import{c as pg}from"react/compiler-runtime";import{useEffect as fg,useRef as hg}from"react";var cg="Expected a function",ug=Math.max,dg=Math.min;function mg(t,e,o){let n,r,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(cg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?ug(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(C){let k=n,T=s;return n=s=void 0,l=C,u=t.apply(T,k),u}function h(C){return l=C,a=setTimeout(_,e),i?p(C):u}function f(C){let k=C-r,T=C-l,I=e-k;return d?dg(I,c-T):I}function g(C){let k=C-r,T=C-l;return r===void 0||k>=e||k<0||d&&T>=c}function _(){let C=Date.now();if(g(C))return L(C);a=setTimeout(_,f(C))}function L(C){return a=void 0,m&&n?p(C):(n=s=void 0,u)}function R(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function b(){return a===void 0?u:L(Date.now())}function x(){let C=Date.now(),k=g(C);if(n=arguments,s=this,r=C,k){if(a===void 0)return h(r);if(d)return clearTimeout(a),a=setTimeout(_,e),p(r)}return a===void 0&&(a=setTimeout(_,e)),u}return x.cancel=R,x.flush=b,x}var za=mg;function Ka(t,e,o){let n=pg(6),r=hg(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=za(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),fg(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;r.current&&r.current(...u)},n[5]=i):i=n[5],i}var qa=16;function $g({anchorElem:t}){let[e]=bg(),o=Qa(),n=G(),[r,l]=No(!1),[s,i]=No(!1),[d,c]=No(!1),[u,a]=No({}),m=Ya(new Set),p=Ya(null),h=Ka(_=>{let{isOutside:L,tableDOMNode:R}=Ag(_,n.editorConfig?.lexical);if(L){l(!1),i(!1);return}if(!R)return;p.current=R;let b=null,x=null,C=null;if(e.getEditorState().read(()=>{let A=Xa(R);if(Eg(A)){let D=yg(A,F=>Ja(F));if(!Ja(D))return;if(C=Ng(D,e.getElementByKey(D.getKey())),C){let F=D.getChildrenSize(),B=D.getChildAtIndex(0)?.getChildrenSize(),Y=Tg(A),J=_g(A);Y===F-1?b=A:J===B-1&&(x=A)}}},{editor:e}),!C)return;let k=C.parentElement;if(!k)return;let{bottom:T,height:I,left:N,right:S,width:E,y:w}=C.getBoundingClientRect(),v=!1;k&&k.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(v=k.scrollWidth>k.clientWidth);let{left:y,y:M}=t.getBoundingClientRect();b?(i(!1),l(!0),a({height:qa,left:v&&k?k.offsetLeft:N-y,top:T-M+5,width:v&&k?k.offsetWidth:E})):x&&(i(!0),l(!1),a({height:I,left:S-y+5,top:w-M,width:qa}))},50,250),f=Ig(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Za(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),Za(()=>vg(e.registerMutationListener(Lg,_=>{e.getEditorState().read(()=>{let L=!1;for(let[R,b]of _)switch(b){case"created":{m.current.add(R),L=!0;break}case"destroyed":{m.current.delete(R),L=!0;break}default:break}if(L){f.disconnect();for(let R of m.current){let{tableElement:b}=kg(R);f.observe(b)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=_=>{e.update(()=>{p.current&&(Xa(p.current)?.selectEnd(),_?(Sg(),l(!1)):(wg(),i(!1)))})};return o?xg(Cg,{children:[r&&Jn("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...u},type:"button"}),s&&Jn("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...u},type:"button"})]}):null}function Ag(t,e){let o=t.target;if(Rg(o)){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 ec(t){let e=gg(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!Qa())return null;let l;return e[0]!==n?(l=Mg(Jn($g,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as Yn,jsxs as Bg}from"react/jsx-runtime";import{useLexicalComposerContext as Pg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as jg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Hg,TableCellNode as Ug,TableNode as Gg,TableRowNode as Vg}from"@lexical/table";import{mergeRegister as Wg}from"@lexical/utils";import{$getSelection as zg,$isRangeSelection as Kg,$setSelection as Jg,COMMAND_PRIORITY_EDITOR as Xg,createCommand as Zg}from"lexical";import{createContext as Yg,use as qg,useCallback as ic,useEffect as sc,useMemo as Qg,useRef as e2,useState as Lo}from"react";import*as ac from"react";import{jsx as Q,jsxs as Re}from"react/jsx-runtime";import{useCallback as Xn,useEffect as tc,useRef as Zn,useState as Ht}from"react";import*as rc from"react";import{createPortal as Dg}from"react-dom";var oc=10,nc=7;function Og(){return Re("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[Q("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"1.5",y:"1.5"}),Q("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"7.5",y:"1.5"})]})}function Fg(){return Re("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[Q("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"1.5"}),Q("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"7.5"})]})}function lc({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=Ht(0),[d,c]=Ht(0),[u,a]=Ht(""),[m,p]=Ht(""),[h,f]=Ht(null),g=Zn(null),_=Zn(null),L=Zn(null),R=s>0?s:u?parseInt(u,10)||0:5,b=d>0?d:m?parseInt(m,10)||0:5;tc(()=>{o||(i(0),c(0),a(""),p(""),f(null))},[o]),tc(()=>{if(!o)return;let N=S=>{if(S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),n()),S.key==="Enter"&&h){S.preventDefault();let E=parseInt(u,10),w=parseInt(m,10);E>0&&w>0&&r(E,w)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,h,u,m]);let x=Xn((N,S)=>{N>0&&S>0&&r(N,S)},[r]),C=Xn((N,S)=>{i(N),c(S)},[]),k=Xn(()=>{i(0),c(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=nc;N++)for(let S=1;S<=oc;S++){let E=S<=R&&N<=b,w=S<=s&&N<=d,v="table-grid-popup__cell";E&&w?v+=" table-grid-popup__cell--hover":E&&(v+=" table-grid-popup__cell--selected"),T.push(Q("div",{"aria-label":`${S} columns, ${N} rows`,className:v,onClick:()=>x(S,N),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),x(S,N))},onMouseEnter:()=>C(S,N),role:"button",tabIndex:-1},`${N}-${S}`))}let I=s>0&&d>0;return Dg(Re(rc.Fragment,{children:[Q("div",{className:"table-grid-popup__backdrop",onClick:n}),Q("div",{className:"table-grid-popup",ref:g,style:{transform:`translate(${l.left}px, ${l.top}px)`},children:Re("div",{className:"table-grid-popup__content",children:[Re("div",{className:"table-grid-popup__header",children:[Re("div",{className:`table-grid-popup__input-group${h==="cols"?" table-grid-popup__input-group--focused":""}`,children:[Q("div",{className:"table-grid-popup__input-icon",children:Q(Og,{})}),Q("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>f(null),onChange:N=>a(N.target.value),onFocus:()=>f("cols"),placeholder:s>0?String(s):"5",ref:_,type:"number",value:u})]}),Q("span",{className:"table-grid-popup__separator",children:"\xD7"}),Re("div",{className:`table-grid-popup__input-group${h==="rows"?" table-grid-popup__input-group--focused":""}`,children:[Q("div",{className:"table-grid-popup__input-icon",children:Q(Fg,{})}),Q("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>f(null),onChange:N=>p(N.target.value),onFocus:()=>f("rows"),placeholder:d>0?String(d):"5",ref:L,type:"number",value:m})]})]}),Re("div",{className:"table-grid-popup__grid",onMouseLeave:k,children:[T,I&&Re("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/oc*100}%)`,top:`calc(${(d-1)/nc*100}%)`},children:[R," \xD7 ",b]})]})]})})]}),t)}var yo=Zg("OPEN_EMBED_DRAWER_COMMAND"),cc=Yg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function uc({children:t}){let[e,o]=Lo({cellEditorConfig:null,cellEditorPlugins:null});return Yn(cc,{value:Qg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var dc=()=>{let[t]=Pg(),e=qg(cc),[o,n]=Lo(!1),[r,l]=Lo(null),s=e2(null),[i,d]=Lo(null);sc(()=>{let a=t.getRootElement();if(a){let m=a.closest(".editor")??null;d(m??a.parentElement)}},[t]),sc(()=>{if(!t.hasNodes([Gg,Vg,Ug]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Wg(t.registerCommand(yo,()=>{let a=i;if(!a)return!0;let m=a.getBoundingClientRect(),p=null;t.getEditorState().read(()=>{let f=zg();if(Kg(f)){s.current=f.clone();let g=f.anchor.getNode(),_=t.getElementByKey(g.getKey());if(_){let L=_.getBoundingClientRect();L.height>0&&(p={left:L.left-m.left,top:L.bottom-m.top+8})}}});let h=window.getSelection();if(h&&h.rangeCount>0){let g=h.getRangeAt(0).getBoundingClientRect();g.height>0&&(p={left:g.left-m.left,top:g.bottom-m.top+8})}return p||(p={left:0,top:40}),l(p),n(!0),!0},Xg))},[e,t,i]);let c=ic(()=>{n(!1)},[]),u=ic((a,m)=>{n(!1),t.focus(),t.update(()=>{s.current&&Jg(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(Hg,{columns:String(a),rows:String(m)})},1)},[t]);return Bg(ac.Fragment,{children:[Yn(lc,{anchorElem:i,editor:t,isOpen:o,onClose:c,onInsert:u,position:r}),Yn(jg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var r2=$({markdownTransformers:[ya],nodes:[o2,t2,n2],plugins:[{Component:dc,position:"normal"},{Component:Wa,position:"normal"},{Component:Ba,position:"floatingAnchorElem"},{Component:ec,position:"floatingAnchorElem"}],providers:[uc],slashMenu:{groups:[X([{Icon:Bn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]},toolbarFixed:{groups:[Te([{ChildComponent:Bn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]}});import{$isNodeSelection as j2}from"lexical";import{jsx as mc}from"react/jsx-runtime";import"react";var l2="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",qn=({className:t})=>mc("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:mc("path",{clipRule:"evenodd",d:l2,fill:"currentColor",fillRule:"evenodd"})});import{jsx as xc}from"react/jsx-runtime";import Cc from"bson-objectid";import{$applyNodeReplacement as d2}from"lexical";import*as bc from"react";import i2 from"bson-objectid";function vo(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let n=t.getAttribute("data-lexical-pending-upload-form-id");if(n!=null)return{node:e({data:{pending:{formID:n,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let n=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(n!=null&&r!=null)return{node:e({data:{fields:{},relationTo:r,value:n}})}}return{node:e({data:{pending:{formID:new i2.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as s2}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as a2}from"@lexical/utils";import fc from"bson-objectid";import{$applyNodeReplacement as c2}from"lexical";var Ut=class extends s2{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>vo(o,pc),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new fc.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=pc({data:o});return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return a2(o,e?.theme?.upload),o}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function pc({data:t}){return t?.id||(t.id=new fc.default().toHexString()),c2(new Ut({data:t}))}import{jsx as hc}from"react/jsx-runtime";import{ShimmerEffect as u2}from"@payloadcms/ui";var gc=()=>hc("div",{className:"lexical-upload",children:hc(u2,{height:"95px",width:"203px"})});var m2=bc.lazy(()=>import("./component-53Y3RYR5.js").then(t=>({default:t.UploadComponent}))),ge=class extends Ut{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>vo(o,xe),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Cc.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=xe({data:o});return n.setFormat(e.format),n}decorate(e,o){return this.__data.pending?xc(gc,{}):xc(m2,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function xe({data:t}){return t?.id||(t.id=new Cc.default().toHexString()),d2(new ge({data:t}))}function ft(t){return t instanceof ge}import{c as k2}from"react/compiler-runtime";import{jsx as _2}from"react/jsx-runtime";import{useLexicalComposerContext as T2}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Rc,$insertNodeToNearestRoot as tr,mergeRegister as w2}from"@lexical/utils";import{useBulkUpload as S2,useEffectEvent as E2,useModal as N2}from"@payloadcms/ui";import or from"bson-objectid";import{$createRangeSelection as L2,$getPreviousSelection as Ec,$getSelection as Nc,$isParagraphNode as nr,$isRangeSelection as Lc,$setSelection as y2,COMMAND_PRIORITY_EDITOR as v2,COMMAND_PRIORITY_LOW as yc,createCommand as R2,DROP_COMMAND as I2,getDOMSelectionFromTarget as M2,isHTMLElement as vc,PASTE_COMMAND as $2}from"lexical";import{useEffect as A2}from"react";import{c as kc}from"react/compiler-runtime";import{jsx as Qn}from"react/jsx-runtime";import{useLexicalComposerContext as _c}from"@lexical/react/LexicalComposerContext.js";import{toast as p2}from"@payloadcms/ui";import{$getNodeByKey as f2,COMMAND_PRIORITY_EDITOR as Tc}from"lexical";import{useEffect as wc,useState as h2}from"react";var g2=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=f2(o);r&&r.replace(xe({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(er,{fields:null,relationTo:e,value:n})},x2=t=>{let e=kc(13),{enabledCollectionSlugs:o}=t,[n]=_c(),[r,l]=h2(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:c}=Dt(s),u,a;e[2]!==n||e[3]!==c?(u=()=>n.registerCommand(et,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Tc),a=[n,c],e[2]=n,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),wc(u,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=f=>{let{collectionSlug:g,doc:_}=f;i(),g2({editor:n,relationTo:g,replaceNodeKey:r,value:_.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,h;return e[10]!==d||e[11]!==p?(h=Qn(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=h):h=e[12],h},C2=()=>{let t=kc(3),[e]=_c(),o,n;return t[0]!==e?(o=()=>e.registerCommand(et,b2,Tc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),wc(o,n),null},Sc=({enabledCollectionSlugs:t})=>t?.length?Qn(x2,{enabledCollectionSlugs:t}):Qn(C2,{});function b2(){return p2.error("No upload collections enabled"),!0}function D2(t){let e=t.target;return!!(vc(e)&&!e.closest("code, span.editor-image")&&vc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function O2(t){let e,o=M2(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var er=R2("INSERT_UPLOAD_COMMAND"),Ic=t=>{let e=k2(21),{clientProps:o}=t,[n]=T2(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l,uploads:!0},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=fo(s),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=S2(),{isModalOpen:h,openModal:f}=N2(),g;e[3]!==d||e[4]!==n||e[5]!==i||e[6]!==h||e[7]!==f||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(g=x=>{let{files:C}=x;if(C?.length!==0&&(u(k=>[...k??[],...C.map(F2)]),!h(d))){if(!i.length||!i[0])return;c(i[0]),p(i),a(()=>{n.update(B2)}),m(k=>{let T=new Map(k.map(P2));n.update(()=>{for(let I of Rc()){let N=I.node;if(ft(N)){let S=N.getData();if(S?.pending){let E=T.get(S.pending?.formID);E&&N.replace(xe({data:{id:new or.default().toHexString(),fields:{},relationTo:E.collectionSlug,value:E.doc.id}}))}}}})}),f(d)}},e[3]=d,e[4]=n,e[5]=i,e[6]=h,e[7]=f,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=p,e[13]=g):g=e[13];let _=E2(g),L;e[14]!==n||e[15]!==_?(L=()=>{if(!n.hasNodes([ge]))throw new Error("UploadPlugin: UploadNode not registered on editor");return w2(n.registerNodeTransform(ge,x=>{let C=x.getData();if(!C?.pending)return;(async function(){let I=null,N=C?.pending?.src,S=C?.pending?.formID;if(N?.startsWith("data:")){let E=N.match(/data:(image\/[a-zA-Z]+);base64,/),w=E?E[1]:"image/png",v=N.replace(/^data:image\/[a-zA-Z]+;base64,/,""),y=atob(v),M=new Array(y.length);for(let F=0;F<y.length;F++)M[F]=y.charCodeAt(F);let A=new Uint8Array(M);I={alt:void 0,file:new File([A],"pasted-image."+w?.split("/",2)[1],{type:w}),formID:S}}else if(N?.startsWith("http")||N?.startsWith("https")){let w=await(await fetch(N)).blob(),v=N.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];I={alt:void 0,file:new File([w],v,{type:w.type}),formID:S}}I&&_({files:[I]})})()}),n.registerCommand(er,x=>(n.update(()=>{let C=Nc()||Ec();if(Lc(C)){let k=xe({data:{id:x.id,fields:x.fields,relationTo:x.relationTo,value:x.value}}),{focus:T}=C,I=T.getNode();tr(k),nr(I)&&!I.__first&&I.remove()}}),!0),v2),n.registerCommand($2,x=>{if(!(x instanceof ClipboardEvent))return!1;let C=x.clipboardData;if(!C?.types?.length||C?.types?.includes("text/html"))return!1;let k=[];return C?.files?.length&&Array.from(C.files).forEach(T=>{k.push({alt:"",file:T,formID:new or.default().toHexString()})}),k.length?(n.update(()=>{let T=Nc()||Ec();if(Lc(T))for(let I of k){let N=xe({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:S}=T,E=S.getNode();tr(N),nr(E)&&!E.__first&&E.remove()}}),_({files:k}),!0):!1},yc),n.registerCommand(I2,x=>{if(!(x instanceof DragEvent))return!1;let C=x.dataTransfer;if(!C?.types?.length)return!1;let k=[];return C?.files?.length&&Array.from(C.files).forEach(T=>{k.push({alt:"",file:T,formID:new or.default().toHexString()})}),k.length?(x.preventDefault(),x.stopPropagation(),n.update(()=>{if(D2(x)){let T=O2(x),I=L2();T!=null&&I.applyDOMRange(T),y2(I);for(let N of k){let S=xe({data:{pending:{formID:N.formID,src:URL.createObjectURL(N.file)}}}),{focus:E}=I,w=E.getNode();tr(S),nr(w)&&!w.__first&&w.remove()}}}),_({files:k}),!0):!1},yc))},e[14]=n,e[15]=_,e[16]=L):L=e[16];let R;e[17]!==n?(R=[n],e[17]=n,e[18]=R):R=e[18],A2(L,R);let b;return e[19]!==i?(b=_2(Sc,{enabledCollectionSlugs:i}),e[19]=i,e[20]=b):b=e[20],b};function F2(t){return{file:t.file,formID:t.formID}}function B2(){for(let t of Rc()){let e=t.node;ft(e)&&e.getData()?.pending&&e.remove()}}function P2(t){return[t.formID,t]}var H2=$({nodes:[ge],plugins:[{Component:Ic,position:"normal"}],slashMenu:{groups:[X([{Icon:qn,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]},toolbarFixed:{groups:[Te([{ChildComponent:qn,isActive:({selection:t})=>{if(!j2(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ft(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]}});import{c as G2}from"react/compiler-runtime";import{jsx as Ro}from"react/jsx-runtime";import{createElement as V2}from"react";import{ShimmerEffect as W2,useConfig as z2}from"@payloadcms/ui";import{lazy as K2,Suspense as J2,useEffect as X2,useState as Z2}from"react";var Mc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",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",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",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:"LexicalEditorTheme__upload"};var rr={namespace:"lexical",theme:Mc};function $c({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map;for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.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.");s.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:i,schemaPath:r,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as U2}from"payload/shared";var Ac=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(n=>{n.key==="toolbarFixed"&&n.sanitizedClientFeatureProps?.customGroups&&(o={...o,...n.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(n=>{if(n.providers?.length&&(e.providers=e.providers.concat(n.providers)),n.enableFormats?.length&&e.enabledFormats.push(...n.enableFormats),n.nodes?.length)for(let r of n.nodes)e.nodes.push(r);if(n.plugins?.length&&n.plugins.forEach((r,l)=>{e.plugins?.push({clientProps:n.sanitizedClientFeatureProps,Component:r.Component,key:n.key+l,position:r.position})}),n.toolbarInline?.groups?.length)for(let r of n.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===r.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarInline?.groups.push(l)}if(n.toolbarFixed?.groups?.length)for(let r of n.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===r.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarFixed?.groups.push(l)}if(n.slashMenu?.groups){n.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(n.slashMenu.dynamicGroups));for(let r of n.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===r.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.slashMenu.groups.push(l)}}if(n.markdownTransformers?.length)for(let r of n.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(n.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(n=>{let r=o[n.key];return r?U2(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function lr(t,e,o,n){return{admin:o,features:Ac(t),lexical:e,resolvedFeatureMap:t,view:n}}var Y2=K2(()=>import("./Field-PJW7KUJG.js").then(t=>({default:t.RichText}))),q2=t=>Ro(Po,{inheritable:!0,views:t.views,children:Ro(Q2,{...t})}),Q2=t=>{let e=G2(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d,views:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let a=u,m;e[2]!==r?(m=r===void 0?{}:r,e[2]=r,e[3]=m):m=e[3];let p=m,h=i===void 0?rr:i,{currentView:f}=jo(),g=c?.[f]?.admin??a,_=c?.[f]?.lexical,L;e[4]!==h||e[5]!==_?(L=typeof _=="function"?_(h):_??h,e[4]=h,e[5]=_,e[6]=L):L=e[6];let R=L,{config:b}=z2(),[x,C]=Z2(null),k,T;e[7]!==n||e[8]!==b||e[9]!==f||e[10]!==g||e[11]!==R||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==x||e[16]!==d||e[17]!==c?(k=()=>{if(x&&x.view===f)return;let N=c?.[f],S=N?.filterFeatures?N.filterFeatures(n):n,E=[];for(let v of Object.values(S))v.clientFeatureProvider&&E.push(v.clientFeatureProvider(v.clientFeatureProps));let w=$c({config:b,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:E,lexical:R}});C(lr(w,R,g,f))},T=[g,n,b,p,l,s,x,R,d,f,c],e[7]=n,e[8]=b,e[9]=f,e[10]=g,e[11]=R,e[12]=p,e[13]=l,e[14]=s,e[15]=x,e[16]=d,e[17]=c,e[18]=k,e[19]=T):(k=e[18],T=e[19]),X2(k,T);let I;return e[20]!==x||e[21]!==t?(I=Ro(J2,{fallback:Ro(W2,{height:"35vh"}),children:x&&V2(Y2,{...t,editorConfig:x,key:x.view})}),e[20]=x,e[21]=t,e[22]=I):I=e[22],I};function ex(t){return t instanceof HTMLElement}function tx(...t){return t.filter(Boolean).join(" ")}var Io=new WeakMap;function Dc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mo(t,e){let o=Io.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Dc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=Dc(s);for(let c of n)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},Io.set(t,o)}return o.listeners.add(e),()=>{ox(t,e)}}function ox(t,e){let o=Io.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Io.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function nx(t,e){return Mo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function rx(t,e){return Mo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function lx(t,e){return Mo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function ix(t,e){return Mo(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as sx}from"react/compiler-runtime";import{jsx as ax}from"react/jsx-runtime";import"react";var cx=()=>{let t=sx(2),{EditButton:e}=ke(),o;return t[0]!==e?(o=e?ax(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as ux}from"react/compiler-runtime";import{jsx as dx}from"react/jsx-runtime";import"react";var mx=()=>{let t=ux(2),{RemoveButton:e}=ke(),o;return t[0]!==e?(o=e?dx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as px}from"react/compiler-runtime";import{jsx as fx}from"react/jsx-runtime";import"react";var hx=()=>{let t=px(2),{Label:e}=ke(),o;return t[0]!==e?(o=e?fx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gx}from"react/compiler-runtime";import{jsx as xx}from"react/jsx-runtime";import"react";var Cx=t=>{let e=gx(3),{children:o}=t,{InlineBlockContainer:n}=ke(),r;return e[0]!==n||e[1]!==o?(r=n?xx(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as bx}from"react/jsx-runtime";import"react";var kx=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?bx(n,{...o,children:e}):null};import{c as _x}from"react/compiler-runtime";import{jsx as Tx}from"react/jsx-runtime";import"react";var wx=()=>{let t=_x(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?Tx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Sx}from"react/compiler-runtime";import{jsx as Ex}from"react/jsx-runtime";import"react";var Nx=()=>{let t=Sx(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?Ex(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Lx}from"qs-esm";var yx=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let d=Lx({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var Oc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
|
|
60
|
+
`);let o=p5(_o.NO_STATUS);return Wt(t,e,o),o},Na=(t,e)=>{let o=t.match(La);return!o||!o[1]?null:o[1].split("|").map(n=>va(n,e))};import{c as S5}from"react/compiler-runtime";import{jsx as j,jsxs as ve}from"react/jsx-runtime";import{useLexicalComposerContext as Da}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as E5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Ma,$deleteTableColumnAtSelection as N5,$deleteTableRowAtSelection as L5,$getNodeTriplet as y5,$getTableCellNodeFromLexicalNode as $a,$getTableColumnIndexFromTableCellNode as v5,$getTableNodeFromLexicalNodeOrThrow as Oe,$getTableRowIndexFromTableCellNode as R5,$insertTableColumnAtSelection as I5,$insertTableRowAtSelection as M5,$isTableCellNode as Oa,$isTableSelection as Pt,$mergeCells as $5,$unmergeCell as A5,getTableElement as Hn,getTableObserverFromTableElement as Un,TableCellHeaderStates as De,TableCellNode as D5}from"@lexical/table";import{mergeRegister as O5}from"@lexical/utils";import{useScrollInfo as F5}from"@payloadcms/ui";import{$getSelection as wo,$isElementNode as B5,$isRangeSelection as Gn,$isTextNode as P5,$setSelection as j5,COMMAND_PRIORITY_CRITICAL as H5,getDOMSelection as U5,isDOMNode as G5,SELECTION_CHANGE_COMMAND as V5}from"lexical";import*as Vn from"react";import{useCallback as me,useEffect as dt,useRef as To,useState as mt}from"react";import{createPortal as Fa}from"react-dom";import{jsx as Ra}from"react/jsx-runtime";import"react";var w5={16:"M5 8a1 1 0 1 1-2 0 1 1 0 0 1 2 0m4 0a1 1 0 1 1-2 0 1 1 0 0 1 2 0m3 1a1 1 0 1 0 0-2 1 1 0 0 0 0 2",24:"M7.5 12a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m6 0a1.5 1.5 0 1 1-3 0 1.5 1.5 0 0 1 3 0m4.5 1.5a1.5 1.5 0 1 0 0-3 1.5 1.5 0 0 0 0 3"},Ia=({className:t,size:e=24})=>Ra("svg",{className:t,fill:"none",height:e,viewBox:`0 0 ${e} ${e}`,width:e,xmlns:"http://www.w3.org/2000/svg",children:Ra("path",{clipRule:"evenodd",d:w5[e],fill:"currentColor",fillRule:"evenodd"})});function Aa(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function W5(){let t=wo();if(Gn(t)&&!t.isCollapsed()||Pt(t)&&!t.anchor.is(t.focus)||!Gn(t)&&!Pt(t))return!1;let[e]=y5(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function z5(t){let e=t.getLastDescendant();P5(e)?e.select():B5(e)?e.selectEnd():e!==null&&e.selectNext()}function K5({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[l]=Da(),s=To(null),[i,d]=mt(r),[c,u]=mt({columns:1,rows:1}),[a,m]=mt(!1),[p,h]=mt(!1),{y:f}=F5();dt(()=>l.registerMutationListener(D5,w=>{w.get(i.getKey())==="updated"&&l.getEditorState().read(()=>{d(i.getLatest())})},{skipInitialization:!0}),[l,i]),dt(()=>{l.getEditorState().read(()=>{let w=wo();if(Pt(w)){let v=Aa(w);u(Aa(w)),m(v.columns>1||v.rows>1)}h(W5())})},[l]),dt(()=>{let w=e.current,v=s.current,y=l.getRootElement();if(w!=null&&v!=null&&y!=null){let M=y.getBoundingClientRect(),A=w.getBoundingClientRect();v.style.opacity="1";let D=v.getBoundingClientRect(),F=5,B=A.right+F;if(B+D.width>window.innerWidth||B+D.width>M.right){let J=A.left-D.width-F;B=(J<0?F:J)+window.pageXOffset}v.style.left=`${B+window.pageXOffset}px`;let Y=A.top;if(Y+D.height>window.innerHeight){let J=A.bottom-D.height;Y=J<0?F:J}v.style.top=`${Y}px`}},[e,s,l,f]),dt(()=>{function w(v){s.current!=null&&e.current!=null&&G5(v.target)&&!s.current.contains(v.target)&&!e.current.contains(v.target)&&n(!1)}return window.addEventListener("click",w),()=>window.removeEventListener("click",w)},[n,e]);let g=me(()=>{l.update(()=>{if(i.isAttached()){let w=Oe(i),v=Hn(w,l.getElementByKey(w.getKey()));if(v===null)throw new Error("Expected to find tableElement in DOM");let y=Un(v);y!==null&&y.$clearHighlight(),w.markDirty(),d(i.getLatest())}j5(null)})},[l,i]),_=()=>{l.update(()=>{let w=wo();if(!Pt(w))return;let y=w.getNodes().filter(Oa),M=$5(y);M&&(z5(M),o())})},L=()=>{l.update(()=>{A5()})},R=me(w=>{l.update(()=>{for(let v=0;v<c.rows;v++)M5(w);o()})},[l,o,c.rows]),b=me(w=>{l.update(()=>{for(let v=0;v<c.columns;v++)I5(w);o()})},[l,o,c.columns]),x=me(()=>{l.update(()=>{L5(),o()})},[l,o]),C=me(()=>{l.update(()=>{Oe(i).remove(),g(),o()})},[l,i,g,o]),k=me(()=>{l.update(()=>{N5(),o()})},[l,o]),T=me(()=>{l.update(()=>{let w=Oe(i),v=R5(i),[y]=Ma(w,null,null),M=new Set,A=i.getHeaderStyles()^De.ROW;if(y[v])for(let D=0;D<y[v].length;D++){let F=y[v][D];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles(A,De.ROW)))}g(),o()})},[l,i,g,o]),I=me(()=>{l.update(()=>{let w=Oe(i),v=v5(i),[y]=Ma(w,null,null),M=new Set,A=i.getHeaderStyles()^De.COLUMN;if(y)for(let D=0;D<y.length;D++){let F=y?.[D]?.[v];F?.cell&&(M.has(F.cell)||(M.add(F.cell),F.cell.setHeaderStyles(A,De.COLUMN)))}g(),o()})},[l,i,g,o]),N=me(()=>{l.update(()=>{if(i.isAttached()){let w=Oe(i);w&&w.setRowStriping(!w.getRowStriping())}g(),o()})},[l,i,g,o]),S=me(()=>{l.update(()=>{if(i.isAttached()){let w=Oe(i);w&&w.setFrozenColumns(w.getFrozenColumns()===0?1:0)}g(),o()})},[l,i,g,o]),E=null;return t&&(a?E=j("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>_(),type:"button",children:j("span",{className:"text",children:"Merge cells"})}):p&&(E=j("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>L(),type:"button",children:j("span",{className:"text",children:"Unmerge cells"})}))),Fa(ve("div",{className:"table-action-menu-dropdown",onClick:w=>{w.stopPropagation()},ref:s,children:[E?ve(Vn.Fragment,{children:[E,j("hr",{})]}):null,j("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>N(),type:"button",children:j("span",{className:"text",children:"Toggle row striping"})}),j("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>S(),type:"button",children:j("span",{className:"text",children:"Toggle first column freeze"})}),j("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>R(!1),type:"button",children:ve("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),j("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>R(!0),type:"button",children:ve("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:ve("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),j("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:ve("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>k(),type:"button",children:j("span",{className:"text",children:"Delete column"})}),j("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>x(),type:"button",children:j("span",{className:"text",children:"Delete row"})}),j("button",{className:"item","data-test-id":"table-delete",onClick:()=>C(),type:"button",children:j("span",{className:"text",children:"Delete table"})}),j("hr",{}),j("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:ve("span",{className:"text",children:[(i.__headerState&De.ROW)===De.ROW?"Remove":"Add"," ","row header"]})}),j("button",{className:"item","data-test-id":"table-column-header",onClick:()=>I(),type:"button",children:ve("span",{className:"text",children:[(i.__headerState&De.COLUMN)===De.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function J5({anchorElem:t,cellMerge:e}){let[o]=Da(),n=To(null),r=To(null),[l,s]=mt(!1),[i,d]=mt(null),c=me(()=>{let a=n.current,m=wo(),p=U5(o._window),h=document.activeElement;function f(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),d(null)}if(m==null||a==null)return f();let g=o.getRootElement(),_=null,L=null;if(Gn(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let b=$a(m.anchor.getNode());if(b==null||(L=o.getElementByKey(b.getKey()),L==null||!b.isAttached()))return f();let x=Oe(b),C=Hn(x,o.getElementByKey(x.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Un(C),d(b)}else if(Pt(m)){let b=$a(m.anchor.getNode());if(!Oa(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let x=Oe(b),C=Hn(x,o.getElementByKey(x.getKey()));if(C===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");_=Un(C),L=o.getElementByKey(b.getKey())}else if(!h)return f();if(_===null||L===null)return f();let R=!_||!_.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",R),a.classList.toggle("table-cell-action-button-container--inactive",!R),R){let b=L.getBoundingClientRect(),x=t.getBoundingClientRect(),C=b.top-x.top,k=b.right-x.left;a.style.transform=`translate(${k}px, ${C}px)`}},[o,t]);dt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return O5(o.registerUpdateListener(p),o.registerCommand(V5,p,H5),o.registerRootListener((h,f)=>{f&&f.removeEventListener("pointerup",p),h&&(h.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let u=To(i);return dt(()=>{u.current!==i&&s(!1),u.current=i},[u,i]),j("div",{className:"table-cell-action-button-container",ref:n,children:i!=null&&ve(Vn.Fragment,{children:[j("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),s(!l)},ref:r,type:"button",children:j(Ia,{})}),l&&j(K5,{cellMerge:e,contextRef:r,onClose:()=>s(!1),setIsMenuOpen:s,tableCellNode:i})]})})}var Ba=t=>{let e=S5(3),{anchorElem:o}=t,n=E5(),r;return e[0]!==o||e[1]!==n?(r=Fa(n?j(J5,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as X5}from"react/compiler-runtime";import{jsx as Eo,jsxs as Z5}from"react/jsx-runtime";import{useLexicalComposerContext as Y5}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as q5}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Q5,$getTableNodeFromLexicalNodeOrThrow as Wn,$getTableRowIndexFromTableCellNode as eg,$isTableCellNode as Pa,$isTableRowNode as tg,getDOMCellFromTarget as og,getTableElement as ng,TableNode as ja}from"@lexical/table";import{calculateZoomLevel as Ha,mergeRegister as rg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as zn,isHTMLElement as lg,SKIP_SCROLL_INTO_VIEW_TAG as Ua}from"lexical";import*as Va from"react";import{useCallback as jt,useEffect as Kn,useRef as So,useState as pt}from"react";import{createPortal as ig}from"react-dom";var sg=33,Ga=92;function ag({editor:t}){let e=So(null),o=So(null),n=So(null),[r,l]=pt(!1),s=G(),i=So(null),[d,c]=pt(null),[u,a]=pt(null),[m,p]=pt(!1),[h,f]=pt(null),g=jt(()=>{a(null),e.current=null,f(null),i.current=null,n.current=null},[]),_=S=>(S.buttons&1)===1;Kn(()=>{let S=new Set;return rg(t.registerMutationListener(ja,E=>{for(let[w,v]of E)v==="destroyed"?S.delete(w):S.add(w);l(S.size>0)}),t.registerNodeTransform(ja,E=>{if(E.getColWidths())return E;let w=E.getColumnCount(),v=Ga;return E.setColWidths(Array(w).fill(v)),E}))},[t]),Kn(()=>{if(!r)return;let S=y=>{let M=y.target;if(lg(M)){if(h){c({x:y.clientX,y:y.clientY});return}if(p(_(y)),!(o.current&&o.current.contains(M))&&e.current!==M){e.current=M;let A=og(M);A&&u!==A?t.getEditorState().read(()=>{let D=zn(A.elem);if(!D)throw new Error("TableCellResizer: Table cell node not found.");let F=Wn(D),B=ng(F,t.getElementByKey(F.getKey()));if(!B)throw new Error("TableCellResizer: Table element not found.");e.current=M,n.current=B.getBoundingClientRect(),a(A)},{editor:t}):A==null&&g()}}},E=y=>{p(!0)},w=y=>{p(!1)},v=t.registerRootListener((y,M)=>{M?.removeEventListener("mousemove",S),M?.removeEventListener("mousedown",E),M?.removeEventListener("mouseup",w),y?.addEventListener("mousemove",S),y?.addEventListener("mousedown",E),y?.addEventListener("mouseup",w)});return()=>{v()}},[u,h,t,r,g]);let L=S=>S==="bottom",R=jt(S=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let E=zn(u.elem);if(!Pa(E))throw new Error("TableCellResizer: Table cell node not found.");let w=Wn(E),v=eg(E),y=w.getChildren(),A=E.getColSpan()===w.getColumnCount()?v:v+E.getRowSpan()-1;if(A>=y.length||A<0)throw new Error("Expected table cell to be inside of table row.");let D=y[A];if(!tg(D))throw new Error("Expected table row");let F=D.getHeight();if(F===void 0){let Y=D.getChildren();F=Math.min(...Y.map(J=>b(J,t)??1/0))}let B=Math.max(F+S,sg);D.setHeight(B)},{tag:Ua})},[u,t]),b=(S,E)=>E.getElementByKey(S.getKey())?.clientHeight,x=(S,E)=>{let w;return E.forEach(v=>{v.forEach((y,M)=>{y.cell===S&&(w=M)})}),w},C=jt(S=>{if(!u)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let E=zn(u.elem);if(!Pa(E))throw new Error("TableCellResizer: Table cell node not found.");let w=Wn(E),[v]=Q5(w,null,null),y=x(E,v);if(y===void 0)throw new Error("TableCellResizer: Table column not found.");let M=w.getColWidths();if(!M)return;let A=M[y];if(A===void 0)return;let D=[...M],F=Math.max(A+S,Ga);D[y]=F,w.setColWidths(D)},{tag:Ua})},[u,t]),k=jt(S=>{let E=w=>{if(w.preventDefault(),w.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:v,y}=i.current;if(u===null)return;let M=Ha(w.target);if(L(S)){let A=(w.clientY-y)/M;R(A)}else{let A=(w.clientX-v)/M;C(A)}g(),document.removeEventListener("mouseup",E)}};return E},[u,g,C,R]),T=jt(S=>E=>{if(E.preventDefault(),E.stopPropagation(),!u)throw new Error("TableCellResizer: Expected active cell.");i.current={x:E.clientX,y:E.clientY},c(i.current),f(S),document.addEventListener("mouseup",k(S))},[u,k]),[I,N]=pt({bottom:null,left:null,right:null,top:null});return Kn(()=>{if(u){let{height:S,left:E,top:w,width:v}=u.elem.getBoundingClientRect(),y=Ha(u.elem),M=10,A={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${M}px`,left:`${window.scrollX+E}px`,top:`${window.scrollY+w+S-M/2}px`,width:`${v}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${S}px`,left:`${window.scrollX+E+v-M/2}px`,top:`${window.scrollY+w}px`,width:`${M}px`}},D=n.current;h&&d&&D&&(L(h)?(A[h].left=`${window.scrollX+D.left}px`,A[h].top=`${window.scrollY+d.y/y}px`,A[h].height="3px",A[h].width=`${D.width}px`):(A[h].top=`${window.scrollY+D.top}px`,A[h].left=`${window.scrollX+d.x/y}px`,A[h].width="3px",A[h].height=`${D.height}px`),A[h].backgroundColor="#adf"),N(A)}else N({bottom:null,left:null,right:null,top:null})},[u,h,d]),Eo("div",{ref:o,children:u!=null&&!m&&Z5(Va.Fragment,{children:[Eo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:I.right||void 0}),Eo("div",{className:`${s.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:I.bottom||void 0})]})})}var Wa=()=>{let t=X5(3),[e]=Y5(),o=q5(),n;return t[0]!==e||t[1]!==o?(n=o?ig(Eo(ag,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=n):n=t[2],n};import{c as gg}from"react/compiler-runtime";import{jsx as Jn,jsxs as xg,Fragment as Cg}from"react/jsx-runtime";import{useLexicalComposerContext as bg}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Qa}from"@lexical/react/useLexicalEditable";import{$getTableAndElementByKey as kg,$getTableColumnIndexFromTableCellNode as _g,$getTableRowIndexFromTableCellNode as Tg,$insertTableColumnAtSelection as wg,$insertTableRowAtSelection as Sg,$isTableCellNode as Eg,$isTableNode as Ja,getTableElement as Ng,TableNode as Lg}from"@lexical/table";import{$findMatchingParent as yg,mergeRegister as vg}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Xa,isHTMLElement as Rg}from"lexical";import{useEffect as Za,useMemo as Ig,useRef as Ya,useState as No}from"react";import"react";import{createPortal as Mg}from"react-dom";import{c as pg}from"react/compiler-runtime";import{useEffect as fg,useRef as hg}from"react";var cg="Expected a function",ug=Math.max,dg=Math.min;function mg(t,e,o){let n,r,l=0,s,i=!1,d=!1,c,u,a,m=!0;if(typeof t!="function")throw new TypeError(cg);e=e||0,typeof o=="object"&&(i=!!o.leading,d="maxWait"in o,c=d?ug(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(C){let k=n,T=s;return n=s=void 0,l=C,u=t.apply(T,k),u}function h(C){return l=C,a=setTimeout(_,e),i?p(C):u}function f(C){let k=C-r,T=C-l,I=e-k;return d?dg(I,c-T):I}function g(C){let k=C-r,T=C-l;return r===void 0||k>=e||k<0||d&&T>=c}function _(){let C=Date.now();if(g(C))return L(C);a=setTimeout(_,f(C))}function L(C){return a=void 0,m&&n?p(C):(n=s=void 0,u)}function R(){a!==void 0&&clearTimeout(a),l=0,n=r=s=a=void 0}function b(){return a===void 0?u:L(Date.now())}function x(){let C=Date.now(),k=g(C);if(n=arguments,s=this,r=C,k){if(a===void 0)return h(r);if(d)return clearTimeout(a),a=setTimeout(_,e),p(r)}return a===void 0&&(a=setTimeout(_,e)),u}return x.cancel=R,x.flush=b,x}var za=mg;function Ka(t,e,o){let n=pg(6),r=hg(null),l,s;n[0]!==t||n[1]!==o||n[2]!==e?(l=()=>(r.current=za(t,e,{maxWait:o}),()=>{r.current?.cancel()}),s=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=l,n[4]=s):(l=n[3],s=n[4]),fg(l,s);let i;return n[5]===Symbol.for("react.memo_cache_sentinel")?(i=(...c)=>{let u=c;r.current&&r.current(...u)},n[5]=i):i=n[5],i}var qa=16;function $g({anchorElem:t}){let[e]=bg(),o=Qa(),n=G(),[r,l]=No(!1),[s,i]=No(!1),[d,c]=No(!1),[u,a]=No({}),m=Ya(new Set),p=Ya(null),h=Ka(_=>{let{isOutside:L,tableDOMNode:R}=Ag(_,n.editorConfig?.lexical);if(L){l(!1),i(!1);return}if(!R)return;p.current=R;let b=null,x=null,C=null;if(e.getEditorState().read(()=>{let A=Xa(R);if(Eg(A)){let D=yg(A,F=>Ja(F));if(!Ja(D))return;if(C=Ng(D,e.getElementByKey(D.getKey())),C){let F=D.getChildrenSize(),B=D.getChildAtIndex(0)?.getChildrenSize(),Y=Tg(A),J=_g(A);Y===F-1?b=A:J===B-1&&(x=A)}}},{editor:e}),!C)return;let k=C.parentElement;if(!k)return;let{bottom:T,height:I,left:N,right:S,width:E,y:w}=C.getBoundingClientRect(),v=!1;k&&k.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(v=k.scrollWidth>k.clientWidth);let{left:y,y:M}=t.getBoundingClientRect();b?(i(!1),l(!0),a({height:qa,left:v&&k?k.offsetLeft:N-y,top:T-M+5,width:v&&k?k.offsetWidth:E})):x&&(i(!0),l(!1),a({height:I,left:S-y+5,top:w-M,width:qa}))},50,250),f=Ig(()=>new ResizeObserver(()=>{l(!1),i(!1)}),[]);Za(()=>{if(d)return document.addEventListener("mousemove",h),()=>{l(!1),i(!1),document.removeEventListener("mousemove",h)}},[d,h]),Za(()=>vg(e.registerMutationListener(Lg,_=>{e.getEditorState().read(()=>{let L=!1;for(let[R,b]of _)switch(b){case"created":{m.current.add(R),L=!0;break}case"destroyed":{m.current.delete(R),L=!0;break}default:break}if(L){f.disconnect();for(let R of m.current){let{tableElement:b}=kg(R);f.observe(b)}c(m.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let g=_=>{e.update(()=>{p.current&&(Xa(p.current)?.selectEnd(),_?(Sg(),l(!1)):(wg(),i(!1)))})};return o?xg(Cg,{children:[r&&Jn("button",{"aria-label":"Add Row",className:n.editorConfig.lexical.theme.tableAddRows,onClick:()=>g(!0),style:{...u},type:"button"}),s&&Jn("button",{"aria-label":"Add Column",className:n.editorConfig.lexical.theme.tableAddColumns,onClick:()=>g(!1),style:{...u},type:"button"})]}):null}function Ag(t,e){let o=t.target;if(Rg(o)){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 ec(t){let e=gg(2),{anchorElem:o}=t,n=o===void 0?document.body:o;if(!Qa())return null;let l;return e[0]!==n?(l=Mg(Jn($g,{anchorElem:n}),n),e[0]=n,e[1]=l):l=e[1],l}import{jsx as Yn,jsxs as Bg}from"react/jsx-runtime";import{useLexicalComposerContext as Pg}from"@lexical/react/LexicalComposerContext";import{TablePlugin as jg}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Hg,TableCellNode as Ug,TableNode as Gg,TableRowNode as Vg}from"@lexical/table";import{mergeRegister as Wg}from"@lexical/utils";import{$getSelection as zg,$isRangeSelection as Kg,$setSelection as Jg,COMMAND_PRIORITY_EDITOR as Xg,createCommand as Zg}from"lexical";import{createContext as Yg,use as qg,useCallback as ic,useEffect as sc,useMemo as Qg,useRef as e2,useState as Lo}from"react";import*as ac from"react";import{jsx as Q,jsxs as Re}from"react/jsx-runtime";import{useCallback as Xn,useEffect as tc,useRef as Zn,useState as Ht}from"react";import*as rc from"react";import{createPortal as Dg}from"react-dom";var oc=10,nc=7;function Og(){return Re("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[Q("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"1.5",y:"1.5"}),Q("rect",{height:"9",rx:"1",stroke:"currentColor",width:"3",x:"7.5",y:"1.5"})]})}function Fg(){return Re("svg",{fill:"none",height:"12",viewBox:"0 0 12 12",width:"12",xmlns:"http://www.w3.org/2000/svg",children:[Q("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"1.5"}),Q("rect",{height:"3",rx:"1",stroke:"currentColor",width:"9",x:"1.5",y:"7.5"})]})}function lc({anchorElem:t,editor:e,isOpen:o,onClose:n,onInsert:r,position:l}){let[s,i]=Ht(0),[d,c]=Ht(0),[u,a]=Ht(""),[m,p]=Ht(""),[h,f]=Ht(null),g=Zn(null),_=Zn(null),L=Zn(null),R=s>0?s:u?parseInt(u,10)||0:5,b=d>0?d:m?parseInt(m,10)||0:5;tc(()=>{o||(i(0),c(0),a(""),p(""),f(null))},[o]),tc(()=>{if(!o)return;let N=S=>{if(S.key==="Escape"&&(S.preventDefault(),S.stopPropagation(),n()),S.key==="Enter"&&h){S.preventDefault();let E=parseInt(u,10),w=parseInt(m,10);E>0&&w>0&&r(E,w)}};return document.addEventListener("keydown",N,!0),()=>document.removeEventListener("keydown",N,!0)},[o,n,r,h,u,m]);let x=Xn((N,S)=>{N>0&&S>0&&r(N,S)},[r]),C=Xn((N,S)=>{i(N),c(S)},[]),k=Xn(()=>{i(0),c(0)},[]);if(!o||!l||!t)return null;let T=[];for(let N=1;N<=nc;N++)for(let S=1;S<=oc;S++){let E=S<=R&&N<=b,w=S<=s&&N<=d,v="table-grid-popup__cell";E&&w?v+=" table-grid-popup__cell--hover":E&&(v+=" table-grid-popup__cell--selected"),T.push(Q("div",{"aria-label":`${S} columns, ${N} rows`,className:v,onClick:()=>x(S,N),onKeyDown:y=>{(y.key==="Enter"||y.key===" ")&&(y.preventDefault(),x(S,N))},onMouseEnter:()=>C(S,N),role:"button",tabIndex:-1},`${N}-${S}`))}let I=s>0&&d>0;return Dg(Re(rc.Fragment,{children:[Q("div",{className:"table-grid-popup__backdrop",onClick:n}),Q("div",{className:"table-grid-popup",ref:g,style:{transform:`translate(${l.left}px, ${l.top}px)`},children:Re("div",{className:"table-grid-popup__content",children:[Re("div",{className:"table-grid-popup__header",children:[Re("div",{className:`table-grid-popup__input-group${h==="cols"?" table-grid-popup__input-group--focused":""}`,children:[Q("div",{className:"table-grid-popup__input-icon",children:Q(Og,{})}),Q("input",{"aria-label":"Columns",className:"table-grid-popup__input",min:1,onBlur:()=>f(null),onChange:N=>a(N.target.value),onFocus:()=>f("cols"),placeholder:s>0?String(s):"5",ref:_,type:"number",value:u})]}),Q("span",{className:"table-grid-popup__separator",children:"\xD7"}),Re("div",{className:`table-grid-popup__input-group${h==="rows"?" table-grid-popup__input-group--focused":""}`,children:[Q("div",{className:"table-grid-popup__input-icon",children:Q(Fg,{})}),Q("input",{"aria-label":"Rows",className:"table-grid-popup__input",min:1,onBlur:()=>f(null),onChange:N=>p(N.target.value),onFocus:()=>f("rows"),placeholder:d>0?String(d):"5",ref:L,type:"number",value:m})]})]}),Re("div",{className:"table-grid-popup__grid",onMouseLeave:k,children:[T,I&&Re("div",{className:"table-grid-popup__tooltip",style:{left:`calc(${(s-.5)/oc*100}%)`,top:`calc(${(d-1)/nc*100}%)`},children:[R," \xD7 ",b]})]})]})})]}),t)}var yo=Zg("OPEN_EMBED_DRAWER_COMMAND"),cc=Yg({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function uc({children:t}){let[e,o]=Lo({cellEditorConfig:null,cellEditorPlugins:null});return Yn(cc,{value:Qg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var dc=()=>{let[t]=Pg(),e=qg(cc),[o,n]=Lo(!1),[r,l]=Lo(null),s=e2(null),[i,d]=Lo(null);sc(()=>{let a=t.getRootElement();if(a){let m=a.closest(".editor")??null;d(m??a.parentElement)}},[t]),sc(()=>{if(!t.hasNodes([Gg,Vg,Ug]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Wg(t.registerCommand(yo,()=>{let a=i;if(!a)return!0;let m=a.getBoundingClientRect(),p=null;t.getEditorState().read(()=>{let f=zg();if(Kg(f)){s.current=f.clone();let g=f.anchor.getNode(),_=t.getElementByKey(g.getKey());if(_){let L=_.getBoundingClientRect();L.height>0&&(p={left:L.left-m.left,top:L.bottom-m.top+8})}}});let h=window.getSelection();if(h&&h.rangeCount>0){let g=h.getRangeAt(0).getBoundingClientRect();g.height>0&&(p={left:g.left-m.left,top:g.bottom-m.top+8})}return p||(p={left:0,top:40}),l(p),n(!0),!0},Xg))},[e,t,i]);let c=ic(()=>{n(!1)},[]),u=ic((a,m)=>{n(!1),t.focus(),t.update(()=>{s.current&&Jg(s.current.clone())},{discrete:!0,skipTransforms:!0}),setTimeout(()=>{t.dispatchCommand(Hg,{columns:String(a),rows:String(m)})},1)},[t]);return Bg(ac.Fragment,{children:[Yn(lc,{anchorElem:i,editor:t,isOpen:o,onClose:c,onInsert:u,position:r}),Yn(jg,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]})};var r2=$({markdownTransformers:[ya],nodes:[o2,t2,n2],plugins:[{Component:dc,position:"normal"},{Component:Wa,position:"normal"},{Component:Ba,position:"floatingAnchorElem"},{Component:ec,position:"floatingAnchorElem"}],providers:[uc],slashMenu:{groups:[X([{Icon:Bn,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]},toolbarFixed:{groups:[Te([{ChildComponent:Bn,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(yo,{})}}])]}});import{$isNodeSelection as j2}from"lexical";import{jsx as mc}from"react/jsx-runtime";import"react";var l2="M16.2041 6.01074C17.2128 6.113 18 6.96435 18 8V16L17.9893 16.2041C17.8938 17.1457 17.1457 17.8938 16.2041 17.9893L16 18H8C6.96435 18 6.113 17.2128 6.01074 16.2041L6 16V8C6 6.89543 6.89543 6 8 6H16L16.2041 6.01074ZM8 7C7.44772 7 7 7.44772 7 8V16C7 16.5523 7.44772 17 8 17H16C16.5523 17 17 16.5523 17 16V8C17 7.44772 16.5523 7 16 7H8ZM9.72461 11.582C9.91869 11.4539 10.1827 11.4756 10.3535 11.6465L13.8535 15.1465C14.0488 15.3417 14.0488 15.6583 13.8535 15.8535C13.6583 16.0488 13.3417 16.0488 13.1465 15.8535L10 12.707L8.85352 13.8535C8.65825 14.0488 8.34175 14.0488 8.14648 13.8535C7.95122 13.6583 7.95122 13.3417 8.14648 13.1465L9.64648 11.6465L9.72461 11.582ZM14 8C15.1046 8 16 8.89543 16 10C16 11.1046 15.1046 12 14 12C12.8954 12 12 11.1046 12 10C12 8.89543 12.8954 8 14 8ZM14 9C13.4477 9 13 9.44772 13 10C13 10.5523 13.4477 11 14 11C14.5523 11 15 10.5523 15 10C15 9.44772 14.5523 9 14 9Z",qn=({className:t})=>mc("svg",{"aria-hidden":"true",className:["icon",t].filter(Boolean).join(" "),fill:"none",focusable:"false",height:24,viewBox:"0 0 24 24",width:24,xmlns:"http://www.w3.org/2000/svg",children:mc("path",{clipRule:"evenodd",d:l2,fill:"currentColor",fillRule:"evenodd"})});import{jsx as xc}from"react/jsx-runtime";import Cc from"bson-objectid";import{$applyNodeReplacement as d2}from"lexical";import*as bc from"react";import i2 from"bson-objectid";function vo(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let n=t.getAttribute("data-lexical-pending-upload-form-id");if(n!=null)return{node:e({data:{pending:{formID:n,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let n=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(n!=null&&r!=null)return{node:e({data:{fields:{},relationTo:r,value:n}})}}return{node:e({data:{pending:{formID:new i2.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as s2}from"@lexical/react/LexicalDecoratorBlockNode.js";import{addClassNamesToElement as a2}from"@lexical/utils";import fc from"bson-objectid";import{$applyNodeReplacement as c2}from"lexical";var Ut=class extends s2{__data;constructor({data:e,format:o,key:n}){super(o,n),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"upload"}static importDOM(){return{img:e=>({conversion:o=>vo(o,pc),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new fc.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=pc({data:o});return n.setFormat(e.format),n}static isInline(){return!1}createDOM(e){let o=document.createElement("div");return a2(o,e?.theme?.upload),o}decorate(){return null}exportDOM(){let e=document.createElement("img"),o=this.__data;return o.pending?(e.setAttribute("data-lexical-pending-upload-form-id",String(o?.pending?.formID)),e.setAttribute("src",o?.pending?.src||"")):(e.setAttribute("data-lexical-upload-id",String(o?.value)),e.setAttribute("data-lexical-upload-relation-to",o?.relationTo)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"upload",version:3}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function pc({data:t}){return t?.id||(t.id=new fc.default().toHexString()),c2(new Ut({data:t}))}import{jsx as hc}from"react/jsx-runtime";import{ShimmerEffect as u2}from"@payloadcms/ui";var gc=()=>hc("div",{className:"lexical-upload",children:hc(u2,{height:"95px",width:"203px"})});var m2=bc.lazy(()=>import("./component-2ZTDKRVK.js").then(t=>({default:t.UploadComponent}))),ge=class extends Ut{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>vo(o,xe),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Cc.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},n=xe({data:o});return n.setFormat(e.format),n}decorate(e,o){return this.__data.pending?xc(gc,{}):xc(m2,{className:o?.theme?.upload??"LexicalEditorTheme__upload",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function xe({data:t}){return t?.id||(t.id=new Cc.default().toHexString()),d2(new ge({data:t}))}function ft(t){return t instanceof ge}import{c as k2}from"react/compiler-runtime";import{jsx as _2}from"react/jsx-runtime";import{useLexicalComposerContext as T2}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Rc,$insertNodeToNearestRoot as tr,mergeRegister as w2}from"@lexical/utils";import{useBulkUpload as S2,useEffectEvent as E2,useModal as N2}from"@payloadcms/ui";import or from"bson-objectid";import{$createRangeSelection as L2,$getPreviousSelection as Ec,$getSelection as Nc,$isParagraphNode as nr,$isRangeSelection as Lc,$setSelection as y2,COMMAND_PRIORITY_EDITOR as v2,COMMAND_PRIORITY_LOW as yc,createCommand as R2,DROP_COMMAND as I2,getDOMSelectionFromTarget as M2,isHTMLElement as vc,PASTE_COMMAND as $2}from"lexical";import{useEffect as A2}from"react";import{c as kc}from"react/compiler-runtime";import{jsx as Qn}from"react/jsx-runtime";import{useLexicalComposerContext as _c}from"@lexical/react/LexicalComposerContext.js";import{toast as p2}from"@payloadcms/ui";import{$getNodeByKey as f2,COMMAND_PRIORITY_EDITOR as Tc}from"lexical";import{useEffect as wc,useState as h2}from"react";var g2=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=f2(o);r&&r.replace(xe({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(er,{fields:null,relationTo:e,value:n})},x2=t=>{let e=kc(13),{enabledCollectionSlugs:o}=t,[n]=_c(),[r,l]=h2(null),s;e[0]!==o?(s={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=s):s=e[1];let{closeListDrawer:i,ListDrawer:d,openListDrawer:c}=Dt(s),u,a;e[2]!==n||e[3]!==c?(u=()=>n.registerCommand(et,f=>(l(f?.replace?f?.replace.nodeKey:null),c(),!0),Tc),a=[n,c],e[2]=n,e[3]=c,e[4]=u,e[5]=a):(u=e[4],a=e[5]),wc(u,a);let m;e[6]!==i||e[7]!==n||e[8]!==r?(m=f=>{let{collectionSlug:g,doc:_}=f;i(),g2({editor:n,relationTo:g,replaceNodeKey:r,value:_.id})},e[6]=i,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,h;return e[10]!==d||e[11]!==p?(h=Qn(d,{onSelect:p}),e[10]=d,e[11]=p,e[12]=h):h=e[12],h},C2=()=>{let t=kc(3),[e]=_c(),o,n;return t[0]!==e?(o=()=>e.registerCommand(et,b2,Tc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),wc(o,n),null},Sc=({enabledCollectionSlugs:t})=>t?.length?Qn(x2,{enabledCollectionSlugs:t}):Qn(C2,{});function b2(){return p2.error("No upload collections enabled"),!0}function D2(t){let e=t.target;return!!(vc(e)&&!e.closest("code, span.editor-image")&&vc(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function O2(t){let e,o=M2(t.target);if(document.caretRangeFromPoint)e=document.caretRangeFromPoint(t.clientX,t.clientY);else if(t.rangeParent&&o!==null)o.collapse(t.rangeParent,t.rangeOffset||0),e=o.getRangeAt(0);else throw Error("Cannot get the selection when dragging");return e}var er=R2("INSERT_UPLOAD_COMMAND"),Ic=t=>{let e=k2(21),{clientProps:o}=t,[n]=T2(),r=o?.disabledCollections,l=o?.enabledCollections,s;e[0]!==r||e[1]!==l?(s={collectionSlugsBlacklist:r,collectionSlugsWhitelist:l,uploads:!0},e[0]=r,e[1]=l,e[2]=s):s=e[2];let{enabledCollectionSlugs:i}=fo(s),{drawerSlug:d,setCollectionSlug:c,setInitialForms:u,setOnCancel:a,setOnSuccess:m,setSelectableCollections:p}=S2(),{isModalOpen:h,openModal:f}=N2(),g;e[3]!==d||e[4]!==n||e[5]!==i||e[6]!==h||e[7]!==f||e[8]!==c||e[9]!==u||e[10]!==a||e[11]!==m||e[12]!==p?(g=x=>{let{files:C}=x;if(C?.length!==0&&(u(k=>[...k??[],...C.map(F2)]),!h(d))){if(!i.length||!i[0])return;c(i[0]),p(i),a(()=>{n.update(B2)}),m(k=>{let T=new Map(k.map(P2));n.update(()=>{for(let I of Rc()){let N=I.node;if(ft(N)){let S=N.getData();if(S?.pending){let E=T.get(S.pending?.formID);E&&N.replace(xe({data:{id:new or.default().toHexString(),fields:{},relationTo:E.collectionSlug,value:E.doc.id}}))}}}})}),f(d)}},e[3]=d,e[4]=n,e[5]=i,e[6]=h,e[7]=f,e[8]=c,e[9]=u,e[10]=a,e[11]=m,e[12]=p,e[13]=g):g=e[13];let _=E2(g),L;e[14]!==n||e[15]!==_?(L=()=>{if(!n.hasNodes([ge]))throw new Error("UploadPlugin: UploadNode not registered on editor");return w2(n.registerNodeTransform(ge,x=>{let C=x.getData();if(!C?.pending)return;(async function(){let I=null,N=C?.pending?.src,S=C?.pending?.formID;if(N?.startsWith("data:")){let E=N.match(/data:(image\/[a-zA-Z]+);base64,/),w=E?E[1]:"image/png",v=N.replace(/^data:image\/[a-zA-Z]+;base64,/,""),y=atob(v),M=new Array(y.length);for(let F=0;F<y.length;F++)M[F]=y.charCodeAt(F);let A=new Uint8Array(M);I={alt:void 0,file:new File([A],"pasted-image."+w?.split("/",2)[1],{type:w}),formID:S}}else if(N?.startsWith("http")||N?.startsWith("https")){let w=await(await fetch(N)).blob(),v=N.split("/").pop()||"pasted-image"+w.type.split("/",2)[1];I={alt:void 0,file:new File([w],v,{type:w.type}),formID:S}}I&&_({files:[I]})})()}),n.registerCommand(er,x=>(n.update(()=>{let C=Nc()||Ec();if(Lc(C)){let k=xe({data:{id:x.id,fields:x.fields,relationTo:x.relationTo,value:x.value}}),{focus:T}=C,I=T.getNode();tr(k),nr(I)&&!I.__first&&I.remove()}}),!0),v2),n.registerCommand($2,x=>{if(!(x instanceof ClipboardEvent))return!1;let C=x.clipboardData;if(!C?.types?.length||C?.types?.includes("text/html"))return!1;let k=[];return C?.files?.length&&Array.from(C.files).forEach(T=>{k.push({alt:"",file:T,formID:new or.default().toHexString()})}),k.length?(n.update(()=>{let T=Nc()||Ec();if(Lc(T))for(let I of k){let N=xe({data:{pending:{formID:I.formID,src:URL.createObjectURL(I.file)}}}),{focus:S}=T,E=S.getNode();tr(N),nr(E)&&!E.__first&&E.remove()}}),_({files:k}),!0):!1},yc),n.registerCommand(I2,x=>{if(!(x instanceof DragEvent))return!1;let C=x.dataTransfer;if(!C?.types?.length)return!1;let k=[];return C?.files?.length&&Array.from(C.files).forEach(T=>{k.push({alt:"",file:T,formID:new or.default().toHexString()})}),k.length?(x.preventDefault(),x.stopPropagation(),n.update(()=>{if(D2(x)){let T=O2(x),I=L2();T!=null&&I.applyDOMRange(T),y2(I);for(let N of k){let S=xe({data:{pending:{formID:N.formID,src:URL.createObjectURL(N.file)}}}),{focus:E}=I,w=E.getNode();tr(S),nr(w)&&!w.__first&&w.remove()}}}),_({files:k}),!0):!1},yc))},e[14]=n,e[15]=_,e[16]=L):L=e[16];let R;e[17]!==n?(R=[n],e[17]=n,e[18]=R):R=e[18],A2(L,R);let b;return e[19]!==i?(b=_2(Sc,{enabledCollectionSlugs:i}),e[19]=i,e[20]=b):b=e[20],b};function F2(t){return{file:t.file,formID:t.formID}}function B2(){for(let t of Rc()){let e=t.node;ft(e)&&e.getData()?.pending&&e.remove()}}function P2(t){return[t.formID,t]}var H2=$({nodes:[ge],plugins:[{Component:Ic,position:"normal"}],slashMenu:{groups:[X([{Icon:qn,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]},toolbarFixed:{groups:[Te([{ChildComponent:qn,isActive:({selection:t})=>{if(!j2(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return ft(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(et,{replace:!1})}}])]}});import{c as G2}from"react/compiler-runtime";import{jsx as Ro}from"react/jsx-runtime";import{createElement as V2}from"react";import{ShimmerEffect as W2,useConfig as z2}from"@payloadcms/ui";import{lazy as K2,Suspense as J2,useEffect as X2,useState as Z2}from"react";var Mc={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",inlineBlock:"LexicalEditorTheme__inlineBlock",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",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",placeholder:"LexicalEditorTheme__placeholder",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",root:"LexicalEditorTheme",rtl:"LexicalEditorTheme__rtl",tab:"LexicalEditorTheme__tabNode",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableAlignment:{center:"LexicalEditorTheme__tableAlignmentCenter",right:"LexicalEditorTheme__tableAlignmentRight"},tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableFrozenColumn:"LexicalEditorTheme__tableFrozenColumn",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableScrollableWrapper:"LexicalEditorTheme__tableScrollableWrapper",tableSelected:"LexicalEditorTheme__tableSelected",tableSelection:"LexicalEditorTheme__tableSelection",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:"LexicalEditorTheme__upload"};var rr={namespace:"lexical",theme:Mc};function $c({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:n,schemaPath:r,unSanitizedEditorConfig:l}){let s=new Map;for(let c of l.features){if(!c?.clientFeatureProps?.featureKey||c?.clientFeatureProps?.order===void 0||c?.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.");s.set(c.clientFeatureProps.featureKey,c)}l.features=l.features.sort((c,u)=>c.clientFeatureProps.order-u.clientFeatureProps.order);let i=new Map,d=0;for(let c of l.features){let u=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:s,field:n,resolvedFeatures:i,schemaPath:r,unSanitizedEditorConfig:l}):c.feature;u.key=c.clientFeatureProps.featureKey,u.order=d,i.set(c.clientFeatureProps.featureKey,u),d++}return i}import{deepMerge as U2}from"payload/shared";var Ac=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(n=>{n.key==="toolbarFixed"&&n.sanitizedClientFeatureProps?.customGroups&&(o={...o,...n.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(n=>{if(n.providers?.length&&(e.providers=e.providers.concat(n.providers)),n.enableFormats?.length&&e.enabledFormats.push(...n.enableFormats),n.nodes?.length)for(let r of n.nodes)e.nodes.push(r);if(n.plugins?.length&&n.plugins.forEach((r,l)=>{e.plugins?.push({clientProps:n.sanitizedClientFeatureProps,Component:r.Component,key:n.key+l,position:r.position})}),n.toolbarInline?.groups?.length)for(let r of n.toolbarInline.groups){let l=e.toolbarInline.groups.find(s=>s.key===r.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarInline?.groups.push(l)}if(n.toolbarFixed?.groups?.length)for(let r of n.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(s=>s.key===r.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.toolbarFixed?.groups.push(l)}if(n.slashMenu?.groups){n.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(n.slashMenu.dynamicGroups));for(let r of n.slashMenu.groups){let l=e.slashMenu.groups.find(s=>s.key===r.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(s=>s.key!==r.key):l={...r,items:[]},r?.items?.length&&(l.items=l.items.concat(r.items)),e.slashMenu.groups.push(l)}}if(n.markdownTransformers?.length)for(let r of n.markdownTransformers)typeof r=="function"?e.markdownTransformers.push(r({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(r);e.enabledFeatures.push(n.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(n=>{let r=o[n.key];return r?U2(n,r):n})),e.toolbarInline.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0),e.toolbarFixed.groups.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let n of e.toolbarInline.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);for(let n of e.toolbarFixed.groups)n.items.sort((r,l)=>r.order&&l.order?r.order-l.order:r.order?-1:l.order?1:0);return e};function lr(t,e,o,n){return{admin:o,features:Ac(t),lexical:e,resolvedFeatureMap:t,view:n}}var Y2=K2(()=>import("./Field-VMNLDBRS.js").then(t=>({default:t.RichText}))),q2=t=>Ro(Po,{inheritable:!0,views:t.views,children:Ro(Q2,{...t})}),Q2=t=>{let e=G2(23),{admin:o,clientFeatures:n,featureClientImportMap:r,featureClientSchemaMap:l,field:s,lexicalEditorConfig:i,schemaPath:d,views:c}=t,u;e[0]!==o?(u=o===void 0?{}:o,e[0]=o,e[1]=u):u=e[1];let a=u,m;e[2]!==r?(m=r===void 0?{}:r,e[2]=r,e[3]=m):m=e[3];let p=m,h=i===void 0?rr:i,{currentView:f}=jo(),g=c?.[f]?.admin??a,_=c?.[f]?.lexical,L;e[4]!==h||e[5]!==_?(L=typeof _=="function"?_(h):_??h,e[4]=h,e[5]=_,e[6]=L):L=e[6];let R=L,{config:b}=z2(),[x,C]=Z2(null),k,T;e[7]!==n||e[8]!==b||e[9]!==f||e[10]!==g||e[11]!==R||e[12]!==p||e[13]!==l||e[14]!==s||e[15]!==x||e[16]!==d||e[17]!==c?(k=()=>{if(x&&x.view===f)return;let N=c?.[f],S=N?.filterFeatures?N.filterFeatures(n):n,E=[];for(let v of Object.values(S))v.clientFeatureProvider&&E.push(v.clientFeatureProvider(v.clientFeatureProps));let w=$c({config:b,featureClientImportMap:p,featureClientSchemaMap:l,field:s,schemaPath:d??s.name,unSanitizedEditorConfig:{features:E,lexical:R}});C(lr(w,R,g,f))},T=[g,n,b,p,l,s,x,R,d,f,c],e[7]=n,e[8]=b,e[9]=f,e[10]=g,e[11]=R,e[12]=p,e[13]=l,e[14]=s,e[15]=x,e[16]=d,e[17]=c,e[18]=k,e[19]=T):(k=e[18],T=e[19]),X2(k,T);let I;return e[20]!==x||e[21]!==t?(I=Ro(J2,{fallback:Ro(W2,{height:"35vh"}),children:x&&V2(Y2,{...t,editorConfig:x,key:x.view})}),e[20]=x,e[21]=t,e[22]=I):I=e[22],I};function ex(t){return t instanceof HTMLElement}function tx(...t){return t.filter(Boolean).join(" ")}var Io=new WeakMap;function Dc(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Mo(t,e){let o=Io.get(t);if(o===void 0){let n=new Set,r=s=>{o!==void 0&&(o.start=Dc(s))},l=s=>{if(o===void 0)return;let{start:i}=o;if(i===null)return;let d=Dc(s);for(let c of n)d!==null&&c([d[0]-i[0],d[1]-i[1]],s)};t.addEventListener("touchstart",r),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:r,listeners:n,start:null},Io.set(t,o)}return o.listeners.add(e),()=>{ox(t,e)}}function ox(t,e){let o=Io.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(Io.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function nx(t,e){return Mo(t,(o,n)=>{let[r,l]=o;r<0&&-r>Math.abs(l)&&e(r,n)})}function rx(t,e){return Mo(t,(o,n)=>{let[r,l]=o;r>0&&r>Math.abs(l)&&e(r,n)})}function lx(t,e){return Mo(t,(o,n)=>{let[r,l]=o;l<0&&-l>Math.abs(r)&&e(r,n)})}function ix(t,e){return Mo(t,(o,n)=>{let[r,l]=o;l>0&&l>Math.abs(r)&&e(r,n)})}import{c as sx}from"react/compiler-runtime";import{jsx as ax}from"react/jsx-runtime";import"react";var cx=()=>{let t=sx(2),{EditButton:e}=ke(),o;return t[0]!==e?(o=e?ax(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as ux}from"react/compiler-runtime";import{jsx as dx}from"react/jsx-runtime";import"react";var mx=()=>{let t=ux(2),{RemoveButton:e}=ke(),o;return t[0]!==e?(o=e?dx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as px}from"react/compiler-runtime";import{jsx as fx}from"react/jsx-runtime";import"react";var hx=()=>{let t=px(2),{Label:e}=ke(),o;return t[0]!==e?(o=e?fx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as gx}from"react/compiler-runtime";import{jsx as xx}from"react/jsx-runtime";import"react";var Cx=t=>{let e=gx(3),{children:o}=t,{InlineBlockContainer:n}=ke(),r;return e[0]!==n||e[1]!==o?(r=n?xx(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{jsx as bx}from"react/jsx-runtime";import"react";var kx=t=>{let{children:e,...o}=t,{BlockCollapsible:n}=ae();return n?bx(n,{...o,children:e}):null};import{c as _x}from"react/compiler-runtime";import{jsx as Tx}from"react/jsx-runtime";import"react";var wx=()=>{let t=_x(2),{EditButton:e}=ae(),o;return t[0]!==e?(o=e?Tx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Sx}from"react/compiler-runtime";import{jsx as Ex}from"react/jsx-runtime";import"react";var Nx=()=>{let t=Sx(2),{RemoveButton:e}=ae(),o;return t[0]!==e?(o=e?Ex(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Lx}from"qs-esm";var yx=({apiURL:t,depth:e,draft:o,locale:n})=>async({id:l,collectionSlug:s,select:i})=>{let d=Lx({depth:e??0,draft:o??!1,locale:n,select:i},{addQueryPrefix:!0});return await fetch(`${t}/${s}/${l}${d}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(u=>u.json())};var Oc={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
|
|
61
61
|
`)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
|
|
62
62
|
`+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let n=o?.[1];return t.startsWith(`
|
|
63
63
|
`)&&(t=t.slice(1)),t.endsWith(`
|