@lexical/react 0.45.1-nightly.20260610.0 → 0.45.1-nightly.20260611.0

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.
Files changed (76) hide show
  1. package/dist/LexicalAutoEmbedPlugin.dev.js +1 -1
  2. package/dist/LexicalAutoEmbedPlugin.dev.mjs +1 -1
  3. package/dist/LexicalAutoEmbedPlugin.prod.js +1 -1
  4. package/dist/LexicalAutoEmbedPlugin.prod.mjs +1 -1
  5. package/dist/LexicalBlockWithAlignableContents.prod.js +1 -1
  6. package/dist/LexicalBlockWithAlignableContents.prod.mjs +1 -1
  7. package/dist/LexicalCharacterLimitPlugin.prod.js +2 -1
  8. package/dist/LexicalCharacterLimitPlugin.prod.mjs +2 -1
  9. package/dist/LexicalCollaborationContext.prod.js +2 -1
  10. package/dist/LexicalCollaborationContext.prod.mjs +2 -1
  11. package/dist/LexicalCollaborationPlugin.prod.js +1 -1
  12. package/dist/LexicalCollaborationPlugin.prod.mjs +1 -1
  13. package/dist/LexicalComposer.prod.js +1 -1
  14. package/dist/LexicalComposer.prod.mjs +1 -1
  15. package/dist/LexicalComposerContext.prod.js +1 -1
  16. package/dist/LexicalComposerContext.prod.mjs +1 -1
  17. package/dist/LexicalContentEditable.prod.js +2 -1
  18. package/dist/LexicalContentEditable.prod.mjs +2 -1
  19. package/dist/LexicalDraggableBlockPlugin.prod.js +1 -1
  20. package/dist/LexicalDraggableBlockPlugin.prod.mjs +1 -1
  21. package/dist/LexicalEditorRefPlugin.prod.js +1 -1
  22. package/dist/LexicalErrorBoundary.prod.js +2 -1
  23. package/dist/LexicalErrorBoundary.prod.mjs +2 -1
  24. package/dist/LexicalExtensionComponent.prod.js +2 -1
  25. package/dist/LexicalExtensionComponent.prod.mjs +2 -1
  26. package/dist/LexicalExtensionComposer.dev.js +1 -1
  27. package/dist/LexicalExtensionComposer.dev.mjs +1 -1
  28. package/dist/LexicalExtensionComposer.prod.js +2 -1
  29. package/dist/LexicalExtensionComposer.prod.mjs +2 -1
  30. package/dist/LexicalExtensionEditorComposer.prod.js +2 -1
  31. package/dist/LexicalExtensionEditorComposer.prod.mjs +2 -1
  32. package/dist/LexicalHorizontalRuleNode.prod.js +2 -1
  33. package/dist/LexicalHorizontalRuleNode.prod.mjs +2 -1
  34. package/dist/LexicalNestedComposer.prod.js +2 -1
  35. package/dist/LexicalNestedComposer.prod.mjs +2 -1
  36. package/dist/LexicalNodeContextMenuPlugin.prod.js +1 -1
  37. package/dist/LexicalNodeContextMenuPlugin.prod.mjs +1 -1
  38. package/dist/LexicalNodeMenuPlugin.dev.js +1 -1
  39. package/dist/LexicalNodeMenuPlugin.dev.mjs +2 -2
  40. package/dist/LexicalNodeMenuPlugin.prod.js +1 -1
  41. package/dist/LexicalNodeMenuPlugin.prod.mjs +1 -1
  42. package/dist/LexicalPlainTextPlugin.prod.js +1 -1
  43. package/dist/LexicalPlainTextPlugin.prod.mjs +1 -1
  44. package/dist/LexicalReactExtension.dev.js +2 -1
  45. package/dist/LexicalReactExtension.dev.mjs +2 -1
  46. package/dist/LexicalReactExtension.prod.js +5 -1
  47. package/dist/LexicalReactExtension.prod.mjs +5 -1
  48. package/dist/LexicalReactPluginHostExtension.dev.js +4 -4
  49. package/dist/LexicalReactPluginHostExtension.dev.mjs +5 -5
  50. package/dist/LexicalReactPluginHostExtension.prod.js +1 -1
  51. package/dist/LexicalReactPluginHostExtension.prod.mjs +1 -1
  52. package/dist/LexicalReactProviderExtension.dev.js +1 -1
  53. package/dist/LexicalReactProviderExtension.dev.mjs +1 -1
  54. package/dist/LexicalReactProviderExtension.prod.js +1 -1
  55. package/dist/LexicalReactProviderExtension.prod.mjs +1 -1
  56. package/dist/LexicalRichTextPlugin.prod.js +1 -1
  57. package/dist/LexicalRichTextPlugin.prod.mjs +1 -1
  58. package/dist/LexicalTreeView.prod.js +1 -1
  59. package/dist/LexicalTreeView.prod.mjs +2 -1
  60. package/dist/LexicalTreeViewExtension.dev.js +1 -1
  61. package/dist/LexicalTreeViewExtension.dev.mjs +1 -1
  62. package/dist/LexicalTreeViewExtension.prod.js +2 -1
  63. package/dist/LexicalTreeViewExtension.prod.mjs +2 -1
  64. package/dist/LexicalTypeaheadMenuPlugin.dev.js +2 -2
  65. package/dist/LexicalTypeaheadMenuPlugin.dev.mjs +3 -3
  66. package/dist/LexicalTypeaheadMenuPlugin.prod.js +1 -1
  67. package/dist/LexicalTypeaheadMenuPlugin.prod.mjs +1 -1
  68. package/package.json +19 -19
  69. package/src/LexicalAutoEmbedPlugin.tsx +1 -1
  70. package/src/LexicalExtensionComposer.tsx +1 -1
  71. package/src/LexicalTypeaheadMenuPlugin.tsx +1 -1
  72. package/src/ReactExtension.tsx +2 -2
  73. package/src/ReactPluginHostExtension.tsx +8 -4
  74. package/src/ReactProviderExtension.tsx +1 -1
  75. package/src/TreeViewExtension.tsx +1 -1
  76. package/src/shared/LexicalMenu.tsx +1 -1
@@ -25,7 +25,7 @@ var jsxRuntime = require('react/jsx-runtime');
25
25
  */
26
26
 
27
27
  const URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
28
- const INSERT_EMBED_COMMAND = lexical.createCommand('INSERT_EMBED_COMMAND');
28
+ const INSERT_EMBED_COMMAND = /* @__PURE__ */lexical.createCommand('INSERT_EMBED_COMMAND');
29
29
  class AutoEmbedOption extends LexicalNodeMenuPlugin.MenuOption {
30
30
  title;
31
31
  onSelect;
@@ -23,7 +23,7 @@ import { jsx } from 'react/jsx-runtime';
23
23
  */
24
24
 
25
25
  const URL_MATCHER = /((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
26
- const INSERT_EMBED_COMMAND = createCommand('INSERT_EMBED_COMMAND');
26
+ const INSERT_EMBED_COMMAND = /* @__PURE__ */createCommand('INSERT_EMBED_COMMAND');
27
27
  class AutoEmbedOption extends MenuOption {
28
28
  title;
29
29
  onSelect;
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/link"),t=require("@lexical/react/LexicalComposerContext"),n=require("@lexical/react/LexicalNodeMenuPlugin"),i=require("@lexical/utils"),o=require("lexical"),r=require("react"),l=require("react/jsx-runtime");const s=o.createCommand("INSERT_EMBED_COMMAND");class u extends n.MenuOption{title;onSelect;constructor(e,t){super(e),this.title=e,this.onSelect=t.onSelect.bind(this)}}exports.AutoEmbedOption=u,exports.INSERT_EMBED_COMMAND=s,exports.LexicalAutoEmbedPlugin=function({embedConfigs:u,onOpenEmbedModalForConfig:a,getMenuOptions:c,menuRenderFn:d,menuCommandPriority:m=o.COMMAND_PRIORITY_LOW}){const[p]=t.useLexicalComposerContext(),[f,x]=r.useState(null),[C,M]=r.useState(null),g=r.useCallback(()=>{x(null),M(null)},[]),E=r.useCallback(async t=>{const n=p.getEditorState().read(function(){const n=o.$getNodeByKey(t);if(e.$isLinkNode(n))return n.getURL()});if(void 0!==n)for(const e of u){null!=await Promise.resolve(e.parseUrl(n))&&(M(e),x(t))}},[p,u]);r.useEffect(()=>i.mergeRegister(...[e.LinkNode,e.AutoLinkNode].map(e=>p.registerMutationListener(e,(...e)=>((e,{updateTags:t,dirtyLeaves:n})=>{for(const[i,r]of e)"created"===r&&t.has(o.PASTE_TAG)&&n.size<=3?E(i):i===f&&g()})(...e),{skipInitialization:!0}))),[E,p,f,g]),r.useEffect(()=>{if(a)return p.registerCommand(s,e=>{const t=u.find(({type:t})=>t===e);return!!t&&(a(t),!0)},o.COMMAND_PRIORITY_EDITOR)},[p,u,a]);const N=r.useCallback(async function(){if(null!=C&&null!=f){const t=p.getEditorState().read(()=>{const t=o.$getNodeByKey(f);return e.$isLinkNode(t)?t:null});if(e.$isLinkNode(t)){const e=await Promise.resolve(C.parseUrl(t.__url));null!=e&&p.update(()=>{o.$getSelection()||t.selectEnd(),C.insertNode(p,e),t.isAttached()&&t.remove()})}}},[C,p,f]),L=r.useMemo(()=>null!=C&&null!=f?c(C,N,g):[],[C,N,c,f,g]),A=r.useCallback((e,t,n)=>{p.update(()=>{e.onSelect(t),n()})},[p]);return null!=f?l.jsx(n.LexicalNodeMenuPlugin,{nodeKey:f,onClose:g,onSelectOption:A,options:L,menuRenderFn:d,commandPriority:m}):null},exports.URL_MATCHER=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
9
+ "use strict";var e=require("@lexical/link"),t=require("@lexical/react/LexicalComposerContext"),n=require("@lexical/react/LexicalNodeMenuPlugin"),i=require("@lexical/utils"),o=require("lexical"),r=require("react"),l=require("react/jsx-runtime");const s=/* @__PURE__ */o.createCommand("INSERT_EMBED_COMMAND");class u extends n.MenuOption{title;onSelect;constructor(e,t){super(e),this.title=e,this.onSelect=t.onSelect.bind(this)}}exports.AutoEmbedOption=u,exports.INSERT_EMBED_COMMAND=s,exports.LexicalAutoEmbedPlugin=function({embedConfigs:u,onOpenEmbedModalForConfig:a,getMenuOptions:c,menuRenderFn:d,menuCommandPriority:m=o.COMMAND_PRIORITY_LOW}){const[p]=t.useLexicalComposerContext(),[f,x]=r.useState(null),[C,M]=r.useState(null),g=r.useCallback(()=>{x(null),M(null)},[]),E=r.useCallback(async t=>{const n=p.getEditorState().read(function(){const n=o.$getNodeByKey(t);if(e.$isLinkNode(n))return n.getURL()});if(void 0!==n)for(const e of u){null!=await Promise.resolve(e.parseUrl(n))&&(M(e),x(t))}},[p,u]);r.useEffect(()=>i.mergeRegister(...[e.LinkNode,e.AutoLinkNode].map(e=>p.registerMutationListener(e,(...e)=>((e,{updateTags:t,dirtyLeaves:n})=>{for(const[i,r]of e)"created"===r&&t.has(o.PASTE_TAG)&&n.size<=3?E(i):i===f&&g()})(...e),{skipInitialization:!0}))),[E,p,f,g]),r.useEffect(()=>{if(a)return p.registerCommand(s,e=>{const t=u.find(({type:t})=>t===e);return!!t&&(a(t),!0)},o.COMMAND_PRIORITY_EDITOR)},[p,u,a]);const N=r.useCallback(async function(){if(null!=C&&null!=f){const t=p.getEditorState().read(()=>{const t=o.$getNodeByKey(f);return e.$isLinkNode(t)?t:null});if(e.$isLinkNode(t)){const e=await Promise.resolve(C.parseUrl(t.__url));null!=e&&p.update(()=>{o.$getSelection()||t.selectEnd(),C.insertNode(p,e),t.isAttached()&&t.remove()})}}},[C,p,f]),L=r.useMemo(()=>null!=C&&null!=f?c(C,N,g):[],[C,N,c,f,g]),A=r.useCallback((e,t,n)=>{p.update(()=>{e.onSelect(t),n()})},[p]);return null!=f?/*#__PURE__*/l.jsx(n.LexicalNodeMenuPlugin,{nodeKey:f,onClose:g,onSelectOption:A,options:L,menuRenderFn:d,commandPriority:m}):null},exports.URL_MATCHER=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/;
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{$isLinkNode as e,LinkNode as t,AutoLinkNode as n}from"@lexical/link";import{useLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{MenuOption as r,LexicalNodeMenuPlugin as i}from"@lexical/react/LexicalNodeMenuPlugin";import{mergeRegister as l}from"@lexical/utils";import{createCommand as s,$getNodeByKey as a,COMMAND_PRIORITY_EDITOR as c,$getSelection as u,COMMAND_PRIORITY_LOW as m,PASTE_TAG as d}from"lexical";import{useState as p,useCallback as f,useEffect as x,useMemo as g}from"react";import{jsx as w}from"react/jsx-runtime";const C=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,S=s("INSERT_EMBED_COMMAND");class y extends r{title;onSelect;constructor(e,t){super(e),this.title=e,this.onSelect=t.onSelect.bind(this)}}function E({embedConfigs:r,onOpenEmbedModalForConfig:s,getMenuOptions:C,menuRenderFn:y,menuCommandPriority:E=m}){const[M]=o(),[h,_]=p(null),[v,z]=p(null),A=f(()=>{_(null),z(null)},[]),L=f(async t=>{const n=M.getEditorState().read(function(){const n=a(t);if(e(n))return n.getURL()});if(void 0!==n)for(const e of r){null!=await Promise.resolve(e.parseUrl(n))&&(z(e),_(t))}},[M,r]);x(()=>l(...[t,n].map(e=>M.registerMutationListener(e,(...e)=>((e,{updateTags:t,dirtyLeaves:n})=>{for(const[o,r]of e)"created"===r&&t.has(d)&&n.size<=3?L(o):o===h&&A()})(...e),{skipInitialization:!0}))),[L,M,h,A]),x(()=>{if(s)return M.registerCommand(S,e=>{const t=r.find(({type:t})=>t===e);return!!t&&(s(t),!0)},c)},[M,r,s]);const P=f(async function(){if(null!=v&&null!=h){const t=M.getEditorState().read(()=>{const t=a(h);return e(t)?t:null});if(e(t)){const e=await Promise.resolve(v.parseUrl(t.__url));null!=e&&M.update(()=>{u()||t.selectEnd(),v.insertNode(M,e),t.isAttached()&&t.remove()})}}},[v,M,h]),b=g(()=>null!=v&&null!=h?C(v,P,A):[],[v,P,C,h,A]),N=f((e,t,n)=>{M.update(()=>{e.onSelect(t),n()})},[M]);return null!=h?w(i,{nodeKey:h,onClose:A,onSelectOption:N,options:b,menuRenderFn:y,commandPriority:E}):null}export{y as AutoEmbedOption,S as INSERT_EMBED_COMMAND,E as LexicalAutoEmbedPlugin,C as URL_MATCHER};
9
+ import{$isLinkNode as e,LinkNode as t,AutoLinkNode as n}from"@lexical/link";import{useLexicalComposerContext as o}from"@lexical/react/LexicalComposerContext";import{MenuOption as r,LexicalNodeMenuPlugin as i}from"@lexical/react/LexicalNodeMenuPlugin";import{mergeRegister as l}from"@lexical/utils";import{createCommand as s,$getNodeByKey as a,COMMAND_PRIORITY_EDITOR as c,$getSelection as u,COMMAND_PRIORITY_LOW as m,PASTE_TAG as d}from"lexical";import{useState as p,useCallback as f,useEffect as x,useMemo as g}from"react";import{jsx as w}from"react/jsx-runtime";const C=/((https?:\/\/(www\.)?)|(www\.))[-a-zA-Z0-9@:%._+~#=]{1,256}\.[a-zA-Z0-9()]{1,6}\b([-a-zA-Z0-9()@:%_+.~#?&//=]*)/,S=/* @__PURE__ */s("INSERT_EMBED_COMMAND");class y extends r{title;onSelect;constructor(e,t){super(e),this.title=e,this.onSelect=t.onSelect.bind(this)}}function E({embedConfigs:r,onOpenEmbedModalForConfig:s,getMenuOptions:C,menuRenderFn:y,menuCommandPriority:E=m}){const[M]=o(),[h,_]=p(null),[v,z]=p(null),A=f(()=>{_(null),z(null)},[]),L=f(async t=>{const n=M.getEditorState().read(function(){const n=a(t);if(e(n))return n.getURL()});if(void 0!==n)for(const e of r){null!=await Promise.resolve(e.parseUrl(n))&&(z(e),_(t))}},[M,r]);x(()=>l(...[t,n].map(e=>M.registerMutationListener(e,(...e)=>((e,{updateTags:t,dirtyLeaves:n})=>{for(const[o,r]of e)"created"===r&&t.has(d)&&n.size<=3?L(o):o===h&&A()})(...e),{skipInitialization:!0}))),[L,M,h,A]),x(()=>{if(s)return M.registerCommand(S,e=>{const t=r.find(({type:t})=>t===e);return!!t&&(s(t),!0)},c)},[M,r,s]);const P=f(async function(){if(null!=v&&null!=h){const t=M.getEditorState().read(()=>{const t=a(h);return e(t)?t:null});if(e(t)){const e=await Promise.resolve(v.parseUrl(t.__url));null!=e&&M.update(()=>{u()||t.selectEnd(),v.insertNode(M,e),t.isAttached()&&t.remove()})}}},[v,M,h]),b=g(()=>null!=v&&null!=h?C(v,P,A):[],[v,P,C,h,A]),N=f((e,t,n)=>{M.update(()=>{e.onSelect(t),n()})},[M]);return null!=h?/*#__PURE__*/w(i,{nodeKey:h,onClose:A,onSelectOption:N,options:b,menuRenderFn:y,commandPriority:E}):null}export{y as AutoEmbedOption,S as INSERT_EMBED_COMMAND,E as LexicalAutoEmbedPlugin,C as URL_MATCHER};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("@lexical/react/LexicalDecoratorBlockNode"),r=require("@lexical/react/useLexicalNodeSelection"),o=require("@lexical/utils"),i=require("lexical"),l=require("react"),c=require("react/jsx-runtime");exports.BlockWithAlignableContents=function({children:s,format:a,nodeKey:n,className:u}){const[f]=e.useLexicalComposerContext(),[x,N,d]=r.useLexicalNodeSelection(n),m=l.useRef(null);return l.useEffect(()=>o.mergeRegister(f.registerCommand(i.FORMAT_ELEMENT_COMMAND,e=>{if(x){const r=i.$getSelection();if(i.$isNodeSelection(r)){const r=i.$getNodeByKey(n);t.$isDecoratorBlockNode(r)&&r.setFormat(e)}else if(i.$isRangeSelection(r)){const i=r.getNodes();for(const r of i)if(t.$isDecoratorBlockNode(r))r.setFormat(e);else{o.$getNearestBlockElementAncestorOrThrow(r).setFormat(e)}}return!0}return!1},i.COMMAND_PRIORITY_LOW),f.registerCommand(i.CLICK_COMMAND,e=>e.target===m.current&&(e.preventDefault(),e.shiftKey||d(),N(!x),!0),i.COMMAND_PRIORITY_LOW)),[d,f,x,n,N]),c.jsx("div",{className:[u.base,x?u.focus:null].filter(Boolean).join(" "),ref:m,style:{textAlign:a||void 0},children:s})};
9
+ "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("@lexical/react/LexicalDecoratorBlockNode"),r=require("@lexical/react/useLexicalNodeSelection"),o=require("@lexical/utils"),i=require("lexical"),l=require("react"),c=require("react/jsx-runtime");exports.BlockWithAlignableContents=function({children:s,format:a,nodeKey:n,className:u}){const[f]=e.useLexicalComposerContext(),[x,N,d]=r.useLexicalNodeSelection(n),m=l.useRef(null);return l.useEffect(()=>o.mergeRegister(f.registerCommand(i.FORMAT_ELEMENT_COMMAND,e=>{if(x){const r=i.$getSelection();if(i.$isNodeSelection(r)){const r=i.$getNodeByKey(n);t.$isDecoratorBlockNode(r)&&r.setFormat(e)}else if(i.$isRangeSelection(r)){const i=r.getNodes();for(const r of i)if(t.$isDecoratorBlockNode(r))r.setFormat(e);else{o.$getNearestBlockElementAncestorOrThrow(r).setFormat(e)}}return!0}return!1},i.COMMAND_PRIORITY_LOW),f.registerCommand(i.CLICK_COMMAND,e=>e.target===m.current&&(e.preventDefault(),e.shiftKey||d(),N(!x),!0),i.COMMAND_PRIORITY_LOW)),[d,f,x,n,N]),/*#__PURE__*/c.jsx("div",{className:[u.base,x?u.focus:null].filter(Boolean).join(" "),ref:m,style:{textAlign:a||void 0},children:s})};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as t}from"@lexical/react/LexicalDecoratorBlockNode";import{useLexicalNodeSelection as r}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as o,$getNearestBlockElementAncestorOrThrow as i}from"@lexical/utils";import{FORMAT_ELEMENT_COMMAND as l,$getSelection as a,$isNodeSelection as c,$getNodeByKey as m,$isRangeSelection as n,COMMAND_PRIORITY_LOW as s,CLICK_COMMAND as f}from"lexical";import{useRef as u,useEffect as x}from"react";import{jsx as d}from"react/jsx-runtime";function p({children:p,format:g,nodeKey:N,className:C}){const[h]=e(),[v,y,F]=r(N),L=u(null);return x(()=>o(h.registerCommand(l,e=>{if(v){const r=a();if(c(r)){const r=m(N);t(r)&&r.setFormat(e)}else if(n(r)){const o=r.getNodes();for(const r of o)if(t(r))r.setFormat(e);else{i(r).setFormat(e)}}return!0}return!1},s),h.registerCommand(f,e=>e.target===L.current&&(e.preventDefault(),e.shiftKey||F(),y(!v),!0),s)),[F,h,v,N,y]),d("div",{className:[C.base,v?C.focus:null].filter(Boolean).join(" "),ref:L,style:{textAlign:g||void 0},children:p})}export{p as BlockWithAlignableContents};
9
+ import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{$isDecoratorBlockNode as t}from"@lexical/react/LexicalDecoratorBlockNode";import{useLexicalNodeSelection as r}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as o,$getNearestBlockElementAncestorOrThrow as i}from"@lexical/utils";import{FORMAT_ELEMENT_COMMAND as l,$getSelection as a,$isNodeSelection as c,$getNodeByKey as m,$isRangeSelection as n,COMMAND_PRIORITY_LOW as s,CLICK_COMMAND as f}from"lexical";import{useRef as u,useEffect as x}from"react";import{jsx as d}from"react/jsx-runtime";function p({children:p,format:g,nodeKey:N,className:C}){const[h]=e(),[v,y,F]=r(N),L=u(null);return x(()=>o(h.registerCommand(l,e=>{if(v){const r=a();if(c(r)){const r=m(N);t(r)&&r.setFormat(e)}else if(n(r)){const o=r.getNodes();for(const r of o)if(t(r))r.setFormat(e);else{i(r).setFormat(e)}}return!0}return!1},s),h.registerCommand(f,e=>e.target===L.current&&(e.preventDefault(),e.shiftKey||F(),y(!v),!0),s)),[F,h,v,N,y]),/*#__PURE__*/d("div",{className:[C.base,v?C.focus:null].filter(Boolean).join(" "),ref:L,style:{textAlign:g||void 0},children:p})}export{p as BlockWithAlignableContents};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("react"),n=require("@lexical/overflow"),r=require("@lexical/text"),i=require("@lexical/utils"),o=require("lexical"),s=require("react/jsx-runtime");function l(e,s,l=Object.freeze({})){const{strlen:f=e=>e.length,remainingCharacters:g=()=>{}}=l;t.useEffect(()=>{e.hasNodes([n.OverflowNode])||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(57)},[e]),t.useEffect(()=>{let t=e.getEditorState().read(r.$rootTextContent,{editor:e}),l=0;return i.mergeRegister(e.registerTextContentListener(e=>{t=e}),e.registerUpdateListener(({dirtyLeaves:r,dirtyElements:d})=>{const u=e.isComposing(),m=r.size>0||d.size>0;if(u||!m)return;const h=f(t),x=h>s||null!==l&&l>s;if(g(s-h),null===l||x){const r=function(e,t,n){let r=0,i=0;if("function"==typeof Intl.Segmenter){const o=(new Intl.Segmenter).segment(e);for(const{segment:e}of o){const o=i+n(e);if(o>t)break;i=o,r+=e.length}}else{const o=Array.from(e),s=o.length;for(let e=0;e<s;e++){const s=o[e],l=i+n(s);if(l>t)break;i=l,r+=s.length}}return r}(t,s,f);e.update(()=>{!function(e){const t=i.$dfs(),r=t.length;let s=0;for(let l=0;l<r;l+=1){const{node:r}=t[l],f=o.$isLeafNode(r)&&!i.$findMatchingParent(r,n.$isOverflowNode);if(n.$isOverflowNode(r)){const t=s;if(s+r.getTextContentSize()<=e){const e=r.getParent(),t=r.getPreviousSibling(),n=r.getNextSibling();i.$unwrapNode(r);const s=o.$getSelection();!o.$isRangeSelection(s)||s.anchor.getNode().isAttached()&&s.focus.getNode().isAttached()||(o.$isTextNode(t)?t.select():o.$isTextNode(n)?n.select():null!==e&&e.select())}else if(t<e){const n=r.getFirstDescendant(),s=t+(null!==n?n.getTextContentSize():0);(o.$isTextNode(n)&&n.isSimpleText()||s<=e)&&i.$unwrapNode(r)}}else if(f){const t=s;if(s+=r.getTextContentSize(),s>e&&!n.$isOverflowNode(r.getParent())){const n=o.$getSelection();let i;if(t<e&&o.$isTextNode(r)&&r.isSimpleText()){const[,n]=r.splitText(e-t);i=c(n)}else i=c(r);null!==n&&o.$setSelection(n),a(i)}}}}(r)},{tag:o.HISTORY_MERGE_TAG})}l=h}),e.registerCommand(o.DELETE_CHARACTER_COMMAND,e=>{const t=o.$getSelection();if(!o.$isRangeSelection(t))return!1;const n=t.anchor.getNode().getParent(),r=n?n.getParent():null,i=r?r.getNextSibling():null;return t.deleteCharacter(e),r&&r.isEmpty()?r.remove():o.$isElementNode(i)&&i.isEmpty()&&i.remove(),!0},o.COMMAND_PRIORITY_LOW))},[e,s,g,f])}function c(e){const t=n.$createOverflowNode();return e.replace(t),t.append(e),t}function a(e){const t=e.getPreviousSibling();if(!n.$isOverflowNode(t))return;const r=e.getFirstChild(),i=t.getChildren(),s=i.length;if(null===r)e.append(...i);else for(let e=0;e<s;e++)r.insertBefore(i[e]);const l=o.$getSelection();if(o.$isRangeSelection(l)){const n=l.anchor,r=n.getNode(),i=l.focus,o=n.getNode();r.is(t)?n.set(e.getKey(),n.offset,"element"):r.is(e)&&n.set(e.getKey(),s+n.offset,"element"),o.is(t)?i.set(e.getKey(),i.offset,"element"):o.is(e)&&i.set(e.getKey(),s+i.offset,"element")}t.remove()}let f=null;function g(e){const t=void 0===window.TextEncoder?null:(null===f&&(f=new window.TextEncoder),f);if(null===t){const t=encodeURIComponent(e).match(/%[89ABab]/g);return e.length+(t?t.length:0)}return t.encode(e).length}function d({remainingCharacters:e}){return s.jsx("span",{className:"characters-limit "+(e<0?"characters-limit-exceeded":""),children:e})}exports.CharacterLimitPlugin=function({charset:n="UTF-16",maxLength:r=5,renderer:i=d}){const[o]=e.useLexicalComposerContext(),[s,c]=t.useState(r),a=t.useMemo(()=>({remainingCharacters:c,strlen:e=>{if("UTF-8"===n)return g(e);if("UTF-16"===n)return e.length;throw new Error("Unrecognized charset")}}),[n]);return l(o,r,a),i({remainingCharacters:s})};
9
+ "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("react"),n=require("@lexical/overflow"),r=require("@lexical/text"),i=require("@lexical/utils"),o=require("lexical"),s=require("react/jsx-runtime");function l(e,s,l=Object.freeze({})){const{strlen:f=e=>e.length,remainingCharacters:g=()=>{}}=l;t.useEffect(()=>{e.hasNodes([n.OverflowNode])||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(57)},[e]),t.useEffect(()=>{let t=e.getEditorState().read(r.$rootTextContent,{editor:e}),l=0;return i.mergeRegister(e.registerTextContentListener(e=>{t=e}),e.registerUpdateListener(({dirtyLeaves:r,dirtyElements:d})=>{const u=e.isComposing(),m=r.size>0||d.size>0;if(u||!m)return;const h=f(t),x=h>s||null!==l&&l>s;if(g(s-h),null===l||x){const r=function(e,t,n){let r=0,i=0;if("function"==typeof Intl.Segmenter){const o=(new Intl.Segmenter).segment(e);for(const{segment:e}of o){const o=i+n(e);if(o>t)break;i=o,r+=e.length}}else{const o=Array.from(e),s=o.length;for(let e=0;e<s;e++){const s=o[e],l=i+n(s);if(l>t)break;i=l,r+=s.length}}return r}(t,s,f);e.update(()=>{!function(e){const t=i.$dfs(),r=t.length;let s=0;for(let l=0;l<r;l+=1){const{node:r}=t[l],f=o.$isLeafNode(r)&&!i.$findMatchingParent(r,n.$isOverflowNode);if(n.$isOverflowNode(r)){const t=s;if(s+r.getTextContentSize()<=e){const e=r.getParent(),t=r.getPreviousSibling(),n=r.getNextSibling();i.$unwrapNode(r);const s=o.$getSelection();!o.$isRangeSelection(s)||s.anchor.getNode().isAttached()&&s.focus.getNode().isAttached()||(o.$isTextNode(t)?t.select():o.$isTextNode(n)?n.select():null!==e&&e.select())}else if(t<e){const n=r.getFirstDescendant(),s=t+(null!==n?n.getTextContentSize():0);(o.$isTextNode(n)&&n.isSimpleText()||s<=e)&&i.$unwrapNode(r)}}else if(f){const t=s;if(s+=r.getTextContentSize(),s>e&&!n.$isOverflowNode(r.getParent())){const n=o.$getSelection();let i;if(t<e&&o.$isTextNode(r)&&r.isSimpleText()){const[,n]=r.splitText(e-t);i=c(n)}else i=c(r);null!==n&&o.$setSelection(n),a(i)}}}}(r)},{tag:o.HISTORY_MERGE_TAG})}l=h}),e.registerCommand(o.DELETE_CHARACTER_COMMAND,e=>{const t=o.$getSelection();if(!o.$isRangeSelection(t))return!1;const n=t.anchor.getNode().getParent(),r=n?n.getParent():null,i=r?r.getNextSibling():null;return t.deleteCharacter(e),r&&r.isEmpty()?r.remove():o.$isElementNode(i)&&i.isEmpty()&&i.remove(),!0},o.COMMAND_PRIORITY_LOW))},[e,s,g,f])}function c(e){const t=n.$createOverflowNode();return e.replace(t),t.append(e),t}function a(e){const t=e.getPreviousSibling();if(!n.$isOverflowNode(t))return;const r=e.getFirstChild(),i=t.getChildren(),s=i.length;if(null===r)e.append(...i);else for(let e=0;e<s;e++)r.insertBefore(i[e]);const l=o.$getSelection();if(o.$isRangeSelection(l)){const n=l.anchor,r=n.getNode(),i=l.focus,o=n.getNode();r.is(t)?n.set(e.getKey(),n.offset,"element"):r.is(e)&&n.set(e.getKey(),s+n.offset,"element"),o.is(t)?i.set(e.getKey(),i.offset,"element"):o.is(e)&&i.set(e.getKey(),s+i.offset,"element")}t.remove()}let f=null;function g(e){const t=void 0===window.TextEncoder?null:(null===f&&(f=new window.TextEncoder),f);if(null===t){const t=encodeURIComponent(e).match(/%[89ABab]/g);return e.length+(t?t.length:0)}return t.encode(e).length}function d({remainingCharacters:e}){/*#__PURE__*/
10
+ return s.jsx("span",{className:"characters-limit "+(e<0?"characters-limit-exceeded":""),children:e})}exports.CharacterLimitPlugin=function({charset:n="UTF-16",maxLength:r=5,renderer:i=d}){const[o]=e.useLexicalComposerContext(),[s,c]=t.useState(r),a=t.useMemo(()=>({remainingCharacters:c,strlen:e=>{if("UTF-8"===n)return g(e);if("UTF-16"===n)return e.length;throw new Error("Unrecognized charset")}}),[n]);return l(o,r,a),i({remainingCharacters:s})};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useEffect as t,useState as n,useMemo as r}from"react";import{OverflowNode as o,$isOverflowNode as i,$createOverflowNode as s}from"@lexical/overflow";import{$rootTextContent as l}from"@lexical/text";import{mergeRegister as c,$dfs as a,$findMatchingParent as f,$unwrapNode as g}from"@lexical/utils";import{HISTORY_MERGE_TAG as m,DELETE_CHARACTER_COMMAND as d,$getSelection as u,$isRangeSelection as h,$isElementNode as p,COMMAND_PRIORITY_LOW as x,$isLeafNode as C,$isTextNode as S,$setSelection as v}from"lexical";import{jsx as w}from"react/jsx-runtime";function T(e,n,r=Object.freeze({})){const{strlen:s=e=>e.length,remainingCharacters:w=()=>{}}=r;t(()=>{e.hasNodes([o])||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(57)},[e]),t(()=>{let t=e.getEditorState().read(l,{editor:e}),r=0;return c(e.registerTextContentListener(e=>{t=e}),e.registerUpdateListener(({dirtyLeaves:o,dirtyElements:l})=>{const c=e.isComposing(),d=o.size>0||l.size>0;if(c||!d)return;const p=s(t),x=p>n||null!==r&&r>n;if(w(n-p),null===r||x){const r=function(e,t,n){let r=0,o=0;if("function"==typeof Intl.Segmenter){const i=(new Intl.Segmenter).segment(e);for(const{segment:e}of i){const i=o+n(e);if(i>t)break;o=i,r+=e.length}}else{const i=Array.from(e),s=i.length;for(let e=0;e<s;e++){const s=i[e],l=o+n(s);if(l>t)break;o=l,r+=s.length}}return r}(t,n,s);e.update(()=>{!function(e){const t=a(),n=t.length;let r=0;for(let o=0;o<n;o+=1){const{node:n}=t[o],s=C(n)&&!f(n,i);if(i(n)){const t=r;if(r+n.getTextContentSize()<=e){const e=n.getParent(),t=n.getPreviousSibling(),r=n.getNextSibling();g(n);const o=u();!h(o)||o.anchor.getNode().isAttached()&&o.focus.getNode().isAttached()||(S(t)?t.select():S(r)?r.select():null!==e&&e.select())}else if(t<e){const r=n.getFirstDescendant(),o=t+(null!==r?r.getTextContentSize():0);(S(r)&&r.isSimpleText()||o<=e)&&g(n)}}else if(s){const t=r;if(r+=n.getTextContentSize(),r>e&&!i(n.getParent())){const r=u();let o;if(t<e&&S(n)&&n.isSimpleText()){const[,r]=n.splitText(e-t);o=y(r)}else o=y(n);null!==r&&v(r),N(o)}}}}(r)},{tag:m})}r=p}),e.registerCommand(d,e=>{const t=u();if(!h(t))return!1;const n=t.anchor.getNode().getParent(),r=n?n.getParent():null,o=r?r.getNextSibling():null;return t.deleteCharacter(e),r&&r.isEmpty()?r.remove():p(o)&&o.isEmpty()&&o.remove(),!0},x))},[e,n,w,s])}function y(e){const t=s();return e.replace(t),t.append(e),t}function N(e){const t=e.getPreviousSibling();if(!i(t))return;const n=e.getFirstChild(),r=t.getChildren(),o=r.length;if(null===n)e.append(...r);else for(let e=0;e<o;e++)n.insertBefore(r[e]);const s=u();if(h(s)){const n=s.anchor,r=n.getNode(),i=s.focus,l=n.getNode();r.is(t)?n.set(e.getKey(),n.offset,"element"):r.is(e)&&n.set(e.getKey(),o+n.offset,"element"),l.is(t)?i.set(e.getKey(),i.offset,"element"):l.is(e)&&i.set(e.getKey(),o+i.offset,"element")}t.remove()}let b=null;function E(e){const t=void 0===window.TextEncoder?null:(null===b&&(b=new window.TextEncoder),b);if(null===t){const t=encodeURIComponent(e).match(/%[89ABab]/g);return e.length+(t?t.length:0)}return t.encode(e).length}function L({remainingCharacters:e}){return w("span",{className:"characters-limit "+(e<0?"characters-limit-exceeded":""),children:e})}function U({charset:t="UTF-16",maxLength:o=5,renderer:i=L}){const[s]=e(),[l,c]=n(o);return T(s,o,r(()=>({remainingCharacters:c,strlen:e=>{if("UTF-8"===t)return E(e);if("UTF-16"===t)return e.length;throw new Error("Unrecognized charset")}}),[t])),i({remainingCharacters:l})}export{U as CharacterLimitPlugin};
9
+ import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useEffect as t,useState as n,useMemo as r}from"react";import{OverflowNode as o,$isOverflowNode as i,$createOverflowNode as s}from"@lexical/overflow";import{$rootTextContent as l}from"@lexical/text";import{mergeRegister as c,$dfs as a,$findMatchingParent as f,$unwrapNode as g}from"@lexical/utils";import{HISTORY_MERGE_TAG as m,DELETE_CHARACTER_COMMAND as d,$getSelection as u,$isRangeSelection as h,$isElementNode as p,COMMAND_PRIORITY_LOW as x,$isLeafNode as C,$isTextNode as S,$setSelection as v}from"lexical";import{jsx as w}from"react/jsx-runtime";function T(e,n,r=Object.freeze({})){const{strlen:s=e=>e.length,remainingCharacters:w=()=>{}}=r;t(()=>{e.hasNodes([o])||function(e,...t){const n=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of t)r.append("v",e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(57)},[e]),t(()=>{let t=e.getEditorState().read(l,{editor:e}),r=0;return c(e.registerTextContentListener(e=>{t=e}),e.registerUpdateListener(({dirtyLeaves:o,dirtyElements:l})=>{const c=e.isComposing(),d=o.size>0||l.size>0;if(c||!d)return;const p=s(t),x=p>n||null!==r&&r>n;if(w(n-p),null===r||x){const r=function(e,t,n){let r=0,o=0;if("function"==typeof Intl.Segmenter){const i=(new Intl.Segmenter).segment(e);for(const{segment:e}of i){const i=o+n(e);if(i>t)break;o=i,r+=e.length}}else{const i=Array.from(e),s=i.length;for(let e=0;e<s;e++){const s=i[e],l=o+n(s);if(l>t)break;o=l,r+=s.length}}return r}(t,n,s);e.update(()=>{!function(e){const t=a(),n=t.length;let r=0;for(let o=0;o<n;o+=1){const{node:n}=t[o],s=C(n)&&!f(n,i);if(i(n)){const t=r;if(r+n.getTextContentSize()<=e){const e=n.getParent(),t=n.getPreviousSibling(),r=n.getNextSibling();g(n);const o=u();!h(o)||o.anchor.getNode().isAttached()&&o.focus.getNode().isAttached()||(S(t)?t.select():S(r)?r.select():null!==e&&e.select())}else if(t<e){const r=n.getFirstDescendant(),o=t+(null!==r?r.getTextContentSize():0);(S(r)&&r.isSimpleText()||o<=e)&&g(n)}}else if(s){const t=r;if(r+=n.getTextContentSize(),r>e&&!i(n.getParent())){const r=u();let o;if(t<e&&S(n)&&n.isSimpleText()){const[,r]=n.splitText(e-t);o=y(r)}else o=y(n);null!==r&&v(r),N(o)}}}}(r)},{tag:m})}r=p}),e.registerCommand(d,e=>{const t=u();if(!h(t))return!1;const n=t.anchor.getNode().getParent(),r=n?n.getParent():null,o=r?r.getNextSibling():null;return t.deleteCharacter(e),r&&r.isEmpty()?r.remove():p(o)&&o.isEmpty()&&o.remove(),!0},x))},[e,n,w,s])}function y(e){const t=s();return e.replace(t),t.append(e),t}function N(e){const t=e.getPreviousSibling();if(!i(t))return;const n=e.getFirstChild(),r=t.getChildren(),o=r.length;if(null===n)e.append(...r);else for(let e=0;e<o;e++)n.insertBefore(r[e]);const s=u();if(h(s)){const n=s.anchor,r=n.getNode(),i=s.focus,l=n.getNode();r.is(t)?n.set(e.getKey(),n.offset,"element"):r.is(e)&&n.set(e.getKey(),o+n.offset,"element"),l.is(t)?i.set(e.getKey(),i.offset,"element"):l.is(e)&&i.set(e.getKey(),o+i.offset,"element")}t.remove()}let b=null;function E(e){const t=void 0===window.TextEncoder?null:(null===b&&(b=new window.TextEncoder),b);if(null===t){const t=encodeURIComponent(e).match(/%[89ABab]/g);return e.length+(t?t.length:0)}return t.encode(e).length}function L({remainingCharacters:e}){/*#__PURE__*/
10
+ return w("span",{className:"characters-limit "+(e<0?"characters-limit-exceeded":""),children:e})}function U({charset:t="UTF-16",maxLength:o=5,renderer:i=L}){const[s]=e(),[l,c]=n(o);return T(s,o,r(()=>({remainingCharacters:c,strlen:e=>{if("UTF-8"===t)return E(e);if("UTF-16"===t)return e.length;throw new Error("Unrecognized charset")}}),[t])),i({remainingCharacters:l})}export{U as CharacterLimitPlugin};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var r=require("react"),e=require("react/jsx-runtime");const o=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],n=o[Math.floor(Math.random()*o.length)],t=r.createContext(null);function l(){return{color:n[1],isCollabActive:!1,name:n[0],yjsDocMap:new Map}}const a=l();exports.CollaborationContext=t,exports.LexicalCollaboration=function({children:o}){const n=r.useMemo(()=>l(),[]);return e.jsx(t.Provider,{value:n,children:o})},exports.useCollaborationContext=function(e,o){let n=r.useContext(t);return null==n&&function(r,...e){const o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",r);for(const r of e)n.append("v",r);o.search=n.toString(),console.warn(`Minified Lexical warning #${r}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(319),n=n??a,null!=e&&(n.name=e),null!=o&&(n.color=o),n};
9
+ "use strict";var r=require("react"),e=require("react/jsx-runtime");const o=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],n=o[Math.floor(Math.random()*o.length)],t=/*#__PURE__*/r.createContext(null);function l(){return{color:n[1],isCollabActive:!1,name:n[0],yjsDocMap:new Map}}const a=l();exports.CollaborationContext=t,exports.LexicalCollaboration=function({children:o}){const n=r.useMemo(()=>l(),[]);/*#__PURE__*/
10
+ return e.jsx(t.Provider,{value:n,children:o})},exports.useCollaborationContext=function(e,o){let n=r.useContext(t);return null==n&&function(r,...e){const o=new URL("https://lexical.dev/docs/error"),n=new URLSearchParams;n.append("code",r);for(const r of e)n.append("v",r);o.search=n.toString(),console.warn(`Minified Lexical warning #${r}; visit ${o.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(319),n=n??a,null!=e&&(n.name=e),null!=o&&(n.color=o),n};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- import{createContext as r,useMemo as n,useContext as e}from"react";import{jsx as o}from"react/jsx-runtime";const t=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],i=t[Math.floor(Math.random()*t.length)],l=r(null);function a(){return{color:i[1],isCollabActive:!1,name:i[0],yjsDocMap:new Map}}const g=a();function c({children:r}){const e=n(()=>a(),[]);return o(l.Provider,{value:e,children:r})}function b(r,n){let o=e(l);return null==o&&function(r,...n){const e=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const r of n)o.append("v",r);e.search=o.toString(),console.warn(`Minified Lexical warning #${r}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(319),o=o??g,null!=r&&(o.name=r),null!=n&&(o.color=n),o}export{l as CollaborationContext,c as LexicalCollaboration,b as useCollaborationContext};
9
+ import{createContext as r,useMemo as n,useContext as e}from"react";import{jsx as o}from"react/jsx-runtime";const t=[["Cat","rgb(125, 50, 0)"],["Dog","rgb(100, 0, 0)"],["Rabbit","rgb(150, 0, 0)"],["Frog","rgb(200, 0, 0)"],["Fox","rgb(200, 75, 0)"],["Hedgehog","rgb(0, 75, 0)"],["Pigeon","rgb(0, 125, 0)"],["Squirrel","rgb(75, 100, 0)"],["Bear","rgb(125, 100, 0)"],["Tiger","rgb(0, 0, 150)"],["Leopard","rgb(0, 0, 200)"],["Zebra","rgb(0, 0, 250)"],["Wolf","rgb(0, 100, 150)"],["Owl","rgb(0, 100, 100)"],["Gull","rgb(100, 0, 100)"],["Squid","rgb(150, 0, 150)"]],i=t[Math.floor(Math.random()*t.length)],l=/*#__PURE__*/r(null);function a(){return{color:i[1],isCollabActive:!1,name:i[0],yjsDocMap:new Map}}const g=a();function c({children:r}){const e=n(()=>a(),[]);/*#__PURE__*/
10
+ return o(l.Provider,{value:e,children:r})}function b(r,n){let o=e(l);return null==o&&function(r,...n){const e=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",r);for(const r of n)o.append("v",r);e.search=o.toString(),console.warn(`Minified Lexical warning #${r}; visit ${e.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(319),o=o??g,null!=r&&(o.name=r),null!=n&&(o.color=n),o}export{l as CollaborationContext,c as LexicalCollaboration,b as useCollaborationContext};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/react/LexicalCollaborationContext"),t=require("@lexical/react/LexicalComposerContext"),o=require("@lexical/yjs"),n=require("react"),r=require("@lexical/utils"),s=require("lexical"),a=require("react-dom"),c=require("yjs"),i=require("react/jsx-runtime");function l(e){var t=Object.create(null);if(e)for(var o in e)t[o]=e[o];return t.default=e,t}var u=l(n);const d=Symbol.for("@lexical/yjs/UndoManager");function f(e,t,r,a,i,l,u,d,f,p,_,h,M=o.syncCursorPositions,R=!1){const O=n.useRef(!1),D=n.useCallback(()=>{const{root:t}=d;u&&t.isEmpty()&&0===t._xmlText._length&&m(e,_)},[d,e,_,u]);return n.useEffect(()=>{const{root:t}=d,n=(e,t)=>{const n=t.origin;if(n!==d){const t=n instanceof c.UndoManager;o.syncYjsChangesToLexical(d,r,e,t,M)}};t.getSharedType().observeDeep(n);const a=e.registerUpdateListener(({prevEditorState:e,editorState:t,dirtyLeaves:n,dirtyElements:a,normalizedNodes:c,tags:i})=>{i.has(s.SKIP_COLLAB_TAG)||o.syncLexicalUpdateToYjs(d,r,e,t,a,n,c,i)});return()=>{t.getSharedType().unobserveDeep(n),a()}},[d,r,e,f,a,t,M]),n.useEffect(()=>{const n=n=>{!function(e,t){if(e.update(()=>{const e=s.$getRoot();e.clear(),e.select()},{tag:s.SKIP_COLLAB_TAG}),null==t.cursors)return;const n=t.cursors;if(null==n)return;const r=t.cursorsContainer;if(null==r)return;for(const e of n.values()){const n=e.selection;if(null!==n){null!==n.highlight&&(CSS.highlights.delete(n.highlightName),o.removeCursorHighlightRule(t,n.highlightName)),n.caret.parentNode===r&&r.removeChild(n.caret);for(const e of n.selections)e.parentNode===r&&r.removeChild(e);e.selection=null}}}(e,d),f(n),a.set(t,n),O.current=!0},c=()=>{O.current=!1};return r.on("reload",n),r.on("sync",c),()=>{r.off("reload",n),r.off("sync",c)}},[d,r,e,f,a,t]),E(e,r,i,l,O,h,D),g(d,r,R),C(d,p)}function E(e,t,r,a,c,i,l){const u=n.useCallback(()=>t.connect(),[t]),d=n.useCallback(()=>{try{t.disconnect()}catch(e){}},[t]);n.useEffect(()=>{const n=({status:t})=>{e.dispatchCommand(o.CONNECTED_COMMAND,"connected"===t)},s=e=>{e&&!1===c.current&&l&&l()};o.initLocalState(t,r,a,document.activeElement===e.getRootElement(),i||{}),t.on("status",n),t.on("sync",s);const f=u();return()=>{!1===c.current&&(f?f.then(d):d()),t.off("sync",s),t.off("status",n)}},[e,t,r,a,c,i,l,u,d]),n.useEffect(()=>e.registerCommand(o.TOGGLE_CONNECT_COMMAND,e=>(e?(console.log("Collaboration connected!"),u()):(console.log("Collaboration disconnected!"),d()),!0),s.COMMAND_PRIORITY_EDITOR),[u,d,e]),n.useEffect(()=>{const e=()=>{try{t.awareness.setLocalState(null)}catch(e){}};return window.addEventListener("beforeunload",e),window.addEventListener("pagehide",e),()=>{window.removeEventListener("beforeunload",e),window.removeEventListener("pagehide",e)}},[t])}function g(e,t,r){n.useEffect(()=>{const{awareness:n}=t,s=()=>{o.syncCursorPositions(e,t,{selectionHighlight:r})};return n.on("update",s),()=>{n.off("update",s)}},[e,t,r])}function C(e,t){return n.useMemo(()=>a.createPortal(i.jsx("div",{ref:t=>{e.cursorsContainer=t}}),t&&t.current||document.body),[e,t])}function p(e,t,a,c,i){n.useEffect(()=>r.mergeRegister(e.registerCommand(s.FOCUS_COMMAND,()=>(o.setLocalStateFocus(t,a,c,!0,i||{}),!1),s.COMMAND_PRIORITY_EDITOR),e.registerCommand(s.BLUR_COMMAND,()=>(o.setLocalStateFocus(t,a,c,!1,i||{}),!1),s.COMMAND_PRIORITY_EDITOR)),[c,e,a,t,i])}function _(e,t){n.useEffect(()=>r.mergeRegister(e.registerCommand(s.UNDO_COMMAND,()=>(t.undo(),!0),s.COMMAND_PRIORITY_EDITOR),e.registerCommand(s.REDO_COMMAND,()=>(t.redo(),!0),s.COMMAND_PRIORITY_EDITOR))),n.useEffect(()=>{const o=e;return o[d]=t,()=>{o[d]===t&&delete o[d]}},[e,t]);const o=n.useCallback(()=>{t.clear()},[t]);return u.useEffect(()=>{const o=()=>{e.dispatchCommand(s.CAN_UNDO_COMMAND,t.undoStack.length>0),e.dispatchCommand(s.CAN_REDO_COMMAND,t.redoStack.length>0)};return t.on("stack-item-added",o),t.on("stack-item-popped",o),t.on("stack-cleared",o),()=>{t.off("stack-item-added",o),t.off("stack-item-popped",o),t.off("stack-cleared",o)}},[e,t]),o}function m(e,t){e.update(()=>{const o=s.$getRoot();if(o.isEmpty())if(t)switch(typeof t){case"string":{const o=e.parseEditorState(t);e.setEditorState(o,{tag:s.HISTORY_MERGE_TAG});break}case"object":e.setEditorState(t,{tag:s.HISTORY_MERGE_TAG});break;case"function":e.update(()=>{s.$getRoot().isEmpty()&&t(e)},{tag:s.HISTORY_MERGE_TAG})}else{const t=s.$createParagraphNode();o.append(t);const{activeElement:n}=document;(null!==s.$getSelection()||null!==n&&n===e.getRootElement())&&t.select()}},{tag:s.HISTORY_MERGE_TAG})}function h({editor:e,id:t,provider:r,yjsDocMap:s,name:a,color:c,shouldBootstrap:i,cursorsContainerRef:l,initialEditorState:u,awarenessData:d,collabContext:E,binding:g,setDoc:C,syncCursorPositionsFn:m,selectionHighlight:h}){const M=f(e,t,r,s,a,c,i,g,C,l,u,d,m,h);return function(e,t){_(e,n.useMemo(()=>o.createUndoManager(t,t.root.getSharedType()),[t]))}(e,g),p(e,r,a,c,d),M}const M=(e,t)=>{n.useEffect(()=>(e.isCollabActive=!0,()=>{null==t._parentEditor&&(e.isCollabActive=!1)}),[e,t])};exports.CollaborationPlugin=function({id:r,providerFactory:s,shouldBootstrap:a,username:c,cursorColor:l,cursorsContainerRef:u,initialEditorState:d,excludedProperties:f,awarenessData:E,syncCursorPositionsFn:g,selectionHighlight:C}){const p=n.useRef(!1),_=n.useRef(!1),m=e.useCollaborationContext(c,l),{yjsDocMap:R,name:O,color:D}=m,[T]=t.useLexicalComposerContext();M(m,T);const[N,S]=n.useState(),[A,I]=n.useState();n.useEffect(()=>{if(_.current)return;_.current=!0;const e=s(r,R);return S(e),I(R.get(r)),()=>{e.disconnect()}},[r,s,R]);const[y,L]=n.useState();return n.useEffect(()=>{if(!N)return;if(p.current)return;p.current=!0;const e=o.createBinding(T,N,r,A||R.get(r),R,f);return L(e),()=>{e.root.destroy(e)}},[T,N,r,R,A,f]),N&&y?i.jsx(h,{awarenessData:E,binding:y,collabContext:m,color:D,cursorsContainerRef:u,editor:T,id:r,initialEditorState:d,name:O,provider:N,setDoc:I,shouldBootstrap:a,yjsDocMap:R,syncCursorPositionsFn:g,selectionHighlight:C}):i.jsx(i.Fragment,{})},exports.CollaborationPluginV2__EXPERIMENTAL=function({id:a,doc:i,provider:l,__shouldBootstrapUnsafe:u,username:d,cursorColor:f,cursorsContainerRef:h,excludedProperties:R,awarenessData:O,selectionHighlight:D}){const T=e.useCollaborationContext(d,f),{yjsDocMap:N,name:S,color:A}=T,[I]=t.useLexicalComposerContext();M(T,I);const y=function(e,t,a,i,l,u,d,f={}){const{awarenessData:C,excludedProperties:p,rootName:_,selectionHighlight:h=!1,__shouldBootstrapUnsafe:M}=f,R=n.useMemo(()=>({current:!1}),[]),O=n.useMemo(()=>o.createBindingV2__EXPERIMENTAL(e,t,a,l,{excludedProperties:p,rootName:_}),[e,t,a,l,p,_]);n.useEffect(()=>(l.set(t,a),()=>{l.delete(t)}),[a,l,t]);const D=n.useCallback(()=>{const{root:t}=O;M&&0===t._length&&m(e)},[O,e,M]),[T,N]=n.useState();return n.useEffect(()=>{r.mergeRegister(e.registerCommand(o.CLEAR_DIFF_VERSIONS_COMMAND__EXPERIMENTAL,()=>(N(null),o.syncYjsStateToLexicalV2__EXPERIMENTAL(O,i),!0),s.COMMAND_PRIORITY_EDITOR),e.registerCommand(o.DIFF_VERSIONS_COMMAND__EXPERIMENTAL,({prevSnapshot:e,snapshot:t})=>(N({prevSnapshot:e,snapshot:t}),!0),s.COMMAND_PRIORITY_EDITOR))},[e,O,i]),n.useEffect(()=>{const{root:t}=O;if(T)return void o.renderSnapshot__EXPERIMENTAL(O,T.snapshot,T.prevSnapshot);const n=(e,t)=>{const n=t.origin;if(n!==O){const r=n instanceof c.UndoManager;o.syncYjsChangesToLexicalV2__EXPERIMENTAL(O,i,e,t,r)}};t.observeDeep(n);const r=e.registerUpdateListener(({prevEditorState:e,editorState:t,dirtyElements:n,normalizedNodes:r,tags:a})=>{a.has(s.SKIP_COLLAB_TAG)||o.syncLexicalUpdateToYjsV2__EXPERIMENTAL(O,i,e,t,n,r,a)});return()=>{t.unobserveDeep(n),r()}},[O,i,e,T]),E(e,i,u,d,R,C,D),g(O,i,h),O}(I,a,i,l,N,S,A,{__shouldBootstrapUnsafe:u,awarenessData:O,excludedProperties:R,selectionHighlight:D});return function(e,t){_(e,n.useMemo(()=>o.createUndoManager(t,t.root),[t]))}(I,y),p(I,l,S,A,O),C(y,h)};
9
+ "use strict";var e=require("@lexical/react/LexicalCollaborationContext"),t=require("@lexical/react/LexicalComposerContext"),o=require("@lexical/yjs"),n=require("react"),r=require("@lexical/utils"),s=require("lexical"),a=require("react-dom"),c=require("yjs"),i=require("react/jsx-runtime");function l(e){var t=Object.create(null);if(e)for(var o in e)t[o]=e[o];return t.default=e,t}var u=/*#__PURE__*/l(n);const d=Symbol.for("@lexical/yjs/UndoManager");function f(e,t,r,a,i,l,u,d,f,p,_,h,M=o.syncCursorPositions,R=!1){const O=n.useRef(!1),D=n.useCallback(()=>{const{root:t}=d;u&&t.isEmpty()&&0===t._xmlText._length&&m(e,_)},[d,e,_,u]);return n.useEffect(()=>{const{root:t}=d,n=(e,t)=>{const n=t.origin;if(n!==d){const t=n instanceof c.UndoManager;o.syncYjsChangesToLexical(d,r,e,t,M)}};t.getSharedType().observeDeep(n);const a=e.registerUpdateListener(({prevEditorState:e,editorState:t,dirtyLeaves:n,dirtyElements:a,normalizedNodes:c,tags:i})=>{i.has(s.SKIP_COLLAB_TAG)||o.syncLexicalUpdateToYjs(d,r,e,t,a,n,c,i)});return()=>{t.getSharedType().unobserveDeep(n),a()}},[d,r,e,f,a,t,M]),n.useEffect(()=>{const n=n=>{!function(e,t){if(e.update(()=>{const e=s.$getRoot();e.clear(),e.select()},{tag:s.SKIP_COLLAB_TAG}),null==t.cursors)return;const n=t.cursors;if(null==n)return;const r=t.cursorsContainer;if(null==r)return;for(const e of n.values()){const n=e.selection;if(null!==n){null!==n.highlight&&(CSS.highlights.delete(n.highlightName),o.removeCursorHighlightRule(t,n.highlightName)),n.caret.parentNode===r&&r.removeChild(n.caret);for(const e of n.selections)e.parentNode===r&&r.removeChild(e);e.selection=null}}}(e,d),f(n),a.set(t,n),O.current=!0},c=()=>{O.current=!1};return r.on("reload",n),r.on("sync",c),()=>{r.off("reload",n),r.off("sync",c)}},[d,r,e,f,a,t]),E(e,r,i,l,O,h,D),g(d,r,R),C(d,p)}function E(e,t,r,a,c,i,l){const u=n.useCallback(()=>t.connect(),[t]),d=n.useCallback(()=>{try{t.disconnect()}catch(e){}},[t]);n.useEffect(()=>{const n=({status:t})=>{e.dispatchCommand(o.CONNECTED_COMMAND,"connected"===t)},s=e=>{e&&!1===c.current&&l&&l()};o.initLocalState(t,r,a,document.activeElement===e.getRootElement(),i||{}),t.on("status",n),t.on("sync",s);const f=u();return()=>{!1===c.current&&(f?f.then(d):d()),t.off("sync",s),t.off("status",n)}},[e,t,r,a,c,i,l,u,d]),n.useEffect(()=>e.registerCommand(o.TOGGLE_CONNECT_COMMAND,e=>(e?(console.log("Collaboration connected!"),u()):(console.log("Collaboration disconnected!"),d()),!0),s.COMMAND_PRIORITY_EDITOR),[u,d,e]),n.useEffect(()=>{const e=()=>{try{t.awareness.setLocalState(null)}catch(e){}};return window.addEventListener("beforeunload",e),window.addEventListener("pagehide",e),()=>{window.removeEventListener("beforeunload",e),window.removeEventListener("pagehide",e)}},[t])}function g(e,t,r){n.useEffect(()=>{const{awareness:n}=t,s=()=>{o.syncCursorPositions(e,t,{selectionHighlight:r})};return n.on("update",s),()=>{n.off("update",s)}},[e,t,r])}function C(e,t){return n.useMemo(()=>/*#__PURE__*/a.createPortal(/*#__PURE__*/i.jsx("div",{ref:t=>{e.cursorsContainer=t}}),t&&t.current||document.body),[e,t])}function p(e,t,a,c,i){n.useEffect(()=>r.mergeRegister(e.registerCommand(s.FOCUS_COMMAND,()=>(o.setLocalStateFocus(t,a,c,!0,i||{}),!1),s.COMMAND_PRIORITY_EDITOR),e.registerCommand(s.BLUR_COMMAND,()=>(o.setLocalStateFocus(t,a,c,!1,i||{}),!1),s.COMMAND_PRIORITY_EDITOR)),[c,e,a,t,i])}function _(e,t){n.useEffect(()=>r.mergeRegister(e.registerCommand(s.UNDO_COMMAND,()=>(t.undo(),!0),s.COMMAND_PRIORITY_EDITOR),e.registerCommand(s.REDO_COMMAND,()=>(t.redo(),!0),s.COMMAND_PRIORITY_EDITOR))),n.useEffect(()=>{const o=e;return o[d]=t,()=>{o[d]===t&&delete o[d]}},[e,t]);const o=n.useCallback(()=>{t.clear()},[t]);return u.useEffect(()=>{const o=()=>{e.dispatchCommand(s.CAN_UNDO_COMMAND,t.undoStack.length>0),e.dispatchCommand(s.CAN_REDO_COMMAND,t.redoStack.length>0)};return t.on("stack-item-added",o),t.on("stack-item-popped",o),t.on("stack-cleared",o),()=>{t.off("stack-item-added",o),t.off("stack-item-popped",o),t.off("stack-cleared",o)}},[e,t]),o}function m(e,t){e.update(()=>{const o=s.$getRoot();if(o.isEmpty())if(t)switch(typeof t){case"string":{const o=e.parseEditorState(t);e.setEditorState(o,{tag:s.HISTORY_MERGE_TAG});break}case"object":e.setEditorState(t,{tag:s.HISTORY_MERGE_TAG});break;case"function":e.update(()=>{s.$getRoot().isEmpty()&&t(e)},{tag:s.HISTORY_MERGE_TAG})}else{const t=s.$createParagraphNode();o.append(t);const{activeElement:n}=document;(null!==s.$getSelection()||null!==n&&n===e.getRootElement())&&t.select()}},{tag:s.HISTORY_MERGE_TAG})}function h({editor:e,id:t,provider:r,yjsDocMap:s,name:a,color:c,shouldBootstrap:i,cursorsContainerRef:l,initialEditorState:u,awarenessData:d,collabContext:E,binding:g,setDoc:C,syncCursorPositionsFn:m,selectionHighlight:h}){const M=f(e,t,r,s,a,c,i,g,C,l,u,d,m,h);return function(e,t){_(e,n.useMemo(()=>o.createUndoManager(t,t.root.getSharedType()),[t]))}(e,g),p(e,r,a,c,d),M}const M=(e,t)=>{n.useEffect(()=>(e.isCollabActive=!0,()=>{null==t._parentEditor&&(e.isCollabActive=!1)}),[e,t])};exports.CollaborationPlugin=function({id:r,providerFactory:s,shouldBootstrap:a,username:c,cursorColor:l,cursorsContainerRef:u,initialEditorState:d,excludedProperties:f,awarenessData:E,syncCursorPositionsFn:g,selectionHighlight:C}){const p=n.useRef(!1),_=n.useRef(!1),m=e.useCollaborationContext(c,l),{yjsDocMap:R,name:O,color:D}=m,[T]=t.useLexicalComposerContext();M(m,T);const[N,S]=n.useState(),[A,I]=n.useState();n.useEffect(()=>{if(_.current)return;_.current=!0;const e=s(r,R);return S(e),I(R.get(r)),()=>{e.disconnect()}},[r,s,R]);const[y,L]=n.useState();return n.useEffect(()=>{if(!N)return;if(p.current)return;p.current=!0;const e=o.createBinding(T,N,r,A||R.get(r),R,f);return L(e),()=>{e.root.destroy(e)}},[T,N,r,R,A,f]),N&&y?/*#__PURE__*/i.jsx(h,{awarenessData:E,binding:y,collabContext:m,color:D,cursorsContainerRef:u,editor:T,id:r,initialEditorState:d,name:O,provider:N,setDoc:I,shouldBootstrap:a,yjsDocMap:R,syncCursorPositionsFn:g,selectionHighlight:C}):/*#__PURE__*/i.jsx(i.Fragment,{})},exports.CollaborationPluginV2__EXPERIMENTAL=function({id:a,doc:i,provider:l,__shouldBootstrapUnsafe:u,username:d,cursorColor:f,cursorsContainerRef:h,excludedProperties:R,awarenessData:O,selectionHighlight:D}){const T=e.useCollaborationContext(d,f),{yjsDocMap:N,name:S,color:A}=T,[I]=t.useLexicalComposerContext();M(T,I);const y=function(e,t,a,i,l,u,d,f={}){const{awarenessData:C,excludedProperties:p,rootName:_,selectionHighlight:h=!1,__shouldBootstrapUnsafe:M}=f,R=n.useMemo(()=>({current:!1}),[]),O=n.useMemo(()=>o.createBindingV2__EXPERIMENTAL(e,t,a,l,{excludedProperties:p,rootName:_}),[e,t,a,l,p,_]);n.useEffect(()=>(l.set(t,a),()=>{l.delete(t)}),[a,l,t]);const D=n.useCallback(()=>{const{root:t}=O;M&&0===t._length&&m(e)},[O,e,M]),[T,N]=n.useState();return n.useEffect(()=>{r.mergeRegister(e.registerCommand(o.CLEAR_DIFF_VERSIONS_COMMAND__EXPERIMENTAL,()=>(N(null),o.syncYjsStateToLexicalV2__EXPERIMENTAL(O,i),!0),s.COMMAND_PRIORITY_EDITOR),e.registerCommand(o.DIFF_VERSIONS_COMMAND__EXPERIMENTAL,({prevSnapshot:e,snapshot:t})=>(N({prevSnapshot:e,snapshot:t}),!0),s.COMMAND_PRIORITY_EDITOR))},[e,O,i]),n.useEffect(()=>{const{root:t}=O;if(T)return void o.renderSnapshot__EXPERIMENTAL(O,T.snapshot,T.prevSnapshot);const n=(e,t)=>{const n=t.origin;if(n!==O){const r=n instanceof c.UndoManager;o.syncYjsChangesToLexicalV2__EXPERIMENTAL(O,i,e,t,r)}};t.observeDeep(n);const r=e.registerUpdateListener(({prevEditorState:e,editorState:t,dirtyElements:n,normalizedNodes:r,tags:a})=>{a.has(s.SKIP_COLLAB_TAG)||o.syncLexicalUpdateToYjsV2__EXPERIMENTAL(O,i,e,t,n,r,a)});return()=>{t.unobserveDeep(n),r()}},[O,i,e,T]),E(e,i,u,d,R,C,D),g(O,i,h),O}(I,a,i,l,N,S,A,{__shouldBootstrapUnsafe:u,awarenessData:O,excludedProperties:R,selectionHighlight:D});return function(e,t){_(e,n.useMemo(()=>o.createUndoManager(t,t.root),[t]))}(I,y),p(I,l,S,A,O),C(y,h)};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{useCollaborationContext as e}from"@lexical/react/LexicalCollaborationContext";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{syncCursorPositions as o,syncLexicalUpdateToYjs as n,createUndoManager as r,setLocalStateFocus as s,createBindingV2__EXPERIMENTAL as i,CLEAR_DIFF_VERSIONS_COMMAND__EXPERIMENTAL as a,syncYjsStateToLexicalV2__EXPERIMENTAL as c,DIFF_VERSIONS_COMMAND__EXPERIMENTAL as l,renderSnapshot__EXPERIMENTAL as d,syncLexicalUpdateToYjsV2__EXPERIMENTAL as u,syncYjsChangesToLexical as m,initLocalState as p,TOGGLE_CONNECT_COMMAND as f,syncYjsChangesToLexicalV2__EXPERIMENTAL as g,removeCursorHighlightRule as h,CONNECTED_COMMAND as C,createBinding as y}from"@lexical/yjs";import*as v from"react";import{useRef as E,useCallback as S,useEffect as x,useMemo as b,useState as w}from"react";import{mergeRegister as D}from"@lexical/utils";import{SKIP_COLLAB_TAG as k,FOCUS_COMMAND as L,COMMAND_PRIORITY_EDITOR as _,BLUR_COMMAND as j,$getRoot as N,HISTORY_MERGE_TAG as P,$createParagraphNode as H,$getSelection as B,UNDO_COMMAND as R,REDO_COMMAND as U,CAN_UNDO_COMMAND as M,CAN_REDO_COMMAND as F}from"lexical";import{createPortal as T}from"react-dom";import{UndoManager as z}from"yjs";import{jsx as A,Fragment as q}from"react/jsx-runtime";const G=Symbol.for("@lexical/yjs/UndoManager");function I(e,t,r,s,i,a,c,l,d,u,p,f,g=o,C=!1){const y=E(!1),v=S(()=>{const{root:t}=l;c&&t.isEmpty()&&0===t._xmlText._length&&W(e,p)},[l,e,p,c]);return x(()=>{const{root:t}=l,o=(e,t)=>{const o=t.origin;if(o!==l){m(l,r,e,o instanceof z,g)}};t.getSharedType().observeDeep(o);const s=e.registerUpdateListener(({prevEditorState:e,editorState:t,dirtyLeaves:o,dirtyElements:s,normalizedNodes:i,tags:a})=>{a.has(k)||n(l,r,e,t,s,o,i,a)});return()=>{t.getSharedType().unobserveDeep(o),s()}},[l,r,e,d,s,t,g]),x(()=>{const o=o=>{!function(e,t){if(e.update(()=>{const e=N();e.clear(),e.select()},{tag:k}),null==t.cursors)return;const o=t.cursors;if(null==o)return;const n=t.cursorsContainer;if(null==n)return;for(const e of o.values()){const o=e.selection;if(null!==o){null!==o.highlight&&(CSS.highlights.delete(o.highlightName),h(t,o.highlightName)),o.caret.parentNode===n&&n.removeChild(o.caret);for(const e of o.selections)e.parentNode===n&&n.removeChild(e);e.selection=null}}}(e,l),d(o),s.set(t,o),y.current=!0},n=()=>{y.current=!1};return r.on("reload",o),r.on("sync",n),()=>{r.off("reload",o),r.off("sync",n)}},[l,r,e,d,s,t]),J(e,r,i,a,y,f,v),K(l,r,C),O(l,u)}function J(e,t,o,n,r,s,i){const a=S(()=>t.connect(),[t]),c=S(()=>{try{t.disconnect()}catch(e){}},[t]);x(()=>{const l=({status:t})=>{e.dispatchCommand(C,"connected"===t)},d=e=>{e&&!1===r.current&&i&&i()};p(t,o,n,document.activeElement===e.getRootElement(),s||{}),t.on("status",l),t.on("sync",d);const u=a();return()=>{!1===r.current&&(u?u.then(c):c()),t.off("sync",d),t.off("status",l)}},[e,t,o,n,r,s,i,a,c]),x(()=>e.registerCommand(f,e=>(e?(console.log("Collaboration connected!"),a()):(console.log("Collaboration disconnected!"),c()),!0),_),[a,c,e]),x(()=>{const e=()=>{try{t.awareness.setLocalState(null)}catch(e){}};return window.addEventListener("beforeunload",e),window.addEventListener("pagehide",e),()=>{window.removeEventListener("beforeunload",e),window.removeEventListener("pagehide",e)}},[t])}function K(e,t,n){x(()=>{const{awareness:r}=t,s=()=>{o(e,t,{selectionHighlight:n})};return r.on("update",s),()=>{r.off("update",s)}},[e,t,n])}function O(e,t){return b(()=>T(A("div",{ref:t=>{e.cursorsContainer=t}}),t&&t.current||document.body),[e,t])}function Q(e,t,o,n,r){x(()=>D(e.registerCommand(L,()=>(s(t,o,n,!0,r||{}),!1),_),e.registerCommand(j,()=>(s(t,o,n,!1,r||{}),!1),_)),[n,e,o,t,r])}function V(e,t){x(()=>D(e.registerCommand(R,()=>(t.undo(),!0),_),e.registerCommand(U,()=>(t.redo(),!0),_))),x(()=>{const o=e;return o[G]=t,()=>{o[G]===t&&delete o[G]}},[e,t]);const o=S(()=>{t.clear()},[t]);return v.useEffect(()=>{const o=()=>{e.dispatchCommand(M,t.undoStack.length>0),e.dispatchCommand(F,t.redoStack.length>0)};return t.on("stack-item-added",o),t.on("stack-item-popped",o),t.on("stack-cleared",o),()=>{t.off("stack-item-added",o),t.off("stack-item-popped",o),t.off("stack-cleared",o)}},[e,t]),o}function W(e,t){e.update(()=>{const o=N();if(o.isEmpty())if(t)switch(typeof t){case"string":{const o=e.parseEditorState(t);e.setEditorState(o,{tag:P});break}case"object":e.setEditorState(t,{tag:P});break;case"function":e.update(()=>{N().isEmpty()&&t(e)},{tag:P})}else{const t=H();o.append(t);const{activeElement:n}=document;(null!==B()||null!==n&&n===e.getRootElement())&&t.select()}},{tag:P})}function X({id:o,providerFactory:n,shouldBootstrap:r,username:s,cursorColor:i,cursorsContainerRef:a,initialEditorState:c,excludedProperties:l,awarenessData:d,syncCursorPositionsFn:u,selectionHighlight:m}){const p=E(!1),f=E(!1),g=e(s,i),{yjsDocMap:h,name:C,color:v}=g,[S]=t();$(g,S);const[b,D]=w(),[k,L]=w();x(()=>{if(f.current)return;f.current=!0;const e=n(o,h);return D(e),L(h.get(o)),()=>{e.disconnect()}},[o,n,h]);const[_,j]=w();return x(()=>{if(!b)return;if(p.current)return;p.current=!0;const e=y(S,b,o,k||h.get(o),h,l);return j(e),()=>{e.root.destroy(e)}},[S,b,o,h,k,l]),b&&_?A(Y,{awarenessData:d,binding:_,collabContext:g,color:v,cursorsContainerRef:a,editor:S,id:o,initialEditorState:c,name:C,provider:b,setDoc:L,shouldBootstrap:r,yjsDocMap:h,syncCursorPositionsFn:u,selectionHighlight:m}):A(q,{})}function Y({editor:e,id:t,provider:o,yjsDocMap:n,name:s,color:i,shouldBootstrap:a,cursorsContainerRef:c,initialEditorState:l,awarenessData:d,collabContext:u,binding:m,setDoc:p,syncCursorPositionsFn:f,selectionHighlight:g}){const h=I(e,t,o,n,s,i,a,m,p,c,l,d,f,g);return function(e,t){V(e,b(()=>r(t,t.root.getSharedType()),[t]))}(e,m),Q(e,o,s,i,d),h}function Z({id:o,doc:n,provider:s,__shouldBootstrapUnsafe:m,username:p,cursorColor:f,cursorsContainerRef:h,excludedProperties:C,awarenessData:y,selectionHighlight:v}){const E=e(p,f),{yjsDocMap:L,name:j,color:N}=E,[P]=t();$(E,P);const H=function(e,t,o,n,r,s,m,p={}){const{awarenessData:f,excludedProperties:h,rootName:C,selectionHighlight:y=!1,__shouldBootstrapUnsafe:v}=p,E=b(()=>({current:!1}),[]),L=b(()=>i(e,t,o,r,{excludedProperties:h,rootName:C}),[e,t,o,r,h,C]);x(()=>(r.set(t,o),()=>{r.delete(t)}),[o,r,t]);const j=S(()=>{const{root:t}=L;v&&0===t._length&&W(e)},[L,e,v]),[N,P]=w();return x(()=>{D(e.registerCommand(a,()=>(P(null),c(L,n),!0),_),e.registerCommand(l,({prevSnapshot:e,snapshot:t})=>(P({prevSnapshot:e,snapshot:t}),!0),_))},[e,L,n]),x(()=>{const{root:t}=L;if(N)return void d(L,N.snapshot,N.prevSnapshot);const o=(e,t)=>{const o=t.origin;o!==L&&g(L,n,e,t,o instanceof z)};t.observeDeep(o);const r=e.registerUpdateListener(({prevEditorState:e,editorState:t,dirtyElements:o,normalizedNodes:r,tags:s})=>{s.has(k)||u(L,n,e,t,o,r,s)});return()=>{t.unobserveDeep(o),r()}},[L,n,e,N]),J(e,n,s,m,E,f,j),K(L,n,y),L}(P,o,n,s,L,j,N,{__shouldBootstrapUnsafe:m,awarenessData:y,excludedProperties:C,selectionHighlight:v});return function(e,t){V(e,b(()=>r(t,t.root),[t]))}(P,H),Q(P,s,j,N,y),O(H,h)}const $=(e,t)=>{x(()=>(e.isCollabActive=!0,()=>{null==t._parentEditor&&(e.isCollabActive=!1)}),[e,t])};export{X as CollaborationPlugin,Z as CollaborationPluginV2__EXPERIMENTAL};
9
+ import{useCollaborationContext as e}from"@lexical/react/LexicalCollaborationContext";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{syncCursorPositions as o,syncLexicalUpdateToYjs as n,createUndoManager as r,setLocalStateFocus as s,createBindingV2__EXPERIMENTAL as i,CLEAR_DIFF_VERSIONS_COMMAND__EXPERIMENTAL as a,syncYjsStateToLexicalV2__EXPERIMENTAL as c,DIFF_VERSIONS_COMMAND__EXPERIMENTAL as l,renderSnapshot__EXPERIMENTAL as d,syncLexicalUpdateToYjsV2__EXPERIMENTAL as u,syncYjsChangesToLexical as m,initLocalState as p,TOGGLE_CONNECT_COMMAND as f,syncYjsChangesToLexicalV2__EXPERIMENTAL as g,removeCursorHighlightRule as h,CONNECTED_COMMAND as C,createBinding as y}from"@lexical/yjs";import*as v from"react";import{useRef as E,useCallback as S,useEffect as x,useMemo as b,useState as w}from"react";import{mergeRegister as D}from"@lexical/utils";import{SKIP_COLLAB_TAG as k,FOCUS_COMMAND as L,COMMAND_PRIORITY_EDITOR as _,BLUR_COMMAND as j,$getRoot as N,HISTORY_MERGE_TAG as P,$createParagraphNode as H,$getSelection as B,UNDO_COMMAND as R,REDO_COMMAND as U,CAN_UNDO_COMMAND as M,CAN_REDO_COMMAND as F}from"lexical";import{createPortal as T}from"react-dom";import{UndoManager as z}from"yjs";import{jsx as A,Fragment as q}from"react/jsx-runtime";const G=Symbol.for("@lexical/yjs/UndoManager");function I(e,t,r,s,i,a,c,l,d,u,p,f,g=o,C=!1){const y=E(!1),v=S(()=>{const{root:t}=l;c&&t.isEmpty()&&0===t._xmlText._length&&W(e,p)},[l,e,p,c]);return x(()=>{const{root:t}=l,o=(e,t)=>{const o=t.origin;if(o!==l){m(l,r,e,o instanceof z,g)}};t.getSharedType().observeDeep(o);const s=e.registerUpdateListener(({prevEditorState:e,editorState:t,dirtyLeaves:o,dirtyElements:s,normalizedNodes:i,tags:a})=>{a.has(k)||n(l,r,e,t,s,o,i,a)});return()=>{t.getSharedType().unobserveDeep(o),s()}},[l,r,e,d,s,t,g]),x(()=>{const o=o=>{!function(e,t){if(e.update(()=>{const e=N();e.clear(),e.select()},{tag:k}),null==t.cursors)return;const o=t.cursors;if(null==o)return;const n=t.cursorsContainer;if(null==n)return;for(const e of o.values()){const o=e.selection;if(null!==o){null!==o.highlight&&(CSS.highlights.delete(o.highlightName),h(t,o.highlightName)),o.caret.parentNode===n&&n.removeChild(o.caret);for(const e of o.selections)e.parentNode===n&&n.removeChild(e);e.selection=null}}}(e,l),d(o),s.set(t,o),y.current=!0},n=()=>{y.current=!1};return r.on("reload",o),r.on("sync",n),()=>{r.off("reload",o),r.off("sync",n)}},[l,r,e,d,s,t]),J(e,r,i,a,y,f,v),K(l,r,C),O(l,u)}function J(e,t,o,n,r,s,i){const a=S(()=>t.connect(),[t]),c=S(()=>{try{t.disconnect()}catch(e){}},[t]);x(()=>{const l=({status:t})=>{e.dispatchCommand(C,"connected"===t)},d=e=>{e&&!1===r.current&&i&&i()};p(t,o,n,document.activeElement===e.getRootElement(),s||{}),t.on("status",l),t.on("sync",d);const u=a();return()=>{!1===r.current&&(u?u.then(c):c()),t.off("sync",d),t.off("status",l)}},[e,t,o,n,r,s,i,a,c]),x(()=>e.registerCommand(f,e=>(e?(console.log("Collaboration connected!"),a()):(console.log("Collaboration disconnected!"),c()),!0),_),[a,c,e]),x(()=>{const e=()=>{try{t.awareness.setLocalState(null)}catch(e){}};return window.addEventListener("beforeunload",e),window.addEventListener("pagehide",e),()=>{window.removeEventListener("beforeunload",e),window.removeEventListener("pagehide",e)}},[t])}function K(e,t,n){x(()=>{const{awareness:r}=t,s=()=>{o(e,t,{selectionHighlight:n})};return r.on("update",s),()=>{r.off("update",s)}},[e,t,n])}function O(e,t){return b(()=>/*#__PURE__*/T(/*#__PURE__*/A("div",{ref:t=>{e.cursorsContainer=t}}),t&&t.current||document.body),[e,t])}function Q(e,t,o,n,r){x(()=>D(e.registerCommand(L,()=>(s(t,o,n,!0,r||{}),!1),_),e.registerCommand(j,()=>(s(t,o,n,!1,r||{}),!1),_)),[n,e,o,t,r])}function V(e,t){x(()=>D(e.registerCommand(R,()=>(t.undo(),!0),_),e.registerCommand(U,()=>(t.redo(),!0),_))),x(()=>{const o=e;return o[G]=t,()=>{o[G]===t&&delete o[G]}},[e,t]);const o=S(()=>{t.clear()},[t]);return v.useEffect(()=>{const o=()=>{e.dispatchCommand(M,t.undoStack.length>0),e.dispatchCommand(F,t.redoStack.length>0)};return t.on("stack-item-added",o),t.on("stack-item-popped",o),t.on("stack-cleared",o),()=>{t.off("stack-item-added",o),t.off("stack-item-popped",o),t.off("stack-cleared",o)}},[e,t]),o}function W(e,t){e.update(()=>{const o=N();if(o.isEmpty())if(t)switch(typeof t){case"string":{const o=e.parseEditorState(t);e.setEditorState(o,{tag:P});break}case"object":e.setEditorState(t,{tag:P});break;case"function":e.update(()=>{N().isEmpty()&&t(e)},{tag:P})}else{const t=H();o.append(t);const{activeElement:n}=document;(null!==B()||null!==n&&n===e.getRootElement())&&t.select()}},{tag:P})}function X({id:o,providerFactory:n,shouldBootstrap:r,username:s,cursorColor:i,cursorsContainerRef:a,initialEditorState:c,excludedProperties:l,awarenessData:d,syncCursorPositionsFn:u,selectionHighlight:m}){const p=E(!1),f=E(!1),g=e(s,i),{yjsDocMap:h,name:C,color:v}=g,[S]=t();$(g,S);const[b,D]=w(),[k,L]=w();x(()=>{if(f.current)return;f.current=!0;const e=n(o,h);return D(e),L(h.get(o)),()=>{e.disconnect()}},[o,n,h]);const[_,j]=w();return x(()=>{if(!b)return;if(p.current)return;p.current=!0;const e=y(S,b,o,k||h.get(o),h,l);return j(e),()=>{e.root.destroy(e)}},[S,b,o,h,k,l]),b&&_?/*#__PURE__*/A(Y,{awarenessData:d,binding:_,collabContext:g,color:v,cursorsContainerRef:a,editor:S,id:o,initialEditorState:c,name:C,provider:b,setDoc:L,shouldBootstrap:r,yjsDocMap:h,syncCursorPositionsFn:u,selectionHighlight:m}):/*#__PURE__*/A(q,{})}function Y({editor:e,id:t,provider:o,yjsDocMap:n,name:s,color:i,shouldBootstrap:a,cursorsContainerRef:c,initialEditorState:l,awarenessData:d,collabContext:u,binding:m,setDoc:p,syncCursorPositionsFn:f,selectionHighlight:g}){const h=I(e,t,o,n,s,i,a,m,p,c,l,d,f,g);return function(e,t){V(e,b(()=>r(t,t.root.getSharedType()),[t]))}(e,m),Q(e,o,s,i,d),h}function Z({id:o,doc:n,provider:s,__shouldBootstrapUnsafe:m,username:p,cursorColor:f,cursorsContainerRef:h,excludedProperties:C,awarenessData:y,selectionHighlight:v}){const E=e(p,f),{yjsDocMap:L,name:j,color:N}=E,[P]=t();$(E,P);const H=function(e,t,o,n,r,s,m,p={}){const{awarenessData:f,excludedProperties:h,rootName:C,selectionHighlight:y=!1,__shouldBootstrapUnsafe:v}=p,E=b(()=>({current:!1}),[]),L=b(()=>i(e,t,o,r,{excludedProperties:h,rootName:C}),[e,t,o,r,h,C]);x(()=>(r.set(t,o),()=>{r.delete(t)}),[o,r,t]);const j=S(()=>{const{root:t}=L;v&&0===t._length&&W(e)},[L,e,v]),[N,P]=w();return x(()=>{D(e.registerCommand(a,()=>(P(null),c(L,n),!0),_),e.registerCommand(l,({prevSnapshot:e,snapshot:t})=>(P({prevSnapshot:e,snapshot:t}),!0),_))},[e,L,n]),x(()=>{const{root:t}=L;if(N)return void d(L,N.snapshot,N.prevSnapshot);const o=(e,t)=>{const o=t.origin;o!==L&&g(L,n,e,t,o instanceof z)};t.observeDeep(o);const r=e.registerUpdateListener(({prevEditorState:e,editorState:t,dirtyElements:o,normalizedNodes:r,tags:s})=>{s.has(k)||u(L,n,e,t,o,r,s)});return()=>{t.unobserveDeep(o),r()}},[L,n,e,N]),J(e,n,s,m,E,f,j),K(L,n,y),L}(P,o,n,s,L,j,N,{__shouldBootstrapUnsafe:m,awarenessData:y,excludedProperties:C,selectionHighlight:v});return function(e,t){V(e,b(()=>r(t,t.root),[t]))}(P,H),Q(P,s,j,N,y),O(H,h)}const $=(e,t)=>{x(()=>(e.isCollabActive=!0,()=>{null==t._parentEditor&&(e.isCollabActive=!1)}),[e,t])};export{X as CollaborationPlugin,Z as CollaborationPluginV2__EXPERIMENTAL};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("lexical"),o=require("react"),r=require("react/jsx-runtime");const n=t.CAN_USE_DOM?o.useLayoutEffect:o.useEffect,a={tag:t.HISTORY_MERGE_TAG};exports.LexicalComposer=function({initialConfig:i,children:c}){const s=o.useMemo(()=>{const{theme:o,namespace:r,nodes:n,onError:c,onWarn:s,editorState:l,html:u}=i,d=e.createLexicalComposerContext(null,o),m=t.createEditor({editable:i.editable,html:u,namespace:r,nodes:n,onError:e=>c(e,m),...s?{onWarn:e=>s(e,m)}:{},theme:o});return function(e,o){if(null===o)return;if(void 0===o)e.update(()=>{const o=t.$getRoot();if(o.isEmpty()){const r=t.$createParagraphNode();o.append(r);const n=t.CAN_USE_DOM?document.activeElement:null;(null!==t.$getSelection()||null!==n&&n===e.getRootElement())&&r.select()}},a);else if(null!==o)switch(typeof o){case"string":{const t=e.parseEditorState(o);e.setEditorState(t,a);break}case"object":e.setEditorState(o,a);break;case"function":e.update(()=>{t.$getRoot().isEmpty()&&o(e)},a)}}(m,l),[m,d]},[]);return n(()=>{const e=i.editable,[t]=s;t.setEditable(void 0===e||e)},[]),r.jsx(e.LexicalComposerContext.Provider,{value:s,children:c})};
9
+ "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("lexical"),o=require("react"),r=require("react/jsx-runtime");const n=t.CAN_USE_DOM?o.useLayoutEffect:o.useEffect,a={tag:t.HISTORY_MERGE_TAG};exports.LexicalComposer=function({initialConfig:i,children:c}){const s=o.useMemo(()=>{const{theme:o,namespace:r,nodes:n,onError:c,onWarn:s,editorState:l,html:u}=i,d=e.createLexicalComposerContext(null,o),m=t.createEditor({editable:i.editable,html:u,namespace:r,nodes:n,onError:e=>c(e,m),...s?{onWarn:e=>s(e,m)}:{},theme:o});return function(e,o){if(null===o)return;if(void 0===o)e.update(()=>{const o=t.$getRoot();if(o.isEmpty()){const r=t.$createParagraphNode();o.append(r);const n=t.CAN_USE_DOM?document.activeElement:null;(null!==t.$getSelection()||null!==n&&n===e.getRootElement())&&r.select()}},a);else if(null!==o)switch(typeof o){case"string":{const t=e.parseEditorState(o);e.setEditorState(t,a);break}case"object":e.setEditorState(o,a);break;case"function":e.update(()=>{t.$getRoot().isEmpty()&&o(e)},a)}}(m,l),[m,d]},[]);return n(()=>{const e=i.editable,[t]=s;t.setEditable(void 0===e||e)},[]),/*#__PURE__*/r.jsx(e.LexicalComposerContext.Provider,{value:s,children:c})};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{createLexicalComposerContext as t,LexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{CAN_USE_DOM as n,createEditor as o,$getRoot as r,$createParagraphNode as i,$getSelection as a,HISTORY_MERGE_TAG as l}from"lexical";import{useLayoutEffect as c,useEffect as s,useMemo as m}from"react";import{jsx as d}from"react/jsx-runtime";const u=n?c:s,p={tag:l};function f({initialConfig:l,children:c}){const s=m(()=>{const{theme:e,namespace:c,nodes:s,onError:m,onWarn:d,editorState:u,html:f}=l,E=t(null,e),b=o({editable:l.editable,html:f,namespace:c,nodes:s,onError:t=>m(t,b),...d?{onWarn:t=>d(t,b)}:{},theme:e});return function(t,e){if(null===e)return;if(void 0===e)t.update(()=>{const e=r();if(e.isEmpty()){const o=i();e.append(o);const r=n?document.activeElement:null;(null!==a()||null!==r&&r===t.getRootElement())&&o.select()}},p);else if(null!==e)switch(typeof e){case"string":{const n=t.parseEditorState(e);t.setEditorState(n,p);break}case"object":t.setEditorState(e,p);break;case"function":t.update(()=>{r().isEmpty()&&e(t)},p)}}(b,u),[b,E]},[]);return u(()=>{const t=l.editable,[e]=s;e.setEditable(void 0===t||t)},[]),d(e.Provider,{value:s,children:c})}export{f as LexicalComposer};
9
+ import{createLexicalComposerContext as t,LexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{CAN_USE_DOM as n,createEditor as o,$getRoot as r,$createParagraphNode as i,$getSelection as a,HISTORY_MERGE_TAG as l}from"lexical";import{useLayoutEffect as c,useEffect as s,useMemo as m}from"react";import{jsx as d}from"react/jsx-runtime";const u=n?c:s,p={tag:l};function f({initialConfig:l,children:c}){const s=m(()=>{const{theme:e,namespace:c,nodes:s,onError:m,onWarn:d,editorState:u,html:f}=l,E=t(null,e),b=o({editable:l.editable,html:f,namespace:c,nodes:s,onError:t=>m(t,b),...d?{onWarn:t=>d(t,b)}:{},theme:e});return function(t,e){if(null===e)return;if(void 0===e)t.update(()=>{const e=r();if(e.isEmpty()){const o=i();e.append(o);const r=n?document.activeElement:null;(null!==a()||null!==r&&r===t.getRootElement())&&o.select()}},p);else if(null!==e)switch(typeof e){case"string":{const n=t.parseEditorState(e);t.setEditorState(n,p);break}case"object":t.setEditorState(e,p);break;case"function":t.update(()=>{r().isEmpty()&&e(t)},p)}}(b,u),[b,E]},[]);return u(()=>{const t=l.editable,[e]=s;e.setEditable(void 0===t||t)},[]),/*#__PURE__*/d(e.Provider,{value:s,children:c})}export{f as LexicalComposer};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("react");const n=e.createContext(null);exports.LexicalComposerContext=n,exports.createLexicalComposerContext=function(e,n){let t=null;return null!=e&&(t=e[1]),{getTheme:function(){return null!=n?n:null!=t?t.getTheme():null}}},exports.useLexicalComposerContext=function(){const t=e.useContext(n);return null==t&&function(e,...n){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of n)r.append("v",e);throw t.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),t};
9
+ "use strict";var e=require("react");const n=/*#__PURE__*/e.createContext(null);exports.LexicalComposerContext=n,exports.createLexicalComposerContext=function(e,n){let t=null;return null!=e&&(t=e[1]),{getTheme:function(){return null!=n?n:null!=t?t.getTheme():null}}},exports.useLexicalComposerContext=function(){const t=e.useContext(n);return null==t&&function(e,...n){const t=new URL("https://lexical.dev/docs/error"),r=new URLSearchParams;r.append("code",e);for(const e of n)r.append("v",e);throw t.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${t.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),t};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{createContext as n,useContext as e}from"react";const r=n(null);function t(n,e){let r=null;return null!=n&&(r=n[1]),{getTheme:function(){return null!=e?e:null!=r?r.getTheme():null}}}function o(){const n=e(r);return null==n&&function(n,...e){const r=new URL("https://lexical.dev/docs/error"),t=new URLSearchParams;t.append("code",n);for(const n of e)t.append("v",n);throw r.search=t.toString(),Error(`Minified Lexical error #${n}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),n}export{r as LexicalComposerContext,t as createLexicalComposerContext,o as useLexicalComposerContext};
9
+ import{createContext as n,useContext as e}from"react";const r=/*#__PURE__*/n(null);function t(n,e){let r=null;return null!=n&&(r=n[1]),{getTheme:function(){return null!=e?e:null!=r?r.getTheme():null}}}function o(){const n=e(r);return null==n&&function(n,...e){const r=new URL("https://lexical.dev/docs/error"),t=new URLSearchParams;t.append("code",n);for(const n of e)t.append("v",n);throw r.search=t.toString(),Error(`Minified Lexical error #${n}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(8),n}export{r as LexicalComposerContext,t as createLexicalComposerContext,o as useLexicalComposerContext};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("react"),a=require("lexical"),r=require("react/jsx-runtime"),i=require("@lexical/text"),n=require("@lexical/utils");const l=a.CAN_USE_DOM?t.useLayoutEffect:t.useEffect;function o({editor:e,ariaActiveDescendant:a,ariaAutoComplete:i,ariaControls:n,ariaDescribedBy:o,ariaErrorMessage:s,ariaExpanded:u,ariaInvalid:d,ariaLabel:c,ariaLabelledBy:f,ariaMultiline:b,ariaOwns:x,ariaRequired:E,autoCapitalize:m,className:p,id:C,role:v="textbox",spellCheck:y=!0,style:g,tabIndex:L,"data-testid":h,...q},w){const[j,R]=t.useState(e.isEditable()),S=t.useCallback(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),D=t.useMemo(()=>function(...e){return t=>{for(const a of e)"function"==typeof a?a(t):null!=a&&(a.current=t)}}(w,S),[S,w]);return l(()=>(R(e.isEditable()),e.registerEditableListener(e=>{R(e)})),[e]),r.jsx("div",{"aria-activedescendant":j?a:void 0,"aria-autocomplete":j?i:"none","aria-controls":j?n:void 0,"aria-describedby":o,...null!=s?{"aria-errormessage":s}:{},"aria-expanded":j&&"combobox"===v?!!u:void 0,...null!=d?{"aria-invalid":d}:{},"aria-label":c,"aria-labelledby":f,"aria-multiline":b,"aria-owns":j?x:void 0,"aria-readonly":!j||void 0,"aria-required":E,autoCapitalize:m,className:p,contentEditable:j,"data-testid":h,id:C,ref:D,role:v,spellCheck:y,style:g,tabIndex:L,...q})}const s=t.forwardRef(o);function u(e){return e.getEditorState().read(i.$canShowPlaceholderCurry(e.isComposing()))}const d=t.forwardRef(c);function c(t,a){const{placeholder:i,...n}=t,[l]=e.useLexicalComposerContext();return r.jsxs(r.Fragment,{children:[r.jsx(s,{editor:l,...n,ref:a}),null!=i&&r.jsx(f,{editor:l,content:i})]})}function f({content:e,editor:a}){const i=function(e){const[a,r]=t.useState(()=>u(e));return l(()=>{function t(){const t=u(e);r(t)}return t(),n.mergeRegister(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),a}(a),[o,s]=t.useState(a.isEditable());if(t.useLayoutEffect(()=>(s(a.isEditable()),a.registerEditableListener(e=>{s(e)})),[a]),!i)return null;let d=null;return"function"==typeof e?d=e(o):null!==e&&(d=e),null===d?null:r.jsx("div",{"aria-hidden":!0,children:d})}exports.ContentEditable=d,exports.ContentEditableElement=s;
9
+ "use strict";var e=require("@lexical/react/LexicalComposerContext"),t=require("react"),a=require("lexical"),r=require("react/jsx-runtime"),i=require("@lexical/text"),n=require("@lexical/utils");const l=a.CAN_USE_DOM?t.useLayoutEffect:t.useEffect;function o({editor:e,ariaActiveDescendant:a,ariaAutoComplete:i,ariaControls:n,ariaDescribedBy:o,ariaErrorMessage:s,ariaExpanded:u,ariaInvalid:d,ariaLabel:c,ariaLabelledBy:f,ariaMultiline:b,ariaOwns:x,ariaRequired:E,autoCapitalize:m,className:p,id:C,role:v="textbox",spellCheck:y=!0,style:g,tabIndex:L,"data-testid":h,...q},w){const[j,R]=t.useState(e.isEditable()),S=t.useCallback(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),D=t.useMemo(()=>function(...e){return t=>{for(const a of e)"function"==typeof a?a(t):null!=a&&(a.current=t)}}(w,S),[S,w]);return l(()=>(R(e.isEditable()),e.registerEditableListener(e=>{R(e)})),[e]),/*#__PURE__*/r.jsx("div",{"aria-activedescendant":j?a:void 0,"aria-autocomplete":j?i:"none","aria-controls":j?n:void 0,"aria-describedby":o,...null!=s?{"aria-errormessage":s}:{},"aria-expanded":j&&"combobox"===v?!!u:void 0,...null!=d?{"aria-invalid":d}:{},"aria-label":c,"aria-labelledby":f,"aria-multiline":b,"aria-owns":j?x:void 0,"aria-readonly":!j||void 0,"aria-required":E,autoCapitalize:m,className:p,contentEditable:j,"data-testid":h,id:C,ref:D,role:v,spellCheck:y,style:g,tabIndex:L,...q})}const s=/*#__PURE__*/t.forwardRef(o);function u(e){return e.getEditorState().read(i.$canShowPlaceholderCurry(e.isComposing()))}const d=/*#__PURE__*/t.forwardRef(c);function c(t,a){const{placeholder:i,...n}=t,[l]=e.useLexicalComposerContext();/*#__PURE__*/
10
+ return r.jsxs(r.Fragment,{children:[/*#__PURE__*/r.jsx(s,{editor:l,...n,ref:a}),null!=i&&/*#__PURE__*/r.jsx(f,{editor:l,content:i})]})}function f({content:e,editor:a}){const i=function(e){const[a,r]=t.useState(()=>u(e));return l(()=>{function t(){const t=u(e);r(t)}return t(),n.mergeRegister(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),a}(a),[o,s]=t.useState(a.isEditable());if(t.useLayoutEffect(()=>(s(a.isEditable()),a.registerEditableListener(e=>{s(e)})),[a]),!i)return null;let d=null;return"function"==typeof e?d=e(o):null!==e&&(d=e),null===d?null:/*#__PURE__*/r.jsx("div",{"aria-hidden":!0,children:d})}exports.ContentEditable=d,exports.ContentEditableElement=s;
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useLayoutEffect as t,useEffect as i,forwardRef as a,useState as r,useCallback as n,useMemo as o}from"react";import{CAN_USE_DOM as l}from"lexical";import{jsx as d,jsxs as s,Fragment as c}from"react/jsx-runtime";import{$canShowPlaceholderCurry as u}from"@lexical/text";import{mergeRegister as m}from"@lexical/utils";const f=l?t:i;function b({editor:e,ariaActiveDescendant:t,ariaAutoComplete:i,ariaControls:a,ariaDescribedBy:l,ariaErrorMessage:s,ariaExpanded:c,ariaInvalid:u,ariaLabel:m,ariaLabelledBy:b,ariaMultiline:p,ariaOwns:x,ariaRequired:E,autoCapitalize:v,className:y,id:C,role:g="textbox",spellCheck:L=!0,style:h,tabIndex:w,"data-testid":D,...I},R){const[k,q]=r(e.isEditable()),z=n(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),A=o(()=>function(...e){return t=>{for(const i of e)"function"==typeof i?i(t):null!=i&&(i.current=t)}}(R,z),[z,R]);return f(()=>(q(e.isEditable()),e.registerEditableListener(e=>{q(e)})),[e]),d("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?i:"none","aria-controls":k?a:void 0,"aria-describedby":l,...null!=s?{"aria-errormessage":s}:{},"aria-expanded":k&&"combobox"===g?!!c:void 0,...null!=u?{"aria-invalid":u}:{},"aria-label":m,"aria-labelledby":b,"aria-multiline":p,"aria-owns":k?x:void 0,"aria-readonly":!k||void 0,"aria-required":E,autoCapitalize:v,className:y,contentEditable:k,"data-testid":D,id:C,ref:A,role:g,spellCheck:L,style:h,tabIndex:w,...I})}const p=a(b);function x(e){return e.getEditorState().read(u(e.isComposing()))}const E=a(v);function v(t,i){const{placeholder:a,...r}=t,[n]=e();return s(c,{children:[d(p,{editor:n,...r,ref:i}),null!=a&&d(y,{editor:n,content:a})]})}function y({content:e,editor:i}){const a=function(e){const[t,i]=r(()=>x(e));return f(()=>{function t(){const t=x(e);i(t)}return t(),m(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(i),[n,o]=r(i.isEditable());if(t(()=>(o(i.isEditable()),i.registerEditableListener(e=>{o(e)})),[i]),!a)return null;let l=null;return"function"==typeof e?l=e(n):null!==e&&(l=e),null===l?null:d("div",{"aria-hidden":!0,children:l})}export{E as ContentEditable,p as ContentEditableElement};
9
+ import{useLexicalComposerContext as e}from"@lexical/react/LexicalComposerContext";import{useLayoutEffect as t,useEffect as i,forwardRef as a,useState as r,useCallback as n,useMemo as o}from"react";import{CAN_USE_DOM as l}from"lexical";import{jsx as d,jsxs as s,Fragment as c}from"react/jsx-runtime";import{$canShowPlaceholderCurry as u}from"@lexical/text";import{mergeRegister as m}from"@lexical/utils";const f=l?t:i;function b({editor:e,ariaActiveDescendant:t,ariaAutoComplete:i,ariaControls:a,ariaDescribedBy:l,ariaErrorMessage:s,ariaExpanded:c,ariaInvalid:u,ariaLabel:m,ariaLabelledBy:b,ariaMultiline:p,ariaOwns:x,ariaRequired:E,autoCapitalize:v,className:y,id:C,role:g="textbox",spellCheck:L=!0,style:h,tabIndex:w,"data-testid":D,...I},R){const[k,q]=r(e.isEditable()),z=n(t=>{t&&t.ownerDocument&&t.ownerDocument.defaultView?e.setRootElement(t):e.setRootElement(null)},[e]),A=o(()=>function(...e){return t=>{for(const i of e)"function"==typeof i?i(t):null!=i&&(i.current=t)}}(R,z),[z,R]);return f(()=>(q(e.isEditable()),e.registerEditableListener(e=>{q(e)})),[e]),/*#__PURE__*/d("div",{"aria-activedescendant":k?t:void 0,"aria-autocomplete":k?i:"none","aria-controls":k?a:void 0,"aria-describedby":l,...null!=s?{"aria-errormessage":s}:{},"aria-expanded":k&&"combobox"===g?!!c:void 0,...null!=u?{"aria-invalid":u}:{},"aria-label":m,"aria-labelledby":b,"aria-multiline":p,"aria-owns":k?x:void 0,"aria-readonly":!k||void 0,"aria-required":E,autoCapitalize:v,className:y,contentEditable:k,"data-testid":D,id:C,ref:A,role:g,spellCheck:L,style:h,tabIndex:w,...I})}const p=/*#__PURE__*/a(b);function x(e){return e.getEditorState().read(u(e.isComposing()))}const E=/*#__PURE__*/a(v);function v(t,i){const{placeholder:a,...r}=t,[n]=e();/*#__PURE__*/
10
+ return s(c,{children:[/*#__PURE__*/d(p,{editor:n,...r,ref:i}),null!=a&&/*#__PURE__*/d(y,{editor:n,content:a})]})}function y({content:e,editor:i}){const a=function(e){const[t,i]=r(()=>x(e));return f(()=>{function t(){const t=x(e);i(t)}return t(),m(e.registerUpdateListener(()=>{t()}),e.registerEditableListener(()=>{t()}))},[e]),t}(i),[n,o]=r(i.isEditable());if(t(()=>(o(i.isEditable()),i.registerEditableListener(e=>{o(e)})),[i]),!a)return null;let l=null;return"function"==typeof e?l=e(n):null!==e&&(l=e),null===l?null:/*#__PURE__*/d("div",{"aria-hidden":!0,children:l})}export{E as ContentEditable,p as ContentEditableElement};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var t=require("@lexical/react/LexicalComposerContext"),e=require("@lexical/rich-text"),n=require("@lexical/utils"),r=require("lexical"),o=require("react"),i=require("react-dom"),s=require("react/jsx-runtime");class l{_x;_y;constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}equals({x:t,y:e}){return this.x===t&&this.y===e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}}class a{_left;_top;_right;_bottom;constructor(t,e,n,r){const[o,i]=e<=r?[e,r]:[r,e],[s,l]=t<=n?[t,n]:[n,t];this._top=o,this._right=l,this._left=s,this._bottom=i}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:t,left:e,bottom:n,right:r}){return t===this._top&&n===this._bottom&&e===this._left&&r===this._right}contains(t){if(t instanceof l){const{x:e,y:n}=t,r=n<this._top,o=n>this._bottom,i=e<this._left,s=e>this._right;return{reason:{isOnBottomSide:o,isOnLeftSide:i,isOnRightSide:s,isOnTopSide:r},result:!(r||o||i||s)}}{const{top:e,left:n,bottom:r,right:o}=t;return e>=this._top&&e<=this._bottom&&r>=this._top&&r<=this._bottom&&n>=this._left&&n<=this._right&&o>=this._left&&o<=this._right}}intersectsWith(t){const{left:e,top:n,width:r,height:o}=t,{left:i,top:s,width:l,height:a}=this;return(e+r>=i+l?e+r:i+l)-(e<=i?e:i)<=r+l&&(n+o>=s+a?n+o:s+a)-(n<=s?n:s)<=o+a}generateNewRect({left:t=this.left,top:e=this.top,right:n=this.right,bottom:r=this.bottom}){return new a(t,e,n,r)}static fromLTRB(t,e,n,r){return new a(t,e,n,r)}static fromLWTH(t,e,n,r){return new a(t,n,t+e,n+r)}static fromPoints(t,e){const{y:n,x:r}=t,{y:o,x:i}=e;return a.fromLTRB(r,n,i,o)}static fromDOM(t){const{top:e,width:n,left:r,height:o}=t.getBoundingClientRect();return a.fromLWTH(r,n,e,o)}}const c="application/x-lexical-drag-block";let u=1/0;function g(t){const e=(t,e)=>t?parseFloat(window.getComputedStyle(t)[e]):0,{marginTop:n,marginBottom:r}=window.getComputedStyle(t),o=e(t.previousElementSibling,"marginBottom"),i=e(t.nextElementSibling,"marginTop"),s=Math.max(parseFloat(n),o);return{marginBottom:Math.max(parseFloat(r),i),marginTop:s}}function m(t,e,o,i=!1){const s=t.getBoundingClientRect(),c=function(t){return t.getEditorState().read(()=>r.$getRoot().getChildrenKeys())}(e);let m=null;return e.getEditorState().read(()=>{if(i){const[t,r]=[e.getElementByKey(c[0]),e.getElementByKey(c[c.length-1])],[i,s]=[null!=t?t.getBoundingClientRect():void 0,null!=r?r.getBoundingClientRect():void 0];if(i&&s){const e=n.calculateZoomLevel(t),l=n.calculateZoomLevel(r);if(o.y/e<i.top?m=t:o.y/l>s.bottom&&(m=r),m)return}}let t=0===(r=c.length)?1/0:u>=0&&u<r?u:Math.floor(r/2);var r;let h=0;for(;t>=0&&t<c.length;){const r=c[t],i=e.getElementByKey(r);if(null===i)break;const f=n.calculateZoomLevel(i),d=new l(o.x/f,o.y/f),p=a.fromDOM(i),{marginTop:_,marginBottom:y}=g(i),E=p.generateNewRect({bottom:p.bottom+y,left:s.left,right:s.right,top:p.top-_}),{result:R,reason:{isOnTopSide:x,isOnBottomSide:v}}=E.contains(d);if(R){m=i,u=t;break}0===h&&(h=x?-1:v?1:1/0),t+=h}}),m}function h(t,l,a,u,h,f,d,p,_){const y=l.parentElement,E=o.useRef(!1),[R,x]=o.useState(null),v=o.useCallback(t=>{x(t),_&&_(t)},[_]);return o.useEffect(()=>{function e(e){const r=e.target;if(!n.isHTMLElement(r))return void v(null);if(p(r))return;const o=m(l,t,e);v(o)}function r(){v(null)}return null!=y&&(y.addEventListener("mousemove",e),y.addEventListener("mouseleave",r)),()=>{null!=y&&(y.removeEventListener("mousemove",e),y.removeEventListener("mouseleave",r))}},[y,l,t,p,v]),o.useEffect(()=>{const t=n.calculateZoomLevel(document.getElementsByClassName("ContentEditable__root")[0],!0);a.current&&function(t,e,n,r){if(!t)return void(e.style.display="none");const o=t.getBoundingClientRect(),i=window.getComputedStyle(t),s=e.getBoundingClientRect(),l=n.getBoundingClientRect();let a=parseInt(i.lineHeight,10);isNaN(a)&&(a=o.bottom-o.top);const c=(o.top+(a-(s.height||a))/2-l.top+n.scrollTop)/r;e.style.display="flex",e.style.opacity="1",e.style.transform=`translate(4px, ${c}px)`}(R,a.current,l,t)},[l,R,a]),o.useEffect(()=>{function o(r){if(!E.current)return!1;const[o]=e.eventFiles(r);if(o)return!1;const{pageY:i,target:s}=r;if(!n.isHTMLElement(s))return!1;const a=m(l,t,r,!0),c=u.current;return null!==a&&null!==c&&(function(t,e,n,r){const{top:o,height:i}=e.getBoundingClientRect(),{top:s,width:l}=r.getBoundingClientRect(),{marginTop:a,marginBottom:c}=g(e);let u=o;n>=o?u+=i+c/2:u-=a/2;const m=u-s-2+r.scrollTop;t.style.transform=`translate(24px, ${m}px)`,t.style.width=l-48+"px",t.style.opacity=".4"}(c,a,i/n.calculateZoomLevel(s),l),r.preventDefault(),!0)}return n.mergeRegister(t.registerCommand(r.DRAGOVER_COMMAND,t=>o(t),r.COMMAND_PRIORITY_LOW),t.registerCommand(r.DROP_COMMAND,o=>function(o){if(!E.current)return!1;const[i]=e.eventFiles(o);if(i)return!1;const{target:s,dataTransfer:a,pageY:u}=o,g=null!=a?a.getData(c):"",h=r.$getNodeByKey(g);if(!h)return!1;if(!n.isHTMLElement(s))return!1;const f=m(l,t,o,!0);if(!f)return!1;const d=r.$getNearestNodeFromDOMNode(f);if(!d)return!1;if(d===h)return r.IS_FIREFOX&&t.focus(),!0;const p=f.getBoundingClientRect().top;return u/n.calculateZoomLevel(s)>=p?d.insertAfter(h):d.insertBefore(h),v(null),r.IS_FIREFOX&&r.$onUpdate(()=>{t.focus()}),!0}(o),r.COMMAND_PRIORITY_HIGH))},[l,t,u,v]),o.useEffect(()=>{if(r.IS_FIREFOX&&h)return n.mergeRegister(t.registerRootListener(e=>{function o(o){const i=o.relatedTarget;n.isHTMLElement(i)&&p(i)&&(e&&(e.focus({preventScroll:!0}),t.update(()=>{const t=r.$getSelection();null===t||t.dirty||(t.dirty=!0)})),o.stopImmediatePropagation())}if(e)return e.addEventListener("blur",o,!0),()=>e.removeEventListener("blur",o,!0)}),t.registerCommand(r.BLUR_COMMAND,()=>{const e=t.getRootElement(),o=document.activeElement;return!!(e&&n.isHTMLElement(o)&&p(o))&&(e.focus({preventScroll:!0}),t.update(()=>{const t=r.$getSelection();null===t||t.dirty||(t.dirty=!0)}),!0)},r.COMMAND_PRIORITY_HIGH))},[t,h,p]),i.createPortal(s.jsxs(s.Fragment,{children:[s.jsx("div",{draggable:!0,onDragStart:function(e){const n=e.dataTransfer;if(!n||!R)return;!function(t,e){const{transform:n}=e.style;e.style.transform="translateZ(0)",t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=n})}(n,R);let o="";if(t.update(()=>{const t=r.$getNearestNodeFromDOMNode(R);t&&(o=t.getKey())}),E.current=!0,n.setData(c,o),r.IS_FIREFOX){const e=t.getRootElement();null!==e&&document.activeElement!==e&&(e.focus({preventScroll:!0}),t.update(()=>{const t=r.$getSelection();null===t||t.dirty||(t.dirty=!0)}))}},onDragEnd:function(){var e;E.current=!1,(e=u.current)&&(e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)"),r.IS_FIREFOX&&t.focus()},children:h&&f}),d]}),l)}exports.DraggableBlockPlugin_EXPERIMENTAL=function({anchorElem:e=document.body,menuRef:n,targetLineRef:r,menuComponent:o,targetLineComponent:i,isOnMenu:s,onElementChanged:l}){const[a]=t.useLexicalComposerContext();return h(a,e,n,r,a._editable,o,i,s,l)};
9
+ "use strict";var t=require("@lexical/react/LexicalComposerContext"),e=require("@lexical/rich-text"),n=require("@lexical/utils"),r=require("lexical"),o=require("react"),i=require("react-dom"),s=require("react/jsx-runtime");class l{_x;_y;constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}equals({x:t,y:e}){return this.x===t&&this.y===e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}}class a{_left;_top;_right;_bottom;constructor(t,e,n,r){const[o,i]=e<=r?[e,r]:[r,e],[s,l]=t<=n?[t,n]:[n,t];this._top=o,this._right=l,this._left=s,this._bottom=i}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:t,left:e,bottom:n,right:r}){return t===this._top&&n===this._bottom&&e===this._left&&r===this._right}contains(t){if(t instanceof l){const{x:e,y:n}=t,r=n<this._top,o=n>this._bottom,i=e<this._left,s=e>this._right;return{reason:{isOnBottomSide:o,isOnLeftSide:i,isOnRightSide:s,isOnTopSide:r},result:!(r||o||i||s)}}{const{top:e,left:n,bottom:r,right:o}=t;return e>=this._top&&e<=this._bottom&&r>=this._top&&r<=this._bottom&&n>=this._left&&n<=this._right&&o>=this._left&&o<=this._right}}intersectsWith(t){const{left:e,top:n,width:r,height:o}=t,{left:i,top:s,width:l,height:a}=this;return(e+r>=i+l?e+r:i+l)-(e<=i?e:i)<=r+l&&(n+o>=s+a?n+o:s+a)-(n<=s?n:s)<=o+a}generateNewRect({left:t=this.left,top:e=this.top,right:n=this.right,bottom:r=this.bottom}){return new a(t,e,n,r)}static fromLTRB(t,e,n,r){return new a(t,e,n,r)}static fromLWTH(t,e,n,r){return new a(t,n,t+e,n+r)}static fromPoints(t,e){const{y:n,x:r}=t,{y:o,x:i}=e;return a.fromLTRB(r,n,i,o)}static fromDOM(t){const{top:e,width:n,left:r,height:o}=t.getBoundingClientRect();return a.fromLWTH(r,n,e,o)}}const c="application/x-lexical-drag-block";let u=1/0;function g(t){const e=(t,e)=>t?parseFloat(window.getComputedStyle(t)[e]):0,{marginTop:n,marginBottom:r}=window.getComputedStyle(t),o=e(t.previousElementSibling,"marginBottom"),i=e(t.nextElementSibling,"marginTop"),s=Math.max(parseFloat(n),o);return{marginBottom:Math.max(parseFloat(r),i),marginTop:s}}function m(t,e,o,i=!1){const s=t.getBoundingClientRect(),c=function(t){return t.getEditorState().read(()=>r.$getRoot().getChildrenKeys())}(e);let m=null;return e.getEditorState().read(()=>{if(i){const[t,r]=[e.getElementByKey(c[0]),e.getElementByKey(c[c.length-1])],[i,s]=[null!=t?t.getBoundingClientRect():void 0,null!=r?r.getBoundingClientRect():void 0];if(i&&s){const e=n.calculateZoomLevel(t),l=n.calculateZoomLevel(r);if(o.y/e<i.top?m=t:o.y/l>s.bottom&&(m=r),m)return}}let t=0===(r=c.length)?1/0:u>=0&&u<r?u:Math.floor(r/2);var r;let h=0;for(;t>=0&&t<c.length;){const r=c[t],i=e.getElementByKey(r);if(null===i)break;const f=n.calculateZoomLevel(i),d=new l(o.x/f,o.y/f),p=a.fromDOM(i),{marginTop:_,marginBottom:y}=g(i),E=p.generateNewRect({bottom:p.bottom+y,left:s.left,right:s.right,top:p.top-_}),{result:R,reason:{isOnTopSide:x,isOnBottomSide:v}}=E.contains(d);if(R){m=i,u=t;break}0===h&&(h=x?-1:v?1:1/0),t+=h}}),m}function h(t,l,a,u,h,f,d,p,_){const y=l.parentElement,E=o.useRef(!1),[R,x]=o.useState(null),v=o.useCallback(t=>{x(t),_&&_(t)},[_]);return o.useEffect(()=>{function e(e){const r=e.target;if(!n.isHTMLElement(r))return void v(null);if(p(r))return;const o=m(l,t,e);v(o)}function r(){v(null)}return null!=y&&(y.addEventListener("mousemove",e),y.addEventListener("mouseleave",r)),()=>{null!=y&&(y.removeEventListener("mousemove",e),y.removeEventListener("mouseleave",r))}},[y,l,t,p,v]),o.useEffect(()=>{const t=n.calculateZoomLevel(document.getElementsByClassName("ContentEditable__root")[0],!0);a.current&&function(t,e,n,r){if(!t)return void(e.style.display="none");const o=t.getBoundingClientRect(),i=window.getComputedStyle(t),s=e.getBoundingClientRect(),l=n.getBoundingClientRect();let a=parseInt(i.lineHeight,10);isNaN(a)&&(a=o.bottom-o.top);const c=(o.top+(a-(s.height||a))/2-l.top+n.scrollTop)/r;e.style.display="flex",e.style.opacity="1",e.style.transform=`translate(4px, ${c}px)`}(R,a.current,l,t)},[l,R,a]),o.useEffect(()=>{function o(r){if(!E.current)return!1;const[o]=e.eventFiles(r);if(o)return!1;const{pageY:i,target:s}=r;if(!n.isHTMLElement(s))return!1;const a=m(l,t,r,!0),c=u.current;return null!==a&&null!==c&&(function(t,e,n,r){const{top:o,height:i}=e.getBoundingClientRect(),{top:s,width:l}=r.getBoundingClientRect(),{marginTop:a,marginBottom:c}=g(e);let u=o;n>=o?u+=i+c/2:u-=a/2;const m=u-s-2+r.scrollTop;t.style.transform=`translate(24px, ${m}px)`,t.style.width=l-48+"px",t.style.opacity=".4"}(c,a,i/n.calculateZoomLevel(s),l),r.preventDefault(),!0)}return n.mergeRegister(t.registerCommand(r.DRAGOVER_COMMAND,t=>o(t),r.COMMAND_PRIORITY_LOW),t.registerCommand(r.DROP_COMMAND,o=>function(o){if(!E.current)return!1;const[i]=e.eventFiles(o);if(i)return!1;const{target:s,dataTransfer:a,pageY:u}=o,g=null!=a?a.getData(c):"",h=r.$getNodeByKey(g);if(!h)return!1;if(!n.isHTMLElement(s))return!1;const f=m(l,t,o,!0);if(!f)return!1;const d=r.$getNearestNodeFromDOMNode(f);if(!d)return!1;if(d===h)return r.IS_FIREFOX&&t.focus(),!0;const p=f.getBoundingClientRect().top;return u/n.calculateZoomLevel(s)>=p?d.insertAfter(h):d.insertBefore(h),v(null),r.IS_FIREFOX&&r.$onUpdate(()=>{t.focus()}),!0}(o),r.COMMAND_PRIORITY_HIGH))},[l,t,u,v]),o.useEffect(()=>{if(r.IS_FIREFOX&&h)return n.mergeRegister(t.registerRootListener(e=>{function o(o){const i=o.relatedTarget;n.isHTMLElement(i)&&p(i)&&(e&&(e.focus({preventScroll:!0}),t.update(()=>{const t=r.$getSelection();null===t||t.dirty||(t.dirty=!0)})),o.stopImmediatePropagation())}if(e)return e.addEventListener("blur",o,!0),()=>e.removeEventListener("blur",o,!0)}),t.registerCommand(r.BLUR_COMMAND,()=>{const e=t.getRootElement(),o=document.activeElement;return!!(e&&n.isHTMLElement(o)&&p(o))&&(e.focus({preventScroll:!0}),t.update(()=>{const t=r.$getSelection();null===t||t.dirty||(t.dirty=!0)}),!0)},r.COMMAND_PRIORITY_HIGH))},[t,h,p]),/*#__PURE__*/i.createPortal(/*#__PURE__*/s.jsxs(s.Fragment,{children:[/*#__PURE__*/s.jsx("div",{draggable:!0,onDragStart:function(e){const n=e.dataTransfer;if(!n||!R)return;!function(t,e){const{transform:n}=e.style;e.style.transform="translateZ(0)",t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=n})}(n,R);let o="";if(t.update(()=>{const t=r.$getNearestNodeFromDOMNode(R);t&&(o=t.getKey())}),E.current=!0,n.setData(c,o),r.IS_FIREFOX){const e=t.getRootElement();null!==e&&document.activeElement!==e&&(e.focus({preventScroll:!0}),t.update(()=>{const t=r.$getSelection();null===t||t.dirty||(t.dirty=!0)}))}},onDragEnd:function(){var e;E.current=!1,(e=u.current)&&(e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)"),r.IS_FIREFOX&&t.focus()},children:h&&f}),d]}),l)}exports.DraggableBlockPlugin_EXPERIMENTAL=function({anchorElem:e=document.body,menuRef:n,targetLineRef:r,menuComponent:o,targetLineComponent:i,isOnMenu:s,onElementChanged:l}){const[a]=t.useLexicalComposerContext();return h(a,e,n,r,a._editable,o,i,s,l)};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{eventFiles as e}from"@lexical/rich-text";import{calculateZoomLevel as n,mergeRegister as r,isHTMLElement as o}from"@lexical/utils";import{DRAGOVER_COMMAND as i,COMMAND_PRIORITY_LOW as s,DROP_COMMAND as l,COMMAND_PRIORITY_HIGH as a,IS_FIREFOX as c,BLUR_COMMAND as u,$getSelection as m,$getNodeByKey as g,$getNearestNodeFromDOMNode as h,$onUpdate as f,$getRoot as p}from"lexical";import{useRef as d,useState as y,useCallback as _,useEffect as x}from"react";import{createPortal as b}from"react-dom";import{jsxs as v,Fragment as T,jsx as B}from"react/jsx-runtime";class C{_x;_y;constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}equals({x:t,y:e}){return this.x===t&&this.y===e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}}class E{_left;_top;_right;_bottom;constructor(t,e,n,r){const[o,i]=e<=r?[e,r]:[r,e],[s,l]=t<=n?[t,n]:[n,t];this._top=o,this._right=l,this._left=s,this._bottom=i}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:t,left:e,bottom:n,right:r}){return t===this._top&&n===this._bottom&&e===this._left&&r===this._right}contains(t){if(t instanceof C){const{x:e,y:n}=t,r=n<this._top,o=n>this._bottom,i=e<this._left,s=e>this._right;return{reason:{isOnBottomSide:o,isOnLeftSide:i,isOnRightSide:s,isOnTopSide:r},result:!(r||o||i||s)}}{const{top:e,left:n,bottom:r,right:o}=t;return e>=this._top&&e<=this._bottom&&r>=this._top&&r<=this._bottom&&n>=this._left&&n<=this._right&&o>=this._left&&o<=this._right}}intersectsWith(t){const{left:e,top:n,width:r,height:o}=t,{left:i,top:s,width:l,height:a}=this;return(e+r>=i+l?e+r:i+l)-(e<=i?e:i)<=r+l&&(n+o>=s+a?n+o:s+a)-(n<=s?n:s)<=o+a}generateNewRect({left:t=this.left,top:e=this.top,right:n=this.right,bottom:r=this.bottom}){return new E(t,e,n,r)}static fromLTRB(t,e,n,r){return new E(t,e,n,r)}static fromLWTH(t,e,n,r){return new E(t,n,t+e,n+r)}static fromPoints(t,e){const{y:n,x:r}=t,{y:o,x:i}=e;return E.fromLTRB(r,n,i,o)}static fromDOM(t){const{top:e,width:n,left:r,height:o}=t.getBoundingClientRect();return E.fromLWTH(r,n,e,o)}}const w="application/x-lexical-drag-block";let R=1/0;function D(t){const e=(t,e)=>t?parseFloat(window.getComputedStyle(t)[e]):0,{marginTop:n,marginBottom:r}=window.getComputedStyle(t),o=e(t.previousElementSibling,"marginBottom"),i=e(t.nextElementSibling,"marginTop"),s=Math.max(parseFloat(n),o);return{marginBottom:Math.max(parseFloat(r),i),marginTop:s}}function S(t,e,r,o=!1){const i=t.getBoundingClientRect(),s=function(t){return t.getEditorState().read(()=>p().getChildrenKeys())}(e);let l=null;return e.getEditorState().read(()=>{if(o){const[t,o]=[e.getElementByKey(s[0]),e.getElementByKey(s[s.length-1])],[i,a]=[null!=t?t.getBoundingClientRect():void 0,null!=o?o.getBoundingClientRect():void 0];if(i&&a){const e=n(t),s=n(o);if(r.y/e<i.top?l=t:r.y/s>a.bottom&&(l=o),l)return}}let t=0===(a=s.length)?1/0:R>=0&&R<a?R:Math.floor(a/2);var a;let c=0;for(;t>=0&&t<s.length;){const o=s[t],a=e.getElementByKey(o);if(null===a)break;const u=n(a),m=new C(r.x/u,r.y/u),g=E.fromDOM(a),{marginTop:h,marginBottom:f}=D(a),p=g.generateNewRect({bottom:g.bottom+f,left:i.left,right:i.right,top:g.top-h}),{result:d,reason:{isOnTopSide:y,isOnBottomSide:_}}=p.contains(m);if(d){l=a,R=t;break}0===c&&(c=y?-1:_?1:1/0),t+=c}}),l}function L(t,p,C,E,R,L,M,O,K){const N=p.parentElement,Y=d(!1),[H,k]=y(null),q=_(t=>{k(t),K&&K(t)},[K]);return x(()=>{function e(e){const n=e.target;if(!o(n))return void q(null);if(O(n))return;const r=S(p,t,e);q(r)}function n(){q(null)}return null!=N&&(N.addEventListener("mousemove",e),N.addEventListener("mouseleave",n)),()=>{null!=N&&(N.removeEventListener("mousemove",e),N.removeEventListener("mouseleave",n))}},[N,p,t,O,q]),x(()=>{const t=n(document.getElementsByClassName("ContentEditable__root")[0],!0);C.current&&function(t,e,n,r){if(!t)return void(e.style.display="none");const o=t.getBoundingClientRect(),i=window.getComputedStyle(t),s=e.getBoundingClientRect(),l=n.getBoundingClientRect();let a=parseInt(i.lineHeight,10);isNaN(a)&&(a=o.bottom-o.top);const c=(o.top+(a-(s.height||a))/2-l.top+n.scrollTop)/r;e.style.display="flex",e.style.opacity="1",e.style.transform=`translate(4px, ${c}px)`}(H,C.current,p,t)},[p,H,C]),x(()=>{function u(r){if(!Y.current)return!1;const[i]=e(r);if(i)return!1;const{pageY:s,target:l}=r;if(!o(l))return!1;const a=S(p,t,r,!0),c=E.current;return null!==a&&null!==c&&(function(t,e,n,r){const{top:o,height:i}=e.getBoundingClientRect(),{top:s,width:l}=r.getBoundingClientRect(),{marginTop:a,marginBottom:c}=D(e);let u=o;n>=o?u+=i+c/2:u-=a/2;const m=u-s-2+r.scrollTop;t.style.transform=`translate(24px, ${m}px)`,t.style.width=l-48+"px",t.style.opacity=".4"}(c,a,s/n(l),p),r.preventDefault(),!0)}return r(t.registerCommand(i,t=>u(t),s),t.registerCommand(l,r=>function(r){if(!Y.current)return!1;const[i]=e(r);if(i)return!1;const{target:s,dataTransfer:l,pageY:a}=r,u=null!=l?l.getData(w):"",m=g(u);if(!m)return!1;if(!o(s))return!1;const d=S(p,t,r,!0);if(!d)return!1;const y=h(d);if(!y)return!1;if(y===m)return c&&t.focus(),!0;const _=d.getBoundingClientRect().top;return a/n(s)>=_?y.insertAfter(m):y.insertBefore(m),q(null),c&&f(()=>{t.focus()}),!0}(r),a))},[p,t,E,q]),x(()=>{if(c&&R)return r(t.registerRootListener(e=>{function n(n){const r=n.relatedTarget;o(r)&&O(r)&&(e&&(e.focus({preventScroll:!0}),t.update(()=>{const t=m();null===t||t.dirty||(t.dirty=!0)})),n.stopImmediatePropagation())}if(e)return e.addEventListener("blur",n,!0),()=>e.removeEventListener("blur",n,!0)}),t.registerCommand(u,()=>{const e=t.getRootElement(),n=document.activeElement;return!!(e&&o(n)&&O(n))&&(e.focus({preventScroll:!0}),t.update(()=>{const t=m();null===t||t.dirty||(t.dirty=!0)}),!0)},a))},[t,R,O]),b(v(T,{children:[B("div",{draggable:!0,onDragStart:function(e){const n=e.dataTransfer;if(!n||!H)return;!function(t,e){const{transform:n}=e.style;e.style.transform="translateZ(0)",t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=n})}(n,H);let r="";if(t.update(()=>{const t=h(H);t&&(r=t.getKey())}),Y.current=!0,n.setData(w,r),c){const e=t.getRootElement();null!==e&&document.activeElement!==e&&(e.focus({preventScroll:!0}),t.update(()=>{const t=m();null===t||t.dirty||(t.dirty=!0)}))}},onDragEnd:function(){var e;Y.current=!1,(e=E.current)&&(e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)"),c&&t.focus()},children:R&&L}),M]}),p)}function M({anchorElem:e=document.body,menuRef:n,targetLineRef:r,menuComponent:o,targetLineComponent:i,isOnMenu:s,onElementChanged:l}){const[a]=t();return L(a,e,n,r,a._editable,o,i,s,l)}export{M as DraggableBlockPlugin_EXPERIMENTAL};
9
+ import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{eventFiles as e}from"@lexical/rich-text";import{calculateZoomLevel as n,mergeRegister as r,isHTMLElement as o}from"@lexical/utils";import{DRAGOVER_COMMAND as i,COMMAND_PRIORITY_LOW as s,DROP_COMMAND as l,COMMAND_PRIORITY_HIGH as a,IS_FIREFOX as c,BLUR_COMMAND as u,$getSelection as m,$getNodeByKey as g,$getNearestNodeFromDOMNode as h,$onUpdate as f,$getRoot as p}from"lexical";import{useRef as d,useState as y,useCallback as _,useEffect as x}from"react";import{createPortal as b}from"react-dom";import{jsxs as v,Fragment as T,jsx as B}from"react/jsx-runtime";class C{_x;_y;constructor(t,e){this._x=t,this._y=e}get x(){return this._x}get y(){return this._y}equals({x:t,y:e}){return this.x===t&&this.y===e}calcDeltaXTo({x:t}){return this.x-t}calcDeltaYTo({y:t}){return this.y-t}calcHorizontalDistanceTo(t){return Math.abs(this.calcDeltaXTo(t))}calcVerticalDistance(t){return Math.abs(this.calcDeltaYTo(t))}calcDistanceTo(t){return Math.sqrt(Math.pow(this.calcDeltaXTo(t),2)+Math.pow(this.calcDeltaYTo(t),2))}}class E{_left;_top;_right;_bottom;constructor(t,e,n,r){const[o,i]=e<=r?[e,r]:[r,e],[s,l]=t<=n?[t,n]:[n,t];this._top=o,this._right=l,this._left=s,this._bottom=i}get top(){return this._top}get right(){return this._right}get bottom(){return this._bottom}get left(){return this._left}get width(){return Math.abs(this._left-this._right)}get height(){return Math.abs(this._bottom-this._top)}equals({top:t,left:e,bottom:n,right:r}){return t===this._top&&n===this._bottom&&e===this._left&&r===this._right}contains(t){if(t instanceof C){const{x:e,y:n}=t,r=n<this._top,o=n>this._bottom,i=e<this._left,s=e>this._right;return{reason:{isOnBottomSide:o,isOnLeftSide:i,isOnRightSide:s,isOnTopSide:r},result:!(r||o||i||s)}}{const{top:e,left:n,bottom:r,right:o}=t;return e>=this._top&&e<=this._bottom&&r>=this._top&&r<=this._bottom&&n>=this._left&&n<=this._right&&o>=this._left&&o<=this._right}}intersectsWith(t){const{left:e,top:n,width:r,height:o}=t,{left:i,top:s,width:l,height:a}=this;return(e+r>=i+l?e+r:i+l)-(e<=i?e:i)<=r+l&&(n+o>=s+a?n+o:s+a)-(n<=s?n:s)<=o+a}generateNewRect({left:t=this.left,top:e=this.top,right:n=this.right,bottom:r=this.bottom}){return new E(t,e,n,r)}static fromLTRB(t,e,n,r){return new E(t,e,n,r)}static fromLWTH(t,e,n,r){return new E(t,n,t+e,n+r)}static fromPoints(t,e){const{y:n,x:r}=t,{y:o,x:i}=e;return E.fromLTRB(r,n,i,o)}static fromDOM(t){const{top:e,width:n,left:r,height:o}=t.getBoundingClientRect();return E.fromLWTH(r,n,e,o)}}const w="application/x-lexical-drag-block";let R=1/0;function D(t){const e=(t,e)=>t?parseFloat(window.getComputedStyle(t)[e]):0,{marginTop:n,marginBottom:r}=window.getComputedStyle(t),o=e(t.previousElementSibling,"marginBottom"),i=e(t.nextElementSibling,"marginTop"),s=Math.max(parseFloat(n),o);return{marginBottom:Math.max(parseFloat(r),i),marginTop:s}}function S(t,e,r,o=!1){const i=t.getBoundingClientRect(),s=function(t){return t.getEditorState().read(()=>p().getChildrenKeys())}(e);let l=null;return e.getEditorState().read(()=>{if(o){const[t,o]=[e.getElementByKey(s[0]),e.getElementByKey(s[s.length-1])],[i,a]=[null!=t?t.getBoundingClientRect():void 0,null!=o?o.getBoundingClientRect():void 0];if(i&&a){const e=n(t),s=n(o);if(r.y/e<i.top?l=t:r.y/s>a.bottom&&(l=o),l)return}}let t=0===(a=s.length)?1/0:R>=0&&R<a?R:Math.floor(a/2);var a;let c=0;for(;t>=0&&t<s.length;){const o=s[t],a=e.getElementByKey(o);if(null===a)break;const u=n(a),m=new C(r.x/u,r.y/u),g=E.fromDOM(a),{marginTop:h,marginBottom:f}=D(a),p=g.generateNewRect({bottom:g.bottom+f,left:i.left,right:i.right,top:g.top-h}),{result:d,reason:{isOnTopSide:y,isOnBottomSide:_}}=p.contains(m);if(d){l=a,R=t;break}0===c&&(c=y?-1:_?1:1/0),t+=c}}),l}function L(t,p,C,E,R,L,M,O,K){const N=p.parentElement,Y=d(!1),[H,k]=y(null),q=_(t=>{k(t),K&&K(t)},[K]);return x(()=>{function e(e){const n=e.target;if(!o(n))return void q(null);if(O(n))return;const r=S(p,t,e);q(r)}function n(){q(null)}return null!=N&&(N.addEventListener("mousemove",e),N.addEventListener("mouseleave",n)),()=>{null!=N&&(N.removeEventListener("mousemove",e),N.removeEventListener("mouseleave",n))}},[N,p,t,O,q]),x(()=>{const t=n(document.getElementsByClassName("ContentEditable__root")[0],!0);C.current&&function(t,e,n,r){if(!t)return void(e.style.display="none");const o=t.getBoundingClientRect(),i=window.getComputedStyle(t),s=e.getBoundingClientRect(),l=n.getBoundingClientRect();let a=parseInt(i.lineHeight,10);isNaN(a)&&(a=o.bottom-o.top);const c=(o.top+(a-(s.height||a))/2-l.top+n.scrollTop)/r;e.style.display="flex",e.style.opacity="1",e.style.transform=`translate(4px, ${c}px)`}(H,C.current,p,t)},[p,H,C]),x(()=>{function u(r){if(!Y.current)return!1;const[i]=e(r);if(i)return!1;const{pageY:s,target:l}=r;if(!o(l))return!1;const a=S(p,t,r,!0),c=E.current;return null!==a&&null!==c&&(function(t,e,n,r){const{top:o,height:i}=e.getBoundingClientRect(),{top:s,width:l}=r.getBoundingClientRect(),{marginTop:a,marginBottom:c}=D(e);let u=o;n>=o?u+=i+c/2:u-=a/2;const m=u-s-2+r.scrollTop;t.style.transform=`translate(24px, ${m}px)`,t.style.width=l-48+"px",t.style.opacity=".4"}(c,a,s/n(l),p),r.preventDefault(),!0)}return r(t.registerCommand(i,t=>u(t),s),t.registerCommand(l,r=>function(r){if(!Y.current)return!1;const[i]=e(r);if(i)return!1;const{target:s,dataTransfer:l,pageY:a}=r,u=null!=l?l.getData(w):"",m=g(u);if(!m)return!1;if(!o(s))return!1;const d=S(p,t,r,!0);if(!d)return!1;const y=h(d);if(!y)return!1;if(y===m)return c&&t.focus(),!0;const _=d.getBoundingClientRect().top;return a/n(s)>=_?y.insertAfter(m):y.insertBefore(m),q(null),c&&f(()=>{t.focus()}),!0}(r),a))},[p,t,E,q]),x(()=>{if(c&&R)return r(t.registerRootListener(e=>{function n(n){const r=n.relatedTarget;o(r)&&O(r)&&(e&&(e.focus({preventScroll:!0}),t.update(()=>{const t=m();null===t||t.dirty||(t.dirty=!0)})),n.stopImmediatePropagation())}if(e)return e.addEventListener("blur",n,!0),()=>e.removeEventListener("blur",n,!0)}),t.registerCommand(u,()=>{const e=t.getRootElement(),n=document.activeElement;return!!(e&&o(n)&&O(n))&&(e.focus({preventScroll:!0}),t.update(()=>{const t=m();null===t||t.dirty||(t.dirty=!0)}),!0)},a))},[t,R,O]),/*#__PURE__*/b(/*#__PURE__*/v(T,{children:[/*#__PURE__*/B("div",{draggable:!0,onDragStart:function(e){const n=e.dataTransfer;if(!n||!H)return;!function(t,e){const{transform:n}=e.style;e.style.transform="translateZ(0)",t.setDragImage(e,0,0),setTimeout(()=>{e.style.transform=n})}(n,H);let r="";if(t.update(()=>{const t=h(H);t&&(r=t.getKey())}),Y.current=!0,n.setData(w,r),c){const e=t.getRootElement();null!==e&&document.activeElement!==e&&(e.focus({preventScroll:!0}),t.update(()=>{const t=m();null===t||t.dirty||(t.dirty=!0)}))}},onDragEnd:function(){var e;Y.current=!1,(e=E.current)&&(e.style.opacity="0",e.style.transform="translate(-10000px, -10000px)"),c&&t.focus()},children:R&&L}),M]}),p)}function M({anchorElem:e=document.body,menuRef:n,targetLineRef:r,menuComponent:o,targetLineComponent:i,isOnMenu:s,onElementChanged:l}){const[a]=t();return L(a,e,n,r,a._editable,o,i,s,l)}export{M as DraggableBlockPlugin_EXPERIMENTAL};
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/react/LexicalComposerContext");function t(e){var t=Object.create(null);if(e)for(var r in e)t[r]=e[r];return t.default=e,t}var r=t(require("react"));exports.EditorRefPlugin=function({editorRef:t}){const[n]=e.useLexicalComposerContext();return r.useEffect(()=>{"function"==typeof t?t(n):"object"==typeof t&&null!==t&&(t.current=n)},[n]),null};
9
+ "use strict";var e=require("@lexical/react/LexicalComposerContext");function t(e){var t=Object.create(null);if(e)for(var r in e)t[r]=e[r];return t.default=e,t}var r=/*#__PURE__*/t(require("react"));exports.EditorRefPlugin=function({editorRef:t}){const[n]=e.useLexicalComposerContext();return r.useEffect(()=>{"function"==typeof t?t(n):"object"==typeof t&&null!==t&&(t.current=n)},[n]),null};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var r=require("react"),e=require("react-error-boundary"),o=require("react/jsx-runtime");exports.LexicalErrorBoundary=function({children:n,onError:a}){const c=r.useCallback((r,e)=>{a(r instanceof Error?r:new Error(String(r),{cause:r}),e)},[a]);return o.jsx(e.ErrorBoundary,{fallback:o.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:c,children:n})};
9
+ "use strict";var r=require("react"),e=require("react-error-boundary"),o=require("react/jsx-runtime");exports.LexicalErrorBoundary=function({children:n,onError:a}){const c=r.useCallback((r,e)=>{a(r instanceof Error?r:new Error(String(r),{cause:r}),e)},[a]);/*#__PURE__*/
10
+ return o.jsx(e.ErrorBoundary,{fallback:/*#__PURE__*/o.jsx("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:c,children:n})};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- import{useCallback as r}from"react";import{ErrorBoundary as o}from"react-error-boundary";import{jsx as n}from"react/jsx-runtime";function e({children:e,onError:t}){const i=r((r,o)=>{t(r instanceof Error?r:new Error(String(r),{cause:r}),o)},[t]);return n(o,{fallback:n("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:i,children:e})}export{e as LexicalErrorBoundary};
9
+ import{useCallback as r}from"react";import{ErrorBoundary as o}from"react-error-boundary";import{jsx as n}from"react/jsx-runtime";function e({children:e,onError:t}){const i=r((r,o)=>{t(r instanceof Error?r:new Error(String(r),{cause:r}),o)},[t]);/*#__PURE__*/
10
+ return n(o,{fallback:/*#__PURE__*/n("div",{style:{border:"1px solid #f00",color:"#f00",padding:"8px"},children:"An error was thrown."}),onError:i,children:e})}export{e as LexicalErrorBoundary};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/react/useExtensionComponent"),n=require("react/jsx-runtime");exports.ExtensionComponent=function({"lexical:extension":t,...o}){const r=e.useExtensionComponent(t);return n.jsx(r,{...o})};
9
+ "use strict";var e=require("@lexical/react/useExtensionComponent"),n=require("react/jsx-runtime");exports.ExtensionComponent=function({"lexical:extension":t,...o}){const r=e.useExtensionComponent(t);/*#__PURE__*/
10
+ return n.jsx(r,{...o})};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- import{useExtensionComponent as e}from"@lexical/react/useExtensionComponent";import{jsx as t}from"react/jsx-runtime";function n({"lexical:extension":n,...o}){const r=e(n);return t(r,{...o})}export{n as ExtensionComponent};
9
+ import{useExtensionComponent as e}from"@lexical/react/useExtensionComponent";import{jsx as t}from"react/jsx-runtime";function n({"lexical:extension":n,...o}){const r=e(n);/*#__PURE__*/
10
+ return t(r,{...o})}export{n as ExtensionComponent};
@@ -77,7 +77,7 @@ function LexicalExtensionComposer({
77
77
  contentEditable
78
78
  }) {
79
79
  const editor = react.useMemo(() => {
80
- const builder = extension.LexicalBuilder.fromExtensions([ReactProviderExtension.ReactProviderExtension, lexical.configExtension(ReactExtension.ReactExtension, contentEditable === undefined ? {} : {
80
+ const builder = extension.LexicalBuilder.fromExtensions([ReactProviderExtension.ReactProviderExtension, /* @__PURE__ */lexical.configExtension(ReactExtension.ReactExtension, contentEditable === undefined ? {} : {
81
81
  contentEditable
82
82
  }), extension$1]);
83
83
  return builder.buildEditor();
@@ -75,7 +75,7 @@ function LexicalExtensionComposer({
75
75
  contentEditable
76
76
  }) {
77
77
  const editor = useMemo(() => {
78
- const builder = LexicalBuilder.fromExtensions([ReactProviderExtension, configExtension(ReactExtension, contentEditable === undefined ? {} : {
78
+ const builder = LexicalBuilder.fromExtensions([ReactProviderExtension, /* @__PURE__ */configExtension(ReactExtension, contentEditable === undefined ? {} : {
79
79
  contentEditable
80
80
  }), extension]);
81
81
  return builder.buildEditor();
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/extension"),t=require("@lexical/react/ReactExtension"),i=require("@lexical/react/ReactProviderExtension"),n=require("lexical"),r=require("react"),o=require("react/jsx-runtime");exports.LexicalExtensionComposer=function({extension:c,children:s,contentEditable:x}){const a=r.useMemo(()=>e.LexicalBuilder.fromExtensions([i.ReactProviderExtension,n.configExtension(t.ReactExtension,void 0===x?{}:{contentEditable:x}),c]).buildEditor(),[x,c]);r.useEffect(()=>{let e=!1;return queueMicrotask(()=>{e=!0}),()=>{e&&a.dispose()}},[a]);const{Component:u}=e.getExtensionDependencyFromEditor(a,t.ReactExtension).output;return o.jsx(u,{children:s})};
9
+ "use strict";var e=require("@lexical/extension"),t=require("@lexical/react/ReactExtension"),i=require("@lexical/react/ReactProviderExtension"),n=require("lexical"),r=require("react"),o=require("react/jsx-runtime");exports.LexicalExtensionComposer=function({extension:c,children:s,contentEditable:x}){const a=r.useMemo(()=>e.LexicalBuilder.fromExtensions([i.ReactProviderExtension,/* @__PURE__ */n.configExtension(t.ReactExtension,void 0===x?{}:{contentEditable:x}),c]).buildEditor(),[x,c]);r.useEffect(()=>{let e=!1;return queueMicrotask(()=>{e=!0}),()=>{e&&a.dispose()}},[a]);const{Component:u}=e.getExtensionDependencyFromEditor(a,t.ReactExtension).output;/*#__PURE__*/
10
+ return o.jsx(u,{children:s})};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- import{LexicalBuilder as t,getExtensionDependencyFromEditor as e}from"@lexical/extension";import{ReactExtension as o}from"@lexical/react/ReactExtension";import{ReactProviderExtension as r}from"@lexical/react/ReactProviderExtension";import{configExtension as i}from"lexical";import{useMemo as n,useEffect as c}from"react";import{jsx as m}from"react/jsx-runtime";function l({extension:l,children:a,contentEditable:s}){const x=n(()=>t.fromExtensions([r,i(o,void 0===s?{}:{contentEditable:s}),l]).buildEditor(),[s,l]);c(()=>{let t=!1;return queueMicrotask(()=>{t=!0}),()=>{t&&x.dispose()}},[x]);const{Component:p}=e(x,o).output;return m(p,{children:a})}export{l as LexicalExtensionComposer};
9
+ import{LexicalBuilder as t,getExtensionDependencyFromEditor as e}from"@lexical/extension";import{ReactExtension as o}from"@lexical/react/ReactExtension";import{ReactProviderExtension as r}from"@lexical/react/ReactProviderExtension";import{configExtension as i}from"lexical";import{useMemo as n,useEffect as c}from"react";import{jsx as m}from"react/jsx-runtime";function l({extension:l,children:a,contentEditable:s}){const x=n(()=>t.fromExtensions([r,/* @__PURE__ */i(o,void 0===s?{}:{contentEditable:s}),l]).buildEditor(),[s,l]);c(()=>{let t=!1;return queueMicrotask(()=>{t=!0}),()=>{t&&x.dispose()}},[x]);const{Component:p}=e(x,o).output;/*#__PURE__*/
10
+ return m(p,{children:a})}export{l as LexicalExtensionComposer};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/extension"),t=require("@lexical/react/ReactExtension"),i=require("react/jsx-runtime");exports.LexicalExtensionEditorComposer=function({initialEditor:n,children:r}){const{Component:o}=e.getExtensionDependencyFromEditor(n,t.ReactExtension).output;return i.jsx(o,{children:r})};
9
+ "use strict";var e=require("@lexical/extension"),t=require("@lexical/react/ReactExtension"),i=require("react/jsx-runtime");exports.LexicalExtensionEditorComposer=function({initialEditor:n,children:r}){const{Component:o}=e.getExtensionDependencyFromEditor(n,t.ReactExtension).output;/*#__PURE__*/
10
+ return i.jsx(o,{children:r})};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- import{getExtensionDependencyFromEditor as t}from"@lexical/extension";import{ReactExtension as i}from"@lexical/react/ReactExtension";import{jsx as o}from"react/jsx-runtime";function r({initialEditor:r,children:e}){const{Component:n}=t(r,i).output;return o(n,{children:e})}export{r as LexicalExtensionEditorComposer};
9
+ import{getExtensionDependencyFromEditor as t}from"@lexical/extension";import{ReactExtension as i}from"@lexical/react/ReactExtension";import{jsx as o}from"react/jsx-runtime";function r({initialEditor:r,children:e}){const{Component:n}=t(r,i).output;/*#__PURE__*/
10
+ return o(n,{children:e})}export{r as LexicalExtensionEditorComposer};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/extension"),t=require("@lexical/react/LexicalComposerContext"),r=require("@lexical/react/useLexicalNodeSelection"),o=require("@lexical/utils"),n=require("lexical"),i=require("react"),l=require("react/jsx-runtime");function s({nodeKey:e}){const[l]=t.useLexicalComposerContext(),[s,a,c]=r.useLexicalNodeSelection(e);return i.useEffect(()=>o.mergeRegister(l.registerCommand(n.CLICK_COMMAND,t=>{const r=l.getElementByKey(e);return t.target===r&&(t.shiftKey||c(),a(!s),!0)},n.COMMAND_PRIORITY_LOW)),[c,l,s,e,a]),i.useEffect(()=>{const t=l.getElementByKey(e),r=l._config.theme.hrSelected??"selected";null!==t&&(s?o.addClassNamesToElement(t,r):o.removeClassNamesFromElement(t,r))},[l,s,e]),null}class a extends e.HorizontalRuleNode{static getType(){return"horizontalrule"}static clone(e){return new a(e.__key)}static importJSON(e){return u().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:c,priority:0})}}decorate(){return l.jsx(s,{nodeKey:this.__key})}}function c(){return{node:u()}}function u(){return n.$applyNodeReplacement(new a)}exports.$isHorizontalRuleNode=e.$isHorizontalRuleNode,exports.INSERT_HORIZONTAL_RULE_COMMAND=e.INSERT_HORIZONTAL_RULE_COMMAND,exports.$createHorizontalRuleNode=u,exports.HorizontalRuleNode=a;
9
+ "use strict";var e=require("@lexical/extension"),t=require("@lexical/react/LexicalComposerContext"),r=require("@lexical/react/useLexicalNodeSelection"),o=require("@lexical/utils"),n=require("lexical"),i=require("react"),l=require("react/jsx-runtime");function s({nodeKey:e}){const[l]=t.useLexicalComposerContext(),[s,a,c]=r.useLexicalNodeSelection(e);return i.useEffect(()=>o.mergeRegister(l.registerCommand(n.CLICK_COMMAND,t=>{const r=l.getElementByKey(e);return t.target===r&&(t.shiftKey||c(),a(!s),!0)},n.COMMAND_PRIORITY_LOW)),[c,l,s,e,a]),i.useEffect(()=>{const t=l.getElementByKey(e),r=l._config.theme.hrSelected??"selected";null!==t&&(s?o.addClassNamesToElement(t,r):o.removeClassNamesFromElement(t,r))},[l,s,e]),null}class a extends e.HorizontalRuleNode{static getType(){return"horizontalrule"}static clone(e){return new a(e.__key)}static importJSON(e){return u().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:c,priority:0})}}decorate(){/*#__PURE__*/
10
+ return l.jsx(s,{nodeKey:this.__key})}}function c(){return{node:u()}}function u(){return n.$applyNodeReplacement(new a)}exports.$isHorizontalRuleNode=e.$isHorizontalRuleNode,exports.INSERT_HORIZONTAL_RULE_COMMAND=e.INSERT_HORIZONTAL_RULE_COMMAND,exports.$createHorizontalRuleNode=u,exports.HorizontalRuleNode=a;
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- import{HorizontalRuleNode as e}from"@lexical/extension";export{$isHorizontalRuleNode,INSERT_HORIZONTAL_RULE_COMMAND}from"@lexical/extension";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as r}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as o,addClassNamesToElement as n,removeClassNamesFromElement as i}from"@lexical/utils";import{$applyNodeReplacement as l,CLICK_COMMAND as c,COMMAND_PRIORITY_LOW as a}from"lexical";import{useEffect as m}from"react";import{jsx as s}from"react/jsx-runtime";function u({nodeKey:e}){const[l]=t(),[s,u,p]=r(e);return m(()=>o(l.registerCommand(c,t=>{const r=l.getElementByKey(e);return t.target===r&&(t.shiftKey||p(),u(!s),!0)},a)),[p,l,s,e,u]),m(()=>{const t=l.getElementByKey(e),r=l._config.theme.hrSelected??"selected";null!==t&&(s?n(t,r):i(t,r))},[l,s,e]),null}class p extends e{static getType(){return"horizontalrule"}static clone(e){return new p(e.__key)}static importJSON(e){return f().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:x,priority:0})}}decorate(){return s(u,{nodeKey:this.__key})}}function x(){return{node:f()}}function f(){return l(new p)}export{f as $createHorizontalRuleNode,p as HorizontalRuleNode};
9
+ import{HorizontalRuleNode as e}from"@lexical/extension";export{$isHorizontalRuleNode,INSERT_HORIZONTAL_RULE_COMMAND}from"@lexical/extension";import{useLexicalComposerContext as t}from"@lexical/react/LexicalComposerContext";import{useLexicalNodeSelection as r}from"@lexical/react/useLexicalNodeSelection";import{mergeRegister as o,addClassNamesToElement as n,removeClassNamesFromElement as i}from"@lexical/utils";import{$applyNodeReplacement as l,CLICK_COMMAND as c,COMMAND_PRIORITY_LOW as a}from"lexical";import{useEffect as m}from"react";import{jsx as s}from"react/jsx-runtime";function u({nodeKey:e}){const[l]=t(),[s,u,p]=r(e);return m(()=>o(l.registerCommand(c,t=>{const r=l.getElementByKey(e);return t.target===r&&(t.shiftKey||p(),u(!s),!0)},a)),[p,l,s,e,u]),m(()=>{const t=l.getElementByKey(e),r=l._config.theme.hrSelected??"selected";null!==t&&(s?n(t,r):i(t,r))},[l,s,e]),null}class p extends e{static getType(){return"horizontalrule"}static clone(e){return new p(e.__key)}static importJSON(e){return f().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:x,priority:0})}}decorate(){/*#__PURE__*/
10
+ return s(u,{nodeKey:this.__key})}}function x(){return{node:f()}}function f(){return l(new p)}export{f as $createHorizontalRuleNode,p as HorizontalRuleNode};
@@ -6,4 +6,5 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("@lexical/react/LexicalCollaborationContext"),t=require("@lexical/react/LexicalComposerContext"),r=require("lexical"),o=require("react"),s=require("react/jsx-runtime");const a=()=>{},n=()=>{};exports.LexicalNestedComposer=function({initialEditor:i,children:l,initialNodes:c,initialTheme:d,skipCollabChecks:p,skipEditableListener:f}){const u=o.useRef(!1),m=o.useContext(t.LexicalComposerContext);null==m&&function(e,...t){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw r.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}(9);const[x,{getTheme:h}]=m,g=o.useMemo(()=>{const e=d||h()||void 0,o=t.createLexicalComposerContext(m,e);void 0!==e&&(i._config.theme=e),i._parentEditor=i._parentEditor||x;const s=i._createEditorArgs,l=s&&s.namespace;if(c){a(),l||(n(),i._config.namespace=x._config.namespace);for(let e of c){let t=null,o=null;if("function"!=typeof e){const r=e;e=r.replace,t=r.with,o=r.withKlass||null}const s=r.getRegisteredNode(i,e.getType());i._nodes.set(e.getType(),{exportDOM:s?s.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:o,sharedNodeState:r.createSharedNodeState(e),transforms:r.getTransformSetFromKlass(e)})}}else if(s&&s.nodes)l||(n(),i._config.namespace=x._config.namespace);else{const e=i._nodes=new Map(x._nodes);l||(i._config.namespace=x._config.namespace);for(const[t,o]of e)i._nodes.set(t,{exportDOM:o.exportDOM,klass:o.klass,replace:o.replace,replaceWithKlass:o.replaceWithKlass,sharedNodeState:r.createSharedNodeState(o.klass),transforms:r.getTransformSetFromKlass(o.klass)})}return[i,o]},[]),C=o.useContext(e.CollaborationContext),{isCollabActive:_,yjsDocMap:v}=C??{},E=p||u.current||v&&v.has(i.getKey());return o.useEffect(()=>{E&&(u.current=!0)},[E]),o.useEffect(()=>{if(!f){const e=e=>i.setEditable(e);return e(x.isEditable()),x.registerEditableListener(e)}},[i,x,f]),s.jsx(t.LexicalComposerContext.Provider,{value:g,children:!_||E?l:null})};
9
+ "use strict";var e=require("@lexical/react/LexicalCollaborationContext"),t=require("@lexical/react/LexicalComposerContext"),r=require("lexical"),o=require("react"),s=require("react/jsx-runtime");const a=()=>{},n=()=>{};exports.LexicalNestedComposer=function({initialEditor:i,children:l,initialNodes:c,initialTheme:d,skipCollabChecks:p,skipEditableListener:f}){const u=o.useRef(!1),m=o.useContext(t.LexicalComposerContext);null==m&&function(e,...t){const r=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw r.search=o.toString(),Error(`Minified Lexical error #${e}; visit ${r.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}
10
+ /*@__INLINE__*/(9);const[x,{getTheme:h}]=m,g=o.useMemo(()=>{const e=d||h()||void 0,o=t.createLexicalComposerContext(m,e);void 0!==e&&(i._config.theme=e),i._parentEditor=i._parentEditor||x;const s=i._createEditorArgs,l=s&&s.namespace;if(c){a(),l||(n(),i._config.namespace=x._config.namespace);for(let e of c){let t=null,o=null;if("function"!=typeof e){const r=e;e=r.replace,t=r.with,o=r.withKlass||null}const s=r.getRegisteredNode(i,e.getType());i._nodes.set(e.getType(),{exportDOM:s?s.exportDOM:void 0,klass:e,replace:t,replaceWithKlass:o,sharedNodeState:r.createSharedNodeState(e),transforms:r.getTransformSetFromKlass(e)})}}else if(s&&s.nodes)l||(n(),i._config.namespace=x._config.namespace);else{const e=i._nodes=new Map(x._nodes);l||(i._config.namespace=x._config.namespace);for(const[t,o]of e)i._nodes.set(t,{exportDOM:o.exportDOM,klass:o.klass,replace:o.replace,replaceWithKlass:o.replaceWithKlass,sharedNodeState:r.createSharedNodeState(o.klass),transforms:r.getTransformSetFromKlass(o.klass)})}return[i,o]},[]),C=o.useContext(e.CollaborationContext),{isCollabActive:_,yjsDocMap:v}=C??{},E=p||u.current||v&&v.has(i.getKey());return o.useEffect(()=>{E&&(u.current=!0)},[E]),o.useEffect(()=>{if(!f){const e=e=>i.setEditable(e);return e(x.isEditable()),x.registerEditableListener(e)}},[i,x,f]),/*#__PURE__*/s.jsx(t.LexicalComposerContext.Provider,{value:g,children:!_||E?l:null})};