@payloadcms/richtext-lexical 3.57.0-internal.1d2ebbc → 3.57.0-internal.266049e
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-PKJPWZJL.js → Field-BJACUMFU.js} +2 -2
- package/dist/exports/client/Field-BJACUMFU.js.map +7 -0
- package/dist/exports/client/bundled.css +1 -1
- package/dist/exports/client/{chunk-YCH4JNUH.js → chunk-SEPPJCZ6.js} +2 -2
- package/dist/exports/client/component-VDJI45F2.js +2 -0
- package/dist/exports/client/component-VDJI45F2.js.map +7 -0
- package/dist/exports/client/index.d.ts +2 -0
- package/dist/exports/client/index.d.ts.map +1 -1
- package/dist/exports/client/index.js +35 -10
- package/dist/exports/client/index.js.map +4 -4
- package/dist/features/align/server/i18n.d.ts.map +1 -1
- package/dist/features/align/server/i18n.js +6 -0
- package/dist/features/align/server/i18n.js.map +1 -1
- package/dist/features/blockquote/server/i18n.d.ts.map +1 -1
- package/dist/features/blockquote/server/i18n.js +3 -0
- package/dist/features/blockquote/server/i18n.js.map +1 -1
- package/dist/features/blocks/client/index.d.ts.map +1 -1
- package/dist/features/blocks/client/index.js +5 -0
- package/dist/features/blocks/client/index.js.map +1 -1
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts +6 -0
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.d.ts.map +1 -0
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js +24 -0
- package/dist/features/blocks/client/markdown/getLexicalToMarkdown.js.map +1 -0
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts +6 -0
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.d.ts.map +1 -0
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.js +20 -0
- package/dist/features/blocks/client/markdown/getMarkdownToLexical.js.map +1 -0
- package/dist/features/blocks/client/markdown/markdownTransformer.d.ts +12 -0
- package/dist/features/blocks/client/markdown/markdownTransformer.d.ts.map +1 -0
- package/dist/features/blocks/client/markdown/markdownTransformer.js +348 -0
- package/dist/features/blocks/client/markdown/markdownTransformer.js.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component.d.ts +53 -0
- package/dist/features/blocks/premade/CodeBlock/Component.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/Component.js +68 -0
- package/dist/features/blocks/premade/CodeBlock/Component.js.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/converter.d.ts +7 -0
- package/dist/features/blocks/premade/CodeBlock/converter.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/converter.js +46 -0
- package/dist/features/blocks/premade/CodeBlock/converter.js.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/converterClient.d.ts +2 -0
- package/dist/features/blocks/premade/CodeBlock/converterClient.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/converterClient.js +4 -0
- package/dist/features/blocks/premade/CodeBlock/converterClient.js.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/index.d.ts +7 -0
- package/dist/features/blocks/premade/CodeBlock/index.d.ts.map +1 -0
- package/dist/features/blocks/premade/CodeBlock/index.js +39 -0
- package/dist/features/blocks/premade/CodeBlock/index.js.map +1 -0
- package/dist/features/blocks/server/i18n.d.ts.map +1 -1
- package/dist/features/blocks/server/i18n.js +9 -0
- package/dist/features/blocks/server/i18n.js.map +1 -1
- package/dist/features/blocks/server/index.js +1 -1
- package/dist/features/blocks/server/index.js.map +1 -1
- package/dist/features/blocks/server/markdown/getLexicalToMarkdown.d.ts +6 -0
- package/dist/features/blocks/server/markdown/getLexicalToMarkdown.d.ts.map +1 -0
- package/dist/features/blocks/server/markdown/getLexicalToMarkdown.js +27 -0
- package/dist/features/blocks/server/markdown/getLexicalToMarkdown.js.map +1 -0
- package/dist/features/blocks/server/markdown/getMarkdownToLexical.d.ts +7 -0
- package/dist/features/blocks/server/markdown/getMarkdownToLexical.d.ts.map +1 -0
- package/dist/features/blocks/server/markdown/getMarkdownToLexical.js +22 -0
- package/dist/features/blocks/server/markdown/getMarkdownToLexical.js.map +1 -0
- package/dist/features/blocks/server/markdown/linesFromMatchToContentAndPropsString.d.ts.map +1 -0
- package/dist/features/blocks/server/markdown/linesFromMatchToContentAndPropsString.js.map +1 -0
- package/dist/features/blocks/server/markdown/markdownTransformer.d.ts +15 -0
- package/dist/features/blocks/server/markdown/markdownTransformer.d.ts.map +1 -0
- package/dist/features/blocks/server/{markdownTransformer.js → markdown/markdownTransformer.js} +6 -48
- package/dist/features/blocks/server/markdown/markdownTransformer.js.map +1 -0
- package/dist/features/heading/client/index.d.ts.map +1 -1
- package/dist/features/heading/client/index.js +60 -0
- package/dist/features/heading/client/index.js.map +1 -1
- package/dist/features/heading/server/i18n.d.ts.map +1 -1
- package/dist/features/heading/server/i18n.js +3 -0
- package/dist/features/heading/server/i18n.js.map +1 -1
- package/dist/features/heading/server/index.d.ts.map +1 -1
- package/dist/features/heading/server/index.js +1 -0
- package/dist/features/heading/server/index.js.map +1 -1
- package/dist/features/horizontalRule/server/i18n.d.ts.map +1 -1
- package/dist/features/horizontalRule/server/i18n.js +3 -0
- package/dist/features/horizontalRule/server/i18n.js.map +1 -1
- package/dist/features/indent/server/i18n.d.ts.map +1 -1
- package/dist/features/indent/server/i18n.js +4 -0
- package/dist/features/indent/server/i18n.js.map +1 -1
- package/dist/features/link/server/i18n.d.ts.map +1 -1
- package/dist/features/link/server/i18n.js +4 -0
- package/dist/features/link/server/i18n.js.map +1 -1
- package/dist/features/lists/checklist/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/checklist/server/i18n.js +3 -0
- package/dist/features/lists/checklist/server/i18n.js.map +1 -1
- package/dist/features/lists/orderedList/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/orderedList/server/i18n.js +3 -0
- package/dist/features/lists/orderedList/server/i18n.js.map +1 -1
- package/dist/features/lists/unorderedList/server/i18n.d.ts.map +1 -1
- package/dist/features/lists/unorderedList/server/i18n.js +3 -0
- package/dist/features/lists/unorderedList/server/i18n.js.map +1 -1
- package/dist/features/paragraph/server/i18n.d.ts.map +1 -1
- package/dist/features/paragraph/server/i18n.js +4 -0
- package/dist/features/paragraph/server/i18n.js.map +1 -1
- package/dist/features/relationship/server/i18n.d.ts.map +1 -1
- package/dist/features/relationship/server/i18n.js +3 -0
- package/dist/features/relationship/server/i18n.js.map +1 -1
- package/dist/features/textState/i18n.d.ts.map +1 -1
- package/dist/features/textState/i18n.js +3 -0
- package/dist/features/textState/i18n.js.map +1 -1
- package/dist/features/upload/client/component/index.d.ts +2 -0
- package/dist/features/upload/client/component/index.d.ts.map +1 -1
- package/dist/features/upload/client/component/index.js +28 -24
- package/dist/features/upload/client/component/index.js.map +1 -1
- package/dist/features/upload/client/component/pending/index.d.ts +3 -0
- package/dist/features/upload/client/component/pending/index.d.ts.map +1 -0
- package/dist/features/upload/client/{pendingComponent → component/pending}/index.js +1 -1
- package/dist/features/upload/client/component/pending/index.js.map +1 -0
- package/dist/features/upload/client/index.d.ts.map +1 -1
- package/dist/features/upload/client/index.js +1 -2
- package/dist/features/upload/client/index.js.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/client/nodes/UploadNode.js +6 -0
- package/dist/features/upload/client/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/client/plugin/index.d.ts +6 -0
- package/dist/features/upload/client/plugin/index.d.ts.map +1 -1
- package/dist/features/upload/client/plugin/index.js +67 -31
- package/dist/features/upload/client/plugin/index.js.map +1 -1
- package/dist/features/upload/server/i18n.d.ts.map +1 -1
- package/dist/features/upload/server/i18n.js +3 -0
- package/dist/features/upload/server/i18n.js.map +1 -1
- package/dist/features/upload/server/index.d.ts.map +1 -1
- package/dist/features/upload/server/index.js +1 -4
- package/dist/features/upload/server/index.js.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.d.ts +16 -0
- package/dist/features/upload/server/nodes/UploadNode.d.ts.map +1 -1
- package/dist/features/upload/server/nodes/UploadNode.js +9 -2
- package/dist/features/upload/server/nodes/UploadNode.js.map +1 -1
- package/dist/features/upload/server/nodes/conversions.d.ts +0 -3
- package/dist/features/upload/server/nodes/conversions.d.ts.map +1 -1
- package/dist/features/upload/server/nodes/conversions.js +20 -20
- package/dist/features/upload/server/nodes/conversions.js.map +1 -1
- package/dist/field/Field.d.ts.map +1 -1
- package/dist/field/Field.js +1 -1
- package/dist/field/Field.js.map +1 -1
- package/dist/field/bundled.css +1 -1
- package/dist/i18n.d.ts.map +1 -1
- package/dist/i18n.js +6 -0
- package/dist/i18n.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/utilities/jsx/collectTopLevelJSXInLines.js +2 -2
- package/dist/utilities/jsx/collectTopLevelJSXInLines.js.map +1 -1
- package/package.json +7 -7
- package/dist/exports/client/Field-PKJPWZJL.js.map +0 -7
- package/dist/exports/client/component-3PENNOM3.js +0 -2
- package/dist/exports/client/component-3PENNOM3.js.map +0 -7
- package/dist/exports/client/pendingComponent-WFSCE6LJ.js +0 -2
- package/dist/exports/client/pendingComponent-WFSCE6LJ.js.map +0 -7
- package/dist/features/blocks/client/markdownTransformer.d.ts +0 -17
- package/dist/features/blocks/client/markdownTransformer.d.ts.map +0 -1
- package/dist/features/blocks/client/markdownTransformer.js +0 -144
- package/dist/features/blocks/client/markdownTransformer.js.map +0 -1
- package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.d.ts.map +0 -1
- package/dist/features/blocks/server/linesFromMatchToContentAndPropsString.js.map +0 -1
- package/dist/features/blocks/server/markdownTransformer.d.ts +0 -22
- package/dist/features/blocks/server/markdownTransformer.d.ts.map +0 -1
- package/dist/features/blocks/server/markdownTransformer.js.map +0 -1
- package/dist/features/upload/client/nodes/PendingUploadNode.d.ts +0 -17
- package/dist/features/upload/client/nodes/PendingUploadNode.d.ts.map +0 -1
- package/dist/features/upload/client/nodes/PendingUploadNode.js +0 -57
- package/dist/features/upload/client/nodes/PendingUploadNode.js.map +0 -1
- package/dist/features/upload/client/pendingComponent/index.d.ts +0 -7
- package/dist/features/upload/client/pendingComponent/index.d.ts.map +0 -1
- package/dist/features/upload/client/pendingComponent/index.js.map +0 -1
- package/dist/features/upload/server/nodes/PendingUploadNode.d.ts +0 -42
- package/dist/features/upload/server/nodes/PendingUploadNode.d.ts.map +0 -1
- package/dist/features/upload/server/nodes/PendingUploadNode.js +0 -92
- package/dist/features/upload/server/nodes/PendingUploadNode.js.map +0 -1
- /package/dist/exports/client/{chunk-YCH4JNUH.js.map → chunk-SEPPJCZ6.js.map} +0 -0
- /package/dist/features/blocks/server/{linesFromMatchToContentAndPropsString.d.ts → markdown/linesFromMatchToContentAndPropsString.d.ts} +0 -0
- /package/dist/features/blocks/server/{linesFromMatchToContentAndPropsString.js → markdown/linesFromMatchToContentAndPropsString.js} +0 -0
|
@@ -1,6 +1,26 @@
|
|
|
1
|
-
"use client";import{a as
|
|
1
|
+
"use client";import{a as fe,c as it,d as st,e as at}from"./chunk-3BY5IZJD.js";import{a as ut}from"./chunk-DBWINSQN.js";import{a as ct,b as Ut,c as Ge}from"./chunk-CYLMY5ZJ.js";import{a as pe}from"./chunk-INBEEENE.js";import{a as Va}from"./chunk-F26IQ5RE.js";import{b as jt,c as Ht,d as re,e as Wt,f as Ka,g as Ja,i as Xa,k as za,l as Za}from"./chunk-SEPPJCZ6.js";import{a as Ga,b as j}from"./chunk-BZZVLW4U.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as Se,$isRangeSelection as Vt,FORMAT_ELEMENT_COMMAND as Kt}from"lexical";import{jsx as Mo,jsxs as Ya}from"react/jsx-runtime";import"react";var zr=()=>Ya("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Mo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Mo("path",{d:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Do,jsxs as qa}from"react/jsx-runtime";import"react";var Zr=()=>qa("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Do("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Do("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Do("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Ao,jsxs as Qa}from"react/jsx-runtime";import"react";var Gt=()=>Qa("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ao("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ao("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Ao("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Oo,jsxs as ec}from"react/jsx-runtime";import"react";var Yr=()=>ec("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Oo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Oo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),Oo("path",{d:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var M=t=>o=>{let r={clientFeatureProps:o};if(typeof t=="function")r.feature=({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a})=>{let m=t({config:n,featureClientImportMap:l,featureClientSchemaMap:i,featureProviderMap:s,field:u,props:o,resolvedFeatures:c,schemaPath:d,unSanitizedEditorConfig:a});return m.sanitizedClientFeatureProps===null&&(m.sanitizedClientFeatureProps=o),m};else{let n={...t};n.sanitizedClientFeatureProps=o,r.feature=n}return r};var qr=t=>({type:"dropdown",ChildComponent:Gt,items:t,key:"align",order:30});var Qr=[qr([{ChildComponent:Gt,isActive:({selection:t})=>{if(!Vt(t))return!1;for(let e of t.getNodes()){if(Se(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(Se(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Kt,"left")},order:1},{ChildComponent:zr,isActive:({selection:t})=>{if(!Vt(t))return!1;for(let e of t.getNodes()){if(Se(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(Se(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Kt,"center")},order:2},{ChildComponent:Yr,isActive:({selection:t})=>{if(!Vt(t))return!1;for(let e of t.getNodes()){if(Se(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(Se(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Kt,"right")},order:3},{ChildComponent:Zr,isActive:({selection:t})=>{if(!Vt(t))return!1;for(let e of t.getNodes()){if(Se(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(Se(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Kt,"justify")},order:4}])],tc=M({toolbarFixed:{groups:Qr},toolbarInline:{groups:Qr}});import{$createQuoteNode as sn,$isQuoteNode as nn,QuoteNode as nc}from"@lexical/rich-text";import{$setBlocksType as an}from"@lexical/selection";import{$getSelection as cn,$isRangeSelection as lc}from"lexical";import{jsx as en}from"react/jsx-runtime";import"react";var $o=()=>en("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:en("path",{d:"M13.5353 10.5725C13.5353 9.47709 11.0456 9.99991 11.0456 7.85883C11.0456 6.46464 12.1162 5.61816 13.361 5.61816C14.805 5.61816 16 6.86298 16 8.92937C16 11.2945 14.4564 13.7841 11.1203 14.3816L10.8216 13.1368C12.888 12.4895 13.5353 11.4937 13.5353 10.5725ZM6.71369 10.5725C6.71369 9.47709 4.22407 9.99991 4.22407 7.85883C4.22407 6.46464 5.29461 5.61816 6.53942 5.61816C7.9834 5.61816 9.17842 6.86298 9.17842 8.92937C9.17842 11.2945 7.63485 13.7841 4.29876 14.3816L4 13.1368C6.06639 12.4895 6.71369 11.4937 6.71369 10.5725Z",fill:"currentColor"})});import{jsx as tn}from"react/jsx-runtime";import"react";var dt=()=>tn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:tn("path",{d:"M11.708 14.5H7.79785V13.9414H8.01367C9.00391 13.9414 9.15625 13.9033 9.15625 13.6113V6.70508H8.07715C6.82031 6.70508 6.73145 7.08594 6.28711 8.67285H5.80469L5.91895 6.12109H13.5869L13.7012 8.67285H13.2188C12.7744 7.08594 12.6855 6.70508 11.4287 6.70508H10.3496V13.6113C10.3496 13.9033 10.502 13.9414 11.4922 13.9414H11.708V14.5Z",fill:"currentColor"})});var Q=t=>({type:"dropdown",ChildComponent:dt,items:t,key:"text",order:25});import{$createQuoteNode as oc,$isQuoteNode as on,QuoteNode as rc}from"@lexical/rich-text";var rn={type:"element",dependencies:[rc],export:(t,e)=>{if(!on(t))return null;let o=e(t).split(`
|
|
2
2
|
`),r=[];for(let n of o)r.push("> "+n);return r.join(`
|
|
3
|
-
`)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(rn(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=Ka();n.append(...e),t.replace(n),n.select(0,0)}};var sn=[Q([{ChildComponent:Do,isActive:({selection:t})=>{if(!za(t))return!1;for(let e of t.getNodes())if(!ln(e)&&!ln(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=un();cn(e,()=>an())})},order:20}])],Za=v({markdownTransformers:[nn],nodes:[Xa],slashMenu:{groups:[Z([{Icon:Do,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=un();cn(e,()=>an())})}}])]},toolbarFixed:{groups:sn},toolbarInline:{groups:sn}});import{getTranslation as Xt}from"@payloadcms/translations";import{jsx as Mo,jsxs as Ya}from"react/jsx-runtime";import"react";var jt=()=>Ya("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Mo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Mo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as dn}from"react/jsx-runtime";import"react";var Ut=()=>dn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dn("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as qa}from"react/jsx-runtime";import"react";function Gt(t,e){return t?()=>qa("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):jt}import{jsx as yc}from"react/jsx-runtime";import Ic from"bson-objectid";import"react";import{DecoratorBlockNode as Qa}from"@lexical/react/LexicalDecoratorBlockNode.js";import ec from"bson-objectid";var st=class extends Qa{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),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=tc(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function tc(t){return new st({fields:{...t,id:t?.id||new ec.default().toHexString()}})}import{jsx as K,jsxs as at,Fragment as ac}from"react/jsx-runtime";import{Button as hn,Collapsible as cc,Drawer as uc,EditDepthProvider as dc,ErrorPill as mc,Form as pc,formatDrawerSlug as fc,FormSubmit as hc,Pill as gc,RenderFields as xc,SectionTitle as Cc,useConfig as bc,useDocumentForm as kc,useDocumentInfo as gn,useEditDepth as _c,useFormSubmitted as Tc,useServerFunctions as wc,useTranslation as Ec}from"@payloadcms/ui";import{abortAndIgnore as Oo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Vt,reduceFieldsToValues as xn}from"payload/shared";import ct,{useCallback as Ao,useEffect as $o,useMemo as ut,useRef as Fo}from"react";import{useLexicalComposerContext as Sc}from"@lexical/react/LexicalComposerContext";import{getTranslation as Nc}from"@payloadcms/translations";import{$getNodeByKey as Kt}from"lexical";import{v4 as Lc}from"uuid";import{c as oc}from"react/compiler-runtime";import{jsx as Wt,jsxs as rc}from"react/jsx-runtime";import{RenderFields as nc,useFormSubmitted as lc}from"@payloadcms/ui";import ic,{createContext as sc}from"react";var mn=sc({initialState:!1}),De=()=>ic.use(mn),pn=t=>{let e=oc(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:l,errorCount:i,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,p=lc()&&i>0,m;e[0]!==r||e[1]!==i||e[2]!==p?(m=g=>Wt(r,{editButton:g.editButton,errorCount:i,fieldHasErrors:p,Label:g.Label,removeButton:g.removeButton,children:g.children}),e[0]=r,e[1]=i,e[2]=p,e[3]=m):m=e[3];let f=m,h;return e[4]!==o||e[5]!==f||e[6]!==n||e[7]!==l||e[8]!==d||e[9]!==s||e[10]!==u||e[11]!==c?(h=n?rc(mn,{value:{BlockCollapsible:f,EditButton:l,initialState:u,nodeKey:c,RemoveButton:d},children:[n,Wt(o,{})]}):Wt(f,{children:Wt(nc,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=f,e[6]=n,e[7]=l,e[8]=d,e[9]=s,e[10]=u,e[11]=c,e[12]=h):h=e[12],h};function fn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var ne="lexical-block",Cn=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=Tc(),{id:l,collectionSlug:i,globalSlug:s}=gn(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:p,schemaPath:m},uuid:f}=H(),{fields:h}=kc(),g=Fo(new AbortController),b=_c(),[T,E]=ct.useState(0),{config:C}=bc(),k=fc({slug:`lexical-blocks-create-${f}-${o.id}`,depth:b}),{toggleDrawer:x}=me(k),{getDocPreferences:w,setDocFieldPreferences:S}=gn(),[O]=Sc(),{getFormState:$}=wc(),R=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[N,_]=ct.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),L=Fo(!1),D=Fo(e);$o(()=>{L.current?(D.current!==e&&_(!1),D.current=e):L.current=!0},[e]);let[I,M]=ct.useState(N?._components?.customComponents?.BlockLabel),[y,F]=ct.useState(N?._components?.customComponents?.Block);$o(()=>{let j=new AbortController;return o&&!N&&(async()=>{let{state:W}=await $({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Vt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:R,signal:j.signal});if(W){W.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let z=xn(Vt(W),!0);O.update(()=>{let V=Kt(r);if(V&&dt(V)){let oe=z;oe.blockType=o.blockType,V.setFields(oe,!0)}}),_(W),M(W._components?.customComponents?.BlockLabel),F(W._components?.customComponents?.Block)}})(),()=>{Oo(j)}},[$,R,l,o,O,r,N,i,s,w,h]);let[G,q]=ct.useState(d?.[o.id]?.collapsed??!1),te=`${m}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,X=u.blocks?.[te]?.[0],U=X.blockReferences?typeof X?.blockReferences?.[0]=="string"?C.blocksMap[X?.blockReferences?.[0]]:X?.blockReferences?.[0]:X?.blocks?.[0],{i18n:He,t:Ee}=Ec(),de=Ao(async({formState:j,submit:se})=>{Oo(g.current);let W=new AbortController;g.current=W;let{state:z}=await $({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Vt(h),formState:j,globalSlug:s,initialBlockFormState:j,operation:"update",renderAllFields:!!se,schemaPath:R,signal:W.signal});if(!z)return j;j.blockName&&(z.blockName=j.blockName);let V=xn(fn({fields:Vt(z)}),!0);if(setTimeout(()=>{O.update(()=>{let oe=Kt(r);if(oe&&dt(oe)){let Ue=V;Ue.blockType=o.blockType,oe.setFields(Ue,!0)}})},0),se){M(z._components?.customComponents?.BlockLabel),F(z._components?.customComponents?.Block);let oe=0;for(let Ue of Object.values(z))Ue?.valid===!1&&oe++;E(oe)}return z},[$,l,i,w,s,R,o.blockType,h,O,r]);$o(()=>()=>{Oo(g.current)},[]);let Mt=Ao(()=>{O.update(()=>{Kt(r)?.remove()})},[O,r]),Se=U?.labels?.singular?Nc(U.labels.singular,He):U?.slug,Ot=Ao(j=>{w().then(se=>{let z=se?.fields?.[c.name]?.collapsed,V=z&&z?.length?z:[];j?V.includes(o.id)||V.push(o.id):V.includes(o.id)&&V.splice(V.indexOf(o.id),1),S(c.name,{collapsed:V,hello:"hi"})})},[w,c.name,S,o.id]),je=ut(()=>()=>K(hn,{buttonStyle:"icon-label",className:`${ne}__editButton`,disabled:p,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),x(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:Ee("lexical:blocks:inlineBlocks:edit",{label:Se})}),[Se,p,Ee,x]),At=ut(()=>()=>K(hn,{buttonStyle:"icon-label",className:`${ne}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),Mt()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,Mt]),Eo=ut(()=>({children:j,disableBlockName:se,editButton:W,errorCount:z,fieldHasErrors:V,Label:oe,removeButton:Ue})=>K("div",{className:ne+" "+ne+"-"+o.blockType,children:K(cc,{className:[`${ne}__row`,V?`${ne}__row--has-errors`:`${ne}__row--no-errors`].join(" "),collapsibleStyle:V?"error":"default",header:at("div",{className:`${ne}__block-header`,children:[oe??I?oe??I:at("div",{children:[K(gc,{className:`${ne}__block-pill ${ne}__block-pill-${o?.blockType}`,pillStyle:"white",size:"small",children:Se??o?.blockType}),!se&&!U?.admin?.disableBlockName&&K(Cc,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),V&&K(mc,{count:z??0,i18n:He,withMessage:!0})]}),at("div",{children:[y&&W!==!1||!y&&W?K(je,{}):null,Ue!==!1&&O.isEditable()?K(At,{}):null]})]}),isCollapsed:G,onToggle:Jr=>{Ot(Jr),q(Jr)},children:j},0)}),[y,I,je,At,Se,U?.admin?.disableBlockName,O,o.blockType,He,G,Ot,c?.admin?.readOnly]),Kr=ut(()=>()=>K(dc,{children:K(uc,{className:"",slug:k,title:Ee(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:Se??Ee("lexical:blocks:inlineBlocks:label")}),children:N?at(ac,{children:[K(xc,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:R,permissions:!0,readOnly:!1}),K(hc,{programmaticSubmit:!0,children:Ee("fields:saveChanges")})]}):null})}),[N,k,Se,Ee,U?.fields,R,a]),Ma=ut(()=>N?K(pc,{beforeSubmit:[async({formState:j})=>await de({formState:j,submit:!0})],el:"div",fields:U?.fields??[],initialState:N,onChange:[de],onSubmit:(j,se)=>{se.blockType=o.blockType,O.update(()=>{let W=Kt(r);W&&dt(W)&&W.setFields(se,!0)}),x()},submitted:n,uuid:Lc(),children:K(pn,{baseClass:ne,BlockDrawer:Kr,Collapsible:Eo,CustomBlock:y,EditButton:je,errorCount:T,formSchema:U?.fields??[],initialState:N,nodeKey:r,RemoveButton:At})}):null,[Eo,Kr,y,U?.fields,At,je,O,T,x,U?.fields,N,r,de,n]);return U?Ma:K(Eo,{disableBlockName:!0,fieldHasErrors:!0,children:at("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var fe=class extends st{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=Jt(e.fields);return o.setFormat(e.format),o}decorate(e,o){return yc(Cn,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Jt(t){return new fe({fields:{...t,id:t?.id||new Ic.default().toHexString()}})}function dt(t){return t instanceof fe}import{createCommand as bn}from"lexical";var We=bn("INSERT_BLOCK_COMMAND"),Ve=bn("INSERT_INLINE_BLOCK_COMMAND");import{c as Rc}from"react/compiler-runtime";import{useLexicalComposerContext as vc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Dc,$wrapNodeInElement as Mc,mergeRegister as Oc}from"@lexical/utils";import{formatDrawerSlug as Ac,useEditDepth as $c}from"@payloadcms/ui";import{$createParagraphNode as Fc,$getNodeByKey as Pc,$getPreviousSelection as Bc,$getSelection as Hc,$insertNodes as jc,$isParagraphNode as Uc,$isRangeSelection as Gc,$isRootOrShadowRoot as Wc,COMMAND_PRIORITY_EDITOR as kn}from"lexical";import{useEffect as Vc,useState as Kc}from"react";var _n=()=>{let t=Rc(12),[e]=vc(),[o,r]=Kc(null),{setCreatedInlineBlock:n,uuid:l}=H(),i=$c(),s="lexical-inlineBlocks-create-"+l,u;t[0]!==i||t[1]!==s?(u=Ac({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=me(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([fe]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Oc(e.registerCommand(We,m=>(e.update(()=>{let f=Hc()||Bc();if(Gc(f)){let h=Jt(m),{focus:g}=f,b=g.getNode();Dc(h),Uc(b)&&!b.__first&&b.remove()}}),!0),kn),e.registerCommand(Ve,m=>{if(o){let h=Pc(o);return!h||!Lo(h)?!1:(h.setFields(m),r(null),!0)}let f=No(m);return n?.(f),jc([f]),Wc(f.getParentOrThrow())&&Mc(f,Fc).selectEnd(),!0},kn))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let p;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(p=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=p):p=t[11],Vc(a,p),null};var Jc=v(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),d=u.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{nodes:[fe,So],plugins:[{Component:_n,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:Gt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:p})=>a?.labels?.singular?Xt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(We,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Ut,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:p})=>a?.labels?.singular?Xt(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ve,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:jt,items:c.map((a,p)=>({ChildComponent:Gt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Xt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(We,{blockName:"",blockType:a.slug})},order:p})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Ut,items:d.map((a,p)=>({ChildComponent:a.imageURL?Gt(a.imageURL,a.imageAltText):Ut,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:m})=>a?.labels?.singular?Xt(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ve,{blockName:"",blockType:a.slug})},order:p})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Zc}from"react/compiler-runtime";import{jsx as Oe,jsxs as jo}from"react/jsx-runtime";import{useLexicalComposerContext as Yc}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as qc,$createTextNode as Qc,$getRoot as eu,getDOMSelection as Po}from"lexical";import*as Nn from"react";import{useCallback as Me,useEffect as Bo,useLayoutEffect as wn,useRef as Ho,useState as zt}from"react";var Xc=re&&"documentMode"in document?document.documentMode:null,Tn=re&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),F2=re&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),P2=re&&"InputEvent"in window&&!Xc?"getTargetRanges"in new window.InputEvent("input"):!1,B2=re&&/Version\/[\d.].*Safari/.test(navigator.userAgent),H2=re&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,j2=re&&/Android/.test(navigator.userAgent),U2=re&&/Win/.test(navigator.platform),zc=re&&/^(?=.*Chrome).*/i.test(navigator.userAgent),G2=re&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!zc;var tu=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},ou=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},ru=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
3
|
+
`)},regExp:/^>\s/,replace:(t,e,o,r)=>{if(r){let l=t.getPreviousSibling();if(on(l)){l.splice(l.getChildrenSize(),0,[...e]),l.select(0,0),t.remove();return}}let n=oc();n.append(...e),t.replace(n),n.select(0,0)}};var ln=[Q([{ChildComponent:$o,isActive:({selection:t})=>{if(!lc(t))return!1;for(let e of t.getNodes())if(!nn(e)&&!nn(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=cn();an(e,()=>sn())})},order:20}])],ic=M({markdownTransformers:[rn],nodes:[nc],slashMenu:{groups:[Z([{Icon:$o,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=cn();an(e,()=>sn())})}}])]},toolbarFixed:{groups:ln},toolbarInline:{groups:ln}});import{getTranslation as oo}from"@payloadcms/translations";import{jsx as Fo,jsxs as sc}from"react/jsx-runtime";import"react";var Jt=()=>sc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"8",y:"5"}),Fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"5",y:"11"}),Fo("rect",{height:"4",rx:"0.5",stroke:"currentColor",width:"4",x:"11",y:"11"})]});import{jsx as un}from"react/jsx-runtime";import"react";var Xt=()=>un("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:un("path",{clipRule:"evenodd",d:"M5.33333 6.5C5.11232 6.5 4.90036 6.5878 4.74408 6.74408C4.5878 6.90036 4.5 7.11232 4.5 7.33333V12.1667C4.5 12.3877 4.5878 12.5996 4.74408 12.7559C4.90036 12.9122 5.11232 13 5.33333 13H14.6667C14.8877 13 15.0996 12.9122 15.2559 12.7559C15.4122 12.5996 15.5 12.3877 15.5 12.1667V11.6667C15.5 11.3905 15.7239 11.1667 16 11.1667C16.2761 11.1667 16.5 11.3905 16.5 11.6667V12.1667C16.5 12.6529 16.3068 13.1192 15.963 13.463C15.6192 13.8068 15.1529 14 14.6667 14H5.33333C4.8471 14 4.38079 13.8068 4.03697 13.463C3.69315 13.1192 3.5 12.6529 3.5 12.1667V7.33333C3.5 6.8471 3.69315 6.38079 4.03697 6.03697C4.38079 5.69315 4.8471 5.5 5.33333 5.5H10.3333C10.6095 5.5 10.8333 5.72386 10.8333 6C10.8333 6.27614 10.6095 6.5 10.3333 6.5H5.33333ZM13 6.5C12.7239 6.5 12.5 6.27614 12.5 6C12.5 5.72386 12.7239 5.5 13 5.5H16C16.2761 5.5 16.5 5.72386 16.5 6V9C16.5 9.27614 16.2761 9.5 16 9.5C15.7239 9.5 15.5 9.27614 15.5 9V7.20711L13.3536 9.35355C13.1583 9.54882 12.8417 9.54882 12.6464 9.35355C12.4512 9.15829 12.4512 8.84171 12.6464 8.64645L14.7929 6.5H13ZM6.16699 8.33325C6.16699 8.05711 6.39085 7.83325 6.66699 7.83325H11.0003C11.2765 7.83325 11.5003 8.05711 11.5003 8.33325C11.5003 8.60939 11.2765 8.83325 11.0003 8.83325H6.66699C6.39085 8.83325 6.16699 8.60939 6.16699 8.33325ZM6.16699 10.9999C6.16699 10.7238 6.39085 10.4999 6.66699 10.4999H13.3337C13.6098 10.4999 13.8337 10.7238 13.8337 10.9999C13.8337 11.2761 13.6098 11.4999 13.3337 11.4999H6.66699C6.39085 11.4999 6.16699 11.2761 6.16699 10.9999Z",fill:"currentColor",fillRule:"evenodd"})});import{jsx as ac}from"react/jsx-runtime";import"react";function zt(t,e){return t?()=>ac("img",{alt:e??"Block Image",className:"lexical-block-custom-image",src:t,style:{maxHeight:20,maxWidth:20}}):Jt}import{$parseSerializedNode as kn}from"lexical";import{JSOX as Po}from"jsox";function Zt({propsString:t}){let e={},o="",r=!0;for(let n=0;n<t.length;n++){let l=t[n];if(r)l==="="||l===" "?o&&(l===" "?(e[o]=!0,o=""):r=!1):o+=l;else{let i=cc(t,n);e[o]=i.value,n=i.newIndex,o="",r=!0}}return o&&(e[o]=!0),e}function cc(t,e){let o=t[e];return o==='"'?dn(t,e):o==="'"?dn(t,e,!0):o==="{"?dc(t,e):o==="["?uc(t,e):pc(t,e)}function uc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="["?o++:t[n]==="]"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:Po.parse(`[${r}]`)}}function dn(t,e,o=!1){let r="",n=e+1;for(;n<t.length&&(t[n]!==(o?"'":'"')||t[n-1]==="\\");)r+=t[n],n++;return{newIndex:n,value:r}}function dc(t,e){let o=1,r="",n=e+1;for(;n<t.length&&o>0;)t[n]==="{"?o++:t[n]==="}"&&o--,o>0&&(r+=t[n]),n++;return{newIndex:n,value:mc(r)}}function mc(t){return t[0]!=="{"?Po.parse(t):Po.parse(t.replace(/(\w+):/g,'"$1":'))}function pc(t,e){let o="",r=e;for(;r<t.length&&t[r]!==" ";)o+=t[r],r++;return{newIndex:r-1,value:o}}function mt({props:t}){let e=[];for(let[o,r]of Object.entries(t))typeof r=="string"?e.push(`${o}="${fc(r)}"`):typeof r=="number"?e.push(`${o}={${r}}`):typeof r=="boolean"?r&&e.push(`${o}`):r!==null&&typeof r=="object"&&(Array.isArray(r)?e.push(`${o}={[${r.map(n=>JSON.stringify(n,mn)).join(", ")}]}`):e.push(`${o}={${JSON.stringify(r,mn)}}`));return e.join(" ")}function fc(t){return t.replace(/"/g,""")}function mn(t,e){return typeof e=="string"?e.replace(/'/g,"\\'"):e}function Yt({isEndOptional:t,lines:e,regexpEndRegex:o,startLineIndex:r,startMatch:n,trimChildren:l}){let i="",s="",u=e.slice(r),c=!1,d=0,a=0,m=null,p=!1,f=0,h=u[0].slice(0,n.index),g=0,C=r;e:for(let[S,b]of u.entries()){let k=l?b.trim():b,x=0;if(l)for(let T=0;T<b.length&&b[T]===" ";T++)x++;let w=0;for(S===0&&(w=(n.index??0)+n[0].length-x);w<k.length;){let T=k[w],y=k[w+1];if(c){if(T==="`"&&f++,f%2===0)if(T==="<"&&y==="/"){if(d--,d<0){s[s.length-1]===`
|
|
4
|
+
`&&(s=s.slice(0,-1)),C=S;for(let $=w;$<k.length;$++)if(k[$]===">"){g=$+1;break}break e}}else if(T==="/"&&y===">"){if(d--,d<0){s[s.length-1]===`
|
|
5
|
+
`&&(s=s.slice(0,-1)),C=S,g=w+2;break e}}else T==="<"&&y!=="/"&&d++;s+=T}else{if(T==="{"&&!m?a++:T==="}"&&!m?a--:(T==='"'||T==="'")&&!m?m=T:T===m&&(m=null),T==="/"&&y===">"&&a===0&&!m){p=!0,C=S,g=w+2;break e}else if(T===">"&&a===0&&!m){c=!0,w++;continue}i+=T}w++}if(c?s?.length>0&&S>0&&(s+=`
|
|
6
|
+
`):i+=`
|
|
7
|
+
`,o&&d<0){let T=k.match(o);if(T?.index!==void 0){C=S,g=T.index+T[0].length-1;break}}if(S===u.length-1&&!t&&!p)throw new Error("End match not found for lines "+e.join(`
|
|
8
|
+
`)+`
|
|
9
|
+
|
|
10
|
+
. Start match: `+JSON.stringify(n))}return{afterEndLine:u[C].trim().slice(g),beforeStartLine:h,content:s,endLineIndex:r+C,endlineLastCharIndex:g,propsString:i}}import{jsx as Gc}from"react/jsx-runtime";import Vc from"bson-objectid";import"react";import{DecoratorBlockNode as hc}from"@lexical/react/LexicalDecoratorBlockNode.js";import gc from"bson-objectid";var pt=class extends hc{__cacheBuster;__fields;constructor({cacheBuster:e,fields:o,format:r,key:n}){super(r,n),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=xc(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getCacheBuster(){return this.getLatest().__cacheBuster}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e,o){let r=this.getWritable();r.__fields=e,o||r.__cacheBuster++}};function xc(t){return new pt({fields:{...t,id:t?.id||new gc.default().toHexString()}})}import{jsx as K,jsxs as ft,Fragment as Ec}from"react/jsx-runtime";import{Button as gn,Collapsible as Sc,Drawer as Nc,EditDepthProvider as Lc,ErrorPill as yc,Form as Rc,formatDrawerSlug as Ic,FormSubmit as vc,Pill as Mc,RenderFields as Dc,SectionTitle as Ac,useConfig as Oc,useDocumentForm as $c,useDocumentInfo as xn,useEditDepth as Fc,useFormSubmitted as Pc,useServerFunctions as Bc,useTranslation as jc}from"@payloadcms/ui";import{abortAndIgnore as Bo}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as Qt,reduceFieldsToValues as Cn}from"payload/shared";import ht,{useCallback as jo,useEffect as Ho,useMemo as gt,useRef as Uo}from"react";import{useLexicalComposerContext as Hc}from"@lexical/react/LexicalComposerContext";import{getTranslation as Uc}from"@payloadcms/translations";import{$getNodeByKey as eo}from"lexical";import{v4 as Wc}from"uuid";import{c as Cc}from"react/compiler-runtime";import{jsx as qt,jsxs as bc}from"react/jsx-runtime";import{RenderFields as kc,useFormSubmitted as _c}from"@payloadcms/ui";import Tc,{createContext as wc}from"react";var pn=wc({initialState:!1}),ve=()=>Tc.use(pn),fn=t=>{let e=Cc(13),{BlockDrawer:o,Collapsible:r,CustomBlock:n,EditButton:l,errorCount:i,formSchema:s,initialState:u,nodeKey:c,RemoveButton:d}=t,m=_c()&&i>0,p;e[0]!==r||e[1]!==i||e[2]!==m?(p=g=>qt(r,{editButton:g.editButton,errorCount:i,fieldHasErrors:m,Label:g.Label,removeButton:g.removeButton,children:g.children}),e[0]=r,e[1]=i,e[2]=m,e[3]=p):p=e[3];let f=p,h;return e[4]!==o||e[5]!==f||e[6]!==n||e[7]!==l||e[8]!==d||e[9]!==s||e[10]!==u||e[11]!==c?(h=n?bc(pn,{value:{BlockCollapsible:f,EditButton:l,initialState:u,nodeKey:c,RemoveButton:d},children:[n,qt(o,{})]}):qt(f,{children:qt(kc,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=f,e[6]=n,e[7]=l,e[8]=d,e[9]=s,e[10]=u,e[11]=c,e[12]=h):h=e[12],h};function hn({fields:t}){for(let e in t){let o=t[e];Array.isArray(o?.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var le="lexical-block",bn=t=>{let{cacheBuster:e,formData:o,nodeKey:r}=t,n=Pc(),{id:l,collectionSlug:i,globalSlug:s}=xn(),{fieldProps:{featureClientSchemaMap:u,field:c,initialLexicalFormState:d,permissions:a,readOnly:m,schemaPath:p},uuid:f}=j(),{fields:h}=$c(),g=Uo(new AbortController),C=Fc(),[_,S]=ht.useState(0),{config:b}=Oc(),k=Ic({slug:`lexical-blocks-create-${f}-${o.id}`,depth:C}),{toggleDrawer:x}=pe(k),{getDocPreferences:w,setDocFieldPreferences:T}=xn(),[y]=Hc(),{getFormState:$}=Bc(),v=`${p}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}.fields`,[N,E]=ht.useState(()=>d?.[o.id]?.formState?{...d?.[o.id]?.formState,blockName:{initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName}}:!1),L=Uo(!1),D=Uo(e);Ho(()=>{L.current?(D.current!==e&&E(!1),D.current=e):L.current=!0},[e]);let[I,A]=ht.useState(N?._components?.customComponents?.BlockLabel),[R,F]=ht.useState(N?._components?.customComponents?.Block);Ho(()=>{let H=new AbortController;return o&&!N&&(async()=>{let{state:G}=await $({id:l,collectionSlug:i,data:o,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Qt(h),globalSlug:s,initialBlockData:o,operation:"update",renderAllFields:!0,schemaPath:v,signal:H.signal});if(G){G.blockName={initialValue:o.blockName,passesCondition:!0,valid:!0,value:o.blockName};let z=Cn(Qt(G),!0);y.update(()=>{let V=eo(r);if(V&&Me(V)){let oe=z;oe.blockType=o.blockType,V.setFields(oe,!0)}}),E(G),A(G._components?.customComponents?.BlockLabel),F(G._components?.customComponents?.Block)}})(),()=>{Bo(H)}},[$,v,l,o,y,r,N,i,s,w,h]);let[W,q]=ht.useState(d?.[o.id]?.collapsed??!1),te=`${p}.lexical_internal_feature.blocks.lexical_blocks.${o.blockType}`,X=u.blocks?.[te]?.[0],U=X.blockReferences?typeof X?.blockReferences?.[0]=="string"?b.blocksMap[X?.blockReferences?.[0]]:X?.blockReferences?.[0]:X?.blocks?.[0],{i18n:He,t:we}=jc(),me=jo(async({formState:H,submit:ce})=>{Bo(g.current);let G=new AbortController;g.current=G;let{state:z}=await $({id:l,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await w(),documentFormState:Qt(h),formState:H,globalSlug:s,initialBlockFormState:H,operation:"update",renderAllFields:!!ce,schemaPath:v,signal:G.signal});if(!z)return H;H.blockName&&(z.blockName=H.blockName);let V=Cn(hn({fields:Qt(z)}),!0);if(setTimeout(()=>{y.update(()=>{let oe=eo(r);if(oe&&Me(oe)){let We=V;We.blockType=o.blockType,oe.setFields(We,!0)}})},0),ce){A(z._components?.customComponents?.BlockLabel),F(z._components?.customComponents?.Block);let oe=0;for(let We of Object.values(z))We?.valid===!1&&oe++;S(oe)}return z},[$,l,i,w,s,v,o.blockType,h,y,r]);Ho(()=>()=>{Bo(g.current)},[]);let Ft=jo(()=>{y.update(()=>{eo(r)?.remove()})},[y,r]),Ee=U?.labels?.singular?Uc(U.labels.singular,He):U?.slug,Pt=jo(H=>{w().then(ce=>{let z=ce?.fields?.[c.name]?.collapsed,V=z&&z?.length?z:[];H?V.includes(o.id)||V.push(o.id):V.includes(o.id)&&V.splice(V.indexOf(o.id),1),T(c.name,{collapsed:V,hello:"hi"})})},[w,c.name,T,o.id]),Ue=gt(()=>()=>K(gn,{buttonStyle:"icon-label",className:`${le}__editButton`,disabled:m,el:"button",icon:"edit",onClick:H=>(H.preventDefault(),H.stopPropagation(),x(),!1),onMouseDown:H=>{H.preventDefault()},round:!0,size:"small",tooltip:we("lexical:blocks:inlineBlocks:edit",{label:Ee})}),[Ee,m,we,x]),Bt=gt(()=>()=>K(gn,{buttonStyle:"icon-label",className:`${le}__removeButton`,disabled:c?.admin?.readOnly||!1,icon:"x",onClick:H=>{H.preventDefault(),Ft()},round:!0,tooltip:"Remove Block"}),[c?.admin?.readOnly,Ft]),vo=gt(()=>({children:H,disableBlockName:ce,editButton:G,errorCount:z,fieldHasErrors:V,Label:oe,removeButton:We})=>K("div",{className:le+" "+le+"-"+o.blockType,children:K(Sc,{className:[`${le}__row`,V?`${le}__row--has-errors`:`${le}__row--no-errors`].join(" "),collapsibleStyle:V?"error":"default",header:ft("div",{className:`${le}__block-header`,children:[oe??I?oe??I:ft("div",{children:[K(Mc,{className:`${le}__block-pill ${le}__block-pill-${o?.blockType}`,pillStyle:"white",size:"small",children:Ee??o?.blockType}),!ce&&!U?.admin?.disableBlockName&&K(Ac,{path:"blockName",readOnly:c?.admin?.readOnly||!1}),V&&K(yc,{count:z??0,i18n:He,withMessage:!0})]}),ft("div",{children:[R&&G!==!1||!R&&G?K(Ue,{}):null,We!==!1&&y.isEditable()?K(Bt,{}):null]})]}),isCollapsed:W,onToggle:Xr=>{Pt(Xr),q(Xr)},children:H},0)}),[R,I,Ue,Bt,Ee,U?.admin?.disableBlockName,y,o.blockType,He,W,Pt,c?.admin?.readOnly]),Jr=gt(()=>()=>K(Lc,{children:K(Nc,{className:"",slug:k,title:we(`lexical:blocks:inlineBlocks:${o?.id?"edit":"create"}`,{label:Ee??we("lexical:blocks:inlineBlocks:label")}),children:N?ft(Ec,{children:[K(Dc,{fields:U?.fields??[],forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:v,permissions:!0,readOnly:!1}),K(vc,{programmaticSubmit:!0,children:we("fields:saveChanges")})]}):null})}),[N,k,Ee,we,U?.fields,v,a]),Wa=gt(()=>N?K(Rc,{beforeSubmit:[async({formState:H})=>await me({formState:H,submit:!0})],el:"div",fields:U?.fields??[],initialState:N,onChange:[me],onSubmit:(H,ce)=>{ce.blockType=o.blockType,y.update(()=>{let G=eo(r);G&&Me(G)&&G.setFields(ce,!0)}),x()},submitted:n,uuid:Wc(),children:K(fn,{baseClass:le,BlockDrawer:Jr,Collapsible:vo,CustomBlock:R,EditButton:Ue,errorCount:_,formSchema:U?.fields??[],initialState:N,nodeKey:r,RemoveButton:Bt})}):null,[vo,Jr,R,U?.fields,Bt,Ue,y,_,x,U?.fields,N,r,me,n]);return U?Wa:K(vo,{disableBlockName:!0,fieldHasErrors:!0,children:ft("div",{className:"lexical-block-not-found",children:["Error: Block '",o.blockType,"' not found in the config but exists in the lexical data"]})})};var ie=class extends pt{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=De(e.fields);return o.setFormat(e.format),o}decorate(e,o){return Gc(bn,{cacheBuster:this.getCacheBuster(),formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function De(t){return new ie({fields:{...t,id:t?.id||new Vc.default().toHexString()}})}function Me(t){return t instanceof ie}import{createHeadlessEditor as Kc}from"@lexical/headless";function Wo(t,e){return({editorState:r})=>{let n=Kc({nodes:t});try{n.setEditorState(n.parseEditorState(r))}catch(i){console.error("getLexicalToMarkdown: ERROR parsing editor state",i)}let l="";return n.getEditorState().read(()=>{l=Ht(e)}),l}}import{createHeadlessEditor as Jc}from"@lexical/headless";function to(t,e){return({markdown:r})=>{let n=Jc({nodes:t});return n.update(()=>{jt(r,e)},{discrete:!0}),n.getEditorState().toJSON()}}function Xc(t){let e=t.replace(/[.*+?^${}()|[\]\\]/g,"\\$&");return{regExpEnd:new RegExp(`</(${e})\\s*>|<${e}[^>]*?/>`,"i"),regExpStart:new RegExp(`<(${e})([^>]*?)\\s*(/?)>`,"i")}}var Tn=({blocks:t,inlineBlocks:e})=>{if(!t?.length&&!e?.length)return[];let o=[];if(t?.length)for(let r of t){let n=_n(r,!1);n&&(o=o.concat(n))}if(e?.length)for(let r of e){let n=_n(r,!0);n&&(o=o.concat(n))}return o};function _n(t,e){if(!t.jsx)return null;let o=Xc(t.slug),r=[];return e?(r.push(({allNodes:n,allTransformers:l})=>({type:"text-match",dependencies:[it],export:i=>{if(!at(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),u=Wo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:u});if(c===!1)return null;if(typeof c=="string")return c;let d=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};return c?.children?.length?`<${s.blockType}${d?" "+mt({props:a}):""}>${c.children}</${s.blockType}>`:`<${s.blockType}${d?" "+mt({props:a}):""}/>`},getEndIndex:(i,s)=>{let{endlineLastCharIndex:u}=Yt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:s,trimChildren:!1});return u},importRegExp:t.jsx?.customStartRegex??o.regExpStart,regExp:/___ignoreignoreignore___/g,replace(i,s){let{content:u,propsString:c}=Yt({isEndOptional:!1,lines:[i.getTextContent()],regexpEndRegex:o.regExpEnd,startLineIndex:0,startMatch:{...s,index:0},trimChildren:!1});if(!t?.jsx?.import)return;let d=to(n,l),a=t.jsx.import({children:u,closeMatch:null,htmlToLexical:null,markdownToLexical:d,openMatch:s,props:c?Zt({propsString:c}):{}});if(a===!1)return;let m=st({blockType:t.slug,...a});i.replace(m)}})),r):(r.push(({allNodes:n,allTransformers:l})=>({dependencies:[ie],export:i=>{if(!Me(i)||i.getFields()?.blockType?.toLowerCase()!==t.slug.toLowerCase())return null;let s=i.getFields(),u=Wo(n,l),c=t.jsx.export({fields:s,lexicalToMarkdown:u});if(c===!1)return null;if(typeof c=="string")return c;let d=c.props&&Object.keys(c.props)?.length>0,a=c.props??{};if(c?.children?.length){let m=c.children,p="";if(m.includes(`
|
|
11
|
+
`))for(let f of m.split(`
|
|
12
|
+
`)){let h="";!t?.jsx?.doNotTrimChildren&&f!==""&&(h=" "),h+=f+`
|
|
13
|
+
`,p+=h}else p=(t?.jsx?.doNotTrimChildren?"":" ")+m+`
|
|
14
|
+
`;return`<${s.blockType}${d?" "+mt({props:a}):""}>
|
|
15
|
+
${p}</${s.blockType}>`}return`<${s.blockType}${d?" "+mt({props:a}):""}/>`},handleImportAfterStartMatch:t.jsx?.customEndRegex?void 0:({lines:i,rootNode:s,startLineIndex:u,startMatch:c,transformer:d})=>{let a=typeof d.regExpEnd=="object"&&"regExp"in d.regExpEnd?d.regExpEnd.regExp:d.regExpEnd,m=d.regExpEnd&&typeof d.regExpEnd=="object"&&"optional"in d.regExpEnd?d.regExpEnd.optional:!d.regExpEnd,{afterEndLine:p,beforeStartLine:f,content:h,endLineIndex:g,propsString:C}=Yt({isEndOptional:m,lines:i,regexpEndRegex:a,startLineIndex:u,startMatch:c,trimChildren:!1}),_="";if(t?.jsx?.doNotTrimChildren)_=h.endsWith(`
|
|
16
|
+
`)?h.slice(0,-1):h;else if(h.includes(`
|
|
17
|
+
`)){let x=h.split(`
|
|
18
|
+
`),w=0;for(let T of x){if(w++,T.startsWith(" "))_+=T.slice(2);else if(T==="")_+=T;else{_=h.endsWith(`
|
|
19
|
+
`)?h.slice(0,-1):h;break}_+=w===x.length?"":`
|
|
20
|
+
`}}else _=(h.startsWith(" ")?h.slice(2):h)+`
|
|
21
|
+
`;if(!t?.jsx?.import)return[!1,u];let S=to(n,l),b=t.jsx.import({children:_,closeMatch:null,htmlToLexical:null,markdownToLexical:S,openMatch:c,props:C?Zt({propsString:C}):{}});if(b===!1)return[!1,u];let k=De({blockType:t.slug,...b});if(k){let x=null,w=null;if(f?.length){x=S({markdown:f})?.root?.children??[];let T=x?.[0];T&&s.append(kn(T))}if(s.append(k),p?.length){w=S({markdown:p})?.root?.children;let T=s.getChildren()[s.getChildren().length-1],y=kn(w[0])?.getChildren();if(y?.length)for(let $ of y)T.append($)}}return[!0,g]},regExpEnd:t.jsx?.customEndRegex??o.regExpEnd,regExpStart:t.jsx?.customStartRegex??o.regExpStart,type:"multiline-element",replace:(i,s,u,c,d)=>{if(t?.jsx?.import){if(!d){let g="";if(s)for(let C of s)g+=C.getTextContent();d=[g]}let a="";t?.jsx?.doNotTrimChildren?a=d.join(`
|
|
22
|
+
`):a=d.join(`
|
|
23
|
+
`).trim();let m=u[1]?.trim(),p=to(n,l),f=t.jsx.import({children:a,closeMatch:c,htmlToLexical:null,markdownToLexical:p,openMatch:u,props:m?Zt({propsString:m}):{}});if(f===!1)return!1;let h=De({blockType:t.slug,...f});h&&i.append(h);return}return!1}})),r)}import{createCommand as wn}from"lexical";var Ve=wn("INSERT_BLOCK_COMMAND"),Ke=wn("INSERT_INLINE_BLOCK_COMMAND");import{c as zc}from"react/compiler-runtime";import{useLexicalComposerContext as Zc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Yc,$wrapNodeInElement as qc,mergeRegister as Qc}from"@lexical/utils";import{formatDrawerSlug as eu,useEditDepth as tu}from"@payloadcms/ui";import{$createParagraphNode as ou,$getNodeByKey as ru,$getPreviousSelection as nu,$getSelection as lu,$insertNodes as iu,$isParagraphNode as su,$isRangeSelection as au,$isRootOrShadowRoot as cu,COMMAND_PRIORITY_EDITOR as En}from"lexical";import{useEffect as uu,useState as du}from"react";var Sn=()=>{let t=zc(12),[e]=Zc(),[o,r]=du(null),{setCreatedInlineBlock:n,uuid:l}=j(),i=tu(),s="lexical-inlineBlocks-create-"+l,u;t[0]!==i||t[1]!==s?(u=eu({slug:s,depth:i}),t[0]=i,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=pe(c,!0),a;t[3]!==e||t[4]!==n||t[5]!==o?(a=()=>{if(!e.hasNodes([ie]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return Qc(e.registerCommand(Ve,p=>(e.update(()=>{let f=lu()||nu();if(au(f)){let h=De(p),{focus:g}=f,C=g.getNode();Yc(h),su(C)&&!C.__first&&C.remove()}}),!0),En),e.registerCommand(Ke,p=>{if(o){let h=ru(o);return!h||!at(h)?!1:(h.setFields(p),r(null),!0)}let f=st(p);return n?.(f),iu([f]),cu(f.getParentOrThrow())&&qc(f,ou).selectEnd(),!0},En))},t[3]=e,t[4]=n,t[5]=o,t[6]=a):a=t[6];let m;return t[7]!==e||t[8]!==n||t[9]!==o||t[10]!==d?(m=[e,n,o,d],t[7]=e,t[8]=n,t[9]=o,t[10]=d,t[11]=m):m=t[11],uu(a,m),null};var mu=M(({config:t,featureClientSchemaMap:e,props:o,schemaPath:r})=>{let n=`${r}.lexical_internal_feature.blocks.lexical_blocks`,l=`${r}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=e.blocks;if(!i)return{};let s=Object.entries(i).filter(([a])=>a.startsWith(n+".")&&!a.replace(n+".","").includes(".")).map(([,a])=>a[0]),u=Object.entries(i).filter(([a])=>a.startsWith(l+".")&&!a.replace(l+".","").includes(".")).map(([,a])=>a[0]),c=s.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0),d=u.map(a=>a.blockReferences?typeof a.blockReferences[0]=="string"?t.blocksMap[a.blockReferences[0]]:a.blockReferences[0]:a.blocks[0]).filter(a=>a!==void 0);return{markdownTransformers:Tn({blocks:c,inlineBlocks:d}),nodes:[ie,it],plugins:[{Component:Sn,position:"normal"}],sanitizedClientFeatureProps:o,slashMenu:{groups:[c?.length?{items:c.map(a=>({Icon:zt(a.imageURL,a.imageAltText),key:"block-"+a.slug,keywords:["block","blocks",a.slug],label:({i18n:m})=>a?.labels?.singular?oo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ve,{blockName:"",blockType:a.slug})}})),key:"blocks",label:({i18n:a})=>a.t("lexical:blocks:label")}:null,d?.length?{items:d.map(a=>({Icon:Xt,key:"inlineBlocks-"+a.slug,keywords:["inlineBlock","inline block",a.slug],label:({i18n:m})=>a?.labels?.singular?oo(a.labels.singular,m):a?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Ke,{blockName:"",blockType:a.slug})}})),key:"inlineBlocks",label:({i18n:a})=>a.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[c.length?{type:"dropdown",ChildComponent:Jt,items:c.map((a,m)=>({ChildComponent:zt(a.imageURL,a.imageAltText),isActive:void 0,key:"block-"+a.slug,label:({i18n:p})=>a?.labels?.singular?oo(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ve,{blockName:"",blockType:a.slug})},order:m})),key:"blocks",order:20}:null,d?.length?{type:"dropdown",ChildComponent:Xt,items:d.map((a,m)=>({ChildComponent:a.imageURL?zt(a.imageURL,a.imageAltText):Xt,isActive:void 0,key:"inlineBlock-"+a.slug,label:({i18n:p})=>a?.labels?.singular?oo(a.labels.singular,p):a?.slug,onSelect:({editor:p})=>{p.dispatchCommand(Ke,{blockName:"",blockType:a.slug})},order:m})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as hu}from"react/compiler-runtime";import{jsx as Oe,jsxs as Jo}from"react/jsx-runtime";import{useLexicalComposerContext as gu}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as xu,$createTextNode as Cu,$getRoot as bu,getDOMSelection as Go}from"lexical";import*as In from"react";import{useCallback as Ae,useEffect as Vo,useLayoutEffect as Ln,useRef as Ko,useState as ro}from"react";var pu=re&&"documentMode"in document?document.documentMode:null,Nn=re&&/Mac|iPod|iPhone|iPad/.test(navigator.platform),Rb=re&&/^(?!.*Seamonkey)(?=.*Firefox).*/i.test(navigator.userAgent),Ib=re&&"InputEvent"in window&&!pu?"getTargetRanges"in new window.InputEvent("input"):!1,vb=re&&/Version\/[\d.].*Safari/.test(navigator.userAgent),Mb=re&&/iPad|iPhone|iPod/.test(navigator.userAgent)&&!window.MSStream,Db=re&&/Android/.test(navigator.userAgent),Ab=re&&/Win/.test(navigator.platform),fu=re&&/^(?=.*Chrome).*/i.test(navigator.userAgent),Ob=re&&/AppleWebKit\/[\d.]+/.test(navigator.userAgent)&&!fu;var ku=t=>{let e=document.createElement("textarea");e.value=t||"",e.style.position="absolute",e.style.opacity="0",document.body?.appendChild(e),e.focus(),e.select();try{let o=document.execCommand("copy");console.log(o)}catch(o){console.error(o)}document.body?.removeChild(e)},_u=(t,e)=>{let o=document.createElement("a");o.setAttribute("href","data:text/plain;charset=utf-8,"+encodeURIComponent(e||"")),o.setAttribute("download",t),o.style.display="none",document.body?.appendChild(o),o.click(),document.body?.removeChild(o)},Tu=t=>{let o=((r,n)=>{switch(r){case"click":return` await page.mouse.click(${n.x}, ${n.y});`;case"keydown":return` await page.keyboard.keydown('${n}');`;case"keyup":return` await page.keyboard.keyup('${n}');`;case"press":return` await page.keyboard.press('${n}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
4
24
|
await assertSelection(page, {
|
|
5
25
|
anchorPath: [${n.anchorPath.toString()}],
|
|
6
26
|
anchorOffset: ${n.anchorOffset},
|
|
@@ -10,7 +30,7 @@
|
|
|
10
30
|
`;case"type":return` await page.keyboard.type('${n}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
|
|
11
31
|
`);default:return` await repeat(${t.count}, async () => {
|
|
12
32
|
${o}
|
|
13
|
-
);`}};function
|
|
33
|
+
);`}};function wu(t){return t.key.toLowerCase()==="a"&&(Nn?t.metaKey:t.ctrlKey)}function Eu(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:r,focusOffset:n}=t;return r!==0&&r--,n!==0&&n--,{anchorNode:e,anchorOffset:r,focusNode:o,focusOffset:n}}function yn(t,e){let o=t,r=[];for(;o!==e;)o!=null&&r.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return r}var Rn=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Su(t){let[e,o]=ro([]),[r,n]=ro(!1),[,l]=ro(""),[i,s]=ro(""),u=Ko(null),c=Ko(!1),d=Ko(null),a=Ae(()=>t,[t]),m=Ae(()=>{let b=t.getRootElement(),k=Go(t._window);return b==null||k==null||k.anchorNode==null||k.focusNode==null||!b.contains(k.anchorNode)||!b.contains(k.focusNode)?null:`
|
|
14
34
|
import {
|
|
15
35
|
initializeE2E,
|
|
16
36
|
assertHTMLSnapshot,
|
|
@@ -27,15 +47,20 @@ describe('Test case', () => {
|
|
|
27
47
|
const {page} = e2e;
|
|
28
48
|
|
|
29
49
|
await page.focus('div[contenteditable="true"]');
|
|
30
|
-
${e.map(
|
|
50
|
+
${e.map(Tu).join(`
|
|
31
51
|
`)}
|
|
32
52
|
});
|
|
33
53
|
});
|
|
34
|
-
`},[t,e]),m=Me((C,k)=>{o(x=>{let w=e.length-1,S=e[w];if(S&&S.name===C){if(C==="type")return[...e.slice(0,w),{...S,value:S.value+k}];if(S.value===k)return[...e.slice(0,w),{...S,count:S.count+1}]}return[...x,{name:C,count:1,value:k}]})},[e,o]);wn(()=>{let C=x=>{if(!r)return;let w=x.key;nu(x)?m("selectAll",""):Sn.has(w)?m("press",x.key):[...w].length>1?m("keydown",x.key):m("type",x.key)},k=x=>{if(!r)return;let w=x.key;!Sn.has(w)&&[...w].length>1&&m("keyup",x.key)};return t.registerRootListener((x,w)=>{w!==null&&(w.removeEventListener("keydown",C),w.removeEventListener("keyup",k)),x!==null&&(x.addEventListener("keydown",C),x.addEventListener("keyup",k))})},[t,r,m]),wn(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[p]),Bo(()=>{if(e){let C=p();C!==null&&s(C),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[p,e]),Bo(()=>t.registerUpdateListener(({dirtyElements:k,dirtyLeaves:x,editorState:w})=>{if(!r)return;let S=w._selection,O=u.current,$=c.current;if(O!==S){if(x.size===0&&k.size===0&&!$){let N=Po(t._window);if(N&&(N.anchorNode==null||N.focusNode==null))return}u.current=S}c.current=!1;let R=p();R!==null&&s(R)}),[t,p,r,m]),Bo(()=>r?t.registerUpdateListener(()=>{let k=t.getRootElement();k!==null&&l(k?.innerHTML)}):void 0,[t,r]);let f=Me(C=>{r||(C.update(()=>{let k=eu();k.clear();let x=Qc();k.append(qc().append(x)),x.select()}),o([])),n(k=>!k)},[r]),h=Me(()=>{if(!r)return;let C=Po(t._window);if(C===null||C.anchorNode==null||C.focusNode==null)return;let{anchorNode:k,anchorOffset:x,focusNode:w,focusOffset:S}=lu(C),O=a().getRootElement(),$;k!==null&&($=En(k,O));let R;w!==null&&(R=En(w,O)),m("snapshot",{anchorNode:k,anchorOffset:x,anchorPath:$,focusNode:w,focusOffset:S,focusPath:R})},[m,r,a]),g=Me(()=>{tu(p())},[p]),b=Me(()=>{ou("test.js",p())},[p]);return[Oe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:C=>{f(a()),C.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?jo("div",{className:"test-recorder-output",children:[jo("div",{className:"test-recorder-toolbar",children:[Oe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:C=>{h(),C.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:C=>{g(),C.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:C=>{b(),C.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Oe("pre",{id:"test-recorder",ref:d,children:i})]}):null]}var Ln=()=>{let t=Zc(3),[e]=Yc(),[o,r]=iu(e),n;return t[0]!==o||t[1]!==r?(n=jo(Nn.Fragment,{children:[Oe("p",{children:"HI"}),o,r,Oe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var su=v({plugins:[{Component:Ln,position:"bottom"}]});import{c as au}from"react/compiler-runtime";import{jsx as cu}from"react/jsx-runtime";import{useLexicalComposerContext as uu}from"@lexical/react/LexicalComposerContext.js";import{TreeView as du}from"@lexical/react/LexicalTreeView.js";import"react";var yn=()=>{let t=au(2),[e]=uu(),o;return t[0]!==e?(o=cu(du,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var mu=v({plugins:[{Component:yn,position:"bottom"}]});import{$isTableSelection as pu}from"@lexical/table";import{$isRangeSelection as fu,FORMAT_TEXT_COMMAND as hu}from"lexical";import{jsx as In}from"react/jsx-runtime";import"react";var Rn=()=>In("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:In("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Y=t=>({type:"buttons",items:t,key:"format",order:40});var vn={type:"text-format",format:["bold","italic"],tag:"***"},Dn={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Mn={type:"text-format",format:["bold"],tag:"**"},On={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var An=[Y([{ChildComponent:Rn,isActive:({selection:t})=>fu(t)||pu(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(hu,"bold")},order:1}])],gu=v(({featureProviderMap:t})=>{let e=[Mn,On];return t.get("italic")&&e.push(Dn,vn),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:An},toolbarInline:{groups:An}}});import{$isTableSelection as Cu}from"@lexical/table";import{$isRangeSelection as bu,FORMAT_TEXT_COMMAND as ku}from"lexical";import{jsx as $n,jsxs as xu}from"react/jsx-runtime";import"react";var Fn=()=>xu("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[$n("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),$n("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Pn={type:"text-format",format:["code"],tag:"`"};var Bn=[Y([{ChildComponent:Fn,isActive:({selection:t})=>bu(t)||Cu(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(ku,"code")},order:7}])],_u=v({enableFormats:["code"],markdownTransformers:[Pn],toolbarFixed:{groups:Bn},toolbarInline:{groups:Bn}});import{$isTableSelection as Tu}from"@lexical/table";import{$isRangeSelection as wu,FORMAT_TEXT_COMMAND as Eu}from"lexical";import{jsx as Hn}from"react/jsx-runtime";import"react";var jn=()=>Hn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Hn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var Un={type:"text-format",format:["italic"],tag:"*"},Gn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Wn=[Y([{ChildComponent:jn,isActive:({selection:t})=>wu(t)||Tu(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Eu,"italic")},order:2}])],Su=v({enableFormats:["italic"],markdownTransformers:[Un,Gn],toolbarFixed:{groups:Wn},toolbarInline:{groups:Wn}});import{$isTableSelection as Lu}from"@lexical/table";import{$isRangeSelection as yu,FORMAT_TEXT_COMMAND as Iu}from"lexical";import{jsx as Vn,jsxs as Nu}from"react/jsx-runtime";import"react";var Kn=()=>Nu("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Vn("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),Vn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Jn={type:"text-format",format:["strikethrough"],tag:"~~"};var Xn=[Y([{ChildComponent:Kn,isActive:({selection:t})=>yu(t)||Lu(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Iu,"strikethrough")},order:4}])],Ru=v({enableFormats:["strikethrough"],markdownTransformers:[Jn],toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}});import{$isTableSelection as vu}from"@lexical/table";import{$isRangeSelection as Du,FORMAT_TEXT_COMMAND as Mu}from"lexical";import{jsx as zn}from"react/jsx-runtime";import"react";var Zn=()=>zn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:zn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var Yn=[Y([{ChildComponent:Zn,isActive:({selection:t})=>Du(t)||vu(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(Mu,"subscript")},order:5}])],Ou=v({enableFormats:["subscript"],toolbarFixed:{groups:Yn},toolbarInline:{groups:Yn}});import{$isTableSelection as Au}from"@lexical/table";import{$isRangeSelection as $u,FORMAT_TEXT_COMMAND as Fu}from"lexical";import{jsx as qn}from"react/jsx-runtime";import"react";var Qn=()=>qn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:qn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var el=[Y([{ChildComponent:Qn,isActive:({selection:t})=>$u(t)||Au(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(Fu,"superscript")},order:6}])],Pu=v({enableFormats:["superscript"],toolbarFixed:{groups:el},toolbarInline:{groups:el}});import{$isTableSelection as Hu}from"@lexical/table";import{$isRangeSelection as ju,FORMAT_TEXT_COMMAND as Uu}from"lexical";import{jsx as tl,jsxs as Bu}from"react/jsx-runtime";import"react";var ol=()=>Bu("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[tl("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),tl("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var rl=[Y([{ChildComponent:ol,isActive:({selection:t})=>ju(t)||Hu(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(Uu,"underline")},order:3}])],Gu=v({enableFormats:["underline"],toolbarFixed:{groups:rl},toolbarInline:{groups:rl}});import{jsx as Wo}from"react/jsx-runtime";import{jsx as Wu}from"react/jsx-runtime";function Vu(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var Zt=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[Vu(o),r])):{};return Wu("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as Ku}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as Ju}from"@lexical/selection";import{$getNodeByKey as Xu,$getState as zu,$setState as Zu,createState as Yu,TextNode as qu}from"lexical";import{useEffect as Qu}from"react";var Uo=new Map;function nl(t){for(let e in t){let o=t[e],r=Yu(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});Uo.set(e,{stateConfig:r,stateValues:o})}}function Go(t,e,o){t.update(()=>{Ju(r=>{let n=Uo.get(e);if(!n)throw new Error(`State config for ${e} not found`);Zu(r,n.stateConfig,o)})})}function ll(){let[t]=Ku();return Qu(()=>t.registerMutationListener(qu,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=Xu(o),l=t.getElementByKey(o);if(!n||!l)continue;let i=Object.create(null);Uo.forEach((s,u)=>{let c=zu(n,s.stateConfig);if(!c){delete l.dataset[u];return}l.dataset[u]=c;let d=s.stateValues[c]?.css;d&&Object.assign(i,d)}),l.style.cssText="",Object.assign(l.style,i)}})}),[t]),null}var il=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>Wo(Zt,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{Go(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>Wo(Zt,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>Wo(Zt,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let n in t.state)Go(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},ed=v(({props:t})=>(nl(t.state),{plugins:[{Component:ll,position:"normal"}],toolbarFixed:{groups:il(t)},toolbarInline:{groups:il(t)}}));import{$createHeadingNode as nd,$isHeadingNode as kl,HeadingNode as ld}from"@lexical/rich-text";import{$setBlocksType as id}from"@lexical/selection";import{$getSelection as sd,$isRangeSelection as ad}from"lexical";import{jsx as sl}from"react/jsx-runtime";import"react";var al=()=>sl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:sl("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as cl}from"react/jsx-runtime";import"react";var ul=()=>cl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:cl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as dl}from"react/jsx-runtime";import"react";var ml=()=>dl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as pl}from"react/jsx-runtime";import"react";var fl=()=>pl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:pl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as hl}from"react/jsx-runtime";import"react";var gl=()=>hl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:hl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as xl}from"react/jsx-runtime";import"react";var Cl=()=>xl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:xl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as td,$isHeadingNode as od,HeadingNode as rd}from"@lexical/rich-text";var Vo=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var bl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[rd],export:(n,l)=>{if(!od(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:Vo(n=>{let l="h"+n[1]?.length;return td(l)})}};var _l=t=>{let e=sd();id(e,()=>nd(t))},Tl={h1:al,h2:ul,h3:ml,h4:fl,h5:gl,h6:Cl},cd=v(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[Q(e.map((r,n)=>({ChildComponent:Tl[r],isActive:({selection:l})=>{if(!ad(l))return!1;for(let i of l.getNodes()){if(kl(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(kl(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{_l(r)})},order:n+2})))];return{markdownTransformers:[bl(e)],nodes:[ld],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:Tl[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{_l(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Sd}from"lexical";import{jsx as wl}from"react/jsx-runtime";import"react";var Ko=()=>wl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:wl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as El,jsxs as ud}from"react/jsx-runtime";import"react";var Sl=()=>ud("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[El("path",{d:"M5 10h10",stroke:"currentColor"}),El("path",{d:"M10 15V5",stroke:"currentColor"})]});var he=t=>({type:"dropdown",ChildComponent:Sl,items:t,key:"add",order:10});import{addClassNamesToElement as dd}from"@lexical/utils";import{$applyNodeReplacement as md,createCommand as pd,DecoratorNode as fd}from"lexical";var pt=pd("INSERT_HORIZONTAL_RULE_COMMAND"),mt=class extends fd{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:hd,priority:0})}}static importJSON(e){return Nl()}createDOM(e){let o=document.createElement("hr");return dd(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
|
|
35
|
-
`}isInline(){return!1}updateDOM(){return!1}};function hd(){return{node:Nl()}}function Nl(){return md(new mt)}import{$applyNodeReplacement as gd}from"lexical";import"react";var Le=class extends mt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return ft()}decorate(){return null}exportJSON(){return super.exportJSON()}};function ft(){return gd(new Le)}function Yt(t){return t instanceof Le}var Ll={type:"element",dependencies:[Le],export:(t,e)=>Yt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=ft();e&&t.replace(e)}};import{c as xd}from"react/compiler-runtime";import{useLexicalComposerContext as Cd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as bd}from"@lexical/utils";import{$getSelection as kd,$isRangeSelection as _d,COMMAND_PRIORITY_EDITOR as Td}from"lexical";import{useEffect as wd}from"react";var yl=()=>{let t=xd(3),[e]=Cd(),o,r;return t[0]!==e?(o=()=>e.registerCommand(pt,Ed,Td),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),wd(o,r),null};function Ed(t){let e=kd();if(!_d(e))return!1;if(e.focus.getNode()!==null){let r=ft();bd(r)}return!0}var Nd=v({markdownTransformers:[Ll],nodes:[Le],plugins:[{Component:yl,position:"normal"}],slashMenu:{groups:[Z([{Icon:Ko,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(pt,void 0)}}])]},toolbarFixed:{groups:[he([{ChildComponent:Ko,isActive:({selection:t})=>{if(!Sd(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Yt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(pt,void 0)}}])]}});import{$findMatchingParent as Pl}from"@lexical/utils";import{$isElementNode as Bd,INDENT_CONTENT_COMMAND as Hd,OUTDENT_CONTENT_COMMAND as jd}from"lexical";import{jsx as qt,jsxs as Ld}from"react/jsx-runtime";import"react";var Il=()=>Ld("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[qt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),qt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),qt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),qt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Qt,jsxs as yd}from"react/jsx-runtime";import"react";var Rl=()=>yd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Qt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Qt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Qt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Qt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Id}from"react/jsx-runtime";import{useLexicalComposerContext as Rd}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as vd}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as Dd,mergeRegister as vl}from"@lexical/utils";import{$getSelection as Md,$isElementNode as Al,$isRangeSelection as Od,COMMAND_PRIORITY_LOW as Dl,INDENT_CONTENT_COMMAND as Ml,KEY_TAB_COMMAND as Ad,OUTDENT_CONTENT_COMMAND as $d,TabNode as Fd}from"lexical";import{useEffect as Ol}from"react";var $l=({clientProps:t})=>{let[e]=Rd(),{disabledNodes:o,disableTabNode:r}=t;return Ol(()=>{if(!(!e||!o?.length))return vl(e.registerCommand(Ml,()=>Pd(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Dl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);Al(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),Ol(()=>{if(!(!e||!r))return vl(e.registerCommand(Ad,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?$d:Ml,void 0)),Dl),e.registerNodeTransform(Fd,n=>{n.remove()}))},[e,r]),Id(vd,{})};function Pd(t){let e=Md();if(!Od(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=Dd(l,c=>Al(c)&&!c.isInline());if(s===null)continue;let u=s.getKey();s.canIndent()&&!o.has(u)&&(o.add(u),t(s))}return o.size>0}var Fl=t=>({type:"buttons",items:t,key:"indent",order:35});var Bl=({disabledNodes:t})=>[Fl([{ChildComponent:Il,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Hl(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!Pl(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(jd,void 0)},order:1},{ChildComponent:Rl,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Hl(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!Pl(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(Hd,void 0)},order:2}])],Ud=v(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:$l,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Bl({disabledNodes:e})},toolbarInline:{groups:Bl({disabledNodes:e})}}}),Hl=t=>Bd(t)&&t.canIndent();import{$findMatchingParent as ep}from"@lexical/utils";import{$getSelection as tr,$isRangeSelection as xi}from"lexical";import{jsx as jl}from"react/jsx-runtime";import"react";var Ul=()=>jl("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:jl("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as Gl}from"@lexical/selection";function Ke(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?Gl(o)?r:n:Gl(e)?r:n}var Jo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as Qd}from"lexical";import{addClassNamesToElement as Gd,isHTMLAnchorElement as Wd}from"@lexical/utils";import Zo from"bson-objectid";import{$applyNodeReplacement as Vd,$createTextNode as Wl,$getSelection as Kd,$isElementNode as Vl,$isRangeSelection as zo,createCommand as Jd,ElementNode as Xd}from"lexical";var zd=new Set(["http:","https:","mailto:","sms:","tel:"]),ee=class t extends Xd{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Zd,priority:1})}}static importJSON(e){let o=ge({}).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 Zo.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=Xo(o.rel,"add","noopener")),Gd(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},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!zo(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Vl(r)){let n=ge({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!zd.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,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),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=Xo(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=Xo(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Zd(t){let e=null;if(Wd(t)){let o=t.textContent;o!==null&&o!==""&&(e=ge({id:new Zo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function ge({id:t,fields:e}){return Vd(new ee({id:t??new Zo.default().toHexString(),fields:e}))}function J(t){return t instanceof ee}var ae=Jd("TOGGLE_LINK_COMMAND");function Yo(t){let e=Kd();if(!zo(e)&&(t===null||!t.selectedNodes?.length))return;let o=zo(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();J(i)&&(i.getChildren().forEach(u=>{i.insertBefore(u)}),i.remove())});return}if(o?.length===1){let l=o[0],i=J(l)?l:Yd(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Wl(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||Vl(l)&&!l.isInline())){if(J(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(Wl(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=ge({fields:t.fields}),J(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),J(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function Yd(t){return qd(t,e=>J(e))}function qd(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function Xo(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var Kl={type:"text-match",dependencies:[ee],export:(t,e)=>{if(!J(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=ge({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=Qd(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as em,$isElementNode as tm}from"lexical";var xe=class t extends ee{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=ht({}).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 r=this.getParentOrThrow().insertNewAfter(e,o);if(tm(r)){let n=ht({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function ht({fields:t}){return em(new xe({id:"",fields:t}))}function Ce(t){return t instanceof xe}import{c as om}from"react/compiler-runtime";import{useLexicalComposerContext as rm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as nm}from"@lexical/utils";import{$createTextNode as Jl,$getSelection as lm,$isElementNode as zl,$isLineBreakNode as Zl,$isNodeSelection as im,$isRangeSelection as sm,$isTextNode as gt,TextNode as am}from"lexical";import{useEffect as cm}from"react";function Xl(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function Yl(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var um=/[.,;\s]/;function to(t){return t!==void 0&&um.test(t)}function ql(t){return to(t[t.length-1])}function Qo(t){return to(t[0])}function dm(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function Ql(t){let e=t.getPreviousSibling();return zl(e)&&(e=e.getLastDescendant()),e===null||Zl(e)||gt(e)&&ql(e.getTextContent())}function ei(t){let e=t.getNextSibling();return zl(e)&&(e=e.getFirstDescendant()),e===null||Zl(e)||gt(e)&&Qo(e.getTextContent())}function mm(t,e,o,r){return(t>0?to(o[t-1]):Ql(r[0]))?e<o.length?to(o[e]):ei(r[r.length-1]):!1}function pm(t,e,o){let r=[],n=[],l=[],i=0,s=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,p=s;s+a<=e?(r.push(c),i+=a):p>=o?l.push(c):n.push(c),s+=a,u.shift()}return[i,r,n,l]}function fm(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=ht({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let u=Jl(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),l.append(u),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,u;e===0?u=i:[,u]=i.splitText(e);let c=[],d;if(t.forEach(a=>{let m=a.getTextContent().length,f=s,h=s+m;if(f<o)if(h<=o)c.push(a);else{let[g,b]=a.splitText(o-f);g&&c.push(g),d=b}s+=m}),u){let a=lm(),p=a?a.getNodes().find(gt):void 0,m=Jl(u.getTextContent());return m.setFormat(u.getFormat()),m.setDetail(u.getDetail()),m.setStyle(u.getStyle()),l.append(m,...c),p&&p===u&&(sm(a)?m.select(a.anchor.offset,a.focus.offset):im(a)&&m.select(0,m.getTextContent().length)),u.replace(l),d}}}function hm(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),l=n,i,s=0;for(;(i=Yl(l,e))!=null&&i!==null;){let u=i.index,c=i.length,d=u+c;if(mm(s+u,s+d,n,r)){let[p,,m,f]=pm(r,s+u,s+d),h=s+u-p,g=s+d-p,b=fm(m,h,g,i);r=b?[b,...f]:f,o(i.url,null),s=0}else s+=d;l=l.substring(d)}}function qo(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!gt(c)||!c.isSimpleText()){eo(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=Yl(l,e);if(i===null||i.text!==l){eo(t),o(null,t.getFields()?.url??null);return}if(!Ql(t)||!ei(t)){eo(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let u=t.getFields();u.url=i?.url,t.setFields(u),o(i.url,s??null)}}function gm(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(Ce(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!Qo(l)||dm(l,i))&&(r.append(t),qo(r,e,o),o(null,r.getFields()?.url??null))}Ce(n)&&!ql(l)&&(eo(n),qo(n,e,o),o(null,n.getFields()?.url??null))}function eo(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function xm(t){let e=[t],o=t.getNextSibling();for(;o!==null&>(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Cm(t,e,o){let r=om(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([xe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,u)=>{o?.(s,u)};return nm(t.registerNodeTransform(am,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(Ce(u))qo(u,e,i);else if(!J(u)){if(s.isSimpleText()&&(Qo(s.getTextContent())||!Ce(c))){let d=xm(s);hm(d,e,i)}gm(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),cm(n,l)}var bm=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,km=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,_m=[Xl(bm,t=>t.startsWith("http")?t:`https://${t}`),Xl(km,t=>`mailto:${t}`)],ti=()=>{let[t]=rm();return Cm(t,_m),null};import{jsx as Tm}from"react/jsx-runtime";import{ClickableLinkPlugin as wm}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var oi=()=>Tm(wm,{});import{jsx as jm}from"react/jsx-runtime";import"react";import{createPortal as Um}from"react-dom";import{jsx as be,jsxs as xt,Fragment as Sm}from"react/jsx-runtime";import{useLexicalComposerContext as Nm}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as ri,mergeRegister as ni}from"@lexical/utils";import{getTranslation as er}from"@payloadcms/translations";import{CloseMenuIcon as Lm,EditIcon as ym,ExternalLinkIcon as li,formatDrawerSlug as Im,useConfig as Rm,useEditDepth as vm,useLocale as Dm,useTranslation as Mm}from"@payloadcms/ui";import{requests as Om}from"@payloadcms/ui/shared";import{$getSelection as ii,$isLineBreakNode as Am,$isRangeSelection as si,COMMAND_PRIORITY_HIGH as $m,COMMAND_PRIORITY_LOW as ai,getDOMSelection as Fm,KEY_ESCAPE_COMMAND as Pm,SELECTION_CHANGE_COMMAND as Bm}from"lexical";import ci,{useCallback as ui,useEffect as no,useRef as Hm,useState as Ae}from"react";function oo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),u=l.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=i.height+t.height+r*2),d+i.width>u.right&&(d=u.right-i.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as Em}from"lexical";var ro=Em("TOGGLE_LINK_WITH_MODAL_COMMAND");function di(t){t.preventDefault()}function mi({anchorElem:t}){let[e]=Nm(),[o,r]=Ae(),n=Hm(null),[l,i]=Ae(null),[s,u]=Ae(null),{fieldProps:{schemaPath:c},uuid:d}=H(),{config:a,getEntityConfig:p}=Rm(),{i18n:m,t:f}=Mm(),[h,g]=Ae(),b=vm(),[T,E]=Ae(!1),[C,k]=Ae([]),x=Dm(),[w,S]=Ae(!1),O=Im({slug:"lexical-rich-text-link-"+d,depth:b}),{toggleDrawer:$}=me(O),R=ui(()=>{E(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),S(!1),i(null),u(null),k([]),g(void 0)},[E,i,u,k]),N=ui(()=>{let _=ii(),L;if(!si(_)||!_){R();return}let D=Ke(_);L=e.getElementByKey(D.getKey())?.getBoundingClientRect();let I=ri(D,J),M=_.getNodes().filter(X=>!Am(X)).find(X=>{let U=ri(X,J);return I&&!I.is(U)||U&&!U.is(I)});if(I==null||M){R();return}r(I);let y=I.getFields(),F={...y,id:I.getID(),text:I.getTextContent()};if(y?.linkType==="custom")i(y?.url??null),u(null);else{i(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${y?.doc?.relationTo}/${y?.doc?.value}`);let X=y?.doc?.relationTo?p({collectionSlug:y?.doc?.relationTo}):void 0;if(!X)u(y?.label?String(y?.label):null),i(y?.url?String(y?.url):null);else{let U=typeof y.doc?.value=="object"?y.doc.value.id:y.doc?.value,He=y.doc?.relationTo;if(!U||!He)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let Ee=f("fields:linkedTo",{label:`${er(X.labels.singular,m)} - ${f("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");u(Ee),Om.get(`${a.serverURL}${a.routes.api}/${He}/${U}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:x?.code}}).then(async de=>{if(!de.ok)throw new Error(`HTTP error! Status: ${de.status}`);let Mt=await de.json(),Se=X?.admin?.useAsTitle||"id",Ot=Mt[Se],je=f("fields:linkedTo",{label:`${er(X.labels.singular,m)} - ${Ot}`}).replace(/<[^>]*>?/g,"");u(je)}).catch(()=>{let de=f("fields:linkedTo",{label:`${er(X.labels.singular,m)} - ${f("general:untitled",m)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");u(de)})}}g(F),E(!0),k(_?_?.getNodes():[]),Ce(I)?S(!0):S(!1);let G=n.current,q=Fm(e._window),{activeElement:te}=document;if(G===null)return;let Dt=e.getRootElement();return q!==null&&Dt!==null&&Dt.contains(q.anchorNode)?(L||(L=q.getRangeAt(0).getBoundingClientRect()),L!=null&&(L.y+=40,oo(L,G,t))):(te==null||te.className!=="link-input")&&(Dt!==null&&oo(null,G,t),i(null),u(null)),!0},[e,R,a.routes.admin,a.routes.api,a.serverURL,p,f,m,x?.code,t]);return no(()=>ni(e.registerCommand(ro,_=>(e.dispatchCommand(ae,_),N(),$(),!0),ai)),[e,N,$,O]),no(()=>{let _=t.parentElement,L=()=>{e.getEditorState().read(()=>{N()})};return window.addEventListener("resize",L),_?.addEventListener("scroll",L),()=>{window.removeEventListener("resize",L),_?.removeEventListener("scroll",L)}},[t.parentElement,e,N]),no(()=>ni(e.registerUpdateListener(({editorState:_})=>{_.read(()=>{N()})}),e.registerCommand(Bm,()=>(N(),!0),ai),e.registerCommand(Pm,()=>T?(R(),!0):!1,$m)),[e,N,T,R]),no(()=>{e.getEditorState().read(()=>{N()})},[e,N]),xt(ci.Fragment,{children:[be("div",{className:"link-editor",ref:n,children:xt("div",{className:"link-input",children:[l&&l.length>0?xt("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?be(li,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?xt(Sm,{children:[o?.__fields.newTab?be(li,{}):null,be("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&xt(ci.Fragment,{children:[be("button",{"aria-label":"Edit link",className:"link-edit",onClick:_=>{_.preventDefault(),$()},onMouseDown:di,tabIndex:0,type:"button",children:be(ym,{})}),!w&&be("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ae,null)},onMouseDown:di,tabIndex:0,type:"button",children:be(Lm,{})})]})]})}),be(nt,{className:"lexical-link-edit-drawer",data:h,drawerSlug:O,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(_,L)=>{let D=L,I={...D};delete I.text,e.update(()=>{let M=ii(),y=null;if(si(M)?y=Ke(M).getParent():C.length&&(y=C[0]?.getParent()??null),y&&Ce(y)){let F=ge({fields:I});y.replace(F,!0)}}),e.dispatchCommand(ae,{fields:I,selectedNodes:C,text:D.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var pi=t=>{let{anchorElem:e=document.body}=t;return Um(jm(mi,{anchorElem:e}),e)};import{c as Vm}from"react/compiler-runtime";import{useLexicalComposerContext as Km}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Jm}from"@lexical/utils";import{$getSelection as Xm,$isElementNode as zm,$isRangeSelection as Zm,COMMAND_PRIORITY_LOW as hi,PASTE_COMMAND as Ym}from"lexical";import{useEffect as qm}from"react";var Gm=/^(?:[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+)?$/,Wm=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function fi(t){if(!t)return!1;if(t==="https://"||Gm.test(t)||Wm.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var gi=t=>{let e=Vm(5),{clientProps:o}=t,[r]=Km(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ee]))throw new Error("LinkPlugin: LinkNode not registered on editor");return Jm(r.registerCommand(ae,i=>i===null?(Yo(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),Yo(i),!0),hi),r.registerCommand(Ym,i=>{let s=Xm();if(!Zm(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let u=i.clipboardData.getData("text");if(!fi(u))return!1;if(!s.getNodes().some(Qm)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(ae,{fields:c,text:null}),i.preventDefault(),!0}return!1},hi))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),qm(n,l),null};function Qm(t){return zm(t)}var Ci=[Jo([{ChildComponent:Ul,isActive:({selection:t})=>{if(xi(t)){let e=Ke(t);return ep(e,J)!=null}return!1},isEnabled:({selection:t})=>!!(xi(t)&&tr()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ae,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=tr()?.getTextContent(),r=tr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(ro,{fields:n,selectedNodes:r,text:o})}},order:1}])],tp=v(({props:t})=>({markdownTransformers:[Kl],nodes:[ee,t?.disableAutoLinks===!0?null:xe].filter(Boolean),plugins:[{Component:gi,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:ti,position:"normal"},{Component:oi,position:"normal"},{Component:pi,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:Ci},toolbarInline:{groups:Ci}}));import{$isListNode as nr,INSERT_CHECK_LIST_COMMAND as Ei,ListItemNode as pp,ListNode as fp}from"@lexical/list";import{$isRangeSelection as hp}from"lexical";import{jsx as bi,jsxs as op}from"react/jsx-runtime";import"react";var or=()=>op("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[bi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),bi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as rp}from"react/jsx-runtime";import{ListPlugin as np}from"@lexical/react/LexicalListPlugin.js";import"react";var Je=()=>rp(np,{});function Xe(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as ap,ListItemNode as cp,ListNode as up}from"@lexical/list";import{$createListItemNode as lp,$createListNode as ip,$isListItemNode as sp,$isListNode as rr}from"@lexical/list";var ki=4,ze=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=lp(t==="check"?r[3]==="x":void 0);if(rr(l)&&l.getListType()===t){let u=l.getFirstChild();u!==null?u.insertBefore(i):l.append(i),e.remove()}else if(rr(n)&&n.getListType()===t)n.append(i),e.remove();else{let u=ip(t,t==="number"?Number(r[2]):void 0);u.append(i),e.replace(u)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/ki);s&&i.setIndent(s)},$e=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(sp(i)){if(i.getChildrenSize()===1){let d=i.getFirstChild();if(rr(d)){r.push($e(d,e,o+1));continue}}let s=" ".repeat(o*ki),u=t.getListType(),c=u==="number"?`${t.getStart()+l}. `:u==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
|
|
36
|
-
`)};var _i={type:"element",dependencies:[up,cp],export:(t,e)=>ap(t)?$e(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:ze("check")};import{jsx as dp}from"react/jsx-runtime";import{CheckListPlugin as mp}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Ti=()=>dp(mp,{});var wi=[Q([{ChildComponent:or,isActive:({selection:t})=>{if(!hp(t))return!1;for(let e of t.getNodes()){if(nr(e)&&e.getListType()==="check")continue;let o=e.getParent();if(nr(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(nr(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ei,void 0)},order:12}])],gp=v(({featureProviderMap:t})=>{let e=[{Component:Ti,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Je,position:"normal"}),{markdownTransformers:[_i],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[fp,pp],plugins:e,slashMenu:{groups:[Xe([{Icon:or,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Ei,void 0)}}])]},toolbarFixed:{groups:wi},toolbarInline:{groups:wi}}});import{$isListNode as ir,INSERT_ORDERED_LIST_COMMAND as Li,ListItemNode as _p,ListNode as Tp}from"@lexical/list";import{$isRangeSelection as wp}from"lexical";import{jsx as Ct,jsxs as xp}from"react/jsx-runtime";import"react";var lr=()=>xp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ct("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),Ct("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),Ct("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),Ct("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),Ct("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Cp,ListItemNode as bp,ListNode as kp}from"@lexical/list";var Si={type:"element",dependencies:[kp,bp],export:(t,e)=>Cp(t)?$e(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:ze("number")};var Ni=[Q([{ChildComponent:lr,isActive:({selection:t})=>{if(!wp(t))return!1;for(let e of t.getNodes()){if(ir(e)&&e.getListType()==="number")continue;let o=e.getParent();if(ir(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(ir(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Li,void 0)},order:10}])],Ep=v(({featureProviderMap:t})=>({markdownTransformers:[Si],nodes:t.has("orderedList")?[]:[Tp,_p],plugins:t.has("orderedList")?[]:[{Component:Je,position:"normal"}],slashMenu:{groups:[Xe([{Icon:lr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Li,void 0)}}])]},toolbarFixed:{groups:Ni},toolbarInline:{groups:Ni}}));import{$isListNode as ar,INSERT_UNORDERED_LIST_COMMAND as Ri,ListItemNode as Ip,ListNode as Rp}from"@lexical/list";import{$isRangeSelection as vp}from"lexical";import{jsx as Ze,jsxs as Sp}from"react/jsx-runtime";import"react";var sr=()=>Sp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ze("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ze("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ze("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ze("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Ze("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Ze("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Np,ListItemNode as Lp,ListNode as yp}from"@lexical/list";var yi={type:"element",dependencies:[yp,Lp],export:(t,e)=>Np(t)?$e(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:ze("bullet")};var Ii=[Q([{ChildComponent:sr,isActive:({selection:t})=>{if(!vp(t))return!1;for(let e of t.getNodes()){if(ar(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(ar(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(ar(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ri,void 0)},order:11}])],Dp=v({markdownTransformers:[yi],nodes:[Rp,Ip],plugins:[{Component:Je,position:"normal"}],slashMenu:{groups:[Xe([{Icon:sr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ri,void 0)}}])]},toolbarFixed:{groups:Ii},toolbarInline:{groups:Ii}});import{jsx as Mp}from"react/jsx-runtime";import{addClassNamesToElement as Op}from"@lexical/utils";import{DecoratorNode as Ap}from"lexical";import*as vi from"react";var $p=vi.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),bt=class t extends Ap{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Fp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Op(o,"unknownConverted"),o}decorate(){return Mp($p,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Fp({data:t}){return new bt({data:t})}var Pp=v(()=>({nodes:[bt]}));import{jsx as Bp}from"react/jsx-runtime";import{addClassNamesToElement as Hp}from"@lexical/utils";import{DecoratorNode as jp}from"lexical";import*as Di from"react";var Up=Di.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),kt=class t extends jp{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return Gp({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Hp(o,"unknownConverted"),o}decorate(){return Bp(Up,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Gp({data:t}){return new kt({data:t})}var Wp=v(()=>({nodes:[kt]}));import{$setBlocksType as Ai}from"@lexical/selection";import{$createParagraphNode as $i,$getSelection as Fi,$isParagraphNode as Mi,$isRangeSelection as Vp}from"lexical";var Oi=[Q([{ChildComponent:it,isActive:({selection:t})=>{if(!Vp(t))return!1;for(let e of t.getNodes())if(!Mi(e)&&!Mi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Fi();Ai(e,()=>$i())})},order:1}])],Kp=v({slashMenu:{groups:[Z([{Icon:it,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Fi();Ai(e,()=>$i())})}}])]},toolbarFixed:{groups:Oi},toolbarInline:{groups:Oi}});import{c as ff}from"react/compiler-runtime";import{jsx as rs}from"react/jsx-runtime";import{useLexicalComposerContext as hf}from"@lexical/react/LexicalComposerContext";import{useEffect as gf,useState as xf}from"react";import{jsx as os,Fragment as pf}from"react/jsx-runtime";import"react";import{jsx as Jp}from"react/jsx-runtime";var Pi={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Jp("blockquote",{children:o})}};import{jsx as Xp}from"react/jsx-runtime";var Bi={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Xp(r,{children:o})}};import{jsx as zp}from"react/jsx-runtime";var Hi={horizontalrule:zp("hr",{})};import{jsx as Zp}from"react/jsx-runtime";var ji={linebreak:Zp("br",{})};import{jsx as Ui}from"react/jsx-runtime";var Gi=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return Ui("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),Ui("a",{href:i,rel:n,target:l,children:r})}});import{jsx as Ye,jsxs as Yp,Fragment as qp}from"react/jsx-runtime";import{v4 as Qp}from"uuid";var Wi={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return Ye(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=Qp();return Ye("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:Yp(qp,{children:[Ye("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),Ye("label",{htmlFor:l,children:n}),Ye("br",{})]})})}else return Ye("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as cr}from"react/jsx-runtime";var Vi={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?cr("p",{children:o}):cr("p",{children:cr("br",{})})}};var Ki={tab:" "};import{jsx as _t}from"react/jsx-runtime";var Ji={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return _t("div",{className:"lexical-table-container",children:_t("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:_t("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return _t(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return _t("tr",{className:"lexical-table-row",children:o})}};import{jsx as Fe}from"react/jsx-runtime";import"react";var A={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},ef=A.IS_BOLD|A.IS_ITALIC|A.IS_STRIKETHROUGH|A.IS_UNDERLINE|A.IS_CODE|A.IS_SUBSCRIPT|A.IS_SUPERSCRIPT|A.IS_HIGHLIGHT,tf="\xA0",of=`
|
|
54
|
+
`},[t,e]),p=Ae((b,k)=>{o(x=>{let w=e.length-1,T=e[w];if(T&&T.name===b){if(b==="type")return[...e.slice(0,w),{...T,value:T.value+k}];if(T.value===k)return[...e.slice(0,w),{...T,count:T.count+1}]}return[...x,{name:b,count:1,value:k}]})},[e,o]);Ln(()=>{let b=x=>{if(!r)return;let w=x.key;wu(x)?p("selectAll",""):Rn.has(w)?p("press",x.key):[...w].length>1?p("keydown",x.key):p("type",x.key)},k=x=>{if(!r)return;let w=x.key;!Rn.has(w)&&[...w].length>1&&p("keyup",x.key)};return t.registerRootListener((x,w)=>{w!==null&&(w.removeEventListener("keydown",b),w.removeEventListener("keyup",k)),x!==null&&(x.addEventListener("keydown",b),x.addEventListener("keyup",k))})},[t,r,p]),Ln(()=>{d.current&&d.current.scrollTo(0,d.current.scrollHeight)},[m]),Vo(()=>{if(e){let b=m();b!==null&&s(b),d.current&&d.current.scrollTo(0,d.current.scrollHeight)}},[m,e]),Vo(()=>t.registerUpdateListener(({dirtyElements:k,dirtyLeaves:x,editorState:w})=>{if(!r)return;let T=w._selection,y=u.current,$=c.current;if(y!==T){if(x.size===0&&k.size===0&&!$){let N=Go(t._window);if(N&&(N.anchorNode==null||N.focusNode==null))return}u.current=T}c.current=!1;let v=m();v!==null&&s(v)}),[t,m,r,p]),Vo(()=>r?t.registerUpdateListener(()=>{let k=t.getRootElement();k!==null&&l(k?.innerHTML)}):void 0,[t,r]);let f=Ae(b=>{r||(b.update(()=>{let k=bu();k.clear();let x=Cu();k.append(xu().append(x)),x.select()}),o([])),n(k=>!k)},[r]),h=Ae(()=>{if(!r)return;let b=Go(t._window);if(b===null||b.anchorNode==null||b.focusNode==null)return;let{anchorNode:k,anchorOffset:x,focusNode:w,focusOffset:T}=Eu(b),y=a().getRootElement(),$;k!==null&&($=yn(k,y));let v;w!==null&&(v=yn(w,y)),p("snapshot",{anchorNode:k,anchorOffset:x,anchorPath:$,focusNode:w,focusOffset:T,focusPath:v})},[p,r,a]),g=Ae(()=>{ku(m())},[m]),C=Ae(()=>{_u("test.js",m())},[m]);return[Oe("button",{className:`editor-dev-button ${r?"active":""}`,id:"test-recorder-button",onClick:b=>{f(a()),b.preventDefault()},title:r?"Disable test recorder":"Enable test recorder",type:"button",children:r?"Disable test recorder":"Enable test recorder"}),r?Jo("div",{className:"test-recorder-output",children:[Jo("div",{className:"test-recorder-toolbar",children:[Oe("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:b=>{h(),b.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:b=>{g(),b.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Oe("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:b=>{C(),b.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Oe("pre",{id:"test-recorder",ref:d,children:i})]}):null]}var vn=()=>{let t=hu(3),[e]=gu(),[o,r]=Su(e),n;return t[0]!==o||t[1]!==r?(n=Jo(In.Fragment,{children:[Oe("p",{children:"HI"}),o,r,Oe("p",{children:"DONE"})]}),t[0]=o,t[1]=r,t[2]=n):n=t[2],n};var Nu=M({plugins:[{Component:vn,position:"bottom"}]});import{c as Lu}from"react/compiler-runtime";import{jsx as yu}from"react/jsx-runtime";import{useLexicalComposerContext as Ru}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Iu}from"@lexical/react/LexicalTreeView.js";import"react";var Mn=()=>{let t=Lu(2),[e]=Ru(),o;return t[0]!==e?(o=yu(Iu,{editor:e,timeTravelButtonClassName:"debug-timetravel-button",timeTravelPanelButtonClassName:"debug-timetravel-panel-button",timeTravelPanelClassName:"debug-timetravel-panel",timeTravelPanelSliderClassName:"debug-timetravel-panel-slider",treeTypeButtonClassName:"debug-treetype-button",viewClassName:"tree-view-output"}),t[0]=e,t[1]=o):o=t[1],o};var vu=M({plugins:[{Component:Mn,position:"bottom"}]});import{$isTableSelection as Mu}from"@lexical/table";import{$isRangeSelection as Du,FORMAT_TEXT_COMMAND as Au}from"lexical";import{jsx as Dn}from"react/jsx-runtime";import"react";var An=()=>Dn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Dn("path",{d:"M10.6772 15H6.27017V5.718H10.4172C12.6792 5.718 13.8492 6.602 13.8492 8.292C13.8492 9.098 13.1992 9.982 12.4712 10.216C13.3812 10.476 14.1742 11.256 14.1742 12.322C14.1742 14.09 12.9002 15 10.6772 15ZM8.46717 9.501H10.3262C11.3012 9.501 11.7042 9.046 11.7042 8.409C11.7042 7.72 11.2362 7.317 10.3392 7.317H8.46717V9.501ZM8.46717 11.061V13.401H10.4822C11.4702 13.401 11.9642 12.959 11.9642 12.218C11.9642 11.49 11.4702 11.061 10.4822 11.061H8.46717Z",fill:"currentColor"})});var Y=t=>({type:"buttons",items:t,key:"format",order:40});var On={type:"text-format",format:["bold","italic"],tag:"***"},$n={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Fn={type:"text-format",format:["bold"],tag:"**"},Pn={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var Bn=[Y([{ChildComponent:An,isActive:({selection:t})=>Du(t)||Mu(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Au,"bold")},order:1}])],Ou=M(({featureProviderMap:t})=>{let e=[Fn,Pn];return t.get("italic")&&e.push($n,On),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:Bn},toolbarInline:{groups:Bn}}});import{$isTableSelection as Fu}from"@lexical/table";import{$isRangeSelection as Pu,FORMAT_TEXT_COMMAND as Bu}from"lexical";import{jsx as jn,jsxs as $u}from"react/jsx-runtime";import"react";var Hn=()=>$u("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[jn("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),jn("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var Un={type:"text-format",format:["code"],tag:"`"};var Wn=[Y([{ChildComponent:Hn,isActive:({selection:t})=>Pu(t)||Fu(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Bu,"code")},order:7}])],ju=M({enableFormats:["code"],markdownTransformers:[Un],toolbarFixed:{groups:Wn},toolbarInline:{groups:Wn}});import{$isTableSelection as Hu}from"@lexical/table";import{$isRangeSelection as Uu,FORMAT_TEXT_COMMAND as Wu}from"lexical";import{jsx as Gn}from"react/jsx-runtime";import"react";var Vn=()=>Gn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Gn("path",{d:"M11.311 14.2969L11.0327 15H6.18408L6.4624 14.2969C7.54639 14.2969 7.70752 14.209 7.83936 13.8721L10.8423 6.45996C10.8716 6.38672 10.8862 6.32812 10.8862 6.26953C10.8862 6.09375 10.6519 6.03516 9.80225 6.03516L10.0952 5.33203H14.9438L14.6509 6.03516C13.5669 6.03516 13.4204 6.12305 13.2886 6.45996L10.2856 13.8721C10.2563 13.9453 10.2271 14.0039 10.2271 14.0625C10.2271 14.2383 10.4614 14.2969 11.311 14.2969Z",fill:"currentColor"})});var Kn={type:"text-format",format:["italic"],tag:"*"},Jn={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var Xn=[Y([{ChildComponent:Vn,isActive:({selection:t})=>Uu(t)||Hu(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(Wu,"italic")},order:2}])],Gu=M({enableFormats:["italic"],markdownTransformers:[Kn,Jn],toolbarFixed:{groups:Xn},toolbarInline:{groups:Xn}});import{$isTableSelection as Ku}from"@lexical/table";import{$isRangeSelection as Ju,FORMAT_TEXT_COMMAND as Xu}from"lexical";import{jsx as zn,jsxs as Vu}from"react/jsx-runtime";import"react";var Zn=()=>Vu("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[zn("path",{d:"M5.50756 12.76H7.42756C7.56256 14.215 8.82256 14.71 10.1576 14.71C11.4326 14.71 12.4226 14.14 12.4226 13.06C12.4226 12.28 11.9576 11.845 10.6676 11.605L8.70256 11.245C7.12756 10.96 5.85256 10.21 5.85256 8.335C5.85256 6.43 7.53256 5.11 9.87256 5.11C12.4226 5.11 13.9526 6.22 14.1626 8.23H12.2876C12.1526 7.18 11.2226 6.595 9.88756 6.595C8.59756 6.595 7.78756 7.27 7.78756 8.215C7.78756 9.1 8.34256 9.385 9.49756 9.61L11.5676 10.015C13.3226 10.345 14.3726 11.215 14.3726 12.94C14.3726 14.89 12.5876 16.18 10.2176 16.18C7.66756 16.18 5.70256 15.115 5.50756 12.76Z",fill:"currentColor"}),zn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var Yn={type:"text-format",format:["strikethrough"],tag:"~~"};var qn=[Y([{ChildComponent:Zn,isActive:({selection:t})=>Ju(t)||Ku(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(Xu,"strikethrough")},order:4}])],zu=M({enableFormats:["strikethrough"],markdownTransformers:[Yn],toolbarFixed:{groups:qn},toolbarInline:{groups:qn}});import{$isTableSelection as Zu}from"@lexical/table";import{$isRangeSelection as Yu,FORMAT_TEXT_COMMAND as qu}from"lexical";import{jsx as Qn}from"react/jsx-runtime";import"react";var el=()=>Qn("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Qn("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 13.258C16.7768 14.155 16.1398 14.532 15.2038 15C14.5538 15.325 14.2808 15.546 14.2418 15.78H16.7898V16.82H12.7208V16.339C12.7208 15.286 13.5918 14.675 14.3588 14.233C15.0868 13.83 15.4378 13.635 15.4378 13.232C15.4378 12.894 15.2038 12.686 14.8268 12.686C14.3848 12.686 14.1248 13.024 14.1118 13.427H12.7468C12.8248 12.426 13.5528 11.633 14.8398 11.633C15.9448 11.633 16.7768 12.257 16.7768 13.258Z",fill:"currentColor"})});var tl=[Y([{ChildComponent:el,isActive:({selection:t})=>Yu(t)||Zu(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(qu,"subscript")},order:5}])],Qu=M({enableFormats:["subscript"],toolbarFixed:{groups:tl},toolbarInline:{groups:tl}});import{$isTableSelection as ed}from"@lexical/table";import{$isRangeSelection as td,FORMAT_TEXT_COMMAND as od}from"lexical";import{jsx as ol}from"react/jsx-runtime";import"react";var rl=()=>ol("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:ol("path",{d:"M10.167 15L7.45002 11.36L4.73302 15H2.91302L6.55302 10.177L3.23802 5.718H5.20102L7.54102 8.89L9.89402 5.718H11.714L8.43802 10.06L12.13 15H10.167ZM16.7768 7.252C16.7768 8.149 16.1398 8.526 15.2038 8.994C14.5538 9.319 14.2808 9.54 14.2418 9.774H16.7898V10.814H12.7208V10.333C12.7208 9.28 13.5918 8.669 14.3588 8.227C15.0868 7.824 15.4378 7.629 15.4378 7.226C15.4378 6.888 15.2038 6.68 14.8268 6.68C14.3848 6.68 14.1248 7.018 14.1118 7.421H12.7468C12.8248 6.42 13.5528 5.627 14.8398 5.627C15.9448 5.627 16.7768 6.251 16.7768 7.252Z",fill:"currentColor"})});var nl=[Y([{ChildComponent:rl,isActive:({selection:t})=>td(t)||ed(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(od,"superscript")},order:6}])],rd=M({enableFormats:["superscript"],toolbarFixed:{groups:nl},toolbarInline:{groups:nl}});import{$isTableSelection as ld}from"@lexical/table";import{$isRangeSelection as id,FORMAT_TEXT_COMMAND as sd}from"lexical";import{jsx as ll,jsxs as nd}from"react/jsx-runtime";import"react";var il=()=>nd("svg",{"aria-hidden":"true",className:"icon",fill:"currentColor",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ll("path",{d:"M13.9656 11.256C13.9656 13.791 12.5096 15.156 10.0006 15.156C7.50461 15.156 6.03561 13.791 6.03561 11.23V5.718H7.76461V11.243C7.76461 12.868 8.50561 13.778 10.0006 13.778C11.4956 13.778 12.2496 12.868 12.2496 11.243V5.718H13.9656V11.256Z",fill:"currentColor"}),ll("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var sl=[Y([{ChildComponent:il,isActive:({selection:t})=>id(t)||ld(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(sd,"underline")},order:3}])],ad=M({enableFormats:["underline"],toolbarFixed:{groups:sl},toolbarInline:{groups:sl}});import{jsx as Zo}from"react/jsx-runtime";import{jsx as cd}from"react/jsx-runtime";function ud(t){return t.replace(/-([a-z])/g,(e,o)=>o.toUpperCase())}var no=({css:t})=>{let e=t?Object.fromEntries(Object.entries(t).map(([o,r])=>[ud(o),r])):{};return cd("span",{style:{...e,alignItems:"center",borderRadius:"4px",display:"flex",fontSize:"16px",height:"20px",justifyContent:"center",width:"20px"},children:"A"})};import{useLexicalComposerContext as dd}from"@lexical/react/LexicalComposerContext";import{$forEachSelectedTextNode as md}from"@lexical/selection";import{$getNodeByKey as pd,$getState as fd,$setState as hd,createState as gd,TextNode as xd}from"lexical";import{useEffect as Cd}from"react";var Xo=new Map;function al(t){for(let e in t){let o=t[e],r=gd(e,{parse:n=>typeof n=="string"&&Object.keys(o).includes(n)?n:void 0});Xo.set(e,{stateConfig:r,stateValues:o})}}function zo(t,e,o){t.update(()=>{md(r=>{let n=Xo.get(e);if(!n)throw new Error(`State config for ${e} not found`);hd(r,n.stateConfig,o)})})}function cl(){let[t]=dd();return Cd(()=>t.registerMutationListener(xd,e=>{t.getEditorState().read(()=>{for(let[o,r]of e){if(r==="destroyed")continue;let n=pd(o),l=t.getElementByKey(o);if(!n||!l)continue;let i=Object.create(null);Xo.forEach((s,u)=>{let c=fd(n,s.stateConfig);if(!c){delete l.dataset[u];return}l.dataset[u]=c;let d=s.stateValues[c]?.css;d&&Object.assign(i,d)}),l.style.cssText="",Object.assign(l.style,i)}})}),[t]),null}var ul=t=>{let e=[];for(let r in t.state){let n=t.state[r];for(let l in n){let i=n[l];e.push({ChildComponent:()=>Zo(no,{css:i.css}),key:l,label:i.label,onSelect:({editor:s})=>{zo(s,r,l)}})}}return[{type:"dropdown",ChildComponent:()=>Zo(no,{css:{color:"var(--theme-elevation-600)"}}),items:[...[{ChildComponent:()=>Zo(no,{}),key:"clear-style",label:({i18n:r})=>r.t("lexical:textState:defaultStyle"),onSelect:({editor:r})=>{for(let n in t.state)zo(r,n,void 0)},order:1}],...e],key:"textState",order:30}]},bd=M(({props:t})=>(al(t.state),{plugins:[{Component:cl,position:"normal"}],toolbarFixed:{groups:ul(t)},toolbarInline:{groups:ul(t)}}));import{c as wd}from"react/compiler-runtime";import{useLexicalComposerContext as Ed}from"@lexical/react/LexicalComposerContext";import{$createHeadingNode as Sd,$isHeadingNode as El,HeadingNode as Ll}from"@lexical/rich-text";import{$setBlocksType as Nd}from"@lexical/selection";import{$getSelection as Ld,$isRangeSelection as yd}from"lexical";import{useEffect as Rd}from"react";import{jsx as dl}from"react/jsx-runtime";import"react";var ml=()=>dl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:dl("path",{d:"M4.639 13.5V7.074H6.196V9.648H9.076V7.074H10.642V13.5H9.076V10.836H6.196V13.5H4.639ZM11.5656 9.045V8.019C12.6636 8.019 13.1316 7.731 13.2846 7.065H14.4006V13.5H12.8436V9.045H11.5656Z",fill:"currentColor"})});import{jsx as pl}from"react/jsx-runtime";import"react";var fl=()=>pl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:pl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM15.9796 8.973C15.9796 10.116 15.1696 10.656 14.0356 11.232C13.2256 11.646 12.8206 11.943 12.7846 12.294H15.9886V13.5H11.0566V12.951C11.0566 11.601 12.1636 10.845 13.1176 10.287C14.0356 9.756 14.5126 9.486 14.5126 8.946C14.5126 8.46 14.2156 8.145 13.6306 8.145C13.0186 8.145 12.6586 8.613 12.6226 9.198H11.1196C11.2186 7.947 12.1006 6.966 13.6396 6.966C15.0346 6.966 15.9796 7.785 15.9796 8.973Z",fill:"currentColor"})});import{jsx as hl}from"react/jsx-runtime";import"react";var gl=()=>hl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:hl("path",{d:"M4.139 13.5V7.074H5.696V9.648H8.576V7.074H10.142V13.5H8.576V10.836H5.696V13.5H4.139ZM16.1146 11.745C16.1146 12.744 15.2236 13.608 13.6126 13.608C12.0736 13.608 11.0926 12.762 10.9846 11.547H12.4696C12.5146 12.114 13.0006 12.456 13.6126 12.456C14.2876 12.456 14.6746 12.132 14.6746 11.619C14.6746 11.061 14.2426 10.836 13.6216 10.836H12.9826V9.738H13.6036C14.1526 9.738 14.5486 9.486 14.5486 8.937C14.5486 8.46 14.2156 8.127 13.6486 8.127C13.0366 8.127 12.6586 8.514 12.6226 9.045H11.1916C11.2726 7.929 12.1276 6.966 13.6666 6.966C15.1876 6.966 15.9706 7.848 15.9706 8.865C15.9706 9.603 15.5026 10.143 14.8186 10.269C15.6196 10.404 16.1146 10.971 16.1146 11.745Z",fill:"currentColor"})});import{jsx as xl}from"react/jsx-runtime";import"react";var Cl=()=>xl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:xl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM15.1736 7.074V10.854H16.3706V12.033H15.1736V13.5H13.6796V12.033H10.5116V10.845L13.4996 7.074H15.1736ZM13.6796 8.46L11.8256 10.854H13.6796V8.46Z",fill:"currentColor"})});import{jsx as bl}from"react/jsx-runtime";import"react";var kl=()=>bl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:bl("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.1576 10.269C12.6896 10.269 12.3746 10.494 12.2216 10.737H10.8176L11.1956 7.074H15.2546V8.28H12.3206L12.1856 9.549C12.4016 9.351 12.8516 9.126 13.4636 9.126C14.7866 9.126 15.6596 10.053 15.6596 11.358C15.6596 12.609 14.7326 13.608 13.1756 13.608C11.5826 13.608 10.6556 12.753 10.5566 11.511H12.1136C12.1586 12.06 12.5456 12.465 13.1576 12.465C13.8236 12.465 14.1746 11.97 14.1746 11.376C14.1746 10.764 13.8416 10.269 13.1576 10.269Z",fill:"currentColor"})});import{jsx as _l}from"react/jsx-runtime";import"react";var Tl=()=>_l("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_l("path",{d:"M3.639 13.5V7.074H5.196V9.648H8.076V7.074H9.642V13.5H8.076V10.836H5.196V13.5H3.639ZM13.3646 8.127C12.5456 8.127 12.0416 8.937 12.0416 9.999C12.3296 9.54 12.8246 9.207 13.5536 9.207C14.8586 9.207 15.8036 10.134 15.8036 11.376C15.8036 12.645 14.8226 13.608 13.3196 13.608C11.7266 13.608 10.6196 12.393 10.6196 10.395C10.6196 8.316 11.7716 6.966 13.4186 6.966C14.7056 6.966 15.5786 7.749 15.7316 8.829H14.3186C14.2016 8.415 13.9226 8.127 13.3646 8.127ZM13.3106 12.51C13.9586 12.51 14.3816 12.042 14.3816 11.385C14.3816 10.737 13.9586 10.278 13.3106 10.278C12.6536 10.278 12.2126 10.737 12.2126 11.385C12.2126 12.042 12.6536 12.51 13.3106 12.51Z",fill:"currentColor"})});import{$createHeadingNode as kd,$isHeadingNode as _d,HeadingNode as Td}from"@lexical/rich-text";var Yo=t=>(e,o,r)=>{let n=t(r);n&&(n.append(...o),e.replace(n),n.select(0,0))};var wl=t=>{let o=`^(${t.map(n=>Number(n.slice(1))).map(n=>`#{${n}}`).join("|")})\\s`,r=new RegExp(o);return{type:"element",dependencies:[Td],export:(n,l)=>{if(!_d(n))return null;let i=Number(n.getTag().slice(1));return"#".repeat(i)+" "+l(n)},regExp:r,replace:Yo(n=>{let l="h"+n[1]?.length;return kd(l)})}};var Sl=t=>{let e=Ld();Nd(e,()=>Sd(t))},Nl={h1:ml,h2:fl,h3:gl,h4:Cl,h5:kl,h6:Tl},Id=M(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[Q(e.map((r,n)=>({ChildComponent:Nl[r],isActive:({selection:l})=>{if(!yd(l))return!1;for(let i of l.getNodes()){if(El(i)&&i.getTag()===r)continue;let s=i.getParent();if(!(El(s)&&s.getTag()===r))return!1}return!0},key:r,label:({i18n:l})=>l.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:l})=>{l.update(()=>{Sl(r)})},order:n+2})))];return{markdownTransformers:[wl(e)],nodes:[Ll],plugins:[{Component:vd,position:"normal"}],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(r=>({Icon:Nl[r],key:`heading-${r.charAt(1)}`,keywords:["heading",r],label:({i18n:n})=>n.t("lexical:heading:label",{headingLevel:r.charAt(1)}),onSelect:({editor:n})=>{n.update(()=>{Sl(r)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}}),vd=t=>{let e=wd(9),{clientProps:o}=t,{enabledHeadingSizes:r}=o,n;e[0]!==r?(n=r===void 0?["h1","h2","h3","h4","h5","h6"]:r,e[0]=r,e[1]=n):n=e[1];let l=n,i;e[2]!==l?(i=l.at(-1),e[2]=l,e[3]=i):i=e[3];let s=i,[u]=Ed(),c,d;return e[4]!==u||e[5]!==l||e[6]!==s?(c=()=>{if(!(!s||l.length===6))return u.registerNodeTransform(Ll,a=>{l.includes(a.getTag())||a.setTag(s)})},d=[u,l,s],e[4]=u,e[5]=l,e[6]=s,e[7]=c,e[8]=d):(c=e[7],d=e[8]),Rd(c,d),null};import{$isNodeSelection as Jd}from"lexical";import{jsx as yl}from"react/jsx-runtime";import"react";var qo=()=>yl("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yl("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Rl,jsxs as Md}from"react/jsx-runtime";import"react";var Il=()=>Md("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Rl("path",{d:"M5 10h10",stroke:"currentColor"}),Rl("path",{d:"M10 15V5",stroke:"currentColor"})]});var he=t=>({type:"dropdown",ChildComponent:Il,items:t,key:"add",order:10});import{addClassNamesToElement as Dd}from"@lexical/utils";import{$applyNodeReplacement as Ad,createCommand as Od,DecoratorNode as $d}from"lexical";var Ct=Od("INSERT_HORIZONTAL_RULE_COMMAND"),xt=class extends $d{static clone(e){return new this(e.__key)}static getType(){return"horizontalrule"}static importDOM(){return{hr:()=>({conversion:Fd,priority:0})}}static importJSON(e){return vl()}createDOM(e){let o=document.createElement("hr");return Dd(o,e.theme.hr),o}decorate(){return null}exportDOM(){return{element:document.createElement("hr")}}exportJSON(){return{type:"horizontalrule",version:1}}getTextContent(){return`
|
|
55
|
+
`}isInline(){return!1}updateDOM(){return!1}};function Fd(){return{node:vl()}}function vl(){return Ad(new xt)}import{$applyNodeReplacement as Pd}from"lexical";import"react";var Ne=class extends xt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importJSON(e){return bt()}decorate(){return null}exportJSON(){return super.exportJSON()}};function bt(){return Pd(new Ne)}function lo(t){return t instanceof Ne}var Ml={type:"element",dependencies:[Ne],export:(t,e)=>lo(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=bt();e&&t.replace(e)}};import{c as Bd}from"react/compiler-runtime";import{useLexicalComposerContext as jd}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Hd}from"@lexical/utils";import{$getSelection as Ud,$isRangeSelection as Wd,COMMAND_PRIORITY_EDITOR as Gd}from"lexical";import{useEffect as Vd}from"react";var Dl=()=>{let t=Bd(3),[e]=jd(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ct,Kd,Gd),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Vd(o,r),null};function Kd(t){let e=Ud();if(!Wd(e))return!1;if(e.focus.getNode()!==null){let r=bt();Hd(r)}return!0}var Xd=M({markdownTransformers:[Ml],nodes:[Ne],plugins:[{Component:Dl,position:"normal"}],slashMenu:{groups:[Z([{Icon:qo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ct,void 0)}}])]},toolbarFixed:{groups:[he([{ChildComponent:qo,isActive:({selection:t})=>{if(!Jd(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return lo(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ct,void 0)}}])]}});import{$findMatchingParent as Wl}from"@lexical/utils";import{$isElementNode as sm,INDENT_CONTENT_COMMAND as am,OUTDENT_CONTENT_COMMAND as cm}from"lexical";import{jsx as io,jsxs as zd}from"react/jsx-runtime";import"react";var Al=()=>zd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[io("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),io("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),io("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),io("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as so,jsxs as Zd}from"react/jsx-runtime";import"react";var Ol=()=>Zd("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[so("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),so("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{jsx as Yd}from"react/jsx-runtime";import{useLexicalComposerContext as qd}from"@lexical/react/LexicalComposerContext";import{TabIndentationPlugin as Qd}from"@lexical/react/LexicalTabIndentationPlugin";import{$findMatchingParent as em,mergeRegister as $l}from"@lexical/utils";import{$getSelection as tm,$isElementNode as jl,$isRangeSelection as om,COMMAND_PRIORITY_LOW as Fl,INDENT_CONTENT_COMMAND as Pl,KEY_TAB_COMMAND as rm,OUTDENT_CONTENT_COMMAND as nm,TabNode as lm}from"lexical";import{useEffect as Bl}from"react";var Hl=({clientProps:t})=>{let[e]=qd(),{disabledNodes:o,disableTabNode:r}=t;return Bl(()=>{if(!(!e||!o?.length))return $l(e.registerCommand(Pl,()=>im(n=>{if(!o.includes(n.getType())){let l=n.getIndent();n.setIndent(l+1)}}),Fl),e.registerUpdateListener(({dirtyElements:n,editorState:l})=>{e.update(()=>{for(let[i]of n){let s=l._nodeMap.get(i);jl(s)&&o.includes(s.getType())&&s.getIndent()>0&&s.setIndent(0)}})}))},[e,o]),Bl(()=>{if(!(!e||!r))return $l(e.registerCommand(rm,n=>(n.preventDefault(),e.dispatchCommand(n.shiftKey?nm:Pl,void 0)),Fl),e.registerNodeTransform(lm,n=>{n.remove()}))},[e,r]),Yd(Qd,{})};function im(t){let e=tm();if(!om(e))return!1;let o=new Set,r=e.getNodes();for(let n=0;n<r.length;n++){let l=r[n],i=l.getKey();if(o.has(i))continue;let s=em(l,c=>jl(c)&&!c.isInline());if(s===null)continue;let u=s.getKey();s.canIndent()&&!o.has(u)&&(o.add(u),t(s))}return o.size>0}var Ul=t=>({type:"buttons",items:t,key:"indent",order:35});var Gl=({disabledNodes:t})=>[Ul([{ChildComponent:Al,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Vl(n)&&n.getIndent()>0;return o.some(n=>r(n)||!!Wl(n,r))},key:"indentDecrease",label:({i18n:e})=>e.t("lexical:indent:decreaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(cm,void 0)},order:1},{ChildComponent:Ol,isActive:()=>!1,isEnabled:({selection:e})=>{let o=e?.getNodes()??[],r=n=>Vl(n)&&!(t??[]).includes(n.getType());return o.some(n=>r(n)||!!Wl(n,r))},key:"indentIncrease",label:({i18n:e})=>e.t("lexical:indent:increaseLabel"),onSelect:({editor:e})=>{e.dispatchCommand(am,void 0)},order:2}])],um=M(({props:t})=>{let e=t.disabledNodes??[];return{plugins:[{Component:Hl,position:"normal"}],sanitizedClientFeatureProps:t,toolbarFixed:{groups:Gl({disabledNodes:e})},toolbarInline:{groups:Gl({disabledNodes:e})}}}),Vl=t=>sm(t)&&t.canIndent();import{$findMatchingParent as Tp}from"@lexical/utils";import{$getSelection as sr,$isRangeSelection as Ti}from"lexical";import{jsx as Kl}from"react/jsx-runtime";import"react";var Jl=()=>Kl("svg",{"aria-hidden":"true",className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Kl("path",{d:"M8.5 11.5L11.5 8.5M8.5 7L9.625 5.875C10.868 4.633 12.882 4.633 14.125 5.875C15.368 7.118 15.368 9.133 14.125 10.375L13 11.5M7 8.5L5.746 9.754C4.56 10.94 4.519 12.85 5.652 14.087C6.814 15.354 8.78 15.449 10.058 14.298L11.5 13",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})});import{$isAtNodeEnd as Xl}from"@lexical/selection";function Je(t){let{anchor:e}=t,{focus:o}=t,r=t.anchor.getNode(),n=t.focus.getNode();return r===n?r:t.isBackward()?Xl(o)?r:n:Xl(e)?r:n}var Qo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as _m}from"lexical";import{addClassNamesToElement as dm,isHTMLAnchorElement as mm}from"@lexical/utils";import or from"bson-objectid";import{$applyNodeReplacement as pm,$createTextNode as zl,$getSelection as fm,$isElementNode as Zl,$isRangeSelection as tr,createCommand as hm,ElementNode as gm}from"lexical";var xm=new Set(["http:","https:","mailto:","sms:","tel:"]),ee=class t extends gm{__fields;__id;constructor({id:e,fields:o={linkType:"custom",newTab:!1},key:r}){super(r),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:Cm,priority:1})}}static importJSON(e){let o=ge({}).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 or.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=er(o.rel,"add","noopener")),dm(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},r=this.getID();return r&&(o.id=r),o}extractWithChild(e,o,r){if(!tr(o))return!1;let n=o.anchor.getNode(),l=o.focus.getNode();return this.isParentOf(n)&&this.isParentOf(l)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let r=this.getParentOrThrow().insertNewAfter(e,o);if(Zl(r)){let n=ge({fields:this.__fields});return r.append(n),n}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!xm.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,r){let n=this.__fields?.url,l=this.__fields?.newTab;return n!=null&&n!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=n),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=er(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=er(o.rel,"remove","noopener"))),!1}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields).setID(e.id)}};function Cm(t){let e=null;if(mm(t)){let o=t.textContent;o!==null&&o!==""&&(e=ge({id:new or.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function ge({id:t,fields:e}){return pm(new ee({id:t??new or.default().toHexString(),fields:e}))}function J(t){return t instanceof ee}var ue=hm("TOGGLE_LINK_COMMAND");function rr(t){let e=fm();if(!tr(e)&&(t===null||!t.selectedNodes?.length))return;let o=tr(e)?e.extract():t===null?[]:t.selectedNodes;if(t===null){o?.forEach(l=>{let i=l.getParent();J(i)&&(i.getChildren().forEach(u=>{i.insertBefore(u)}),i.remove())});return}if(o?.length===1){let l=o[0],i=J(l)?l:bm(l);if(i!==null){i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(zl(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}}let r=null,n=null;o?.forEach(l=>{let i=l.getParent();if(!(i===n||i===null||Zl(l)&&!l.isInline())){if(J(i)){n=i,i.setFields(t.fields),t.text!=null&&t.text!==i.getTextContent()&&(i.append(zl(t.text)),i.getChildren().forEach(s=>{s!==i.getLastChild()&&s.remove()}));return}if(i.is(r)||(r=i,n=ge({fields:t.fields}),J(i)?l.getPreviousSibling()===null?i.insertBefore(n):i.insertAfter(n):l.insertBefore(n)),J(l)){if(l.is(n))return;if(n!==null){let s=l.getChildren();n.append(...s)}l.remove();return}n!==null&&n.append(l)}})}function bm(t){return km(t,e=>J(e))}function km(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function er(t,e,o){let r,n=`${t}`;if(e==="add"){if(n.includes(o)){let l=new RegExp(o,"g");n=n.replace(l,"").trim()}n=n.trim(),r=n.length===0?`${o}`:`${n} ${o}`}else{let l=new RegExp(o,"g");r=n.replace(l,"").trim()}return r}var Yl={type:"text-match",dependencies:[ee],export:(t,e)=>{if(!J(t))return null;let o=t,{url:r}=o.getFields();return`[${e(o)}](${r})`},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,r]=e,n=ge({fields:{doc:null,linkType:"custom",newTab:!1,url:r}}),l=_m(o);return l.setFormat(t.getFormat()),n.append(l),t.replace(n),l},trigger:")"};import{$applyNodeReplacement as Tm,$isElementNode as wm}from"lexical";var xe=class t extends ee{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){let o=kt({}).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 r=this.getParentOrThrow().insertNewAfter(e,o);if(wm(r)){let n=kt({fields:this.__fields});return r.append(n),n}return null}updateFromJSON(e){return super.updateFromJSON(e).setFields(e.fields)}};function kt({fields:t}){return Tm(new xe({id:"",fields:t}))}function Ce(t){return t instanceof xe}import{c as Em}from"react/compiler-runtime";import{useLexicalComposerContext as Sm}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Nm}from"@lexical/utils";import{$createTextNode as ql,$getSelection as Lm,$isElementNode as ei,$isLineBreakNode as ti,$isNodeSelection as ym,$isRangeSelection as Rm,$isTextNode as _t,TextNode as Im}from"lexical";import{useEffect as vm}from"react";function Ql(t,e=o=>o){return o=>{let r=t.exec(o);return r===null?null:{index:r.index,length:r[0].length,text:r[0],url:e(r[0])}}}function oi(t,e){for(let o of e){let r=o(t);if(r!=null)return r}return null}var Mm=/[.,;\s]/;function co(t){return t!==void 0&&Mm.test(t)}function ri(t){return co(t[t.length-1])}function lr(t){return co(t[0])}function Dm(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function ni(t){let e=t.getPreviousSibling();return ei(e)&&(e=e.getLastDescendant()),e===null||ti(e)||_t(e)&&ri(e.getTextContent())}function li(t){let e=t.getNextSibling();return ei(e)&&(e=e.getFirstDescendant()),e===null||ti(e)||_t(e)&&lr(e.getTextContent())}function Am(t,e,o,r){return(t>0?co(o[t-1]):ni(r[0]))?e<o.length?co(o[e]):li(r[r.length-1]):!1}function Om(t,e,o){let r=[],n=[],l=[],i=0,s=0,u=[...t];for(;u.length>0;){let c=u[0],a=c.getTextContent().length,m=s;s+a<=e?(r.push(c),i+=a):m>=o?l.push(c):n.push(c),s+=a,u.shift()}return[i,r,n,l]}function $m(t,e,o,r){let n={linkType:"custom",url:r.url,...r.fields},l=kt({fields:n});if(t.length===1){let i=t[0],s;if(e===0?[s]=i.splitText(o):[,s]=i.splitText(e,o),s){let u=ql(r.text);u.setFormat(s.getFormat()),u.setDetail(s.getDetail()),u.setStyle(s.getStyle()),l.append(u),s.replace(l)}return i}else if(t.length>1){let i=t[0],s=i.getTextContent().length,u;e===0?u=i:[,u]=i.splitText(e);let c=[],d;if(t.forEach(a=>{let p=a.getTextContent().length,f=s,h=s+p;if(f<o)if(h<=o)c.push(a);else{let[g,C]=a.splitText(o-f);g&&c.push(g),d=C}s+=p}),u){let a=Lm(),m=a?a.getNodes().find(_t):void 0,p=ql(u.getTextContent());return p.setFormat(u.getFormat()),p.setDetail(u.getDetail()),p.setStyle(u.getStyle()),l.append(p,...c),m&&m===u&&(Rm(a)?p.select(a.anchor.offset,a.focus.offset):ym(a)&&p.select(0,p.getTextContent().length)),u.replace(l),d}}}function Fm(t,e,o){let r=[...t],n=r.map(u=>u.getTextContent()).join(""),l=n,i,s=0;for(;(i=oi(l,e))!=null&&i!==null;){let u=i.index,c=i.length,d=u+c;if(Am(s+u,s+d,n,r)){let[m,,p,f]=Om(r,s+u,s+d),h=s+u-m,g=s+d-m,C=$m(p,h,g,i);r=C?[C,...f]:f,o(i.url,null),s=0}else s+=d;l=l.substring(d)}}function nr(t,e,o){let r=t.getChildren(),n=r.length;for(let u=0;u<n;u++){let c=r[u];if(!_t(c)||!c.isSimpleText()){ao(t),o(null,t.getFields()?.url??null);return}}let l=t.getTextContent(),i=oi(l,e);if(i===null||i.text!==l){ao(t),o(null,t.getFields()?.url??null);return}if(!ni(t)||!li(t)){ao(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==i?.url){let u=t.getFields();u.url=i?.url,t.setFields(u),o(i.url,s??null)}}function Pm(t,e,o){let r=t.getPreviousSibling(),n=t.getNextSibling(),l=t.getTextContent();if(Ce(r)){let i=r.getFields()?.url?r.getFields()?.url?.startsWith("mailto:")??!1:!1;(!lr(l)||Dm(l,i))&&(r.append(t),nr(r,e,o),o(null,r.getFields()?.url??null))}Ce(n)&&!ri(l)&&(ao(n),nr(n,e,o),o(null,n.getFields()?.url??null))}function ao(t){let e=t.getChildren(),o=e.length;for(let r=o-1;r>=0;r--)t.insertAfter(e[r]);return t.remove(),e.map(r=>r.getLatest())}function Bm(t){let e=[t],o=t.getNextSibling();for(;o!==null&&_t(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function jm(t,e,o){let r=Em(5),n,l;r[0]!==t||r[1]!==e||r[2]!==o?(n=()=>{if(!t.hasNodes([xe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let i=(s,u)=>{o?.(s,u)};return Nm(t.registerNodeTransform(Im,s=>{let u=s.getParentOrThrow(),c=s.getPreviousSibling();if(Ce(u))nr(u,e,i);else if(!J(u)){if(s.isSimpleText()&&(lr(s.getTextContent())||!Ce(c))){let d=Bm(s);Fm(d,e,i)}Pm(s,e,i)}}))},l=[t,e,o],r[0]=t,r[1]=e,r[2]=o,r[3]=n,r[4]=l):(n=r[3],l=r[4]),vm(n,l)}var Hm=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Um=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Wm=[Ql(Hm,t=>t.startsWith("http")?t:`https://${t}`),Ql(Um,t=>`mailto:${t}`)],ii=()=>{let[t]=Sm();return jm(t,Wm),null};import{jsx as Gm}from"react/jsx-runtime";import{ClickableLinkPlugin as Vm}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var si=()=>Gm(Vm,{});import{jsx as cp}from"react/jsx-runtime";import"react";import{createPortal as up}from"react-dom";import{jsx as be,jsxs as Tt,Fragment as Jm}from"react/jsx-runtime";import{useLexicalComposerContext as Xm}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as ai,mergeRegister as ci}from"@lexical/utils";import{getTranslation as ir}from"@payloadcms/translations";import{CloseMenuIcon as zm,EditIcon as Zm,ExternalLinkIcon as ui,formatDrawerSlug as Ym,useConfig as qm,useEditDepth as Qm,useLocale as ep,useTranslation as tp}from"@payloadcms/ui";import{requests as op}from"@payloadcms/ui/shared";import{$getSelection as di,$isLineBreakNode as rp,$isRangeSelection as mi,COMMAND_PRIORITY_HIGH as np,COMMAND_PRIORITY_LOW as pi,getDOMSelection as lp,KEY_ESCAPE_COMMAND as ip,SELECTION_CHANGE_COMMAND as sp}from"lexical";import fi,{useCallback as hi,useEffect as po,useRef as ap,useState as $e}from"react";function uo(t,e,o,r=10,n=5){let l=o.parentElement;if(t===null||l==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let i=e.getBoundingClientRect(),s=o.getBoundingClientRect(),u=l.getBoundingClientRect(),c=t.top-r,d=t.left-n;c<u.top&&(c+=i.height+t.height+r*2),d+i.width>u.right&&(d=u.right-i.width-n),c-=s.top,d-=s.left,e.style.opacity="1",e.style.transform=`translate(${d}px, ${c}px)`}import{createCommand as Km}from"lexical";var mo=Km("TOGGLE_LINK_WITH_MODAL_COMMAND");function gi(t){t.preventDefault()}function xi({anchorElem:t}){let[e]=Xm(),[o,r]=$e(),n=ap(null),[l,i]=$e(null),[s,u]=$e(null),{fieldProps:{schemaPath:c},uuid:d}=j(),{config:a,getEntityConfig:m}=qm(),{i18n:p,t:f}=tp(),[h,g]=$e(),C=Qm(),[_,S]=$e(!1),[b,k]=$e([]),x=ep(),[w,T]=$e(!1),y=Ym({slug:"lexical-rich-text-link-"+d,depth:C}),{toggleDrawer:$}=pe(y),v=hi(()=>{S(!1),n&&n.current&&(n.current.style.opacity="0",n.current.style.transform="translate(-10000px, -10000px)"),T(!1),i(null),u(null),k([]),g(void 0)},[S,i,u,k]),N=hi(()=>{let E=di(),L;if(!mi(E)||!E){v();return}let D=Je(E);L=e.getElementByKey(D.getKey())?.getBoundingClientRect();let I=ai(D,J),A=E.getNodes().filter(X=>!rp(X)).find(X=>{let U=ai(X,J);return I&&!I.is(U)||U&&!U.is(I)});if(I==null||A){v();return}r(I);let R=I.getFields(),F={...R,id:I.getID(),text:I.getTextContent()};if(R?.linkType==="custom")i(R?.url??null),u(null);else{i(`${a.routes.admin==="/"?"":a.routes.admin}/collections/${R?.doc?.relationTo}/${R?.doc?.value}`);let X=R?.doc?.relationTo?m({collectionSlug:R?.doc?.relationTo}):void 0;if(!X)u(R?.label?String(R?.label):null),i(R?.url?String(R?.url):null);else{let U=typeof R.doc?.value=="object"?R.doc.value.id:R.doc?.value,He=R.doc?.relationTo;if(!U||!He)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let we=f("fields:linkedTo",{label:`${ir(X.labels.singular,p)} - ${f("lexical:link:loadingWithEllipsis",p)}`}).replace(/<[^>]*>?/g,"");u(we),op.get(`${a.serverURL}${a.routes.api}/${He}/${U}`,{headers:{"Accept-Language":p.language},params:{depth:0,locale:x?.code}}).then(async me=>{if(!me.ok)throw new Error(`HTTP error! Status: ${me.status}`);let Ft=await me.json(),Ee=X?.admin?.useAsTitle||"id",Pt=Ft[Ee],Ue=f("fields:linkedTo",{label:`${ir(X.labels.singular,p)} - ${Pt}`}).replace(/<[^>]*>?/g,"");u(Ue)}).catch(()=>{let me=f("fields:linkedTo",{label:`${ir(X.labels.singular,p)} - ${f("general:untitled",p)} - ID: ${U}`}).replace(/<[^>]*>?/g,"");u(me)})}}g(F),S(!0),k(E?E?.getNodes():[]),Ce(I)?T(!0):T(!1);let W=n.current,q=lp(e._window),{activeElement:te}=document;if(W===null)return;let $t=e.getRootElement();return q!==null&&$t!==null&&$t.contains(q.anchorNode)?(L||(L=q.getRangeAt(0).getBoundingClientRect()),L!=null&&(L.y+=40,uo(L,W,t))):(te==null||te.className!=="link-input")&&($t!==null&&uo(null,W,t),i(null),u(null)),!0},[e,v,a.routes.admin,a.routes.api,a.serverURL,m,f,p,x?.code,t]);return po(()=>ci(e.registerCommand(mo,E=>(e.dispatchCommand(ue,E),N(),$(),!0),pi)),[e,N,$,y]),po(()=>{let E=t.parentElement,L=()=>{e.getEditorState().read(()=>{N()})};return window.addEventListener("resize",L),E?.addEventListener("scroll",L),()=>{window.removeEventListener("resize",L),E?.removeEventListener("scroll",L)}},[t.parentElement,e,N]),po(()=>ci(e.registerUpdateListener(({editorState:E})=>{E.read(()=>{N()})}),e.registerCommand(sp,()=>(N(),!0),pi),e.registerCommand(ip,()=>_?(v(),!0):!1,np)),[e,N,_,v]),po(()=>{e.getEditorState().read(()=>{N()})},[e,N]),Tt(fi.Fragment,{children:[be("div",{className:"link-editor",ref:n,children:Tt("div",{className:"link-input",children:[l&&l.length>0?Tt("a",{href:l,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?be(ui,{}):null,s!=null&&s.length>0?s:l]}):s!=null&&s.length>0?Tt(Jm,{children:[o?.__fields.newTab?be(ui,{}):null,be("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&Tt(fi.Fragment,{children:[be("button",{"aria-label":"Edit link",className:"link-edit",onClick:E=>{E.preventDefault(),$()},onMouseDown:gi,tabIndex:0,type:"button",children:be(Zm,{})}),!w&&be("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(ue,null)},onMouseDown:gi,tabIndex:0,type:"button",children:be(zm,{})})]})]})}),be(ct,{className:"lexical-link-edit-drawer",data:h,drawerSlug:y,drawerTitle:f("fields:editLink"),featureKey:"link",handleDrawerSubmit:(E,L)=>{let D=L,I={...D};delete I.text,e.update(()=>{let A=di(),R=null;if(mi(A)?R=Je(A).getParent():b.length&&(R=b[0]?.getParent()??null),R&&Ce(R)){let F=ge({fields:I});R.replace(F,!0)}}),e.dispatchCommand(ue,{fields:I,selectedNodes:b,text:D.text})},schemaPath:c,schemaPathSuffix:"fields"})]})}var Ci=t=>{let{anchorElem:e=document.body}=t;return up(cp(xi,{anchorElem:e}),e)};import{c as pp}from"react/compiler-runtime";import{useLexicalComposerContext as fp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as hp}from"@lexical/utils";import{$getSelection as gp,$isElementNode as xp,$isRangeSelection as Cp,COMMAND_PRIORITY_LOW as ki,PASTE_COMMAND as bp}from"lexical";import{useEffect as kp}from"react";var dp=/^(?:[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+)?$/,mp=/^(?:\/[\w\-./]*(?:#\w[\w-]*)?|#[\w\-]+)$/;function bi(t){if(!t)return!1;if(t==="https://"||dp.test(t)||mp.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var _i=t=>{let e=pp(5),{clientProps:o}=t,[r]=fp(),n,l;return e[0]!==o.defaultLinkType||e[1]!==o.defaultLinkURL||e[2]!==r?(n=()=>{if(!r.hasNodes([ee]))throw new Error("LinkPlugin: LinkNode not registered on editor");return hp(r.registerCommand(ue,i=>i===null?(rr(null),!0):(i.fields?.linkType||(i.fields.linkType=o.defaultLinkType),i.fields?.url||(i.fields.url=o.defaultLinkURL),rr(i),!0),ki),r.registerCommand(bp,i=>{let s=gp();if(!Cp(s)||s.isCollapsed()||!(i instanceof ClipboardEvent)||i.clipboardData==null)return!1;let u=i.clipboardData.getData("text");if(!bi(u))return!1;if(!s.getNodes().some(_p)){let c={doc:null,linkType:"custom",newTab:!1,url:u};return r.dispatchCommand(ue,{fields:c,text:null}),i.preventDefault(),!0}return!1},ki))},l=[o.defaultLinkType,o.defaultLinkURL,r],e[0]=o.defaultLinkType,e[1]=o.defaultLinkURL,e[2]=r,e[3]=n,e[4]=l):(n=e[3],l=e[4]),kp(n,l),null};function _p(t){return xp(t)}var wi=[Qo([{ChildComponent:Jl,isActive:({selection:t})=>{if(Ti(t)){let e=Je(t);return Tp(e,J)!=null}return!1},isEnabled:({selection:t})=>!!(Ti(t)&&sr()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(ue,null);else{let o,r=[];if(t.getEditorState().read(()=>{o=sr()?.getTextContent(),r=sr()?.getNodes()??[]}),!o?.length)return;let n={doc:null};t.dispatchCommand(mo,{fields:n,selectedNodes:r,text:o})}},order:1}])],wp=M(({props:t})=>({markdownTransformers:[Yl],nodes:[ee,t?.disableAutoLinks===!0?null:xe].filter(Boolean),plugins:[{Component:_i,position:"normal"},t?.disableAutoLinks===!0||t?.disableAutoLinks==="creationOnly"?null:{Component:ii,position:"normal"},{Component:si,position:"normal"},{Component:Ci,position:"floatingAnchorElem"}].filter(Boolean),sanitizedClientFeatureProps:t,toolbarFixed:{groups:wi},toolbarInline:{groups:wi}}));import{$isListNode as ur,INSERT_CHECK_LIST_COMMAND as Ri,ListItemNode as Op,ListNode as $p}from"@lexical/list";import{$isRangeSelection as Fp}from"lexical";import{jsx as Ei,jsxs as Ep}from"react/jsx-runtime";import"react";var ar=()=>Ep("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ei("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),Ei("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as Sp}from"react/jsx-runtime";import{ListPlugin as Np}from"@lexical/react/LexicalListPlugin.js";import"react";var Xe=()=>Sp(Np,{});function ze(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Ip,ListItemNode as vp,ListNode as Mp}from"@lexical/list";import{$createListItemNode as Lp,$createListNode as yp,$isListItemNode as Rp,$isListNode as cr}from"@lexical/list";var Si=4,Ze=t=>(e,o,r)=>{let n=e.getPreviousSibling(),l=e.getNextSibling(),i=Lp(t==="check"?r[3]==="x":void 0);if(cr(l)&&l.getListType()===t){let u=l.getFirstChild();u!==null?u.insertBefore(i):l.append(i),e.remove()}else if(cr(n)&&n.getListType()===t)n.append(i),e.remove();else{let u=yp(t,t==="number"?Number(r[2]):void 0);u.append(i),e.replace(u)}i.append(...o),i.select(0,0);let s=Math.floor(r[1].length/Si);s&&i.setIndent(s)},Fe=(t,e,o)=>{let r=[],n=t.getChildren(),l=0;for(let i of n)if(Rp(i)){if(i.getChildrenSize()===1){let d=i.getFirstChild();if(cr(d)){r.push(Fe(d,e,o+1));continue}}let s=" ".repeat(o*Si),u=t.getListType(),c=u==="number"?`${t.getStart()+l}. `:u==="check"?`- [${i.getChecked()?"x":" "}] `:"- ";r.push(s+c+e(i)),l++}return r.join(`
|
|
56
|
+
`)};var Ni={type:"element",dependencies:[Mp,vp],export:(t,e)=>Ip(t)?Fe(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Ze("check")};import{jsx as Dp}from"react/jsx-runtime";import{CheckListPlugin as Ap}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Li=()=>Dp(Ap,{});var yi=[Q([{ChildComponent:ar,isActive:({selection:t})=>{if(!Fp(t))return!1;for(let e of t.getNodes()){if(ur(e)&&e.getListType()==="check")continue;let o=e.getParent();if(ur(o)&&o.getListType()==="check")continue;let r=o?.getParent();if(!(ur(r)&&r.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ri,void 0)},order:12}])],Pp=M(({featureProviderMap:t})=>{let e=[{Component:Li,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:Xe,position:"normal"}),{markdownTransformers:[Ni],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[$p,Op],plugins:e,slashMenu:{groups:[ze([{Icon:ar,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Ri,void 0)}}])]},toolbarFixed:{groups:yi},toolbarInline:{groups:yi}}});import{$isListNode as mr,INSERT_ORDERED_LIST_COMMAND as Mi,ListItemNode as Wp,ListNode as Gp}from"@lexical/list";import{$isRangeSelection as Vp}from"lexical";import{jsx as wt,jsxs as Bp}from"react/jsx-runtime";import"react";var dr=()=>Bp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[wt("path",{d:"M5.89284 12.479C5.89284 13.368 5.26284 13.788 4.38084 14.236C3.75084 14.558 3.43584 14.789 3.40784 15.062H5.89984V16H2.06384V15.573C2.06384 14.523 2.92484 13.935 3.66684 13.501C4.38084 13.088 4.75184 12.878 4.75184 12.458C4.75184 12.08 4.52084 11.835 4.06584 11.835C3.58984 11.835 3.30984 12.199 3.28184 12.654H2.11284C2.18984 11.681 2.87584 10.918 4.07284 10.918C5.15784 10.918 5.89284 11.555 5.89284 12.479Z",fill:"currentColor"}),wt("path",{d:"M2.68608 4.535V3.737C3.54008 3.737 3.90408 3.513 4.02308 2.995H4.89108V8H3.68008L3.68008 4.535H2.68608Z",fill:"currentColor"}),wt("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),wt("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),wt("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as jp,ListItemNode as Hp,ListNode as Up}from"@lexical/list";var Ii={type:"element",dependencies:[Up,Hp],export:(t,e)=>jp(t)?Fe(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Ze("number")};var vi=[Q([{ChildComponent:dr,isActive:({selection:t})=>{if(!Vp(t))return!1;for(let e of t.getNodes()){if(mr(e)&&e.getListType()==="number")continue;let o=e.getParent();if(mr(o)&&o.getListType()==="number")continue;let r=o?.getParent();if(!(mr(r)&&r.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Mi,void 0)},order:10}])],Kp=M(({featureProviderMap:t})=>({markdownTransformers:[Ii],nodes:t.has("orderedList")?[]:[Gp,Wp],plugins:t.has("orderedList")?[]:[{Component:Xe,position:"normal"}],slashMenu:{groups:[ze([{Icon:dr,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Mi,void 0)}}])]},toolbarFixed:{groups:vi},toolbarInline:{groups:vi}}));import{$isListNode as fr,INSERT_UNORDERED_LIST_COMMAND as Oi,ListItemNode as Yp,ListNode as qp}from"@lexical/list";import{$isRangeSelection as Qp}from"lexical";import{jsx as Ye,jsxs as Jp}from"react/jsx-runtime";import"react";var pr=()=>Jp("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Ye("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ye("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ye("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Ye("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Ye("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Ye("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Xp,ListItemNode as zp,ListNode as Zp}from"@lexical/list";var Di={type:"element",dependencies:[Zp,zp],export:(t,e)=>Xp(t)?Fe(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Ze("bullet")};var Ai=[Q([{ChildComponent:pr,isActive:({selection:t})=>{if(!Qp(t))return!1;for(let e of t.getNodes()){if(fr(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if(fr(o)&&o.getListType()==="bullet")continue;let r=o?.getParent();if(!(fr(r)&&r.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Oi,void 0)},order:11}])],ef=M({markdownTransformers:[Di],nodes:[qp,Yp],plugins:[{Component:Xe,position:"normal"}],slashMenu:{groups:[ze([{Icon:pr,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Oi,void 0)}}])]},toolbarFixed:{groups:Ai},toolbarInline:{groups:Ai}});import{jsx as tf}from"react/jsx-runtime";import{addClassNamesToElement as of}from"@lexical/utils";import{DecoratorNode as rf}from"lexical";import*as $i from"react";var nf=$i.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),Et=class t extends rf{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return lf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return of(o,"unknownConverted"),o}decorate(){return tf(nf,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function lf({data:t}){return new Et({data:t})}var sf=M(()=>({nodes:[Et]}));import{jsx as af}from"react/jsx-runtime";import{addClassNamesToElement as cf}from"@lexical/utils";import{DecoratorNode as uf}from"lexical";import*as Fi from"react";var df=Fi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),St=class t extends uf{__data;constructor({data:e,key:o}){super(o),this.__data=e}static clone(e){return new t({data:e.__data,key:e.__key})}static getType(){return"unknownConverted"}static importJSON(e){return mf({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return cf(o,"unknownConverted"),o}decorate(){return af(df,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function mf({data:t}){return new St({data:t})}var pf=M(()=>({nodes:[St]}));import{$setBlocksType as ji}from"@lexical/selection";import{$createParagraphNode as Hi,$getSelection as Ui,$isParagraphNode as Pi,$isRangeSelection as ff}from"lexical";var Bi=[Q([{ChildComponent:dt,isActive:({selection:t})=>{if(!ff(t))return!1;for(let e of t.getNodes())if(!Pi(e)&&!Pi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Ui();ji(e,()=>Hi())})},order:1}])],hf=M({slashMenu:{groups:[Z([{Icon:dt,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Ui();ji(e,()=>Hi())})}}])]},toolbarFixed:{groups:Bi},toolbarInline:{groups:Bi}});import{c as $f}from"react/compiler-runtime";import{jsx as as}from"react/jsx-runtime";import{useLexicalComposerContext as Ff}from"@lexical/react/LexicalComposerContext";import{useEffect as Pf,useState as Bf}from"react";import{jsx as ss,Fragment as Of}from"react/jsx-runtime";import"react";import{jsx as gf}from"react/jsx-runtime";var Wi={quote:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return gf("blockquote",{children:o})}};import{jsx as xf}from"react/jsx-runtime";var Gi={heading:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return xf(r,{children:o})}};import{jsx as Cf}from"react/jsx-runtime";var Vi={horizontalrule:Cf("hr",{})};import{jsx as bf}from"react/jsx-runtime";var Ki={linebreak:bf("br",{})};import{jsx as Ji}from"react/jsx-runtime";var Xi=({internalDocToHref:t})=>({autolink:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0;return Ji("a",{href:e.fields.url,rel:n,target:l,children:r})},link:({node:e,nodesToJSX:o})=>{let r=o({nodes:e.children}),n=e.fields.newTab?"noopener noreferrer":void 0,l=e.fields.newTab?"_blank":void 0,i=e.fields.url??"";return e.fields.linkType==="internal"&&(t?i=t({linkNode:e}):(console.error("Lexical => JSX converter: Link converter: found internal link, but internalDocToHref is not provided"),i="#")),Ji("a",{href:i,rel:n,target:l,children:r})}});import{jsx as qe,jsxs as kf,Fragment as _f}from"react/jsx-runtime";import{v4 as Tf}from"uuid";var zi={list:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.tag;return qe(r,{className:`list-${t?.listType}`,children:o})},listitem:({node:t,nodesToJSX:e,parent:o})=>{let r=t.children.some(l=>l.type==="list"),n=e({nodes:t.children});if("listType"in o&&o?.listType==="check"){let l=Tf();return qe("li",{"aria-checked":t.checked?"true":"false",className:`list-item-checkbox${t.checked?" list-item-checkbox-checked":" list-item-checkbox-unchecked"}${r?" nestedListItem":""}`,role:"checkbox",style:{listStyleType:"none"},tabIndex:-1,value:t?.value,children:r?n:kf(_f,{children:[qe("input",{checked:t.checked,id:l,readOnly:!0,type:"checkbox"}),qe("label",{htmlFor:l,children:n}),qe("br",{})]})})}else return qe("li",{className:`${r?"nestedListItem":""}`,style:r?{listStyleType:"none"}:void 0,value:t?.value,children:n})}};import{jsx as hr}from"react/jsx-runtime";var Zi={paragraph:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return o?.length?hr("p",{children:o}):hr("p",{children:hr("br",{})})}};var Yi={tab:" "};import{jsx as Nt}from"react/jsx-runtime";var qi={table:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Nt("div",{className:"lexical-table-container",children:Nt("table",{className:"lexical-table",style:{borderCollapse:"collapse"},children:Nt("tbody",{children:o})})})},tablecell:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children}),r=t.headerState>0?"th":"td",n=`lexical-table-cell-header-${t.headerState}`,l={backgroundColor:t.backgroundColor||void 0,border:"1px solid #ccc",padding:"8px"},i=t.colSpan&&t.colSpan>1?t.colSpan:void 0,s=t.rowSpan&&t.rowSpan>1?t.rowSpan:void 0;return Nt(r,{className:`lexical-table-cell ${n}`,colSpan:i,rowSpan:s,style:l,children:o})},tablerow:({node:t,nodesToJSX:e})=>{let o=e({nodes:t.children});return Nt("tr",{className:"lexical-table-row",children:o})}};import{jsx as Pe}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},wf=O.IS_BOLD|O.IS_ITALIC|O.IS_STRIKETHROUGH|O.IS_UNDERLINE|O.IS_CODE|O.IS_SUBSCRIPT|O.IS_SUPERSCRIPT|O.IS_HIGHLIGHT,Ef="\xA0",Sf=`
|
|
37
57
|
|
|
38
|
-
`,Xi="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",zi="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",rf=new RegExp("^[^"+zi+"]*["+Xi+"]"),nf=new RegExp("^[^"+Xi+"]*["+zi+"]"),lf={bold:A.IS_BOLD,code:A.IS_CODE,highlight:A.IS_HIGHLIGHT,italic:A.IS_ITALIC,strikethrough:A.IS_STRIKETHROUGH,subscript:A.IS_SUBSCRIPT,superscript:A.IS_SUPERSCRIPT,underline:A.IS_UNDERLINE},sf={directionless:A.IS_DIRECTIONLESS,unmergeable:A.IS_UNMERGEABLE},af={center:A.IS_ALIGN_CENTER,end:A.IS_ALIGN_END,justify:A.IS_ALIGN_JUSTIFY,left:A.IS_ALIGN_LEFT,right:A.IS_ALIGN_RIGHT,start:A.IS_ALIGN_START},cf={[A.IS_ALIGN_CENTER]:"center",[A.IS_ALIGN_END]:"end",[A.IS_ALIGN_JUSTIFY]:"justify",[A.IS_ALIGN_LEFT]:"left",[A.IS_ALIGN_RIGHT]:"right",[A.IS_ALIGN_START]:"start"},uf={normal:A.IS_NORMAL,segmented:A.IS_SEGMENTED,token:A.IS_TOKEN},df={[A.IS_NORMAL]:"normal",[A.IS_SEGMENTED]:"segmented",[A.IS_TOKEN]:"token"};var Zi={text:({node:t})=>{let e=t.text;return t.format&A.IS_BOLD&&(e=Fe("strong",{children:e})),t.format&A.IS_ITALIC&&(e=Fe("em",{children:e})),t.format&A.IS_STRIKETHROUGH&&(e=Fe("span",{style:{textDecoration:"line-through"},children:e})),t.format&A.IS_UNDERLINE&&(e=Fe("span",{style:{textDecoration:"underline"},children:e})),t.format&A.IS_CODE&&(e=Fe("code",{children:e})),t.format&A.IS_SUBSCRIPT&&(e=Fe("sub",{children:e})),t.format&A.IS_SUPERSCRIPT&&(e=Fe("sup",{children:e})),e}};import{jsx as Tt}from"react/jsx-runtime";var Yi={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Tt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Tt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Tt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Tt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Tt("picture",{children:n})}};var qe={...Vi,...Zi,...ji,...Pi,...Ji,...Bi,...Hi,...Wi,...Gi({}),...Yi,...Ki};import{jsx as Qi,Fragment as mf}from"react/jsx-runtime";import ur from"react";function qi(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function es({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return qi(e)?ts({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):Qi(mf,{})}function ts({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,u)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:s,nodesToJSX:m=>ts({converters:m.converters??t,disableIndent:m.disableIndent??e,disableTextAlign:m.disableTextAlign??o,nodes:m.nodes,parent:m.parent??{...s,parent:n}}),parent:n}):c:d=Qi("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.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(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),ur.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let p={...a,...d?.props?.style??{}};return ur.cloneElement(d,{key:u,style:p})}return ur.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var dr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:qe}):i=e:i=qe;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&es({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?os(pf,{children:s}):os("div",{className:t??"payload-richtext",children:s})};function ns(){let t=ff(7),[e]=hf(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=xf(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),gf(l,i);let s;return t[5]!==r?(s=rs("div",{className:"debug-jsx-converter",children:rs(dr,{converters:qe,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var Cf=v({plugins:[{Component:ns,position:"bottom"}]});var B={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)"}},bf={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as r0}from"lexical";import{jsx as wt,jsxs as kf}from"react/jsx-runtime";import"react";var mr=()=>kf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[wt("g",{clipPath:"url(#clip0_4397_10817)",children:wt("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),wt("defs",{children:wt("clipPath",{id:"clip0_4397_10817",children:wt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as wf}from"react/jsx-runtime";import*as is from"react";import{DecoratorBlockNode as _f}from"@lexical/react/LexicalDecoratorBlockNode.js";function Tf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:ls({relationTo:o,value:e})}:null}var Et=class extends _f{__data;constructor({data:e,format:o,key:r}){super(o,r),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:Tf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=ls(o);return r.setFormat(e.format),r}static isInline(){return!1}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 ls(t){return new Et({data:t})}var Ef=is.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function Sf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Pe({relationTo:o,value:e})}:null}var ke=class extends Et{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:Sf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Pe(o);return r.setFormat(e.format),r}decorate(e,o){return wf(Ef,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Pe(t){return new ke({data:t})}function pr(t){return t instanceof ke}import{c as Gf}from"react/compiler-runtime";import{jsx as Wf}from"react/jsx-runtime";import{useLexicalComposerContext as Vf}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Kf}from"@lexical/utils";import{useConfig as Jf}from"@payloadcms/ui";import{$getPreviousSelection as Xf,$getSelection as zf,$isParagraphNode as Zf,$isRangeSelection as Yf,COMMAND_PRIORITY_EDITOR as qf,createCommand as Qf}from"lexical";import{useEffect as e0}from"react";import{c as Ff}from"react/compiler-runtime";import{jsx as lo}from"react/jsx-runtime";import{useLexicalComposerContext as Pf}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as Bf,COMMAND_PRIORITY_EDITOR as Hf}from"lexical";import{useEffect as jf,useState as cs}from"react";import{c as Nf}from"react/compiler-runtime";import{jsx as Lf}from"react/jsx-runtime";import{useLexicalComposerContext as yf}from"@lexical/react/LexicalComposerContext";import{useListDrawer as If,useModal as Rf}from"@payloadcms/ui";import{$getNodeByKey as ss,$getPreviousSelection as vf,$getRoot as Df,$getSelection as Mf,$isRangeSelection as Of,$setSelection as Af}from"lexical";import{useEffect as $f,useState as as}from"react";var St=t=>{let e=Nf(23),[o]=yf(),[r,n]=as(null),[l,i]=as(!1),[s,u,c]=If(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:p,openDrawer:m}=c,{modalState:f}=Rf(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let $=Mf()??vf();n($)},e[0]=h):h=e[0];let g=h,b;e[1]!==o||e[2]!==r?(b=()=>{r&&o.update(()=>{if(Of(r)){let{anchor:$,focus:R}=r;ss($.key)&&ss(R.key)&&Af(r.clone())}else Df().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=b):b=e[3];let T=b,E;e[4]!==d?(E=()=>{d()},e[4]=d,e[5]=E):E=e[5];let C=E,k,x;e[6]!==a||e[7]!==f||e[8]!==T||e[9]!==l?(k=()=>{if(!l)return;let $=f[a];$&&!$?.isOpen&&(i(!1),setTimeout(()=>{T()},1))},x=[f,a,T,l],e[6]=a,e[7]=f,e[8]=T,e[9]=l,e[10]=k,e[11]=x):(k=e[10],x=e[11]),$f(k,x);let w;e[12]!==u?(w=$=>Lf(u,{...$,onClick:()=>{g()}}),e[12]=u,e[13]=w):w=e[13];let S;e[14]!==m?(S=()=>{g(),m(),i(!0)},e[14]=m,e[15]=S):S=e[15];let O;return e[16]!==s||e[17]!==C||e[18]!==p||e[19]!==a||e[20]!==w||e[21]!==S?(O={closeListDrawer:C,isListDrawerOpen:p,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:S},e[16]=s,e[17]=C,e[18]=p,e[19]=a,e[20]=w,e[21]=S,e[22]=O):O=e[22],O};var Uf=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=Bf(o);n&&n.replace(Pe({relationTo:e,value:r}))}):t.dispatchCommand(fr,{relationTo:e,value:r})},us=t=>{let e=Ff(16),{enabledCollectionSlugs:o}=t,[r]=Pf(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=cs(n),[i,s]=cs(null),u=o||void 0,c;e[2]!==l||e[3]!==u?(c={collectionSlugs:u,selectedCollection:l},e[2]=l,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:p}=St(c),m,f;e[5]!==r||e[6]!==p?(m=()=>r.registerCommand(lt,T=>(s(T?.replace?T?.replace.nodeKey:null),p(),!0),Hf),f=[r,p],e[5]=r,e[6]=p,e[7]=m,e[8]=f):(m=e[7],f=e[8]),jf(m,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=T=>{let{collectionSlug:E,doc:C}=T;Uf({editor:r,relationTo:E,replaceNodeKey:i,value:C.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let g=h,b;return e[13]!==a||e[14]!==g?(b=lo(a,{onSelect:g}),e[13]=a,e[14]=g,e[15]=b):b=e[15],b},ds=t=>(t?.enabledCollectionSlugs?.length??-1)>0?lo(us,{...t}):lo($t,{...t,children:lo(us,{...t})});var fr=Qf("INSERT_RELATIONSHIP_COMMAND"),ms=t=>{let e=Gf(5),{clientProps:o}=t,[r]=Vf(),{config:n}=Jf(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let c;e[0]!==o?.disabledCollections?(c=d=>{let{slug:a}=d;return!o?.disabledCollections?.includes(a)},e[0]=o?.disabledCollections,e[1]=c):c=e[1],i=l.filter(c).map(t0)}let s,u;return e[2]!==r?(s=()=>{if(!r.hasNodes([ke]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(fr,o0,qf)},u=[r],e[2]=r,e[3]=s,e[4]=u):(s=e[3],u=e[4]),e0(s,u),Wf(ds,{enabledCollectionSlugs:i})};function t0(t){let{slug:e}=t;return e}function o0(t){let e=zf()||Xf();if(Yf(e)){let o=Pe(t),{focus:r}=e,n=r.getNode();Kf(o),Zf(n)&&!n.__first&&n.remove()}return!0}var n0=v({nodes:[ke],plugins:[{Component:ms,position:"normal"}],slashMenu:{groups:[Z([{Icon:mr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(lt,{replace:!1})}}])]},toolbarFixed:{groups:[he([{ChildComponent:mr,isActive:({selection:t})=>{if(!r0(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return pr(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(lt,{replace:!1})}}])]}});import{c as _s}from"react/compiler-runtime";import{jsx as le,jsxs as v0}from"react/jsx-runtime";import{useLexicalComposerContext as D0}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as M0,useThrottledEffect as O0,useTranslation as A0}from"@payloadcms/ui";import*as _e from"react";import{useMemo as $0}from"react";import{c as l0}from"react/compiler-runtime";import{jsx as i0}from"react/jsx-runtime";import{mergeRegister as s0}from"@lexical/utils";import{$addUpdateTag as a0,$getSelection as c0}from"lexical";import{useDeferredValue as u0,useEffect as d0,useState as m0}from"react";var ps="toolbar-popup__button",Nt=t=>{let e=l0(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=m0(l),u=u0(i),c=H(),d=u.enabled?"":"disabled",a=u.active?"active":"",p=n.key?`${ps}-${n.key}`:"",m;e[1]!==d||e[2]!==a||e[3]!==p?(m=[ps,d,a,p].filter(Boolean),e[1]=d,e[2]=a,e[3]=p,e[4]=m):m=e[4];let f=m.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let S=c0();if(!S)return;let O=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:S}):!1,$=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:S}):!0;s(R=>R.active===O&&R.enabled===$?R:{active:O,enabled:$})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let g=h,b=Ft(),T,E;e[9]!==r||e[10]!==b||e[11]!==g?(T=()=>{b(g);let S=()=>b(g),O=s0(r.registerUpdateListener(S));return document.addEventListener("mouseup",S),()=>{O(),document.removeEventListener("mouseup",S)}},E=[r,b,g],e[9]=r,e[10]=b,e[11]=g,e[12]=T,e[13]=E):(T=e[12],E=e[13]),d0(T,E);let C;e[14]!==i||e[15]!==r||e[16]!==n?(C=()=>{i.enabled&&r.focus(()=>{r.update(p0),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=C):C=e[17];let k=C,x=f0,w;return e[18]!==o||e[19]!==f||e[20]!==k||e[21]!==n.key?(w=i0("button",{className:f,"data-button-key":n.key,onClick:k,onMouseDown:x,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=k,e[21]=n.key,e[22]=w):w=e[22],w};function p0(){a0("toolbar")}function f0(t){t.preventDefault()}import{c as _0}from"react/compiler-runtime";import{jsx as Qe}from"react/jsx-runtime";import ks,{useCallback as T0,useDeferredValue as w0,useEffect as E0,useMemo as S0}from"react";import{mergeRegister as N0}from"@lexical/utils";import{useTranslation as L0}from"@payloadcms/ui";import{$getSelection as y0}from"lexical";import{jsx as ye,jsxs as fs}from"react/jsx-runtime";import{Button as h0}from"@payloadcms/ui";import{$addUpdateTag as g0,isDOMNode as x0}from"lexical";import io,{useCallback as C0,useEffect as so,useMemo as gs,useRef as hr,useState as gr}from"react";import{createPortal as b0}from"react-dom";var hs="toolbar-popup__dropdown-item",xs=io.createContext(null);function Cs({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let u=gs(()=>[hs,r===!1?"disabled":"",t?"active":"",l?.key?`${hs}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=hr(null),d=io.use(xs);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return so(()=>{c?.current!=null&&a(c)},[c,a]),ye(h0,{"aria-label":s,buttonStyle:"none",className:u,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{g0("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:p=>{p.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function k0({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=gr(),[i,s]=gr(),u=C0(a=>{l(p=>p!=null?[...p,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:p}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(p)&&a.preventDefault(),p==="Escape"||p==="Tab"?r():p==="ArrowUp"?s(m=>{if(m==null)return n[0];let f=n.indexOf(m)-1;return n[f===-1?n.length-1:f]}):p==="ArrowDown"&&s(m=>m==null?n[0]:n[n.indexOf(m)+1])},d=gs(()=>({registerItem:u}),[u]);return so(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),ye(xs,{value:d,children:ye("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function bs({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:u}){let c=hr(null),d=hr(null),[a,p]=gr(!1),m=()=>{p(!1),d?.current!=null&&d.current.focus()};so(()=>{let h=d.current,g=c.current;if(a&&h!==null&&g!==null){let{left:b,top:T}=h.getBoundingClientRect(),E=window.scrollY||document.documentElement.scrollTop;g.style.top=`${T+E+h.offsetHeight+5}px`,g.style.left=`${Math.min(b-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,d,a]),so(()=>{let h=d.current;if(h!==null&&a){let g=b=>{let T=b.target;x0(T)&&(u&&c.current&&c.current.contains(T)||h.contains(T)||p(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,d,a,u]);let f=b0(ye(k0,{dropDownRef:c,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return fs(io.Fragment,{children:[fs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),p(!a)},onMouseDown:h=>{h.preventDefault()},ref:d,type:"button",children:[l&&ye(l,{}),s&&ye("span",{className:"toolbar-popup__dropdown-label",children:s}),ye("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&ye(io.Fragment,{children:f})]})}var xr="toolbar-popup__dropdown",I0=t=>{let e=_0(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=L0(),{fieldProps:u}=H(),{featureClientSchemaMap:c,schemaPath:d}=u;if(i.Component){let p;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(p=i?.Component&&Qe(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=p):p=e[5],p}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==d){let p=i.key,m;i.label&&(p=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):i.label),p.length>25?m=p.substring(0,25)+"...":m=p,a=Qe(Cs,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?Qe(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:p,children:Qe("span",{className:"text",children:m})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=d,e[13]=a}else a=e[13];return a},R0=ks.memo(I0),Be=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:u})=>{let[c,d]=ks.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=w0(c),p=H(),{items:m,key:f}=r,h=Ft(),g=T0(()=>{o.getEditorState().read(()=>{let T=y0();if(!T)return;let E=[],C=[],k=[];for(let x of m)x.isActive&&(!s||E.length<s)&&x.isActive({editor:o,editorConfigContext:p,selection:T})&&(E.push(x.key),C.push(x)),x.isEnabled?x.isEnabled({editor:o,editorConfigContext:p,selection:T})&&k.push(x.key):k.push(x.key);d({activeItemKeys:E,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:p,selection:T}):!0,enabledItemKeys:k}),u&&u({activeItems:C})})},[o,p,r,m,s,u]);E0(()=>(h(g),N0(o.registerUpdateListener(async()=>{await h(g)}))),[o,h,g]);let b=S0(()=>m?.length?m.map(T=>Qe(R0,{active:a.activeItemKeys.includes(T.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(T.key),item:T},T.key)):null,[m,a,t,o]);return Qe(bs,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[xr,`${xr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${xr}-items`,...l||[]],label:i,children:b},f)};function F0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&le(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?le(Nt,{editor:e,item:o,children:le(o.ChildComponent,{})},o.key):null}function P0(t){let e=_s(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=A0(),{fieldProps:u}=H(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,p]=_e.useState(void 0),[m,f]=_e.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let g;e[4]!==l?(g=[l],e[4]=l,e[5]=g):g=e[5],_e.useEffect(h,g);let b;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==d?(b=k=>{let{activeItems:x}=k;if(!x.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),p(void 0)):(f(void 0),p(void 0));return}let w=x[0],S=w.key;w.label&&(S=typeof w.label=="function"?w.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):w.label),S.length>25&&(S=S.substring(0,25)+"..."),x.length===1?(p(S),f(()=>w.ChildComponent)):(p(s.t("lexical:general:toolbarItemsActive",{count:x.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=d,e[12]=b):b=e[12];let T=b,E=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,C;return e[13]!==m||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==T||e[21]!==E?(C=v0("div",{className:E,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?m?le(Be,{anchorElem:o,editor:r,group:l,Icon:m,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):le(Be,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:T}):null,l.type==="buttons"&&l.items.length?l.items.map(k=>le(F0,{anchorElem:o,editor:r,item:k},k.key)):null,i<n.features.toolbarFixed?.groups.length-1&&le("div",{className:"divider"})]},l.key),e[13]=m,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=T,e[21]=E,e[22]=C):C=e[22],C}function B0({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=_e.useRef(null),{y:i}=M0(),s=$0(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return O0(()=>{if(!s)return;let u=l.current;if(!u)return;let c=u.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.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"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[l,s,i]),le("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:o.isEditable()&&le(_e.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>le(P0,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var Ts=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Ts(t.parentEditor)}return!1},ws=t=>{let e=_s(6),{clientProps:o}=t,[r]=D0(),n=H(),{editorConfig:l}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||l,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=Ts(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=le(B0,{anchorElem:document.body,editor:i,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=i,e[2]=s,e[3]=n,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var H0=v({plugins:[{Component:ws,position:"aboveContainer"}]});import{c as Ns}from"react/compiler-runtime";import{jsx as ce,jsxs as Ls}from"react/jsx-runtime";import{useLexicalComposerContext as j0}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as ys}from"@lexical/utils";import{$getSelection as Is,$isRangeSelection as Es,$isTextNode as U0,COMMAND_PRIORITY_LOW as G0,getDOMSelection as Rs,SELECTION_CHANGE_COMMAND as W0}from"lexical";import{useCallback as co,useEffect as Lt,useRef as Ss,useState as V0}from"react";import*as uo from"react";import{createPortal as K0}from"react-dom";function Cr(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function ao(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:u,verticalGap:c=10}=t,d=o.parentElement;if(u===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),p=o.getBoundingClientRect(),m=d.getBoundingClientRect(),f=u.top-a.height-c,h=u.left-l;i==="center"&&(h=u.left+u.width/2-a.width/2);let g=0;return!e&&f<m.top&&!s&&(g=a.height+u.height+c*2,f+=g),i==="center"?h+a.width>m.right?h=m.right-a.width-l:h<m.left&&(h=m.left+l):h+a.width>m.right&&(h=m.right-a.width-l),h-=p.left,n.style.opacity="1",s&&r!==0?(f-=p.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=p.top,n.style.transform=`translate(${h}px, ${f}px)`),g}function J0({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ce(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ce(Nt,{editor:e,item:o,children:ce(o.ChildComponent,{})},o.key):null}function X0(t){let e=Ns(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=H(),[s,u]=uo.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],uo.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let b=g[0];u(()=>b?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let p=a,m=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==p||e[17]!==m?(f=Ls("div",{className:m,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?ce(Be,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):ce(Be,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:p}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>ce(J0,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&ce("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=p,e[17]=m,e[18]=f):f=e[18],f}function z0({anchorElem:t,editor:e}){let o=Ss(null),r=Ss(null),{editorConfig:n}=H(),l=co(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),i=co(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let p=c.clientX,m=c.clientY,f=document.elementFromPoint(p,m);o.current.contains(f)||l()}}},[l]),s=co(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Lt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let u=co(()=>{let c=Is(),d=Rs(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),p=a!==null&&"style"in a&&a?.style?.opacity==="1",m=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&m!==null&&m.contains(d.anchorNode)){let f=Cr(d,m),h=ao({alwaysDisplayOnTop:p,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&ao({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Lt(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{u()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,u,t]),Lt(()=>(e.getEditorState().read(()=>{u()}),ys(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(W0,()=>(u(),!1),G0))),[e,u]),Ls("div",{className:"inline-toolbar-popup",ref:o,children:[ce("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>ce(X0,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function Z0(t,e){let o=Ns(12),[r,n]=V0(!1),l;o[0]!==t?(l=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let p=Is(),m=Rs(t._window),f=t.getRootElement();if(m!==null&&(!Es(p)||f===null||!f.contains(m.anchorNode))){n(!1);return}if(!Es(p))return;if(p.getTextContent()!==""){let g=p.getNodes(),b=!1;for(let T of g)if(U0(T)){n(!0),b=!0;break}b||n(!1)}else n(!1);let h=p.getTextContent().replace(/\n/g,"");if(!p.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=l):l=o[1];let i=l,s,u;o[2]!==i?(s=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),u=[i],o[2]=i,o[3]=s,o[4]=u):(s=o[3],u=o[4]),Lt(s,u);let c,d;if(o[5]!==t||o[6]!==i?(c=()=>ys(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=d):(c=o[7],d=o[8]),Lt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=K0(ce(z0,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var vs=t=>{let{anchorElem:e}=t,[o]=j0();return Z0(o,e)};var Y0=v({plugins:[{Component:vs,position:"floatingAnchorElem"}]});import{TableCellNode as Bh,TableNode as Hh,TableRowNode as jh}from"@lexical/table";import{jsx as Ds}from"react/jsx-runtime";import"react";var br=()=>Ds("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Ds("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as q0,$createTableNode as Q0,$createTableRowNode as e1,$isTableCellNode as Ms,$isTableNode as kr,$isTableRowNode as _r,TableCellHeaderStates as mo,TableCellNode as t1,TableNode as o1,TableRowNode as r1}from"@lexical/table";import{$isParagraphNode as n1,$isTextNode as l1}from"lexical";var As=/^\|(.+)\|\s?$/,i1=/^(\| ?:?-*:? ?)+\|\s?$/,$s=({allTransformers:t})=>({type:"element",dependencies:[o1,r1,t1],export:e=>{if(!kr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!_r(r))continue;let l=!1;for(let i of r.getChildren())Ms(i)&&(n.push(zr(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===mo.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
|
|
39
|
-
`)},regExp:
|
|
40
|
-
`);let o=q0(mo.NO_STATUS);return Xr(t,e,o),o},Os=(t,e)=>{let o=t.match(As);return!o||!o[1]?null:o[1].split("|").map(r=>Fs(r,e))};import{c as c1}from"react/compiler-runtime";import{jsx as P,jsxs as Te}from"react/jsx-runtime";import{useLexicalComposerContext as Us}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as u1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Bs,$deleteTableColumnAtSelection as d1,$deleteTableRowAtSelection as m1,$getNodeTriplet as p1,$getTableCellNodeFromLexicalNode as Hs,$getTableColumnIndexFromTableCellNode as f1,$getTableNodeFromLexicalNodeOrThrow as Re,$getTableRowIndexFromTableCellNode as h1,$insertTableColumnAtSelection as g1,$insertTableRowAtSelection as x1,$isTableCellNode as Gs,$isTableSelection as yt,$mergeCells as C1,$unmergeCell as b1,getTableElement as wr,getTableObserverFromTableElement as Er,TableCellHeaderStates as Ie,TableCellNode as k1}from"@lexical/table";import{mergeRegister as _1}from"@lexical/utils";import{useScrollInfo as T1}from"@payloadcms/ui";import{$getSelection as fo,$isElementNode as w1,$isRangeSelection as Sr,$isTextNode as E1,$setSelection as S1,COMMAND_PRIORITY_CRITICAL as N1,getDOMSelection as L1,isDOMNode as y1,SELECTION_CHANGE_COMMAND as I1}from"lexical";import*as Nr from"react";import{useCallback as ie,useEffect as et,useRef as po,useState as tt}from"react";import{createPortal as Ws}from"react-dom";import{jsx as Tr,jsxs as a1}from"react/jsx-runtime";import"react";var Ps=()=>a1("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Tr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),Tr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),Tr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function js(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function R1(){let t=fo();if(Sr(t)&&!t.isCollapsed()||yt(t)&&!t.anchor.is(t.focus)||!Sr(t)&&!yt(t))return!1;let[e]=p1(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function v1(t){let e=t.getLastDescendant();E1(e)?e.select():w1(e)?e.selectEnd():e!==null&&e.selectNext()}function D1({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Us(),i=po(null),[s,u]=tt(n),[c,d]=tt({columns:1,rows:1}),[a,p]=tt(!1),[m,f]=tt(!1),{y:h}=T1();et(()=>l.registerMutationListener(k1,_=>{_.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),et(()=>{l.getEditorState().read(()=>{let _=fo();if(yt(_)){let L=js(_);d(js(_)),p(L.columns>1||L.rows>1)}f(R1())})},[l]),et(()=>{let _=e.current,L=i.current,D=l.getRootElement();if(_!=null&&L!=null&&D!=null){let I=D.getBoundingClientRect(),M=_.getBoundingClientRect();L.style.opacity="1";let y=L.getBoundingClientRect(),F=5,G=M.right+F;if(G+y.width>window.innerWidth||G+y.width>I.right){let te=M.left-y.width-F;G=(te<0?F:te)+window.pageXOffset}L.style.left=`${G+window.pageXOffset}px`;let q=M.top;if(q+y.height>window.innerHeight){let te=M.bottom-y.height;q=te<0?F:te}L.style.top=`${q}px`}},[e,i,l,h]),et(()=>{function _(L){i.current!=null&&e.current!=null&&y1(L.target)&&!i.current.contains(L.target)&&!e.current.contains(L.target)&&r(!1)}return window.addEventListener("click",_),()=>window.removeEventListener("click",_)},[r,e]);let g=ie(()=>{l.update(()=>{if(s.isAttached()){let _=Re(s),L=wr(_,l.getElementByKey(_.getKey()));if(L===null)throw new Error("Expected to find tableElement in DOM");let D=Er(L);D!==null&&D.$clearHighlight(),_.markDirty(),u(s.getLatest())}S1(null)})},[l,s]),b=()=>{l.update(()=>{let _=fo();if(!yt(_))return;let D=_.getNodes().filter(Gs),I=C1(D);I&&(v1(I),o())})},T=()=>{l.update(()=>{b1()})},E=ie(_=>{l.update(()=>{for(let L=0;L<c.rows;L++)x1(_);o()})},[l,o,c.rows]),C=ie(_=>{l.update(()=>{for(let L=0;L<c.columns;L++)g1(_);o()})},[l,o,c.columns]),k=ie(()=>{l.update(()=>{m1(),o()})},[l,o]),x=ie(()=>{l.update(()=>{Re(s).remove(),g(),o()})},[l,s,g,o]),w=ie(()=>{l.update(()=>{d1(),o()})},[l,o]),S=ie(()=>{l.update(()=>{let _=Re(s),L=h1(s),[D]=Bs(_,null,null),I=new Set,M=s.getHeaderStyles()^Ie.ROW;if(D[L])for(let y=0;y<D[L].length;y++){let F=D[L][y];F?.cell&&(I.has(F.cell)||(I.add(F.cell),F.cell.setHeaderStyles(M,Ie.ROW)))}g(),o()})},[l,s,g,o]),O=ie(()=>{l.update(()=>{let _=Re(s),L=f1(s),[D]=Bs(_,null,null),I=new Set,M=s.getHeaderStyles()^Ie.COLUMN;if(D)for(let y=0;y<D.length;y++){let F=D?.[y]?.[L];F?.cell&&(I.has(F.cell)||(I.add(F.cell),F.cell.setHeaderStyles(M,Ie.COLUMN)))}g(),o()})},[l,s,g,o]),$=ie(()=>{l.update(()=>{if(s.isAttached()){let _=Re(s);_&&_.setRowStriping(!_.getRowStriping())}g(),o()})},[l,s,g,o]),R=ie(()=>{l.update(()=>{if(s.isAttached()){let _=Re(s);_&&_.setFrozenColumns(_.getFrozenColumns()===0?1:0)}g(),o()})},[l,s,g,o]),N=null;return t&&(a?N=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>b(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):m&&(N=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>T(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),Ws(Te("div",{className:"table-action-menu-dropdown",onClick:_=>{_.stopPropagation()},ref:i,children:[N?Te(Nr.Fragment,{children:[N,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>$(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>R(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>E(!1),type:"button",children:Te("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>E(!0),type:"button",children:Te("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>C(!1),type:"button",children:Te("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>C(!0),type:"button",children:Te("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>S(),type:"button",children:Te("span",{className:"text",children:[(s.__headerState&Ie.ROW)===Ie.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>O(),type:"button",children:Te("span",{className:"text",children:[(s.__headerState&Ie.COLUMN)===Ie.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function M1({anchorElem:t,cellMerge:e}){let[o]=Us(),r=po(null),n=po(null),[l,i]=tt(!1),[s,u]=tt(null),c=ie(()=>{let a=r.current,p=fo(),m=L1(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(p==null||a==null)return h();let g=o.getRootElement(),b=null,T=null;if(Sr(p)&&g!==null&&m!==null&&g.contains(m.anchorNode)){let C=Hs(p.anchor.getNode());if(C==null||(T=o.getElementByKey(C.getKey()),T==null||!C.isAttached()))return h();let k=Re(C),x=wr(k,o.getElementByKey(k.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=Er(x),u(C)}else if(yt(p)){let C=Hs(p.anchor.getNode());if(!Gs(C))throw new Error("TableSelection anchorNode must be a TableCellNode");let k=Re(C),x=wr(k,o.getElementByKey(k.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");b=Er(x),T=o.getElementByKey(C.getKey())}else if(!f)return h();if(b===null||T===null)return h();let E=!b||!b.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",E),a.classList.toggle("table-cell-action-button-container--inactive",!E),E){let C=T.getBoundingClientRect(),k=t.getBoundingClientRect(),x=C.top-k.top,w=C.right-k.left;a.style.transform=`translate(${w}px, ${x}px)`}},[o,t]);et(()=>{let a,p=()=>{a=void 0,o.getEditorState().read(c)},m=()=>(a===void 0&&(a=setTimeout(p,0)),!1);return _1(o.registerUpdateListener(m),o.registerCommand(I1,m,N1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",m),f&&(f.addEventListener("pointerup",m),m())}),()=>clearTimeout(a))});let d=po(s);return et(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Te(Nr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(Ps,{})}),l&&P(D1,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var Vs=t=>{let e=c1(3),{anchorElem:o}=t,r=u1(),n;return e[0]!==o||e[1]!==r?(n=Ws(r?P(M1,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as O1}from"react/compiler-runtime";import{jsx as go,jsxs as A1}from"react/jsx-runtime";import{useLexicalComposerContext as $1}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as F1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as P1,$getTableNodeFromLexicalNodeOrThrow as Lr,$getTableRowIndexFromTableCellNode as B1,$isTableCellNode as Ks,$isTableRowNode as H1,getDOMCellFromTarget as j1,getTableElement as U1,TableNode as Js}from"@lexical/table";import{calculateZoomLevel as Xs,mergeRegister as G1}from"@lexical/utils";import{$getNearestNodeFromDOMNode as yr,isHTMLElement as W1,SKIP_SCROLL_INTO_VIEW_TAG as zs}from"lexical";import*as Ys from"react";import{useCallback as It,useEffect as Ir,useRef as ho,useState as ot}from"react";import{createPortal as V1}from"react-dom";var K1=33,Zs=92;function J1({editor:t}){let e=ho(null),o=ho(null),r=ho(null),[n,l]=ot(!1),i=H(),s=ho(null),[u,c]=ot(null),[d,a]=ot(null),[p,m]=ot(!1),[f,h]=ot(null),g=It(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),b=R=>(R.buttons&1)===1;Ir(()=>{let R=new Set;return G1(t.registerMutationListener(Js,N=>{for(let[_,L]of N)L==="destroyed"?R.delete(_):R.add(_);l(R.size>0)}),t.registerNodeTransform(Js,N=>{if(N.getColWidths())return N;let _=N.getColumnCount(),L=Zs;return N.setColWidths(Array(_).fill(L)),N}))},[t]),Ir(()=>{if(!n)return;let R=D=>{let I=D.target;if(W1(I)){if(f){c({x:D.clientX,y:D.clientY});return}if(m(b(D)),!(o.current&&o.current.contains(I))&&e.current!==I){e.current=I;let M=j1(I);M&&d!==M?t.getEditorState().read(()=>{let y=yr(M.elem);if(!y)throw new Error("TableCellResizer: Table cell node not found.");let F=Lr(y),G=U1(F,t.getElementByKey(F.getKey()));if(!G)throw new Error("TableCellResizer: Table element not found.");e.current=I,r.current=G.getBoundingClientRect(),a(M)},{editor:t}):M==null&&g()}}},N=D=>{m(!0)},_=D=>{m(!1)},L=t.registerRootListener((D,I)=>{I?.removeEventListener("mousemove",R),I?.removeEventListener("mousedown",N),I?.removeEventListener("mouseup",_),D?.addEventListener("mousemove",R),D?.addEventListener("mousedown",N),D?.addEventListener("mouseup",_)});return()=>{L()}},[d,f,t,n,g]);let T=R=>R==="bottom",E=It(R=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=yr(d.elem);if(!Ks(N))throw new Error("TableCellResizer: Table cell node not found.");let _=Lr(N),L=B1(N),D=_.getChildren(),M=N.getColSpan()===_.getColumnCount()?L:L+N.getRowSpan()-1;if(M>=D.length||M<0)throw new Error("Expected table cell to be inside of table row.");let y=D[M];if(!H1(y))throw new Error("Expected table row");let F=y.getHeight();if(F===void 0){let q=y.getChildren();F=Math.min(...q.map(te=>C(te,t)??1/0))}let G=Math.max(F+R,K1);y.setHeight(G)},{tag:zs})},[d,t]),C=(R,N)=>N.getElementByKey(R.getKey())?.clientHeight,k=(R,N)=>{let _;return N.forEach(L=>{L.forEach((D,I)=>{D.cell===R&&(_=I)})}),_},x=It(R=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=yr(d.elem);if(!Ks(N))throw new Error("TableCellResizer: Table cell node not found.");let _=Lr(N),[L]=P1(_,null,null),D=k(N,L);if(D===void 0)throw new Error("TableCellResizer: Table column not found.");let I=_.getColWidths();if(!I)return;let M=I[D];if(M===void 0)return;let y=[...I],F=Math.max(M+R,Zs);y[D]=F,_.setColWidths(y)},{tag:zs})},[d,t]),w=It(R=>{let N=_=>{if(_.preventDefault(),_.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:L,y:D}=s.current;if(d===null)return;let I=Xs(_.target);if(T(R)){let M=(_.clientY-D)/I;E(M)}else{let M=(_.clientX-L)/I;x(M)}g(),document.removeEventListener("mouseup",N)}};return N},[d,g,x,E]),S=It(R=>N=>{if(N.preventDefault(),N.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:N.clientX,y:N.clientY},c(s.current),h(R),document.addEventListener("mouseup",w(R))},[d,w]),[O,$]=ot({bottom:null,left:null,right:null,top:null});return Ir(()=>{if(d){let{height:R,left:N,top:_,width:L}=d.elem.getBoundingClientRect(),D=Xs(d.elem),I=10,M={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${I}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+_+R-I/2}px`,width:`${L}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${R}px`,left:`${window.scrollX+N+L-I/2}px`,top:`${window.scrollY+_}px`,width:`${I}px`}},y=r.current;f&&u&&y&&(T(f)?(M[f].left=`${window.scrollX+y.left}px`,M[f].top=`${window.scrollY+u.y/D}px`,M[f].height="3px",M[f].width=`${y.width}px`):(M[f].top=`${window.scrollY+y.top}px`,M[f].left=`${window.scrollX+u.x/D}px`,M[f].width="3px",M[f].height=`${y.height}px`),M[f].backgroundColor="#adf"),$(M)}else $({bottom:null,left:null,right:null,top:null})},[d,f,u]),go("div",{ref:o,children:d!=null&&!p&&A1(Ys.Fragment,{children:[go("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:S("right"),style:O.right||void 0}),go("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:S("bottom"),style:O.bottom||void 0})]})})}var qs=()=>{let t=O1(3),[e]=$1(),o=F1(),r;return t[0]!==e||t[1]!==o?(r=o?V1(go(J1,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as th}from"react/compiler-runtime";import{jsx as Rr,jsxs as oh,Fragment as rh}from"react/jsx-runtime";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as nh,$getTableColumnIndexFromTableCellNode as lh,$getTableRowIndexFromTableCellNode as ih,$insertTableColumnAtSelection as sh,$insertTableRowAtSelection as ah,$isTableCellNode as ch,$isTableNode as ta,getTableElement as uh,TableNode as dh}from"@lexical/table";import{$findMatchingParent as mh,mergeRegister as ph}from"@lexical/utils";import{$getNearestNodeFromDOMNode as oa,isHTMLElement as fh}from"lexical";import{useEffect as ra,useMemo as hh,useRef as na,useState as xo}from"react";import"react";import{createPortal as gh}from"react-dom";import{c as q1}from"react/compiler-runtime";import{useEffect as Q1,useRef as eh}from"react";var X1="Expected a function",z1=Math.max,Z1=Math.min;function Y1(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,p=!0;if(typeof t!="function")throw new TypeError(X1);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?z1(o.maxWait||0,e):c,p="trailing"in o?!!o.trailing:p);function m(x){let w=r,S=i;return r=i=void 0,l=x,d=t.apply(S,w),d}function f(x){return l=x,a=setTimeout(b,e),s?m(x):d}function h(x){let w=x-n,S=x-l,O=e-w;return u?Z1(O,c-S):O}function g(x){let w=x-n,S=x-l;return n===void 0||w>=e||w<0||u&&S>=c}function b(){let x=Date.now();if(g(x))return T(x);a=setTimeout(b,h(x))}function T(x){return a=void 0,p&&r?m(x):(r=i=void 0,d)}function E(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function C(){return a===void 0?d:T(Date.now())}function k(){let x=Date.now(),w=g(x);if(r=arguments,i=this,n=x,w){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(b,e),m(n)}return a===void 0&&(a=setTimeout(b,e)),d}return k.cancel=E,k.flush=C,k}var Qs=Y1;function ea(t,e,o){let r=q1(6),n=eh(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=Qs(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),Q1(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var la=20;function xh({anchorElem:t}){let[e]=ia(),o=H(),[r,n]=xo(!1),[l,i]=xo(!1),[s,u]=xo(!1),[c,d]=xo({}),a=na(new Set),p=na(null),m=ea(g=>{let{isOutside:b,tableDOMNode:T}=Ch(g,o.editorConfig?.lexical);if(b){n(!1),i(!1);return}if(!T)return;p.current=T;let E=null,C=null,k=null;if(e.getEditorState().read(()=>{let I=oa(T);if(ch(I)){let M=mh(I,y=>ta(y));if(!ta(M))return;if(k=uh(M,e.getElementByKey(M.getKey())),k){let y=M.getChildrenSize(),F=M.getChildAtIndex(0)?.getChildrenSize(),G=ih(I),q=lh(I);G===y-1?E=I:q===F-1&&(C=I)}}},{editor:e}),!k)return;let x=k.parentElement;if(!x)return;let{bottom:w,height:S,left:O,right:$,width:R,y:N}=k.getBoundingClientRect(),_=!1;x&&x.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(_=x.scrollWidth>x.clientWidth);let{left:L,y:D}=t.getBoundingClientRect();E?(i(!1),n(!0),d({height:la,left:_&&x?x.offsetLeft:O-L,top:w-D+5,width:_&&x?x.offsetWidth:R})):C&&(i(!0),n(!1),d({height:S,left:$-L+5,top:N-D,width:la}))},50,250),f=hh(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);ra(()=>{if(s)return document.addEventListener("mousemove",m),()=>{n(!1),i(!1),document.removeEventListener("mousemove",m)}},[s,m]),ra(()=>ph(e.registerMutationListener(dh,g=>{e.getEditorState().read(()=>{let b=!1;for(let[T,E]of g)switch(E){case"created":{a.current.add(T),b=!0;break}case"destroyed":{a.current.delete(T),b=!0;break}default:break}if(b){f.disconnect();for(let T of a.current){let{tableElement:E}=nh(T);f.observe(E)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{p.current&&(oa(p.current)?.selectEnd(),g?(ah(),n(!1)):(sh(),i(!1)))})};return e?.isEditable()?oh(rh,{children:[r&&Rr("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&Rr("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function Ch(t,e){let o=t.target;if(fh(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function sa(t){let e=th(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=ia();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=gh(Rr(xh,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as bh}from"react/compiler-runtime";import{jsx as vr,jsxs as kh}from"react/jsx-runtime";import{useLexicalComposerContext as _h}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Th}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as wh,TableCellNode as Eh,TableNode as Sh,TableRowNode as Nh}from"@lexical/table";import{mergeRegister as Lh}from"@lexical/utils";import{formatDrawerSlug as yh,useEditDepth as Ih}from"@payloadcms/ui";import{$getSelection as Rh,$isRangeSelection as vh,COMMAND_PRIORITY_EDITOR as Dh,createCommand as Mh}from"lexical";import{createContext as Oh,use as Ah,useEffect as $h,useMemo as Fh,useState as Ph}from"react";import*as aa from"react";var Co=Mh("OPEN_EMBED_DRAWER_COMMAND"),ca=Oh({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ua({children:t}){let[e,o]=Ph({cellEditorConfig:null,cellEditorPlugins:null});return vr(ca,{value:Fh(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var da=()=>{let t=bh(16),[e]=_h(),o=Ah(ca),r=Ih(),{fieldProps:n,uuid:l}=H(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=yh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=me(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([Sh,Nh,Eh]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return Lh(e.registerCommand(Co,()=>{let h=null;return e.getEditorState().read(()=>{let g=Rh();vh(g)&&(h=g)}),h&&d(),!0},Dh))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let p;t[6]!==o||t[7]!==e||t[8]!==d?(p=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=p):p=t[9],$h(a,p);let m;t[10]!==e?(m=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(wh,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=m):m=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==m?(f=kh(aa.Fragment,{children:[vr(nt,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:m,schemaPath:i,schemaPathSuffix:"fields"}),vr(Th,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=m,t[15]=f):f=t[15],f};var Uh=v({markdownTransformers:[$s],nodes:[Hh,Bh,jh],plugins:[{Component:da,position:"normal"},{Component:qs,position:"normal"},{Component:Vs,position:"floatingAnchorElem"},{Component:sa,position:"floatingAnchorElem"}],providers:[ua],slashMenu:{groups:[Z([{Icon:br,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Co,{})}}])]},toolbarFixed:{groups:[he([{ChildComponent:br,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Co,{})}}])]}});import{$isNodeSelection as yg}from"lexical";import{jsx as Dr,jsxs as Gh}from"react/jsx-runtime";import"react";var Mr=()=>Gh("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Dr("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Dr("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Dr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as Xh}from"react/jsx-runtime";import{$applyNodeReplacement as zh}from"lexical";import*as fa from"react";import Wh from"bson-objectid";function bo(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{formID:r,src:t.getAttribute("src")||""}})}}return{node:e({data:{formID:new Wh.default().toHexString(),src:t.getAttribute("src")||""}})}}function ko(t,e){if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let o=t.getAttribute("data-lexical-upload-id"),r=t.getAttribute("data-lexical-upload-relation-to");if(o!=null&&r!=null)return{node:e({data:{fields:{},relationTo:r,value:o}})}}return null}import{jsx as Vh}from"react/jsx-runtime";import{DecoratorBlockNode as Kh}from"@lexical/react/LexicalDecoratorBlockNode.js";import{$applyNodeReplacement as Jh}from"lexical";import"react";var Rt=class extends Kh{__data;constructor({data:e,format:o,key:r}){super(o,r),this.__data=e}static clone(e){return new this({data:e.__data,format:e.__format,key:e.__key})}static getType(){return"pendingUpload"}static importDOM(){return{img:e=>({conversion:o=>bo(o,ma),priority:0})}}static importJSON(e){let o={formID:e.formID,src:e.src},r=ma({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return Vh(RawUploadComponent,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-pending-upload-form-id",String(this.__data?.formID)),{element:e}}exportJSON(){return{...super.exportJSON(),...this.getData(),type:"pendingUpload",version:1}}getData(){return this.getLatest().__data}setData(e){let o=this.getWritable();o.__data=e}updateDOM(){return!1}};function ma({data:t}){return Jh(new Rt({data:t}))}var Zh=fa.lazy(()=>import("./pendingComponent-WFSCE6LJ.js").then(t=>({default:t.PendingUploadComponent}))),ue=class extends Rt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:()=>({conversion:e=>bo(e,pa),priority:0})}}static importJSON(e){let o={formID:e.formID,src:e.src},r=pa({data:o});return r.setFormat(e.format),r}decorate(){return Xh(Zh,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function pa({data:t}){return zh(new ue({data:t}))}function Or(t){return t instanceof ue}import{jsx as Qh}from"react/jsx-runtime";import xa from"bson-objectid";import{$applyNodeReplacement as eg}from"lexical";import*as Ca from"react";import{DecoratorBlockNode as Yh}from"@lexical/react/LexicalDecoratorBlockNode.js";import ga from"bson-objectid";import{$applyNodeReplacement as qh}from"lexical";var vt=class extends Yh{__data;constructor({data:e,format:o,key:r}){super(o,r),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=>ko(o,ha),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new ga.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=ha({data:o});return r.setFormat(e.format),r}static isInline(){return!1}decorate(){return null}exportDOM(){let e=document.createElement("img");return e.setAttribute("data-lexical-upload-id",String(this.__data?.value)),e.setAttribute("data-lexical-upload-relation-to",this.__data?.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 ha({data:t}){return t?.id||(t.id=new ga.default().toHexString()),qh(new vt({data:t}))}var tg=Ca.lazy(()=>import("./component-3PENNOM3.js").then(t=>({default:t.UploadComponent}))),we=class extends vt{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>ko(o,ve),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new xa.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,relationTo:e.relationTo,value:e.value},r=ve({data:o});return r.setFormat(e.format),r}decorate(){return Qh(tg,{data:this.__data,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function ve({data:t}){return t?.id||(t.id=new xa.default().toHexString()),eg(new we({data:t}))}function Ar(t){return t instanceof we}import{c as cg}from"react/compiler-runtime";import{jsx as ug}from"react/jsx-runtime";import{useLexicalComposerContext as dg}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Sa,$insertNodeToNearestRoot as Pr,mergeRegister as mg}from"@lexical/utils";import{useBulkUpload as pg,useConfig as fg,useEffectEvent as hg,useModal as gg}from"@payloadcms/ui";import Br from"bson-objectid";import{$getPreviousSelection as Hr,$getSelection as jr,$isParagraphNode as Ur,$isRangeSelection as Gr,COMMAND_PRIORITY_EDITOR as xg,COMMAND_PRIORITY_LOW as Ea,createCommand as Cg,DROP_COMMAND as bg,PASTE_COMMAND as kg}from"lexical";import{useEffect as _g}from"react";import{c as ba}from"react/compiler-runtime";import{jsx as $r}from"react/jsx-runtime";import{useLexicalComposerContext as ka}from"@lexical/react/LexicalComposerContext.js";import{toast as og}from"@payloadcms/ui";import{$getNodeByKey as rg,COMMAND_PRIORITY_EDITOR as _a}from"lexical";import{useEffect as Ta,useState as ng}from"react";var lg=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=rg(o);n&&n.replace(ve({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Fr,{fields:null,relationTo:e,value:r})},ig=t=>{let e=ba(13),{enabledCollectionSlugs:o}=t,[r]=ka(),[n,l]=ng(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=St(i),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ge,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),_a),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),Ta(d,a);let p;e[6]!==s||e[7]!==r||e[8]!==n?(p=h=>{let{collectionSlug:g,doc:b}=h;s(),lg({editor:r,relationTo:g,replaceNodeKey:n,value:b.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=p):p=e[9];let m=p,f;return e[10]!==u||e[11]!==m?(f=$r(u,{onSelect:m}),e[10]=u,e[11]=m,e[12]=f):f=e[12],f},sg=()=>{let t=ba(3),[e]=ka(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ge,ag,_a),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),Ta(o,r),null},wa=t=>$r($t,{...t,FallbackComponent:sg,uploads:!0,children:$r(ig,{...t})});function ag(){return og.error("No upload collections enabled"),!0}var Fr=Cg("INSERT_UPLOAD_COMMAND"),Na=()=>{let t=cg(18),[e]=dg(),{config:o}=fg(),{collections:r}=o,{drawerSlug:n,setCollectionSlug:l,setInitialForms:i,setOnCancel:s,setOnSuccess:u,setSelectableCollections:c}=pg(),{isModalOpen:d,openModal:a}=gg(),p;t[0]!==n||t[1]!==r||t[2]!==e||t[3]!==d||t[4]!==a||t[5]!==l||t[6]!==i||t[7]!==s||t[8]!==u||t[9]!==c?(p=b=>{let{files:T}=b;if(T?.length!==0&&(i(E=>[...E??[],...T.map(Tg)]),!d(n))){let E=r.filter(wg).map(Eg);if(!E.length||!E[0])return;l(E[0]),c(E),s(()=>{e.update(Sg)}),u(C=>{let k=new Map(C.map(Ng));e.update(()=>{for(let x of Sa()){let w=x.node;if(Or(w)){let S=k.get(w.getData().formID);S&&w.replace(ve({data:{id:new Br.default().toHexString(),fields:S.doc,relationTo:S.collectionSlug,value:S.doc.id}}))}}})}),a(n)}},t[0]=n,t[1]=r,t[2]=e,t[3]=d,t[4]=a,t[5]=l,t[6]=i,t[7]=s,t[8]=u,t[9]=c,t[10]=p):p=t[10];let m=hg(p),f;t[11]!==e||t[12]!==m?(f=()=>{if(!e.hasNodes([we]))throw new Error("UploadPlugin: UploadNode not registered on editor");return mg(e.registerNodeTransform(ue,b=>{let T=b.getData();(async function(){let k=null,x=T.src,w=T.formID;if(x.startsWith("data:")){let S=x.match(/data:(image\/[a-zA-Z]+);base64,/),O=S?S[1]:"image/png",$=x.replace(/^data:image\/[a-zA-Z]+;base64,/,""),R=atob($),N=new Array(R.length);for(let D=0;D<R.length;D++)N[D]=R.charCodeAt(D);let _=new Uint8Array(N);k={alt:void 0,file:new File([_],"pasted-image."+O?.split("/")[1],{type:O}),formID:w}}else if(x.startsWith("http")||x.startsWith("https")){let O=await(await fetch(x)).blob();k={alt:void 0,file:new File([O],"pasted-image."+O.type.split("/")[1],{type:O.type}),formID:w}}k&&m({files:[k]})})()}),e.registerCommand(Fr,b=>(e.update(()=>{let T=jr()||Hr();if(Gr(T)){let E=ve({data:{id:b.id,fields:b.fields,relationTo:b.relationTo,value:b.value}}),{focus:C}=T,k=C.getNode();Pr(E),Ur(k)&&!k.__first&&k.remove()}}),!0),xg),e.registerCommand(kg,b=>{if(!(b instanceof ClipboardEvent))return!1;let T=b.clipboardData;if(!T?.types?.length||T?.types?.includes("text/html"))return!1;let E=[];return T?.files?.length&&Array.from(T.files).forEach(C=>{E.push({alt:"",file:C,formID:new Br.default().toHexString()})}),E.length?(e.update(()=>{let C=jr()||Hr();if(Gr(C))for(let k of E){let x=new ue({data:{formID:k.formID,src:URL.createObjectURL(k.file)}}),{focus:w}=C,S=w.getNode();Pr(x),Ur(S)&&!S.__first&&S.remove()}}),m({files:E}),!0):!1},Ea),e.registerCommand(bg,b=>{if(!(b instanceof DragEvent))return!1;let T=b.dataTransfer;if(!T?.types?.length)return!1;let E=[];return T?.files?.length&&Array.from(T.files).forEach(C=>{E.push({alt:"",file:C,formID:new Br.default().toHexString()})}),E.length?(b.preventDefault(),b.stopPropagation(),e.update(()=>{let C=jr()||Hr();if(Gr(C))for(let k of E){let x=new ue({data:{formID:k.formID,src:URL.createObjectURL(k.file)}}),{focus:w}=C,S=w.getNode();Pr(x),Ur(S)&&!S.__first&&S.remove()}}),m({files:E}),!0):!1},Ea))},t[11]=e,t[12]=m,t[13]=f):f=t[13];let h;t[14]!==e?(h=[e],t[14]=e,t[15]=h):h=t[15],_g(f,h);let g;return t[16]!==r?(g=ug(wa,{enabledCollectionSlugs:r.map(Lg)}),t[16]=r,t[17]=g):g=t[17],g};function Tg(t){return{file:t.file,formID:t.formID}}function wg(t){let{upload:e}=t;return!!e}function Eg(t){let{slug:e}=t;return e}function Sg(){for(let t of Sa()){let e=t.node;Or(e)&&e.remove()}}function Ng(t){return[t.formID,t]}function Lg(t){let{slug:e}=t;return e}var Ig=v({nodes:[we,ue],plugins:[{Component:Na,position:"normal"}],slashMenu:{groups:[Z([{Icon:Mr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]},toolbarFixed:{groups:[he([{ChildComponent:Mr,isActive:({selection:t})=>{if(!yg(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return Ar(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]}});import{c as vg}from"react/compiler-runtime";import{jsx as Vr}from"react/jsx-runtime";import{ShimmerEffect as Dg,useConfig as Mg}from"@payloadcms/ui";import{lazy as Og,Suspense as Ag,useEffect as $g,useState as Fg}from"react";var La={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",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:"editor-upload"};var _o={namespace:"lexical",theme:La};function ya({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){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.");l.features=l.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of l.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}import{deepMerge as Rg}from"payload/shared";var Ia=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?Rg(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Wr(t,e,o){return{admin:o,features:Ia(t),lexical:e,resolvedFeatureMap:t}}var Pg=Og(()=>import("./Field-PKJPWZJL.js").then(t=>({default:t.RichText}))),Bg=t=>{let e=vg(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,a=s===void 0?_o:s,{config:p}=Mg(),[m,f]=Fg(null),h,g;e[2]!==d||e[3]!==r||e[4]!==p||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==m||e[9]!==a||e[10]!==u?(h=()=>{if(m)return;let T=[];for(let[k,x]of Object.entries(r))x.clientFeatureProvider&&T.push(x.clientFeatureProvider(x.clientFeatureProps));let E=a||_o,C=ya({config:p,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:T,lexical:E}});f(Wr(C,E,d))},g=[a,d,m,r,n,l,i,p,u],e[2]=d,e[3]=r,e[4]=p,e[5]=n,e[6]=l,e[7]=i,e[8]=m,e[9]=a,e[10]=u,e[11]=h,e[12]=g):(h=e[11],g=e[12]),$g(h,g);let b;return e[13]!==m||e[14]!==t?(b=Vr(Ag,{fallback:Vr(Dg,{height:"35vh"}),children:m&&Vr(Pg,{...t,editorConfig:m})}),e[13]=m,e[14]=t,e[15]=b):b=e[15],b};function Hg(t){return t instanceof HTMLElement}function jg(...t){return t.filter(Boolean).join(" ")}var To=new WeakMap;function Ra(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function wo(t,e){let o=To.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=Ra(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=Ra(i);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},To.set(t,o)}return o.listeners.add(e),()=>{Ug(t,e)}}function Ug(t,e){let o=To.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(To.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Gg(t,e){return wo(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function Wg(t,e){return wo(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function Vg(t,e){return wo(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function Kg(t,e){return wo(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as Jg}from"react/compiler-runtime";import{jsx as Xg}from"react/jsx-runtime";import"react";var zg=()=>{let t=Jg(2),{EditButton:e}=pe(),o;return t[0]!==e?(o=e?Xg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Zg}from"react/compiler-runtime";import{jsx as Yg}from"react/jsx-runtime";import"react";var qg=()=>{let t=Zg(2),{RemoveButton:e}=pe(),o;return t[0]!==e?(o=e?Yg(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Qg}from"react/compiler-runtime";import{jsx as ex}from"react/jsx-runtime";import"react";var tx=()=>{let t=Qg(2),{Label:e}=pe(),o;return t[0]!==e?(o=e?ex(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as ox}from"react/compiler-runtime";import{jsx as rx}from"react/jsx-runtime";import"react";var nx=t=>{let e=ox(3),{children:o}=t,{InlineBlockContainer:r}=pe(),n;return e[0]!==r||e[1]!==o?(n=r?rx(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as lx}from"react/compiler-runtime";import{jsx as ix}from"react/jsx-runtime";import"react";var sx=t=>{let e=lx(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=De(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?ix(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as ax}from"react/compiler-runtime";import{jsx as cx}from"react/jsx-runtime";import"react";var ux=()=>{let t=ax(2),{EditButton:e}=De(),o;return t[0]!==e?(o=e?cx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as dx}from"react/compiler-runtime";import{jsx as mx}from"react/jsx-runtime";import"react";var px=()=>{let t=dx(2),{RemoveButton:e}=De(),o;return t[0]!==e?(o=e?mx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as fx}from"qs-esm";var hx=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=fx({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};import{c as gx}from"react/compiler-runtime";import{jsx as rt}from"react/jsx-runtime";import{FieldContext as xx,FieldPathContext as va,ServerFunctionsContext as Da,ShimmerEffect as Cx,useServerFunctions as bx}from"@payloadcms/ui";import kx,{useEffect as _x,useRef as Tx}from"react";var wx=t=>{let e=gx(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:u}=t,[c,d]=kx.useState(null),a=bx(),{_internal_renderField:p}=a,[m,f]=i.split("."),h=l??(o&&"name"in o?o?.name:"")??"",g;e[0]!==p||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==i?(g=()=>{(async function(){let{Field:O}=await p({field:{...o||{},type:"richText",admin:{hidden:!1}},initialValue:r??void 0,path:l,schemaPath:i});d(O)})()},e[0]=p,e[1]=o,e[2]=r,e[3]=l,e[4]=i,e[5]=g):g=e[5];let b=g,T=Tx(!1),E,C;if(e[6]!==b?(E=()=>{T.current||(T.current=!0,b())},C=[b],e[6]=b,e[7]=E,e[8]=C):(E=e[7],C=e[8]),_x(E,C),!c)return typeof n<"u"?n:rt(Cx,{});let k={...a,getFormState:async w=>a.getFormState({...w,collectionSlug:m==="collection"?f:void 0,globalSlug:m==="global"?f:void 0})};if(typeof u>"u"&&!s)return rt(Da,{value:{...k},children:rt(va,{value:h,children:c},h)});let x={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:h,setValue:s??Ex,showError:!1,value:u};return rt(Da,{value:{...k},children:rt(va,{value:h,children:rt(xx,{value:x,children:c})},h)})};function Ex(){}function Sx({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}export{ht as $createAutoLinkNode,Jt as $createBlockNode,No as $createInlineBlockNode,ge as $createLinkNode,Pe as $createRelationshipNode,ve as $createUploadNode,Ce as $isAutoLinkNode,dt as $isBlockNode,Lo as $isInlineBlockNode,J as $isLinkNode,pr as $isRelationshipNode,Ar as $isUploadNode,Va as AlignFeatureClient,xe as AutoLinkNode,sx as BlockCollapsible,ux as BlockEditButton,fe as BlockNode,px as BlockRemoveButton,Za as BlockquoteFeatureClient,Jc as BlocksFeatureClient,gu as BoldFeatureClient,re as CAN_USE_DOM,gp as ChecklistFeatureClient,sf as DETAIL_TYPE_TO_DETAIL,of as DOUBLE_LINE_BREAK,Cf as DebugJsxConverterFeatureClient,cf as ELEMENT_FORMAT_TO_TYPE,af as ELEMENT_TYPE_TO_FORMAT,Pa as ENABLE_SLASH_MENU_COMMAND,Oa as EditorConfigProvider,nt as FieldsDrawer,H0 as FixedToolbarFeatureClient,cd as HeadingFeatureClient,Nd as HorizontalRuleFeatureClient,We as INSERT_BLOCK_COMMAND,Ve as INSERT_INLINE_BLOCK_COMMAND,ef as IS_ALL_FORMATTING,Ud as IndentFeatureClient,nx as InlineBlockContainer,zg as InlineBlockEditButton,tx as InlineBlockLabel,So as InlineBlockNode,qg as InlineBlockRemoveButton,_u as InlineCodeFeatureClient,Y0 as InlineToolbarFeatureClient,Su as ItalicFeatureClient,nf as LTR_REGEX,Pp as LexicalPluginToLexicalFeatureClient,tp as LinkFeatureClient,ee as LinkNode,tf as NON_BREAKING_SPACE,A as NodeFormat,Ep as OrderedListFeatureClient,Kp as ParagraphFeatureClient,$a as Point,rf as RTL_REGEX,Ba as Rect,n0 as RelationshipFeatureClient,ke as RelationshipNode,wx as RenderLexical,Bg as RichTextField,Wp as SlateToLexicalFeatureClient,Ru as StrikethroughFeatureClient,Ou as SubscriptFeatureClient,Pu as SuperscriptFeatureClient,uf as TEXT_MODE_TO_TYPE,lf as TEXT_TYPE_TO_FORMAT,df as TEXT_TYPE_TO_MODE,ae as TOGGLE_LINK_COMMAND,Uh as TableFeatureClient,su as TestRecorderFeatureClient,ed as TextStateFeatureClient,Nt as ToolbarButton,Be as ToolbarDropdown,mu as TreeViewFeatureClient,Gu as UnderlineFeatureClient,Dp as UnorderedListFeatureClient,Ig as UploadFeatureClient,we as UploadNode,Kg as addSwipeDownListener,Gg as addSwipeLeftListener,Wg as addSwipeRightListener,Vg as addSwipeUpListener,Sx as buildEditorState,Vo as createBlockNode,v as createClientFeature,bf as defaultColors,_o as defaultEditorLexicalConfig,Cr as getDOMRangeRect,Ha as getEnabledNodes,hx as getRestPopulateFn,Ke as getSelectedNode,Hg as isHTMLElement,Fa as isPoint,jg as joinClasses,Wr as sanitizeClientEditorConfig,Ia as sanitizeClientFeatures,ao as setFloatingElemPosition,oo as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,he as toolbarAddDropdownGroupWithItems,Jo as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,Q as toolbarTextDropdownGroupWithItems,De as useBlockComponentContext,H as useEditorConfigContext,pe as useInlineBlockComponentContext,Aa as useLexicalDocumentDrawer,me as useLexicalDrawer,St as useLexicalListDrawer};
|
|
58
|
+
`,Qi="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",es="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",Nf=new RegExp("^[^"+es+"]*["+Qi+"]"),Lf=new RegExp("^[^"+Qi+"]*["+es+"]"),yf={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},Rf={directionless:O.IS_DIRECTIONLESS,unmergeable:O.IS_UNMERGEABLE},If={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},vf={[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"},Mf={normal:O.IS_NORMAL,segmented:O.IS_SEGMENTED,token:O.IS_TOKEN},Df={[O.IS_NORMAL]:"normal",[O.IS_SEGMENTED]:"segmented",[O.IS_TOKEN]:"token"};var ts={text:({node:t})=>{let e=t.text;return t.format&O.IS_BOLD&&(e=Pe("strong",{children:e})),t.format&O.IS_ITALIC&&(e=Pe("em",{children:e})),t.format&O.IS_STRIKETHROUGH&&(e=Pe("span",{style:{textDecoration:"line-through"},children:e})),t.format&O.IS_UNDERLINE&&(e=Pe("span",{style:{textDecoration:"underline"},children:e})),t.format&O.IS_CODE&&(e=Pe("code",{children:e})),t.format&O.IS_SUBSCRIPT&&(e=Pe("sub",{children:e})),t.format&O.IS_SUPERSCRIPT&&(e=Pe("sup",{children:e})),e}};import{jsx as Lt}from"react/jsx-runtime";var os={upload:({node:t})=>{let e=t;if(typeof e.value!="object")return null;let o=e.value,r=o.url;if(!o.mimeType.startsWith("image"))return Lt("a",{href:r,rel:"noopener noreferrer",children:o.filename});if(!o.sizes||!Object.keys(o.sizes).length)return Lt("img",{alt:o.filename,height:o.height,src:r,width:o.width});let n=[];for(let l in o.sizes){let i=o.sizes[l];if(!i||!i.width||!i.height||!i.mimeType||!i.filesize||!i.filename||!i.url)continue;let s=i?.url;n.push(Lt("source",{media:`(max-width: ${i.width}px)`,srcSet:s,type:i.mimeType},l))}return n.push(Lt("img",{alt:o?.filename,height:o?.height,src:r,width:o?.width},"image")),Lt("picture",{children:n})}};var Qe={...Zi,...ts,...Ki,...Wi,...qi,...Gi,...Vi,...zi,...Xi({}),...os,...Yi};import{jsx as ns,Fragment as Af}from"react/jsx-runtime";import gr from"react";function rs(t){let e=!!t?.root?.children?.length,o=!1;if(t?.root?.children?.length===1&&t?.root?.children[0]?.type==="paragraph"){let r=t?.root?.children[0];if(!r?.children||r?.children?.length===0)o=!0;else if(r?.children?.length===1){let n=r?.children[0];n?.type==="text"&&(n?.text?.length||(o=!0))}}return!(!e||o)}function ls({converters:t,data:e,disableIndent:o,disableTextAlign:r}){return rs(e)?is({converters:t,disableIndent:o,disableTextAlign:r,nodes:e?.root?.children,parent:e?.root}):ns(Af,{})}function is({converters:t,disableIndent:e,disableTextAlign:o,nodes:r,parent:n}){let l=t.unknown;return r.map((s,u)=>{let c;s.type==="block"?(c=t?.blocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Blocks converter: found ${s?.fields?.blockType} block, but no converter is provided`)):s.type==="inlineBlock"?(c=t?.inlineBlocks?.[s?.fields?.blockType],!c&&!l&&console.error(`Lexical => JSX converter: Inline Blocks converter: found ${s?.fields?.blockType} inline block, but no converter is provided`)):c=t[s.type];try{!c&&l&&(c=l);let d;c?d=typeof c=="function"?c({childIndex:u,converters:t,node:s,nodesToJSX:p=>is({converters:p.converters??t,disableIndent:p.disableIndent??e,disableTextAlign:p.disableTextAlign??o,nodes:p.nodes,parent:p.parent??{...s,parent:n}}),parent:n}):c:d=ns("span",{children:"unknown node"},u);let a={};if(!o&&(!Array.isArray(o)||!o?.includes(s.type))&&"format"in s&&s.format)switch(s.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(s.type))&&"indent"in s&&s.indent&&s.type!=="listitem"&&(a.paddingInlineStart=`${Number(s.indent)*40}px`),gr.isValidElement(d)){if(a.textAlign||a.paddingInlineStart){let m={...a,...d?.props?.style??{}};return gr.cloneElement(d,{key:u,style:m})}return gr.cloneElement(d,{key:u})}return d}catch(d){return console.error("Error converting lexical node to JSX:",d,"node:",s),null}}).filter(Boolean)}var xr=({className:t,converters:e,data:o,disableContainer:r,disableIndent:n,disableTextAlign:l})=>{if(!o)return null;let i={};e?typeof e=="function"?i=e({defaultConverters:Qe}):i=e:i=Qe;let s=o&&!Array.isArray(o)&&typeof o=="object"&&"root"in o&&ls({converters:i,data:o,disableIndent:n,disableTextAlign:l});return r?ss(Of,{children:s}):ss("div",{className:t??"payload-richtext",children:s})};function cs(){let t=$f(7),[e]=Ff(),o;t[0]!==e?(o=e.getEditorState().toJSON(),t[0]=e,t[1]=o):o=t[1];let[r,n]=Bf(o),l,i;t[2]!==e?(l=()=>e.registerUpdateListener(u=>{let{editorState:c}=u;n(c.toJSON())}),i=[e],t[2]=e,t[3]=l,t[4]=i):(l=t[3],i=t[4]),Pf(l,i);let s;return t[5]!==r?(s=as("div",{className:"debug-jsx-converter",children:as(xr,{converters:Qe,data:r})}),t[5]=r,t[6]=s):s=t[6],s}var jf=M({plugins:[{Component:cs,position:"bottom"}]});var B={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)"}},Hf={text:{"text-red":{css:{color:`light-dark(${B.red[600]}, ${B.red[400]})`},label:"Red"},"text-orange":{css:{color:`light-dark(${B.orange[600]}, ${B.orange[400]})`},label:"Orange"},"text-yellow":{css:{color:`light-dark(${B.yellow[700]}, ${B.yellow[300]})`},label:"Yellow"},"text-green":{css:{color:`light-dark(${B.green[700]}, ${B.green[400]})`},label:"Green"},"text-blue":{css:{color:`light-dark(${B.blue[600]}, ${B.blue[400]})`},label:"Blue"},"text-purple":{css:{color:`light-dark(${B.purple[600]}, ${B.purple[400]})`},label:"Purple"},"text-pink":{css:{color:`light-dark(${B.pink[600]}, ${B.pink[400]})`},label:"Pink"}},background:{"bg-red":{css:{"background-color":`light-dark(${B.red[400]}, ${B.red[600]})`},label:"Red"},"bg-orange":{css:{"background-color":`light-dark(${B.orange[400]}, ${B.orange[600]})`},label:"Orange"},"bg-yellow":{css:{"background-color":`light-dark(${B.yellow[300]}, ${B.yellow[700]})`},label:"Yellow"},"bg-green":{css:{"background-color":`light-dark(${B.green[400]}, ${B.green[700]})`},label:"Green"},"bg-blue":{css:{"background-color":`light-dark(${B.blue[400]}, ${B.blue[600]})`},label:"Blue"},"bg-purple":{css:{"background-color":`light-dark(${B.purple[400]}, ${B.purple[600]})`},label:"Purple"},"bg-pink":{css:{"background-color":`light-dark(${B.pink[400]}, ${B.pink[600]})`},label:"Pink"}}};import{$isNodeSelection as S0}from"lexical";import{jsx as yt,jsxs as Uf}from"react/jsx-runtime";import"react";var Cr=()=>Uf("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[yt("g",{clipPath:"url(#clip0_4397_10817)",children:yt("path",{d:"M7.75 12.25L15.25 4.75M15.25 4.75H11.5M15.25 4.75V8.5M13 11.5V13.75C13 14.5784 12.3284 15.25 11.5 15.25H6.25C5.42157 15.25 4.75 14.5784 4.75 13.75V8.5C4.75 7.67157 5.42157 7 6.25 7H8.5",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})}),yt("defs",{children:yt("clipPath",{id:"clip0_4397_10817",children:yt("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{jsx as Vf}from"react/jsx-runtime";import*as ds from"react";import{DecoratorBlockNode as Wf}from"@lexical/react/LexicalDecoratorBlockNode.js";function Gf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:us({relationTo:o,value:e})}:null}var Rt=class extends Wf{__data;constructor({data:e,format:o,key:r}){super(o,r),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:Gf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=us(o);return r.setFormat(e.format),r}static isInline(){return!1}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 us(t){return new Rt({data:t})}var Kf=ds.lazy(()=>import("./RelationshipComponent-APF3CN47.js").then(t=>({default:t.RelationshipComponent})));function Jf(t){let e=t.getAttribute("data-lexical-relationship-id"),o=t.getAttribute("data-lexical-relationship-relationTo");return e!=null&&o!=null?{node:Be({relationTo:o,value:e})}:null}var ke=class extends Rt{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:Jf,priority:2}}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id);let o={relationTo:e.relationTo,value:e.value},r=Be(o);return r.setFormat(e.format),r}decorate(e,o){return Vf(Kf,{className:o.theme.relationship??"LexicalEditorTheme__relationship",data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Be(t){return new ke({data:t})}function br(t){return t instanceof ke}import{c as d0}from"react/compiler-runtime";import{jsx as m0}from"react/jsx-runtime";import{useLexicalComposerContext as p0}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as f0}from"@lexical/utils";import{useConfig as h0}from"@payloadcms/ui";import{$getPreviousSelection as g0,$getSelection as x0,$isParagraphNode as C0,$isRangeSelection as b0,COMMAND_PRIORITY_EDITOR as k0,createCommand as _0}from"lexical";import{useEffect as T0}from"react";import{c as l0}from"react/compiler-runtime";import{jsx as fo}from"react/jsx-runtime";import{useLexicalComposerContext as i0}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as s0,COMMAND_PRIORITY_EDITOR as a0}from"lexical";import{useEffect as c0,useState as fs}from"react";import{c as Xf}from"react/compiler-runtime";import{jsx as zf}from"react/jsx-runtime";import{useLexicalComposerContext as Zf}from"@lexical/react/LexicalComposerContext";import{useListDrawer as Yf,useModal as qf}from"@payloadcms/ui";import{$getNodeByKey as ms,$getPreviousSelection as Qf,$getRoot as e0,$getSelection as t0,$isRangeSelection as o0,$setSelection as r0}from"lexical";import{useEffect as n0,useState as ps}from"react";var It=t=>{let e=Xf(23),[o]=Zf(),[r,n]=ps(null),[l,i]=ps(!1),[s,u,c]=Yf(t),{closeDrawer:d,drawerSlug:a,isDrawerOpen:m,openDrawer:p}=c,{modalState:f}=qf(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let $=t0()??Qf();n($)},e[0]=h):h=e[0];let g=h,C;e[1]!==o||e[2]!==r?(C=()=>{r&&o.update(()=>{if(o0(r)){let{anchor:$,focus:v}=r;ms($.key)&&ms(v.key)&&r0(r.clone())}else e0().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=r,e[3]=C):C=e[3];let _=C,S;e[4]!==d?(S=()=>{d()},e[4]=d,e[5]=S):S=e[5];let b=S,k,x;e[6]!==a||e[7]!==f||e[8]!==_||e[9]!==l?(k=()=>{if(!l)return;let $=f[a];$&&!$?.isOpen&&(i(!1),setTimeout(()=>{_()},1))},x=[f,a,_,l],e[6]=a,e[7]=f,e[8]=_,e[9]=l,e[10]=k,e[11]=x):(k=e[10],x=e[11]),n0(k,x);let w;e[12]!==u?(w=$=>zf(u,{...$,onClick:()=>{g()}}),e[12]=u,e[13]=w):w=e[13];let T;e[14]!==p?(T=()=>{g(),p(),i(!0)},e[14]=p,e[15]=T):T=e[15];let y;return e[16]!==s||e[17]!==b||e[18]!==m||e[19]!==a||e[20]!==w||e[21]!==T?(y={closeListDrawer:b,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:a,ListDrawerToggler:w,openListDrawer:T},e[16]=s,e[17]=b,e[18]=m,e[19]=a,e[20]=w,e[21]=T,e[22]=y):y=e[22],y};var u0=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=s0(o);n&&n.replace(Be({relationTo:e,value:r}))}):t.dispatchCommand(kr,{relationTo:e,value:r})},hs=t=>{let e=l0(16),{enabledCollectionSlugs:o}=t,[r]=i0(),n;e[0]!==o?.[0]?(n=()=>o?.[0],e[0]=o?.[0],e[1]=n):n=e[1];let[l]=fs(n),[i,s]=fs(null),u=o||void 0,c;e[2]!==l||e[3]!==u?(c={collectionSlugs:u,selectedCollection:l},e[2]=l,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,ListDrawer:a,openListDrawer:m}=It(c),p,f;e[5]!==r||e[6]!==m?(p=()=>r.registerCommand(ut,_=>(s(_?.replace?_?.replace.nodeKey:null),m(),!0),a0),f=[r,m],e[5]=r,e[6]=m,e[7]=p,e[8]=f):(p=e[7],f=e[8]),c0(p,f);let h;e[9]!==d||e[10]!==r||e[11]!==i?(h=_=>{let{collectionSlug:S,doc:b}=_;u0({editor:r,relationTo:S,replaceNodeKey:i,value:b.id}),d()},e[9]=d,e[10]=r,e[11]=i,e[12]=h):h=e[12];let g=h,C;return e[13]!==a||e[14]!==g?(C=fo(a,{onSelect:g}),e[13]=a,e[14]=g,e[15]=C):C=e[15],C},gs=t=>(t?.enabledCollectionSlugs?.length??-1)>0?fo(hs,{...t}):fo(Ut,{...t,children:fo(hs,{...t})});var kr=_0("INSERT_RELATIONSHIP_COMMAND"),xs=t=>{let e=d0(5),{clientProps:o}=t,[r]=p0(),{config:n}=h0(),{collections:l}=n,i=null;if(o?.enabledCollections)i=o?.enabledCollections;else if(o?.disabledCollections){let c;e[0]!==o?.disabledCollections?(c=d=>{let{slug:a}=d;return!o?.disabledCollections?.includes(a)},e[0]=o?.disabledCollections,e[1]=c):c=e[1],i=l.filter(c).map(w0)}let s,u;return e[2]!==r?(s=()=>{if(!r.hasNodes([ke]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return r.registerCommand(kr,E0,k0)},u=[r],e[2]=r,e[3]=s,e[4]=u):(s=e[3],u=e[4]),T0(s,u),m0(gs,{enabledCollectionSlugs:i})};function w0(t){let{slug:e}=t;return e}function E0(t){let e=x0()||g0();if(b0(e)){let o=Be(t),{focus:r}=e,n=r.getNode();f0(o),C0(n)&&!n.__first&&n.remove()}return!0}var N0=M({nodes:[ke],plugins:[{Component:xs,position:"normal"}],slashMenu:{groups:[Z([{Icon:Cr,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(ut,{replace:!1})}}])]},toolbarFixed:{groups:[he([{ChildComponent:Cr,isActive:({selection:t})=>{if(!S0(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return br(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(ut,{replace:!1})}}])]}});import{c as Ns}from"react/compiler-runtime";import{jsx as se,jsxs as Q0}from"react/jsx-runtime";import{useLexicalComposerContext as e1}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as t1,useThrottledEffect as o1,useTranslation as r1}from"@payloadcms/ui";import*as _e from"react";import{useMemo as n1}from"react";import{c as L0}from"react/compiler-runtime";import{jsx as y0}from"react/jsx-runtime";import{mergeRegister as R0}from"@lexical/utils";import{$addUpdateTag as I0,$getSelection as v0}from"lexical";import{useDeferredValue as M0,useEffect as D0,useState as A0}from"react";var Cs="toolbar-popup__button",vt=t=>{let e=L0(23),{children:o,editor:r,item:n}=t,l;e[0]===Symbol.for("react.memo_cache_sentinel")?(l={active:!1,enabled:!0},e[0]=l):l=e[0];let[i,s]=A0(l),u=M0(i),c=j(),d=u.enabled?"":"disabled",a=u.active?"active":"",m=n.key?`${Cs}-${n.key}`:"",p;e[1]!==d||e[2]!==a||e[3]!==m?(p=[Cs,d,a,m].filter(Boolean),e[1]=d,e[2]=a,e[3]=m,e[4]=p):p=e[4];let f=p.join(" "),h;e[5]!==r||e[6]!==c||e[7]!==n?(h=()=>{r.getEditorState().read(()=>{let T=v0();if(!T)return;let y=n.isActive?n.isActive({editor:r,editorConfigContext:c,selection:T}):!1,$=n.isEnabled?n.isEnabled({editor:r,editorConfigContext:c,selection:T}):!0;s(v=>v.active===y&&v.enabled===$?v:{active:y,enabled:$})})},e[5]=r,e[6]=c,e[7]=n,e[8]=h):h=e[8];let g=h,C=Wt(),_,S;e[9]!==r||e[10]!==C||e[11]!==g?(_=()=>{C(g);let T=()=>C(g),y=R0(r.registerUpdateListener(T));return document.addEventListener("mouseup",T),()=>{y(),document.removeEventListener("mouseup",T)}},S=[r,C,g],e[9]=r,e[10]=C,e[11]=g,e[12]=_,e[13]=S):(_=e[12],S=e[13]),D0(_,S);let b;e[14]!==i||e[15]!==r||e[16]!==n?(b=()=>{i.enabled&&r.focus(()=>{r.update(O0),n.onSelect?.({editor:r,isActive:i.active})})},e[14]=i,e[15]=r,e[16]=n,e[17]=b):b=e[17];let k=b,x=$0,w;return e[18]!==o||e[19]!==f||e[20]!==k||e[21]!==n.key?(w=y0("button",{className:f,"data-button-key":n.key,onClick:k,onMouseDown:x,type:"button",children:o}),e[18]=o,e[19]=f,e[20]=k,e[21]=n.key,e[22]=w):w=e[22],w};function O0(){I0("toolbar")}function $0(t){t.preventDefault()}import{c as W0}from"react/compiler-runtime";import{jsx as et}from"react/jsx-runtime";import Ss,{useCallback as G0,useDeferredValue as V0,useEffect as K0,useMemo as J0}from"react";import{mergeRegister as X0}from"@lexical/utils";import{useTranslation as z0}from"@payloadcms/ui";import{$getSelection as Z0}from"lexical";import{jsx as Le,jsxs as bs}from"react/jsx-runtime";import{Button as F0}from"@payloadcms/ui";import{$addUpdateTag as P0,isDOMNode as B0}from"lexical";import ho,{useCallback as j0,useEffect as go,useMemo as _s,useRef as _r,useState as Tr}from"react";import{createPortal as H0}from"react-dom";var ks="toolbar-popup__dropdown-item",Ts=ho.createContext(null);function ws({active:t,children:e,editor:o,enabled:r,Icon:n,item:l,itemKey:i,tooltip:s}){let u=_s(()=>[ks,r===!1?"disabled":"",t?"active":"",l?.key?`${ks}-${l.key}`:""].filter(Boolean).join(" "),[r,t,l.key]),c=_r(null),d=ho.use(Ts);if(d===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:a}=d;return go(()=>{c?.current!=null&&a(c)},[c,a]),Le(F0,{"aria-label":s,buttonStyle:"none",className:u,disabled:r===!1,extraButtonProps:{"data-item-key":i},icon:n,iconPosition:"left",iconStyle:"none",onClick:()=>{r!==!1&&o.focus(()=>{o.update(()=>{P0("toolbar")}),l.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:c,tooltip:s,type:"button",children:e})}function U0({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:r}){let[n,l]=Tr(),[i,s]=Tr(),u=j0(a=>{l(m=>m!=null?[...m,a]:[a])},[l]),c=a=>{if(n==null)return;let{key:m}=a;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&a.preventDefault(),m==="Escape"||m==="Tab"?r():m==="ArrowUp"?s(p=>{if(p==null)return n[0];let f=n.indexOf(p)-1;return n[f===-1?n.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?n[0]:n[n.indexOf(p)+1])},d=_s(()=>({registerItem:u}),[u]);return go(()=>{n!=null&&i==null&&s(n[0]),i!=null&&i?.current!=null&&i.current.focus()},[n,i]),Le(Ts,{value:d,children:Le("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:c,ref:e,children:t})})}function Es({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:r=!1,dropdownKey:n,Icon:l,itemsContainerClassNames:i,label:s,stopCloseOnClickSelf:u}){let c=_r(null),d=_r(null),[a,m]=Tr(!1),p=()=>{m(!1),d?.current!=null&&d.current.focus()};go(()=>{let h=d.current,g=c.current;if(a&&h!==null&&g!==null){let{left:C,top:_}=h.getBoundingClientRect(),S=window.scrollY||document.documentElement.scrollTop;g.style.top=`${_+S+h.offsetHeight+5}px`,g.style.left=`${Math.min(C-5,window.innerWidth-g.offsetWidth-20)}px`}},[c,d,a]),go(()=>{let h=d.current;if(h!==null&&a){let g=C=>{let _=C.target;B0(_)&&(u&&c.current&&c.current.contains(_)||h.contains(_)||m(!1))};return document.addEventListener("click",g),()=>{document.removeEventListener("click",g)}}},[c,d,a,u]);let f=H0(Le(U0,{dropDownRef:c,itemsContainerClassNames:i,onClose:p,children:o}),document.body);return bs(ho.Fragment,{children:[bs("button",{"aria-label":t,className:e+(a?" active":""),"data-dropdown-key":n,disabled:r,onClick:h=>{h.preventDefault(),m(!a)},onMouseDown:h=>{h.preventDefault()},ref:d,type:"button",children:[l&&Le(l,{}),s&&Le("span",{className:"toolbar-popup__dropdown-label",children:s}),Le("i",{className:"toolbar-popup__dropdown-caret"})]}),a&&Le(ho.Fragment,{children:f})]})}var wr="toolbar-popup__dropdown",Y0=t=>{let e=W0(14),{active:o,anchorElem:r,editor:n,enabled:l,item:i}=t,{i18n:s}=z0(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u;if(i.Component){let m;return e[0]!==o||e[1]!==r||e[2]!==n||e[3]!==l||e[4]!==i?(m=i?.Component&&et(i.Component,{active:o,anchorElem:r,editor:n,enabled:l,item:i},i.key),e[0]=o,e[1]=r,e[2]=n,e[3]=l,e[4]=i,e[5]=m):m=e[5],m}let a;if(e[6]!==o||e[7]!==n||e[8]!==l||e[9]!==c||e[10]!==s||e[11]!==i||e[12]!==d){let m=i.key,p;i.label&&(m=typeof i.label=="function"?i.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):i.label),m.length>25?p=m.substring(0,25)+"...":p=m,a=et(ws,{active:o,editor:n,enabled:l,Icon:i?.ChildComponent?et(i.ChildComponent,{}):void 0,item:i,itemKey:i.key,tooltip:m,children:et("span",{className:"text",children:p})},i.key),e[6]=o,e[7]=n,e[8]=l,e[9]=c,e[10]=s,e[11]=i,e[12]=d,e[13]=a}else a=e[13];return a},q0=Ss.memo(Y0),je=({anchorElem:t,classNames:e,editor:o,group:r,Icon:n,itemsContainerClassNames:l,label:i,maxActiveItems:s,onActiveChange:u})=>{let[c,d]=Ss.useState({activeItemKeys:[],enabledGroup:!0,enabledItemKeys:[]}),a=V0(c),m=j(),{items:p,key:f}=r,h=Wt(),g=G0(()=>{o.getEditorState().read(()=>{let _=Z0();if(!_)return;let S=[],b=[],k=[];for(let x of p)x.isActive&&(!s||S.length<s)&&x.isActive({editor:o,editorConfigContext:m,selection:_})&&(S.push(x.key),b.push(x)),x.isEnabled?x.isEnabled({editor:o,editorConfigContext:m,selection:_})&&k.push(x.key):k.push(x.key);d({activeItemKeys:S,enabledGroup:r.isEnabled?r.isEnabled({editor:o,editorConfigContext:m,selection:_}):!0,enabledItemKeys:k}),u&&u({activeItems:b})})},[o,m,r,p,s,u]);K0(()=>(h(g),X0(o.registerUpdateListener(async()=>{await h(g)}))),[o,h,g]);let C=J0(()=>p?.length?p.map(_=>et(q0,{active:a.activeItemKeys.includes(_.key),anchorElem:t,editor:o,enabled:a.enabledItemKeys.includes(_.key),item:_},_.key)):null,[p,a,t,o]);return et(Es,{buttonAriaLabel:`${f} dropdown`,buttonClassName:[wr,`${wr}-${f}`,...e||[]].filter(Boolean).join(" "),disabled:!a.enabledGroup,dropdownKey:f,Icon:n,itemsContainerClassNames:[`${wr}-items`,...l||[]],label:i,children:C},f)};function l1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&se(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?se(vt,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function i1(t){let e=Ns(23),{anchorElem:o,editor:r,editorConfig:n,group:l,index:i}=t,{i18n:s}=r1(),{fieldProps:u}=j(),{featureClientSchemaMap:c,schemaPath:d}=u,[a,m]=_e.useState(void 0),[p,f]=_e.useState(void 0),h;e[0]!==l.ChildComponent||e[1]!==l.items||e[2]!==l.type?(h=()=>{l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0)},e[0]=l.ChildComponent,e[1]=l.items,e[2]=l.type,e[3]=h):h=e[3];let g;e[4]!==l?(g=[l],e[4]=l,e[5]=g):g=e[5],_e.useEffect(h,g);let C;e[6]!==c||e[7]!==l.ChildComponent||e[8]!==l.items||e[9]!==l.type||e[10]!==s||e[11]!==d?(C=k=>{let{activeItems:x}=k;if(!x.length){l?.type==="dropdown"&&l.items.length&&l.ChildComponent?(f(()=>l.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let w=x[0],T=w.key;w.label&&(T=typeof w.label=="function"?w.label({featureClientSchemaMap:c,i18n:s,schemaPath:d}):w.label),T.length>25&&(T=T.substring(0,25)+"..."),x.length===1?(m(T),f(()=>w.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:x.length})),l?.type==="dropdown"&&l.items.length&&l.ChildComponent?f(()=>l.ChildComponent):f(void 0))},e[6]=c,e[7]=l.ChildComponent,e[8]=l.items,e[9]=l.type,e[10]=s,e[11]=d,e[12]=C):C=e[12];let _=C,S=`fixed-toolbar__group fixed-toolbar__group-${l.key}`,b;return e[13]!==p||e[14]!==o||e[15]!==a||e[16]!==r||e[17]!==n.features.toolbarFixed?.groups.length||e[18]!==l||e[19]!==i||e[20]!==_||e[21]!==S?(b=Q0("div",{className:S,"data-toolbar-group-key":l.key,children:[l.type==="dropdown"&&l.items.length?p?se(je,{anchorElem:o,editor:r,group:l,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:_}):se(je,{anchorElem:o,editor:r,group:l,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:a,maxActiveItems:l.maxActiveItems??1,onActiveChange:_}):null,l.type==="buttons"&&l.items.length?l.items.map(k=>se(l1,{anchorElem:o,editor:r,item:k},k.key)):null,i<n.features.toolbarFixed?.groups.length-1&&se("div",{className:"divider"})]},l.key),e[13]=p,e[14]=o,e[15]=a,e[16]=r,e[17]=n.features.toolbarFixed?.groups.length,e[18]=l,e[19]=i,e[20]=_,e[21]=S,e[22]=b):b=e[22],b}function s1({anchorElem:t,clientProps:e,editor:o,editorConfig:r,parentWithFixedToolbar:n}){let l=_e.useRef(null),{y:i}=t1(),s=n1(()=>{if(!n||e?.disableIfParentHasFixedToolbar)return null;let c=n.editorContainerRef.current.previousElementSibling;for(;c;){if(c.classList.contains("fixed-toolbar"))return c;c=c.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,n]);return o1(()=>{if(!s)return;let u=l.current;if(!u)return;let c=u.getBoundingClientRect(),d=s.getBoundingClientRect();if(!(c.bottom<d.top||c.top>d.bottom))u.classList.remove("fixed-toolbar"),u.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.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"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[l,s,i]),se("div",{className:"fixed-toolbar",onFocus:u=>{u.stopPropagation()},ref:l,children:o.isEditable()&&se(_e.Fragment,{children:r?.features&&r.features?.toolbarFixed?.groups.map((u,c)=>se(i1,{anchorElem:t,editor:o,editorConfig:r,group:u,index:c},u.key))})})}var Ls=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return Ls(t.parentEditor)}return!1},ys=t=>{let e=Ns(6),{clientProps:o}=t,[r]=e1(),n=j(),{editorConfig:l}=n,i=o.applyToFocusedEditor&&n.focusedEditor?.editor||r,s=o.applyToFocusedEditor&&n.focusedEditor?.editorConfig||l,u,c;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==i||e[2]!==s||e[3]!==n){c=Symbol.for("react.early_return_sentinel");e:{let d=Ls(n);if(o?.disableIfParentHasFixedToolbar&&d){c=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){c=null;break e}u=se(s1,{anchorElem:document.body,editor:i,editorConfig:s,parentWithFixedToolbar:d})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=i,e[2]=s,e[3]=n,e[4]=u,e[5]=c}else u=e[4],c=e[5];return c!==Symbol.for("react.early_return_sentinel")?c:u};var a1=M({plugins:[{Component:ys,position:"aboveContainer"}]});import{c as vs}from"react/compiler-runtime";import{jsx as de,jsxs as Ms}from"react/jsx-runtime";import{useLexicalComposerContext as c1}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Ds}from"@lexical/utils";import{$getSelection as As,$isRangeSelection as Rs,$isTextNode as u1,COMMAND_PRIORITY_LOW as d1,getDOMSelection as Os,SELECTION_CHANGE_COMMAND as m1}from"lexical";import{useCallback as Co,useEffect as Mt,useRef as Is,useState as p1}from"react";import*as bo from"react";import{createPortal as f1}from"react-dom";function Er(t,e){let o=t.getRangeAt(0),r;if(t.anchorNode===e){let n=e;for(;n.firstElementChild!=null;)n=n.firstElementChild;r=n.getBoundingClientRect()}else r=o.getBoundingClientRect();return r}function xo(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:r=0,floatingElem:n,horizontalOffset:l=32,horizontalPosition:i="left",specialHandlingForCaret:s=!1,targetRect:u,verticalGap:c=10}=t,d=o.parentElement;if(u===null||d==null){n.style.opacity="0",n.style.transform="translate(-10000px, -10000px)";return}let a=n.getBoundingClientRect(),m=o.getBoundingClientRect(),p=d.getBoundingClientRect(),f=u.top-a.height-c,h=u.left-l;i==="center"&&(h=u.left+u.width/2-a.width/2);let g=0;return!e&&f<p.top&&!s&&(g=a.height+u.height+c*2,f+=g),i==="center"?h+a.width>p.right?h=p.right-a.width-l:h<p.left&&(h=p.left+l):h+a.width>p.right&&(h=p.right-a.width-l),h-=m.left,n.style.opacity="1",s&&r!==0?(f-=m.bottom-r+a.height-3,n.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,n.style.transform=`translate(${h}px, ${f}px)`),g}function h1({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&de(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?de(vt,{editor:e,item:o,children:de(o.ChildComponent,{})},o.key):null}function g1(t){let e=vs(19),{anchorElem:o,editor:r,group:n,index:l}=t,{editorConfig:i}=j(),[s,u]=bo.useState(),c;e[0]!==n.ChildComponent||e[1]!==n.items||e[2]!==n.type?(c=()=>{n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0)},e[0]=n.ChildComponent,e[1]=n.items,e[2]=n.type,e[3]=c):c=e[3];let d;e[4]!==n?(d=[n],e[4]=n,e[5]=d):d=e[5],bo.useEffect(c,d);let a;e[6]!==n.ChildComponent||e[7]!==n.items||e[8]!==n.type?(a=h=>{let{activeItems:g}=h;if(!g.length){n?.type==="dropdown"&&n.items.length&&n.ChildComponent?u(()=>n.ChildComponent):u(void 0);return}let C=g[0];u(()=>C?.ChildComponent)},e[6]=n.ChildComponent,e[7]=n.items,e[8]=n.type,e[9]=a):a=e[9];let m=a,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${n.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==r||e[13]!==i.features.toolbarInline?.groups.length||e[14]!==n||e[15]!==l||e[16]!==m||e[17]!==p?(f=Ms("div",{className:p,"data-toolbar-group-key":n.key,children:[n.type==="dropdown"&&n.items.length?s?de(je,{anchorElem:o,editor:r,group:n,Icon:s,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):de(je,{anchorElem:o,editor:r,group:n,maxActiveItems:n.maxActiveItems??1,onActiveChange:m}):null,n.type==="buttons"&&n.items.length?n.items.map(h=>de(h1,{anchorElem:o,editor:r,item:h},h.key)):null,l<i.features.toolbarInline?.groups.length-1&&de("div",{className:"divider"})]},n.key),e[10]=s,e[11]=o,e[12]=r,e[13]=i.features.toolbarInline?.groups.length,e[14]=n,e[15]=l,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function x1({anchorElem:t,editor:e}){let o=Is(null),r=Is(null),{editorConfig:n}=j(),l=Co(()=>{if(o?.current){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";c||(o.current.style.opacity="0"),d||(o.current.style.pointerEvents="none")}},[o]),i=Co(c=>{if(o?.current&&(c.buttons===1||c.buttons===3)){let d=o.current.style.opacity==="0",a=o.current.style.pointerEvents==="none";if(!d||!a){let m=c.clientX,p=c.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||l()}}},[l]),s=Co(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);Mt(()=>(document.addEventListener("mousemove",i),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",i),document.removeEventListener("mouseup",s)}),[o,i,s]);let u=Co(()=>{let c=As(),d=Os(e._window);if(o.current===null)return;let a=t.querySelector(":scope > .link-editor"),m=a!==null&&"style"in a&&a?.style?.opacity==="1",p=e.getRootElement();if(c!==null&&d!==null&&!d.isCollapsed&&p!==null&&p.contains(d.anchorNode)){let f=Er(d,p),h=xo({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});r.current&&xo({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:r.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else l()},[e,l,t]);return Mt(()=>{let c=t.parentElement,d=()=>{e.getEditorState().read(()=>{u()})};return window.addEventListener("resize",d),c&&c.addEventListener("scroll",d),()=>{window.removeEventListener("resize",d),c&&c.removeEventListener("scroll",d)}},[e,u,t]),Mt(()=>(e.getEditorState().read(()=>{u()}),Ds(e.registerUpdateListener(({editorState:c})=>{c.read(()=>{u()})}),e.registerCommand(m1,()=>(u(),!1),d1))),[e,u]),Ms("div",{className:"inline-toolbar-popup",ref:o,children:[de("div",{className:"caret",ref:r}),n?.features&&n.features?.toolbarInline?.groups.map((c,d)=>de(g1,{anchorElem:t,editor:e,group:c,index:d},c.key))]})}function C1(t,e){let o=vs(12),[r,n]=p1(!1),l;o[0]!==t?(l=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=As(),p=Os(t._window),f=t.getRootElement();if(p!==null&&(!Rs(m)||f===null||!f.contains(p.anchorNode))){n(!1);return}if(!Rs(m))return;if(m.getTextContent()!==""){let g=m.getNodes(),C=!1;for(let _ of g)if(u1(_)){n(!0),C=!0;break}C||n(!1)}else n(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){n(!1);return}})},o[0]=t,o[1]=l):l=o[1];let i=l,s,u;o[2]!==i?(s=()=>(document.addEventListener("selectionchange",i),document.addEventListener("mouseup",i),()=>{document.removeEventListener("selectionchange",i),document.removeEventListener("mouseup",i)}),u=[i],o[2]=i,o[3]=s,o[4]=u):(s=o[3],u=o[4]),Mt(s,u);let c,d;if(o[5]!==t||o[6]!==i?(c=()=>Ds(t.registerUpdateListener(()=>{i()}),t.registerRootListener(()=>{t.getRootElement()===null&&n(!1)})),d=[t,i],o[5]=t,o[6]=i,o[7]=c,o[8]=d):(c=o[7],d=o[8]),Mt(c,d),!r||!t.isEditable())return null;let a;return o[9]!==e||o[10]!==t?(a=f1(de(x1,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=a):a=o[11],a}var $s=t=>{let{anchorElem:e}=t,[o]=c1();return C1(o,e)};var b1=M({plugins:[{Component:$s,position:"floatingAnchorElem"}]});import{TableCellNode as sg,TableNode as ag,TableRowNode as cg}from"@lexical/table";import{jsx as Fs}from"react/jsx-runtime";import"react";var Sr=()=>Fs("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Fs("path",{clipRule:"evenodd",d:"M5.33333 4.5C4.8731 4.5 4.5 4.8731 4.5 5.33333V7.5H9.5V4.5H5.33333ZM5.33333 3.5C4.32081 3.5 3.5 4.32081 3.5 5.33333V14.6667C3.5 15.6792 4.32081 16.5 5.33333 16.5H14.6667C15.6792 16.5 16.5 15.6792 16.5 14.6667V5.33333C16.5 4.32081 15.6792 3.5 14.6667 3.5H5.33333ZM10.5 4.5V7.5H15.5V5.33333C15.5 4.8731 15.1269 4.5 14.6667 4.5H10.5ZM15.5 8.5H10.5V11.5H15.5V8.5ZM15.5 12.5H10.5V15.5H14.6667C15.1269 15.5 15.5 15.1269 15.5 14.6667V12.5ZM9.5 15.5V12.5H4.5V14.6667C4.5 15.1269 4.8731 15.5 5.33333 15.5H9.5ZM4.5 11.5H9.5V8.5H4.5V11.5Z",fill:"currentColor",fillRule:"evenodd"})});import{$createTableCellNode as k1,$createTableNode as _1,$createTableRowNode as T1,$isTableCellNode as Ps,$isTableNode as Nr,$isTableRowNode as Lr,TableCellHeaderStates as ko,TableCellNode as w1,TableNode as E1,TableRowNode as S1}from"@lexical/table";import{$isParagraphNode as N1,$isTextNode as L1}from"lexical";var js=/^\|(.+)\|\s?$/,y1=/^(\| ?:?-*:? ?)+\|\s?$/,Hs=({allTransformers:t})=>({type:"element",dependencies:[E1,S1,w1],export:e=>{if(!Nr(e))return null;let o=[];for(let r of e.getChildren()){let n=[];if(!Lr(r))continue;let l=!1;for(let i of r.getChildren())Ps(i)&&(n.push(Ht(t,i).replace(/\n/g,"\\n").trim()),i.__headerState===ko.ROW&&(l=!0));o.push(`| ${n.join(" | ")} |`),l&&o.push(`| ${n.map(i=>"---").join(" | ")} |`)}return o.join(`
|
|
59
|
+
`)},regExp:js,replace:(e,o,r)=>{let n=r[0];if(!n)return;if(y1.test(n)){let a=e.getPreviousSibling();if(!a||!Nr(a))return;let m=a.getChildren(),p=m[m.length-1];if(!p||!Lr(p))return;p.getChildren().forEach(f=>{Ps(f)&&f.setHeaderStyles(ko.ROW,ko.ROW)}),e.remove();return}let l=Bs(n,t);if(l==null)return;let i=[l],s=e.getPreviousSibling(),u=l.length;for(;s&&!(!N1(s)||s.getChildrenSize()!==1);){let a=s.getFirstChild();if(!L1(a))break;let m=Bs(a.getTextContent(),t);if(m==null)break;u=Math.max(u,m.length),i.unshift(m);let p=s.getPreviousSibling();s.remove(),s=p}let c=_1();for(let a of i){let m=T1();c.append(m);for(let p=0;p<u;p++)m.append(p<a.length?a[p]:Us("",t))}let d=e.getPreviousSibling();Nr(d)&&R1(d)===u?(d.append(...c.getChildren()),e.remove()):e.replace(c),c.selectEnd()}});function R1(t){let e=t.getFirstChild();return Lr(e)?e.getChildrenSize():0}var Us=(t,e)=>{t=t.replace(/\\n/g,`
|
|
60
|
+
`);let o=k1(ko.NO_STATUS);return jt(t,e,o),o},Bs=(t,e)=>{let o=t.match(js);return!o||!o[1]?null:o[1].split("|").map(r=>Us(r,e))};import{c as v1}from"react/compiler-runtime";import{jsx as P,jsxs as Te}from"react/jsx-runtime";import{useLexicalComposerContext as Js}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as M1}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as Gs,$deleteTableColumnAtSelection as D1,$deleteTableRowAtSelection as A1,$getNodeTriplet as O1,$getTableCellNodeFromLexicalNode as Vs,$getTableColumnIndexFromTableCellNode as $1,$getTableNodeFromLexicalNodeOrThrow as Re,$getTableRowIndexFromTableCellNode as F1,$insertTableColumnAtSelection as P1,$insertTableRowAtSelection as B1,$isTableCellNode as Xs,$isTableSelection as Dt,$mergeCells as j1,$unmergeCell as H1,getTableElement as Rr,getTableObserverFromTableElement as Ir,TableCellHeaderStates as ye,TableCellNode as U1}from"@lexical/table";import{mergeRegister as W1}from"@lexical/utils";import{useScrollInfo as G1}from"@payloadcms/ui";import{$getSelection as To,$isElementNode as V1,$isRangeSelection as vr,$isTextNode as K1,$setSelection as J1,COMMAND_PRIORITY_CRITICAL as X1,getDOMSelection as z1,isDOMNode as Z1,SELECTION_CHANGE_COMMAND as Y1}from"lexical";import*as Mr from"react";import{useCallback as ae,useEffect as tt,useRef as _o,useState as ot}from"react";import{createPortal as zs}from"react-dom";import{jsx as yr,jsxs as I1}from"react/jsx-runtime";import"react";var Ws=()=>I1("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[yr("path",{d:"M5 11C5.55228 11 6 10.5523 6 10C6 9.44772 5.55228 9 5 9C4.44772 9 4 9.44772 4 10C4 10.5523 4.44772 11 5 11Z",fill:"currentColor"}),yr("path",{d:"M10 11C10.5523 11 11 10.5523 11 10C11 9.44772 10.5523 9 10 9C9.44772 9 9 9.44772 9 10C9 10.5523 9.44772 11 10 11Z",fill:"currentColor"}),yr("path",{d:"M15 11C15.5523 11 16 10.5523 16 10C16 9.44772 15.5523 9 15 9C14.4477 9 14 9.44772 14 10C14 10.5523 14.4477 11 15 11Z",fill:"currentColor"})]});function Ks(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function q1(){let t=To();if(vr(t)&&!t.isCollapsed()||Dt(t)&&!t.anchor.is(t.focus)||!vr(t)&&!Dt(t))return!1;let[e]=O1(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Q1(t){let e=t.getLastDescendant();K1(e)?e.select():V1(e)?e.selectEnd():e!==null&&e.selectNext()}function eh({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:r,tableCellNode:n}){let[l]=Js(),i=_o(null),[s,u]=ot(n),[c,d]=ot({columns:1,rows:1}),[a,m]=ot(!1),[p,f]=ot(!1),{y:h}=G1();tt(()=>l.registerMutationListener(U1,E=>{E.get(s.getKey())==="updated"&&l.getEditorState().read(()=>{u(s.getLatest())})},{skipInitialization:!0}),[l,s]),tt(()=>{l.getEditorState().read(()=>{let E=To();if(Dt(E)){let L=Ks(E);d(Ks(E)),m(L.columns>1||L.rows>1)}f(q1())})},[l]),tt(()=>{let E=e.current,L=i.current,D=l.getRootElement();if(E!=null&&L!=null&&D!=null){let I=D.getBoundingClientRect(),A=E.getBoundingClientRect();L.style.opacity="1";let R=L.getBoundingClientRect(),F=5,W=A.right+F;if(W+R.width>window.innerWidth||W+R.width>I.right){let te=A.left-R.width-F;W=(te<0?F:te)+window.pageXOffset}L.style.left=`${W+window.pageXOffset}px`;let q=A.top;if(q+R.height>window.innerHeight){let te=A.bottom-R.height;q=te<0?F:te}L.style.top=`${q}px`}},[e,i,l,h]),tt(()=>{function E(L){i.current!=null&&e.current!=null&&Z1(L.target)&&!i.current.contains(L.target)&&!e.current.contains(L.target)&&r(!1)}return window.addEventListener("click",E),()=>window.removeEventListener("click",E)},[r,e]);let g=ae(()=>{l.update(()=>{if(s.isAttached()){let E=Re(s),L=Rr(E,l.getElementByKey(E.getKey()));if(L===null)throw new Error("Expected to find tableElement in DOM");let D=Ir(L);D!==null&&D.$clearHighlight(),E.markDirty(),u(s.getLatest())}J1(null)})},[l,s]),C=()=>{l.update(()=>{let E=To();if(!Dt(E))return;let D=E.getNodes().filter(Xs),I=j1(D);I&&(Q1(I),o())})},_=()=>{l.update(()=>{H1()})},S=ae(E=>{l.update(()=>{for(let L=0;L<c.rows;L++)B1(E);o()})},[l,o,c.rows]),b=ae(E=>{l.update(()=>{for(let L=0;L<c.columns;L++)P1(E);o()})},[l,o,c.columns]),k=ae(()=>{l.update(()=>{A1(),o()})},[l,o]),x=ae(()=>{l.update(()=>{Re(s).remove(),g(),o()})},[l,s,g,o]),w=ae(()=>{l.update(()=>{D1(),o()})},[l,o]),T=ae(()=>{l.update(()=>{let E=Re(s),L=F1(s),[D]=Gs(E,null,null),I=new Set,A=s.getHeaderStyles()^ye.ROW;if(D[L])for(let R=0;R<D[L].length;R++){let F=D[L][R];F?.cell&&(I.has(F.cell)||(I.add(F.cell),F.cell.setHeaderStyles(A,ye.ROW)))}g(),o()})},[l,s,g,o]),y=ae(()=>{l.update(()=>{let E=Re(s),L=$1(s),[D]=Gs(E,null,null),I=new Set,A=s.getHeaderStyles()^ye.COLUMN;if(D)for(let R=0;R<D.length;R++){let F=D?.[R]?.[L];F?.cell&&(I.has(F.cell)||(I.add(F.cell),F.cell.setHeaderStyles(A,ye.COLUMN)))}g(),o()})},[l,s,g,o]),$=ae(()=>{l.update(()=>{if(s.isAttached()){let E=Re(s);E&&E.setRowStriping(!E.getRowStriping())}g(),o()})},[l,s,g,o]),v=ae(()=>{l.update(()=>{if(s.isAttached()){let E=Re(s);E&&E.setFrozenColumns(E.getFrozenColumns()===0?1:0)}g(),o()})},[l,s,g,o]),N=null;return t&&(a?N=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>C(),type:"button",children:P("span",{className:"text",children:"Merge cells"})}):p&&(N=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Unmerge cells"})}))),zs(Te("div",{className:"table-action-menu-dropdown",onClick:E=>{E.stopPropagation()},ref:i,children:[N?Te(Mr.Fragment,{children:[N,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>$(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-freeze-first-column",onClick:()=>v(),type:"button",children:P("span",{className:"text",children:"Toggle First Column Freeze"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>S(!1),type:"button",children:Te("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>S(!0),type:"button",children:Te("span",{className:"text",children:["Insert ",c.rows===1?"row":`${c.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>b(!1),type:"button",children:Te("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>b(!0),type:"button",children:Te("span",{className:"text",children:["Insert ",c.columns===1?"column":`${c.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>w(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>k(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>x(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-row-header",onClick:()=>T(),type:"button",children:Te("span",{className:"text",children:[(s.__headerState&ye.ROW)===ye.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>y(),type:"button",children:Te("span",{className:"text",children:[(s.__headerState&ye.COLUMN)===ye.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function th({anchorElem:t,cellMerge:e}){let[o]=Js(),r=_o(null),n=_o(null),[l,i]=ot(!1),[s,u]=ot(null),c=ae(()=>{let a=r.current,m=To(),p=z1(o._window),f=document.activeElement;function h(){a&&(a.classList.remove("table-cell-action-button-container--active"),a.classList.add("table-cell-action-button-container--inactive")),u(null)}if(m==null||a==null)return h();let g=o.getRootElement(),C=null,_=null;if(vr(m)&&g!==null&&p!==null&&g.contains(p.anchorNode)){let b=Vs(m.anchor.getNode());if(b==null||(_=o.getElementByKey(b.getKey()),_==null||!b.isAttached()))return h();let k=Re(b),x=Rr(k,o.getElementByKey(k.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=Ir(x),u(b)}else if(Dt(m)){let b=Vs(m.anchor.getNode());if(!Xs(b))throw new Error("TableSelection anchorNode must be a TableCellNode");let k=Re(b),x=Rr(k,o.getElementByKey(k.getKey()));if(x===null)throw new Error("TableActionMenu: Expected to find tableElement in DOM");C=Ir(x),_=o.getElementByKey(b.getKey())}else if(!f)return h();if(C===null||_===null)return h();let S=!C||!C.isSelecting;if(a.classList.toggle("table-cell-action-button-container--active",S),a.classList.toggle("table-cell-action-button-container--inactive",!S),S){let b=_.getBoundingClientRect(),k=t.getBoundingClientRect(),x=b.top-k.top,w=b.right-k.left;a.style.transform=`translate(${w}px, ${x}px)`}},[o,t]);tt(()=>{let a,m=()=>{a=void 0,o.getEditorState().read(c)},p=()=>(a===void 0&&(a=setTimeout(m,0)),!1);return W1(o.registerUpdateListener(p),o.registerCommand(Y1,p,X1),o.registerRootListener((f,h)=>{h&&h.removeEventListener("pointerup",p),f&&(f.addEventListener("pointerup",p),p())}),()=>clearTimeout(a))});let d=_o(s);return tt(()=>{d.current!==s&&i(!1),d.current=s},[d,s]),P("div",{className:"table-cell-action-button-container",ref:r,children:s!=null&&Te(Mr.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:a=>{a.stopPropagation(),i(!l)},ref:n,type:"button",children:P(Ws,{})}),l&&P(eh,{cellMerge:e,contextRef:n,onClose:()=>i(!1),setIsMenuOpen:i,tableCellNode:s})]})})}var Zs=t=>{let e=v1(3),{anchorElem:o}=t,r=M1(),n;return e[0]!==o||e[1]!==r?(n=zs(r?P(th,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=r,e[2]=n):n=e[2],n};import{c as oh}from"react/compiler-runtime";import{jsx as Eo,jsxs as rh}from"react/jsx-runtime";import{useLexicalComposerContext as nh}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as lh}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as ih,$getTableNodeFromLexicalNodeOrThrow as Dr,$getTableRowIndexFromTableCellNode as sh,$isTableCellNode as Ys,$isTableRowNode as ah,getDOMCellFromTarget as ch,getTableElement as uh,TableNode as qs}from"@lexical/table";import{calculateZoomLevel as Qs,mergeRegister as dh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Ar,isHTMLElement as mh,SKIP_SCROLL_INTO_VIEW_TAG as ea}from"lexical";import*as oa from"react";import{useCallback as At,useEffect as Or,useRef as wo,useState as rt}from"react";import{createPortal as ph}from"react-dom";var fh=33,ta=92;function hh({editor:t}){let e=wo(null),o=wo(null),r=wo(null),[n,l]=rt(!1),i=j(),s=wo(null),[u,c]=rt(null),[d,a]=rt(null),[m,p]=rt(!1),[f,h]=rt(null),g=At(()=>{a(null),e.current=null,h(null),s.current=null,r.current=null},[]),C=v=>(v.buttons&1)===1;Or(()=>{let v=new Set;return dh(t.registerMutationListener(qs,N=>{for(let[E,L]of N)L==="destroyed"?v.delete(E):v.add(E);l(v.size>0)}),t.registerNodeTransform(qs,N=>{if(N.getColWidths())return N;let E=N.getColumnCount(),L=ta;return N.setColWidths(Array(E).fill(L)),N}))},[t]),Or(()=>{if(!n)return;let v=D=>{let I=D.target;if(mh(I)){if(f){c({x:D.clientX,y:D.clientY});return}if(p(C(D)),!(o.current&&o.current.contains(I))&&e.current!==I){e.current=I;let A=ch(I);A&&d!==A?t.getEditorState().read(()=>{let R=Ar(A.elem);if(!R)throw new Error("TableCellResizer: Table cell node not found.");let F=Dr(R),W=uh(F,t.getElementByKey(F.getKey()));if(!W)throw new Error("TableCellResizer: Table element not found.");e.current=I,r.current=W.getBoundingClientRect(),a(A)},{editor:t}):A==null&&g()}}},N=D=>{p(!0)},E=D=>{p(!1)},L=t.registerRootListener((D,I)=>{I?.removeEventListener("mousemove",v),I?.removeEventListener("mousedown",N),I?.removeEventListener("mouseup",E),D?.addEventListener("mousemove",v),D?.addEventListener("mousedown",N),D?.addEventListener("mouseup",E)});return()=>{L()}},[d,f,t,n,g]);let _=v=>v==="bottom",S=At(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Ar(d.elem);if(!Ys(N))throw new Error("TableCellResizer: Table cell node not found.");let E=Dr(N),L=sh(N),D=E.getChildren(),A=N.getColSpan()===E.getColumnCount()?L:L+N.getRowSpan()-1;if(A>=D.length||A<0)throw new Error("Expected table cell to be inside of table row.");let R=D[A];if(!ah(R))throw new Error("Expected table row");let F=R.getHeight();if(F===void 0){let q=R.getChildren();F=Math.min(...q.map(te=>b(te,t)??1/0))}let W=Math.max(F+v,fh);R.setHeight(W)},{tag:ea})},[d,t]),b=(v,N)=>N.getElementByKey(v.getKey())?.clientHeight,k=(v,N)=>{let E;return N.forEach(L=>{L.forEach((D,I)=>{D.cell===v&&(E=I)})}),E},x=At(v=>{if(!d)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let N=Ar(d.elem);if(!Ys(N))throw new Error("TableCellResizer: Table cell node not found.");let E=Dr(N),[L]=ih(E,null,null),D=k(N,L);if(D===void 0)throw new Error("TableCellResizer: Table column not found.");let I=E.getColWidths();if(!I)return;let A=I[D];if(A===void 0)return;let R=[...I],F=Math.max(A+v,ta);R[D]=F,E.setColWidths(R)},{tag:ea})},[d,t]),w=At(v=>{let N=E=>{if(E.preventDefault(),E.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");if(s.current){let{x:L,y:D}=s.current;if(d===null)return;let I=Qs(E.target);if(_(v)){let A=(E.clientY-D)/I;S(A)}else{let A=(E.clientX-L)/I;x(A)}g(),document.removeEventListener("mouseup",N)}};return N},[d,g,x,S]),T=At(v=>N=>{if(N.preventDefault(),N.stopPropagation(),!d)throw new Error("TableCellResizer: Expected active cell.");s.current={x:N.clientX,y:N.clientY},c(s.current),h(v),document.addEventListener("mouseup",w(v))},[d,w]),[y,$]=rt({bottom:null,left:null,right:null,top:null});return Or(()=>{if(d){let{height:v,left:N,top:E,width:L}=d.elem.getBoundingClientRect(),D=Qs(d.elem),I=10,A={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${I}px`,left:`${window.scrollX+N}px`,top:`${window.scrollY+E+v-I/2}px`,width:`${L}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${v}px`,left:`${window.scrollX+N+L-I/2}px`,top:`${window.scrollY+E}px`,width:`${I}px`}},R=r.current;f&&u&&R&&(_(f)?(A[f].left=`${window.scrollX+R.left}px`,A[f].top=`${window.scrollY+u.y/D}px`,A[f].height="3px",A[f].width=`${R.width}px`):(A[f].top=`${window.scrollY+R.top}px`,A[f].left=`${window.scrollX+u.x/D}px`,A[f].width="3px",A[f].height=`${R.height}px`),A[f].backgroundColor="#adf"),$(A)}else $({bottom:null,left:null,right:null,top:null})},[d,f,u]),Eo("div",{ref:o,children:d!=null&&!m&&rh(oa.Fragment,{children:[Eo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("right"),style:y.right||void 0}),Eo("div",{className:`${i.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:T("bottom"),style:y.bottom||void 0})]})})}var ra=()=>{let t=oh(3),[e]=nh(),o=lh(),r;return t[0]!==e||t[1]!==o?(r=o?ph(Eo(hh,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],r};import{c as wh}from"react/compiler-runtime";import{jsx as $r,jsxs as Eh,Fragment as Sh}from"react/jsx-runtime";import{useLexicalComposerContext as da}from"@lexical/react/LexicalComposerContext";import{$getTableAndElementByKey as Nh,$getTableColumnIndexFromTableCellNode as Lh,$getTableRowIndexFromTableCellNode as yh,$insertTableColumnAtSelection as Rh,$insertTableRowAtSelection as Ih,$isTableCellNode as vh,$isTableNode as ia,getTableElement as Mh,TableNode as Dh}from"@lexical/table";import{$findMatchingParent as Ah,mergeRegister as Oh}from"@lexical/utils";import{$getNearestNodeFromDOMNode as sa,isHTMLElement as $h}from"lexical";import{useEffect as aa,useMemo as Fh,useRef as ca,useState as So}from"react";import"react";import{createPortal as Ph}from"react-dom";import{c as kh}from"react/compiler-runtime";import{useEffect as _h,useRef as Th}from"react";var gh="Expected a function",xh=Math.max,Ch=Math.min;function bh(t,e,o){let r,n,l=0,i,s=!1,u=!1,c,d,a,m=!0;if(typeof t!="function")throw new TypeError(gh);e=e||0,typeof o=="object"&&(s=!!o.leading,u="maxWait"in o,c=u?xh(o.maxWait||0,e):c,m="trailing"in o?!!o.trailing:m);function p(x){let w=r,T=i;return r=i=void 0,l=x,d=t.apply(T,w),d}function f(x){return l=x,a=setTimeout(C,e),s?p(x):d}function h(x){let w=x-n,T=x-l,y=e-w;return u?Ch(y,c-T):y}function g(x){let w=x-n,T=x-l;return n===void 0||w>=e||w<0||u&&T>=c}function C(){let x=Date.now();if(g(x))return _(x);a=setTimeout(C,h(x))}function _(x){return a=void 0,m&&r?p(x):(r=i=void 0,d)}function S(){a!==void 0&&clearTimeout(a),l=0,r=n=i=a=void 0}function b(){return a===void 0?d:_(Date.now())}function k(){let x=Date.now(),w=g(x);if(r=arguments,i=this,n=x,w){if(a===void 0)return f(n);if(u)return clearTimeout(a),a=setTimeout(C,e),p(n)}return a===void 0&&(a=setTimeout(C,e)),d}return k.cancel=S,k.flush=b,k}var na=bh;function la(t,e,o){let r=kh(6),n=Th(null),l,i;r[0]!==t||r[1]!==o||r[2]!==e?(l=()=>(n.current=na(t,e,{maxWait:o}),()=>{n.current?.cancel()}),i=[t,e,o],r[0]=t,r[1]=o,r[2]=e,r[3]=l,r[4]=i):(l=r[3],i=r[4]),_h(l,i);let s;return r[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...c)=>{let d=c;n.current&&n.current(...d)},r[5]=s):s=r[5],s}var ua=20;function Bh({anchorElem:t}){let[e]=da(),o=j(),[r,n]=So(!1),[l,i]=So(!1),[s,u]=So(!1),[c,d]=So({}),a=ca(new Set),m=ca(null),p=la(g=>{let{isOutside:C,tableDOMNode:_}=jh(g,o.editorConfig?.lexical);if(C){n(!1),i(!1);return}if(!_)return;m.current=_;let S=null,b=null,k=null;if(e.getEditorState().read(()=>{let I=sa(_);if(vh(I)){let A=Ah(I,R=>ia(R));if(!ia(A))return;if(k=Mh(A,e.getElementByKey(A.getKey())),k){let R=A.getChildrenSize(),F=A.getChildAtIndex(0)?.getChildrenSize(),W=yh(I),q=Lh(I);W===R-1?S=I:q===F-1&&(b=I)}}},{editor:e}),!k)return;let x=k.parentElement;if(!x)return;let{bottom:w,height:T,left:y,right:$,width:v,y:N}=k.getBoundingClientRect(),E=!1;x&&x.classList.contains("LexicalEditorTheme__tableScrollableWrapper")&&(E=x.scrollWidth>x.clientWidth);let{left:L,y:D}=t.getBoundingClientRect();S?(i(!1),n(!0),d({height:ua,left:E&&x?x.offsetLeft:y-L,top:w-D+5,width:E&&x?x.offsetWidth:v})):b&&(i(!0),n(!1),d({height:T,left:$-L+5,top:N-D,width:ua}))},50,250),f=Fh(()=>new ResizeObserver(()=>{n(!1),i(!1)}),[]);aa(()=>{if(s)return document.addEventListener("mousemove",p),()=>{n(!1),i(!1),document.removeEventListener("mousemove",p)}},[s,p]),aa(()=>Oh(e.registerMutationListener(Dh,g=>{e.getEditorState().read(()=>{let C=!1;for(let[_,S]of g)switch(S){case"created":{a.current.add(_),C=!0;break}case"destroyed":{a.current.delete(_),C=!0;break}default:break}if(C){f.disconnect();for(let _ of a.current){let{tableElement:S}=Nh(_);f.observe(S)}u(a.current.size>0)}},{editor:e})},{skipInitialization:!1})),[e,f]);let h=g=>{e.update(()=>{m.current&&(sa(m.current)?.selectEnd(),g?(Ih(),n(!1)):(Rh(),i(!1)))})};return e?.isEditable()?Eh(Sh,{children:[r&&$r("button",{"aria-label":"Add Row",className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...c},type:"button"}),l&&$r("button",{"aria-label":"Add Column",className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...c},type:"button"})]}):null}function jh(t,e){let o=t.target;if($h(o)){let r=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(r||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:r}}else return{isOutside:!0,tableDOMNode:null}}function ma(t){let e=wh(2),{anchorElem:o}=t,r=o===void 0?document.body:o,[n]=da();if(!n?.isEditable())return null;let l;return e[0]!==r?(l=Ph($r(Bh,{anchorElem:r}),r),e[0]=r,e[1]=l):l=e[1],l}import{c as Hh}from"react/compiler-runtime";import{jsx as Fr,jsxs as Uh}from"react/jsx-runtime";import{useLexicalComposerContext as Wh}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Gh}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Vh,TableCellNode as Kh,TableNode as Jh,TableRowNode as Xh}from"@lexical/table";import{mergeRegister as zh}from"@lexical/utils";import{formatDrawerSlug as Zh,useEditDepth as Yh}from"@payloadcms/ui";import{$getSelection as qh,$isRangeSelection as Qh,COMMAND_PRIORITY_EDITOR as eg,createCommand as tg}from"lexical";import{createContext as og,use as rg,useEffect as ng,useMemo as lg,useState as ig}from"react";import*as pa from"react";var No=tg("OPEN_EMBED_DRAWER_COMMAND"),fa=og({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function ha({children:t}){let[e,o]=ig({cellEditorConfig:null,cellEditorPlugins:null});return Fr(fa,{value:lg(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(r,n)=>{o({cellEditorConfig:r,cellEditorPlugins:n})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ga=()=>{let t=Hh(16),[e]=Wh(),o=rg(fa),r=Yh(),{fieldProps:n,uuid:l}=j(),{schemaPath:i}=n,s="lexical-table-create-"+l,u;t[0]!==r||t[1]!==s?(u=Zh({slug:s,depth:r}),t[0]=r,t[1]=s,t[2]=u):u=t[2];let c=u,{toggleDrawer:d}=pe(c,!0),a;t[3]!==e||t[4]!==d?(a=()=>{if(!e.hasNodes([Jh,Xh,Kh]))throw new Error("TablePlugin: TableNode, TableRowNode, or TableCellNode is not registered on editor");return zh(e.registerCommand(No,()=>{let h=null;return e.getEditorState().read(()=>{let g=qh();Qh(g)&&(h=g)}),h&&d(),!0},eg))},t[3]=e,t[4]=d,t[5]=a):a=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==d?(m=[o,e,d],t[6]=o,t[7]=e,t[8]=d,t[9]=m):m=t[9],ng(a,m);let p;t[10]!==e?(p=(h,g)=>{!g.columns||!g.rows||e.dispatchCommand(Vh,{columns:String(g.columns),rows:String(g.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==c||t[13]!==i||t[14]!==p?(f=Uh(pa.Fragment,{children:[Fr(ct,{drawerSlug:c,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:i,schemaPathSuffix:"fields"}),Fr(Gh,{hasCellBackgroundColor:!1,hasCellMerge:!0,hasHorizontalScroll:!0})]}),t[12]=c,t[13]=i,t[14]=p,t[15]=f):f=t[15],f};var ug=M({markdownTransformers:[Hs],nodes:[ag,sg,cg],plugins:[{Component:ga,position:"normal"},{Component:ra,position:"normal"},{Component:Zs,position:"floatingAnchorElem"},{Component:ma,position:"floatingAnchorElem"}],providers:[ha],slashMenu:{groups:[Z([{Icon:Sr,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(No,{})}}])]},toolbarFixed:{groups:[he([{ChildComponent:Sr,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(No,{})}}])]}});import{$isNodeSelection as zg}from"lexical";import{jsx as Pr,jsxs as dg}from"react/jsx-runtime";import"react";var Br=()=>dg("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Pr("path",{d:"M14.6667 4H5.33333C4.59695 4 4 4.59695 4 5.33333V14.6667C4 15.403 4.59695 16 5.33333 16H14.6667C15.403 16 16 15.403 16 14.6667V5.33333C16 4.59695 15.403 4 14.6667 4Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Pr("path",{d:"M7.99984 9.33366C8.73622 9.33366 9.33317 8.73671 9.33317 8.00033C9.33317 7.26395 8.73622 6.66699 7.99984 6.66699C7.26346 6.66699 6.6665 7.26395 6.6665 8.00033C6.6665 8.73671 7.26346 9.33366 7.99984 9.33366Z",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"}),Pr("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{jsx as _a}from"react/jsx-runtime";import Ta from"bson-objectid";import{$applyNodeReplacement as gg}from"lexical";import*as wa from"react";import mg from"bson-objectid";function Lo(t,e){if(t.hasAttribute("data-lexical-pending-upload-form-id")){let r=t.getAttribute("data-lexical-pending-upload-form-id");if(r!=null)return{node:e({data:{pending:{formID:r,src:t.getAttribute("src")||""}}})}}if(t.hasAttribute("data-lexical-upload-relation-to")&&t.hasAttribute("data-lexical-upload-id")){let r=t.getAttribute("data-lexical-upload-id"),n=t.getAttribute("data-lexical-upload-relation-to");if(r!=null&&n!=null)return{node:e({data:{fields:{},relationTo:n,value:r}})}}return{node:e({data:{pending:{formID:new mg.default().toHexString(),src:t.getAttribute("src")||""}}})}}import{DecoratorBlockNode as pg}from"@lexical/react/LexicalDecoratorBlockNode.js";import Ca from"bson-objectid";import{$applyNodeReplacement as fg}from"lexical";var Ot=class extends pg{__data;constructor({data:e,format:o,key:r}){super(o,r),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=>Lo(o,xa),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Ca.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=xa({data:o});return r.setFormat(e.format),r}static isInline(){return!1}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 xa({data:t}){return t?.id||(t.id=new Ca.default().toHexString()),fg(new Ot({data:t}))}import{jsx as ba}from"react/jsx-runtime";import{ShimmerEffect as hg}from"@payloadcms/ui";var ka=()=>ba("div",{className:"lexical-upload",children:ba(hg,{height:"95px",width:"203px"})});var xg=wa.lazy(()=>import("./component-VDJI45F2.js").then(t=>({default:t.UploadComponent}))),ne=class extends Ot{static clone(e){return super.clone(e)}static getType(){return super.getType()}static importDOM(){return{img:e=>({conversion:o=>Lo(o,Ie),priority:0})}}static importJSON(e){e.version===1&&e?.value?.id&&(e.value=e.value.id),e.version===2&&!e?.id&&(e.id=new Ta.default().toHexString(),e.version=3);let o={id:e.id,fields:e.fields,pending:e.pending,relationTo:e.relationTo,value:e.value},r=Ie({data:o});return r.setFormat(e.format),r}decorate(){return this.__data.pending?_a(ka,{}):_a(xg,{data:this.__data,format:this.__format,nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function Ie({data:t}){return t?.id||(t.id=new Ta.default().toHexString()),gg(new ne({data:t}))}function nt(t){return t instanceof ne}import{c as Sg}from"react/compiler-runtime";import{jsx as Ng}from"react/jsx-runtime";import{useLexicalComposerContext as Lg}from"@lexical/react/LexicalComposerContext.js";import{$dfsIterator as Aa,$insertNodeToNearestRoot as Ur,mergeRegister as yg}from"@lexical/utils";import{useBulkUpload as Rg,useConfig as Ig,useEffectEvent as vg,useModal as Mg}from"@payloadcms/ui";import Wr from"bson-objectid";import{$createRangeSelection as Dg,$getPreviousSelection as Ra,$getSelection as Ia,$isParagraphNode as Gr,$isRangeSelection as va,$setSelection as Ag,COMMAND_PRIORITY_EDITOR as Og,COMMAND_PRIORITY_LOW as Ma,createCommand as $g,DROP_COMMAND as Fg,getDOMSelectionFromTarget as Pg,isHTMLElement as Da,PASTE_COMMAND as Bg}from"lexical";import{useEffect as jg}from"react";import{c as Ea}from"react/compiler-runtime";import{jsx as jr}from"react/jsx-runtime";import{useLexicalComposerContext as Sa}from"@lexical/react/LexicalComposerContext.js";import{toast as Cg}from"@payloadcms/ui";import{$getNodeByKey as bg,COMMAND_PRIORITY_EDITOR as Na}from"lexical";import{useEffect as La,useState as kg}from"react";var _g=({editor:t,relationTo:e,replaceNodeKey:o,value:r})=>{o?t.update(()=>{let n=bg(o);n&&n.replace(Ie({data:{fields:null,relationTo:e,value:r}}))}):t.dispatchCommand(Hr,{fields:null,relationTo:e,value:r})},Tg=t=>{let e=Ea(13),{enabledCollectionSlugs:o}=t,[r]=Sa(),[n,l]=kg(null),i;e[0]!==o?(i={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=i):i=e[1];let{closeListDrawer:s,ListDrawer:u,openListDrawer:c}=It(i),d,a;e[2]!==r||e[3]!==c?(d=()=>r.registerCommand(Ge,h=>(l(h?.replace?h?.replace.nodeKey:null),c(),!0),Na),a=[r,c],e[2]=r,e[3]=c,e[4]=d,e[5]=a):(d=e[4],a=e[5]),La(d,a);let m;e[6]!==s||e[7]!==r||e[8]!==n?(m=h=>{let{collectionSlug:g,doc:C}=h;s(),_g({editor:r,relationTo:g,replaceNodeKey:n,value:C.id})},e[6]=s,e[7]=r,e[8]=n,e[9]=m):m=e[9];let p=m,f;return e[10]!==u||e[11]!==p?(f=jr(u,{onSelect:p}),e[10]=u,e[11]=p,e[12]=f):f=e[12],f},wg=()=>{let t=Ea(3),[e]=Sa(),o,r;return t[0]!==e?(o=()=>e.registerCommand(Ge,Eg,Na),r=[e],t[0]=e,t[1]=o,t[2]=r):(o=t[1],r=t[2]),La(o,r),null},ya=t=>jr(Ut,{...t,FallbackComponent:wg,uploads:!0,children:jr(Tg,{...t})});function Eg(){return Cg.error("No upload collections enabled"),!0}function Hg(t){let e=t.target;return!!(Da(e)&&!e.closest("code, span.editor-image")&&Da(e.parentElement)&&e.parentElement.closest("div.ContentEditable__root"))}function Ug(t){let e,o=Pg(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 Hr=$g("INSERT_UPLOAD_COMMAND"),Oa=()=>{let t=Sg(18),[e]=Lg(),{config:o}=Ig(),{collections:r}=o,{drawerSlug:n,setCollectionSlug:l,setInitialForms:i,setOnCancel:s,setOnSuccess:u,setSelectableCollections:c}=Rg(),{isModalOpen:d,openModal:a}=Mg(),m;t[0]!==n||t[1]!==r||t[2]!==e||t[3]!==d||t[4]!==a||t[5]!==l||t[6]!==i||t[7]!==s||t[8]!==u||t[9]!==c?(m=C=>{let{files:_}=C;if(_?.length!==0&&(i(S=>[...S??[],..._.map(Wg)]),!d(n))){let S=r.filter(Gg).map(Vg);if(!S.length||!S[0])return;l(S[0]),c(S),s(()=>{e.update(Kg)}),u(b=>{let k=new Map(b.map(Jg));e.update(()=>{for(let x of Aa()){let w=x.node;if(nt(w)){let T=w.getData();if(T?.pending){let y=k.get(T.pending?.formID);y&&w.replace(Ie({data:{id:new Wr.default().toHexString(),fields:{},relationTo:y.collectionSlug,value:y.doc.id}}))}}}})}),a(n)}},t[0]=n,t[1]=r,t[2]=e,t[3]=d,t[4]=a,t[5]=l,t[6]=i,t[7]=s,t[8]=u,t[9]=c,t[10]=m):m=t[10];let p=vg(m),f;t[11]!==e||t[12]!==p?(f=()=>{if(!e.hasNodes([ne]))throw new Error("UploadPlugin: UploadNode not registered on editor");return yg(e.registerNodeTransform(ne,C=>{let _=C.getData();if(!_?.pending)return;(async function(){let k=null,x=_?.pending?.src,w=_?.pending?.formID;if(x?.startsWith("data:")){let T=x.match(/data:(image\/[a-zA-Z]+);base64,/),y=T?T[1]:"image/png",$=x.replace(/^data:image\/[a-zA-Z]+;base64,/,""),v=atob($),N=new Array(v.length);for(let D=0;D<v.length;D++)N[D]=v.charCodeAt(D);let E=new Uint8Array(N);k={alt:void 0,file:new File([E],"pasted-image."+y?.split("/")[1],{type:y}),formID:w}}else if(x?.startsWith("http")||x?.startsWith("https")){let y=await(await fetch(x)).blob(),$=x.split("/").pop()||"pasted-image"+y.type.split("/")[1];k={alt:void 0,file:new File([y],$,{type:y.type}),formID:w}}k&&p({files:[k]})})()}),e.registerCommand(Hr,C=>(e.update(()=>{let _=Ia()||Ra();if(va(_)){let S=Ie({data:{id:C.id,fields:C.fields,relationTo:C.relationTo,value:C.value}}),{focus:b}=_,k=b.getNode();Ur(S),Gr(k)&&!k.__first&&k.remove()}}),!0),Og),e.registerCommand(Bg,C=>{if(!(C instanceof ClipboardEvent))return!1;let _=C.clipboardData;if(!_?.types?.length||_?.types?.includes("text/html"))return!1;let S=[];return _?.files?.length&&Array.from(_.files).forEach(b=>{S.push({alt:"",file:b,formID:new Wr.default().toHexString()})}),S.length?(e.update(()=>{let b=Ia()||Ra();if(va(b))for(let k of S){let x=new ne({data:{pending:{formID:k.formID,src:URL.createObjectURL(k.file)}}}),{focus:w}=b,T=w.getNode();Ur(x),Gr(T)&&!T.__first&&T.remove()}}),p({files:S}),!0):!1},Ma),e.registerCommand(Fg,C=>{if(!(C instanceof DragEvent))return!1;let _=C.dataTransfer;if(!_?.types?.length)return!1;let S=[];return _?.files?.length&&Array.from(_.files).forEach(b=>{S.push({alt:"",file:b,formID:new Wr.default().toHexString()})}),S.length?(C.preventDefault(),C.stopPropagation(),e.update(()=>{if(Hg(C)){let b=Ug(C),k=Dg();b!=null&&k.applyDOMRange(b),Ag(k);for(let x of S){let w=new ne({data:{pending:{formID:x.formID,src:URL.createObjectURL(x.file)}}}),{focus:T}=k,y=T.getNode();Ur(w),Gr(y)&&!y.__first&&y.remove()}}}),p({files:S}),!0):!1},Ma))},t[11]=e,t[12]=p,t[13]=f):f=t[13];let h;t[14]!==e?(h=[e],t[14]=e,t[15]=h):h=t[15],jg(f,h);let g;return t[16]!==r?(g=Ng(ya,{enabledCollectionSlugs:r.map(Xg)}),t[16]=r,t[17]=g):g=t[17],g};function Wg(t){return{file:t.file,formID:t.formID}}function Gg(t){let{upload:e}=t;return!!e}function Vg(t){let{slug:e}=t;return e}function Kg(){for(let t of Aa()){let e=t.node;nt(e)&&e.getData()?.pending&&e.remove()}}function Jg(t){return[t.formID,t]}function Xg(t){let{slug:e}=t;return e}var Zg=M({nodes:[ne],plugins:[{Component:Oa,position:"normal"}],slashMenu:{groups:[Z([{Icon:Br,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]},toolbarFixed:{groups:[he([{ChildComponent:Br,isActive:({selection:t})=>{if(!zg(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return nt(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(Ge,{replace:!1})}}])]}});import{c as qg}from"react/compiler-runtime";import{jsx as Kr}from"react/jsx-runtime";import{ShimmerEffect as Qg,useConfig as ex}from"@payloadcms/ui";import{lazy as tx,Suspense as ox,useEffect as rx,useState as nx}from"react";var $a={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",hrSelected:"LexicalEditorTheme__hrSelected",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",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:"editor-upload"};var yo={namespace:"lexical",theme:$a};function Fa({config:t,featureClientImportMap:e,featureClientSchemaMap:o,field:r,schemaPath:n,unSanitizedEditorConfig:l}){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.");l.features=l.features.sort((c,d)=>c.clientFeatureProps.order-d.clientFeatureProps.order);let i=new Map;for(let c of l.features)i.set(c.clientFeatureProps.featureKey,c);let s=new Map,u=0;for(let c of l.features){let d=typeof c.feature=="function"?c.feature({config:t,featureClientImportMap:e,featureClientSchemaMap:o,featureProviderMap:i,field:r,resolvedFeatures:s,schemaPath:n,unSanitizedEditorConfig:l}):c.feature;d.key=c.clientFeatureProps.featureKey,d.order=u,s.set(c.clientFeatureProps.featureKey,d),u++}return s}import{deepMerge as Yg}from"payload/shared";var Pa=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}},o={};if(t.forEach(r=>{r.key==="toolbarFixed"&&r.sanitizedClientFeatureProps?.customGroups&&(o={...o,...r.sanitizedClientFeatureProps.customGroups})}),!t?.size)return e;t.forEach(r=>{if(r.providers?.length&&(e.providers=e.providers.concat(r.providers)),r.enableFormats?.length&&e.enabledFormats.push(...r.enableFormats),r.nodes?.length)for(let n of r.nodes)e.nodes.push(n);if(r.plugins?.length&&r.plugins.forEach((n,l)=>{e.plugins?.push({clientProps:r.sanitizedClientFeatureProps,Component:n.Component,key:r.key+l,position:n.position})}),r.toolbarInline?.groups?.length)for(let n of r.toolbarInline.groups){let l=e.toolbarInline.groups.find(i=>i.key===n.key);l?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarInline?.groups.push(l)}if(r.toolbarFixed?.groups?.length)for(let n of r.toolbarFixed.groups){let l=e.toolbarFixed.groups.find(i=>i.key===n.key);l?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.toolbarFixed?.groups.push(l)}if(r.slashMenu?.groups){r.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(r.slashMenu.dynamicGroups));for(let n of r.slashMenu.groups){let l=e.slashMenu.groups.find(i=>i.key===n.key);l?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):l={...n,items:[]},n?.items?.length&&(l.items=l.items.concat(n.items)),e.slashMenu.groups.push(l)}}if(r.markdownTransformers?.length)for(let n of r.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(r.key)}),Object.keys(o).length>0&&(e.toolbarFixed.groups=e.toolbarFixed.groups.map(r=>{let n=o[r.key];return n?Yg(r,n):r})),e.toolbarInline.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((r,n)=>r.order&&n.order?r.order-n.order:r.order?-1:n.order?1:0);for(let r of e.toolbarInline.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);for(let r of e.toolbarFixed.groups)r.items.sort((n,l)=>n.order&&l.order?n.order-l.order:n.order?-1:l.order?1:0);return e};function Vr(t,e,o){return{admin:o,features:Pa(t),lexical:e,resolvedFeatureMap:t}}var lx=tx(()=>import("./Field-BJACUMFU.js").then(t=>({default:t.RichText}))),ix=t=>{let e=qg(16),{admin:o,clientFeatures:r,featureClientImportMap:n,featureClientSchemaMap:l,field:i,lexicalEditorConfig:s,schemaPath:u}=t,c;e[0]!==o?(c=o===void 0?{}:o,e[0]=o,e[1]=c):c=e[1];let d=c,a=s===void 0?yo:s,{config:m}=ex(),[p,f]=nx(null),h,g;e[2]!==d||e[3]!==r||e[4]!==m||e[5]!==n||e[6]!==l||e[7]!==i||e[8]!==p||e[9]!==a||e[10]!==u?(h=()=>{if(p)return;let _=[];for(let[k,x]of Object.entries(r))x.clientFeatureProvider&&_.push(x.clientFeatureProvider(x.clientFeatureProps));let S=a||yo,b=Fa({config:m,featureClientImportMap:n,featureClientSchemaMap:l,field:i,schemaPath:u??i.name,unSanitizedEditorConfig:{features:_,lexical:S}});f(Vr(b,S,d))},g=[a,d,p,r,n,l,i,m,u],e[2]=d,e[3]=r,e[4]=m,e[5]=n,e[6]=l,e[7]=i,e[8]=p,e[9]=a,e[10]=u,e[11]=h,e[12]=g):(h=e[11],g=e[12]),rx(h,g);let C;return e[13]!==p||e[14]!==t?(C=Kr(ox,{fallback:Kr(Qg,{height:"35vh"}),children:p&&Kr(lx,{...t,editorConfig:p})}),e[13]=p,e[14]=t,e[15]=C):C=e[15],C};function sx(t){return t instanceof HTMLElement}function ax(...t){return t.filter(Boolean).join(" ")}var Ro=new WeakMap;function Ba(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function Io(t,e){let o=Ro.get(t);if(o===void 0){let r=new Set,n=i=>{o!==void 0&&(o.start=Ba(i))},l=i=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let u=Ba(i);for(let c of r)u!==null&&c([u[0]-s[0],u[1]-s[1]],i)};t.addEventListener("touchstart",n),t.addEventListener("touchend",l),o={handleTouchend:l,handleTouchstart:n,listeners:r,start:null},Ro.set(t,o)}return o.listeners.add(e),()=>{cx(t,e)}}function cx(t,e){let o=Ro.get(t);if(o===void 0)return;let{listeners:r}=o;r.delete(e),r.size===0&&(Ro.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function ux(t,e){return Io(t,(o,r)=>{let[n,l]=o;n<0&&-n>Math.abs(l)&&e(n,r)})}function dx(t,e){return Io(t,(o,r)=>{let[n,l]=o;n>0&&n>Math.abs(l)&&e(n,r)})}function mx(t,e){return Io(t,(o,r)=>{let[n,l]=o;l<0&&-l>Math.abs(n)&&e(n,r)})}function px(t,e){return Io(t,(o,r)=>{let[n,l]=o;l>0&&l>Math.abs(n)&&e(n,r)})}import{c as fx}from"react/compiler-runtime";import{jsx as hx}from"react/jsx-runtime";import"react";var gx=()=>{let t=fx(2),{EditButton:e}=fe(),o;return t[0]!==e?(o=e?hx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as xx}from"react/compiler-runtime";import{jsx as Cx}from"react/jsx-runtime";import"react";var bx=()=>{let t=xx(2),{RemoveButton:e}=fe(),o;return t[0]!==e?(o=e?Cx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as kx}from"react/compiler-runtime";import{jsx as _x}from"react/jsx-runtime";import"react";var Tx=()=>{let t=kx(2),{Label:e}=fe(),o;return t[0]!==e?(o=e?_x(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as wx}from"react/compiler-runtime";import{jsx as Ex}from"react/jsx-runtime";import"react";var Sx=t=>{let e=wx(3),{children:o}=t,{InlineBlockContainer:r}=fe(),n;return e[0]!==r||e[1]!==o?(n=r?Ex(r,{children:o}):null,e[0]=r,e[1]=o,e[2]=n):n=e[2],n};import{c as Nx}from"react/compiler-runtime";import{jsx as Lx}from"react/jsx-runtime";import"react";var yx=t=>{let e=Nx(6),{children:o,editButton:r,Label:n,removeButton:l}=t,{BlockCollapsible:i}=ve(),s;return e[0]!==i||e[1]!==n||e[2]!==o||e[3]!==r||e[4]!==l?(s=i?Lx(i,{editButton:r,Label:n,removeButton:l,children:o}):null,e[0]=i,e[1]=n,e[2]=o,e[3]=r,e[4]=l,e[5]=s):s=e[5],s};import{c as Rx}from"react/compiler-runtime";import{jsx as Ix}from"react/jsx-runtime";import"react";var vx=()=>{let t=Rx(2),{EditButton:e}=ve(),o;return t[0]!==e?(o=e?Ix(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Mx}from"react/compiler-runtime";import{jsx as Dx}from"react/jsx-runtime";import"react";var Ax=()=>{let t=Mx(2),{RemoveButton:e}=ve(),o;return t[0]!==e?(o=e?Dx(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{stringify as Ox}from"qs-esm";var $x=({apiURL:t,depth:e,draft:o,locale:r})=>async({id:l,collectionSlug:i,select:s})=>{let u=Ox({depth:e??0,draft:o??!1,locale:r,select:s},{addQueryPrefix:!0});return await fetch(`${t}/${i}/${l}${u}`,{credentials:"include",headers:{Accept:"application/json","Content-Type":"application/json"},method:"GET"}).then(d=>d.json())};var ja={customEndRegex:{optional:!0,regExp:/[ \t]*```$/},customStartRegex:/^[ \t]*```(\w+)?/,doNotTrimChildren:!0,export:({fields:t})=>!t.code.includes(`
|
|
61
|
+
`)&&!t.language?.length?"```"+t.code+"```":"```"+(t.language||"")+(t.code?`
|
|
62
|
+
`+t.code:"")+"\n```",import:({children:t,closeMatch:e,openMatch:o})=>{let r=o?.[1];return t.startsWith(`
|
|
63
|
+
`)&&(t=t.slice(1)),t.endsWith(`
|
|
64
|
+
`)&&(t=t.slice(0,-1)),!!e&&!t.includes(`
|
|
65
|
+
`)&&o?.input?.trim()!=="```"+r?{code:r+(t?.length?t:""),language:""}:{code:t,language:r}}};import{jsx as Fx}from"react/jsx-runtime";import{CodeField as Px,useFormFields as Bx}from"@payloadcms/ui";import{useMemo as jx}from"react";var Hx=({autoComplete:t,field:e,forceRender:o,languages:r={js:"JavaScript",plaintext:"Plain Text",ts:"TypeScript"},path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:u,typescript:c,validate:d})=>{let a=Bx(([g])=>g.language),m=a?.value||a?.initialValue||"typescript",p=r[m],f=jx(()=>({...e,type:"code",admin:{...e.admin,editorOptions:{},language:m}}),[e,m]),h=`${e.name}-${m}-${p}`;return f&&Fx(Px,{autoComplete:t,field:f,forceRender:o,onMount:(g,C)=>{C.languages.typescript.typescriptDefaults.setCompilerOptions({allowNonTsExtensions:!0,moduleResolution:C.languages.typescript.ModuleResolutionKind.NodeJs,paths:c?.paths,target:C.languages.typescript.ScriptTarget[c?.target??"ESNext"],typeRoots:c?.typeRoots??["node_modules/@types"]}),(async()=>{c?.fetchTypes&&Array.isArray(c.fetchTypes)&&c.fetchTypes.length>0&&await Promise.all(c.fetchTypes.map(async S=>{let k=await(await fetch(S.url)).text();C.languages.typescript.typescriptDefaults.addExtraLib(k,S.filePath)}))})()},path:n,permissions:l,readOnly:i,renderedBlocks:s,schemaPath:u,validate:d},h)};import{c as Ux}from"react/compiler-runtime";import{jsx as lt}from"react/jsx-runtime";import{FieldContext as Wx,FieldPathContext as Ha,ServerFunctionsContext as Ua,ShimmerEffect as Gx,useServerFunctions as Vx}from"@payloadcms/ui";import Kx,{useEffect as Jx,useRef as Xx}from"react";var zx=t=>{let e=Ux(9),{field:o,initialValue:r,Loading:n,path:l,schemaPath:i,setValue:s,value:u}=t,[c,d]=Kx.useState(null),a=Vx(),{_internal_renderField:m}=a,[p,f]=i.split("."),h=l??(o&&"name"in o?o?.name:"")??"",g;e[0]!==m||e[1]!==o||e[2]!==r||e[3]!==l||e[4]!==i?(g=()=>{(async function(){let{Field:y}=await m({field:{...o||{},type:"richText",admin:{hidden:!1}},initialValue:r??void 0,path:l,schemaPath:i});d(y)})()},e[0]=m,e[1]=o,e[2]=r,e[3]=l,e[4]=i,e[5]=g):g=e[5];let C=g,_=Xx(!1),S,b;if(e[6]!==C?(S=()=>{_.current||(_.current=!0,C())},b=[C],e[6]=C,e[7]=S,e[8]=b):(S=e[7],b=e[8]),Jx(S,b),!c)return typeof n<"u"?n:lt(Gx,{});let k={...a,getFormState:async w=>a.getFormState({...w,collectionSlug:p==="collection"?f:void 0,globalSlug:p==="global"?f:void 0})};if(typeof u>"u"&&!s)return lt(Ua,{value:{...k},children:lt(Ha,{value:h,children:c},h)});let x={disabled:!1,formInitializing:!1,formProcessing:!1,formSubmitted:!1,initialValue:u,path:h,setValue:s??Zx,showError:!1,value:u};return lt(Ua,{value:{...k},children:lt(Ha,{value:h,children:lt(Wx,{value:x,children:c})},h)})};function Zx(){}function Yx({nodes:t,text:e}){let o={root:{type:"root",children:[],direction:"ltr",format:"",indent:0,version:1}};return e&&o.root.children.push({type:"paragraph",children:[{type:"text",detail:0,format:0,mode:"normal",style:"",text:e,version:1}],direction:"ltr",format:"",indent:0,textFormat:0,textStyle:"",version:1}),t?.length&&o.root.children.push(...t),o}export{kt as $createAutoLinkNode,De as $createBlockNode,st as $createInlineBlockNode,ge as $createLinkNode,Be as $createRelationshipNode,Ie as $createUploadNode,Ce as $isAutoLinkNode,Me as $isBlockNode,at as $isInlineBlockNode,J as $isLinkNode,br as $isRelationshipNode,nt as $isUploadNode,tc as AlignFeatureClient,xe as AutoLinkNode,yx as BlockCollapsible,vx as BlockEditButton,ie as BlockNode,Ax as BlockRemoveButton,ic as BlockquoteFeatureClient,mu as BlocksFeatureClient,Ou as BoldFeatureClient,re as CAN_USE_DOM,Pp as ChecklistFeatureClient,Hx as CodeComponent,Rf as DETAIL_TYPE_TO_DETAIL,Sf as DOUBLE_LINE_BREAK,jf as DebugJsxConverterFeatureClient,vf as ELEMENT_FORMAT_TO_TYPE,If as ELEMENT_TYPE_TO_FORMAT,Xa as ENABLE_SLASH_MENU_COMMAND,Ga as EditorConfigProvider,ct as FieldsDrawer,a1 as FixedToolbarFeatureClient,Id as HeadingFeatureClient,Xd as HorizontalRuleFeatureClient,Ve as INSERT_BLOCK_COMMAND,Ke as INSERT_INLINE_BLOCK_COMMAND,wf as IS_ALL_FORMATTING,um as IndentFeatureClient,Sx as InlineBlockContainer,gx as InlineBlockEditButton,Tx as InlineBlockLabel,it as InlineBlockNode,bx as InlineBlockRemoveButton,ju as InlineCodeFeatureClient,b1 as InlineToolbarFeatureClient,Gu as ItalicFeatureClient,Lf as LTR_REGEX,sf as LexicalPluginToLexicalFeatureClient,wp as LinkFeatureClient,ee as LinkNode,Ef as NON_BREAKING_SPACE,O as NodeFormat,Kp as OrderedListFeatureClient,hf as ParagraphFeatureClient,Ka as Point,Nf as RTL_REGEX,za as Rect,N0 as RelationshipFeatureClient,ke as RelationshipNode,zx as RenderLexical,ix as RichTextField,pf as SlateToLexicalFeatureClient,zu as StrikethroughFeatureClient,Qu as SubscriptFeatureClient,rd as SuperscriptFeatureClient,Mf as TEXT_MODE_TO_TYPE,yf as TEXT_TYPE_TO_FORMAT,Df as TEXT_TYPE_TO_MODE,ue as TOGGLE_LINK_COMMAND,ug as TableFeatureClient,Nu as TestRecorderFeatureClient,bd as TextStateFeatureClient,vt as ToolbarButton,je as ToolbarDropdown,vu as TreeViewFeatureClient,ad as UnderlineFeatureClient,ef as UnorderedListFeatureClient,Zg as UploadFeatureClient,ne as UploadNode,px as addSwipeDownListener,ux as addSwipeLeftListener,dx as addSwipeRightListener,mx as addSwipeUpListener,Yx as buildEditorState,ja as codeConverterClient,Yo as createBlockNode,M as createClientFeature,Hf as defaultColors,yo as defaultEditorLexicalConfig,Er as getDOMRangeRect,Za as getEnabledNodes,$x as getRestPopulateFn,Je as getSelectedNode,sx as isHTMLElement,Ja as isPoint,ax as joinClasses,Vr as sanitizeClientEditorConfig,Pa as sanitizeClientFeatures,xo as setFloatingElemPosition,uo as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,he as toolbarAddDropdownGroupWithItems,Qo as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,Q as toolbarTextDropdownGroupWithItems,ve as useBlockComponentContext,j as useEditorConfigContext,fe as useInlineBlockComponentContext,Va as useLexicalDocumentDrawer,pe as useLexicalDrawer,It as useLexicalListDrawer};
|
|
41
66
|
//# sourceMappingURL=index.js.map
|