@payloadcms/richtext-lexical 3.12.0 → 3.12.1-canary.b1b1cbf
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.
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
"use client";import{a as ue,c as ro,d as no,e as io}from"./chunk-4J2ONJMB.js";import{a as Be,b as gt,c as Ct,d as xt}from"./chunk-AXXPUMFU.js";import{a as je,b as Ge,c as Ue,d as lo}from"./chunk-PGMIO4IN.js";import{a as He,b as bt,c as We,d as Ve,e as Ke,f as so}from"./chunk-H3D3IU3G.js";import{a as ce}from"./chunk-INBEEENE.js";import{a as
|
|
1
|
+
"use client";import{a as ue,c as ro,d as no,e as io}from"./chunk-4J2ONJMB.js";import{a as Be,b as gt,c as Ct,d as xt}from"./chunk-AXXPUMFU.js";import{a as je,b as Ge,c as Ue,d as lo}from"./chunk-PGMIO4IN.js";import{a as He,b as bt,c as We,d as Ve,e as Ke,f as so}from"./chunk-H3D3IU3G.js";import{a as ce}from"./chunk-INBEEENE.js";import{a as ms}from"./chunk-F26IQ5RE.js";import{a as ds,b as mr,d as pr,e as fr,f as hr,g as ps,h as fs,i as hs,k as gs,m as Cs,n as xs}from"./chunk-XOABLBHB.js";import{a as us,b as B}from"./chunk-CUIBIFW2.js";function Z(t){return{items:t,key:"basic",label:({i18n:e})=>e.t("lexical:general:slashMenuBasicGroupLabel")}}import{$isElementNode as _e,$isRangeSelection as Tt,FORMAT_ELEMENT_COMMAND as Et}from"lexical";import{jsx as ao,jsxs as bs}from"react/jsx-runtime";import"react";var gr=()=>bs("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[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:"M5 15H15",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as co,jsxs as _s}from"react/jsx-runtime";import"react";var Cr=()=>_s("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[co("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),co("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as uo,jsxs as Ts}from"react/jsx-runtime";import"react";var _t=()=>Ts("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[uo("path",{d:"M2.5 5H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 10H17.5",stroke:"currentColor",strokeWidth:"1.5"}),uo("path",{d:"M2.5 15H12.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as mo,jsxs as Es}from"react/jsx-runtime";import"react";var xr=()=>Es("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[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:"M7.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"})]});var y=t=>o=>{let n={clientFeatureProps:o};if(typeof t=="function")n.feature=({featureClientSchemaMap:r,featureProviderMap:i,field:l,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:u})=>{let c=t({featureClientSchemaMap:r,featureProviderMap:i,field:l,props:o,resolvedFeatures:s,schemaPath:a,unSanitizedEditorConfig:u});return c.sanitizedClientFeatureProps===null&&(c.sanitizedClientFeatureProps=o),c};else{let r={...t};r.sanitizedClientFeatureProps=o,n.feature=r}return n};var br=t=>({type:"dropdown",ChildComponent:_t,items:t,key:"align",order:30});var _r=[br([{ChildComponent:_t,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="left")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="left"))return!1}return!0},key:"alignLeft",label:({i18n:t})=>t.t("lexical:align:alignLeftLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"left")},order:1},{ChildComponent:gr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="center")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="center"))return!1}return!0},key:"alignCenter",label:({i18n:t})=>t.t("lexical:align:alignCenterLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"center")},order:2},{ChildComponent:xr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="right")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="right"))return!1}return!0},key:"alignRight",label:({i18n:t})=>t.t("lexical:align:alignRightLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"right")},order:3},{ChildComponent:Cr,isActive:({selection:t})=>{if(!Tt(t))return!1;for(let e of t.getNodes()){if(_e(e)&&e.getFormatType()==="justify")continue;let o=e.getParent();if(!(_e(o)&&o.getFormatType()==="justify"))return!1}return!0},key:"alignJustify",label:({i18n:t})=>t.t("lexical:align:alignJustifyLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Et,"justify")},order:4}])],ws=y({toolbarFixed:{groups:_r},toolbarInline:{groups:_r}});import{$createQuoteNode as Rr,$isQuoteNode as Nr,QuoteNode as Rs}from"@lexical/rich-text";import{$setBlocksType as Ir}from"@lexical/selection";import{$getSelection as Sr,$isRangeSelection as Is}from"lexical";import{jsx as Tr}from"react/jsx-runtime";import"react";var po=()=>Tr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Tr("path",{d:"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 Er}from"react/jsx-runtime";import"react";var ze=()=>Er("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:Er("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:ze,items:t,key:"text",order:25});import{$createQuoteNode as ks,$isQuoteNode as wr,QuoteNode as Ns}from"@lexical/rich-text";import{$createLineBreakNode as Ls}from"lexical";var kr={type:"element",dependencies:[Ns],export:(t,e)=>{if(!wr(t))return null;let o=e(t).split(`
|
|
2
2
|
`),n=[];for(let r of o)n.push("> "+r);return n.join(`
|
|
3
|
-
`)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let i=t.getPreviousSibling();if(wr(i)){i.splice(i.getChildrenSize(),0,[Is(),...e]),i.select(0,0),t.remove();return}}let r=Ls();r.append(...e),t.replace(r),r.select(0,0)}};var Lr=[q([{ChildComponent:po,isActive:({selection:t})=>{if(!ys(t))return!1;for(let e of t.getNodes())if(!Nr(e)&&!Nr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Sr();Ir(e,()=>Rr())})},order:20}])],vs=y({markdownTransformers:[kr],nodes:[Ss],slashMenu:{groups:[Z([{Icon:po,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Sr();Ir(e,()=>Rr())})}}])]},toolbarFixed:{groups:Lr},toolbarInline:{groups:Lr}});import{getTranslation as St}from"@payloadcms/translations";import{jsx as fo,jsxs as Ms}from"react/jsx-runtime";import"react";var wt=()=>Ms("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 yr}from"react/jsx-runtime";import"react";var kt=()=>yr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yr("path",{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 aa}from"react/jsx-runtime";import ca from"bson-objectid";import"react";import{DecoratorBlockNode as Ds}from"@lexical/react/LexicalDecoratorBlockNode.js";import As from"bson-objectid";var Ze=class extends Ds{__fields;constructor({fields:e,format:o,key:n}){super(o,n),this.__fields=e}static clone(e){return new this({fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Fs(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e){let o=this.getWritable();o.__fields=e}};function Fs(t){return new Ze({fields:{...t,id:t?.id||new As.default().toHexString()}})}import{jsx as X,jsxs as Lt,Fragment as Gs}from"react/jsx-runtime";import{Button as Ar,Collapsible as Us,Drawer as Ws,EditDepthProvider as Vs,ErrorPill as Ks,Form as zs,formatDrawerSlug as Zs,FormSubmit as Xs,Pill as Ys,RenderFields as Js,SectionTitle as qs,useDocumentInfo as Fr,useEditDepth as Qs,useFormSubmitted as ea,useServerFunctions as ta,useTranslation as oa}from"@payloadcms/ui";import{abortAndIgnore as ho}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as ra,reduceFieldsToValues as Or}from"payload/shared";import Xe,{useCallback as go,useEffect as $r,useMemo as Ye,useRef as na}from"react";import{useLexicalComposerContext as ia}from"@lexical/react/LexicalComposerContext";import{getTranslation as la}from"@payloadcms/translations";import{$getNodeByKey as Co}from"lexical";import{v4 as sa}from"uuid";import{c as Os}from"react/compiler-runtime";import{jsx as Nt,jsxs as $s}from"react/jsx-runtime";import{RenderFields as Ps,useFormSubmitted as Bs}from"@payloadcms/ui";import Hs,{createContext as js}from"react";var vr=js({initialState:!1}),ke=()=>Hs.useContext(vr),Mr=t=>{let e=Os(13),{BlockDrawer:o,Collapsible:n,CustomBlock:r,EditButton:i,errorCount:l,formSchema:s,initialState:a,nodeKey:u,RemoveButton:c}=t,m=Bs()&&l>0,p,f;e[0]!==n||e[1]!==l||e[2]!==m?(f=w=>Nt(n,{editButton:w.editButton,errorCount:l,fieldHasErrors:m,Label:w.Label,removeButton:w.removeButton,children:w.children}),e[0]=n,e[1]=l,e[2]=m,e[3]=f):f=e[3],p=f;let h=p,C;return e[4]!==o||e[5]!==h||e[6]!==r||e[7]!==i||e[8]!==c||e[9]!==s||e[10]!==a||e[11]!==u?(C=r?$s(vr.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:a,nodeKey:u,RemoveButton:c},children:[r,Nt(o,{})]}):Nt(h,{children:Nt(Ps,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=r,e[7]=i,e[8]=c,e[9]=s,e[10]=a,e[11]=u,e[12]=C):C=e[12],C};function Dr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var re="lexical-block",Pr=t=>{let{formData:e,nodeKey:o}=t,n=ea(),{id:r,collectionSlug:i,globalSlug:l}=Fr(),{fieldProps:{featureClientSchemaMap:s,field:a,initialLexicalFormState:u,permissions:c,readOnly:d,schemaPath:m},uuid:p}=B(),f=na(new AbortController),h=Qs(),[C,w]=Xe.useState(0),v=Zs({slug:`lexical-blocks-create-${p}-${e.id}`,depth:h}),{toggleDrawer:D}=ce(v),{getDocPreferences:x,setDocFieldPreferences:E}=Fr(),[g]=ia(),{getFormState:_}=ta(),N=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}.fields`,[k,L]=Xe.useState(u?.[e.id]?.formState?{...u?.[e.id]?.formState,blockName:{initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName}}:!1),[I,b]=Xe.useState(k?._components?.customComponents?.BlockLabel),[T,S]=Xe.useState(k?._components?.customComponents?.Block);$r(()=>{let j=new AbortController;return e&&!k&&(async()=>{let{state:K}=await _({id:r,collectionSlug:i,data:e,docPermissions:{fields:!0},docPreferences:await x(),globalSlug:l,operation:"update",renderAllFields:!0,schemaPath:N,signal:j.signal});K&&(K.blockName={initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName},L(K),b(K._components?.customComponents?.BlockLabel),S(K._components?.customComponents?.Block))})(),()=>{ho(j)}},[_,N,r,e,k,i,l,x]);let[R,A]=Xe.useState(u?.[e.id]?.collapsed??!1),M=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}`,$=s.blocks[M][0].blocks[0],{i18n:W,t:J}=oa(),U=go(async({formState:j,submit:te})=>{ho(f.current);let K=new AbortController;f.current=K;let{state:z}=await _({id:r,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await x(),formState:j,globalSlug:l,operation:"update",renderAllFields:!!te,schemaPath:N,signal:K.signal});if(!z)return j;z.blockName=j.blockName;let oe=Or(Dr({fields:ra(z)}),!0);if(setTimeout(()=>{g.update(()=>{let be=Co(o);if(be&&Rt(be)){let we=oe;we.blockType=e.blockType,be.setFields(we)}})},0),te){b(z._components?.customComponents?.BlockLabel),S(z._components?.customComponents?.Block);let be=0;for(let we of Object.values(z))we?.valid===!1&&be++;w(be)}return z},[_,r,i,x,l,N,e.blockType,g,o]);$r(()=>()=>{ho(f.current)},[]);let H=go(()=>{g.update(()=>{Co(o)?.remove()})},[g,o]),ee=$?.labels?.singular?la($.labels.singular,W):$?.slug,pt=go(j=>{x().then(te=>{let z=te?.fields?.[a.name]?.collapsed,oe=z&&z?.length?z:[];j?oe.includes(e.id)||oe.push(e.id):oe.includes(e.id)&&oe.splice(oe.indexOf(e.id),1),E(a.name,{collapsed:oe,hello:"hi"})})},[x,a.name,E,e.id]),ie=Ye(()=>()=>X(Ar,{buttonStyle:"icon-label",className:`${re}__editButton`,disabled:d,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),D(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:J("lexical:blocks:inlineBlocks:edit",{label:ee})}),[ee,d,J,D]),ve=Ye(()=>()=>X(Ar,{buttonStyle:"icon-label",className:`${re}__removeButton`,disabled:a?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),H()},round:!0,tooltip:"Remove Block"}),[a?.admin?.readOnly,H]),ft=Ye(()=>({children:j,editButton:te,errorCount:K,fieldHasErrors:z,Label:oe,removeButton:be})=>X("div",{className:re+" "+re+"-"+e.blockType,children:X(Us,{className:[`${re}__row`,z?`${re}__row--has-errors`:`${re}__row--no-errors`].join(" "),collapsibleStyle:z?"error":"default",header:Lt("div",{className:`${re}__block-header`,children:[oe??I?oe??I:Lt("div",{children:[X(Ys,{className:`${re}__block-pill ${re}__block-pill-${e?.blockType}`,pillStyle:"white",children:ee}),X(qs,{path:"blockName",readOnly:a?.admin?.readOnly||!1}),z&&X(Ks,{count:K??0,i18n:W,withMessage:!0})]}),Lt("div",{children:[T&&te!==!1||!T&&te?X(ie,{}):null,be!==!1&&g.isEditable()?X(ve,{}):null]})]}),isCollapsed:R,onToggle:we=>{pt(we),A(we)},children:j},0)}),[T,I,ie,ve,ee,g,e.blockType,W,R,pt,a?.admin?.readOnly]),ht=Ye(()=>()=>X(Vs,{children:X(Ws,{className:"",slug:v,title:J(`lexical:blocks:inlineBlocks:${e?.id?"edit":"create"}`,{label:ee??J("lexical:blocks:inlineBlocks:label")}),children:k?Lt(Gs,{children:[X(Js,{fields:$.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:N,permissions:c,readOnly:!1}),X(Xs,{programmaticSubmit:!0,children:J("fields:saveChanges")})]}):null})}),[k,v,ee,J,$.fields,N,c]);return Ye(()=>k?X(zs,{beforeSubmit:[async({formState:j})=>await U({formState:j,submit:!0})],fields:$.fields,initialState:k,onChange:[U],onSubmit:j=>{let te=Or(j);te.blockType=e.blockType,g.update(()=>{let K=Co(o);K&&Rt(K)&&K.setFields(te)}),D()},submitted:n,uuid:sa(),children:X(Mr,{baseClass:re,BlockDrawer:ht,Collapsible:ft,CustomBlock:T,EditButton:ie,errorCount:C,formSchema:$.fields,initialState:k,nodeKey:o,RemoveButton:ve})}):null,[ft,ht,T,ve,ie,g,C,D,$.fields,k,o,U,n])};var de=class extends Ze{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=It(e.fields);return o.setFormat(e.format),o}decorate(e,o){return aa(Pr,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function It(t){return new de({fields:{...t,id:t?.id||new ca.default().toHexString()}})}function Rt(t){return t instanceof de}import{createCommand as Br}from"lexical";var Je=Br("INSERT_BLOCK_COMMAND"),qe=Br("INSERT_INLINE_BLOCK_COMMAND");import{c as ua}from"react/compiler-runtime";import{useLexicalComposerContext as da}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ma,$wrapNodeInElement as pa,mergeRegister as fa}from"@lexical/utils";import{formatDrawerSlug as ha,useEditDepth as ga}from"@payloadcms/ui";import{$createParagraphNode as Ca,$getNodeByKey as xa,$getPreviousSelection as ba,$getSelection as _a,$insertNodes as Ta,$isParagraphNode as jr,$isRangeSelection as Ea,$isRootOrShadowRoot as wa,COMMAND_PRIORITY_EDITOR as Hr}from"lexical";import{useEffect as ka,useState as Na}from"react";var Gr=()=>{let t=ua(10),[e]=da(),[o,n]=Na(null),{uuid:r}=B(),i=ga(),l="lexical-inlineBlocks-create-"+r,s;t[0]!==i||t[1]!==l?(s=ha({slug:l,depth:i}),t[0]=i,t[1]=l,t[2]=s):s=t[2];let a=s,{toggleDrawer:u}=ce(a,!0),c;t[3]!==e||t[4]!==o?(c=()=>{if(!e.hasNodes([de]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return fa(e.registerCommand(Je,m=>(e.update(()=>{let p=_a()||ba();if(Ea(p)){let f=It(m);ma(f);let{focus:h}=p,C=h.getNode();jr(C)&&C.getTextContentSize()===0&&C.getParentOrThrow().getChildren().filter(La).length>1&&C.remove()}}),!0),Hr),e.registerCommand(qe,m=>{if(o){let f=xa(o);return!f||!io(f)?!1:(f.setFields(m),n(null),!0)}let p=no(m);return Ta([p]),wa(p.getParentOrThrow())&&pa(p,Ca).selectEnd(),!0},Hr))},t[3]=e,t[4]=o,t[5]=c):c=t[5];let d;return t[6]!==e||t[7]!==o||t[8]!==u?(d=[e,o,u],t[6]=e,t[7]=o,t[8]=u,t[9]=d):d=t[9],ka(c,d),null};function La(t){return jr(t)}var Ra=y(({featureClientSchemaMap:t,props:e,schemaPath:o})=>{let n=`${o}.lexical_internal_feature.blocks.lexical_blocks`,r=`${o}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=t.blocks,l=Object.entries(i).filter(([c])=>c.startsWith(n+".")&&!c.replace(n+".","").includes(".")).map(([c,d])=>d[0]),s=Object.entries(i).filter(([c])=>c.startsWith(r+".")&&!c.replace(r+".","").includes(".")).map(([c,d])=>d[0]),a=l.map(c=>c.blocks[0]),u=s.map(c=>c.blocks[0]);return{nodes:[de,ro],plugins:[{Component:Gr,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[a?.length?{items:a.map(c=>({Icon:wt,key:"block-"+c.slug,keywords:["block","blocks",c.slug],label:({i18n:d})=>c?.labels?.singular?St(c.labels.singular,d):c?.slug,onSelect:({editor:d})=>{d.dispatchCommand(Je,{blockName:"",blockType:c.slug})}})),key:"blocks",label:({i18n:c})=>c.t("lexical:blocks:label")}:null,u?.length?{items:u.map(c=>({Icon:kt,key:"inlineBlocks-"+c.slug,keywords:["inlineBlock","inline block",c.slug],label:({i18n:d})=>c?.labels?.singular?St(c.labels.singular,d):c?.slug,onSelect:({editor:d})=>{d.dispatchCommand(qe,{blockName:"",blockType:c.slug})}})),key:"inlineBlocks",label:({i18n:c})=>c.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[a.length?{type:"dropdown",ChildComponent:wt,items:a.map((c,d)=>({ChildComponent:wt,isActive:void 0,key:"block-"+c.slug,label:({i18n:m})=>c?.labels?.singular?St(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:c.slug})},order:d})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:kt,items:u.map((c,d)=>({ChildComponent:kt,isActive:void 0,key:"inlineBlock-"+c.slug,label:({i18n:m})=>c?.labels?.singular?St(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(qe,{blockName:"",blockType:c.slug})},order:d})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as Ia}from"react/compiler-runtime";import{jsx as Le,jsxs as _o}from"react/jsx-runtime";import{useLexicalComposerContext as Sa}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as ya,$createTextNode as va,$getRoot as Ma}from"lexical";import*as Kr from"react";import{useCallback as Ne,useEffect as xo,useLayoutEffect as Ur,useRef as bo,useState as yt}from"react";var Da=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)},Aa=(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)},Fa=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
3
|
+
`)},regExp:/^>\s/,replace:(t,e,o,n)=>{if(n){let i=t.getPreviousSibling();if(wr(i)){i.splice(i.getChildrenSize(),0,[Ls(),...e]),i.select(0,0),t.remove();return}}let r=ks();r.append(...e),t.replace(r),r.select(0,0)}};var Lr=[q([{ChildComponent:po,isActive:({selection:t})=>{if(!Is(t))return!1;for(let e of t.getNodes())if(!Nr(e)&&!Nr(e.getParent()))return!1;return!0},key:"blockquote",label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Sr();Ir(e,()=>Rr())})},order:20}])],Ss=y({markdownTransformers:[kr],nodes:[Rs],slashMenu:{groups:[Z([{Icon:po,key:"blockquote",keywords:["quote","blockquote"],label:({i18n:t})=>t.t("lexical:blockquote:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Sr();Ir(e,()=>Rr())})}}])]},toolbarFixed:{groups:Lr},toolbarInline:{groups:Lr}});import{getTranslation as St}from"@payloadcms/translations";import{jsx as fo,jsxs as ys}from"react/jsx-runtime";import"react";var wt=()=>ys("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 yr}from"react/jsx-runtime";import"react";var kt=()=>yr("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:yr("path",{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 la}from"react/jsx-runtime";import sa from"bson-objectid";import"react";import{DecoratorBlockNode as vs}from"@lexical/react/LexicalDecoratorBlockNode.js";import Ms from"bson-objectid";var Ze=class extends vs{__fields;constructor({fields:e,format:o,key:n}){super(o,n),this.__fields=e}static clone(e){return new this({fields:e.__fields,format:e.__format,key:e.__key})}static getType(){return"block"}static importDOM(){return{}}static importJSON(e){e.version===1&&(e={...e,fields:{...e.fields.data},version:2});let o=Ds(e.fields);return o.setFormat(e.format),o}static isInline(){return!1}decorate(e,o){return null}exportDOM(){let e=document.createElement("div"),o=document.createTextNode(this.getTextContent());return e.append(o),{element:e}}exportJSON(){return{...super.exportJSON(),type:"block",fields:this.getFields(),version:2}}getFields(){return this.getLatest().__fields}getTextContent(){return"Block Field"}setFields(e){let o=this.getWritable();o.__fields=e}};function Ds(t){return new Ze({fields:{...t,id:t?.id||new Ms.default().toHexString()}})}import{jsx as X,jsxs as Lt,Fragment as Hs}from"react/jsx-runtime";import{Button as Ar,Collapsible as js,Drawer as Gs,EditDepthProvider as Us,ErrorPill as Ws,Form as Vs,formatDrawerSlug as Ks,FormSubmit as zs,Pill as Zs,RenderFields as Xs,SectionTitle as Ys,useDocumentInfo as Fr,useEditDepth as Js,useFormSubmitted as qs,useServerFunctions as Qs,useTranslation as ea}from"@payloadcms/ui";import{abortAndIgnore as ho}from"@payloadcms/ui/shared";import{deepCopyObjectSimpleWithoutReactComponents as ta,reduceFieldsToValues as Or}from"payload/shared";import Xe,{useCallback as go,useEffect as $r,useMemo as Ye,useRef as oa}from"react";import{useLexicalComposerContext as ra}from"@lexical/react/LexicalComposerContext";import{getTranslation as na}from"@payloadcms/translations";import{$getNodeByKey as Co}from"lexical";import{v4 as ia}from"uuid";import{c as As}from"react/compiler-runtime";import{jsx as Nt,jsxs as Fs}from"react/jsx-runtime";import{RenderFields as Os,useFormSubmitted as $s}from"@payloadcms/ui";import Ps,{createContext as Bs}from"react";var vr=Bs({initialState:!1}),ke=()=>Ps.useContext(vr),Mr=t=>{let e=As(13),{BlockDrawer:o,Collapsible:n,CustomBlock:r,EditButton:i,errorCount:l,formSchema:s,initialState:a,nodeKey:u,RemoveButton:c}=t,m=$s()&&l>0,p,f;e[0]!==n||e[1]!==l||e[2]!==m?(f=w=>Nt(n,{editButton:w.editButton,errorCount:l,fieldHasErrors:m,Label:w.Label,removeButton:w.removeButton,children:w.children}),e[0]=n,e[1]=l,e[2]=m,e[3]=f):f=e[3],p=f;let h=p,C;return e[4]!==o||e[5]!==h||e[6]!==r||e[7]!==i||e[8]!==c||e[9]!==s||e[10]!==a||e[11]!==u?(C=r?Fs(vr.Provider,{value:{BlockCollapsible:h,EditButton:i,initialState:a,nodeKey:u,RemoveButton:c},children:[r,Nt(o,{})]}):Nt(h,{children:Nt(Os,{fields:s,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:"",permissions:!0})}),e[4]=o,e[5]=h,e[6]=r,e[7]=i,e[8]=c,e[9]=s,e[10]=a,e[11]=u,e[12]=C):C=e[12],C};function Dr({fields:t}){for(let e in t){let o=t[e];Array.isArray(o.rows)&&"value"in o&&(o.disableFormData=!0)}return t}var re="lexical-block",Pr=t=>{let{formData:e,nodeKey:o}=t,n=qs(),{id:r,collectionSlug:i,globalSlug:l}=Fr(),{fieldProps:{featureClientSchemaMap:s,field:a,initialLexicalFormState:u,permissions:c,readOnly:d,schemaPath:m},uuid:p}=B(),f=oa(new AbortController),h=Js(),[C,w]=Xe.useState(0),v=Ks({slug:`lexical-blocks-create-${p}-${e.id}`,depth:h}),{toggleDrawer:D}=ce(v),{getDocPreferences:x,setDocFieldPreferences:E}=Fr(),[g]=ra(),{getFormState:_}=Qs(),N=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}.fields`,[k,L]=Xe.useState(u?.[e.id]?.formState?{...u?.[e.id]?.formState,blockName:{initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName}}:!1),[I,b]=Xe.useState(k?._components?.customComponents?.BlockLabel),[T,S]=Xe.useState(k?._components?.customComponents?.Block);$r(()=>{let j=new AbortController;return e&&!k&&(async()=>{let{state:K}=await _({id:r,collectionSlug:i,data:e,docPermissions:{fields:!0},docPreferences:await x(),globalSlug:l,operation:"update",renderAllFields:!0,schemaPath:N,signal:j.signal});K&&(K.blockName={initialValue:e.blockName,passesCondition:!0,valid:!0,value:e.blockName},L(K),b(K._components?.customComponents?.BlockLabel),S(K._components?.customComponents?.Block))})(),()=>{ho(j)}},[_,N,r,e,k,i,l,x]);let[R,A]=Xe.useState(u?.[e.id]?.collapsed??!1),M=`${m}.lexical_internal_feature.blocks.lexical_blocks.${e.blockType}`,$=s.blocks[M][0].blocks[0],{i18n:W,t:J}=ea(),U=go(async({formState:j,submit:te})=>{ho(f.current);let K=new AbortController;f.current=K;let{state:z}=await _({id:r,collectionSlug:i,docPermissions:{fields:!0},docPreferences:await x(),formState:j,globalSlug:l,operation:"update",renderAllFields:!!te,schemaPath:N,signal:K.signal});if(!z)return j;z.blockName=j.blockName;let oe=Or(Dr({fields:ta(z)}),!0);if(setTimeout(()=>{g.update(()=>{let be=Co(o);if(be&&Rt(be)){let we=oe;we.blockType=e.blockType,be.setFields(we)}})},0),te){b(z._components?.customComponents?.BlockLabel),S(z._components?.customComponents?.Block);let be=0;for(let we of Object.values(z))we?.valid===!1&&be++;w(be)}return z},[_,r,i,x,l,N,e.blockType,g,o]);$r(()=>()=>{ho(f.current)},[]);let H=go(()=>{g.update(()=>{Co(o)?.remove()})},[g,o]),ee=$?.labels?.singular?na($.labels.singular,W):$?.slug,pt=go(j=>{x().then(te=>{let z=te?.fields?.[a.name]?.collapsed,oe=z&&z?.length?z:[];j?oe.includes(e.id)||oe.push(e.id):oe.includes(e.id)&&oe.splice(oe.indexOf(e.id),1),E(a.name,{collapsed:oe,hello:"hi"})})},[x,a.name,E,e.id]),ie=Ye(()=>()=>X(Ar,{buttonStyle:"icon-label",className:`${re}__editButton`,disabled:d,el:"button",icon:"edit",onClick:j=>(j.preventDefault(),j.stopPropagation(),D(),!1),onMouseDown:j=>{j.preventDefault()},round:!0,size:"small",tooltip:J("lexical:blocks:inlineBlocks:edit",{label:ee})}),[ee,d,J,D]),ve=Ye(()=>()=>X(Ar,{buttonStyle:"icon-label",className:`${re}__removeButton`,disabled:a?.admin?.readOnly||!1,icon:"x",onClick:j=>{j.preventDefault(),H()},round:!0,tooltip:"Remove Block"}),[a?.admin?.readOnly,H]),ft=Ye(()=>({children:j,editButton:te,errorCount:K,fieldHasErrors:z,Label:oe,removeButton:be})=>X("div",{className:re+" "+re+"-"+e.blockType,children:X(js,{className:[`${re}__row`,z?`${re}__row--has-errors`:`${re}__row--no-errors`].join(" "),collapsibleStyle:z?"error":"default",header:Lt("div",{className:`${re}__block-header`,children:[oe??I?oe??I:Lt("div",{children:[X(Zs,{className:`${re}__block-pill ${re}__block-pill-${e?.blockType}`,pillStyle:"white",children:ee}),X(Ys,{path:"blockName",readOnly:a?.admin?.readOnly||!1}),z&&X(Ws,{count:K??0,i18n:W,withMessage:!0})]}),Lt("div",{children:[T&&te!==!1||!T&&te?X(ie,{}):null,be!==!1&&g.isEditable()?X(ve,{}):null]})]}),isCollapsed:R,onToggle:we=>{pt(we),A(we)},children:j},0)}),[T,I,ie,ve,ee,g,e.blockType,W,R,pt,a?.admin?.readOnly]),ht=Ye(()=>()=>X(Us,{children:X(Gs,{className:"",slug:v,title:J(`lexical:blocks:inlineBlocks:${e?.id?"edit":"create"}`,{label:ee??J("lexical:blocks:inlineBlocks:label")}),children:k?Lt(Hs,{children:[X(Xs,{fields:$.fields,forceRender:!0,parentIndexPath:"",parentPath:"",parentSchemaPath:N,permissions:c,readOnly:!1}),X(zs,{programmaticSubmit:!0,children:J("fields:saveChanges")})]}):null})}),[k,v,ee,J,$.fields,N,c]);return Ye(()=>k?X(Vs,{beforeSubmit:[async({formState:j})=>await U({formState:j,submit:!0})],fields:$.fields,initialState:k,onChange:[U],onSubmit:j=>{let te=Or(j);te.blockType=e.blockType,g.update(()=>{let K=Co(o);K&&Rt(K)&&K.setFields(te)}),D()},submitted:n,uuid:ia(),children:X(Mr,{baseClass:re,BlockDrawer:ht,Collapsible:ft,CustomBlock:T,EditButton:ie,errorCount:C,formSchema:$.fields,initialState:k,nodeKey:o,RemoveButton:ve})}):null,[ft,ht,T,ve,ie,g,C,D,$.fields,k,o,U,n])};var de=class extends Ze{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=It(e.fields);return o.setFormat(e.format),o}decorate(e,o){return la(Pr,{formData:this.getFields(),nodeKey:this.getKey()})}exportJSON(){return super.exportJSON()}};function It(t){return new de({fields:{...t,id:t?.id||new sa.default().toHexString()}})}function Rt(t){return t instanceof de}import{createCommand as Br}from"lexical";var Je=Br("INSERT_BLOCK_COMMAND"),qe=Br("INSERT_INLINE_BLOCK_COMMAND");import{c as aa}from"react/compiler-runtime";import{useLexicalComposerContext as ca}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as ua,$wrapNodeInElement as da,mergeRegister as ma}from"@lexical/utils";import{formatDrawerSlug as pa,useEditDepth as fa}from"@payloadcms/ui";import{$createParagraphNode as ha,$getNodeByKey as ga,$getPreviousSelection as Ca,$getSelection as xa,$insertNodes as ba,$isParagraphNode as jr,$isRangeSelection as _a,$isRootOrShadowRoot as Ta,COMMAND_PRIORITY_EDITOR as Hr}from"lexical";import{useEffect as Ea,useState as wa}from"react";var Gr=()=>{let t=aa(10),[e]=ca(),[o,n]=wa(null),{uuid:r}=B(),i=fa(),l="lexical-inlineBlocks-create-"+r,s;t[0]!==i||t[1]!==l?(s=pa({slug:l,depth:i}),t[0]=i,t[1]=l,t[2]=s):s=t[2];let a=s,{toggleDrawer:u}=ce(a,!0),c;t[3]!==e||t[4]!==o?(c=()=>{if(!e.hasNodes([de]))throw new Error("BlocksPlugin: BlocksNode not registered on editor");return ma(e.registerCommand(Je,m=>(e.update(()=>{let p=xa()||Ca();if(_a(p)){let f=It(m);ua(f);let{focus:h}=p,C=h.getNode();jr(C)&&C.getTextContentSize()===0&&C.getParentOrThrow().getChildren().filter(ka).length>1&&C.remove()}}),!0),Hr),e.registerCommand(qe,m=>{if(o){let f=ga(o);return!f||!io(f)?!1:(f.setFields(m),n(null),!0)}let p=no(m);return ba([p]),Ta(p.getParentOrThrow())&&da(p,ha).selectEnd(),!0},Hr))},t[3]=e,t[4]=o,t[5]=c):c=t[5];let d;return t[6]!==e||t[7]!==o||t[8]!==u?(d=[e,o,u],t[6]=e,t[7]=o,t[8]=u,t[9]=d):d=t[9],Ea(c,d),null};function ka(t){return jr(t)}var Na=y(({featureClientSchemaMap:t,props:e,schemaPath:o})=>{let n=`${o}.lexical_internal_feature.blocks.lexical_blocks`,r=`${o}.lexical_internal_feature.blocks.lexical_inline_blocks`,i=t.blocks,l=Object.entries(i).filter(([c])=>c.startsWith(n+".")&&!c.replace(n+".","").includes(".")).map(([c,d])=>d[0]),s=Object.entries(i).filter(([c])=>c.startsWith(r+".")&&!c.replace(r+".","").includes(".")).map(([c,d])=>d[0]),a=l.map(c=>c.blocks[0]),u=s.map(c=>c.blocks[0]);return{nodes:[de,ro],plugins:[{Component:Gr,position:"normal"}],sanitizedClientFeatureProps:e,slashMenu:{groups:[a?.length?{items:a.map(c=>({Icon:wt,key:"block-"+c.slug,keywords:["block","blocks",c.slug],label:({i18n:d})=>c?.labels?.singular?St(c.labels.singular,d):c?.slug,onSelect:({editor:d})=>{d.dispatchCommand(Je,{blockName:"",blockType:c.slug})}})),key:"blocks",label:({i18n:c})=>c.t("lexical:blocks:label")}:null,u?.length?{items:u.map(c=>({Icon:kt,key:"inlineBlocks-"+c.slug,keywords:["inlineBlock","inline block",c.slug],label:({i18n:d})=>c?.labels?.singular?St(c.labels.singular,d):c?.slug,onSelect:({editor:d})=>{d.dispatchCommand(qe,{blockName:"",blockType:c.slug})}})),key:"inlineBlocks",label:({i18n:c})=>c.t("lexical:blocks:inlineBlocks:label")}:null].filter(Boolean)},toolbarFixed:{groups:[a.length?{type:"dropdown",ChildComponent:wt,items:a.map((c,d)=>({ChildComponent:wt,isActive:void 0,key:"block-"+c.slug,label:({i18n:m})=>c?.labels?.singular?St(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(Je,{blockName:"",blockType:c.slug})},order:d})),key:"blocks",order:20}:null,u?.length?{type:"dropdown",ChildComponent:kt,items:u.map((c,d)=>({ChildComponent:kt,isActive:void 0,key:"inlineBlock-"+c.slug,label:({i18n:m})=>c?.labels?.singular?St(c.labels.singular,m):c?.slug,onSelect:({editor:m})=>{m.dispatchCommand(qe,{blockName:"",blockType:c.slug})},order:d})),key:"inlineBlocks",order:25}:null].filter(Boolean)}}});import{c as La}from"react/compiler-runtime";import{jsx as Le,jsxs as _o}from"react/jsx-runtime";import{useLexicalComposerContext as Ra}from"@lexical/react/LexicalComposerContext.js";import{$createParagraphNode as Ia,$createTextNode as Sa,$getRoot as ya}from"lexical";import*as Kr from"react";import{useCallback as Ne,useEffect as xo,useLayoutEffect as Ur,useRef as bo,useState as yt}from"react";var va=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)},Ma=(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)},Da=t=>{let o=((n,r)=>{switch(n){case"click":return` await page.mouse.click(${r.x}, ${r.y});`;case"keydown":return` await page.keyboard.keydown('${r}');`;case"keyup":return` await page.keyboard.keyup('${r}');`;case"press":return` await page.keyboard.press('${r}');`;case"selectAll":return" await selectAll(page);";case"snapshot":return` await assertHTMLSnapshot(page);
|
|
4
4
|
await assertSelection(page, {
|
|
5
5
|
anchorPath: [${r.anchorPath.toString()}],
|
|
6
6
|
anchorOffset: ${r.anchorOffset},
|
|
@@ -10,7 +10,7 @@
|
|
|
10
10
|
`;case"type":return` await page.keyboard.type('${r}');`;default:return""}})(t.name,t.value);switch(t.count){case 1:return o;case 2:return[o,o].join(`
|
|
11
11
|
`);default:return` await repeat(${t.count}, async () => {
|
|
12
12
|
${o}
|
|
13
|
-
);`}};function
|
|
13
|
+
);`}};function Aa(t){return t.key.toLowerCase()==="a"&&(mr?t.metaKey:t.ctrlKey)}function Fa(t){let{anchorNode:e,focusNode:o}=t,{anchorOffset:n,focusOffset:r}=t;return n!==0&&n--,r!==0&&r--,{anchorNode:e,anchorOffset:n,focusNode:o,focusOffset:r}}function Wr(t,e){let o=t,n=[];for(;o!==e;)o!=null&&n.unshift(Array.from(o?.parentNode?.childNodes??[]).indexOf(o)),o=o?.parentNode;return n}var Vr=new Set(["ArrowDown","ArrowLeft","ArrowRight","ArrowUp","Backspace","Delete","Enter","Escape"]);function Oa(t){let[e,o]=yt([]),[n,r]=yt(!1),[,i]=yt(""),[l,s]=yt(""),a=bo(null),u=bo(!1),c=bo(null),d=Ne(()=>t,[t]),m=Ne(()=>{let x=t.getRootElement(),E=window.getSelection();return x==null||E==null||E.anchorNode==null||E.focusNode==null||!x.contains(E.anchorNode)||!x.contains(E.focusNode)?null:`
|
|
14
14
|
import {
|
|
15
15
|
initializeE2E,
|
|
16
16
|
assertHTMLSnapshot,
|
|
@@ -27,16 +27,16 @@ describe('Test case', () => {
|
|
|
27
27
|
const {page} = e2e;
|
|
28
28
|
|
|
29
29
|
await page.focus('div[contenteditable="true"]');
|
|
30
|
-
${e.map(
|
|
30
|
+
${e.map(Da).join(`
|
|
31
31
|
`)}
|
|
32
32
|
});
|
|
33
33
|
});
|
|
34
|
-
`},[t,e]),p=Ne((x,E)=>{o(g=>{let _=e.length-1,N=e[_];if(N&&N.name===x){if(x==="type")return[...e.slice(0,_),{...N,value:N.value+E}];if(N.value===E)return[...e.slice(0,_),{...N,count:N.count+1}]}return[...g,{name:x,count:1,value:E}]})},[e,o]);Ur(()=>{let x=g=>{if(!n)return;let _=g.key;Oa(g)?p("selectAll",""):Vr.has(_)?p("press",g.key):[..._].length>1?p("keydown",g.key):p("type",g.key)},E=g=>{if(!n)return;let _=g.key;!Vr.has(_)&&[..._].length>1&&p("keyup",g.key)};return t.registerRootListener((g,_)=>{_!==null&&(_.removeEventListener("keydown",x),_.removeEventListener("keyup",E)),g!==null&&(g.addEventListener("keydown",x),g.addEventListener("keyup",E))})},[t,n,p]),Ur(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),xo(()=>{if(e){let x=m();x!==null&&s(x),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),xo(()=>t.registerUpdateListener(({dirtyElements:E,dirtyLeaves:g,editorState:_})=>{if(!n)return;let N=_._selection,k=a.current,L=u.current;if(k!==N){if(g.size===0&&E.size===0&&!L){let b=window.getSelection();if(b&&(b.anchorNode==null||b.focusNode==null))return}a.current=N}u.current=!1;let I=m();I!==null&&s(I)}),[t,m,n,p]),xo(()=>n?t.registerUpdateListener(()=>{let E=t.getRootElement();E!==null&&i(E?.innerHTML)}):void 0,[t,n]);let f=Ne(x=>{n||(x.update(()=>{let E=Ma();E.clear();let g=va();E.append(ya().append(g)),g.select()}),o([])),r(E=>!E)},[n]),h=Ne(()=>{if(!n)return;let x=window.getSelection();if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:E,anchorOffset:g,focusNode:_,focusOffset:N}=$a(x),k=d().getRootElement(),L;E!==null&&(L=Wr(E,k));let I;_!==null&&(I=Wr(_,k)),p("snapshot",{anchorNode:E,anchorOffset:g,anchorPath:L,focusNode:_,focusOffset:N,focusPath:I})},[p,n,d]),C=Ne(()=>{Da(m())},[m]),w=Ne(()=>{Aa("test.js",m())},[m]);return[Le("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:x=>{f(d()),x.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?_o("div",{className:"test-recorder-output",children:[_o("div",{className:"test-recorder-toolbar",children:[Le("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{h(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Le("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{C(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Le("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{w(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Le("pre",{id:"test-recorder",ref:c,children:l})]}):null]}var zr=()=>{let t=Ia(3),[e]=Sa(),[o,n]=Pa(e),r;return t[0]!==o||t[1]!==n?(r=_o(Kr.Fragment,{children:[Le("p",{children:"HI"}),o,n,Le("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var Ba=y({plugins:[{Component:zr,position:"bottom"}]});import{c as Ha}from"react/compiler-runtime";import{jsx as ja}from"react/jsx-runtime";import{useLexicalComposerContext as Ga}from"@lexical/react/LexicalComposerContext.js";import{TreeView as Ua}from"@lexical/react/LexicalTreeView.js";import"react";var Zr=()=>{let t=Ha(2),[e]=Ga(),o;return t[0]!==e?(o=ja(Ua,{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 Wa=y({plugins:[{Component:Zr,position:"bottom"}]});import{$isTableSelection as Va}from"@lexical/table";import{$isRangeSelection as Ka,FORMAT_TEXT_COMMAND as za}from"lexical";import{jsx as Xr}from"react/jsx-runtime";import"react";var Yr=()=>Xr("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:Xr("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 Jr={type:"text-format",format:["bold","italic"],tag:"***"},qr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Qr={type:"text-format",format:["bold"],tag:"**"},en={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var tn=[Y([{ChildComponent:Yr,isActive:({selection:t})=>Ka(t)||Va(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(za,"bold")},order:1}])],Za=y(({featureProviderMap:t})=>{let e=[Qr,en];return t.get("italic")&&e.push(qr,Jr),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:tn},toolbarInline:{groups:tn}}});import{$isTableSelection as Ya}from"@lexical/table";import{$isRangeSelection as Ja,FORMAT_TEXT_COMMAND as qa}from"lexical";import{jsx as on,jsxs as Xa}from"react/jsx-runtime";import"react";var rn=()=>Xa("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:[on("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),on("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var nn={type:"text-format",format:["code"],tag:"`"};var ln=[Y([{ChildComponent:rn,isActive:({selection:t})=>Ja(t)||Ya(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(qa,"code")},order:7}])],Qa=y({enableFormats:["code"],markdownTransformers:[nn],toolbarFixed:{groups:ln},toolbarInline:{groups:ln}});import{$isTableSelection as ec}from"@lexical/table";import{$isRangeSelection as tc,FORMAT_TEXT_COMMAND as oc}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var an=()=>sn("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:sn("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 cn={type:"text-format",format:["italic"],tag:"*"},un={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var dn=[Y([{ChildComponent:an,isActive:({selection:t})=>tc(t)||ec(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(oc,"italic")},order:2}])],rc=y({enableFormats:["italic"],markdownTransformers:[cn,un],toolbarFixed:{groups:dn},toolbarInline:{groups:dn}});import{$isTableSelection as ic}from"@lexical/table";import{$isRangeSelection as lc,FORMAT_TEXT_COMMAND as sc}from"lexical";import{jsx as mn,jsxs as nc}from"react/jsx-runtime";import"react";var pn=()=>nc("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:[mn("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"}),mn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var fn={type:"text-format",format:["strikethrough"],tag:"~~"};var hn=[Y([{ChildComponent:pn,isActive:({selection:t})=>lc(t)||ic(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(sc,"strikethrough")},order:4}])],ac=y({enableFormats:["strikethrough"],markdownTransformers:[fn],toolbarFixed:{groups:hn},toolbarInline:{groups:hn}});import{$isTableSelection as cc}from"@lexical/table";import{$isRangeSelection as uc,FORMAT_TEXT_COMMAND as dc}from"lexical";import{jsx as gn}from"react/jsx-runtime";import"react";var Cn=()=>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:"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 xn=[Y([{ChildComponent:Cn,isActive:({selection:t})=>uc(t)||cc(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(dc,"subscript")},order:5}])],mc=y({enableFormats:["subscript"],toolbarFixed:{groups:xn},toolbarInline:{groups:xn}});import{$isTableSelection as pc}from"@lexical/table";import{$isRangeSelection as fc,FORMAT_TEXT_COMMAND as hc}from"lexical";import{jsx as bn}from"react/jsx-runtime";import"react";var _n=()=>bn("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:bn("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 Tn=[Y([{ChildComponent:_n,isActive:({selection:t})=>fc(t)||pc(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(hc,"superscript")},order:6}])],gc=y({enableFormats:["superscript"],toolbarFixed:{groups:Tn},toolbarInline:{groups:Tn}});import{$isTableSelection as xc}from"@lexical/table";import{$isRangeSelection as bc,FORMAT_TEXT_COMMAND as _c}from"lexical";import{jsx as En,jsxs as Cc}from"react/jsx-runtime";import"react";var wn=()=>Cc("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:[En("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"}),En("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var kn=[Y([{ChildComponent:wn,isActive:({selection:t})=>bc(t)||xc(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(_c,"underline")},order:3}])],Tc=y({enableFormats:["underline"],toolbarFixed:{groups:kn},toolbarInline:{groups:kn}});import{$createHeadingNode as Nc,$isHeadingNode as Pn,HeadingNode as Lc}from"@lexical/rich-text";import{$setBlocksType as Rc}from"@lexical/selection";import{$getSelection as Ic,$isRangeSelection as Sc}from"lexical";import{jsx as Nn}from"react/jsx-runtime";import"react";var Ln=()=>Nn("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:Nn("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 Rn}from"react/jsx-runtime";import"react";var In=()=>Rn("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:Rn("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 Sn}from"react/jsx-runtime";import"react";var yn=()=>Sn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Sn("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 vn}from"react/jsx-runtime";import"react";var Mn=()=>vn("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:vn("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 Dn}from"react/jsx-runtime";import"react";var An=()=>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",{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 Fn}from"react/jsx-runtime";import"react";var On=()=>Fn("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:Fn("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 Ec,$isHeadingNode as wc,HeadingNode as kc}from"@lexical/rich-text";var To=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var $n=t=>{let o=`^(${t.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[kc],export:(r,i)=>{if(!wc(r))return null;let l=Number(r.getTag().slice(1));return"#".repeat(l)+" "+i(r)},regExp:n,replace:To(r=>{let i="h"+r[1].length;return Ec(i)})}};var Bn=t=>{let e=Ic();Rc(e,()=>Nc(t))},Hn={h1:Ln,h2:In,h3:yn,h4:Mn,h5:An,h6:On},yc=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[q(e.map((n,r)=>({ChildComponent:Hn[n],isActive:({selection:i})=>{if(!Sc(i))return!1;for(let l of i.getNodes()){if(Pn(l)&&l.getTag()===n)continue;let s=l.getParent();if(!(Pn(s)&&s.getTag()===n))return!1}return!0},key:n,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{Bn(n)})},order:r+2})))];return{markdownTransformers:[$n(e)],nodes:[Lc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(n=>({Icon:Hn[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{Bn(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Hc}from"lexical";import{jsx as jn}from"react/jsx-runtime";import"react";var Eo=()=>jn("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("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Gn,jsxs as vc}from"react/jsx-runtime";import"react";var Un=()=>vc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Gn("path",{d:"M5 10h10",stroke:"currentColor"}),Gn("path",{d:"M10 15V5",stroke:"currentColor"})]});var me=t=>({type:"dropdown",ChildComponent:Un,items:t,key:"add",order:10});var Wn={type:"element",dependencies:[gt],export:(t,e)=>xt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Ct();e&&t.replace(e)}};import{c as Mc}from"react/compiler-runtime";import{useLexicalComposerContext as Dc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Ac}from"@lexical/utils";import{$getSelection as Fc,$isRangeSelection as Oc,COMMAND_PRIORITY_EDITOR as $c}from"lexical";import{useEffect as Pc}from"react";var Vn=()=>{let t=Mc(3),[e]=Dc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Be,Bc,$c),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Pc(o,n),null};function Bc(t){let e=Fc();if(!Oc(e))return!1;if(e.focus.getNode()!==null){let n=Ct();Ac(n)}return!0}var jc=y({markdownTransformers:[Wn],nodes:[gt],plugins:[{Component:Vn,position:"normal"}],slashMenu:{groups:[Z([{Icon:Eo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Be,void 0)}}])]},toolbarFixed:{groups:[me([{ChildComponent:Eo,isActive:({selection:t})=>{if(!Hc(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return xt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Be,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as qc,OUTDENT_CONTENT_COMMAND as Qc}from"lexical";import{jsx as vt,jsxs as Gc}from"react/jsx-runtime";import"react";var Kn=()=>Gc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[vt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Mt,jsxs as Uc}from"react/jsx-runtime";import"react";var zn=()=>Uc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{c as Wc}from"react/compiler-runtime";import{jsx as Vc}from"react/jsx-runtime";import{useLexicalComposerContext as Kc}from"@lexical/react/LexicalComposerContext.js";import{TabIndentationPlugin as zc}from"@lexical/react/LexicalTabIndentationPlugin";import{mergeRegister as Zc}from"@lexical/utils";import{COMMAND_PRIORITY_NORMAL as Zn,FOCUS_COMMAND as Xc,KEY_ESCAPE_COMMAND as Yc}from"lexical";import{useEffect as Xn,useState as Jc}from"react";var Yn=()=>{let t=Wc(8),[e]=Kc(),[o,n]=Jc(!1),r,i;t[0]!==e?(r=()=>Zc(e.registerCommand(Xc,()=>(n(!1),!0),Zn),e.registerCommand(Yc,()=>(n(!0),e.getRootElement()?.blur(),!0),Zn)),i=[e,n],t[0]=e,t[1]=r,t[2]=i):(r=t[1],i=t[2]),Xn(r,i);let l,s;t[3]!==e||t[4]!==o?(l=()=>{if(!o)return;let u=c=>{["Escape","Shift"].includes(c.key)||n(!1),c.shiftKey&&c.key==="Tab"&&e.getRootElement()?.parentElement?.focus()};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},s=[e,o],t[3]=e,t[4]=o,t[5]=l,t[6]=s):(l=t[5],s=t[6]),Xn(l,s);let a;return t[7]===Symbol.for("react.memo_cache_sentinel")?(a=Vc(zc,{}),t[7]=a):a=t[7],a};var Jn=t=>({type:"buttons",items:t,key:"indent",order:35});var qn=[Jn([{ChildComponent:Kn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Qc,void 0)},order:1},{ChildComponent:zn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(qc,void 0)},order:2}])],eu=y({plugins:[{Component:Yn,position:"normal"}],toolbarFixed:{groups:qn},toolbarInline:{groups:qn}});import{$findMatchingParent as pd}from"@lexical/utils";import{$getSelection as yo,$isRangeSelection as Si}from"lexical";import{jsx as Qn}from"react/jsx-runtime";import"react";var ei=()=>Qn("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:Qn("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 ti}from"@lexical/selection";function Me(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?ti(o)?n:r:ti(e)?n:r}var wo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as du,$isTextNode as mu}from"lexical";import{addClassNamesToElement as tu,isHTMLAnchorElement as ou}from"@lexical/utils";import Lo from"bson-objectid";import{$applyNodeReplacement as ru,$createTextNode as oi,$getSelection as nu,$isElementNode as ri,$isRangeSelection as No,createCommand as iu,ElementNode as lu}from"lexical";var su=new Set(["http:","https:","mailto:","sms:","tel:"]),Q=class t extends lu{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:""},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:au,priority:1})}}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Lo.default().toHexString(),e.version=3);let o=pe({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=ko(o.rel,"add","noopener")),tu(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,n){if(!No(o))return!1;let r=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(ri(n)){let r=pe({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!su.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,n){let r=this.__fields?.url,i=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=ko(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=ko(o.rel,"remove","noopener"))),!1}};function au(t){let e=null;if(ou(t)){let o=t.textContent;o!==null&&o!==""&&(e=pe({id:new Lo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function pe({id:t,fields:e}){return ru(new Q({id:t??new Lo.default().toHexString(),fields:e}))}function V(t){return t instanceof Q}var le=iu("TOGGLE_LINK_COMMAND");function ni(t){let e=nu();if(!No(e)&&!t.selectedNodes?.length)return;let o=No(e)?e.extract():t.selectedNodes;if(t===null)o?.forEach(n=>{let r=n.getParent();if(V(r)){let i=r.getChildren();for(let l=0;l<i.length;l+=1)r.insertBefore(i[l]);r.remove()}});else{if(o?.length===1){let i=o[0],l=V(i)?i:cu(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(oi(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let n=null,r=null;o?.forEach(i=>{let l=i.getParent();if(!(l===r||l===null||ri(i)&&!i.isInline())){if(V(l)){r=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(oi(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(n)||(n=l,r=pe({fields:t.fields}),V(l)?i.getPreviousSibling()===null?l.insertBefore(r):l.insertAfter(r):i.insertBefore(r)),V(i)){if(i.is(r))return;if(r!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)r.append(s[a])}i.remove();return}r!==null&&r.append(i)}})}}function cu(t){return uu(t,e=>V(e))}function uu(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function ko(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let i=new RegExp(o,"g");r=r.replace(i,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let i=new RegExp(o,"g");n=r.replace(i,"").trim()}return n}var ii={type:"text-match",dependencies:[Q],export:(t,e,o)=>{if(!V(t))return null;let n=t,{url:r}=n.getFields(),i=`[${n.getTextContent()}](${r})`,l=n.getFirstChild();return n.getChildrenSize()===1&&mu(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,n]=e,r=pe({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),i=du(o);i.setFormat(t.getFormat()),r.append(i),t.replace(r)},trigger:")"};import{$applyNodeReplacement as pu,$isElementNode as fu}from"lexical";var fe=class t extends Q{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2);let o=Qe({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(fu(n)){let r=Qe({fields:this.__fields});return n.append(r),r}return null}};function Qe({fields:t}){return pu(new fe({id:"",fields:t}))}function he(t){return t instanceof fe}import{c as hu}from"react/compiler-runtime";import{useLexicalComposerContext as gu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Cu}from"@lexical/utils";import{$createTextNode as li,$getSelection as xu,$isElementNode as ai,$isLineBreakNode as ci,$isNodeSelection as bu,$isRangeSelection as _u,$isTextNode as et,TextNode as Tu}from"lexical";import{useEffect as Eu}from"react";function si(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function ui(t,e){for(let o=0;o<e.length;o++){let n=e[o](t);if(n!=null)return n}return null}var wu=/[.,;\s]/;function At(t){return wu.test(t)}function di(t){return At(t[t.length-1])}function Io(t){return At(t[0])}function ku(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function mi(t){let e=t.getPreviousSibling();return ai(e)&&(e=e.getLastDescendant()),e===null||ci(e)||et(e)&&di(e.getTextContent())}function pi(t){let e=t.getNextSibling();return ai(e)&&(e=e.getFirstDescendant()),e===null||ci(e)||et(e)&&Io(e.getTextContent())}function Nu(t,e,o,n){return(t>0?At(o[t-1]):mi(n[0]))?e<o.length?At(o[e]):pi(n[n.length-1]):!1}function Lu(t,e,o){let n=[],r=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let u=a[0],d=u.getTextContent().length,m=s;s+d<=e?(n.push(u),l+=d):m>=o?i.push(u):r.push(u),s+=d,a.shift()}return[l,n,r,i]}function Ru(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},i=Qe({fields:r});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=li(n.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let u=[],c;for(let f=1;f<t.length;f++){let h=t[f],w=h.getTextContent().length,v=s,D=s+w;if(v<o)if(D<=o)u.push(h);else{let[x,E]=h.splitText(o-v);u.push(x),c=E}s+=w}let d=xu(),m=d?d.getNodes().find(et):void 0,p=li(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...u),m&&m===a&&(_u(d)?p.select(d.anchor.offset,d.focus.offset):bu(d)&&p.select(0,p.getTextContent().length)),a.replace(i),c}}function Iu(t,e,o){let n=[...t],r=n.map(a=>a.getTextContent()).join(""),i=r,l,s=0;for(;(l=ui(i,e))!=null&&l!==null;){let a=l.index,u=l.length,c=a+u;if(Nu(s+a,s+c,r,n)){let[m,,p,f]=Lu(n,s+a,s+c),h=s+a-m,C=s+c-m,w=Ru(p,h,C,l);n=w?[w,...f]:f,o(l.url,null),s=0}else s+=c;i=i.substring(c)}}function Ro(t,e,o){let n=t.getChildren(),r=n.length;for(let a=0;a<r;a++){let u=n[a];if(!et(u)||!u.isSimpleText()){Dt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=ui(i,e);if(l===null||l.text!==i){Dt(t),o(null,t.getFields()?.url??null);return}if(!mi(t)||!pi(t)){Dt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function Su(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),i=t.getTextContent();if(he(n)){let l=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:"):!1;(!Io(i)||ku(i,l))&&(n.append(t),Ro(n,e,o),o(null,n.getFields()?.url??null))}he(r)&&!di(i)&&(Dt(r),Ro(r,e,o),o(null,r.getFields()?.url??null))}function Dt(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function yu(t){let e=[t],o=t.getNextSibling();for(;o!==null&&et(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function vu(t,e,o){let n=hu(5),r,i;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([fe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return Cu(t.registerNodeTransform(Tu,s=>{let a=s.getParentOrThrow(),u=s.getPreviousSibling();if(he(a))Ro(a,e,l);else if(!V(a)){if(s.isSimpleText()&&(Io(s.getTextContent())||!he(u))){let c=yu(s);Iu(c,e,l)}Su(s,e,l)}}))},i=[t,e,o],n[0]=t,n[1]=e,n[2]=o,n[3]=r,n[4]=i):(r=n[3],i=n[4]),Eu(r,i)}var Mu=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,Du=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Au=[si(Mu,t=>t.startsWith("http")?t:`https://${t}`),si(Du,t=>`mailto:${t}`)],fi=()=>{let[t]=gu();return vu(t,Au),null};import{jsx as Fu}from"react/jsx-runtime";import{ClickableLinkPlugin as Ou}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var hi=()=>Fu(Ou,{});import{jsx as Qu}from"react/jsx-runtime";import"react";import{createPortal as ed}from"react-dom";import{jsx as ge,jsxs as tt,Fragment as Pu}from"react/jsx-runtime";import{useLexicalComposerContext as Bu}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as gi,mergeRegister as Ci}from"@lexical/utils";import{getTranslation as So}from"@payloadcms/translations";import{CloseMenuIcon as Hu,EditIcon as ju,ExternalLinkIcon as xi,formatDrawerSlug as Gu,useConfig as Uu,useEditDepth as Wu,useLocale as Vu,useTranslation as Ku}from"@payloadcms/ui";import{requests as zu}from"@payloadcms/ui/shared";import{$getSelection as bi,$isLineBreakNode as Zu,$isRangeSelection as _i,COMMAND_PRIORITY_HIGH as Xu,COMMAND_PRIORITY_LOW as Ti,KEY_ESCAPE_COMMAND as Yu,SELECTION_CHANGE_COMMAND as Ju}from"lexical";import Ei,{useCallback as wi,useEffect as $t,useRef as qu,useState as Re}from"react";function Ft(t,e,o,n=10,r=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),u=t.top-n,c=t.left-r;u<a.top&&(u+=l.height+t.height+n*2),c+l.width>a.right&&(c=a.right-l.width-r),u-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${u}px)`}import{createCommand as $u}from"lexical";var Ot=$u("TOGGLE_LINK_WITH_MODAL_COMMAND");function ki({anchorElem:t}){let[e]=Bu(),[o,n]=Re(),r=qu(null),[i,l]=Re(null),[s,a]=Re(null),{fieldProps:{schemaPath:u},uuid:c}=B(),{config:d}=Uu(),{i18n:m,t:p}=Ku(),[f,h]=Re(),C=Wu(),[w,v]=Re(!1),[D,x]=Re([]),E=Vu(),[g,_]=Re(!1),N=Gu({slug:"lexical-rich-text-link-"+c,depth:C}),{toggleDrawer:k}=ce(N),L=wi(()=>{v(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),_(!1),l(null),a(null),x([]),h(void 0)},[v,l,a,x]),I=wi(()=>{let b=bi(),T;if(!_i(b)||!b){L();return}let S=Me(b);T=e.getElementByKey(S.getKey())?.getBoundingClientRect();let R=gi(S,V),A=b.getNodes().filter(U=>!Zu(U)).find(U=>{let H=gi(U,V);return R&&!R.is(H)||H&&!H.is(R)});if(R==null||A){L();return}n(R);let M=R.getFields(),O={...M,id:R.getID(),text:R.getTextContent()};if(M?.linkType==="custom")l(M?.url??null),a(null);else{l(`${d.routes.admin==="/"?"":d.routes.admin}/collections/${M?.doc?.relationTo}/${M?.doc?.value}`);let U=d.collections.find(H=>H.slug===M?.doc?.relationTo);if(!U)a(M?.label?String(M?.label):null),l(M?.url?String(M?.url):null);else{let H=typeof M.doc?.value=="object"?M.doc.value.id:M.doc?.value,ee=M.doc?.relationTo;if(!H||!ee)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let pt=p("fields:linkedTo",{label:`${So(U.labels.singular,m)} - ${p("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");a(pt),zu.get(`${d.serverURL}${d.routes.api}/${ee}/${H}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:E?.code}}).then(async ie=>{if(!ie.ok)throw new Error(`HTTP error! Status: ${ie.status}`);let ve=await ie.json(),ft=U?.admin?.useAsTitle||"id",ht=ve[ft],dr=p("fields:linkedTo",{label:`${So(U.labels.singular,m)} - ${ht}`}).replace(/<[^>]*>?/g,"");a(dr)}).catch(()=>{let ie=p("fields:linkedTo",{label:`${So(U.labels.singular,m)} - ${p("general:untitled",m)} - ID: ${H}`}).replace(/<[^>]*>?/g,"");a(ie)})}}h(O),v(!0),x(b?b?.getNodes():[]),he(R)?_(!0):_(!1);let G=r.current,$=window.getSelection(),{activeElement:W}=document;if(G===null)return;let J=e.getRootElement();return $!==null&&J!==null&&J.contains($.anchorNode)?(T||(T=$.getRangeAt(0).getBoundingClientRect()),T!=null&&(T.y+=40,Ft(T,G,t))):(W==null||W.className!=="link-input")&&(J!==null&&Ft(null,G,t),l(null),a(null)),!0},[e,L,d.routes.admin,d.routes.api,d.collections,d.serverURL,p,m,E?.code,t]);return $t(()=>Ci(e.registerCommand(Ot,b=>(e.dispatchCommand(le,b),I(),k(),!0),Ti)),[e,I,k,N]),$t(()=>{let b=t.parentElement,T=()=>{e.getEditorState().read(()=>{I()})};return window.addEventListener("resize",T),b?.addEventListener("scroll",T),()=>{window.removeEventListener("resize",T),b?.removeEventListener("scroll",T)}},[t.parentElement,e,I]),$t(()=>Ci(e.registerUpdateListener(({editorState:b})=>{b.read(()=>{I()})}),e.registerCommand(Ju,()=>(I(),!0),Ti),e.registerCommand(Yu,()=>w?(L(),!0):!1,Xu)),[e,I,w,L]),$t(()=>{e.getEditorState().read(()=>{I()})},[e,I]),tt(Ei.Fragment,{children:[ge("div",{className:"link-editor",ref:r,children:tt("div",{className:"link-input",children:[i&&i.length>0?tt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?ge(xi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?tt(Pu,{children:[o?.__fields.newTab?ge(xi,{}):null,ge("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&tt(Ei.Fragment,{children:[ge("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{k()},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:ge(ju,{})}),!g&&ge("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(le,null)},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:ge(Hu,{})})]})]})}),ge(He,{className:"lexical-link-edit-drawer",data:f,drawerSlug:N,drawerTitle:p("fields:editLink"),featureKey:"link",handleDrawerSubmit:(b,T)=>{let S=T,R={...S};delete R.text,e.update(()=>{let A=bi(),M=null;if(_i(A)?M=Me(A).getParent():D.length&&(M=D[0].getParent()),M&&he(M)){let O=pe({fields:R});M.replace(O,!0)}}),e.dispatchCommand(le,{fields:R,selectedNodes:D,text:S.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Ni=t=>{let{anchorElem:e=document.body}=t;return ed(Qu(ki,{anchorElem:e}),e)};import{c as rd}from"react/compiler-runtime";import{useLexicalComposerContext as nd}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as id}from"@lexical/utils";import{$getSelection as ld,$isElementNode as sd,$isRangeSelection as ad,COMMAND_PRIORITY_LOW as Ri,PASTE_COMMAND as cd}from"lexical";import{useEffect as ud}from"react";var td=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,od=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Li(t){if(!t)return!1;if(t==="https://"||td.test(t)||od.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ii=()=>{let t=rd(3),[e]=nd(),o,n;return t[0]!==e?(o=()=>{if(!e.hasNodes([Q]))throw new Error("LinkPlugin: LinkNode not registered on editor");return id(e.registerCommand(le,dd,Ri),e.registerCommand(cd,r=>{let i=ld();if(!ad(i)||i.isCollapsed()||!(r instanceof ClipboardEvent)||r.clipboardData==null)return!1;let l=r.clipboardData.getData("text");if(!Li(l))return!1;if(!i.getNodes().some(md)){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(le,{fields:s,text:null}),r.preventDefault(),!0}return!1},Ri))},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ud(o,n),null};function dd(t){return ni(t),!0}function md(t){return sd(t)}var yi=[wo([{ChildComponent:ei,isActive:({selection:t})=>{if(Si(t)){let e=Me(t);return pd(e,V)!=null}return!1},isEnabled:({selection:t})=>!!(Si(t)&&yo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(le,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=yo()?.getTextContent(),n=yo()?.getNodes()??[]}),!o?.length)return;let r={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(Ot,{fields:r,selectedNodes:n,text:o})}},order:1}])],fd=y({markdownTransformers:[ii],nodes:[Q,fe],plugins:[{Component:Ii,position:"normal"},{Component:fi,position:"normal"},{Component:hi,position:"normal"},{Component:Ni,position:"floatingAnchorElem"}],toolbarFixed:{groups:yi},toolbarInline:{groups:yi}});import{$isListNode as Do,INSERT_CHECK_LIST_COMMAND as Oi,ListItemNode as Ld,ListNode as Rd}from"@lexical/list";import{$isRangeSelection as Id}from"lexical";import{jsx as vi,jsxs as hd}from"react/jsx-runtime";import"react";var vo=()=>hd("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:[vi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),vi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as gd}from"react/jsx-runtime";import{ListPlugin as Cd}from"@lexical/react/LexicalListPlugin.js";import"react";var De=()=>gd(Cd,{});function Ae(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as Td,ListItemNode as Ed,ListNode as wd}from"@lexical/list";import{$createListItemNode as xd,$createListNode as bd,$isListItemNode as _d,$isListNode as Mo}from"@lexical/list";var Mi=4,Fe=t=>(e,o,n)=>{let r=e.getPreviousSibling(),i=e.getNextSibling(),l=xd(t==="check"?n[3]==="x":void 0);if(Mo(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(Mo(r)&&r.getListType()===t)r.append(l),e.remove();else{let a=bd(t,t==="number"?Number(n[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(n[1].length/Mi);s&&l.setIndent(s)},Ie=(t,e,o)=>{let n=[],r=t.getChildren(),i=0;for(let l of r)if(_d(l)){if(l.getChildrenSize()===1){let c=l.getFirstChild();if(Mo(c)){n.push(Ie(c,e,o+1));continue}}let s=" ".repeat(o*Mi),a=t.getListType(),u=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";n.push(s+u+e(l)),i++}return n.join(`
|
|
35
|
-
`)};var Di={type:"element",dependencies:[wd,Ed],export:(t,e)=>Td(t)?Ie(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Fe("check")};import{jsx as kd}from"react/jsx-runtime";import{CheckListPlugin as Nd}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Ai=()=>kd(Nd,{});var Fi=[q([{ChildComponent:vo,isActive:({selection:t})=>{if(!Id(t))return!1;for(let e of t.getNodes()){if(Do(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Do(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(Do(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Oi,void 0)},order:12}])],Sd=y(({featureProviderMap:t})=>{let e=[{Component:Ai,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:De,position:"normal"}),{markdownTransformers:[Di],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Rd,Ld],plugins:e,slashMenu:{groups:[Ae([{Icon:vo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Oi,void 0)}}])]},toolbarFixed:{groups:Fi},toolbarInline:{groups:Fi}}});import{$isListNode as Fo,INSERT_ORDERED_LIST_COMMAND as Bi,ListItemNode as Ad,ListNode as Fd}from"@lexical/list";import{$isRangeSelection as Od}from"lexical";import{jsx as ot,jsxs as yd}from"react/jsx-runtime";import"react";var Ao=()=>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:[ot("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"}),ot("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"}),ot("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as vd,ListItemNode as Md,ListNode as Dd}from"@lexical/list";var $i={type:"element",dependencies:[Dd,Md],export:(t,e)=>vd(t)?Ie(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Fe("number")};var Pi=[q([{ChildComponent:Ao,isActive:({selection:t})=>{if(!Od(t))return!1;for(let e of t.getNodes()){if(Fo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Fo(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(Fo(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Bi,void 0)},order:10}])],$d=y(({featureProviderMap:t})=>({markdownTransformers:[$i],nodes:t.has("orderedList")?[]:[Fd,Ad],plugins:t.has("orderedList")?[]:[{Component:De,position:"normal"}],slashMenu:{groups:[Ae([{Icon:Ao,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Bi,void 0)}}])]},toolbarFixed:{groups:Pi},toolbarInline:{groups:Pi}}));import{$isListNode as $o,INSERT_UNORDERED_LIST_COMMAND as Gi,ListItemNode as Gd,ListNode as Ud}from"@lexical/list";import{$isRangeSelection as Wd}from"lexical";import{jsx as Oe,jsxs as Pd}from"react/jsx-runtime";import"react";var Oo=()=>Pd("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:[Oe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Oe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Oe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Oe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Oe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Oe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Bd,ListItemNode as Hd,ListNode as jd}from"@lexical/list";var Hi={type:"element",dependencies:[jd,Hd],export:(t,e)=>Bd(t)?Ie(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Fe("bullet")};var ji=[q([{ChildComponent:Oo,isActive:({selection:t})=>{if(!Wd(t))return!1;for(let e of t.getNodes()){if($o(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if($o(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!($o(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)},order:11}])],Vd=y({markdownTransformers:[Hi],nodes:[Ud,Gd],plugins:[{Component:De,position:"normal"}],slashMenu:{groups:[Ae([{Icon:Oo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)}}])]},toolbarFixed:{groups:ji},toolbarInline:{groups:ji}});import{jsx as Kd}from"react/jsx-runtime";import{addClassNamesToElement as zd}from"@lexical/utils";import{DecoratorNode as Zd}from"lexical";import*as Ui from"react";var Xd=Ui.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),rt=class t extends Zd{__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 Yd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return zd(o,"unknownConverted"),o}decorate(){return Kd(Xd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Yd({data:t}){return new rt({data:t})}var Jd=y(()=>({nodes:[rt]}));import{jsx as qd}from"react/jsx-runtime";import{addClassNamesToElement as Qd}from"@lexical/utils";import{DecoratorNode as em}from"lexical";import*as Wi from"react";var tm=Wi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),nt=class t extends em{__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 om({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Qd(o,"unknownConverted"),o}decorate(){return qd(tm,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function om({data:t}){return new nt({data:t})}var rm=y(()=>({nodes:[nt]}));import{$setBlocksType as zi}from"@lexical/selection";import{$createParagraphNode as Zi,$getSelection as Xi,$isParagraphNode as Vi,$isRangeSelection as nm}from"lexical";var Ki=[q([{ChildComponent:ze,isActive:({selection:t})=>{if(!nm(t))return!1;for(let e of t.getNodes())if(!Vi(e)&&!Vi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Xi();zi(e,()=>Zi())})},order:1}])],im=y({slashMenu:{groups:[Z([{Icon:ze,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Xi();zi(e,()=>Zi())})}}])]},toolbarFixed:{groups:Ki},toolbarInline:{groups:Ki}});import{$isNodeSelection as $m}from"lexical";import{jsx as it,jsxs as lm}from"react/jsx-runtime";import"react";var Po=()=>lm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[it("g",{clipPath:"url(#clip0_4397_10817)",children:it("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"})}),it("defs",{children:it("clipPath",{id:"clip0_4397_10817",children:it("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as wm}from"react/compiler-runtime";import{jsx as km}from"react/jsx-runtime";import{useLexicalComposerContext as Nm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Lm}from"@lexical/utils";import{useConfig as Rm}from"@payloadcms/ui";import{$getPreviousSelection as Im,$getSelection as Sm,$isParagraphNode as ol,$isRangeSelection as ym,COMMAND_PRIORITY_EDITOR as vm,createCommand as Mm}from"lexical";import{useEffect as Dm}from"react";import{c as xm}from"react/compiler-runtime";import{jsx as Pt}from"react/jsx-runtime";import{useLexicalComposerContext as bm}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as _m,COMMAND_PRIORITY_EDITOR as Tm}from"lexical";import{useEffect as qi,useState as Qi}from"react";import{c as sm}from"react/compiler-runtime";import{jsx as am}from"react/jsx-runtime";import{useLexicalComposerContext as cm}from"@lexical/react/LexicalComposerContext";import{useListDrawer as um,useModal as dm}from"@payloadcms/ui";import{$getNodeByKey as Yi,$getPreviousSelection as mm,$getRoot as pm,$getSelection as fm,$isRangeSelection as hm,$setSelection as gm}from"lexical";import{useEffect as Cm,useState as Ji}from"react";var lt=t=>{let e=sm(23),[o]=cm(),[n,r]=Ji(null),[i,l]=Ji(!1),[s,a,u]=um(t),{closeDrawer:c,drawerSlug:d,isDrawerOpen:m,openDrawer:p}=u,{modalState:f}=dm(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let L=fm()??mm();r(L)},e[0]=h):h=e[0];let C=h,w;e[1]!==o||e[2]!==n?(w=()=>{n&&o.update(()=>{if(hm(n)){let{anchor:L,focus:I}=n;Yi(L.key)&&Yi(I.key)&&gm(n.clone())}else pm().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=w):w=e[3];let v=w,D;e[4]!==c?(D=()=>{c()},e[4]=c,e[5]=D):D=e[5];let x=D,E,g;e[6]!==d||e[7]!==f||e[8]!==v||e[9]!==i?(E=()=>{if(!i)return;let L=f[d];L&&!L?.isOpen&&(l(!1),setTimeout(()=>{v()},1))},g=[f,d,v,i],e[6]=d,e[7]=f,e[8]=v,e[9]=i,e[10]=E,e[11]=g):(E=e[10],g=e[11]),Cm(E,g);let _;e[12]!==a?(_=L=>am(a,{...L,onClick:()=>{C()}}),e[12]=a,e[13]=_):_=e[13];let N;e[14]!==p?(N=()=>{C(),p(),l(!0)},e[14]=p,e[15]=N):N=e[15];let k;return e[16]!==s||e[17]!==x||e[18]!==m||e[19]!==d||e[20]!==_||e[21]!==N?(k={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:d,ListDrawerToggler:_,openListDrawer:N},e[16]=s,e[17]=x,e[18]=m,e[19]=d,e[20]=_,e[21]=N,e[22]=k):k=e[22],k};var Em=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=_m(o);r&&r.replace(Ue({relationTo:e,value:n}))}):t.dispatchCommand(Bo,{relationTo:e,value:n})},el=t=>{let e=xm(21),{enabledCollectionSlugs:o}=t,[n]=bm(),r;e[0]!==o?(r=()=>o?.[0],e[0]=o,e[1]=r):r=e[1];let[i,l]=Qi(r),[s,a]=Qi(null),u=o||void 0,c;e[2]!==i||e[3]!==u?(c={collectionSlugs:u,selectedCollection:i},e[2]=i,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,isListDrawerOpen:m,ListDrawer:p,openListDrawer:f}=lt(c),h,C;e[5]!==n||e[6]!==f?(h=()=>n.registerCommand(je,g=>(a(g?.replace?g?.replace.nodeKey:null),f(),!0),Tm),C=[n,f],e[5]=n,e[6]=f,e[7]=h,e[8]=C):(h=e[7],C=e[8]),qi(h,C);let w;e[9]!==d||e[10]!==n||e[11]!==s?(w=g=>{let{collectionSlug:_,docID:N}=g;Em({editor:n,relationTo:_,replaceNodeKey:s,value:N}),d()},e[9]=d,e[10]=n,e[11]=s,e[12]=w):w=e[12];let v=w,D;e[13]!==o?(D=()=>{l(o?.[0])},e[13]=o,e[14]=D):D=e[14];let x;e[15]!==o||e[16]!==m?(x=[m,o],e[15]=o,e[16]=m,e[17]=x):x=e[17],qi(D,x);let E;return e[18]!==p||e[19]!==v?(E=Pt(p,{onSelect:v}),e[18]=p,e[19]=v,e[20]=E):E=e[20],E},tl=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Pt(el,{...t}):Pt(bt,{...t,children:Pt(el,{...t})});var Bo=Mm("INSERT_RELATIONSHIP_COMMAND"),rl=t=>{let e=wm(10),{clientProps:o}=t,[n]=Nm(),{config:r}=Rm(),{collections:i}=r,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let c;if(e[0]!==o?.disabledCollections||e[1]!==i){let d;e[3]!==o?.disabledCollections?(d=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o?.disabledCollections,e[4]=d):d=e[4],c=i.filter(d).map(Am),e[0]=o?.disabledCollections,e[1]=i,e[2]=c}else c=e[2];l=c}let s,a;e[5]!==n?(s=()=>{if(!n.hasNodes([Ge]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Bo,Om,vm)},a=[n],e[5]=n,e[6]=s,e[7]=a):(s=e[6],a=e[7]),Dm(s,a);let u;return e[8]!==l?(u=km(tl,{enabledCollectionSlugs:l}),e[8]=l,e[9]=u):u=e[9],u};function Am(t){let{slug:e}=t;return e}function Fm(t){return ol(t)}function Om(t){let e=Sm()||Im();if(ym(e)){let o=Ue(t);Lm(o);let{focus:n}=e,r=n.getNode();ol(r)&&r.getTextContentSize()===0&&r.getParentOrThrow().getChildren().filter(Fm).length>1&&r.remove()}return!0}var Pm=y({nodes:[Ge],plugins:[{Component:rl,position:"normal"}],slashMenu:{groups:[Z([{Icon:Po,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,{replace:!1})}}])]},toolbarFixed:{groups:[me([{ChildComponent:Po,isActive:({selection:t})=>{if(!$m(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return lo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,{replace:!1})}}])]}});import{c as ul}from"react/compiler-runtime";import{jsx as ne,jsxs as op}from"react/jsx-runtime";import{useLexicalComposerContext as rp}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as np,useThrottledEffect as ip,useTranslation as lp}from"@payloadcms/ui";import*as Ce from"react";import{useMemo as sp}from"react";import{c as Bm}from"react/compiler-runtime";import{jsx as Hm}from"react/jsx-runtime";import{mergeRegister as jm}from"@lexical/utils";import{$addUpdateTag as Gm,$getSelection as Um}from"lexical";import{useEffect as Bt,useState as Ho}from"react";var jo="toolbar-popup__button",st=t=>{let e=Bm(34),{children:o,editor:n,item:r}=t,[i,l]=Ho(!0),[s,a]=Ho(!1),[u,c]=Ho(jo),d=B(),m;e[0]!==s||e[1]!==n||e[2]!==d||e[3]!==i||e[4]!==r?(m=()=>{n.getEditorState().read(()=>{let N=Um();if(N){if(r.isActive){let k=r.isActive({editor:n,editorConfigContext:d,selection:N});s!==k&&a(k)}if(r.isEnabled){let k=r.isEnabled({editor:n,editorConfigContext:d,selection:N});i!==k&&l(k)}}})},e[0]=s,e[1]=n,e[2]=d,e[3]=i,e[4]=r,e[5]=m):m=e[5];let p=m,f,h;e[6]!==p?(f=()=>{p()},h=[p],e[6]=p,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Bt(f,h);let C,w;e[9]!==p?(C=()=>(document.addEventListener("mouseup",p),()=>{document.removeEventListener("mouseup",p)}),w=[p],e[9]=p,e[10]=C,e[11]=w):(C=e[10],w=e[11]),Bt(C,w);let v,D;e[12]!==n||e[13]!==p?(v=()=>jm(n.registerUpdateListener(()=>{p()})),D=[n,p],e[12]=n,e[13]=p,e[14]=v,e[15]=D):(v=e[14],D=e[15]),Bt(v,D);let x;e[16]!==s||e[17]!==i||e[18]!==r.key?(x=()=>{c([jo,i===!1?"disabled":"",s?"active":"",r?.key?`${jo}-`+r.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=i,e[18]=r.key,e[19]=x):x=e[19];let E;e[20]!==s||e[21]!==u||e[22]!==i||e[23]!==r.key?(E=[i,s,u,r.key],e[20]=s,e[21]=u,e[22]=i,e[23]=r.key,e[24]=E):E=e[24],Bt(x,E);let g;e[25]!==s||e[26]!==n||e[27]!==i||e[28]!==r?(g=()=>{if(i!==!1)return n.focus(()=>{n.update(Wm),r.onSelect?.({editor:n,isActive:s})}),!0},e[25]=s,e[26]=n,e[27]=i,e[28]=r,e[29]=g):g=e[29];let _;return e[30]!==o||e[31]!==u||e[32]!==g?(_=Hm("button",{className:u,onClick:g,onMouseDown:Vm,type:"button",children:o}),e[30]=o,e[31]=u,e[32]=g,e[33]=_):_=e[33],_};function Wm(){Gm("toolbar")}function Vm(t){t.preventDefault()}import{c as cl}from"react/compiler-runtime";import{jsx as $e}from"react/jsx-runtime";import Wo,{useEffect as al}from"react";import{mergeRegister as qm}from"@lexical/utils";import{useTranslation as Qm}from"@payloadcms/ui";import{$getSelection as ep}from"lexical";import{jsx as Te,jsxs as nl}from"react/jsx-runtime";import{Button as Km}from"@payloadcms/ui";import{$addUpdateTag as zm}from"lexical";import Ht,{useCallback as Zm,useEffect as at,useMemo as Xm,useRef as Uo,useState as jt}from"react";import{createPortal as Ym}from"react-dom";var Go="toolbar-popup__dropdown-item",il=Ht.createContext(null);function ll({active:t,children:e,editor:o,enabled:n,Icon:r,item:i,tooltip:l}){let[s,a]=jt(Go);at(()=>{a([Go,n===!1?"disabled":"",t?"active":"",i?.key?`${Go}-${i.key}`:""].filter(Boolean).join(" "))},[n,t,s,i.key]);let u=Uo(null),c=Ht.useContext(il);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:d}=c;return at(()=>{u?.current!=null&&d(u)},[u,d]),Te(Km,{"aria-label":l,buttonStyle:"none",className:s,disabled:n===!1,icon:r,iconPosition:"left",iconStyle:"none",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{zm("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:u,tooltip:l,type:"button",children:e})}function Jm({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:n}){let[r,i]=jt(),[l,s]=jt(),a=Zm(d=>{i(m=>m!=null?[...m,d]:[d])},[i]),u=d=>{if(r==null)return;let{key:m}=d;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&d.preventDefault(),m==="Escape"||m==="Tab"?n():m==="ArrowUp"?s(p=>{if(p==null)return r[0];let f=r.indexOf(p)-1;return r[f===-1?r.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?r[0]:r[r.indexOf(p)+1])},c=Xm(()=>({registerItem:a}),[a]);return at(()=>{r!=null&&l==null&&s(r[0]),l!=null&&l?.current!=null&&l.current.focus()},[r,l]),Te(il.Provider,{value:c,children:Te("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:u,ref:e,children:t})})}function sl({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,Icon:r,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=Uo(null),u=Uo(null),[c,d]=jt(!1),m=()=>{d(!1),u?.current!=null&&u.current.focus()};at(()=>{let f=u.current,h=a.current;if(c&&f!==null&&h!==null){let{left:C,top:w}=f.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;h.style.top=`${w+v+f.offsetHeight+5}px`,h.style.left=`${Math.min(C-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,u,c]),at(()=>{let f=u.current;if(f!==null&&c){let h=C=>{let{target:w}=C;s!=null&&a.current!=null&&a.current.contains(w)||f.contains(w)||d(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,u,c,s]);let p=Ym(Te(Jm,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return nl(Ht.Fragment,{children:[nl("button",{"aria-label":t,className:e+(c?" active":""),disabled:n,onClick:f=>{f.preventDefault(),d(!c)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[r&&Te(r,{}),l&&Te("span",{className:"toolbar-popup__dropdown-label",children:l}),Te("i",{className:"toolbar-popup__dropdown-caret"})]}),c&&Te(Ht.Fragment,{children:p})]})}var Vo="toolbar-popup__dropdown",tp=t=>{let e=cl(18),{active:o,anchorElem:n,editor:r,enabled:i,item:l}=t,{i18n:s}=Qm(),{fieldProps:a}=B(),{featureClientSchemaMap:u,schemaPath:c}=a;if(l.Component){let f;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==i||e[4]!==l?(f=l?.Component&&$e(l.Component,{active:o,anchorElem:n,editor:r,enabled:i,item:l},l.key),e[0]=o,e[1]=n,e[2]=r,e[3]=i,e[4]=l,e[5]=f):f=e[5],f}let d=l.key,m;if(l.label){let f;e[6]!==u||e[7]!==s||e[8]!==l||e[9]!==c?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:u,i18n:s,schemaPath:c}):l.label,e[6]=u,e[7]=s,e[8]=l,e[9]=c,e[10]=f):f=e[10],d=f}d.length>25?m=d.substring(0,25)+"...":m=d;let p;return e[11]!==o||e[12]!==m||e[13]!==r||e[14]!==i||e[15]!==l||e[16]!==d?(p=$e(ll,{active:o,editor:r,enabled:i,Icon:l?.ChildComponent?$e(l.ChildComponent,{}):void 0,item:l,tooltip:d,children:$e("span",{className:"text",children:m})},l.key),e[11]=o,e[12]=m,e[13]=r,e[14]=i,e[15]=l,e[16]=d,e[17]=p):p=e[17],p},Se=t=>{let e=cl(36),{anchorElem:o,classNames:n,editor:r,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:u,onActiveChange:c}=t,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[m,p]=Wo.useState(d),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,C]=Wo.useState(f),[w,v]=Wo.useState(!0),D=B(),{items:x,key:E}=i,g;e[2]!==r||e[3]!==D||e[4]!==i||e[5]!==x||e[6]!==u||e[7]!==c?(g=()=>{r.getEditorState().read(()=>{let $=ep();if(!$)return;let W=[],J=[],U=[];for(let H of x)H.isActive&&(!u||W.length<u)&&H.isActive({editor:r,editorConfigContext:D,selection:$})&&(W.push(H.key),J.push(H)),H.isEnabled?H.isEnabled({editor:r,editorConfigContext:D,selection:$})&&U.push(H.key):U.push(H.key);i.isEnabled&&v(i.isEnabled({editor:r,editorConfigContext:D,selection:$})),p(W),C(U),c&&c({activeItems:J})})},e[2]=r,e[3]=D,e[4]=i,e[5]=x,e[6]=u,e[7]=c,e[8]=g):g=e[8];let _=g,N,k;e[9]!==_?(N=()=>{_()},k=[_],e[9]=_,e[10]=N,e[11]=k):(N=e[10],k=e[11]),al(N,k);let L,I;e[12]!==r||e[13]!==_?(L=()=>qm(r.registerUpdateListener(()=>{_()})),I=[r,_],e[12]=r,e[13]=_,e[14]=L,e[15]=I):(L=e[14],I=e[15]),al(L,I);let b=`${E} dropdown`,T=`${Vo}-${E}`,S;e[16]!==n?(S=n||[],e[16]=n,e[17]=S):S=e[17];let R;e[18]!==S||e[19]!==T?(R=[Vo,T,...S].filter(Boolean),e[18]=S,e[19]=T,e[20]=R):R=e[20];let A=R.join(" "),M=!w,O;e[21]!==s?(O=s||[],e[21]=s,e[22]=O):O=e[22];let G;return e[23]!==l||e[24]!==m||e[25]!==o||e[26]!==r||e[27]!==h||e[28]!==E||e[29]!==x||e[30]!==a||e[31]!==A||e[32]!==M||e[33]!==O||e[34]!==b?(G=$e(sl,{buttonAriaLabel:b,buttonClassName:A,disabled:M,Icon:l,itemsContainerClassNames:[`${Vo}-items`,...O],label:a,children:x.length?x.map($=>$e(tp,{active:m.includes($.key),anchorElem:o,editor:r,enabled:h.includes($.key),item:$},$.key)):null},E),e[23]=l,e[24]=m,e[25]=o,e[26]=r,e[27]=h,e[28]=E,e[29]=x,e[30]=a,e[31]=A,e[32]=M,e[33]=O,e[34]=b,e[35]=G):G=e[35],G};function ap({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ne(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ne(st,{editor:e,item:o,children:ne(o.ChildComponent,{})},o.key):null}function cp(t){let e=ul(23),{anchorElem:o,editor:n,editorConfig:r,group:i,index:l}=t,{i18n:s}=lp(),{fieldProps:a}=B(),{featureClientSchemaMap:u,schemaPath:c}=a,[d,m]=Ce.useState(void 0),[p,f]=Ce.useState(void 0),h;e[0]!==i.ChildComponent||e[1]!==i.items||e[2]!==i.type?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},e[0]=i.ChildComponent,e[1]=i.items,e[2]=i.type,e[3]=h):h=e[3];let C;e[4]!==i?(C=[i],e[4]=i,e[5]=C):C=e[5],Ce.useEffect(h,C);let w;e[6]!==u||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==c?(w=E=>{let{activeItems:g}=E;if(!g.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let _=g[0],N=_.key;_.label&&(N=typeof _.label=="function"?_.label({featureClientSchemaMap:u,i18n:s,schemaPath:c}):_.label),N.length>25&&(N=N.substring(0,25)+"..."),g.length===1?(m(N),f(()=>_.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=u,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=c,e[12]=w):w=e[12];let v=w,D=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,x;return e[13]!==p||e[14]!==o||e[15]!==d||e[16]!==n||e[17]!==r.features.toolbarFixed?.groups.length||e[18]!==i||e[19]!==l||e[20]!==v||e[21]!==D?(x=op("div",{className:D,children:[i.type==="dropdown"&&i.items.length?p?ne(Se,{anchorElem:o,editor:n,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:d,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):ne(Se,{anchorElem:o,editor:n,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:d,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):null,i.type==="buttons"&&i.items.length?i.items.map(E=>ne(ap,{anchorElem:o,editor:n,item:E},E.key)):null,l<r.features.toolbarFixed?.groups.length-1&&ne("div",{className:"divider"})]},i.key),e[13]=p,e[14]=o,e[15]=d,e[16]=n,e[17]=r.features.toolbarFixed?.groups.length,e[18]=i,e[19]=l,e[20]=v,e[21]=D,e[22]=x):x=e[22],x}function up({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let i=Ce.useRef(null),{y:l}=np(),s=sp(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let u=r.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return ip(()=>{if(!s)return;let a=i.current;if(!a)return;let u=a.getBoundingClientRect(),c=s.getBoundingClientRect();if(!(u.bottom<c.top||u.top>c.bottom))a.classList.remove("fixed-toolbar"),a.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.classList.remove("fixed-toolbar--overlapping"),a.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),ne("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&ne(Ce.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((a,u)=>ne(cp,{anchorElem:t,editor:o,editorConfig:n,group:a,index:u},a.key))})})}var dl=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return dl(t.parentEditor)}return!1},ml=t=>{let e=ul(6),{clientProps:o}=t,[n]=rp(),r=B(),{editorConfig:i}=r,l=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,s=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||i,a,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==r){u=Symbol.for("react.early_return_sentinel");e:{let c=dl(r);if(o?.disableIfParentHasFixedToolbar&&c){u=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){u=null;break e}a=ne(up,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:c})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=s,e[3]=r,e[4]=a,e[5]=u}else a=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:a};var dp=y({plugins:[{Component:ml,position:"aboveContainer"}]});import{c as hl}from"react/compiler-runtime";import{jsx as se,jsxs as gl}from"react/jsx-runtime";import{useLexicalComposerContext as mp}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Cl}from"@lexical/utils";import{$getSelection as xl,$isRangeSelection as pl,$isTextNode as pp,COMMAND_PRIORITY_LOW as fp,SELECTION_CHANGE_COMMAND as hp}from"lexical";import{useCallback as Ut,useEffect as ct,useRef as fl,useState as gp}from"react";import*as Wt from"react";import{createPortal as Cp}from"react-dom";function Ko(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function Gt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:u=10}=t,c=o.parentElement;if(a===null||c==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let d=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),f=a.top-d.height-u,h=a.left-i;l==="center"&&(h=a.left+a.width/2-d.width/2);let C=0;return!e&&f<p.top&&!s&&(C=d.height+a.height+u*2,f+=C),l==="center"?h+d.width>p.right?h=p.right-d.width-i:h<p.left&&(h=p.left+i):h+d.width>p.right&&(h=p.right-d.width-i),h-=m.left,r.style.opacity="1",s&&n!==0?(f-=m.bottom-n+d.height-3,r.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,r.style.transform=`translate(${h}px, ${f}px)`),C}function xp({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(st,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function bp(t){let e=hl(19),{anchorElem:o,editor:n,group:r,index:i}=t,{editorConfig:l}=B(),[s,a]=Wt.useState(),u;e[0]!==r.ChildComponent||e[1]!==r.items||e[2]!==r.type?(u=()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0)},e[0]=r.ChildComponent,e[1]=r.items,e[2]=r.type,e[3]=u):u=e[3];let c;e[4]!==r?(c=[r],e[4]=r,e[5]=c):c=e[5],Wt.useEffect(u,c);let d;e[6]!==r.ChildComponent||e[7]!==r.items||e[8]!==r.type?(d=h=>{let{activeItems:C}=h;if(!C.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0);return}let w=C[0];a(()=>w.ChildComponent)},e[6]=r.ChildComponent,e[7]=r.items,e[8]=r.type,e[9]=d):d=e[9];let m=d,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${r.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==n||e[13]!==l.features.toolbarInline?.groups.length||e[14]!==r||e[15]!==i||e[16]!==m||e[17]!==p?(f=gl("div",{className:p,children:[r.type==="dropdown"&&r.items.length?s?se(Se,{anchorElem:o,editor:n,group:r,Icon:s,maxActiveItems:r.maxActiveItems??1,onActiveChange:m}):se(Se,{anchorElem:o,editor:n,group:r,maxActiveItems:r.maxActiveItems??1,onActiveChange:m}):null,r.type==="buttons"&&r.items.length?r.items.map(h=>se(xp,{anchorElem:o,editor:n,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&se("div",{className:"divider"})]},r.key),e[10]=s,e[11]=o,e[12]=n,e[13]=l.features.toolbarInline?.groups.length,e[14]=r,e[15]=i,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function _p({anchorElem:t,editor:e}){let o=fl(null),n=fl(null),{editorConfig:r}=B(),i=Ut(()=>{if(o?.current){let u=o.current.style.opacity==="0",c=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),c||(o.current.style.pointerEvents="none")}},[o]),l=Ut(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";if(!c||!d){let m=u.clientX,p=u.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Ut(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ct(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ut(()=>{let u=xl(),c=window.getSelection();if(o.current===null)return;let d=t.querySelector(":scope > .link-editor"),m=d!==null&&"style"in d&&d?.style?.opacity==="1",p=e.getRootElement();if(u!==null&&c!==null&&!c.isCollapsed&&p!==null&&p.contains(c.anchorNode)){let f=Ko(c,p),h=Gt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&Gt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ct(()=>{let u=t.parentElement,c=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",c),u&&u.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),u&&u.removeEventListener("scroll",c)}},[e,a,t]),ct(()=>(e.getEditorState().read(()=>{a()}),Cl(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{a()})}),e.registerCommand(hp,()=>(a(),!1),fp))),[e,a]),gl("div",{className:"inline-toolbar-popup",ref:o,children:[se("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((u,c)=>se(bp,{anchorElem:t,editor:e,group:u,index:c},u.key))]})}function Tp(t,e){let o=hl(12),[n,r]=gp(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=xl(),p=window.getSelection(),f=t.getRootElement();if(p!==null&&(!pl(m)||f===null||!f.contains(p.anchorNode))){r(!1);return}if(!pl(m))return;if(m.getTextContent()!==""){let C=m.getNodes(),w=!1;for(let v of C)if(pp(v)){r(!0),w=!0;break}w||r(!1)}else r(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){r(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),ct(s,a);let u,c;if(o[5]!==t||o[6]!==l?(u=()=>Cl(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),c=[t,l],o[5]=t,o[6]=l,o[7]=u,o[8]=c):(u=o[7],c=o[8]),ct(u,c),!n||!t.isEditable())return null;let d;return o[9]!==e||o[10]!==t?(d=Cp(se(_p,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=d):d=o[11],d}var bl=t=>{let{anchorElem:e}=t,[o]=mp();return Tp(o,e)};var Ep=y({plugins:[{Component:bl,position:"floatingAnchorElem"}]});import{TableCellNode as c1,TableNode as u1,TableRowNode as d1}from"@lexical/table";import{jsx as _l}from"react/jsx-runtime";import"react";var zo=()=>_l("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_l("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 vp,$createTableNode as Mp,$createTableRowNode as Dp,$isTableCellNode as Il,$isTableNode as Zo,$isTableRowNode as Xo,TableCellHeaderStates as Vt,TableCellNode as Ap,TableNode as Fp,TableRowNode as Op}from"@lexical/table";import{$isParagraphNode as $p,$isTextNode as Pp}from"lexical";var Tl=/^[\t ]*$/,wp=/^(\s*)(\d+)\.\s/,kp=/^(\s*)[-*+]\s/,Np=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,El=/^(#{1,6})\s/,Lp=/^>\s/,wl=/^[ \t]*```(\w+)?/,kl=/[ \t]*```$/,Rp=/^[ \t]*```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*```(?:[^`]|$)/,Ip=/^\|(.+)\|\s?$/,Sp=/^(\| ?:?-*:? ?)+\|\s?$/,Nl=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,Ll=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function yp(t,e=!1){let o=t.split(`
|
|
36
|
-
`),n=!1,r=[];for(let i=0;i<o.length;i++){let l=o[i],s=r[r.length-1];if(Rp.test(l)){r.push(l);continue}if(
|
|
37
|
-
`)}function
|
|
38
|
-
`)},regExp:
|
|
39
|
-
`);let o=vp(Vt.NO_STATUS);return Rl(t,e,o),o},Sl=(t,e)=>{let o=t.match(yl);return!o||!o[1]?null:o[1].split("|").map(n=>Ml(n,e))};import{c as Gp}from"react/compiler-runtime";import{jsx as P,jsxs as xe}from"react/jsx-runtime";import{useLexicalComposerContext as Ol}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Up}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Wp,$deleteTableRow__EXPERIMENTAL as Vp,$getNodeTriplet as Kp,$getTableCellNodeFromLexicalNode as zp,$getTableColumnIndexFromTableCellNode as Zp,$getTableNodeFromLexicalNodeOrThrow as ut,$getTableRowIndexFromTableCellNode as Xp,$insertTableColumn__EXPERIMENTAL as Yp,$insertTableRow__EXPERIMENTAL as Jp,$isTableCellNode as Kt,$isTableRowNode as Al,$isTableSelection as Zt,$unmergeCell as qp,getTableObserverFromTableElement as Qp,TableCellHeaderStates as Ee,TableCellNode as ef}from"@lexical/table";import{useScrollInfo as tf}from"@payloadcms/ui";import{$createParagraphNode as of,$getRoot as rf,$getSelection as Xt,$isElementNode as nf,$isParagraphNode as $l,$isRangeSelection as qo,$isTextNode as lf}from"lexical";import*as Qo from"react";import{useCallback as ae,useEffect as ye,useRef as zt,useState as Pe}from"react";import{createPortal as Pl}from"react-dom";import{jsx as Yo,jsxs as jp}from"react/jsx-runtime";import"react";var Dl=()=>jp("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Yo("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"}),Yo("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"}),Yo("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 Jo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function sf(){let t=Xt();if(qo(t)&&!t.isCollapsed()||Zt(t)&&!t.anchor.is(t.focus)||!qo(t)&&!Zt(t))return!1;let[e]=Kp(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Fl(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!$l(e)||!e.isEmpty())}function af(t){let e=t.getLastDescendant();lf(e)?e.select():nf(e)?e.selectEnd():e!==null&&e.selectNext()}function cf({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=Ol(),l=zt(null),[s,a]=Pe(r),[u,c]=Pe({columns:1,rows:1}),[d,m]=Pe(!1),[p,f]=Pe(!1),{y:h}=tf();ye(()=>i.registerMutationListener(ef,b=>{b.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),ye(()=>{i.getEditorState().read(()=>{let b=Xt();if(Zt(b)){let T=Jo(b);c(Jo(b)),m(T.columns>1||T.rows>1)}f(sf())})},[i]),ye(()=>{let b=e.current,T=l.current,S=i.getRootElement();if(b!=null&&T!=null&&S!=null){let R=S.getBoundingClientRect(),A=b.getBoundingClientRect();T.style.opacity="1";let M=T.getBoundingClientRect(),O=5,G=A.right+O;if(G+M.width>window.innerWidth||G+M.width>R.right){let W=A.left-M.width-O;G=(W<0?O:W)+window.pageXOffset}T.style.left=`${G+window.pageXOffset}px`;let $=A.top;if($+M.height>window.innerHeight){let W=A.bottom-M.height;$=(W<0?O:W)+window.pageYOffset}T.style.top=`${$}px`}},[e,l,i,h]),ye(()=>{function b(T){l.current!=null&&e.current!=null&&!l.current.contains(T.target)&&!e.current.contains(T.target)&&n(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[n,e]);let C=ae(()=>{i.update(()=>{if(s.isAttached()){let T=ut(s),S=i.getElementByKey(T.getKey());if(!S)throw new Error("Expected to find tableElement in DOM");let R=Qp(S);R!==null&&R.clearHighlight(),T.markDirty(),a(s.getLatest())}rf().selectStart()})},[i,s]),w=()=>{i.update(()=>{let b=Xt();if(Zt(b)){let{columns:T,rows:S}=Jo(b),R=b.getNodes(),A=null;for(let M=0;M<R.length;M++){let O=R[M];if(Kt(O))if(A===null){O.setColSpan(T).setRowSpan(S),A=O;let G=Fl(O),$;G&&$l($=O.getFirstChild())&&$.remove()}else Kt(A)&&(Fl(O)||A.append(...O.getChildren()),O.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(of()),af(A)),o()}})},v=()=>{i.update(()=>{qp()})},D=ae(b=>{i.update(()=>{Jp(b),o()})},[i,o]),x=ae(b=>{i.update(()=>{for(let T=0;T<u.columns;T++)Yp(b);o()})},[i,o,u.columns]),E=ae(()=>{i.update(()=>{Vp(),o()})},[i,o]),g=ae(()=>{i.update(()=>{ut(s).remove(),C(),o()})},[i,s,C,o]),_=ae(()=>{i.update(()=>{Wp(),o()})},[i,o]),N=ae(()=>{i.update(()=>{let b=ut(s),T=Xp(s),S=b.getChildren();if(T>=S.length||T<0)throw new Error("Expected table cell to be inside of table row.");let R=S[T];if(!Al(R))throw new Error("Expected table row");let A=s.getHeaderStyles()^Ee.ROW;R.getChildren().forEach(M=>{if(!Kt(M))throw new Error("Expected table cell");M.setHeaderStyles(A,Ee.ROW)}),C(),o()})},[i,s,C,o]),k=ae(()=>{i.update(()=>{let b=ut(s),T=Zp(s),S=b.getChildren(),R=Math.max(...S.map(M=>M.getChildren().length));if(T>=R||T<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^Ee.COLUMN;for(let M=0;M<S.length;M++){let O=S[M];if(!Al(O))throw new Error("Expected table row");let G=O.getChildren();if(T>=G.length)continue;let $=G[T];if(!Kt($))throw new Error("Expected table cell");$.setHeaderStyles(A,Ee.COLUMN)}C(),o()})},[i,s,C,o]),L=ae(()=>{i.update(()=>{if(s.isAttached()){let b=ut(s);b&&b.setRowStriping(!b.getRowStriping())}C(),o()})},[i,s,C,o]),I=null;return t&&(d?I=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:"Merge cells"}):p&&(I=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),Pl(xe("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[I?xe(Qo.Fragment,{children:[I,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>L(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>N(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>k(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function uf({anchorElem:t,cellMerge:e}){let[o]=Ol(),n=zt(null),r=zt(null),[i,l]=Pe(!1),[s,a]=Pe(null),u=ae(()=>{let d=n.current,m=Xt(),p=window.getSelection(),f=document.activeElement;if(m==null||d==null){a(null);return}let h=o.getRootElement();if(qo(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let C=zp(m.anchor.getNode());if(C==null){a(null);return}if(o.getElementByKey(C.getKey())==null){a(null);return}a(C)}else f||a(null)},[o]);ye(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{u()})})),ye(()=>{let d=n.current;if(d!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=d.getBoundingClientRect(),h=t.getBoundingClientRect(),C=p.top-h.top+4,w=p.right-f.width-10-h.left;d.style.opacity="1",d.style.transform=`translate(${w}px, ${C}px)`}else d.style.opacity="0",d.style.transform="translate(-10000px, -10000px)"}},[n,s,o,t]);let c=zt(s);return ye(()=>{c.current!==s&&l(!1),c.current=s},[c,s]),P("div",{className:"table-cell-action-button-container",ref:n,children:s!=null&&xe(Qo.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:d=>{d.stopPropagation(),l(!i)},ref:r,type:"button",children:P(Dl,{})}),i&&P(cf,{cellMerge:e,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var Bl=t=>{let e=Gp(3),{anchorElem:o}=t,n=Up(),r;return e[0]!==o||e[1]!==n?(r=Pl(n?P(uf,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as df}from"react/compiler-runtime";import{jsx as Jt,jsxs as mf}from"react/jsx-runtime";import{useLexicalComposerContext as pf}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ff}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as hf,$getTableNodeFromLexicalNodeOrThrow as er,$getTableRowIndexFromTableCellNode as gf,$isTableCellNode as Hl,$isTableRowNode as Cf,getDOMCellFromTarget as xf,TableNode as bf}from"@lexical/table";import{calculateZoomLevel as jl}from"@lexical/utils";import{$getNearestNodeFromDOMNode as tr}from"lexical";import*as Ul from"react";import{useCallback as dt,useEffect as or,useRef as Yt,useState as mt}from"react";import{createPortal as _f}from"react-dom";var Tf=33,Gl=92;function Ef({editor:t}){let e=Yt(null),o=Yt(null),n=Yt(null),r=B(),i=Yt(null),[l,s]=mt(null),[a,u]=mt(null),[c,d]=mt(!1),[m,p]=mt(null),f=dt(()=>{u(null),e.current=null,p(null),i.current=null,n.current=null},[]),h=k=>(k.buttons&1)===1;or(()=>t.registerNodeTransform(bf,k=>{if(k.getColWidths())return k;let L=k.getColumnCount(),I=Gl;return k.setColWidths(Array(L).fill(I)),k}),[t]),or(()=>{let k=T=>{setTimeout(()=>{let S=T.target;if(m){s({x:T.clientX,y:T.clientY});return}if(d(h(T)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let R=xf(S);R&&a!==R?t.update(()=>{let A=tr(R.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let M=er(A),O=t.getElementByKey(M.getKey());if(!O)throw new Error("TableCellResizer: Table element not found.");e.current=S,n.current=O.getBoundingClientRect(),u(R)}):R==null&&f()}},0)},L=T=>{setTimeout(()=>{d(!0)},0)},I=T=>{setTimeout(()=>{d(!1)},0)},b=t.registerRootListener((T,S)=>{S?.removeEventListener("mousemove",k),S?.removeEventListener("mousedown",L),S?.removeEventListener("mouseup",I),T?.addEventListener("mousemove",k),T?.addEventListener("mousedown",L),T?.addEventListener("mouseup",I)});return()=>{b()}},[a,m,t,f]);let C=k=>k==="bottom",w=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=tr(a.elem);if(!Hl(L))throw new Error("TableCellResizer: Table cell node not found.");let I=er(L),b=gf(L)+L.getRowSpan()-1,T=I.getChildren();if(b>=T.length||b<0)throw new Error("Expected table cell to be inside of table row.");let S=T[b];if(!Cf(S))throw new Error("Expected table row");let R=S.getHeight();if(R===void 0){let M=S.getChildren();R=Math.min(...M.map(O=>v(O,t)??1/0))}let A=Math.max(R+k,Tf);S.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(k,L)=>L.getElementByKey(k.getKey())?.clientHeight,D=(k,L)=>{for(let I=0;I<L.length;I++)for(let b=0;b<L[I].length;b++)if(L[I][b].cell===k)return b},x=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=tr(a.elem);if(!Hl(L))throw new Error("TableCellResizer: Table cell node not found.");let I=er(L),[b]=hf(I,null,null),T=D(L,b);if(T===void 0)throw new Error("TableCellResizer: Table column not found.");let S=I.getColWidths();if(!S)return;let R=S[T];if(R===void 0)return;let A=[...S],M=Math.max(R+k,Gl);A[T]=M,I.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),E=dt(k=>{let L=I=>{if(I.preventDefault(),I.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:b,y:T}=i.current;if(a===null)return;let S=jl(I.target);if(C(k)){let R=(I.clientY-T)/S;w(R)}else{let R=(I.clientX-b)/S;x(R)}f(),document.removeEventListener("mouseup",L)}};return L},[a,f,x,w]),g=dt(k=>L=>{if(L.preventDefault(),L.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:L.clientX,y:L.clientY},s(i.current),p(k),document.addEventListener("mouseup",E(k))},[a,E]),[_,N]=mt({bottom:null,left:null,right:null,top:null});return or(()=>{if(a){let{height:k,left:L,top:I,width:b}=a.elem.getBoundingClientRect(),T=jl(a.elem),S=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+I+k-S/2}px`,width:`${b}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${k}px`,left:`${window.scrollX+L+b-S/2}px`,top:`${window.scrollY+I}px`,width:`${S}px`}},A=n.current;m&&l&&A&&(C(m)?(R[m].left=`${window.scrollX+A.left}px`,R[m].top=`${window.scrollY+l.y/T}px`,R[m].height="3px",R[m].width=`${A.width}px`):(R[m].top=`${window.scrollY+A.top}px`,R[m].left=`${window.scrollX+l.x/T}px`,R[m].width="3px",R[m].height=`${A.height}px`),R[m].backgroundColor="#adf"),N(R)}else N({bottom:null,left:null,right:null,top:null})},[a,m,l]),Jt("div",{ref:o,children:a!=null&&!c&&mf(Ul.Fragment,{children:[Jt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("right"),style:_.right||void 0}),Jt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("bottom"),style:_.bottom||void 0})]})})}var Wl=()=>{let t=df(3),[e]=pf(),o=ff(),n,r;return t[0]!==e||t[1]!==o?(r=o?_f(Jt(Ef,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],n=r,n};import{c as yf}from"react/compiler-runtime";import{jsx as rr,jsxs as vf,Fragment as Mf}from"react/jsx-runtime";import{useLexicalComposerContext as ql}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as Df,$getTableRowIndexFromTableCellNode as Af,$insertTableColumn__EXPERIMENTAL as Ff,$insertTableRow__EXPERIMENTAL as Of,$isTableCellNode as $f,$isTableNode as zl,TableNode as Pf}from"@lexical/table";import{$findMatchingParent as Bf,mergeRegister as Hf}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Zl}from"lexical";import{useEffect as Xl,useMemo as jf,useRef as Yl,useState as qt}from"react";import"react";import{createPortal as Gf}from"react-dom";import{c as Rf}from"react/compiler-runtime";import{useEffect as If,useRef as Sf}from"react";var wf="Expected a function",kf=Math.max,Nf=Math.min;function Lf(t,e,o){let n,r,i=0,l,s=!1,a=!1,u,c,d,m=!0;if(typeof t!="function")throw new TypeError(wf);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,u=a?kf(o.maxWait||0,e):u,m="trailing"in o?!!o.trailing:m);function p(g){let _=n,N=l;return n=l=void 0,i=g,c=t.apply(N,_),c}function f(g){return i=g,d=setTimeout(w,e),s?p(g):c}function h(g){let _=g-r,N=g-i,k=e-_;return a?Nf(k,u-N):k}function C(g){let _=g-r,N=g-i;return r===void 0||_>=e||_<0||a&&N>=u}function w(){let g=Date.now();if(C(g))return v(g);d=setTimeout(w,h(g))}function v(g){return d=void 0,m&&n?p(g):(n=l=void 0,c)}function D(){d!==void 0&&clearTimeout(d),i=0,n=r=l=d=void 0}function x(){return d===void 0?c:v(Date.now())}function E(){let g=Date.now(),_=C(g);if(n=arguments,l=this,r=g,_){if(d===void 0)return f(r);if(a)return clearTimeout(d),d=setTimeout(w,e),p(r)}return d===void 0&&(d=setTimeout(w,e)),c}return E.cancel=D,E.flush=x,E}var Vl=Lf;function Kl(t,e,o){let n=Rf(6),r=Sf(null),i,l;n[0]!==t||n[1]!==o||n[2]!==e?(i=()=>(r.current=Vl(t,e,{maxWait:o}),()=>{r.current?.cancel()}),l=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=i,n[4]=l):(i=n[3],l=n[4]),If(i,l);let s;return n[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...u)=>{let c=u;r.current&&r.current(...c)},n[5]=s):s=n[5],s}var Jl=20;function Uf({anchorElem:t}){let[e]=ql(),o=B(),[n,r]=qt(!1),[i,l]=qt(!1),[s,a]=qt(!1),[u,c]=qt({}),d=Yl(new Set),m=Yl(null),p=Kl(C=>{let{isOutside:w,tableDOMNode:v}=Wf(C,o.editorConfig?.lexical);if(w){r(!1),l(!1);return}if(!v)return;m.current=v;let D=null,x=null,E=null;if(e.update(()=>{let g=Zl(v);if($f(g)){let _=Bf(g,N=>zl(N));if(!zl(_))return;if(E=e.getElementByKey(_?.getKey()),E){let N=_.getChildrenSize(),k=_.getChildAtIndex(0)?.getChildrenSize(),L=Af(g),I=Df(g);L===N-1?D=g:I===k-1&&(x=g)}}}),E){let{bottom:g,height:_,left:N,right:k,width:L,y:I}=E.getBoundingClientRect(),{left:b,y:T}=t.getBoundingClientRect();D?(l(!1),r(!0),c({height:Jl,left:N-b,top:g-T+5,width:L})):x&&(l(!0),r(!1),c({height:_,left:k-b+5,top:I-T,width:Jl}))}},50,250),f=jf(()=>new ResizeObserver(()=>{r(!1),l(!1)}),[]);Xl(()=>{if(s)return document.addEventListener("mousemove",p),()=>{r(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),Xl(()=>Hf(e.registerMutationListener(Pf,C=>{e.getEditorState().read(()=>{for(let[w,v]of C){let D=e.getElementByKey(w);switch(v){case"created":d.current.add(w),a(d.current.size>0),D&&f.observe(D);break;case"destroyed":d.current.delete(w),a(d.current.size>0),f.disconnect(),d.current.forEach(x=>{let E=e.getElementByKey(x);E&&f.observe(E)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{m.current&&(Zl(m.current)?.selectEnd(),C?(Of(),r(!1)):(Ff(),l(!1)))})};return e?.isEditable()?vf(Mf,{children:[n&&rr("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),i&&rr("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function Wf(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function Ql(t){let e=yf(2),{anchorElem:o}=t,n=o===void 0?document.body:o,[r]=ql();if(!r?.isEditable())return null;let i;return e[0]!==n?(i=Gf(rr(Uf,{anchorElem:n}),n),e[0]=n,e[1]=i):i=e[1],i}import{c as Vf}from"react/compiler-runtime";import{jsx as nr,jsxs as Kf}from"react/jsx-runtime";import{useLexicalComposerContext as zf}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Zf}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Xf,TableNode as Yf}from"@lexical/table";import{mergeRegister as Jf}from"@lexical/utils";import{formatDrawerSlug as qf,useEditDepth as Qf}from"@payloadcms/ui";import{$getSelection as e1,$isRangeSelection as t1,COMMAND_PRIORITY_EDITOR as o1,createCommand as r1}from"lexical";import{createContext as n1,useContext as i1,useEffect as l1,useMemo as s1,useState as a1}from"react";import*as es from"react";var Qt=r1("OPEN_EMBED_DRAWER_COMMAND"),ts=n1({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function os({children:t}){let[e,o]=a1({cellEditorConfig:null,cellEditorPlugins:null});return nr(ts.Provider,{value:s1(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var rs=()=>{let t=Vf(16),[e]=zf(),o=i1(ts),n=Qf(),{fieldProps:r,uuid:i}=B(),{schemaPath:l}=r,s="lexical-table-create-"+i,a;t[0]!==n||t[1]!==s?(a=qf({slug:s,depth:n}),t[0]=n,t[1]=s,t[2]=a):a=t[2];let u=a,{toggleDrawer:c}=ce(u,!0),d;t[3]!==e||t[4]!==c?(d=()=>{if(!e.hasNodes([Yf]))throw new Error("TablePlugin: TableNode is not registered on editor");return Jf(e.registerCommand(Qt,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=e1();t1(C)&&(h=C)}),h&&c(),!0},o1))},t[3]=e,t[4]=c,t[5]=d):d=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==c?(m=[o,e,c],t[6]=o,t[7]=e,t[8]=c,t[9]=m):m=t[9],l1(d,m);let p;t[10]!==e?(p=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand(Xf,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==u||t[13]!==l||t[14]!==p?(f=Kf(es.Fragment,{children:[nr(He,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),nr(Zf,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=u,t[13]=l,t[14]=p,t[15]=f):f=t[15],f};var m1=y({markdownTransformers:[vl],nodes:[u1,c1,d1],plugins:[{Component:rs,position:"normal"},{Component:Wl,position:"normal"},{Component:Bl,position:"floatingAnchorElem"},{Component:Ql,position:"floatingAnchorElem"}],providers:[os],slashMenu:{groups:[Z([{Icon:zo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]},toolbarFixed:{groups:[me([{ChildComponent:zo,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]}});import{$isNodeSelection as O1}from"lexical";import{jsx as ir,jsxs as p1}from"react/jsx-runtime";import"react";var lr=()=>p1("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:[ir("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"}),ir("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"}),ir("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as E1}from"react/compiler-runtime";import{jsx as w1}from"react/jsx-runtime";import{useLexicalComposerContext as k1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as N1,mergeRegister as L1}from"@lexical/utils";import{useConfig as R1}from"@payloadcms/ui";import{$getPreviousSelection as I1,$getSelection as S1,$isParagraphNode as y1,$isRangeSelection as v1,COMMAND_PRIORITY_EDITOR as M1,createCommand as D1}from"lexical";import{useEffect as A1}from"react";import{c as f1}from"react/compiler-runtime";import{jsx as sr}from"react/jsx-runtime";import{useLexicalComposerContext as h1}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as g1,COMMAND_PRIORITY_EDITOR as C1}from"lexical";import{useEffect as x1,useState as b1}from"react";var _1=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=g1(o);r&&r.replace(Ke({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(ar,{fields:null,relationTo:e,value:n})},T1=t=>{let e=f1(13),{enabledCollectionSlugs:o}=t,[n]=h1(),[r,i]=b1(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:u}=lt(l),c,d;e[2]!==n||e[3]!==u?(c=()=>n.registerCommand(We,h=>(i(h?.replace?h?.replace.nodeKey:null),u(),!0),C1),d=[n,u],e[2]=n,e[3]=u,e[4]=c,e[5]=d):(c=e[4],d=e[5]),x1(c,d);let m;e[6]!==s||e[7]!==n||e[8]!==r?(m=h=>{let{collectionSlug:C,docID:w}=h;s(),_1({editor:n,relationTo:C,replaceNodeKey:r,value:w})},e[6]=s,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,f;return e[10]!==a||e[11]!==p?(f=sr(a,{onSelect:p}),e[10]=a,e[11]=p,e[12]=f):f=e[12],f},ns=t=>sr(bt,{...t,uploads:!0,children:sr(T1,{...t})});var ar=D1("INSERT_UPLOAD_COMMAND"),is=t=>{let e=E1(5),[o]=k1(),{config:n}=R1(),{collections:r}=n,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return L1(o.registerCommand(ar,a=>(o.update(()=>{let u=S1()||I1();if(v1(u)){let c=Ke({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});N1(c);let{focus:d}=u,m=d.getNode();y1(m)&&!m.__first&&(m.__prev||m.__next)&&m.remove()}}),!0),M1))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),A1(i,l);let s;return e[3]!==r?(s=w1(ns,{enabledCollectionSlugs:r.map(F1)}),e[3]=r,e[4]=s):s=e[4],s};function F1(t){let{slug:e}=t;return e}var $1=y({nodes:[Ve],plugins:[{Component:is,position:"normal"}],slashMenu:{groups:[Z([{Icon:lr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]},toolbarFixed:{groups:[me([{ChildComponent:lr,isActive:({selection:t})=>{if(!O1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return so(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]}});import{c as P1}from"react/compiler-runtime";import{jsx as ur}from"react/jsx-runtime";import{ShimmerEffect as B1}from"@payloadcms/ui";import{lazy as H1,Suspense as j1,useEffect as G1,useState as U1}from"react";var ls={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var eo={namespace:"lexical",theme:ls};function ss({featureClientSchemaMap:t,field:e,schemaPath:o,unSanitizedEditorConfig:n}){for(let s of n.features)if(!s?.clientFeatureProps?.featureKey||s?.clientFeatureProps?.order===void 0||s?.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.");n.features=n.features.sort((s,a)=>s.clientFeatureProps.order-a.clientFeatureProps.order);let r=new Map;for(let s of n.features)r.set(s.clientFeatureProps.featureKey,s);let i=new Map,l=0;for(let s of n.features){let a=typeof s.feature=="function"?s.feature({featureClientSchemaMap:t,featureProviderMap:r,field:e,resolvedFeatures:i,schemaPath:o,unSanitizedEditorConfig:n}):s.feature;a.key=s.clientFeatureProps.featureKey,a.order=l,i.set(s.clientFeatureProps.featureKey,a),l++}return i}var as=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let n of o.nodes)e.nodes.push(n);if(o.plugins?.length&&o.plugins.forEach((n,r)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:n.Component,key:o.key+r,position:n.position})}),o.toolbarInline?.groups?.length)for(let n of o.toolbarInline.groups){let r=e.toolbarInline.groups.find(i=>i.key===n.key);r?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarInline?.groups.push(r)}if(o.toolbarFixed?.groups?.length)for(let n of o.toolbarFixed.groups){let r=e.toolbarFixed.groups.find(i=>i.key===n.key);r?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarFixed?.groups.push(r)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let n of o.slashMenu.groups){let r=e.slashMenu.groups.find(i=>i.key===n.key);r?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.slashMenu.groups.push(r)}}if(o.markdownTransformers?.length)for(let n of o.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);return e};function cr(t,e,o){return{admin:o,features:as(t),lexical:e,resolvedFeatureMap:t}}var W1=H1(()=>import("./Field-7XFZE2MU.js").then(t=>({default:t.RichText}))),V1=t=>{let e=P1(14),{admin:o,clientFeatures:n,featureClientSchemaMap:r,field:i,lexicalEditorConfig:l,schemaPath:s}=t,a;e[0]!==o?(a=o===void 0?{}:o,e[0]=o,e[1]=a):a=e[1];let u=a,c=l===void 0?eo:l,[d,m]=U1(null),p,f;e[2]!==u||e[3]!==n||e[4]!==r||e[5]!==i||e[6]!==d||e[7]!==c||e[8]!==s?(p=()=>{if(d)return;let C=[];for(let[D,x]of Object.entries(n))x.clientFeatureProvider&&C.push(x.clientFeatureProvider(x.clientFeatureProps));let w=c||eo,v=ss({featureClientSchemaMap:r,field:i,schemaPath:s??i.name,unSanitizedEditorConfig:{features:C,lexical:w}});m(cr(v,w,u))},f=[c,u,d,n,r,i,s],e[2]=u,e[3]=n,e[4]=r,e[5]=i,e[6]=d,e[7]=c,e[8]=s,e[9]=p,e[10]=f):(p=e[9],f=e[10]),G1(p,f);let h;return e[11]!==d||e[12]!==t?(h=ur(j1,{fallback:ur(B1,{height:"35vh"}),children:d&&ur(W1,{...t,editorConfig:d})}),e[11]=d,e[12]=t,e[13]=h):h=e[13],h};function K1(...t){return t.filter(Boolean).join(" ")}var to=new WeakMap;function cs(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function oo(t,e){let o=to.get(t);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=cs(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=cs(l);for(let u of n)a!==null&&u([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",r),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:r,listeners:n,start:null},to.set(t,o)}return o.listeners.add(e),()=>{z1(t,e)}}function z1(t,e){let o=to.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(to.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Z1(t,e){return oo(t,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&e(r,n)})}function X1(t,e){return oo(t,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&e(r,n)})}function Y1(t,e){return oo(t,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&e(r,n)})}function J1(t,e){return oo(t,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&e(r,n)})}var F={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},q1=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,Q1="\xA0",eh=`
|
|
34
|
+
`},[t,e]),p=Ne((x,E)=>{o(g=>{let _=e.length-1,N=e[_];if(N&&N.name===x){if(x==="type")return[...e.slice(0,_),{...N,value:N.value+E}];if(N.value===E)return[...e.slice(0,_),{...N,count:N.count+1}]}return[...g,{name:x,count:1,value:E}]})},[e,o]);Ur(()=>{let x=g=>{if(!n)return;let _=g.key;Aa(g)?p("selectAll",""):Vr.has(_)?p("press",g.key):[..._].length>1?p("keydown",g.key):p("type",g.key)},E=g=>{if(!n)return;let _=g.key;!Vr.has(_)&&[..._].length>1&&p("keyup",g.key)};return t.registerRootListener((g,_)=>{_!==null&&(_.removeEventListener("keydown",x),_.removeEventListener("keyup",E)),g!==null&&(g.addEventListener("keydown",x),g.addEventListener("keyup",E))})},[t,n,p]),Ur(()=>{c.current&&c.current.scrollTo(0,c.current.scrollHeight)},[m]),xo(()=>{if(e){let x=m();x!==null&&s(x),c.current&&c.current.scrollTo(0,c.current.scrollHeight)}},[m,e]),xo(()=>t.registerUpdateListener(({dirtyElements:E,dirtyLeaves:g,editorState:_})=>{if(!n)return;let N=_._selection,k=a.current,L=u.current;if(k!==N){if(g.size===0&&E.size===0&&!L){let b=window.getSelection();if(b&&(b.anchorNode==null||b.focusNode==null))return}a.current=N}u.current=!1;let I=m();I!==null&&s(I)}),[t,m,n,p]),xo(()=>n?t.registerUpdateListener(()=>{let E=t.getRootElement();E!==null&&i(E?.innerHTML)}):void 0,[t,n]);let f=Ne(x=>{n||(x.update(()=>{let E=ya();E.clear();let g=Sa();E.append(Ia().append(g)),g.select()}),o([])),r(E=>!E)},[n]),h=Ne(()=>{if(!n)return;let x=window.getSelection();if(x===null||x.anchorNode==null||x.focusNode==null)return;let{anchorNode:E,anchorOffset:g,focusNode:_,focusOffset:N}=Fa(x),k=d().getRootElement(),L;E!==null&&(L=Wr(E,k));let I;_!==null&&(I=Wr(_,k)),p("snapshot",{anchorNode:E,anchorOffset:g,anchorPath:L,focusNode:_,focusOffset:N,focusPath:I})},[p,n,d]),C=Ne(()=>{va(m())},[m]),w=Ne(()=>{Ma("test.js",m())},[m]);return[Le("button",{className:`editor-dev-button ${n?"active":""}`,id:"test-recorder-button",onClick:x=>{f(d()),x.preventDefault()},title:n?"Disable test recorder":"Enable test recorder",type:"button",children:n?"Disable test recorder":"Enable test recorder"}),n?_o("div",{className:"test-recorder-output",children:[_o("div",{className:"test-recorder-toolbar",children:[Le("button",{className:"test-recorder-button",id:"test-recorder-button-snapshot",onClick:x=>{h(),x.preventDefault()},title:"Insert snapshot",type:"button",children:"Insert Snapshot"}),Le("button",{className:"test-recorder-button",id:"test-recorder-button-copy",onClick:x=>{C(),x.preventDefault()},title:"Copy to clipboard",type:"button",children:"Copy"}),Le("button",{className:"test-recorder-button",id:"test-recorder-button-download",onClick:x=>{w(),x.preventDefault()},title:"Download as a file",type:"button",children:"Download"})]}),Le("pre",{id:"test-recorder",ref:c,children:l})]}):null]}var zr=()=>{let t=La(3),[e]=Ra(),[o,n]=Oa(e),r;return t[0]!==o||t[1]!==n?(r=_o(Kr.Fragment,{children:[Le("p",{children:"HI"}),o,n,Le("p",{children:"DONE"})]}),t[0]=o,t[1]=n,t[2]=r):r=t[2],r};var $a=y({plugins:[{Component:zr,position:"bottom"}]});import{c as Pa}from"react/compiler-runtime";import{jsx as Ba}from"react/jsx-runtime";import{useLexicalComposerContext as Ha}from"@lexical/react/LexicalComposerContext.js";import{TreeView as ja}from"@lexical/react/LexicalTreeView.js";import"react";var Zr=()=>{let t=Pa(2),[e]=Ha(),o;return t[0]!==e?(o=Ba(ja,{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 Ga=y({plugins:[{Component:Zr,position:"bottom"}]});import{$isTableSelection as Ua}from"@lexical/table";import{$isRangeSelection as Wa,FORMAT_TEXT_COMMAND as Va}from"lexical";import{jsx as Xr}from"react/jsx-runtime";import"react";var Yr=()=>Xr("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:Xr("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 Jr={type:"text-format",format:["bold","italic"],tag:"***"},qr={type:"text-format",format:["bold","italic"],intraword:!1,tag:"___"},Qr={type:"text-format",format:["bold"],tag:"**"},en={type:"text-format",format:["bold"],intraword:!1,tag:"__"};var tn=[Y([{ChildComponent:Yr,isActive:({selection:t})=>Wa(t)||Ua(t)?t.hasFormat("bold"):!1,key:"bold",onSelect:({editor:t})=>{t.dispatchCommand(Va,"bold")},order:1}])],Ka=y(({featureProviderMap:t})=>{let e=[Qr,en];return t.get("italic")&&e.push(qr,Jr),{enableFormats:["bold"],markdownTransformers:e,toolbarFixed:{groups:tn},toolbarInline:{groups:tn}}});import{$isTableSelection as Za}from"@lexical/table";import{$isRangeSelection as Xa,FORMAT_TEXT_COMMAND as Ya}from"lexical";import{jsx as on,jsxs as za}from"react/jsx-runtime";import"react";var rn=()=>za("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:[on("path",{d:"M7.76465 6L3.76465 10L7.76465 14",stroke:"currentColor"}),on("path",{d:"M12.2354 6L16.2354 10L12.2354 14",stroke:"currentColor"})]});var nn={type:"text-format",format:["code"],tag:"`"};var ln=[Y([{ChildComponent:rn,isActive:({selection:t})=>Xa(t)||Za(t)?t.hasFormat("code"):!1,key:"inlineCode",onSelect:({editor:t})=>{t.dispatchCommand(Ya,"code")},order:7}])],Ja=y({enableFormats:["code"],markdownTransformers:[nn],toolbarFixed:{groups:ln},toolbarInline:{groups:ln}});import{$isTableSelection as qa}from"@lexical/table";import{$isRangeSelection as Qa,FORMAT_TEXT_COMMAND as ec}from"lexical";import{jsx as sn}from"react/jsx-runtime";import"react";var an=()=>sn("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:sn("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 cn={type:"text-format",format:["italic"],tag:"*"},un={type:"text-format",format:["italic"],intraword:!1,tag:"_"};var dn=[Y([{ChildComponent:an,isActive:({selection:t})=>Qa(t)||qa(t)?t.hasFormat("italic"):!1,key:"italic",onSelect:({editor:t})=>{t.dispatchCommand(ec,"italic")},order:2}])],tc=y({enableFormats:["italic"],markdownTransformers:[cn,un],toolbarFixed:{groups:dn},toolbarInline:{groups:dn}});import{$isTableSelection as rc}from"@lexical/table";import{$isRangeSelection as nc,FORMAT_TEXT_COMMAND as ic}from"lexical";import{jsx as mn,jsxs as oc}from"react/jsx-runtime";import"react";var pn=()=>oc("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:[mn("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"}),mn("path",{d:"M4.99756 11.44H15.0026V12.19H4.99756V11.44Z",fill:"currentColor"})]});var fn={type:"text-format",format:["strikethrough"],tag:"~~"};var hn=[Y([{ChildComponent:pn,isActive:({selection:t})=>nc(t)||rc(t)?t.hasFormat("strikethrough"):!1,key:"strikethrough",onSelect:({editor:t})=>{t.dispatchCommand(ic,"strikethrough")},order:4}])],lc=y({enableFormats:["strikethrough"],markdownTransformers:[fn],toolbarFixed:{groups:hn},toolbarInline:{groups:hn}});import{$isTableSelection as sc}from"@lexical/table";import{$isRangeSelection as ac,FORMAT_TEXT_COMMAND as cc}from"lexical";import{jsx as gn}from"react/jsx-runtime";import"react";var Cn=()=>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:"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 xn=[Y([{ChildComponent:Cn,isActive:({selection:t})=>ac(t)||sc(t)?t.hasFormat("subscript"):!1,key:"subscript",onSelect:({editor:t})=>{t.dispatchCommand(cc,"subscript")},order:5}])],uc=y({enableFormats:["subscript"],toolbarFixed:{groups:xn},toolbarInline:{groups:xn}});import{$isTableSelection as dc}from"@lexical/table";import{$isRangeSelection as mc,FORMAT_TEXT_COMMAND as pc}from"lexical";import{jsx as bn}from"react/jsx-runtime";import"react";var _n=()=>bn("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:bn("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 Tn=[Y([{ChildComponent:_n,isActive:({selection:t})=>mc(t)||dc(t)?t.hasFormat("superscript"):!1,key:"superscript",onSelect:({editor:t})=>{t.dispatchCommand(pc,"superscript")},order:6}])],fc=y({enableFormats:["superscript"],toolbarFixed:{groups:Tn},toolbarInline:{groups:Tn}});import{$isTableSelection as gc}from"@lexical/table";import{$isRangeSelection as Cc,FORMAT_TEXT_COMMAND as xc}from"lexical";import{jsx as En,jsxs as hc}from"react/jsx-runtime";import"react";var wn=()=>hc("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:[En("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"}),En("path",{d:"M5.09961 16.3H14.9016V16.95H5.09961V16.3Z",fill:"currentColor"})]});var kn=[Y([{ChildComponent:wn,isActive:({selection:t})=>Cc(t)||gc(t)?t.hasFormat("underline"):!1,key:"underline",onSelect:({editor:t})=>{t.dispatchCommand(xc,"underline")},order:3}])],bc=y({enableFormats:["underline"],toolbarFixed:{groups:kn},toolbarInline:{groups:kn}});import{$createHeadingNode as wc,$isHeadingNode as Pn,HeadingNode as kc}from"@lexical/rich-text";import{$setBlocksType as Nc}from"@lexical/selection";import{$getSelection as Lc,$isRangeSelection as Rc}from"lexical";import{jsx as Nn}from"react/jsx-runtime";import"react";var Ln=()=>Nn("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:Nn("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 Rn}from"react/jsx-runtime";import"react";var In=()=>Rn("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:Rn("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 Sn}from"react/jsx-runtime";import"react";var yn=()=>Sn("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:Sn("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 vn}from"react/jsx-runtime";import"react";var Mn=()=>vn("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:vn("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 Dn}from"react/jsx-runtime";import"react";var An=()=>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",{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 Fn}from"react/jsx-runtime";import"react";var On=()=>Fn("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:Fn("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 _c,$isHeadingNode as Tc,HeadingNode as Ec}from"@lexical/rich-text";var To=t=>(e,o,n)=>{let r=t(n);r&&(r.append(...o),e.replace(r),r.select(0,0))};var $n=t=>{let o=`^(${t.map(r=>Number(r.slice(1))).map(r=>`#{${r}}`).join("|")})\\s`,n=new RegExp(o);return{type:"element",dependencies:[Ec],export:(r,i)=>{if(!Tc(r))return null;let l=Number(r.getTag().slice(1));return"#".repeat(l)+" "+i(r)},regExp:n,replace:To(r=>{let i="h"+r[1].length;return _c(i)})}};var Bn=t=>{let e=Lc();Nc(e,()=>wc(t))},Hn={h1:Ln,h2:In,h3:yn,h4:Mn,h5:An,h6:On},Ic=y(({props:t})=>{let{enabledHeadingSizes:e=["h1","h2","h3","h4","h5","h6"]}=t,o=[q(e.map((n,r)=>({ChildComponent:Hn[n],isActive:({selection:i})=>{if(!Rc(i))return!1;for(let l of i.getNodes()){if(Pn(l)&&l.getTag()===n)continue;let s=l.getParent();if(!(Pn(s)&&s.getTag()===n))return!1}return!0},key:n,label:({i18n:i})=>i.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:i})=>{i.update(()=>{Bn(n)})},order:r+2})))];return{markdownTransformers:[$n(e)],nodes:[kc],sanitizedClientFeatureProps:t,slashMenu:{groups:e?.length?[Z(e.map(n=>({Icon:Hn[n],key:`heading-${n.charAt(1)}`,keywords:["heading",n],label:({i18n:r})=>r.t("lexical:heading:label",{headingLevel:n.charAt(1)}),onSelect:({editor:r})=>{r.update(()=>{Bn(n)})}})))]:[]},toolbarFixed:{groups:e?.length?o:[]},toolbarInline:{groups:e?.length?o:[]}}});import{$isNodeSelection as Pc}from"lexical";import{jsx as jn}from"react/jsx-runtime";import"react";var Eo=()=>jn("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("rect",{fill:"currentColor",height:"1",width:"12",x:"4",y:"9.5"})});import{jsx as Gn,jsxs as Sc}from"react/jsx-runtime";import"react";var Un=()=>Sc("svg",{fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Gn("path",{d:"M5 10h10",stroke:"currentColor"}),Gn("path",{d:"M10 15V5",stroke:"currentColor"})]});var me=t=>({type:"dropdown",ChildComponent:Un,items:t,key:"add",order:10});var Wn={type:"element",dependencies:[gt],export:(t,e)=>xt(t)?"---":null,regExp:/^---\s*$/,replace:t=>{let e=Ct();e&&t.replace(e)}};import{c as yc}from"react/compiler-runtime";import{useLexicalComposerContext as vc}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as Mc}from"@lexical/utils";import{$getSelection as Dc,$isRangeSelection as Ac,COMMAND_PRIORITY_EDITOR as Fc}from"lexical";import{useEffect as Oc}from"react";var Vn=()=>{let t=yc(3),[e]=vc(),o,n;return t[0]!==e?(o=()=>e.registerCommand(Be,$c,Fc),n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),Oc(o,n),null};function $c(t){let e=Dc();if(!Ac(e))return!1;if(e.focus.getNode()!==null){let n=Ct();Mc(n)}return!0}var Bc=y({markdownTransformers:[Wn],nodes:[gt],plugins:[{Component:Vn,position:"normal"}],slashMenu:{groups:[Z([{Icon:Eo,key:"horizontalRule",keywords:["hr","horizontal rule","line","separator"],label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Be,void 0)}}])]},toolbarFixed:{groups:[me([{ChildComponent:Eo,isActive:({selection:t})=>{if(!Pc(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return xt(e)},key:"horizontalRule",label:({i18n:t})=>t.t("lexical:horizontalRule:label"),onSelect:({editor:t})=>{t.dispatchCommand(Be,void 0)}}])]}});import{INDENT_CONTENT_COMMAND as Yc,OUTDENT_CONTENT_COMMAND as Jc}from"lexical";import{jsx as vt,jsxs as Hc}from"react/jsx-runtime";import"react";var Kn=()=>Hc("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:[vt("path",{d:"M2.5 5H10.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M2.5 10H10.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M2.5 15H17.5",stroke:"currentColor",strokeWidth:"1.5"}),vt("path",{d:"M12.25 7.25L17.25 3.75V10.75L12.25 7.25Z",fill:"currentColor"})]});import{jsx as Mt,jsxs as jc}from"react/jsx-runtime";import"react";var zn=()=>jc("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[Mt("path",{d:"M17.5 5H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M17.5 10H9.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M17.5 15H2.5",stroke:"currentColor",strokeWidth:"1.5"}),Mt("path",{d:"M7.75 7.25L2.75 3.75V10.75L7.75 7.25Z",fill:"currentColor"})]});import{c as Gc}from"react/compiler-runtime";import{jsx as Uc}from"react/jsx-runtime";import{useLexicalComposerContext as Wc}from"@lexical/react/LexicalComposerContext.js";import{TabIndentationPlugin as Vc}from"@lexical/react/LexicalTabIndentationPlugin";import{mergeRegister as Kc}from"@lexical/utils";import{COMMAND_PRIORITY_NORMAL as Zn,FOCUS_COMMAND as zc,KEY_ESCAPE_COMMAND as Zc}from"lexical";import{useEffect as Xn,useState as Xc}from"react";var Yn=()=>{let t=Gc(8),[e]=Wc(),[o,n]=Xc(!1),r,i;t[0]!==e?(r=()=>Kc(e.registerCommand(zc,()=>(n(!1),!0),Zn),e.registerCommand(Zc,()=>(n(!0),e.getRootElement()?.blur(),!0),Zn)),i=[e,n],t[0]=e,t[1]=r,t[2]=i):(r=t[1],i=t[2]),Xn(r,i);let l,s;t[3]!==e||t[4]!==o?(l=()=>{if(!o)return;let u=c=>{["Escape","Shift"].includes(c.key)||n(!1),c.shiftKey&&c.key==="Tab"&&e.getRootElement()?.parentElement?.focus()};return document.addEventListener("keydown",u),()=>{document.removeEventListener("keydown",u)}},s=[e,o],t[3]=e,t[4]=o,t[5]=l,t[6]=s):(l=t[5],s=t[6]),Xn(l,s);let a;return t[7]===Symbol.for("react.memo_cache_sentinel")?(a=Uc(Vc,{}),t[7]=a):a=t[7],a};var Jn=t=>({type:"buttons",items:t,key:"indent",order:35});var qn=[Jn([{ChildComponent:Kn,isActive:()=>!1,isEnabled:({selection:t})=>{if(!t||!t?.getNodes()?.length)return!1;for(let e of t.getNodes()){let o=e.getParentOrThrow();if("__indent"in e&&e.__indent>0||"__indent"in o&&o.__indent>0)return!0}return!1},key:"indentDecrease",label:({i18n:t})=>t.t("lexical:indent:decreaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Jc,void 0)},order:1},{ChildComponent:zn,isActive:()=>!1,key:"indentIncrease",label:({i18n:t})=>t.t("lexical:indent:increaseLabel"),onSelect:({editor:t})=>{t.dispatchCommand(Yc,void 0)},order:2}])],qc=y({plugins:[{Component:Yn,position:"normal"}],toolbarFixed:{groups:qn},toolbarInline:{groups:qn}});import{$findMatchingParent as dd}from"@lexical/utils";import{$getSelection as yo,$isRangeSelection as Si}from"lexical";import{jsx as Qn}from"react/jsx-runtime";import"react";var ei=()=>Qn("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:Qn("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 ti}from"@lexical/selection";function Me(t){let{anchor:e}=t,{focus:o}=t,n=t.anchor.getNode(),r=t.focus.getNode();return n===r?n:t.isBackward()?ti(o)?n:r:ti(e)?n:r}var wo=t=>({type:"buttons",items:t,key:"features",order:50});import{$createTextNode as cu,$isTextNode as uu}from"lexical";import{addClassNamesToElement as Qc,isHTMLAnchorElement as eu}from"@lexical/utils";import Lo from"bson-objectid";import{$applyNodeReplacement as tu,$createTextNode as oi,$getSelection as ou,$isElementNode as ri,$isRangeSelection as No,createCommand as ru,ElementNode as nu}from"lexical";var iu=new Set(["http:","https:","mailto:","sms:","tel:"]),Q=class t extends nu{__fields;__id;constructor({id:e,fields:o={doc:null,linkType:"custom",newTab:!1,url:""},key:n}){super(n),this.__fields=o,this.__id=e}static clone(e){return new t({id:e.__id,fields:e.__fields,key:e.__key})}static getType(){return"link"}static importDOM(){return{a:e=>({conversion:lu,priority:1})}}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2),e.version===2&&!e.id&&(e.id=new Lo.default().toHexString(),e.version=3);let o=pe({id:e.id,fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}canBeEmpty(){return!1}canInsertTextAfter(){return!1}canInsertTextBefore(){return!1}createDOM(e){let o=document.createElement("a");return this.__fields?.linkType==="custom"&&(o.href=this.sanitizeUrl(this.__fields.url??"")),(this.__fields?.newTab??!1)&&(o.target="_blank"),this.__fields?.newTab===!0&&this.__fields?.linkType==="custom"&&(o.rel=ko(o.rel,"add","noopener")),Qc(o,e.theme.link),o}exportJSON(){let e={...super.exportJSON(),type:"link",fields:this.getFields(),version:3},o=this.getID();return o&&(e.id=o),e}extractWithChild(e,o,n){if(!No(o))return!1;let r=o.anchor.getNode(),i=o.focus.getNode();return this.isParentOf(r)&&this.isParentOf(i)&&o.getTextContent().length>0}getFields(){return this.getLatest().__fields}getID(){return this.getLatest().__id}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(ri(n)){let r=pe({fields:this.__fields});return n.append(r),r}return null}isInline(){return!0}sanitizeUrl(e){try{let o=new URL(e);if(!iu.has(o.protocol))return"about:blank"}catch{return"https://"}return e}setFields(e){let o=this.getWritable();o.__fields=e}updateDOM(e,o,n){let r=this.__fields?.url,i=this.__fields?.newTab;return r!=null&&r!==e.__fields?.url&&this.__fields?.linkType==="custom"&&(o.href=r),this.__fields?.linkType==="internal"&&e.__fields?.linkType==="custom"&&o.removeAttribute("href"),o.rel==null&&(o.rel=""),i!==e.__fields?.newTab&&(i??!1?(o.target="_blank",this.__fields?.linkType==="custom"&&(o.rel=ko(o.rel,"add","noopener"))):(o.removeAttribute("target"),o.rel=ko(o.rel,"remove","noopener"))),!1}};function lu(t){let e=null;if(eu(t)){let o=t.textContent;o!==null&&o!==""&&(e=pe({id:new Lo.default().toHexString(),fields:{doc:null,linkType:"custom",newTab:t.getAttribute("target")==="_blank",url:t.getAttribute("href")??""}}))}return{node:e}}function pe({id:t,fields:e}){return tu(new Q({id:t??new Lo.default().toHexString(),fields:e}))}function V(t){return t instanceof Q}var le=ru("TOGGLE_LINK_COMMAND");function ni(t){let e=ou();if(!No(e)&&!t.selectedNodes?.length)return;let o=No(e)?e.extract():t.selectedNodes;if(t===null)o?.forEach(n=>{let r=n.getParent();if(V(r)){let i=r.getChildren();for(let l=0;l<i.length;l+=1)r.insertBefore(i[l]);r.remove()}});else{if(o?.length===1){let i=o[0],l=V(i)?i:su(i);if(l!==null){l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(oi(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}}let n=null,r=null;o?.forEach(i=>{let l=i.getParent();if(!(l===r||l===null||ri(i)&&!i.isInline())){if(V(l)){r=l,l.setFields(t.fields),t.text!=null&&t.text!==l.getTextContent()&&(l.append(oi(t.text)),l.getChildren().forEach(s=>{s!==l.getLastChild()&&s.remove()}));return}if(l.is(n)||(n=l,r=pe({fields:t.fields}),V(l)?i.getPreviousSibling()===null?l.insertBefore(r):l.insertAfter(r):i.insertBefore(r)),V(i)){if(i.is(r))return;if(r!==null){let s=i.getChildren();for(let a=0;a<s.length;a+=1)r.append(s[a])}i.remove();return}r!==null&&r.append(i)}})}}function su(t){return au(t,e=>V(e))}function au(t,e){let o=t;for(;o!==null&&(o=o.getParent(),!(o===null||e(o))););return o}function ko(t,e,o){let n,r=`${t}`;if(e==="add"){if(r.includes(o)){let i=new RegExp(o,"g");r=r.replace(i,"").trim()}r=r.trim(),n=r.length===0?`${o}`:`${r} ${o}`}else{let i=new RegExp(o,"g");n=r.replace(i,"").trim()}return n}var ii={type:"text-match",dependencies:[Q],export:(t,e,o)=>{if(!V(t))return null;let n=t,{url:r}=n.getFields(),i=`[${n.getTextContent()}](${r})`,l=n.getFirstChild();return n.getChildrenSize()===1&&uu(l)?o(l,i):i},importRegExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)/,regExp:/\[([^[]+)\]\(([^()\s]+)(?:\s"((?:[^"]*\\")*[^"]*)"\s*)?\)$/,replace:(t,e)=>{let[,o,n]=e,r=pe({fields:{doc:null,linkType:"custom",newTab:!1,url:n}}),i=cu(o);i.setFormat(t.getFormat()),r.append(i),t.replace(r)},trigger:")"};import{$applyNodeReplacement as du,$isElementNode as mu}from"lexical";var fe=class t extends Q{static clone(e){return new t({id:"",fields:e.__fields,key:e.__key})}static getType(){return"autolink"}static importDOM(){return null}static importJSON(e){e.version===1&&typeof e.fields?.doc?.value=="object"&&e.fields?.doc?.value?.id&&(e.fields.doc.value=e.fields.doc.value.id,e.version=2);let o=Qe({fields:e.fields});return o.setFormat(e.format),o.setIndent(e.indent),o.setDirection(e.direction),o}exportJSON(){let e=super.exportJSON();return{type:"autolink",children:e.children,direction:e.direction,fields:e.fields,format:e.format,indent:e.indent,version:2}}insertNewAfter(e,o=!0){let n=this.getParentOrThrow().insertNewAfter(e,o);if(mu(n)){let r=Qe({fields:this.__fields});return n.append(r),r}return null}};function Qe({fields:t}){return du(new fe({id:"",fields:t}))}function he(t){return t instanceof fe}import{c as pu}from"react/compiler-runtime";import{useLexicalComposerContext as fu}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as hu}from"@lexical/utils";import{$createTextNode as li,$getSelection as gu,$isElementNode as ai,$isLineBreakNode as ci,$isNodeSelection as Cu,$isRangeSelection as xu,$isTextNode as et,TextNode as bu}from"lexical";import{useEffect as _u}from"react";function si(t,e=o=>o){return o=>{let n=t.exec(o);return n===null?null:{index:n.index,length:n[0].length,text:n[0],url:e(n[0])}}}function ui(t,e){for(let o=0;o<e.length;o++){let n=e[o](t);if(n!=null)return n}return null}var Tu=/[.,;\s]/;function At(t){return Tu.test(t)}function di(t){return At(t[t.length-1])}function Io(t){return At(t[0])}function Eu(t,e){return e?/^\.[a-z]{2,}/i.test(t):/^\.[a-z0-9]+/i.test(t)}function mi(t){let e=t.getPreviousSibling();return ai(e)&&(e=e.getLastDescendant()),e===null||ci(e)||et(e)&&di(e.getTextContent())}function pi(t){let e=t.getNextSibling();return ai(e)&&(e=e.getFirstDescendant()),e===null||ci(e)||et(e)&&Io(e.getTextContent())}function wu(t,e,o,n){return(t>0?At(o[t-1]):mi(n[0]))?e<o.length?At(o[e]):pi(n[n.length-1]):!1}function ku(t,e,o){let n=[],r=[],i=[],l=0,s=0,a=[...t];for(;a.length>0;){let u=a[0],d=u.getTextContent().length,m=s;s+d<=e?(n.push(u),l+=d):m>=o?i.push(u):r.push(u),s+=d,a.shift()}return[l,n,r,i]}function Nu(t,e,o,n){let r={linkType:"custom",url:n.url,...n.fields},i=Qe({fields:r});if(t.length===1){let l=t[0],s;e===0?[s,l]=l.splitText(o):[,s,l]=l.splitText(e,o);let a=li(n.text);return a.setFormat(s.getFormat()),a.setDetail(s.getDetail()),a.setStyle(s.getStyle()),i.append(a),s.replace(i),l}else if(t.length>1){let l=t[0],s=l.getTextContent().length,a;e===0?a=l:[,a]=l.splitText(e);let u=[],c;for(let f=1;f<t.length;f++){let h=t[f],w=h.getTextContent().length,v=s,D=s+w;if(v<o)if(D<=o)u.push(h);else{let[x,E]=h.splitText(o-v);u.push(x),c=E}s+=w}let d=gu(),m=d?d.getNodes().find(et):void 0,p=li(a.getTextContent());return p.setFormat(a.getFormat()),p.setDetail(a.getDetail()),p.setStyle(a.getStyle()),i.append(p,...u),m&&m===a&&(xu(d)?p.select(d.anchor.offset,d.focus.offset):Cu(d)&&p.select(0,p.getTextContent().length)),a.replace(i),c}}function Lu(t,e,o){let n=[...t],r=n.map(a=>a.getTextContent()).join(""),i=r,l,s=0;for(;(l=ui(i,e))!=null&&l!==null;){let a=l.index,u=l.length,c=a+u;if(wu(s+a,s+c,r,n)){let[m,,p,f]=ku(n,s+a,s+c),h=s+a-m,C=s+c-m,w=Nu(p,h,C,l);n=w?[w,...f]:f,o(l.url,null),s=0}else s+=c;i=i.substring(c)}}function Ro(t,e,o){let n=t.getChildren(),r=n.length;for(let a=0;a<r;a++){let u=n[a];if(!et(u)||!u.isSimpleText()){Dt(t),o(null,t.getFields()?.url??null);return}}let i=t.getTextContent(),l=ui(i,e);if(l===null||l.text!==i){Dt(t),o(null,t.getFields()?.url??null);return}if(!mi(t)||!pi(t)){Dt(t),o(null,t.getFields()?.url??null);return}let s=t.getFields()?.url;if(s!==l?.url){let a=t.getFields();a.url=l?.url,t.setFields(a),o(l.url,s??null)}}function Ru(t,e,o){let n=t.getPreviousSibling(),r=t.getNextSibling(),i=t.getTextContent();if(he(n)){let l=n.getFields()?.url?n.getFields()?.url?.startsWith("mailto:"):!1;(!Io(i)||Eu(i,l))&&(n.append(t),Ro(n,e,o),o(null,n.getFields()?.url??null))}he(r)&&!di(i)&&(Dt(r),Ro(r,e,o),o(null,r.getFields()?.url??null))}function Dt(t){let e=t.getChildren(),o=e.length;for(let n=o-1;n>=0;n--)t.insertAfter(e[n]);return t.remove(),e.map(n=>n.getLatest())}function Iu(t){let e=[t],o=t.getNextSibling();for(;o!==null&&et(o)&&o.isSimpleText()&&(e.push(o),!/\s/.test(o.getTextContent()));)o=o.getNextSibling();return e}function Su(t,e,o){let n=pu(5),r,i;n[0]!==t||n[1]!==e||n[2]!==o?(r=()=>{if(!t.hasNodes([fe]))throw new Error("LexicalAutoLinkPlugin: AutoLinkNode not registered on editor");let l=(s,a)=>{o?.(s,a)};return hu(t.registerNodeTransform(bu,s=>{let a=s.getParentOrThrow(),u=s.getPreviousSibling();if(he(a))Ro(a,e,l);else if(!V(a)){if(s.isSimpleText()&&(Io(s.getTextContent())||!he(u))){let c=Iu(s);Lu(c,e,l)}Ru(s,e,l)}}))},i=[t,e,o],n[0]=t,n[1]=e,n[2]=o,n[3]=r,n[4]=i):(r=n[3],i=n[4]),_u(r,i)}var yu=/((https?:\/\/(www\.)?)|(www\.))[-\w@:%.+~#=]{1,256}\.[a-zA-Z\d()]{1,6}\b([-\w()@:%+.~#?&/=]*)(?<![-.+():%])/,vu=/(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\])|(([a-z\-\d]+\.)+[a-z]{2,}))/i,Mu=[si(yu,t=>t.startsWith("http")?t:`https://${t}`),si(vu,t=>`mailto:${t}`)],fi=()=>{let[t]=fu();return Su(t,Mu),null};import{jsx as Du}from"react/jsx-runtime";import{ClickableLinkPlugin as Au}from"@lexical/react/LexicalClickableLinkPlugin.js";import"react";var hi=()=>Du(Au,{});import{jsx as Ju}from"react/jsx-runtime";import"react";import{createPortal as qu}from"react-dom";import{jsx as ge,jsxs as tt,Fragment as Ou}from"react/jsx-runtime";import{useLexicalComposerContext as $u}from"@lexical/react/LexicalComposerContext.js";import{$findMatchingParent as gi,mergeRegister as Ci}from"@lexical/utils";import{getTranslation as So}from"@payloadcms/translations";import{CloseMenuIcon as Pu,EditIcon as Bu,ExternalLinkIcon as xi,formatDrawerSlug as Hu,useConfig as ju,useEditDepth as Gu,useLocale as Uu,useTranslation as Wu}from"@payloadcms/ui";import{requests as Vu}from"@payloadcms/ui/shared";import{$getSelection as bi,$isLineBreakNode as Ku,$isRangeSelection as _i,COMMAND_PRIORITY_HIGH as zu,COMMAND_PRIORITY_LOW as Ti,KEY_ESCAPE_COMMAND as Zu,SELECTION_CHANGE_COMMAND as Xu}from"lexical";import Ei,{useCallback as wi,useEffect as $t,useRef as Yu,useState as Re}from"react";function Ft(t,e,o,n=10,r=5){let i=o.parentElement;if(t===null||i==null){e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)";return}let l=e.getBoundingClientRect(),s=o.getBoundingClientRect(),a=i.getBoundingClientRect(),u=t.top-n,c=t.left-r;u<a.top&&(u+=l.height+t.height+n*2),c+l.width>a.right&&(c=a.right-l.width-r),u-=s.top,c-=s.left,e.style.opacity="1",e.style.transform=`translate(${c}px, ${u}px)`}import{createCommand as Fu}from"lexical";var Ot=Fu("TOGGLE_LINK_WITH_MODAL_COMMAND");function ki({anchorElem:t}){let[e]=$u(),[o,n]=Re(),r=Yu(null),[i,l]=Re(null),[s,a]=Re(null),{fieldProps:{schemaPath:u},uuid:c}=B(),{config:d}=ju(),{i18n:m,t:p}=Wu(),[f,h]=Re(),C=Gu(),[w,v]=Re(!1),[D,x]=Re([]),E=Uu(),[g,_]=Re(!1),N=Hu({slug:"lexical-rich-text-link-"+c,depth:C}),{toggleDrawer:k}=ce(N),L=wi(()=>{v(!1),r&&r.current&&(r.current.style.opacity="0",r.current.style.transform="translate(-10000px, -10000px)"),_(!1),l(null),a(null),x([]),h(void 0)},[v,l,a,x]),I=wi(()=>{let b=bi(),T;if(!_i(b)||!b){L();return}let S=Me(b);T=e.getElementByKey(S.getKey())?.getBoundingClientRect();let R=gi(S,V),A=b.getNodes().filter(U=>!Ku(U)).find(U=>{let H=gi(U,V);return R&&!R.is(H)||H&&!H.is(R)});if(R==null||A){L();return}n(R);let M=R.getFields(),O={...M,id:R.getID(),text:R.getTextContent()};if(M?.linkType==="custom")l(M?.url??null),a(null);else{l(`${d.routes.admin==="/"?"":d.routes.admin}/collections/${M?.doc?.relationTo}/${M?.doc?.value}`);let U=d.collections.find(H=>H.slug===M?.doc?.relationTo);if(!U)a(M?.label?String(M?.label):null),l(M?.url?String(M?.url):null);else{let H=typeof M.doc?.value=="object"?M.doc.value.id:M.doc?.value,ee=M.doc?.relationTo;if(!H||!ee)throw new Error("Focus link parent is missing doc.value or doc.relationTo");let pt=p("fields:linkedTo",{label:`${So(U.labels.singular,m)} - ${p("lexical:link:loadingWithEllipsis",m)}`}).replace(/<[^>]*>?/g,"");a(pt),Vu.get(`${d.serverURL}${d.routes.api}/${ee}/${H}`,{headers:{"Accept-Language":m.language},params:{depth:0,locale:E?.code}}).then(async ie=>{if(!ie.ok)throw new Error(`HTTP error! Status: ${ie.status}`);let ve=await ie.json(),ft=U?.admin?.useAsTitle||"id",ht=ve[ft],dr=p("fields:linkedTo",{label:`${So(U.labels.singular,m)} - ${ht}`}).replace(/<[^>]*>?/g,"");a(dr)}).catch(()=>{let ie=p("fields:linkedTo",{label:`${So(U.labels.singular,m)} - ${p("general:untitled",m)} - ID: ${H}`}).replace(/<[^>]*>?/g,"");a(ie)})}}h(O),v(!0),x(b?b?.getNodes():[]),he(R)?_(!0):_(!1);let G=r.current,$=window.getSelection(),{activeElement:W}=document;if(G===null)return;let J=e.getRootElement();return $!==null&&J!==null&&J.contains($.anchorNode)?(T||(T=$.getRangeAt(0).getBoundingClientRect()),T!=null&&(T.y+=40,Ft(T,G,t))):(W==null||W.className!=="link-input")&&(J!==null&&Ft(null,G,t),l(null),a(null)),!0},[e,L,d.routes.admin,d.routes.api,d.collections,d.serverURL,p,m,E?.code,t]);return $t(()=>Ci(e.registerCommand(Ot,b=>(e.dispatchCommand(le,b),I(),k(),!0),Ti)),[e,I,k,N]),$t(()=>{let b=t.parentElement,T=()=>{e.getEditorState().read(()=>{I()})};return window.addEventListener("resize",T),b?.addEventListener("scroll",T),()=>{window.removeEventListener("resize",T),b?.removeEventListener("scroll",T)}},[t.parentElement,e,I]),$t(()=>Ci(e.registerUpdateListener(({editorState:b})=>{b.read(()=>{I()})}),e.registerCommand(Xu,()=>(I(),!0),Ti),e.registerCommand(Zu,()=>w?(L(),!0):!1,zu)),[e,I,w,L]),$t(()=>{e.getEditorState().read(()=>{I()})},[e,I]),tt(Ei.Fragment,{children:[ge("div",{className:"link-editor",ref:r,children:tt("div",{className:"link-input",children:[i&&i.length>0?tt("a",{href:i,rel:"noopener noreferrer",target:"_blank",children:[o?.__fields.newTab?ge(xi,{}):null,s!=null&&s.length>0?s:i]}):s!=null&&s.length>0?tt(Ou,{children:[o?.__fields.newTab?ge(xi,{}):null,ge("span",{className:"link-input__label-pure",children:s})]}):null,e.isEditable()&&tt(Ei.Fragment,{children:[ge("button",{"aria-label":"Edit link",className:"link-edit",onClick:()=>{k()},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:ge(Bu,{})}),!g&&ge("button",{"aria-label":"Remove link",className:"link-trash",onClick:()=>{e.dispatchCommand(le,null)},onMouseDown:b=>{b.preventDefault()},tabIndex:0,type:"button",children:ge(Pu,{})})]})]})}),ge(He,{className:"lexical-link-edit-drawer",data:f,drawerSlug:N,drawerTitle:p("fields:editLink"),featureKey:"link",handleDrawerSubmit:(b,T)=>{let S=T,R={...S};delete R.text,e.update(()=>{let A=bi(),M=null;if(_i(A)?M=Me(A).getParent():D.length&&(M=D[0].getParent()),M&&he(M)){let O=pe({fields:R});M.replace(O,!0)}}),e.dispatchCommand(le,{fields:R,selectedNodes:D,text:S.text})},schemaPath:u,schemaPathSuffix:"fields"})]})}var Ni=t=>{let{anchorElem:e=document.body}=t;return qu(Ju(ki,{anchorElem:e}),e)};import{c as td}from"react/compiler-runtime";import{useLexicalComposerContext as od}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as rd}from"@lexical/utils";import{$getSelection as nd,$isElementNode as id,$isRangeSelection as ld,COMMAND_PRIORITY_LOW as Ri,PASTE_COMMAND as sd}from"lexical";import{useEffect as ad}from"react";var Qu=/(?:[A-Za-z]{3,9}:(?:\/\/)?(?:[-;:&=+$,\w]+@)?[A-Za-z\d.-]+|(?:www.|[-;:&=+$,\w]+@)[A-Za-z\d.-]+)(?:\/[+~%/.\w-]*)?\??[-+=&;%@.\w]*#?\w*/,ed=/^[\w\-./]*(?:#\w[\w-]*)?$/;function Li(t){if(!t)return!1;if(t==="https://"||Qu.test(t)||ed.test(t))return!0;try{return new URL(t),!0}catch{}return!1}var Ii=()=>{let t=td(3),[e]=od(),o,n;return t[0]!==e?(o=()=>{if(!e.hasNodes([Q]))throw new Error("LinkPlugin: LinkNode not registered on editor");return rd(e.registerCommand(le,cd,Ri),e.registerCommand(sd,r=>{let i=nd();if(!ld(i)||i.isCollapsed()||!(r instanceof ClipboardEvent)||r.clipboardData==null)return!1;let l=r.clipboardData.getData("text");if(!Li(l))return!1;if(!i.getNodes().some(ud)){let s={doc:null,linkType:"custom",newTab:!1,url:l};return e.dispatchCommand(le,{fields:s,text:null}),r.preventDefault(),!0}return!1},Ri))},n=[e],t[0]=e,t[1]=o,t[2]=n):(o=t[1],n=t[2]),ad(o,n),null};function cd(t){return ni(t),!0}function ud(t){return id(t)}var yi=[wo([{ChildComponent:ei,isActive:({selection:t})=>{if(Si(t)){let e=Me(t);return dd(e,V)!=null}return!1},isEnabled:({selection:t})=>!!(Si(t)&&yo()?.getTextContent()?.length),key:"link",label:({i18n:t})=>t.t("lexical:link:label"),onSelect:({editor:t,isActive:e})=>{if(e)t.dispatchCommand(le,null);else{let o,n=[];if(t.getEditorState().read(()=>{o=yo()?.getTextContent(),n=yo()?.getNodes()??[]}),!o?.length)return;let r={doc:null,linkType:"custom",newTab:!1,url:"https://"};t.dispatchCommand(Ot,{fields:r,selectedNodes:n,text:o})}},order:1}])],md=y({markdownTransformers:[ii],nodes:[Q,fe],plugins:[{Component:Ii,position:"normal"},{Component:fi,position:"normal"},{Component:hi,position:"normal"},{Component:Ni,position:"floatingAnchorElem"}],toolbarFixed:{groups:yi},toolbarInline:{groups:yi}});import{$isListNode as Do,INSERT_CHECK_LIST_COMMAND as Oi,ListItemNode as kd,ListNode as Nd}from"@lexical/list";import{$isRangeSelection as Ld}from"lexical";import{jsx as vi,jsxs as pd}from"react/jsx-runtime";import"react";var vo=()=>pd("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:[vi("rect",{height:"13",rx:"1.5",stroke:"currentColor",width:"13",x:"3.5",y:"3.5"}),vi("path",{d:"M7 10L9 12.5L13 7.5",stroke:"currentColor",strokeWidth:"1.5"})]});import{jsx as fd}from"react/jsx-runtime";import{ListPlugin as hd}from"@lexical/react/LexicalListPlugin.js";import"react";var De=()=>fd(hd,{});function Ae(t){return{items:t,key:"lists",label:({i18n:e})=>e.t("lexical:general:slashMenuListGroupLabel")}}import{$isListNode as bd,ListItemNode as _d,ListNode as Td}from"@lexical/list";import{$createListItemNode as gd,$createListNode as Cd,$isListItemNode as xd,$isListNode as Mo}from"@lexical/list";var Mi=4,Fe=t=>(e,o,n)=>{let r=e.getPreviousSibling(),i=e.getNextSibling(),l=gd(t==="check"?n[3]==="x":void 0);if(Mo(i)&&i.getListType()===t){let a=i.getFirstChild();a!==null?a.insertBefore(l):i.append(l),e.remove()}else if(Mo(r)&&r.getListType()===t)r.append(l),e.remove();else{let a=Cd(t,t==="number"?Number(n[2]):void 0);a.append(l),e.replace(a)}l.append(...o),l.select(0,0);let s=Math.floor(n[1].length/Mi);s&&l.setIndent(s)},Ie=(t,e,o)=>{let n=[],r=t.getChildren(),i=0;for(let l of r)if(xd(l)){if(l.getChildrenSize()===1){let c=l.getFirstChild();if(Mo(c)){n.push(Ie(c,e,o+1));continue}}let s=" ".repeat(o*Mi),a=t.getListType(),u=a==="number"?`${t.getStart()+i}. `:a==="check"?`- [${l.getChecked()?"x":" "}] `:"- ";n.push(s+u+e(l)),i++}return n.join(`
|
|
35
|
+
`)};var Di={type:"element",dependencies:[Td,_d],export:(t,e)=>bd(t)?Ie(t,e,0):null,regExp:/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,replace:Fe("check")};import{jsx as Ed}from"react/jsx-runtime";import{CheckListPlugin as wd}from"@lexical/react/LexicalCheckListPlugin.js";import"react";var Ai=()=>Ed(wd,{});var Fi=[q([{ChildComponent:vo,isActive:({selection:t})=>{if(!Ld(t))return!1;for(let e of t.getNodes()){if(Do(e)&&e.getListType()==="check")continue;let o=e.getParent();if(Do(o)&&o.getListType()==="check")continue;let n=o?.getParent();if(!(Do(n)&&n.getListType()==="check"))return!1}return!0},key:"checklist",label:({i18n:t})=>t.t("lexical:checklist:label"),onSelect:({editor:t})=>{t.dispatchCommand(Oi,void 0)},order:12}])],Rd=y(({featureProviderMap:t})=>{let e=[{Component:Ai,position:"normal"}];return!t.has("unorderedList")&&!t.has("orderedList")&&e.push({Component:De,position:"normal"}),{markdownTransformers:[Di],nodes:t.has("unorderedList")||t.has("orderedList")?[]:[Nd,kd],plugins:e,slashMenu:{groups:[Ae([{Icon:vo,key:"checklist",keywords:["check list","check","checklist","cl"],label:({i18n:o})=>o.t("lexical:checklist:label"),onSelect:({editor:o})=>{o.dispatchCommand(Oi,void 0)}}])]},toolbarFixed:{groups:Fi},toolbarInline:{groups:Fi}}});import{$isListNode as Fo,INSERT_ORDERED_LIST_COMMAND as Bi,ListItemNode as Md,ListNode as Dd}from"@lexical/list";import{$isRangeSelection as Ad}from"lexical";import{jsx as ot,jsxs as Id}from"react/jsx-runtime";import"react";var Ao=()=>Id("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[ot("path",{d:"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"}),ot("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"}),ot("path",{d:"M8 15L17 15",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 10L17 10",stroke:"currentColor",strokeWidth:"1.5"}),ot("path",{d:"M8 5L17 5",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as Sd,ListItemNode as yd,ListNode as vd}from"@lexical/list";var $i={type:"element",dependencies:[vd,yd],export:(t,e)=>Sd(t)?Ie(t,e,0):null,regExp:/^(\s*)(\d+)\.\s/,replace:Fe("number")};var Pi=[q([{ChildComponent:Ao,isActive:({selection:t})=>{if(!Ad(t))return!1;for(let e of t.getNodes()){if(Fo(e)&&e.getListType()==="number")continue;let o=e.getParent();if(Fo(o)&&o.getListType()==="number")continue;let n=o?.getParent();if(!(Fo(n)&&n.getListType()==="number"))return!1}return!0},key:"orderedList",label:({i18n:t})=>t.t("lexical:orderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Bi,void 0)},order:10}])],Fd=y(({featureProviderMap:t})=>({markdownTransformers:[$i],nodes:t.has("orderedList")?[]:[Dd,Md],plugins:t.has("orderedList")?[]:[{Component:De,position:"normal"}],slashMenu:{groups:[Ae([{Icon:Ao,key:"orderedList",keywords:["ordered list","ol"],label:({i18n:e})=>e.t("lexical:orderedList:label"),onSelect:({editor:e})=>{e.dispatchCommand(Bi,void 0)}}])]},toolbarFixed:{groups:Pi},toolbarInline:{groups:Pi}}));import{$isListNode as $o,INSERT_UNORDERED_LIST_COMMAND as Gi,ListItemNode as Hd,ListNode as jd}from"@lexical/list";import{$isRangeSelection as Gd}from"lexical";import{jsx as Oe,jsxs as Od}from"react/jsx-runtime";import"react";var Oo=()=>Od("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:[Oe("circle",{cx:"4",cy:"5",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Oe("circle",{cx:"4",cy:"10",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Oe("circle",{cx:"4",cy:"15",fill:"currentColor",r:"1.15",stroke:"currentColor",strokeWidth:"0.3"}),Oe("path",{d:"M17 5H7",stroke:"currentColor",strokeWidth:"1.5"}),Oe("path",{d:"M17 10H7",stroke:"currentColor",strokeWidth:"1.5"}),Oe("path",{d:"M17 15H7",stroke:"currentColor",strokeWidth:"1.5"})]});import{$isListNode as $d,ListItemNode as Pd,ListNode as Bd}from"@lexical/list";var Hi={type:"element",dependencies:[Bd,Pd],export:(t,e)=>$d(t)?Ie(t,e,0):null,regExp:/^(\s*)[-*+]\s/,replace:Fe("bullet")};var ji=[q([{ChildComponent:Oo,isActive:({selection:t})=>{if(!Gd(t))return!1;for(let e of t.getNodes()){if($o(e)&&e.getListType()==="bullet")continue;let o=e.getParent();if($o(o)&&o.getListType()==="bullet")continue;let n=o?.getParent();if(!($o(n)&&n.getListType()==="bullet"))return!1}return!0},key:"unorderedList",label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)},order:11}])],Ud=y({markdownTransformers:[Hi],nodes:[jd,Hd],plugins:[{Component:De,position:"normal"}],slashMenu:{groups:[Ae([{Icon:Oo,key:"unorderedList",keywords:["unordered list","ul"],label:({i18n:t})=>t.t("lexical:unorderedList:label"),onSelect:({editor:t})=>{t.dispatchCommand(Gi,void 0)}}])]},toolbarFixed:{groups:ji},toolbarInline:{groups:ji}});import{jsx as Wd}from"react/jsx-runtime";import{addClassNamesToElement as Vd}from"@lexical/utils";import{DecoratorNode as Kd}from"lexical";import*as Ui from"react";var zd=Ui.lazy(()=>import("./Component-MBLHTKDK.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),rt=class t extends Kd{__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 Zd({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Vd(o,"unknownConverted"),o}decorate(){return Wd(zd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function Zd({data:t}){return new rt({data:t})}var Xd=y(()=>({nodes:[rt]}));import{jsx as Yd}from"react/jsx-runtime";import{addClassNamesToElement as Jd}from"@lexical/utils";import{DecoratorNode as qd}from"lexical";import*as Wi from"react";var Qd=Wi.lazy(()=>import("./Component-DOSSWC76.js").then(t=>({default:t.UnknownConvertedNodeComponent}))),nt=class t extends qd{__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 em({data:e.data})}canInsertTextAfter(){return!0}canInsertTextBefore(){return!0}createDOM(e){let o=document.createElement("span");return Jd(o,"unknownConverted"),o}decorate(){return Yd(Qd,{data:this.__data})}exportJSON(){return{type:this.getType(),data:this.__data,version:1}}isInline(){return!0}updateDOM(e,o){return!1}};function em({data:t}){return new nt({data:t})}var tm=y(()=>({nodes:[nt]}));import{$setBlocksType as zi}from"@lexical/selection";import{$createParagraphNode as Zi,$getSelection as Xi,$isParagraphNode as Vi,$isRangeSelection as om}from"lexical";var Ki=[q([{ChildComponent:ze,isActive:({selection:t})=>{if(!om(t))return!1;for(let e of t.getNodes())if(!Vi(e)&&!Vi(e.getParent()))return!1;return!0},key:"paragraph",label:({i18n:t})=>t.t("lexical:paragraph:label2"),onSelect:({editor:t})=>{t.update(()=>{let e=Xi();zi(e,()=>Zi())})},order:1}])],rm=y({slashMenu:{groups:[Z([{Icon:ze,key:"paragraph",keywords:["normal","paragraph","p","text"],label:({i18n:t})=>t.t("lexical:paragraph:label"),onSelect:({editor:t})=>{t.update(()=>{let e=Xi();zi(e,()=>Zi())})}}])]},toolbarFixed:{groups:Ki},toolbarInline:{groups:Ki}});import{$isNodeSelection as Fm}from"lexical";import{jsx as it,jsxs as nm}from"react/jsx-runtime";import"react";var Po=()=>nm("svg",{"aria-hidden":"true",className:"icon",fill:"none",focusable:"false",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:[it("g",{clipPath:"url(#clip0_4397_10817)",children:it("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"})}),it("defs",{children:it("clipPath",{id:"clip0_4397_10817",children:it("rect",{fill:"currentColor",height:"12",transform:"translate(4 4)",width:"12"})})})]});import{c as Tm}from"react/compiler-runtime";import{jsx as Em}from"react/jsx-runtime";import{useLexicalComposerContext as wm}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as km}from"@lexical/utils";import{useConfig as Nm}from"@payloadcms/ui";import{$getPreviousSelection as Lm,$getSelection as Rm,$isParagraphNode as ol,$isRangeSelection as Im,COMMAND_PRIORITY_EDITOR as Sm,createCommand as ym}from"lexical";import{useEffect as vm}from"react";import{c as gm}from"react/compiler-runtime";import{jsx as Pt}from"react/jsx-runtime";import{useLexicalComposerContext as Cm}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as xm,COMMAND_PRIORITY_EDITOR as bm}from"lexical";import{useEffect as qi,useState as Qi}from"react";import{c as im}from"react/compiler-runtime";import{jsx as lm}from"react/jsx-runtime";import{useLexicalComposerContext as sm}from"@lexical/react/LexicalComposerContext";import{useListDrawer as am,useModal as cm}from"@payloadcms/ui";import{$getNodeByKey as Yi,$getPreviousSelection as um,$getRoot as dm,$getSelection as mm,$isRangeSelection as pm,$setSelection as fm}from"lexical";import{useEffect as hm,useState as Ji}from"react";var lt=t=>{let e=im(23),[o]=sm(),[n,r]=Ji(null),[i,l]=Ji(!1),[s,a,u]=am(t),{closeDrawer:c,drawerSlug:d,isDrawerOpen:m,openDrawer:p}=u,{modalState:f}=cm(),h;e[0]===Symbol.for("react.memo_cache_sentinel")?(h=()=>{let L=mm()??um();r(L)},e[0]=h):h=e[0];let C=h,w;e[1]!==o||e[2]!==n?(w=()=>{n&&o.update(()=>{if(pm(n)){let{anchor:L,focus:I}=n;Yi(L.key)&&Yi(I.key)&&fm(n.clone())}else dm().selectEnd()},{discrete:!0,skipTransforms:!0})},e[1]=o,e[2]=n,e[3]=w):w=e[3];let v=w,D;e[4]!==c?(D=()=>{c()},e[4]=c,e[5]=D):D=e[5];let x=D,E,g;e[6]!==d||e[7]!==f||e[8]!==v||e[9]!==i?(E=()=>{if(!i)return;let L=f[d];L&&!L?.isOpen&&(l(!1),setTimeout(()=>{v()},1))},g=[f,d,v,i],e[6]=d,e[7]=f,e[8]=v,e[9]=i,e[10]=E,e[11]=g):(E=e[10],g=e[11]),hm(E,g);let _;e[12]!==a?(_=L=>lm(a,{...L,onClick:()=>{C()}}),e[12]=a,e[13]=_):_=e[13];let N;e[14]!==p?(N=()=>{C(),p(),l(!0)},e[14]=p,e[15]=N):N=e[15];let k;return e[16]!==s||e[17]!==x||e[18]!==m||e[19]!==d||e[20]!==_||e[21]!==N?(k={closeListDrawer:x,isListDrawerOpen:m,ListDrawer:s,listDrawerSlug:d,ListDrawerToggler:_,openListDrawer:N},e[16]=s,e[17]=x,e[18]=m,e[19]=d,e[20]=_,e[21]=N,e[22]=k):k=e[22],k};var _m=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=xm(o);r&&r.replace(Ue({relationTo:e,value:n}))}):t.dispatchCommand(Bo,{relationTo:e,value:n})},el=t=>{let e=gm(21),{enabledCollectionSlugs:o}=t,[n]=Cm(),r;e[0]!==o?(r=()=>o?.[0],e[0]=o,e[1]=r):r=e[1];let[i,l]=Qi(r),[s,a]=Qi(null),u=o||void 0,c;e[2]!==i||e[3]!==u?(c={collectionSlugs:u,selectedCollection:i},e[2]=i,e[3]=u,e[4]=c):c=e[4];let{closeListDrawer:d,isListDrawerOpen:m,ListDrawer:p,openListDrawer:f}=lt(c),h,C;e[5]!==n||e[6]!==f?(h=()=>n.registerCommand(je,g=>(a(g?.replace?g?.replace.nodeKey:null),f(),!0),bm),C=[n,f],e[5]=n,e[6]=f,e[7]=h,e[8]=C):(h=e[7],C=e[8]),qi(h,C);let w;e[9]!==d||e[10]!==n||e[11]!==s?(w=g=>{let{collectionSlug:_,docID:N}=g;_m({editor:n,relationTo:_,replaceNodeKey:s,value:N}),d()},e[9]=d,e[10]=n,e[11]=s,e[12]=w):w=e[12];let v=w,D;e[13]!==o?(D=()=>{l(o?.[0])},e[13]=o,e[14]=D):D=e[14];let x;e[15]!==o||e[16]!==m?(x=[m,o],e[15]=o,e[16]=m,e[17]=x):x=e[17],qi(D,x);let E;return e[18]!==p||e[19]!==v?(E=Pt(p,{onSelect:v}),e[18]=p,e[19]=v,e[20]=E):E=e[20],E},tl=t=>(t?.enabledCollectionSlugs?.length??-1)>0?Pt(el,{...t}):Pt(bt,{...t,children:Pt(el,{...t})});var Bo=ym("INSERT_RELATIONSHIP_COMMAND"),rl=t=>{let e=Tm(10),{clientProps:o}=t,[n]=wm(),{config:r}=Nm(),{collections:i}=r,l=null;if(o?.enabledCollections)l=o?.enabledCollections;else if(o?.disabledCollections){let c;if(e[0]!==o?.disabledCollections||e[1]!==i){let d;e[3]!==o?.disabledCollections?(d=m=>{let{slug:p}=m;return!o?.disabledCollections?.includes(p)},e[3]=o?.disabledCollections,e[4]=d):d=e[4],c=i.filter(d).map(Mm),e[0]=o?.disabledCollections,e[1]=i,e[2]=c}else c=e[2];l=c}let s,a;e[5]!==n?(s=()=>{if(!n.hasNodes([Ge]))throw new Error("RelationshipPlugin: RelationshipNode not registered on editor");return n.registerCommand(Bo,Am,Sm)},a=[n],e[5]=n,e[6]=s,e[7]=a):(s=e[6],a=e[7]),vm(s,a);let u;return e[8]!==l?(u=Em(tl,{enabledCollectionSlugs:l}),e[8]=l,e[9]=u):u=e[9],u};function Mm(t){let{slug:e}=t;return e}function Dm(t){return ol(t)}function Am(t){let e=Rm()||Lm();if(Im(e)){let o=Ue(t);km(o);let{focus:n}=e,r=n.getNode();ol(r)&&r.getTextContentSize()===0&&r.getParentOrThrow().getChildren().filter(Dm).length>1&&r.remove()}return!0}var Om=y({nodes:[Ge],plugins:[{Component:rl,position:"normal"}],slashMenu:{groups:[Z([{Icon:Po,key:"relationship",keywords:["relationship","relation","rel"],label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,{replace:!1})}}])]},toolbarFixed:{groups:[me([{ChildComponent:Po,isActive:({selection:t})=>{if(!Fm(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return lo(e)},key:"relationship",label:({i18n:t})=>t.t("lexical:relationship:label"),onSelect:({editor:t})=>{t.dispatchCommand(je,{replace:!1})}}])]}});import{c as ul}from"react/compiler-runtime";import{jsx as ne,jsxs as ep}from"react/jsx-runtime";import{useLexicalComposerContext as tp}from"@lexical/react/LexicalComposerContext.js";import{useScrollInfo as op,useThrottledEffect as rp,useTranslation as np}from"@payloadcms/ui";import*as Ce from"react";import{useMemo as ip}from"react";import{c as $m}from"react/compiler-runtime";import{jsx as Pm}from"react/jsx-runtime";import{mergeRegister as Bm}from"@lexical/utils";import{$addUpdateTag as Hm,$getSelection as jm}from"lexical";import{useEffect as Bt,useState as Ho}from"react";var jo="toolbar-popup__button",st=t=>{let e=$m(34),{children:o,editor:n,item:r}=t,[i,l]=Ho(!0),[s,a]=Ho(!1),[u,c]=Ho(jo),d=B(),m;e[0]!==s||e[1]!==n||e[2]!==d||e[3]!==i||e[4]!==r?(m=()=>{n.getEditorState().read(()=>{let N=jm();if(N){if(r.isActive){let k=r.isActive({editor:n,editorConfigContext:d,selection:N});s!==k&&a(k)}if(r.isEnabled){let k=r.isEnabled({editor:n,editorConfigContext:d,selection:N});i!==k&&l(k)}}})},e[0]=s,e[1]=n,e[2]=d,e[3]=i,e[4]=r,e[5]=m):m=e[5];let p=m,f,h;e[6]!==p?(f=()=>{p()},h=[p],e[6]=p,e[7]=f,e[8]=h):(f=e[7],h=e[8]),Bt(f,h);let C,w;e[9]!==p?(C=()=>(document.addEventListener("mouseup",p),()=>{document.removeEventListener("mouseup",p)}),w=[p],e[9]=p,e[10]=C,e[11]=w):(C=e[10],w=e[11]),Bt(C,w);let v,D;e[12]!==n||e[13]!==p?(v=()=>Bm(n.registerUpdateListener(()=>{p()})),D=[n,p],e[12]=n,e[13]=p,e[14]=v,e[15]=D):(v=e[14],D=e[15]),Bt(v,D);let x;e[16]!==s||e[17]!==i||e[18]!==r.key?(x=()=>{c([jo,i===!1?"disabled":"",s?"active":"",r?.key?`${jo}-`+r.key:""].filter(Boolean).join(" "))},e[16]=s,e[17]=i,e[18]=r.key,e[19]=x):x=e[19];let E;e[20]!==s||e[21]!==u||e[22]!==i||e[23]!==r.key?(E=[i,s,u,r.key],e[20]=s,e[21]=u,e[22]=i,e[23]=r.key,e[24]=E):E=e[24],Bt(x,E);let g;e[25]!==s||e[26]!==n||e[27]!==i||e[28]!==r?(g=()=>{if(i!==!1)return n.focus(()=>{n.update(Gm),r.onSelect?.({editor:n,isActive:s})}),!0},e[25]=s,e[26]=n,e[27]=i,e[28]=r,e[29]=g):g=e[29];let _;return e[30]!==o||e[31]!==u||e[32]!==g?(_=Pm("button",{className:u,onClick:g,onMouseDown:Um,type:"button",children:o}),e[30]=o,e[31]=u,e[32]=g,e[33]=_):_=e[33],_};function Gm(){Hm("toolbar")}function Um(t){t.preventDefault()}import{c as cl}from"react/compiler-runtime";import{jsx as $e}from"react/jsx-runtime";import Wo,{useEffect as al}from"react";import{mergeRegister as Ym}from"@lexical/utils";import{useTranslation as Jm}from"@payloadcms/ui";import{$getSelection as qm}from"lexical";import{jsx as Te,jsxs as nl}from"react/jsx-runtime";import{Button as Wm}from"@payloadcms/ui";import{$addUpdateTag as Vm}from"lexical";import Ht,{useCallback as Km,useEffect as at,useMemo as zm,useRef as Uo,useState as jt}from"react";import{createPortal as Zm}from"react-dom";var Go="toolbar-popup__dropdown-item",il=Ht.createContext(null);function ll({active:t,children:e,editor:o,enabled:n,Icon:r,item:i,tooltip:l}){let[s,a]=jt(Go);at(()=>{a([Go,n===!1?"disabled":"",t?"active":"",i?.key?`${Go}-${i.key}`:""].filter(Boolean).join(" "))},[n,t,s,i.key]);let u=Uo(null),c=Ht.useContext(il);if(c===null)throw new Error("DropDownItem must be used within a DropDown");let{registerItem:d}=c;return at(()=>{u?.current!=null&&d(u)},[u,d]),Te(Wm,{"aria-label":l,buttonStyle:"none",className:s,disabled:n===!1,icon:r,iconPosition:"left",iconStyle:"none",onClick:()=>{n!==!1&&o.focus(()=>{o.update(()=>{Vm("toolbar")}),i.onSelect?.({editor:o,isActive:t})})},onMouseDown:m=>{m.preventDefault()},ref:u,tooltip:l,type:"button",children:e})}function Xm({children:t,dropDownRef:e,itemsContainerClassNames:o,onClose:n}){let[r,i]=jt(),[l,s]=jt(),a=Km(d=>{i(m=>m!=null?[...m,d]:[d])},[i]),u=d=>{if(r==null)return;let{key:m}=d;["ArrowDown","ArrowUp","Escape","Tab"].includes(m)&&d.preventDefault(),m==="Escape"||m==="Tab"?n():m==="ArrowUp"?s(p=>{if(p==null)return r[0];let f=r.indexOf(p)-1;return r[f===-1?r.length-1:f]}):m==="ArrowDown"&&s(p=>p==null?r[0]:r[r.indexOf(p)+1])},c=zm(()=>({registerItem:a}),[a]);return at(()=>{r!=null&&l==null&&s(r[0]),l!=null&&l?.current!=null&&l.current.focus()},[r,l]),Te(il.Provider,{value:c,children:Te("div",{className:(o??["toolbar-popup__dropdown-items"]).join(" "),onKeyDown:u,ref:e,children:t})})}function sl({buttonAriaLabel:t,buttonClassName:e,children:o,disabled:n=!1,Icon:r,itemsContainerClassNames:i,label:l,stopCloseOnClickSelf:s}){let a=Uo(null),u=Uo(null),[c,d]=jt(!1),m=()=>{d(!1),u?.current!=null&&u.current.focus()};at(()=>{let f=u.current,h=a.current;if(c&&f!==null&&h!==null){let{left:C,top:w}=f.getBoundingClientRect(),v=window.scrollY||document.documentElement.scrollTop;h.style.top=`${w+v+f.offsetHeight+5}px`,h.style.left=`${Math.min(C-5,window.innerWidth-h.offsetWidth-20)}px`}},[a,u,c]),at(()=>{let f=u.current;if(f!==null&&c){let h=C=>{let{target:w}=C;s!=null&&a.current!=null&&a.current.contains(w)||f.contains(w)||d(!1)};return document.addEventListener("click",h),()=>{document.removeEventListener("click",h)}}},[a,u,c,s]);let p=Zm(Te(Xm,{dropDownRef:a,itemsContainerClassNames:i,onClose:m,children:o}),document.body);return nl(Ht.Fragment,{children:[nl("button",{"aria-label":t,className:e+(c?" active":""),disabled:n,onClick:f=>{f.preventDefault(),d(!c)},onMouseDown:f=>{f.preventDefault()},ref:u,type:"button",children:[r&&Te(r,{}),l&&Te("span",{className:"toolbar-popup__dropdown-label",children:l}),Te("i",{className:"toolbar-popup__dropdown-caret"})]}),c&&Te(Ht.Fragment,{children:p})]})}var Vo="toolbar-popup__dropdown",Qm=t=>{let e=cl(18),{active:o,anchorElem:n,editor:r,enabled:i,item:l}=t,{i18n:s}=Jm(),{fieldProps:a}=B(),{featureClientSchemaMap:u,schemaPath:c}=a;if(l.Component){let f;return e[0]!==o||e[1]!==n||e[2]!==r||e[3]!==i||e[4]!==l?(f=l?.Component&&$e(l.Component,{active:o,anchorElem:n,editor:r,enabled:i,item:l},l.key),e[0]=o,e[1]=n,e[2]=r,e[3]=i,e[4]=l,e[5]=f):f=e[5],f}let d=l.key,m;if(l.label){let f;e[6]!==u||e[7]!==s||e[8]!==l||e[9]!==c?(f=typeof l.label=="function"?l.label({featureClientSchemaMap:u,i18n:s,schemaPath:c}):l.label,e[6]=u,e[7]=s,e[8]=l,e[9]=c,e[10]=f):f=e[10],d=f}d.length>25?m=d.substring(0,25)+"...":m=d;let p;return e[11]!==o||e[12]!==m||e[13]!==r||e[14]!==i||e[15]!==l||e[16]!==d?(p=$e(ll,{active:o,editor:r,enabled:i,Icon:l?.ChildComponent?$e(l.ChildComponent,{}):void 0,item:l,tooltip:d,children:$e("span",{className:"text",children:m})},l.key),e[11]=o,e[12]=m,e[13]=r,e[14]=i,e[15]=l,e[16]=d,e[17]=p):p=e[17],p},Se=t=>{let e=cl(36),{anchorElem:o,classNames:n,editor:r,group:i,Icon:l,itemsContainerClassNames:s,label:a,maxActiveItems:u,onActiveChange:c}=t,d;e[0]===Symbol.for("react.memo_cache_sentinel")?(d=[],e[0]=d):d=e[0];let[m,p]=Wo.useState(d),f;e[1]===Symbol.for("react.memo_cache_sentinel")?(f=[],e[1]=f):f=e[1];let[h,C]=Wo.useState(f),[w,v]=Wo.useState(!0),D=B(),{items:x,key:E}=i,g;e[2]!==r||e[3]!==D||e[4]!==i||e[5]!==x||e[6]!==u||e[7]!==c?(g=()=>{r.getEditorState().read(()=>{let $=qm();if(!$)return;let W=[],J=[],U=[];for(let H of x)H.isActive&&(!u||W.length<u)&&H.isActive({editor:r,editorConfigContext:D,selection:$})&&(W.push(H.key),J.push(H)),H.isEnabled?H.isEnabled({editor:r,editorConfigContext:D,selection:$})&&U.push(H.key):U.push(H.key);i.isEnabled&&v(i.isEnabled({editor:r,editorConfigContext:D,selection:$})),p(W),C(U),c&&c({activeItems:J})})},e[2]=r,e[3]=D,e[4]=i,e[5]=x,e[6]=u,e[7]=c,e[8]=g):g=e[8];let _=g,N,k;e[9]!==_?(N=()=>{_()},k=[_],e[9]=_,e[10]=N,e[11]=k):(N=e[10],k=e[11]),al(N,k);let L,I;e[12]!==r||e[13]!==_?(L=()=>Ym(r.registerUpdateListener(()=>{_()})),I=[r,_],e[12]=r,e[13]=_,e[14]=L,e[15]=I):(L=e[14],I=e[15]),al(L,I);let b=`${E} dropdown`,T=`${Vo}-${E}`,S;e[16]!==n?(S=n||[],e[16]=n,e[17]=S):S=e[17];let R;e[18]!==S||e[19]!==T?(R=[Vo,T,...S].filter(Boolean),e[18]=S,e[19]=T,e[20]=R):R=e[20];let A=R.join(" "),M=!w,O;e[21]!==s?(O=s||[],e[21]=s,e[22]=O):O=e[22];let G;return e[23]!==l||e[24]!==m||e[25]!==o||e[26]!==r||e[27]!==h||e[28]!==E||e[29]!==x||e[30]!==a||e[31]!==A||e[32]!==M||e[33]!==O||e[34]!==b?(G=$e(sl,{buttonAriaLabel:b,buttonClassName:A,disabled:M,Icon:l,itemsContainerClassNames:[`${Vo}-items`,...O],label:a,children:x.length?x.map($=>$e(Qm,{active:m.includes($.key),anchorElem:o,editor:r,enabled:h.includes($.key),item:$},$.key)):null},E),e[23]=l,e[24]=m,e[25]=o,e[26]=r,e[27]=h,e[28]=E,e[29]=x,e[30]=a,e[31]=A,e[32]=M,e[33]=O,e[34]=b,e[35]=G):G=e[35],G};function lp({anchorElem:t,editor:e,item:o}){return o.Component?o?.Component&&ne(o.Component,{anchorElem:t,editor:e,item:o},o.key):o.ChildComponent?ne(st,{editor:e,item:o,children:ne(o.ChildComponent,{})},o.key):null}function sp(t){let e=ul(23),{anchorElem:o,editor:n,editorConfig:r,group:i,index:l}=t,{i18n:s}=np(),{fieldProps:a}=B(),{featureClientSchemaMap:u,schemaPath:c}=a,[d,m]=Ce.useState(void 0),[p,f]=Ce.useState(void 0),h;e[0]!==i.ChildComponent||e[1]!==i.items||e[2]!==i.type?(h=()=>{i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0)},e[0]=i.ChildComponent,e[1]=i.items,e[2]=i.type,e[3]=h):h=e[3];let C;e[4]!==i?(C=[i],e[4]=i,e[5]=C):C=e[5],Ce.useEffect(h,C);let w;e[6]!==u||e[7]!==i.ChildComponent||e[8]!==i.items||e[9]!==i.type||e[10]!==s||e[11]!==c?(w=E=>{let{activeItems:g}=E;if(!g.length){i?.type==="dropdown"&&i.items.length&&i.ChildComponent?(f(()=>i.ChildComponent),m(void 0)):(f(void 0),m(void 0));return}let _=g[0],N=_.key;_.label&&(N=typeof _.label=="function"?_.label({featureClientSchemaMap:u,i18n:s,schemaPath:c}):_.label),N.length>25&&(N=N.substring(0,25)+"..."),g.length===1?(m(N),f(()=>_.ChildComponent)):(m(s.t("lexical:general:toolbarItemsActive",{count:g.length})),i?.type==="dropdown"&&i.items.length&&i.ChildComponent?f(()=>i.ChildComponent):f(void 0))},e[6]=u,e[7]=i.ChildComponent,e[8]=i.items,e[9]=i.type,e[10]=s,e[11]=c,e[12]=w):w=e[12];let v=w,D=`fixed-toolbar__group fixed-toolbar__group-${i.key}`,x;return e[13]!==p||e[14]!==o||e[15]!==d||e[16]!==n||e[17]!==r.features.toolbarFixed?.groups.length||e[18]!==i||e[19]!==l||e[20]!==v||e[21]!==D?(x=ep("div",{className:D,children:[i.type==="dropdown"&&i.items.length?p?ne(Se,{anchorElem:o,editor:n,group:i,Icon:p,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:d,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):ne(Se,{anchorElem:o,editor:n,group:i,itemsContainerClassNames:["fixed-toolbar__dropdown-items"],label:d,maxActiveItems:i.maxActiveItems??1,onActiveChange:v}):null,i.type==="buttons"&&i.items.length?i.items.map(E=>ne(lp,{anchorElem:o,editor:n,item:E},E.key)):null,l<r.features.toolbarFixed?.groups.length-1&&ne("div",{className:"divider"})]},i.key),e[13]=p,e[14]=o,e[15]=d,e[16]=n,e[17]=r.features.toolbarFixed?.groups.length,e[18]=i,e[19]=l,e[20]=v,e[21]=D,e[22]=x):x=e[22],x}function ap({anchorElem:t,clientProps:e,editor:o,editorConfig:n,parentWithFixedToolbar:r}){let i=Ce.useRef(null),{y:l}=op(),s=ip(()=>{if(!r||e?.disableIfParentHasFixedToolbar)return null;let u=r.editorContainerRef.current.previousElementSibling;for(;u;){if(u.classList.contains("fixed-toolbar"))return u;u=u.previousElementSibling}return null},[e?.disableIfParentHasFixedToolbar,r]);return rp(()=>{if(!s)return;let a=i.current;if(!a)return;let u=a.getBoundingClientRect(),c=s.getBoundingClientRect();if(!(u.bottom<c.top||u.top>c.bottom))a.classList.remove("fixed-toolbar"),a.classList.add("fixed-toolbar","fixed-toolbar--overlapping"),s.classList.remove("fixed-toolbar"),s.classList.add("fixed-toolbar","fixed-toolbar--hide");else{if(!a.classList.contains("fixed-toolbar--overlapping"))return;a.classList.remove("fixed-toolbar--overlapping"),a.classList.add("fixed-toolbar"),s.classList.remove("fixed-toolbar--hide"),s.classList.add("fixed-toolbar")}},50,[i,s,l]),ne("div",{className:"fixed-toolbar",onFocus:a=>{a.stopPropagation()},ref:i,children:o.isEditable()&&ne(Ce.Fragment,{children:n?.features&&n.features?.toolbarFixed?.groups.map((a,u)=>ne(sp,{anchorElem:t,editor:o,editorConfig:n,group:a,index:u},a.key))})})}var dl=t=>{if(t.parentEditor?.editorConfig){if(t.parentEditor?.editorConfig.resolvedFeatureMap.has("toolbarFixed"))return t.parentEditor;if(t.parentEditor)return dl(t.parentEditor)}return!1},ml=t=>{let e=ul(6),{clientProps:o}=t,[n]=tp(),r=B(),{editorConfig:i}=r,l=o.applyToFocusedEditor&&r.focusedEditor?.editor||n,s=o.applyToFocusedEditor&&r.focusedEditor?.editorConfig||i,a,u;if(e[0]!==o.disableIfParentHasFixedToolbar||e[1]!==l||e[2]!==s||e[3]!==r){u=Symbol.for("react.early_return_sentinel");e:{let c=dl(r);if(o?.disableIfParentHasFixedToolbar&&c){u=null;break e}if(!s?.features?.toolbarFixed?.groups?.length){u=null;break e}a=ne(ap,{anchorElem:document.body,editor:l,editorConfig:s,parentWithFixedToolbar:c})}e[0]=o.disableIfParentHasFixedToolbar,e[1]=l,e[2]=s,e[3]=r,e[4]=a,e[5]=u}else a=e[4],u=e[5];return u!==Symbol.for("react.early_return_sentinel")?u:a};var cp=y({plugins:[{Component:ml,position:"aboveContainer"}]});import{c as hl}from"react/compiler-runtime";import{jsx as se,jsxs as gl}from"react/jsx-runtime";import{useLexicalComposerContext as up}from"@lexical/react/LexicalComposerContext.js";import{mergeRegister as Cl}from"@lexical/utils";import{$getSelection as xl,$isRangeSelection as pl,$isTextNode as dp,COMMAND_PRIORITY_LOW as mp,SELECTION_CHANGE_COMMAND as pp}from"lexical";import{useCallback as Ut,useEffect as ct,useRef as fl,useState as fp}from"react";import*as Wt from"react";import{createPortal as hp}from"react-dom";function Ko(t,e){let o=t.getRangeAt(0),n;if(t.anchorNode===e){let r=e;for(;r.firstElementChild!=null;)r=r.firstElementChild;n=r.getBoundingClientRect()}else n=o.getBoundingClientRect();return n}function Gt(t){let{alwaysDisplayOnTop:e=!1,anchorElem:o,anchorFlippedOffset:n=0,floatingElem:r,horizontalOffset:i=32,horizontalPosition:l="left",specialHandlingForCaret:s=!1,targetRect:a,verticalGap:u=10}=t,c=o.parentElement;if(a===null||c==null){r.style.opacity="0",r.style.transform="translate(-10000px, -10000px)";return}let d=r.getBoundingClientRect(),m=o.getBoundingClientRect(),p=c.getBoundingClientRect(),f=a.top-d.height-u,h=a.left-i;l==="center"&&(h=a.left+a.width/2-d.width/2);let C=0;return!e&&f<p.top&&!s&&(C=d.height+a.height+u*2,f+=C),l==="center"?h+d.width>p.right?h=p.right-d.width-i:h<p.left&&(h=p.left+i):h+d.width>p.right&&(h=p.right-d.width-i),h-=m.left,r.style.opacity="1",s&&n!==0?(f-=m.bottom-n+d.height-3,r.style.transform=`translate(${h}px, ${f}px) rotate(180deg)`):(f-=m.top,r.style.transform=`translate(${h}px, ${f}px)`),C}function gp({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(st,{editor:e,item:o,children:se(o.ChildComponent,{})},o.key):null}function Cp(t){let e=hl(19),{anchorElem:o,editor:n,group:r,index:i}=t,{editorConfig:l}=B(),[s,a]=Wt.useState(),u;e[0]!==r.ChildComponent||e[1]!==r.items||e[2]!==r.type?(u=()=>{r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0)},e[0]=r.ChildComponent,e[1]=r.items,e[2]=r.type,e[3]=u):u=e[3];let c;e[4]!==r?(c=[r],e[4]=r,e[5]=c):c=e[5],Wt.useEffect(u,c);let d;e[6]!==r.ChildComponent||e[7]!==r.items||e[8]!==r.type?(d=h=>{let{activeItems:C}=h;if(!C.length){r?.type==="dropdown"&&r.items.length&&r.ChildComponent?a(()=>r.ChildComponent):a(void 0);return}let w=C[0];a(()=>w.ChildComponent)},e[6]=r.ChildComponent,e[7]=r.items,e[8]=r.type,e[9]=d):d=e[9];let m=d,p=`inline-toolbar-popup__group inline-toolbar-popup__group-${r.key}`,f;return e[10]!==s||e[11]!==o||e[12]!==n||e[13]!==l.features.toolbarInline?.groups.length||e[14]!==r||e[15]!==i||e[16]!==m||e[17]!==p?(f=gl("div",{className:p,children:[r.type==="dropdown"&&r.items.length?s?se(Se,{anchorElem:o,editor:n,group:r,Icon:s,maxActiveItems:r.maxActiveItems??1,onActiveChange:m}):se(Se,{anchorElem:o,editor:n,group:r,maxActiveItems:r.maxActiveItems??1,onActiveChange:m}):null,r.type==="buttons"&&r.items.length?r.items.map(h=>se(gp,{anchorElem:o,editor:n,item:h},h.key)):null,i<l.features.toolbarInline?.groups.length-1&&se("div",{className:"divider"})]},r.key),e[10]=s,e[11]=o,e[12]=n,e[13]=l.features.toolbarInline?.groups.length,e[14]=r,e[15]=i,e[16]=m,e[17]=p,e[18]=f):f=e[18],f}function xp({anchorElem:t,editor:e}){let o=fl(null),n=fl(null),{editorConfig:r}=B(),i=Ut(()=>{if(o?.current){let u=o.current.style.opacity==="0",c=o.current.style.pointerEvents==="none";u||(o.current.style.opacity="0"),c||(o.current.style.pointerEvents="none")}},[o]),l=Ut(u=>{if(o?.current&&(u.buttons===1||u.buttons===3)){let c=o.current.style.opacity==="0",d=o.current.style.pointerEvents==="none";if(!c||!d){let m=u.clientX,p=u.clientY,f=document.elementFromPoint(m,p);o.current.contains(f)||i()}}},[i]),s=Ut(()=>{o?.current&&(o.current.style.opacity!=="1"&&(o.current.style.opacity="1"),o.current.style.pointerEvents!=="auto"&&(o.current.style.pointerEvents="auto"))},[]);ct(()=>(document.addEventListener("mousemove",l),document.addEventListener("mouseup",s),()=>{document.removeEventListener("mousemove",l),document.removeEventListener("mouseup",s)}),[o,l,s]);let a=Ut(()=>{let u=xl(),c=window.getSelection();if(o.current===null)return;let d=t.querySelector(":scope > .link-editor"),m=d!==null&&"style"in d&&d?.style?.opacity==="1",p=e.getRootElement();if(u!==null&&c!==null&&!c.isCollapsed&&p!==null&&p.contains(c.anchorNode)){let f=Ko(c,p),h=Gt({alwaysDisplayOnTop:m,anchorElem:t,floatingElem:o.current,horizontalPosition:"center",targetRect:f});n.current&&Gt({anchorElem:o.current,anchorFlippedOffset:h,floatingElem:n.current,horizontalOffset:5,horizontalPosition:"center",specialHandlingForCaret:!0,targetRect:f,verticalGap:8})}else i()},[e,i,t]);return ct(()=>{let u=t.parentElement,c=()=>{e.getEditorState().read(()=>{a()})};return window.addEventListener("resize",c),u&&u.addEventListener("scroll",c),()=>{window.removeEventListener("resize",c),u&&u.removeEventListener("scroll",c)}},[e,a,t]),ct(()=>(e.getEditorState().read(()=>{a()}),Cl(e.registerUpdateListener(({editorState:u})=>{u.read(()=>{a()})}),e.registerCommand(pp,()=>(a(),!1),mp))),[e,a]),gl("div",{className:"inline-toolbar-popup",ref:o,children:[se("div",{className:"caret",ref:n}),r?.features&&r.features?.toolbarInline?.groups.map((u,c)=>se(Cp,{anchorElem:t,editor:e,group:u,index:c},u.key))]})}function bp(t,e){let o=hl(12),[n,r]=fp(!1),i;o[0]!==t?(i=()=>{t.getEditorState().read(()=>{if(t.isComposing())return;let m=xl(),p=window.getSelection(),f=t.getRootElement();if(p!==null&&(!pl(m)||f===null||!f.contains(p.anchorNode))){r(!1);return}if(!pl(m))return;if(m.getTextContent()!==""){let C=m.getNodes(),w=!1;for(let v of C)if(dp(v)){r(!0),w=!0;break}w||r(!1)}else r(!1);let h=m.getTextContent().replace(/\n/g,"");if(!m.isCollapsed()&&h===""){r(!1);return}})},o[0]=t,o[1]=i):i=o[1];let l=i,s,a;o[2]!==l?(s=()=>(document.addEventListener("selectionchange",l),document.addEventListener("mouseup",l),()=>{document.removeEventListener("selectionchange",l),document.removeEventListener("mouseup",l)}),a=[l],o[2]=l,o[3]=s,o[4]=a):(s=o[3],a=o[4]),ct(s,a);let u,c;if(o[5]!==t||o[6]!==l?(u=()=>Cl(t.registerUpdateListener(()=>{l()}),t.registerRootListener(()=>{t.getRootElement()===null&&r(!1)})),c=[t,l],o[5]=t,o[6]=l,o[7]=u,o[8]=c):(u=o[7],c=o[8]),ct(u,c),!n||!t.isEditable())return null;let d;return o[9]!==e||o[10]!==t?(d=hp(se(xp,{anchorElem:e,editor:t}),e),o[9]=e,o[10]=t,o[11]=d):d=o[11],d}var bl=t=>{let{anchorElem:e}=t,[o]=up();return bp(o,e)};var _p=y({plugins:[{Component:bl,position:"floatingAnchorElem"}]});import{TableCellNode as c1,TableNode as u1,TableRowNode as d1}from"@lexical/table";import{jsx as _l}from"react/jsx-runtime";import"react";var zo=()=>_l("svg",{className:"icon",fill:"none",height:"20",viewBox:"0 0 20 20",width:"20",xmlns:"http://www.w3.org/2000/svg",children:_l("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 vp,$createTableNode as Mp,$createTableRowNode as Dp,$isTableCellNode as Ll,$isTableNode as Zo,$isTableRowNode as Xo,TableCellHeaderStates as Vt,TableCellNode as Ap,TableNode as Fp,TableRowNode as Op}from"@lexical/table";import{$isParagraphNode as $p,$isTextNode as Pp}from"lexical";var Tl=/^[\t ]*$/,Tp=/^(\s*)(\d+)\.\s/,Ep=/^(\s*)[-*+]\s/,wp=/^(\s*)(?:-\s)?\s?(\[(\s|x)?\])\s/i,El=/^(#{1,6})\s/,kp=/^>\s/,Np=/^[ \t]*\\?```(\w+)?/,Lp=/[ \t]*\\?```$/,Rp=/^[ \t]*\\?```[^`]+(?:(?:`{1,2}|`{4,})[^`]+)*\\?```(?:[^`]|$)/,Ip=/^\|(.+)\|\s?$/,Sp=/^(\| ?:?-*:? ?)+\|\s?$/,wl=/^[ \t]*<[a-z_][\w-]*(?:\s[^<>]*)?\/?>/i,kl=/^[ \t]*<\/[a-z_][\w-]*\s*>/i;function yp(t,e=!1){let o=t.split(`
|
|
36
|
+
`),n=!1,r=[];for(let i=0;i<o.length;i++){let l=o[i],s=r[r.length-1];if(Rp.test(l)){r.push(l);continue}if(Np.test(l)){n=!0,r.push(l);continue}if(Lp.test(l)){n=!1,r.push(l);continue}if(n){r.push(l);continue}Tl.test(l)||Tl.test(s)||!s||El.test(s)||El.test(l)||kp.test(l)||Tp.test(l)||Ep.test(l)||wp.test(l)||Ip.test(l)||Sp.test(l)||!e||wl.test(l)||kl.test(l)||wl.test(s)||kl.test(s)?r.push(l):r[r.length-1]=s+" "+l.trim()}return r.join(`
|
|
37
|
+
`)}function Nl(t,e=pr,o,n=!1,r=!0){let i=n?t:yp(t,r);return fr(i,e,o)}var Il=/^\|(.+)\|\s?$/,Bp=/^(\| ?:?-*:? ?)+\|\s?$/,Sl=({allTransformers:t})=>({type:"element",dependencies:[Fp,Op,Ap],export:e=>{if(!Zo(e))return null;let o=[];for(let n of e.getChildren()){let r=[];if(!Xo(n))continue;let i=!1;for(let l of n.getChildren())Ll(l)&&(r.push(hr(t,l).replace(/\n/g,"\\n")),l.__headerState===Vt.ROW&&(i=!0));o.push(`| ${r.join(" | ")} |`),i&&o.push(`| ${r.map(l=>"---").join(" | ")} |`)}return o.join(`
|
|
38
|
+
`)},regExp:Il,replace:(e,o,n)=>{if(Bp.test(n[0])){let c=e.getPreviousSibling();if(!c||!Zo(c))return;let d=c.getChildren(),m=d[d.length-1];if(!m||!Xo(m))return;m.getChildren().forEach(p=>{Ll(p)&&p.setHeaderStyles(Vt.ROW,Vt.ROW)}),e.remove();return}let r=Rl(n[0],t);if(r==null)return;let i=[r],l=e.getPreviousSibling(),s=r.length;for(;l&&!(!$p(l)||l.getChildrenSize()!==1);){let c=l.getFirstChild();if(!Pp(c))break;let d=Rl(c.getTextContent(),t);if(d==null)break;s=Math.max(s,d.length),i.unshift(d);let m=l.getPreviousSibling();l.remove(),l=m}let a=Mp();for(let c of i){let d=Dp();a.append(d);for(let m=0;m<s;m++)d.append(m<c.length?c[m]:yl("",t))}let u=e.getPreviousSibling();Zo(u)&&Hp(u)===s?(u.append(...a.getChildren()),e.remove()):e.replace(a),a.selectEnd()}});function Hp(t){let e=t.getFirstChild();return Xo(e)?e.getChildrenSize():0}var yl=(t,e)=>{t=t.replace(/\\n/g,`
|
|
39
|
+
`);let o=vp(Vt.NO_STATUS);return Nl(t,e,o),o},Rl=(t,e)=>{let o=t.match(Il);return!o||!o[1]?null:o[1].split("|").map(n=>yl(n,e))};import{c as Gp}from"react/compiler-runtime";import{jsx as P,jsxs as xe}from"react/jsx-runtime";import{useLexicalComposerContext as Al}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as Up}from"@lexical/react/useLexicalEditable";import{$deleteTableColumn__EXPERIMENTAL as Wp,$deleteTableRow__EXPERIMENTAL as Vp,$getNodeTriplet as Kp,$getTableCellNodeFromLexicalNode as zp,$getTableColumnIndexFromTableCellNode as Zp,$getTableNodeFromLexicalNodeOrThrow as ut,$getTableRowIndexFromTableCellNode as Xp,$insertTableColumn__EXPERIMENTAL as Yp,$insertTableRow__EXPERIMENTAL as Jp,$isTableCellNode as Kt,$isTableRowNode as Ml,$isTableSelection as Zt,$unmergeCell as qp,getTableObserverFromTableElement as Qp,TableCellHeaderStates as Ee,TableCellNode as ef}from"@lexical/table";import{useScrollInfo as tf}from"@payloadcms/ui";import{$createParagraphNode as of,$getRoot as rf,$getSelection as Xt,$isElementNode as nf,$isParagraphNode as Fl,$isRangeSelection as qo,$isTextNode as lf}from"lexical";import*as Qo from"react";import{useCallback as ae,useEffect as ye,useRef as zt,useState as Pe}from"react";import{createPortal as Ol}from"react-dom";import{jsx as Yo,jsxs as jp}from"react/jsx-runtime";import"react";var vl=()=>jp("svg",{fill:"none",height:"18",viewBox:"0 0 20 20",width:"18",xmlns:"http://www.w3.org/2000/svg",children:[Yo("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"}),Yo("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"}),Yo("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 Jo(t){let e=t.getShape();return{columns:e.toX-e.fromX+1,rows:e.toY-e.fromY+1}}function sf(){let t=Xt();if(qo(t)&&!t.isCollapsed()||Zt(t)&&!t.anchor.is(t.focus)||!qo(t)&&!Zt(t))return!1;let[e]=Kp(t.anchor);return e.__colSpan>1||e.__rowSpan>1}function Dl(t){if(t.getChildrenSize()!==1)return!1;let e=t.getFirstChildOrThrow();return!(!Fl(e)||!e.isEmpty())}function af(t){let e=t.getLastDescendant();lf(e)?e.select():nf(e)?e.selectEnd():e!==null&&e.selectNext()}function cf({cellMerge:t,contextRef:e,onClose:o,setIsMenuOpen:n,tableCellNode:r}){let[i]=Al(),l=zt(null),[s,a]=Pe(r),[u,c]=Pe({columns:1,rows:1}),[d,m]=Pe(!1),[p,f]=Pe(!1),{y:h}=tf();ye(()=>i.registerMutationListener(ef,b=>{b.get(s.getKey())==="updated"&&i.getEditorState().read(()=>{a(s.getLatest())})},{skipInitialization:!0}),[i,s]),ye(()=>{i.getEditorState().read(()=>{let b=Xt();if(Zt(b)){let T=Jo(b);c(Jo(b)),m(T.columns>1||T.rows>1)}f(sf())})},[i]),ye(()=>{let b=e.current,T=l.current,S=i.getRootElement();if(b!=null&&T!=null&&S!=null){let R=S.getBoundingClientRect(),A=b.getBoundingClientRect();T.style.opacity="1";let M=T.getBoundingClientRect(),O=5,G=A.right+O;if(G+M.width>window.innerWidth||G+M.width>R.right){let W=A.left-M.width-O;G=(W<0?O:W)+window.pageXOffset}T.style.left=`${G+window.pageXOffset}px`;let $=A.top;if($+M.height>window.innerHeight){let W=A.bottom-M.height;$=(W<0?O:W)+window.pageYOffset}T.style.top=`${$}px`}},[e,l,i,h]),ye(()=>{function b(T){l.current!=null&&e.current!=null&&!l.current.contains(T.target)&&!e.current.contains(T.target)&&n(!1)}return window.addEventListener("click",b),()=>window.removeEventListener("click",b)},[n,e]);let C=ae(()=>{i.update(()=>{if(s.isAttached()){let T=ut(s),S=i.getElementByKey(T.getKey());if(!S)throw new Error("Expected to find tableElement in DOM");let R=Qp(S);R!==null&&R.clearHighlight(),T.markDirty(),a(s.getLatest())}rf().selectStart()})},[i,s]),w=()=>{i.update(()=>{let b=Xt();if(Zt(b)){let{columns:T,rows:S}=Jo(b),R=b.getNodes(),A=null;for(let M=0;M<R.length;M++){let O=R[M];if(Kt(O))if(A===null){O.setColSpan(T).setRowSpan(S),A=O;let G=Dl(O),$;G&&Fl($=O.getFirstChild())&&$.remove()}else Kt(A)&&(Dl(O)||A.append(...O.getChildren()),O.remove())}A!==null&&(A.getChildrenSize()===0&&A.append(of()),af(A)),o()}})},v=()=>{i.update(()=>{qp()})},D=ae(b=>{i.update(()=>{Jp(b),o()})},[i,o]),x=ae(b=>{i.update(()=>{for(let T=0;T<u.columns;T++)Yp(b);o()})},[i,o,u.columns]),E=ae(()=>{i.update(()=>{Vp(),o()})},[i,o]),g=ae(()=>{i.update(()=>{ut(s).remove(),C(),o()})},[i,s,C,o]),_=ae(()=>{i.update(()=>{Wp(),o()})},[i,o]),N=ae(()=>{i.update(()=>{let b=ut(s),T=Xp(s),S=b.getChildren();if(T>=S.length||T<0)throw new Error("Expected table cell to be inside of table row.");let R=S[T];if(!Ml(R))throw new Error("Expected table row");let A=s.getHeaderStyles()^Ee.ROW;R.getChildren().forEach(M=>{if(!Kt(M))throw new Error("Expected table cell");M.setHeaderStyles(A,Ee.ROW)}),C(),o()})},[i,s,C,o]),k=ae(()=>{i.update(()=>{let b=ut(s),T=Zp(s),S=b.getChildren(),R=Math.max(...S.map(M=>M.getChildren().length));if(T>=R||T<0)throw new Error("Expected table cell to be inside of table row.");let A=s.getHeaderStyles()^Ee.COLUMN;for(let M=0;M<S.length;M++){let O=S[M];if(!Ml(O))throw new Error("Expected table row");let G=O.getChildren();if(T>=G.length)continue;let $=G[T];if(!Kt($))throw new Error("Expected table cell");$.setHeaderStyles(A,Ee.COLUMN)}C(),o()})},[i,s,C,o]),L=ae(()=>{i.update(()=>{if(s.isAttached()){let b=ut(s);b&&b.setRowStriping(!b.getRowStriping())}C(),o()})},[i,s,C,o]),I=null;return t&&(d?I=P("button",{className:"item","data-test-id":"table-merge-cells",onClick:()=>w(),type:"button",children:"Merge cells"}):p&&(I=P("button",{className:"item","data-test-id":"table-unmerge-cells",onClick:()=>v(),type:"button",children:"Unmerge cells"}))),Ol(xe("div",{className:"table-action-menu-dropdown",onClick:b=>{b.stopPropagation()},ref:l,children:[I?xe(Qo.Fragment,{children:[I,P("hr",{})]}):null,P("button",{className:"item","data-test-id":"table-row-striping",onClick:()=>L(),type:"button",children:P("span",{className:"text",children:"Toggle Row Striping"})}),P("button",{className:"item","data-test-id":"table-insert-row-above",onClick:()=>D(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," above"]})}),P("button",{className:"item","data-test-id":"table-insert-row-below",onClick:()=>D(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.rows===1?"row":`${u.rows} rows`," below"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-insert-column-before",onClick:()=>x(!1),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","left"]})}),P("button",{className:"item","data-test-id":"table-insert-column-after",onClick:()=>x(!0),type:"button",children:xe("span",{className:"text",children:["Insert ",u.columns===1?"column":`${u.columns} columns`," ","right"]})}),P("hr",{}),P("button",{className:"item","data-test-id":"table-delete-columns",onClick:()=>_(),type:"button",children:P("span",{className:"text",children:"Delete column"})}),P("button",{className:"item","data-test-id":"table-delete-rows",onClick:()=>E(),type:"button",children:P("span",{className:"text",children:"Delete row"})}),P("button",{className:"item","data-test-id":"table-delete",onClick:()=>g(),type:"button",children:P("span",{className:"text",children:"Delete table"})}),P("hr",{}),P("button",{className:"item",onClick:()=>N(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Ee.ROW)===Ee.ROW?"Remove":"Add"," ","row header"]})}),P("button",{className:"item","data-test-id":"table-column-header",onClick:()=>k(),type:"button",children:xe("span",{className:"text",children:[(s.__headerState&Ee.COLUMN)===Ee.COLUMN?"Remove":"Add"," ","column header"]})})]}),document.body)}function uf({anchorElem:t,cellMerge:e}){let[o]=Al(),n=zt(null),r=zt(null),[i,l]=Pe(!1),[s,a]=Pe(null),u=ae(()=>{let d=n.current,m=Xt(),p=window.getSelection(),f=document.activeElement;if(m==null||d==null){a(null);return}let h=o.getRootElement();if(qo(m)&&h!==null&&p!==null&&h.contains(p.anchorNode)){let C=zp(m.anchor.getNode());if(C==null){a(null);return}if(o.getElementByKey(C.getKey())==null){a(null);return}a(C)}else f||a(null)},[o]);ye(()=>o.registerUpdateListener(()=>{o.getEditorState().read(()=>{u()})})),ye(()=>{let d=n.current;if(d!=null&&s!=null){let m=o.getElementByKey(s.getKey());if(m!=null){let p=m.getBoundingClientRect(),f=d.getBoundingClientRect(),h=t.getBoundingClientRect(),C=p.top-h.top+4,w=p.right-f.width-10-h.left;d.style.opacity="1",d.style.transform=`translate(${w}px, ${C}px)`}else d.style.opacity="0",d.style.transform="translate(-10000px, -10000px)"}},[n,s,o,t]);let c=zt(s);return ye(()=>{c.current!==s&&l(!1),c.current=s},[c,s]),P("div",{className:"table-cell-action-button-container",ref:n,children:s!=null&&xe(Qo.Fragment,{children:[P("button",{className:"table-cell-action-button",onClick:d=>{d.stopPropagation(),l(!i)},ref:r,type:"button",children:P(vl,{})}),i&&P(cf,{cellMerge:e,contextRef:r,onClose:()=>l(!1),setIsMenuOpen:l,tableCellNode:s})]})})}var $l=t=>{let e=Gp(3),{anchorElem:o}=t,n=Up(),r;return e[0]!==o||e[1]!==n?(r=Ol(n?P(uf,{anchorElem:o??document.body,cellMerge:!0}):null,o??document.body),e[0]=o,e[1]=n,e[2]=r):r=e[2],r};import{c as df}from"react/compiler-runtime";import{jsx as Jt,jsxs as mf}from"react/jsx-runtime";import{useLexicalComposerContext as pf}from"@lexical/react/LexicalComposerContext";import{useLexicalEditable as ff}from"@lexical/react/useLexicalEditable";import{$computeTableMapSkipCellCheck as hf,$getTableNodeFromLexicalNodeOrThrow as er,$getTableRowIndexFromTableCellNode as gf,$isTableCellNode as Pl,$isTableRowNode as Cf,getDOMCellFromTarget as xf,TableNode as bf}from"@lexical/table";import{calculateZoomLevel as Bl}from"@lexical/utils";import{$getNearestNodeFromDOMNode as tr}from"lexical";import*as jl from"react";import{useCallback as dt,useEffect as or,useRef as Yt,useState as mt}from"react";import{createPortal as _f}from"react-dom";var Tf=33,Hl=92;function Ef({editor:t}){let e=Yt(null),o=Yt(null),n=Yt(null),r=B(),i=Yt(null),[l,s]=mt(null),[a,u]=mt(null),[c,d]=mt(!1),[m,p]=mt(null),f=dt(()=>{u(null),e.current=null,p(null),i.current=null,n.current=null},[]),h=k=>(k.buttons&1)===1;or(()=>t.registerNodeTransform(bf,k=>{if(k.getColWidths())return k;let L=k.getColumnCount(),I=Hl;return k.setColWidths(Array(L).fill(I)),k}),[t]),or(()=>{let k=T=>{setTimeout(()=>{let S=T.target;if(m){s({x:T.clientX,y:T.clientY});return}if(d(h(T)),!(o.current&&o.current.contains(S))&&e.current!==S){e.current=S;let R=xf(S);R&&a!==R?t.update(()=>{let A=tr(R.elem);if(!A)throw new Error("TableCellResizer: Table cell node not found.");let M=er(A),O=t.getElementByKey(M.getKey());if(!O)throw new Error("TableCellResizer: Table element not found.");e.current=S,n.current=O.getBoundingClientRect(),u(R)}):R==null&&f()}},0)},L=T=>{setTimeout(()=>{d(!0)},0)},I=T=>{setTimeout(()=>{d(!1)},0)},b=t.registerRootListener((T,S)=>{S?.removeEventListener("mousemove",k),S?.removeEventListener("mousedown",L),S?.removeEventListener("mouseup",I),T?.addEventListener("mousemove",k),T?.addEventListener("mousedown",L),T?.addEventListener("mouseup",I)});return()=>{b()}},[a,m,t,f]);let C=k=>k==="bottom",w=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=tr(a.elem);if(!Pl(L))throw new Error("TableCellResizer: Table cell node not found.");let I=er(L),b=gf(L)+L.getRowSpan()-1,T=I.getChildren();if(b>=T.length||b<0)throw new Error("Expected table cell to be inside of table row.");let S=T[b];if(!Cf(S))throw new Error("Expected table row");let R=S.getHeight();if(R===void 0){let M=S.getChildren();R=Math.min(...M.map(O=>v(O,t)??1/0))}let A=Math.max(R+k,Tf);S.setHeight(A)},{tag:"skip-scroll-into-view"})},[a,t]),v=(k,L)=>L.getElementByKey(k.getKey())?.clientHeight,D=(k,L)=>{for(let I=0;I<L.length;I++)for(let b=0;b<L[I].length;b++)if(L[I][b].cell===k)return b},x=dt(k=>{if(!a)throw new Error("TableCellResizer: Expected active cell.");t.update(()=>{let L=tr(a.elem);if(!Pl(L))throw new Error("TableCellResizer: Table cell node not found.");let I=er(L),[b]=hf(I,null,null),T=D(L,b);if(T===void 0)throw new Error("TableCellResizer: Table column not found.");let S=I.getColWidths();if(!S)return;let R=S[T];if(R===void 0)return;let A=[...S],M=Math.max(R+k,Hl);A[T]=M,I.setColWidths(A)},{tag:"skip-scroll-into-view"})},[a,t]),E=dt(k=>{let L=I=>{if(I.preventDefault(),I.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");if(i.current){let{x:b,y:T}=i.current;if(a===null)return;let S=Bl(I.target);if(C(k)){let R=(I.clientY-T)/S;w(R)}else{let R=(I.clientX-b)/S;x(R)}f(),document.removeEventListener("mouseup",L)}};return L},[a,f,x,w]),g=dt(k=>L=>{if(L.preventDefault(),L.stopPropagation(),!a)throw new Error("TableCellResizer: Expected active cell.");i.current={x:L.clientX,y:L.clientY},s(i.current),p(k),document.addEventListener("mouseup",E(k))},[a,E]),[_,N]=mt({bottom:null,left:null,right:null,top:null});return or(()=>{if(a){let{height:k,left:L,top:I,width:b}=a.elem.getBoundingClientRect(),T=Bl(a.elem),S=10,R={bottom:{backgroundColor:"none",cursor:"row-resize",height:`${S}px`,left:`${window.scrollX+L}px`,top:`${window.scrollY+I+k-S/2}px`,width:`${b}px`},right:{backgroundColor:"none",cursor:"col-resize",height:`${k}px`,left:`${window.scrollX+L+b-S/2}px`,top:`${window.scrollY+I}px`,width:`${S}px`}},A=n.current;m&&l&&A&&(C(m)?(R[m].left=`${window.scrollX+A.left}px`,R[m].top=`${window.scrollY+l.y/T}px`,R[m].height="3px",R[m].width=`${A.width}px`):(R[m].top=`${window.scrollY+A.top}px`,R[m].left=`${window.scrollX+l.x/T}px`,R[m].width="3px",R[m].height=`${A.height}px`),R[m].backgroundColor="#adf"),N(R)}else N({bottom:null,left:null,right:null,top:null})},[a,m,l]),Jt("div",{ref:o,children:a!=null&&!c&&mf(jl.Fragment,{children:[Jt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("right"),style:_.right||void 0}),Jt("div",{className:`${r.editorConfig.lexical.theme.tableCellResizer} TableCellResizer__ui`,onMouseDown:g("bottom"),style:_.bottom||void 0})]})})}var Gl=()=>{let t=df(3),[e]=pf(),o=ff(),n,r;return t[0]!==e||t[1]!==o?(r=o?_f(Jt(Ef,{editor:e}),document.body):null,t[0]=e,t[1]=o,t[2]=r):r=t[2],n=r,n};import{c as yf}from"react/compiler-runtime";import{jsx as rr,jsxs as vf,Fragment as Mf}from"react/jsx-runtime";import{useLexicalComposerContext as Yl}from"@lexical/react/LexicalComposerContext";import{$getTableColumnIndexFromTableCellNode as Df,$getTableRowIndexFromTableCellNode as Af,$insertTableColumn__EXPERIMENTAL as Ff,$insertTableRow__EXPERIMENTAL as Of,$isTableCellNode as $f,$isTableNode as Vl,TableNode as Pf}from"@lexical/table";import{$findMatchingParent as Bf,mergeRegister as Hf}from"@lexical/utils";import{$getNearestNodeFromDOMNode as Kl}from"lexical";import{useEffect as zl,useMemo as jf,useRef as Zl,useState as qt}from"react";import"react";import{createPortal as Gf}from"react-dom";import{c as Rf}from"react/compiler-runtime";import{useEffect as If,useRef as Sf}from"react";var wf="Expected a function",kf=Math.max,Nf=Math.min;function Lf(t,e,o){let n,r,i=0,l,s=!1,a=!1,u,c,d,m=!0;if(typeof t!="function")throw new TypeError(wf);e=e||0,typeof o=="object"&&(s=!!o.leading,a="maxWait"in o,u=a?kf(o.maxWait||0,e):u,m="trailing"in o?!!o.trailing:m);function p(g){let _=n,N=l;return n=l=void 0,i=g,c=t.apply(N,_),c}function f(g){return i=g,d=setTimeout(w,e),s?p(g):c}function h(g){let _=g-r,N=g-i,k=e-_;return a?Nf(k,u-N):k}function C(g){let _=g-r,N=g-i;return r===void 0||_>=e||_<0||a&&N>=u}function w(){let g=Date.now();if(C(g))return v(g);d=setTimeout(w,h(g))}function v(g){return d=void 0,m&&n?p(g):(n=l=void 0,c)}function D(){d!==void 0&&clearTimeout(d),i=0,n=r=l=d=void 0}function x(){return d===void 0?c:v(Date.now())}function E(){let g=Date.now(),_=C(g);if(n=arguments,l=this,r=g,_){if(d===void 0)return f(r);if(a)return clearTimeout(d),d=setTimeout(w,e),p(r)}return d===void 0&&(d=setTimeout(w,e)),c}return E.cancel=D,E.flush=x,E}var Ul=Lf;function Wl(t,e,o){let n=Rf(6),r=Sf(null),i,l;n[0]!==t||n[1]!==o||n[2]!==e?(i=()=>(r.current=Ul(t,e,{maxWait:o}),()=>{r.current?.cancel()}),l=[t,e,o],n[0]=t,n[1]=o,n[2]=e,n[3]=i,n[4]=l):(i=n[3],l=n[4]),If(i,l);let s;return n[5]===Symbol.for("react.memo_cache_sentinel")?(s=(...u)=>{let c=u;r.current&&r.current(...c)},n[5]=s):s=n[5],s}var Xl=20;function Uf({anchorElem:t}){let[e]=Yl(),o=B(),[n,r]=qt(!1),[i,l]=qt(!1),[s,a]=qt(!1),[u,c]=qt({}),d=Zl(new Set),m=Zl(null),p=Wl(C=>{let{isOutside:w,tableDOMNode:v}=Wf(C,o.editorConfig?.lexical);if(w){r(!1),l(!1);return}if(!v)return;m.current=v;let D=null,x=null,E=null;if(e.update(()=>{let g=Kl(v);if($f(g)){let _=Bf(g,N=>Vl(N));if(!Vl(_))return;if(E=e.getElementByKey(_?.getKey()),E){let N=_.getChildrenSize(),k=_.getChildAtIndex(0)?.getChildrenSize(),L=Af(g),I=Df(g);L===N-1?D=g:I===k-1&&(x=g)}}}),E){let{bottom:g,height:_,left:N,right:k,width:L,y:I}=E.getBoundingClientRect(),{left:b,y:T}=t.getBoundingClientRect();D?(l(!1),r(!0),c({height:Xl,left:N-b,top:g-T+5,width:L})):x&&(l(!0),r(!1),c({height:_,left:k-b+5,top:I-T,width:Xl}))}},50,250),f=jf(()=>new ResizeObserver(()=>{r(!1),l(!1)}),[]);zl(()=>{if(s)return document.addEventListener("mousemove",p),()=>{r(!1),l(!1),document.removeEventListener("mousemove",p)}},[s,p]),zl(()=>Hf(e.registerMutationListener(Pf,C=>{e.getEditorState().read(()=>{for(let[w,v]of C){let D=e.getElementByKey(w);switch(v){case"created":d.current.add(w),a(d.current.size>0),D&&f.observe(D);break;case"destroyed":d.current.delete(w),a(d.current.size>0),f.disconnect(),d.current.forEach(x=>{let E=e.getElementByKey(x);E&&f.observe(E)});break;default:break}}})},{skipInitialization:!1})),[e,f]);let h=C=>{e.update(()=>{m.current&&(Kl(m.current)?.selectEnd(),C?(Of(),r(!1)):(Ff(),l(!1)))})};return e?.isEditable()?vf(Mf,{children:[n&&rr("button",{className:o.editorConfig.lexical.theme.tableAddRows,onClick:()=>h(!0),style:{...u},type:"button"}),i&&rr("button",{className:o.editorConfig.lexical.theme.tableAddColumns,onClick:()=>h(!1),style:{...u},type:"button"})]}):null}function Wf(t,e){let o=t.target;if(o&&o instanceof HTMLElement){let n=o.closest(`td.${e.theme.tableCell}, th.${e.theme.tableCell}`);return{isOutside:!(n||o.closest(`button.${e.theme.tableAddRows}`)||o.closest(`button.${e.theme.tableAddColumns}`)||o.closest(`div.${e.theme.tableCellResizer}`)),tableDOMNode:n}}else return{isOutside:!0,tableDOMNode:null}}function Jl(t){let e=yf(2),{anchorElem:o}=t,n=o===void 0?document.body:o,[r]=Yl();if(!r?.isEditable())return null;let i;return e[0]!==n?(i=Gf(rr(Uf,{anchorElem:n}),n),e[0]=n,e[1]=i):i=e[1],i}import{c as Vf}from"react/compiler-runtime";import{jsx as nr,jsxs as Kf}from"react/jsx-runtime";import{useLexicalComposerContext as zf}from"@lexical/react/LexicalComposerContext";import{TablePlugin as Zf}from"@lexical/react/LexicalTablePlugin";import{INSERT_TABLE_COMMAND as Xf,TableNode as Yf}from"@lexical/table";import{mergeRegister as Jf}from"@lexical/utils";import{formatDrawerSlug as qf,useEditDepth as Qf}from"@payloadcms/ui";import{$getSelection as e1,$isRangeSelection as t1,COMMAND_PRIORITY_EDITOR as o1,createCommand as r1}from"lexical";import{createContext as n1,useContext as i1,useEffect as l1,useMemo as s1,useState as a1}from"react";import*as ql from"react";var Qt=r1("OPEN_EMBED_DRAWER_COMMAND"),Ql=n1({cellEditorConfig:null,cellEditorPlugins:null,set:()=>{}});function es({children:t}){let[e,o]=a1({cellEditorConfig:null,cellEditorPlugins:null});return nr(Ql.Provider,{value:s1(()=>({cellEditorConfig:e.cellEditorConfig,cellEditorPlugins:e.cellEditorPlugins,set:(n,r)=>{o({cellEditorConfig:n,cellEditorPlugins:r})}}),[e.cellEditorConfig,e.cellEditorPlugins]),children:t})}var ts=()=>{let t=Vf(16),[e]=zf(),o=i1(Ql),n=Qf(),{fieldProps:r,uuid:i}=B(),{schemaPath:l}=r,s="lexical-table-create-"+i,a;t[0]!==n||t[1]!==s?(a=qf({slug:s,depth:n}),t[0]=n,t[1]=s,t[2]=a):a=t[2];let u=a,{toggleDrawer:c}=ce(u,!0),d;t[3]!==e||t[4]!==c?(d=()=>{if(!e.hasNodes([Yf]))throw new Error("TablePlugin: TableNode is not registered on editor");return Jf(e.registerCommand(Qt,()=>{let h;return h=null,e.getEditorState().read(()=>{let C=e1();t1(C)&&(h=C)}),h&&c(),!0},o1))},t[3]=e,t[4]=c,t[5]=d):d=t[5];let m;t[6]!==o||t[7]!==e||t[8]!==c?(m=[o,e,c],t[6]=o,t[7]=e,t[8]=c,t[9]=m):m=t[9],l1(d,m);let p;t[10]!==e?(p=(h,C)=>{!C.columns||!C.rows||e.dispatchCommand(Xf,{columns:String(C.columns),rows:String(C.rows)})},t[10]=e,t[11]=p):p=t[11];let f;return t[12]!==u||t[13]!==l||t[14]!==p?(f=Kf(ql.Fragment,{children:[nr(He,{drawerSlug:u,drawerTitle:"Create Table",featureKey:"experimental_table",handleDrawerSubmit:p,schemaPath:l,schemaPathSuffix:"fields"}),nr(Zf,{hasCellBackgroundColor:!1,hasCellMerge:!0})]}),t[12]=u,t[13]=l,t[14]=p,t[15]=f):f=t[15],f};var m1=y({markdownTransformers:[Sl],nodes:[u1,c1,d1],plugins:[{Component:ts,position:"normal"},{Component:Gl,position:"normal"},{Component:$l,position:"floatingAnchorElem"},{Component:Jl,position:"floatingAnchorElem"}],providers:[es],slashMenu:{groups:[Z([{Icon:zo,key:"table",keywords:["table"],label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]},toolbarFixed:{groups:[me([{ChildComponent:zo,key:"table",label:"Table",onSelect:({editor:t})=>{t.dispatchCommand(Qt,{})}}])]}});import{$isNodeSelection as O1}from"lexical";import{jsx as ir,jsxs as p1}from"react/jsx-runtime";import"react";var lr=()=>p1("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:[ir("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"}),ir("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"}),ir("path",{d:"M16 11.9995L13.9427 9.94214C13.6926 9.69218 13.3536 9.55176 13 9.55176C12.6464 9.55176 12.3074 9.69218 12.0573 9.94214L6 15.9995",stroke:"currentColor",strokeLinecap:"round",strokeLinejoin:"round"})]});import{c as E1}from"react/compiler-runtime";import{jsx as w1}from"react/jsx-runtime";import{useLexicalComposerContext as k1}from"@lexical/react/LexicalComposerContext.js";import{$insertNodeToNearestRoot as N1,mergeRegister as L1}from"@lexical/utils";import{useConfig as R1}from"@payloadcms/ui";import{$getPreviousSelection as I1,$getSelection as S1,$isParagraphNode as y1,$isRangeSelection as v1,COMMAND_PRIORITY_EDITOR as M1,createCommand as D1}from"lexical";import{useEffect as A1}from"react";import{c as f1}from"react/compiler-runtime";import{jsx as sr}from"react/jsx-runtime";import{useLexicalComposerContext as h1}from"@lexical/react/LexicalComposerContext.js";import{$getNodeByKey as g1,COMMAND_PRIORITY_EDITOR as C1}from"lexical";import{useEffect as x1,useState as b1}from"react";var _1=({editor:t,relationTo:e,replaceNodeKey:o,value:n})=>{o?t.update(()=>{let r=g1(o);r&&r.replace(Ke({data:{fields:null,relationTo:e,value:n}}))}):t.dispatchCommand(ar,{fields:null,relationTo:e,value:n})},T1=t=>{let e=f1(13),{enabledCollectionSlugs:o}=t,[n]=h1(),[r,i]=b1(null),l;e[0]!==o?(l={collectionSlugs:o,uploads:!0},e[0]=o,e[1]=l):l=e[1];let{closeListDrawer:s,ListDrawer:a,openListDrawer:u}=lt(l),c,d;e[2]!==n||e[3]!==u?(c=()=>n.registerCommand(We,h=>(i(h?.replace?h?.replace.nodeKey:null),u(),!0),C1),d=[n,u],e[2]=n,e[3]=u,e[4]=c,e[5]=d):(c=e[4],d=e[5]),x1(c,d);let m;e[6]!==s||e[7]!==n||e[8]!==r?(m=h=>{let{collectionSlug:C,docID:w}=h;s(),_1({editor:n,relationTo:C,replaceNodeKey:r,value:w})},e[6]=s,e[7]=n,e[8]=r,e[9]=m):m=e[9];let p=m,f;return e[10]!==a||e[11]!==p?(f=sr(a,{onSelect:p}),e[10]=a,e[11]=p,e[12]=f):f=e[12],f},os=t=>sr(bt,{...t,uploads:!0,children:sr(T1,{...t})});var ar=D1("INSERT_UPLOAD_COMMAND"),rs=t=>{let e=E1(5),[o]=k1(),{config:n}=R1(),{collections:r}=n,i,l;e[0]!==o?(i=()=>{if(!o.hasNodes([Ve]))throw new Error("UploadPlugin: UploadNode not registered on editor");return L1(o.registerCommand(ar,a=>(o.update(()=>{let u=S1()||I1();if(v1(u)){let c=Ke({data:{id:a.id,fields:a.fields,relationTo:a.relationTo,value:a.value}});N1(c);let{focus:d}=u,m=d.getNode();y1(m)&&!m.__first&&(m.__prev||m.__next)&&m.remove()}}),!0),M1))},l=[o],e[0]=o,e[1]=i,e[2]=l):(i=e[1],l=e[2]),A1(i,l);let s;return e[3]!==r?(s=w1(os,{enabledCollectionSlugs:r.map(F1)}),e[3]=r,e[4]=s):s=e[4],s};function F1(t){let{slug:e}=t;return e}var $1=y({nodes:[Ve],plugins:[{Component:rs,position:"normal"}],slashMenu:{groups:[Z([{Icon:lr,key:"upload",keywords:["upload","image","file","img","picture","photo","media"],label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]},toolbarFixed:{groups:[me([{ChildComponent:lr,isActive:({selection:t})=>{if(!O1(t)||!t.getNodes().length)return!1;let e=t.getNodes()[0];return so(e)},key:"upload",label:({i18n:t})=>t.t("lexical:upload:label"),onSelect:({editor:t})=>{t.dispatchCommand(We,{replace:!1})}}])]}});import{c as P1}from"react/compiler-runtime";import{jsx as ur}from"react/jsx-runtime";import{ShimmerEffect as B1}from"@payloadcms/ui";import{lazy as H1,Suspense as j1,useEffect as G1,useState as U1}from"react";var ns={block:"LexicalEditorTheme__block",blockCursor:"LexicalEditorTheme__blockCursor",characterLimit:"LexicalEditorTheme__characterLimit",code:"LexicalEditorTheme__code",codeHighlight:{atrule:"LexicalEditorTheme__tokenAttr",attr:"LexicalEditorTheme__tokenAttr",boolean:"LexicalEditorTheme__tokenProperty",builtin:"LexicalEditorTheme__tokenSelector",cdata:"LexicalEditorTheme__tokenComment",char:"LexicalEditorTheme__tokenSelector",class:"LexicalEditorTheme__tokenFunction","class-name":"LexicalEditorTheme__tokenFunction",comment:"LexicalEditorTheme__tokenComment",constant:"LexicalEditorTheme__tokenProperty",deleted:"LexicalEditorTheme__tokenProperty",doctype:"LexicalEditorTheme__tokenComment",entity:"LexicalEditorTheme__tokenOperator",function:"LexicalEditorTheme__tokenFunction",important:"LexicalEditorTheme__tokenVariable",inserted:"LexicalEditorTheme__tokenSelector",keyword:"LexicalEditorTheme__tokenAttr",namespace:"LexicalEditorTheme__tokenVariable",number:"LexicalEditorTheme__tokenProperty",operator:"LexicalEditorTheme__tokenOperator",prolog:"LexicalEditorTheme__tokenComment",property:"LexicalEditorTheme__tokenProperty",punctuation:"LexicalEditorTheme__tokenPunctuation",regex:"LexicalEditorTheme__tokenVariable",selector:"LexicalEditorTheme__tokenSelector",string:"LexicalEditorTheme__tokenSelector",symbol:"LexicalEditorTheme__tokenProperty",tag:"LexicalEditorTheme__tokenProperty",url:"LexicalEditorTheme__tokenOperator",variable:"LexicalEditorTheme__tokenVariable"},embedBlock:{base:"LexicalEditorTheme__embedBlock",focus:"LexicalEditorTheme__embedBlockFocus"},hashtag:"LexicalEditorTheme__hashtag",heading:{h1:"LexicalEditorTheme__h1",h2:"LexicalEditorTheme__h2",h3:"LexicalEditorTheme__h3",h4:"LexicalEditorTheme__h4",h5:"LexicalEditorTheme__h5",h6:"LexicalEditorTheme__h6"},hr:"LexicalEditorTheme__hr",indent:"LexicalEditorTheme__indent",inlineImage:"LexicalEditor__inline-image",link:"LexicalEditorTheme__link",list:{checklist:"LexicalEditorTheme__checklist",listitem:"LexicalEditorTheme__listItem",listitemChecked:"LexicalEditorTheme__listItemChecked",listitemUnchecked:"LexicalEditorTheme__listItemUnchecked",nested:{listitem:"LexicalEditorTheme__nestedListItem"},olDepth:["LexicalEditorTheme__ol1","LexicalEditorTheme__ol2","LexicalEditorTheme__ol3","LexicalEditorTheme__ol4","LexicalEditorTheme__ol5"],ul:"LexicalEditorTheme__ul"},ltr:"LexicalEditorTheme__ltr",mark:"LexicalEditorTheme__mark",markOverlap:"LexicalEditorTheme__markOverlap",paragraph:"LexicalEditorTheme__paragraph",quote:"LexicalEditorTheme__quote",relationship:"LexicalEditorTheme__relationship",rtl:"LexicalEditorTheme__rtl",table:"LexicalEditorTheme__table",tableAddColumns:"LexicalEditorTheme__tableAddColumns",tableAddRows:"LexicalEditorTheme__tableAddRows",tableCell:"LexicalEditorTheme__tableCell",tableCellActionButton:"LexicalEditorTheme__tableCellActionButton",tableCellActionButtonContainer:"LexicalEditorTheme__tableCellActionButtonContainer",tableCellEditing:"LexicalEditorTheme__tableCellEditing",tableCellHeader:"LexicalEditorTheme__tableCellHeader",tableCellPrimarySelected:"LexicalEditorTheme__tableCellPrimarySelected",tableCellResizer:"LexicalEditorTheme__tableCellResizer",tableCellSelected:"LexicalEditorTheme__tableCellSelected",tableCellSortedIndicator:"LexicalEditorTheme__tableCellSortedIndicator",tableResizeRuler:"LexicalEditorTheme__tableCellResizeRuler",tableRowStriping:"LexicalEditorTheme__tableRowStriping",tableSelected:"LexicalEditorTheme__tableSelected",text:{bold:"LexicalEditorTheme__textBold",code:"LexicalEditorTheme__textCode",italic:"LexicalEditorTheme__textItalic",strikethrough:"LexicalEditorTheme__textStrikethrough",subscript:"LexicalEditorTheme__textSubscript",superscript:"LexicalEditorTheme__textSuperscript",underline:"LexicalEditorTheme__textUnderline",underlineStrikethrough:"LexicalEditorTheme__textUnderlineStrikethrough"},upload:"editor-upload"};var eo={namespace:"lexical",theme:ns};function is({featureClientSchemaMap:t,field:e,schemaPath:o,unSanitizedEditorConfig:n}){for(let s of n.features)if(!s?.clientFeatureProps?.featureKey||s?.clientFeatureProps?.order===void 0||s?.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.");n.features=n.features.sort((s,a)=>s.clientFeatureProps.order-a.clientFeatureProps.order);let r=new Map;for(let s of n.features)r.set(s.clientFeatureProps.featureKey,s);let i=new Map,l=0;for(let s of n.features){let a=typeof s.feature=="function"?s.feature({featureClientSchemaMap:t,featureProviderMap:r,field:e,resolvedFeatures:i,schemaPath:o,unSanitizedEditorConfig:n}):s.feature;a.key=s.clientFeatureProps.featureKey,a.order=l,i.set(s.clientFeatureProps.featureKey,a),l++}return i}var ls=t=>{let e={enabledFeatures:[],enabledFormats:[],markdownTransformers:[],nodes:[],plugins:[],providers:[],slashMenu:{dynamicGroups:[],groups:[]},toolbarFixed:{groups:[]},toolbarInline:{groups:[]}};if(!t?.size)return e;t.forEach(o=>{if(o.providers?.length&&(e.providers=e.providers.concat(o.providers)),o.enableFormats?.length&&e.enabledFormats.push(...o.enableFormats),o.nodes?.length)for(let n of o.nodes)e.nodes.push(n);if(o.plugins?.length&&o.plugins.forEach((n,r)=>{e.plugins?.push({clientProps:o.sanitizedClientFeatureProps,Component:n.Component,key:o.key+r,position:n.position})}),o.toolbarInline?.groups?.length)for(let n of o.toolbarInline.groups){let r=e.toolbarInline.groups.find(i=>i.key===n.key);r?e.toolbarInline.groups=e.toolbarInline.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarInline?.groups.push(r)}if(o.toolbarFixed?.groups?.length)for(let n of o.toolbarFixed.groups){let r=e.toolbarFixed.groups.find(i=>i.key===n.key);r?e.toolbarFixed.groups=e.toolbarFixed.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.toolbarFixed?.groups.push(r)}if(o.slashMenu?.groups){o.slashMenu.dynamicGroups?.length&&(e.slashMenu.dynamicGroups=e.slashMenu.dynamicGroups.concat(o.slashMenu.dynamicGroups));for(let n of o.slashMenu.groups){let r=e.slashMenu.groups.find(i=>i.key===n.key);r?e.slashMenu.groups=e.slashMenu.groups.filter(i=>i.key!==n.key):r={...n,items:[]},n?.items?.length&&(r.items=r.items.concat(n.items)),e.slashMenu.groups.push(r)}}if(o.markdownTransformers?.length)for(let n of o.markdownTransformers)typeof n=="function"?e.markdownTransformers.push(n({allNodes:e.nodes,allTransformers:e.markdownTransformers})):e.markdownTransformers.push(n);e.enabledFeatures.push(o.key)}),e.toolbarInline.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0),e.toolbarFixed.groups.sort((o,n)=>o.order&&n.order?o.order-n.order:o.order?-1:n.order?1:0);for(let o of e.toolbarInline.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);for(let o of e.toolbarFixed.groups)o.items.sort((n,r)=>n.order&&r.order?n.order-r.order:n.order?-1:r.order?1:0);return e};function cr(t,e,o){return{admin:o,features:ls(t),lexical:e,resolvedFeatureMap:t}}var W1=H1(()=>import("./Field-7XFZE2MU.js").then(t=>({default:t.RichText}))),V1=t=>{let e=P1(14),{admin:o,clientFeatures:n,featureClientSchemaMap:r,field:i,lexicalEditorConfig:l,schemaPath:s}=t,a;e[0]!==o?(a=o===void 0?{}:o,e[0]=o,e[1]=a):a=e[1];let u=a,c=l===void 0?eo:l,[d,m]=U1(null),p,f;e[2]!==u||e[3]!==n||e[4]!==r||e[5]!==i||e[6]!==d||e[7]!==c||e[8]!==s?(p=()=>{if(d)return;let C=[];for(let[D,x]of Object.entries(n))x.clientFeatureProvider&&C.push(x.clientFeatureProvider(x.clientFeatureProps));let w=c||eo,v=is({featureClientSchemaMap:r,field:i,schemaPath:s??i.name,unSanitizedEditorConfig:{features:C,lexical:w}});m(cr(v,w,u))},f=[c,u,d,n,r,i,s],e[2]=u,e[3]=n,e[4]=r,e[5]=i,e[6]=d,e[7]=c,e[8]=s,e[9]=p,e[10]=f):(p=e[9],f=e[10]),G1(p,f);let h;return e[11]!==d||e[12]!==t?(h=ur(j1,{fallback:ur(B1,{height:"35vh"}),children:d&&ur(W1,{...t,editorConfig:d})}),e[11]=d,e[12]=t,e[13]=h):h=e[13],h};function K1(...t){return t.filter(Boolean).join(" ")}var to=new WeakMap;function ss(t){let e=t.changedTouches[0];return e===void 0?null:[e.clientX,e.clientY]}function oo(t,e){let o=to.get(t);if(o===void 0){let n=new Set,r=l=>{o!==void 0&&(o.start=ss(l))},i=l=>{if(o===void 0)return;let{start:s}=o;if(s===null)return;let a=ss(l);for(let u of n)a!==null&&u([a[0]-s[0],a[1]-s[1]],l)};t.addEventListener("touchstart",r),t.addEventListener("touchend",i),o={handleTouchend:i,handleTouchstart:r,listeners:n,start:null},to.set(t,o)}return o.listeners.add(e),()=>{z1(t,e)}}function z1(t,e){let o=to.get(t);if(o===void 0)return;let{listeners:n}=o;n.delete(e),n.size===0&&(to.delete(t),t.removeEventListener("touchstart",o.handleTouchstart),t.removeEventListener("touchend",o.handleTouchend))}function Z1(t,e){return oo(t,(o,n)=>{let[r,i]=o;r<0&&-r>Math.abs(i)&&e(r,n)})}function X1(t,e){return oo(t,(o,n)=>{let[r,i]=o;r>0&&r>Math.abs(i)&&e(r,n)})}function Y1(t,e){return oo(t,(o,n)=>{let[r,i]=o;i<0&&-i>Math.abs(r)&&e(r,n)})}function J1(t,e){return oo(t,(o,n)=>{let[r,i]=o;i>0&&i>Math.abs(r)&&e(r,n)})}var F={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},q1=F.IS_BOLD|F.IS_ITALIC|F.IS_STRIKETHROUGH|F.IS_UNDERLINE|F.IS_CODE|F.IS_SUBSCRIPT|F.IS_SUPERSCRIPT|F.IS_HIGHLIGHT,Q1="\xA0",eh=`
|
|
40
40
|
|
|
41
|
-
`,
|
|
41
|
+
`,as="\u0591-\u07FF\uFB1D-\uFDFD\uFE70-\uFEFC",cs="A-Za-z\xC0-\xD6\xD8-\xF6\xF8-\u02B8\u0300-\u0590\u0800-\u1FFF\u200E\u2C00-\uFB1C\uFE00-\uFE6F\uFEFD-\uFFFF",th=new RegExp("^[^"+cs+"]*["+as+"]"),oh=new RegExp("^[^"+as+"]*["+cs+"]"),rh={bold:F.IS_BOLD,code:F.IS_CODE,highlight:F.IS_HIGHLIGHT,italic:F.IS_ITALIC,strikethrough:F.IS_STRIKETHROUGH,subscript:F.IS_SUBSCRIPT,superscript:F.IS_SUPERSCRIPT,underline:F.IS_UNDERLINE},nh={directionless:F.IS_DIRECTIONLESS,unmergeable:F.IS_UNMERGEABLE},ih={center:F.IS_ALIGN_CENTER,end:F.IS_ALIGN_END,justify:F.IS_ALIGN_JUSTIFY,left:F.IS_ALIGN_LEFT,right:F.IS_ALIGN_RIGHT,start:F.IS_ALIGN_START},lh={[F.IS_ALIGN_CENTER]:"center",[F.IS_ALIGN_END]:"end",[F.IS_ALIGN_JUSTIFY]:"justify",[F.IS_ALIGN_LEFT]:"left",[F.IS_ALIGN_RIGHT]:"right",[F.IS_ALIGN_START]:"start"},sh={normal:F.IS_NORMAL,segmented:F.IS_SEGMENTED,token:F.IS_TOKEN},ah={[F.IS_NORMAL]:"normal",[F.IS_SEGMENTED]:"segmented",[F.IS_TOKEN]:"token"};import{c as ch}from"react/compiler-runtime";import{jsx as uh}from"react/jsx-runtime";import"react";var dh=()=>{let t=ch(2),{EditButton:e}=ue(),o;return t[0]!==e?(o=e?uh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as mh}from"react/compiler-runtime";import{jsx as ph}from"react/jsx-runtime";import"react";var fh=()=>{let t=mh(2),{RemoveButton:e}=ue(),o;return t[0]!==e?(o=e?ph(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as hh}from"react/compiler-runtime";import{jsx as gh}from"react/jsx-runtime";import"react";var Ch=()=>{let t=hh(2),{Label:e}=ue(),o;return t[0]!==e?(o=e?gh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as xh}from"react/compiler-runtime";import{jsx as bh}from"react/jsx-runtime";import"react";var _h=t=>{let e=xh(3),{children:o}=t,{InlineBlockContainer:n}=ue(),r;return e[0]!==n||e[1]!==o?(r=n?bh(n,{children:o}):null,e[0]=n,e[1]=o,e[2]=r):r=e[2],r};import{c as Th}from"react/compiler-runtime";import{jsx as Eh}from"react/jsx-runtime";import"react";var wh=t=>{let e=Th(6),{children:o,editButton:n,Label:r,removeButton:i}=t,{BlockCollapsible:l}=ke(),s;return e[0]!==l||e[1]!==r||e[2]!==o||e[3]!==n||e[4]!==i?(s=l?Eh(l,{editButton:n,Label:r,removeButton:i,children:o}):null,e[0]=l,e[1]=r,e[2]=o,e[3]=n,e[4]=i,e[5]=s):s=e[5],s};import{c as kh}from"react/compiler-runtime";import{jsx as Nh}from"react/jsx-runtime";import"react";var Lh=()=>{let t=kh(2),{EditButton:e}=ke(),o;return t[0]!==e?(o=e?Nh(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};import{c as Rh}from"react/compiler-runtime";import{jsx as Ih}from"react/jsx-runtime";import"react";var Sh=()=>{let t=Rh(2),{RemoveButton:e}=ke(),o;return t[0]!==e?(o=e?Ih(e,{}):null,t[0]=e,t[1]=o):o=t[1],o};export{Qe as $createAutoLinkNode,It as $createBlockNode,no as $createInlineBlockNode,pe as $createLinkNode,Ue as $createRelationshipNode,Ke as $createUploadNode,he as $isAutoLinkNode,Rt as $isBlockNode,io as $isInlineBlockNode,V as $isLinkNode,lo as $isRelationshipNode,so as $isUploadNode,ws as AlignFeatureClient,fe as AutoLinkNode,wh as BlockCollapsible,Lh as BlockEditButton,de as BlockNode,Sh as BlockRemoveButton,Ss as BlockquoteFeatureClient,Na as BlocksFeatureClient,Ka as BoldFeatureClient,ds as CAN_USE_DOM,Rd as ChecklistFeatureClient,nh as DETAIL_TYPE_TO_DETAIL,eh as DOUBLE_LINE_BREAK,lh as ELEMENT_FORMAT_TO_TYPE,ih as ELEMENT_TYPE_TO_FORMAT,gs as ENABLE_SLASH_MENU_COMMAND,us as EditorConfigProvider,He as FieldsDrawer,cp as FixedToolbarFeatureClient,Ic as HeadingFeatureClient,Bc as HorizontalRuleFeatureClient,q1 as IS_ALL_FORMATTING,qc as IndentFeatureClient,_h as InlineBlockContainer,dh as InlineBlockEditButton,Ch as InlineBlockLabel,ro as InlineBlockNode,fh as InlineBlockRemoveButton,Ja as InlineCodeFeatureClient,_p as InlineToolbarFeatureClient,tc as ItalicFeatureClient,oh as LTR_REGEX,Xd as LexicalPluginToLexicalFeatureClient,md as LinkFeatureClient,Q as LinkNode,Q1 as NON_BREAKING_SPACE,F as NodeFormat,Fd as OrderedListFeatureClient,rm as ParagraphFeatureClient,fs as Point,th as RTL_REGEX,Cs as Rect,Om as RelationshipFeatureClient,Ge as RelationshipNode,V1 as RichTextField,tm as SlateToLexicalFeatureClient,lc as StrikethroughFeatureClient,uc as SubscriptFeatureClient,fc as SuperscriptFeatureClient,sh as TEXT_MODE_TO_TYPE,rh as TEXT_TYPE_TO_FORMAT,ah as TEXT_TYPE_TO_MODE,le as TOGGLE_LINK_COMMAND,m1 as TableFeatureClient,$a as TestRecorderFeatureClient,st as ToolbarButton,Se as ToolbarDropdown,Ga as TreeViewFeatureClient,bc as UnderlineFeatureClient,Ud as UnorderedListFeatureClient,$1 as UploadFeatureClient,Ve as UploadNode,J1 as addSwipeDownListener,Z1 as addSwipeLeftListener,X1 as addSwipeRightListener,Y1 as addSwipeUpListener,To as createBlockNode,y as createClientFeature,eo as defaultEditorLexicalConfig,Ko as getDOMRangeRect,xs as getEnabledNodes,Me as getSelectedNode,ps as isHTMLElement,hs as isPoint,K1 as joinClasses,cr as sanitizeClientEditorConfig,ls as sanitizeClientFeatures,Gt as setFloatingElemPosition,Ft as setFloatingElemPositionForLinkEditor,Z as slashMenuBasicGroupWithItems,me as toolbarAddDropdownGroupWithItems,wo as toolbarFeatureButtonsGroupWithItems,Y as toolbarFormatGroupWithItems,q as toolbarTextDropdownGroupWithItems,ke as useBlockComponentContext,B as useEditorConfigContext,ue as useInlineBlockComponentContext,ms as useLexicalDocumentDrawer,ce as useLexicalDrawer,lt as useLexicalListDrawer};
|
|
42
42
|
//# sourceMappingURL=index.js.map
|