@lexical/extension 0.45.0 → 0.45.1-nightly.20260529.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.
@@ -569,9 +569,9 @@ function formatDevErrorMessage(message) {
569
569
  *
570
570
  */
571
571
 
572
- // `"0.45.0+dev.cjs"` is statically replaced with the build-specific
572
+ // `"0.45.1-nightly.20260529.0+dev.cjs"` is statically replaced with the build-specific
573
573
  // version string in a Rollup build, and a consumer's bundler `define` can
574
- // inject it the same way — so the exact `"0.45.0+dev.cjs"` member
574
+ // inject it the same way — so the exact `"0.45.1-nightly.20260529.0+dev.cjs"` member
575
575
  // expression must be preserved for that substitution to match. Reading it
576
576
  // inside a try/catch lets the source be consumed directly (via the `source`
577
577
  // export condition) in a browser bundle, where `process` is undefined and
@@ -580,11 +580,11 @@ function formatDevErrorMessage(message) {
580
580
  // `pnpm run update-version`.
581
581
  let envLexicalVersion;
582
582
  try {
583
- envLexicalVersion = "0.45.0+dev.cjs";
583
+ envLexicalVersion = "0.45.1-nightly.20260529.0+dev.cjs";
584
584
  } catch (_unused) {
585
585
  // `process` is not defined in some browser bundles; use the fallback.
586
586
  }
587
- const LEXICAL_VERSION = envLexicalVersion ?? '0.45.0+source';
587
+ const LEXICAL_VERSION = envLexicalVersion ?? '0.45.1-nightly.20260529.0+source';
588
588
 
589
589
  /**
590
590
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -568,9 +568,9 @@ function formatDevErrorMessage(message) {
568
568
  *
569
569
  */
570
570
 
571
- // `"0.45.0+dev.esm"` is statically replaced with the build-specific
571
+ // `"0.45.1-nightly.20260529.0+dev.esm"` is statically replaced with the build-specific
572
572
  // version string in a Rollup build, and a consumer's bundler `define` can
573
- // inject it the same way — so the exact `"0.45.0+dev.esm"` member
573
+ // inject it the same way — so the exact `"0.45.1-nightly.20260529.0+dev.esm"` member
574
574
  // expression must be preserved for that substitution to match. Reading it
575
575
  // inside a try/catch lets the source be consumed directly (via the `source`
576
576
  // export condition) in a browser bundle, where `process` is undefined and
@@ -579,11 +579,11 @@ function formatDevErrorMessage(message) {
579
579
  // `pnpm run update-version`.
580
580
  let envLexicalVersion;
581
581
  try {
582
- envLexicalVersion = "0.45.0+dev.esm";
582
+ envLexicalVersion = "0.45.1-nightly.20260529.0+dev.esm";
583
583
  } catch (_unused) {
584
584
  // `process` is not defined in some browser bundles; use the fallback.
585
585
  }
586
- const LEXICAL_VERSION = envLexicalVersion ?? '0.45.0+source';
586
+ const LEXICAL_VERSION = envLexicalVersion ?? '0.45.1-nightly.20260529.0+source';
587
587
 
588
588
  /**
589
589
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- "use strict";var e=require("lexical"),t=require("@lexical/utils");const n=Symbol.for("preact-signals");function i(){if(d>1)return void d--;let e,t=!1;for(!function(){let e=c;for(c=void 0;void 0!==e;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();void 0!==r;){let n=r;for(r=void 0,l++;void 0!==n;){const i=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&E(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=i}}if(l=0,d--,t)throw e}function o(e){if(d>0)return e();f=++u,d++;try{return e()}finally{i()}}let s,r;function a(e){const t=s;s=void 0;try{return e()}finally{s=t}}let c,d=0,l=0,u=0,f=0,g=0;function h(e){if(void 0===s)return;let t=e.n;return void 0===t||t.t!==s?(t={i:0,S:e,p:s.s,n:void 0,t:s,e:void 0,x:void 0,r:t},void 0!==s.s&&(s.s.n=t),s.s=t,e.n=t,32&s.f&&e.S(t),t):-1===t.i?(t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=s.s,t.n=void 0,s.s.n=t,s.s=t),t):void 0}function p(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function m(e,t){return new p(e,t)}function E(e){for(let t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function x(e){for(let t=e.s;void 0!==t;t=t.n){const n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function S(e){let t,n=e.s;for(;void 0!==n;){const e=n.p;-1===n.i?(n.S.U(n),void 0!==e&&(e.n=n.n),void 0!==n.n&&(n.n.p=e)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=e}e.s=t}function v(e,t){p.call(this,void 0),this.x=e,this.s=void 0,this.g=g-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function y(e,t){return new v(e,t)}function N(e){const t=e.m;if(e.m=void 0,"function"==typeof t){d++;const n=s;s=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,b(e),t}finally{s=n,i()}}}function b(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,N(e)}function C(e){if(s!==this)throw new Error("Out-of-order effect");S(this),s=e,this.f&=-2,8&this.f&&b(this),i()}function O(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=null==t?void 0:t.name}function R(e,t){const n=new O(e,t);try{n.c()}catch(e){throw n.d(),e}const i=n.d.bind(n);return i[Symbol.dispose]=i,i}function $(e,t={}){const n={};for(const i in e){const o=t[i],s=m(void 0===o?e[i]:o);n[i]=s}return n}p.prototype.brand=n,p.prototype.h=function(){return!0},p.prototype.S=function(e){const t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:a(()=>{var e;null==(e=this.W)||e.call(this)}))},p.prototype.U=function(e){if(void 0!==this.t){const t=e.e,n=e.x;void 0!==t&&(t.x=n,e.e=void 0),void 0!==n&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&a(()=>{var e;null==(e=this.Z)||e.call(this)}))}},p.prototype.subscribe=function(e){return R(()=>{const t=this.value,n=s;s=void 0;try{e(t)}finally{s=n}},{name:"sub"})},p.prototype.valueOf=function(){return this.value},p.prototype.toString=function(){return this.value+""},p.prototype.toJSON=function(){return this.value},p.prototype.peek=function(){const e=s;s=void 0;try{return this.value}finally{s=e}},Object.defineProperty(p.prototype,"value",{get(){const e=h(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(l>100)throw new Error("Cycle detected");!function(e){0!==d&&0===l&&e.l!==f&&(e.l=f,c={S:e,v:e.v,i:e.i,o:c})}(this),this.v=e,this.i++,g++,d++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{i()}}}}),v.prototype=new p,v.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===g)return!0;if(this.g=g,this.f|=1,this.i>0&&!E(this))return this.f&=-2,!0;const e=s;try{x(this),s=this;const e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return s=e,S(this),this.f&=-2,!0},v.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(let e=this.s;void 0!==e;e=e.n)e.S.S(e)}p.prototype.S.call(this,e)},v.prototype.U=function(e){if(void 0!==this.t&&(p.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(let e=this.s;void 0!==e;e=e.n)e.S.U(e)}},v.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(v.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=h(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),O.prototype.c=function(){const e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const e=this.x();"function"==typeof e&&(this.m=e)}finally{e()}},O.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,N(this),x(this),d++;const e=s;return s=this,C.bind(this,e)},O.prototype.N=function(){2&this.f||(this.f|=2,this.u=r,r=this)},O.prototype.d=function(){this.f|=8,1&this.f||b(this)},O.prototype.dispose=function(){this.d()};const D=e.defineExtension({build:(e,t,n)=>$(t),config:e.safeCast({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){const i=n.getOutput();return R(()=>i.disabled.value?void 0:e.registerRootListener(t=>{e.focus(()=>{const e=document.activeElement;null===t||null!==e&&t.contains(e)||t.focus({preventScroll:!0})},{defaultSelection:i.defaultSelection.peek()})}))}});function w(){const t=e.$getRoot(),n=e.$getSelection(),i=e.$createParagraphNode();t.clear(),t.append(i),null!==n&&i.select(),e.$isRangeSelection(n)&&(n.format=0)}function I(t,n=w){return t.registerCommand(e.CLEAR_EDITOR_COMMAND,e=>(t.update(n),!0),e.COMMAND_PRIORITY_EDITOR)}const M=e.defineExtension({build:(e,t,n)=>$(t),config:e.safeCast({$onClear:w}),name:"@lexical/extension/ClearEditor",register(e,t,n){const{$onClear:i}=n.getOutput();return R(()=>I(e,i.value))}});function _(t){return!!e.$isDecoratorNode(t)||!(!e.$isElementNode(t)||!t.isShadowRoot())}function T(t,n,i,o){return!!t.isEditable()&&(i.target===n&&t.getEditorState().read(()=>{const n=e.$getRoot().getLastChild();if(null===n)return!1;const s=t.getElementByKey(n.getKey());return null!==s&&(!(i.clientY<=s.getBoundingClientRect().bottom)&&o(n))},{editor:t}))}const A=e.defineExtension({build:(e,t)=>$(t),config:e.safeCast({$shouldInsertAfter:_,disabled:!1}),name:"@lexical/ClickAfterLastBlock",register:(t,n,i)=>R(()=>{const n=i.getOutput();if(!n.disabled.value)return t.registerRootListener(i=>{if(null===i)return;const o=e=>{T(t,i,e,n.$shouldInsertAfter.peek())&&e.preventDefault()},s=o=>{T(t,i,o,n.$shouldInsertAfter.peek())&&(o.preventDefault(),e.stopLexicalPropagation(o),t.update(()=>{const t=e.$getRoot().getLastChild();if(null===t)return;if(!n.$shouldInsertAfter.peek()(t))return;const i=e.$createParagraphNode();t.insertAfter(i),i.select()}))};return i.addEventListener("mousedown",o,!0),i.addEventListener("click",s,!0),()=>{i.removeEventListener("mousedown",o,!0),i.removeEventListener("click",s,!0)}})})});function F(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}const P=e.createState("format",{parse:e=>"number"==typeof e?e:0});class L extends e.DecoratorNode{$config(){return this.config("decorator-text",{extends:e.DecoratorNode,stateConfigs:[{flat:!0,stateConfig:P}]})}getFormat(){return e.$getState(this,P)}getFormatFlags(t,n){return e.toggleTextFormatType(this.getFormat(),t,n)}hasFormat(t){const n=e.TEXT_TYPE_TO_FORMAT[t];return 0!==(this.getFormat()&n)}setFormat(t){return e.$setState(this,P,t)}toggleFormat(t){const n=this.getFormat(),i=e.toggleTextFormatType(n,t,null);return this.setFormat(i)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}}function k(e){return e instanceof L}function K(e,t){const n=document.createElement(t);return n.appendChild(e),n}const z={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},j=e.defineExtension({name:"@lexical/extension/DecoratorText",nodes:()=>[L],register:(t,n,i)=>t.registerCommand(e.FORMAT_TEXT_COMMAND,t=>{const n=e.$getSelection();if(e.$isNodeSelection(n)||e.$isRangeSelection(n))for(const e of n.getNodes())k(e)&&e.toggleFormat(t);return!1},e.COMMAND_PRIORITY_LOW)});function B(e,t){let n;return m(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}const U=e.defineExtension({build:e=>B(()=>e.getEditorState(),t=>e.registerUpdateListener(e=>{t.value=e.editorState})),name:"@lexical/extension/EditorState"});function Y(e,...t){const n=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",e);for(const e of t)i.append("v",e);throw n.search=i.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.`)}let G;try{G="0.45.0+prod.cjs"}catch(e){}const H=G??"0.45.0+source";function W(e,t){if(e&&t&&!Array.isArray(t)&&"object"==typeof e&&"object"==typeof t){const n=e,i=t;for(const e in i)n[e]=W(n[e],i[e]);return e}return t}const V=0,Z=1,J=2,X=3,q=4,Q=5,ee=6,te=7;function ne(e){return e.id===V}function ie(e){return e.id===J}function oe(e){return function(e){return e.id===Z}(e)||Y(305,String(e.id),String(Z)),Object.assign(e,{id:J})}const se=new Set;class re{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:V}}mergeConfigs(){let t=this.extension.config||{};const n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):e.shallowMergeConfig;for(const e of this.configs)t=n(t,e);return t}init(e){const t=this.state;ie(t)||Y(306,String(t.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},i={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},o=function(e,t,n){return Object.assign(e,{config:t,id:X,registerState:n})}(t,this.mergeConfigs(),n);let s;this.state=o,this.extension.init&&(s=this.extension.init(e,o.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:q,initResult:t,registerState:n})}(o,s,i)}build(e){const t=this.state;let n;t.id!==q&&Y(307,String(t.id),String(Q)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));const i={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:Q,output:t,registerState:n})}(t,n,i)}register(e,t){this._signal=t;const n=this.state;n.id!==Q&&Y(308,String(n.id),String(Q));const i=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:ee})}(n),()=>{const e=this.state;e.id!==te&&Y(309,String(n.id),String(te)),this.state=function(e){return Object.assign(e,{id:Q})}(e),i&&i()}}afterRegistration(e){const t=this.state;let n;return t.id!==ee&&Y(310,String(t.id),String(ee)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:te})}(t),n}getSignal(){return void 0===this._signal&&Y(311),this._signal}getInitResult(){void 0===this.extension.init&&Y(312,this.extension.name);const e=this.state;return function(e){return e.id>=q}(e)||Y(313,String(e.id),String(q)),e.initResult}getInitPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return function(e){return e.id>=X}(e)||Y(314,String(e.id),String(X)),{config:e.config}}getPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Y(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Y(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(e){return e.id>=te}(e)||Y(316,String(e.id),String(te)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||se}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(e){return e.id>=Q})(e)||Y(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}}const ae={tag:e.HISTORY_MERGE_TAG};function ce(){const t=e.$getRoot();t.isEmpty()&&t.append(e.$createParagraphNode())}const de=e.defineExtension({config:e.safeCast({setOptions:ae,updateOptions:ae}),init:({$initialEditorState:e=ce})=>({$initialEditorState:e,initialized:!1}),afterRegistration(t,{updateOptions:n,setOptions:i},o){const s=o.getInitResult();if(!s.initialized){s.initialized=!0;const{$initialEditorState:o}=s;if(e.$isEditorState(o))t.setEditorState(o,i);else if("function"==typeof o)t.update(()=>{o(t)},n);else if(o&&("string"==typeof o||"object"==typeof o)){const e=t.parseEditorState(o);t.setEditorState(e,i)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[e.RootNode,e.TextNode,e.LineBreakNode,e.TabNode,e.ParagraphNode]}),le=Symbol.for("@lexical/extension/LexicalBuilder");function ue(){}function fe(e){throw e}function ge(e){return Array.isArray(e)?e:[e]}const he=H;class pe{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=he,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[ge(de)];for(const n of e)t.push(ge(n));return new pe(t)}static maybeFromEditor(e){const t=e[le];return t&&(t.PACKAGE_VERSION!==he&&Y(292,t.PACKAGE_VERSION,he),t instanceof pe||Y(293)),t}static fromEditor(e){const t=pe.maybeFromEditor(e);return void 0===t&&Y(294),t}constructEditor(){const{$initialEditorState:t,onError:n,...i}=this.buildCreateEditorArgs(),o=Object.assign(e.createEditor({...i,...n?{onError:e=>{n(e,o)}}:{}}),{[le]:this});for(const e of this.sortedExtensionReps())e.build(o);return o}buildEditor(){let t=ue;function n(){try{t()}finally{t=ue}}const i=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=e.mergeRegister(this.registerEditor(i),()=>i.setRootElement(null)),i}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&Y(295,e.name),t}addEdge(e,t,n){const i=this.outgoingConfigEdges.get(e);i?i.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));const o=this.incomingEdges.get(t);o?o.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&Y(296);const t=ge(e),[n]=t;"string"!=typeof n.name&&Y(297,typeof n.name);let i=this.extensionNameMap.get(n.name);if(void 0!==i&&i.extension!==n&&Y(298,n.name),!i){i=new re(this,n),this.extensionNameMap.set(n.name,i);const e=this.conflicts.get(n.name);"string"==typeof e&&Y(299,n.name,e);for(const e of n.conflictsWith||[])this.extensionNameMap.has(e)&&Y(299,n.name,e),this.conflicts.set(e,n.name);for(const e of n.dependencies||[]){const t=ge(e);this.addEdge(n.name,t[0].name,t.slice(1)),this.addExtension(t)}for(const[e,t]of n.peerDependencies||[])this.addEdge(n.name,e,t?[t]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(n,i)=>{let o=n.state;if(ie(o))return;const s=n.extension.name;var r;ne(o)||Y(300,s,i||"[unknown]"),ne(r=o)||Y(304,String(r.id),String(V)),o=Object.assign(r,{id:Z}),n.state=o;const a=this.outgoingConfigEdges.get(s);if(a)for(const e of a.keys()){const n=this.extensionNameMap.get(e);n&&t(n,s)}o=oe(o),n.state=o,e.push(n)};for(const e of this.extensionNameMap.values())ne(e.state)&&t(e);for(const t of e)for(const[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){const t=this.extensionNameMap.get(e);if(t)for(const e of n)t.configs.add(e)}for(const[e,...t]of this.roots)if(t.length>0){const n=this.extensionNameMap.get(e.name);void 0===n&&Y(301,e.name);for(const e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(t){const n=this.sortedExtensionReps(),i=new AbortController,o=[()=>i.abort()],s=i.signal;for(const e of n){const n=e.register(t,s);n&&o.push(n)}for(const e of n){const n=e.afterRegistration(t);n&&o.push(n)}return e.mergeRegister(...o)}buildCreateEditorArgs(){const e={},t=new Set,n=new Map,i=new Map,o={},s={},r=this.sortedExtensionReps();for(const a of r){const{extension:r}=a;if(void 0!==r.onError&&(e.onError=r.onError),void 0!==r.disableEvents&&(e.disableEvents=r.disableEvents),void 0!==r.parentEditor&&(e.parentEditor=r.parentEditor),void 0!==r.editable&&(e.editable=r.editable),void 0!==r.namespace&&(e.namespace=r.namespace),void 0!==r.$initialEditorState&&(e.$initialEditorState=r.$initialEditorState),r.nodes)for(const e of F(r)){if("function"!=typeof e){const t=n.get(e.replace);t&&Y(302,r.name,e.replace.name,t.extension.name),n.set(e.replace,a)}t.add(e)}if(r.html){if(r.html.export)for(const[e,t]of r.html.export.entries())i.set(e,t);r.html.import&&Object.assign(o,r.html.import)}r.theme&&W(s,r.theme)}Object.keys(s).length>0&&(e.theme=s),t.size&&(e.nodes=[...t]);const a=Object.keys(o).length>0,c=i.size>0;(a||c)&&(e.html={},a&&(e.html.import=o),c&&(e.html.export=i));for(const t of r)t.init(e);return e.onError||(e.onError=fe),e}}function me(e,t){const n=pe.fromEditor(e).getExtensionRep(t);return void 0===n&&Y(303,t.name),n.getExtensionDependency()}function Ee(e,t){const n=pe.maybeFromEditor(e);if(!n)return;const i=n.extensionNameMap.get(t);return i?i.getExtensionDependency():void 0}function xe(t){return me(e.$getEditor(),t)}const Se=new Set,ve=e.defineExtension({build(t,n,i){const o=i.getDependency(U).output,s=m({watchedNodeKeys:new Map}),r=B(()=>{},()=>R(()=>{const t=r.peek(),{watchedNodeKeys:n}=s.value;let i,a=!1;o.value.read(()=>{if(e.$getSelection())for(const[o,s]of n.entries()){if(0===s.size){n.delete(o);continue}const r=e.$getNodeByKey(o),c=r&&r.isSelected()||!1;a=a||c!==(!!t&&t.has(o)),c&&(i=i||new Set,i.add(o))}}),!a&&i&&t&&i.size===t.size||(r.value=i)}));return{watchNodeKey:function(e){const t=y(()=>(r.value||Se).has(e)),{watchedNodeKeys:n}=s.peek();let i=n.get(e);const o=void 0!==i;return i=i||new Set,i.add(t),o||(n.set(e,i),s.value={watchedNodeKeys:n}),t}}},dependencies:[U],name:"@lexical/extension/NodeSelection"}),ye=e.createCommand("INSERT_HORIZONTAL_RULE_COMMAND");class Ne extends e.DecoratorNode{static getType(){return"horizontalrule"}static clone(e){return new Ne(e.__key)}static importJSON(e){return Ce().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:be,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){const n=document.createElement("hr");return e.addClassNamesToElement(n,t.theme.hr),n}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function be(){return{node:Ce()}}function Ce(){return e.$create(Ne)}function Oe(e){return e instanceof Ne}const Re=e.defineExtension({dependencies:[U,ve],name:"@lexical/extension/HorizontalRule",nodes:()=>[Ne],register(n,i,s){const{watchNodeKey:r}=s.getDependency(ve).output,a=m({nodeSelections:new Map}),c=n._config.theme.hrSelected??"selected";return e.mergeRegister(n.registerCommand(ye,n=>{const i=e.$getSelection();if(!e.$isRangeSelection(i))return!1;if(null!==i.focus.getNode()){const e=Ce();t.$insertNodeToNearestRoot(e)}return!0},e.COMMAND_PRIORITY_EDITOR),n.registerCommand(e.CLICK_COMMAND,t=>{if(e.isDOMNode(t.target)){const n=e.$getNodeFromDOMNode(t.target);if(Oe(n))return function(t,n=!1){const i=e.$getSelection(),o=t.isSelected(),s=t.getKey();let r;n&&e.$isNodeSelection(i)?r=i:(r=e.$createNodeSelection(),e.$setSelection(r)),o?r.delete(s):r.add(s)}(n,t.shiftKey),!0}return!1},e.COMMAND_PRIORITY_LOW),n.registerMutationListener(Ne,(e,t)=>{o(()=>{let t=!1;const{nodeSelections:i}=a.peek();for(const[o,s]of e.entries())if("destroyed"===s)i.delete(o),t=!0;else{const e=i.get(o),s=n.getElementByKey(o);e?e.domNode.value=s:(t=!0,i.set(o,{domNode:m(s),selectedSignal:r(o)}))}t&&(a.value={nodeSelections:i})})}),R(()=>{const t=[];for(const{domNode:n,selectedSignal:i}of a.value.nodeSelections.values())t.push(R(()=>{const t=n.value;if(t){i.value?e.addClassNamesToElement(t,c):e.removeClassNamesFromElement(t,c)}}));return e.mergeRegister(...t)}))}});const $e=e.defineExtension({build:(e,t)=>$({inheritEditableFromParent:t.inheritEditableFromParent}),config:e.safeCast({$getParentEditor:function(){const t=e.$getEditor();return pe.fromEditor(t),t},inheritEditableFromParent:!1}),init:(e,t,n)=>{const i=t.$getParentEditor();e.parentEditor=i,e.theme=e.theme||i._config.theme},name:"@lexical/extension/NestedEditor",register:(e,t,n)=>R(()=>{const t=e._parentEditor;if(t&&n.getOutput().inheritEditableFromParent.value)return e.setEditable(t.isEditable()),t.registerEditableListener(e.setEditable.bind(e))})});function De(t){e.$isElementNode(t)&&t.isInline()&&t.isEmpty()&&t.remove()}const we=e.defineExtension({build:(e,t,n)=>$(t),config:e.safeCast({disabled:!1}),name:"@lexical/NormalizeInlineElements",register:(t,n,i)=>{const o=i.getOutput();return R(()=>{if(!o.disabled.value){const n=[];for(const{klass:i,transforms:o}of t._nodes.values())i.prototype instanceof e.ElementNode&&i.prototype.isInline!==e.ElementNode.prototype.isInline&&(o.add(De),n.push(()=>o.delete(De)));return()=>n.forEach(e=>e())}})}}),Ie=new Set([e.SKIP_SELECTION_FOCUS_TAG,e.SKIP_SCROLL_INTO_VIEW_TAG]);const Me=e.defineExtension({build:(e,t,n)=>$(t),config:e.safeCast({$fixFocusOverselection:function(){const t=e.$getSelection();if(e.$isRangeSelection(t)&&!t.isCollapsed()){const n=e.$getCaretRangeInDirection(e.$caretRangeFromSelection(t),"next");let i=n.focus;for(e.$isTextPointCaret(i)&&n.anchor.origin!==i.origin&&0===i.offset&&(i=e.$rewindSiblingCaret(i.getSiblingCaret())),e.$isSiblingCaret(i)&&n.anchor.origin!==i.origin&&e.$isLineBreakNode(i.origin)&&(i=e.$rewindSiblingCaret(i));e.$isChildCaret(i)&&n.anchor.origin!==i.origin;)i=e.$rewindSiblingCaret(e.$getSiblingCaret(i.origin,"next"));if(e.$isSiblingCaret(i)&&e.$isElementNode(i.origin)&&(i=e.$normalizeCaret(e.$getChildCaret(i.origin,"previous")).getFlipped()),i=e.$normalizeCaret(i),!i.isSamePointCaret(n.focus)){const t=e.$setSelectionFromCaretRange(e.$getCaretRange(n.anchor,i)),o=e.$getEditor().getRootElement(),s=o&&e.getDOMSelection(o.ownerDocument.defaultView);s&&e.$updateDOMSelection(e.$getPreviousSelection(),t,e.$getEditor(),s,Ie,o)}}},dateNow:Date.now,disabled:!1,thresholdMsec:100}),name:"@lexical/NormalizeTripleClickSelection",register:(t,n,i)=>R(()=>{const n=i.getOutput();if(!n.disabled.value)return t.registerRootListener(i=>{if(!i)return;let o=0;const s=e=>{if(e?3===e.detail:o>0){const t=n.dateNow.peek()();o=e&&"mousedown"===e.type||t-o<=n.thresholdMsec.peek()?t:0}return o};return e.mergeRegister(t.registerCommand(e.SELECTION_CHANGE_COMMAND,()=>(s(null)&&(o=0,n.$fixFocusOverselection.peek()()),!1),e.COMMAND_PRIORITY_BEFORE_CRITICAL),(()=>{const e=["mouseup","mousedown"];return e.forEach(e=>i.addEventListener(e,s,!0)),()=>e.forEach(e=>i.removeEventListener(e,s,!0))})())})})}),_e=e.defineExtension({build:(e,t,n)=>$(t),config:e.safeCast({disabled:!1,onReposition:void 0}),name:"@lexical/utils/SelectionAlwaysOnDisplay",register:(e,n,i)=>{const o=i.getOutput();return R(()=>{if(!o.disabled.value)return t.selectionAlwaysOnDisplay(e,o.onReposition.value)})}});function Te(e){return e.canIndent()}function Ae(n,i,o=Te){return e.mergeRegister(n.registerCommand(e.KEY_TAB_COMMAND,i=>{const o=e.$getSelection();if(!e.$isRangeSelection(o))return!1;i.preventDefault();const s=function(n){if(n.getNodes().filter(t=>e.$isBlockElementNode(t)&&t.canIndent()).length>0)return!0;const i=n.anchor,o=n.focus,s=o.isBefore(i)?o:i,r=s.getNode(),a=t.$getNearestBlockElementAncestorOrThrow(r);if(a.canIndent()){const t=a.getKey();let n=e.$createRangeSelection();if(n.anchor.set(t,0,"element"),n.focus.set(t,0,"element"),n=e.$normalizeSelection__EXPERIMENTAL(n),n.anchor.is(s))return!0}return!1}(o)?i.shiftKey?e.OUTDENT_CONTENT_COMMAND:e.INDENT_CONTENT_COMMAND:e.INSERT_TAB_COMMAND;return n.dispatchCommand(s,void 0)},e.COMMAND_PRIORITY_EDITOR),n.registerCommand(e.INDENT_CONTENT_COMMAND,()=>{const n="number"==typeof i?i:i?i.peek():null,s=e.$getSelection();if(!e.$isRangeSelection(s))return!1;const r="function"==typeof o?o:o.peek();return t.$handleIndentAndOutdent(e=>{if(r(e)){const t=e.getIndent()+1;(!n||t<n)&&e.setIndent(t)}})},e.COMMAND_PRIORITY_CRITICAL))}const Fe=e.defineExtension({build:(e,t,n)=>$(t),config:e.safeCast({$canIndent:Te,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){const{disabled:i,maxIndent:o,$canIndent:s}=n.getOutput();return R(()=>{if(!i.value)return Ae(e,o,s)})}});exports.configExtension=e.configExtension,exports.declarePeerDependency=e.declarePeerDependency,exports.defineExtension=e.defineExtension,exports.safeCast=e.safeCast,exports.shallowMergeConfig=e.shallowMergeConfig,exports.$createHorizontalRuleNode=Ce,exports.$defaultShouldInsertAfter=_,exports.$getExtensionDependency=xe,exports.$getExtensionOutput=function(e){return xe(e).output},exports.$getPeerDependency=function(t){return Ee(e.$getEditor(),t)},exports.$isDecoratorTextNode=k,exports.$isHorizontalRuleNode=Oe,exports.AutoFocusExtension=D,exports.ClearEditorExtension=M,exports.ClickAfterLastBlockExtension=A,exports.DecoratorTextExtension=j,exports.DecoratorTextNode=L,exports.EditorStateExtension=U,exports.HorizontalRuleExtension=Re,exports.HorizontalRuleNode=Ne,exports.INSERT_HORIZONTAL_RULE_COMMAND=ye,exports.InitialStateExtension=de,exports.LexicalBuilder=pe,exports.NestedEditorExtension=$e,exports.NodeSelectionExtension=ve,exports.NormalizeInlineElementsExtension=we,exports.NormalizeTripleClickSelectionExtension=Me,exports.SelectionAlwaysOnDisplayExtension=_e,exports.TabIndentationExtension=Fe,exports.applyFormatFromStyle=function(e,t,n){const i=t.fontWeight,o=t.textDecoration.split(" "),s="700"===i||"bold"===i,r=o.includes("line-through"),a="italic"===t.fontStyle,c=o.includes("underline"),d=t.verticalAlign;return s&&!e.hasFormat("bold")&&e.toggleFormat("bold"),r&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),a&&!e.hasFormat("italic")&&e.toggleFormat("italic"),c&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==d||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==d||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e},exports.applyFormatToDom=function(e,t,n=z){for(const[i,o]of Object.entries(n))e.hasFormat(o)&&(t=K(t,i));return t},exports.batch=o,exports.buildEditorFromExtensions=function(...e){return pe.fromExtensions(e).buildEditor()},exports.computed=y,exports.effect=R,exports.getExtensionDependencyFromEditor=me,exports.getKnownTypesAndNodes=function(t){const n=new Set,i=new Set;for(const o of F(t)){const t="function"==typeof o?o:o.replace;e.getStaticNodeConfig(t),n.add(t.getType()),i.add(t)}return{nodes:i,types:n}},exports.getPeerDependencyFromEditor=Ee,exports.getPeerDependencyFromEditorOrThrow=function(e,t){const n=Ee(e,t);return void 0===n&&Y(291,t),n},exports.namedSignals=$,exports.registerClearEditor=I,exports.registerTabIndentation=Ae,exports.signal=m,exports.untracked=a,exports.watchedSignal=B;
9
+ "use strict";var e=require("lexical"),t=require("@lexical/utils");const n=Symbol.for("preact-signals");function i(){if(d>1)return void d--;let e,t=!1;for(!function(){let e=c;for(c=void 0;void 0!==e;)e.S.v===e.v&&(e.S.i=e.i),e=e.o}();void 0!==r;){let n=r;for(r=void 0,l++;void 0!==n;){const i=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&E(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=i}}if(l=0,d--,t)throw e}function o(e){if(d>0)return e();f=++u,d++;try{return e()}finally{i()}}let s,r;function a(e){const t=s;s=void 0;try{return e()}finally{s=t}}let c,d=0,l=0,u=0,f=0,g=0;function h(e){if(void 0===s)return;let t=e.n;return void 0===t||t.t!==s?(t={i:0,S:e,p:s.s,n:void 0,t:s,e:void 0,x:void 0,r:t},void 0!==s.s&&(s.s.n=t),s.s=t,e.n=t,32&s.f&&e.S(t),t):-1===t.i?(t.i=0,void 0!==t.n&&(t.n.p=t.p,void 0!==t.p&&(t.p.n=t.n),t.p=s.s,t.n=void 0,s.s.n=t,s.s=t),t):void 0}function p(e,t){this.v=e,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function m(e,t){return new p(e,t)}function E(e){for(let t=e.s;void 0!==t;t=t.n)if(t.S.i!==t.i||!t.S.h()||t.S.i!==t.i)return!0;return!1}function x(e){for(let t=e.s;void 0!==t;t=t.n){const n=t.S.n;if(void 0!==n&&(t.r=n),t.S.n=t,t.i=-1,void 0===t.n){e.s=t;break}}}function S(e){let t,n=e.s;for(;void 0!==n;){const e=n.p;-1===n.i?(n.S.U(n),void 0!==e&&(e.n=n.n),void 0!==n.n&&(n.n.p=e)):t=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=e}e.s=t}function v(e,t){p.call(this,void 0),this.x=e,this.s=void 0,this.g=g-1,this.f=4,this.W=null==t?void 0:t.watched,this.Z=null==t?void 0:t.unwatched,this.name=null==t?void 0:t.name}function y(e,t){return new v(e,t)}function N(e){const t=e.m;if(e.m=void 0,"function"==typeof t){d++;const n=s;s=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,b(e),t}finally{s=n,i()}}}function b(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,N(e)}function C(e){if(s!==this)throw new Error("Out-of-order effect");S(this),s=e,this.f&=-2,8&this.f&&b(this),i()}function O(e,t){this.x=e,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=null==t?void 0:t.name}function R(e,t){const n=new O(e,t);try{n.c()}catch(e){throw n.d(),e}const i=n.d.bind(n);return i[Symbol.dispose]=i,i}function $(e,t={}){const n={};for(const i in e){const o=t[i],s=m(void 0===o?e[i]:o);n[i]=s}return n}p.prototype.brand=n,p.prototype.h=function(){return!0},p.prototype.S=function(e){const t=this.t;t!==e&&void 0===e.e&&(e.x=t,this.t=e,void 0!==t?t.e=e:a(()=>{var e;null==(e=this.W)||e.call(this)}))},p.prototype.U=function(e){if(void 0!==this.t){const t=e.e,n=e.x;void 0!==t&&(t.x=n,e.e=void 0),void 0!==n&&(n.e=t,e.x=void 0),e===this.t&&(this.t=n,void 0===n&&a(()=>{var e;null==(e=this.Z)||e.call(this)}))}},p.prototype.subscribe=function(e){return R(()=>{const t=this.value,n=s;s=void 0;try{e(t)}finally{s=n}},{name:"sub"})},p.prototype.valueOf=function(){return this.value},p.prototype.toString=function(){return this.value+""},p.prototype.toJSON=function(){return this.value},p.prototype.peek=function(){const e=s;s=void 0;try{return this.value}finally{s=e}},Object.defineProperty(p.prototype,"value",{get(){const e=h(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(l>100)throw new Error("Cycle detected");!function(e){0!==d&&0===l&&e.l!==f&&(e.l=f,c={S:e,v:e.v,i:e.i,o:c})}(this),this.v=e,this.i++,g++,d++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{i()}}}}),v.prototype=new p,v.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===g)return!0;if(this.g=g,this.f|=1,this.i>0&&!E(this))return this.f&=-2,!0;const e=s;try{x(this),s=this;const e=this.x();(16&this.f||this.v!==e||0===this.i)&&(this.v=e,this.f&=-17,this.i++)}catch(e){this.v=e,this.f|=16,this.i++}return s=e,S(this),this.f&=-2,!0},v.prototype.S=function(e){if(void 0===this.t){this.f|=36;for(let e=this.s;void 0!==e;e=e.n)e.S.S(e)}p.prototype.S.call(this,e)},v.prototype.U=function(e){if(void 0!==this.t&&(p.prototype.U.call(this,e),void 0===this.t)){this.f&=-33;for(let e=this.s;void 0!==e;e=e.n)e.S.U(e)}},v.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let e=this.t;void 0!==e;e=e.x)e.t.N()}},Object.defineProperty(v.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=h(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),O.prototype.c=function(){const e=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const e=this.x();"function"==typeof e&&(this.m=e)}finally{e()}},O.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,N(this),x(this),d++;const e=s;return s=this,C.bind(this,e)},O.prototype.N=function(){2&this.f||(this.f|=2,this.u=r,r=this)},O.prototype.d=function(){this.f|=8,1&this.f||b(this)},O.prototype.dispose=function(){this.d()};const D=e.defineExtension({build:(e,t,n)=>$(t),config:e.safeCast({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(e,t,n){const i=n.getOutput();return R(()=>i.disabled.value?void 0:e.registerRootListener(t=>{e.focus(()=>{const e=document.activeElement;null===t||null!==e&&t.contains(e)||t.focus({preventScroll:!0})},{defaultSelection:i.defaultSelection.peek()})}))}});function w(){const t=e.$getRoot(),n=e.$getSelection(),i=e.$createParagraphNode();t.clear(),t.append(i),null!==n&&i.select(),e.$isRangeSelection(n)&&(n.format=0)}function I(t,n=w){return t.registerCommand(e.CLEAR_EDITOR_COMMAND,e=>(t.update(n),!0),e.COMMAND_PRIORITY_EDITOR)}const M=e.defineExtension({build:(e,t,n)=>$(t),config:e.safeCast({$onClear:w}),name:"@lexical/extension/ClearEditor",register(e,t,n){const{$onClear:i}=n.getOutput();return R(()=>I(e,i.value))}});function _(t){return!!e.$isDecoratorNode(t)||!(!e.$isElementNode(t)||!t.isShadowRoot())}function T(t,n,i,o){return!!t.isEditable()&&(i.target===n&&t.getEditorState().read(()=>{const n=e.$getRoot().getLastChild();if(null===n)return!1;const s=t.getElementByKey(n.getKey());return null!==s&&(!(i.clientY<=s.getBoundingClientRect().bottom)&&o(n))},{editor:t}))}const A=e.defineExtension({build:(e,t)=>$(t),config:e.safeCast({$shouldInsertAfter:_,disabled:!1}),name:"@lexical/ClickAfterLastBlock",register:(t,n,i)=>R(()=>{const n=i.getOutput();if(!n.disabled.value)return t.registerRootListener(i=>{if(null===i)return;const o=e=>{T(t,i,e,n.$shouldInsertAfter.peek())&&e.preventDefault()},s=o=>{T(t,i,o,n.$shouldInsertAfter.peek())&&(o.preventDefault(),e.stopLexicalPropagation(o),t.update(()=>{const t=e.$getRoot().getLastChild();if(null===t)return;if(!n.$shouldInsertAfter.peek()(t))return;const i=e.$createParagraphNode();t.insertAfter(i),i.select()}))};return i.addEventListener("mousedown",o,!0),i.addEventListener("click",s,!0),()=>{i.removeEventListener("mousedown",o,!0),i.removeEventListener("click",s,!0)}})})});function F(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}const P=e.createState("format",{parse:e=>"number"==typeof e?e:0});class L extends e.DecoratorNode{$config(){return this.config("decorator-text",{extends:e.DecoratorNode,stateConfigs:[{flat:!0,stateConfig:P}]})}getFormat(){return e.$getState(this,P)}getFormatFlags(t,n){return e.toggleTextFormatType(this.getFormat(),t,n)}hasFormat(t){const n=e.TEXT_TYPE_TO_FORMAT[t];return 0!==(this.getFormat()&n)}setFormat(t){return e.$setState(this,P,t)}toggleFormat(t){const n=this.getFormat(),i=e.toggleTextFormatType(n,t,null);return this.setFormat(i)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}}function k(e){return e instanceof L}function K(e,t){const n=document.createElement(t);return n.appendChild(e),n}const z={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},j=e.defineExtension({name:"@lexical/extension/DecoratorText",nodes:()=>[L],register:(t,n,i)=>t.registerCommand(e.FORMAT_TEXT_COMMAND,t=>{const n=e.$getSelection();if(e.$isNodeSelection(n)||e.$isRangeSelection(n))for(const e of n.getNodes())k(e)&&e.toggleFormat(t);return!1},e.COMMAND_PRIORITY_LOW)});function B(e,t){let n;return m(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}const U=e.defineExtension({build:e=>B(()=>e.getEditorState(),t=>e.registerUpdateListener(e=>{t.value=e.editorState})),name:"@lexical/extension/EditorState"});function Y(e,...t){const n=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",e);for(const e of t)i.append("v",e);throw n.search=i.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.`)}let G;try{G="0.45.1-nightly.20260529.0+prod.cjs"}catch(e){}const H=G??"0.45.1-nightly.20260529.0+source";function W(e,t){if(e&&t&&!Array.isArray(t)&&"object"==typeof e&&"object"==typeof t){const n=e,i=t;for(const e in i)n[e]=W(n[e],i[e]);return e}return t}const V=0,Z=1,J=2,X=3,q=4,Q=5,ee=6,te=7;function ne(e){return e.id===V}function ie(e){return e.id===J}function oe(e){return function(e){return e.id===Z}(e)||Y(305,String(e.id),String(Z)),Object.assign(e,{id:J})}const se=new Set;class re{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:V}}mergeConfigs(){let t=this.extension.config||{};const n=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):e.shallowMergeConfig;for(const e of this.configs)t=n(t,e);return t}init(e){const t=this.state;ie(t)||Y(306,String(t.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},i={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},o=function(e,t,n){return Object.assign(e,{config:t,id:X,registerState:n})}(t,this.mergeConfigs(),n);let s;this.state=o,this.extension.init&&(s=this.extension.init(e,o.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:q,initResult:t,registerState:n})}(o,s,i)}build(e){const t=this.state;let n;t.id!==q&&Y(307,String(t.id),String(Q)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));const i={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:Q,output:t,registerState:n})}(t,n,i)}register(e,t){this._signal=t;const n=this.state;n.id!==Q&&Y(308,String(n.id),String(Q));const i=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:ee})}(n),()=>{const e=this.state;e.id!==te&&Y(309,String(n.id),String(te)),this.state=function(e){return Object.assign(e,{id:Q})}(e),i&&i()}}afterRegistration(e){const t=this.state;let n;return t.id!==ee&&Y(310,String(t.id),String(ee)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:te})}(t),n}getSignal(){return void 0===this._signal&&Y(311),this._signal}getInitResult(){void 0===this.extension.init&&Y(312,this.extension.name);const e=this.state;return function(e){return e.id>=q}(e)||Y(313,String(e.id),String(q)),e.initResult}getInitPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionInitDependency():void 0}getExtensionInitDependency(){const e=this.state;return function(e){return e.id>=X}(e)||Y(314,String(e.id),String(X)),{config:e.config}}getPeer(e){const t=this.builder.extensionNameMap.get(e);return t?t.getExtensionDependency():void 0}getInitDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Y(315,this.extension.name,e.name),t.getExtensionInitDependency()}getDependency(e){const t=this.builder.getExtensionRep(e);return void 0===t&&Y(315,this.extension.name,e.name),t.getExtensionDependency()}getState(){const e=this.state;return function(e){return e.id>=te}(e)||Y(316,String(e.id),String(te)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||se}getPeerNameSet(){let e=this._peerNameSet;return e||(e=new Set((this.extension.peerDependencies||[]).map(([e])=>e)),this._peerNameSet=e),e}getExtensionDependency(){if(!this._dependency){const e=this.state;(function(e){return e.id>=Q})(e)||Y(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}}const ae={tag:e.HISTORY_MERGE_TAG};function ce(){const t=e.$getRoot();t.isEmpty()&&t.append(e.$createParagraphNode())}const de=e.defineExtension({config:e.safeCast({setOptions:ae,updateOptions:ae}),init:({$initialEditorState:e=ce})=>({$initialEditorState:e,initialized:!1}),afterRegistration(t,{updateOptions:n,setOptions:i},o){const s=o.getInitResult();if(!s.initialized){s.initialized=!0;const{$initialEditorState:o}=s;if(e.$isEditorState(o))t.setEditorState(o,i);else if("function"==typeof o)t.update(()=>{o(t)},n);else if(o&&("string"==typeof o||"object"==typeof o)){const e=t.parseEditorState(o);t.setEditorState(e,i)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[e.RootNode,e.TextNode,e.LineBreakNode,e.TabNode,e.ParagraphNode]}),le=Symbol.for("@lexical/extension/LexicalBuilder");function ue(){}function fe(e){throw e}function ge(e){return Array.isArray(e)?e:[e]}const he=H;class pe{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(e){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=he,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[ge(de)];for(const n of e)t.push(ge(n));return new pe(t)}static maybeFromEditor(e){const t=e[le];return t&&(t.PACKAGE_VERSION!==he&&Y(292,t.PACKAGE_VERSION,he),t instanceof pe||Y(293)),t}static fromEditor(e){const t=pe.maybeFromEditor(e);return void 0===t&&Y(294),t}constructEditor(){const{$initialEditorState:t,onError:n,...i}=this.buildCreateEditorArgs(),o=Object.assign(e.createEditor({...i,...n?{onError:e=>{n(e,o)}}:{}}),{[le]:this});for(const e of this.sortedExtensionReps())e.build(o);return o}buildEditor(){let t=ue;function n(){try{t()}finally{t=ue}}const i=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=e.mergeRegister(this.registerEditor(i),()=>i.setRootElement(null)),i}hasExtensionByName(e){return this.extensionNameMap.has(e)}getExtensionRep(e){const t=this.extensionNameMap.get(e.name);if(t)return t.extension!==e&&Y(295,e.name),t}addEdge(e,t,n){const i=this.outgoingConfigEdges.get(e);i?i.set(t,n):this.outgoingConfigEdges.set(e,new Map([[t,n]]));const o=this.incomingEdges.get(t);o?o.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&Y(296);const t=ge(e),[n]=t;"string"!=typeof n.name&&Y(297,typeof n.name);let i=this.extensionNameMap.get(n.name);if(void 0!==i&&i.extension!==n&&Y(298,n.name),!i){i=new re(this,n),this.extensionNameMap.set(n.name,i);const e=this.conflicts.get(n.name);"string"==typeof e&&Y(299,n.name,e);for(const e of n.conflictsWith||[])this.extensionNameMap.has(e)&&Y(299,n.name,e),this.conflicts.set(e,n.name);for(const e of n.dependencies||[]){const t=ge(e);this.addEdge(n.name,t[0].name,t.slice(1)),this.addExtension(t)}for(const[e,t]of n.peerDependencies||[])this.addEdge(n.name,e,t?[t]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const e=[],t=(n,i)=>{let o=n.state;if(ie(o))return;const s=n.extension.name;var r;ne(o)||Y(300,s,i||"[unknown]"),ne(r=o)||Y(304,String(r.id),String(V)),o=Object.assign(r,{id:Z}),n.state=o;const a=this.outgoingConfigEdges.get(s);if(a)for(const e of a.keys()){const n=this.extensionNameMap.get(e);n&&t(n,s)}o=oe(o),n.state=o,e.push(n)};for(const e of this.extensionNameMap.values())ne(e.state)&&t(e);for(const t of e)for(const[e,n]of this.outgoingConfigEdges.get(t.extension.name)||[])if(n.length>0){const t=this.extensionNameMap.get(e);if(t)for(const e of n)t.configs.add(e)}for(const[e,...t]of this.roots)if(t.length>0){const n=this.extensionNameMap.get(e.name);void 0===n&&Y(301,e.name);for(const e of t)n.configs.add(e)}return this._sortedExtensionReps=e,this._sortedExtensionReps}registerEditor(t){const n=this.sortedExtensionReps(),i=new AbortController,o=[()=>i.abort()],s=i.signal;for(const e of n){const n=e.register(t,s);n&&o.push(n)}for(const e of n){const n=e.afterRegistration(t);n&&o.push(n)}return e.mergeRegister(...o)}buildCreateEditorArgs(){const e={},t=new Set,n=new Map,i=new Map,o={},s={},r=this.sortedExtensionReps();for(const a of r){const{extension:r}=a;if(void 0!==r.onError&&(e.onError=r.onError),void 0!==r.disableEvents&&(e.disableEvents=r.disableEvents),void 0!==r.parentEditor&&(e.parentEditor=r.parentEditor),void 0!==r.editable&&(e.editable=r.editable),void 0!==r.namespace&&(e.namespace=r.namespace),void 0!==r.$initialEditorState&&(e.$initialEditorState=r.$initialEditorState),r.nodes)for(const e of F(r)){if("function"!=typeof e){const t=n.get(e.replace);t&&Y(302,r.name,e.replace.name,t.extension.name),n.set(e.replace,a)}t.add(e)}if(r.html){if(r.html.export)for(const[e,t]of r.html.export.entries())i.set(e,t);r.html.import&&Object.assign(o,r.html.import)}r.theme&&W(s,r.theme)}Object.keys(s).length>0&&(e.theme=s),t.size&&(e.nodes=[...t]);const a=Object.keys(o).length>0,c=i.size>0;(a||c)&&(e.html={},a&&(e.html.import=o),c&&(e.html.export=i));for(const t of r)t.init(e);return e.onError||(e.onError=fe),e}}function me(e,t){const n=pe.fromEditor(e).getExtensionRep(t);return void 0===n&&Y(303,t.name),n.getExtensionDependency()}function Ee(e,t){const n=pe.maybeFromEditor(e);if(!n)return;const i=n.extensionNameMap.get(t);return i?i.getExtensionDependency():void 0}function xe(t){return me(e.$getEditor(),t)}const Se=new Set,ve=e.defineExtension({build(t,n,i){const o=i.getDependency(U).output,s=m({watchedNodeKeys:new Map}),r=B(()=>{},()=>R(()=>{const t=r.peek(),{watchedNodeKeys:n}=s.value;let i,a=!1;o.value.read(()=>{if(e.$getSelection())for(const[o,s]of n.entries()){if(0===s.size){n.delete(o);continue}const r=e.$getNodeByKey(o),c=r&&r.isSelected()||!1;a=a||c!==(!!t&&t.has(o)),c&&(i=i||new Set,i.add(o))}}),!a&&i&&t&&i.size===t.size||(r.value=i)}));return{watchNodeKey:function(e){const t=y(()=>(r.value||Se).has(e)),{watchedNodeKeys:n}=s.peek();let i=n.get(e);const o=void 0!==i;return i=i||new Set,i.add(t),o||(n.set(e,i),s.value={watchedNodeKeys:n}),t}}},dependencies:[U],name:"@lexical/extension/NodeSelection"}),ye=e.createCommand("INSERT_HORIZONTAL_RULE_COMMAND");class Ne extends e.DecoratorNode{static getType(){return"horizontalrule"}static clone(e){return new Ne(e.__key)}static importJSON(e){return Ce().updateFromJSON(e)}static importDOM(){return{hr:()=>({conversion:be,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){const n=document.createElement("hr");return e.addClassNamesToElement(n,t.theme.hr),n}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function be(){return{node:Ce()}}function Ce(){return e.$create(Ne)}function Oe(e){return e instanceof Ne}const Re=e.defineExtension({dependencies:[U,ve],name:"@lexical/extension/HorizontalRule",nodes:()=>[Ne],register(n,i,s){const{watchNodeKey:r}=s.getDependency(ve).output,a=m({nodeSelections:new Map}),c=n._config.theme.hrSelected??"selected";return e.mergeRegister(n.registerCommand(ye,n=>{const i=e.$getSelection();if(!e.$isRangeSelection(i))return!1;if(null!==i.focus.getNode()){const e=Ce();t.$insertNodeToNearestRoot(e)}return!0},e.COMMAND_PRIORITY_EDITOR),n.registerCommand(e.CLICK_COMMAND,t=>{if(e.isDOMNode(t.target)){const n=e.$getNodeFromDOMNode(t.target);if(Oe(n))return function(t,n=!1){const i=e.$getSelection(),o=t.isSelected(),s=t.getKey();let r;n&&e.$isNodeSelection(i)?r=i:(r=e.$createNodeSelection(),e.$setSelection(r)),o?r.delete(s):r.add(s)}(n,t.shiftKey),!0}return!1},e.COMMAND_PRIORITY_LOW),n.registerMutationListener(Ne,(e,t)=>{o(()=>{let t=!1;const{nodeSelections:i}=a.peek();for(const[o,s]of e.entries())if("destroyed"===s)i.delete(o),t=!0;else{const e=i.get(o),s=n.getElementByKey(o);e?e.domNode.value=s:(t=!0,i.set(o,{domNode:m(s),selectedSignal:r(o)}))}t&&(a.value={nodeSelections:i})})}),R(()=>{const t=[];for(const{domNode:n,selectedSignal:i}of a.value.nodeSelections.values())t.push(R(()=>{const t=n.value;if(t){i.value?e.addClassNamesToElement(t,c):e.removeClassNamesFromElement(t,c)}}));return e.mergeRegister(...t)}))}});const $e=e.defineExtension({build:(e,t)=>$({inheritEditableFromParent:t.inheritEditableFromParent}),config:e.safeCast({$getParentEditor:function(){const t=e.$getEditor();return pe.fromEditor(t),t},inheritEditableFromParent:!1}),init:(e,t,n)=>{const i=t.$getParentEditor();e.parentEditor=i,e.theme=e.theme||i._config.theme},name:"@lexical/extension/NestedEditor",register:(e,t,n)=>R(()=>{const t=e._parentEditor;if(t&&n.getOutput().inheritEditableFromParent.value)return e.setEditable(t.isEditable()),t.registerEditableListener(e.setEditable.bind(e))})});function De(t){e.$isElementNode(t)&&t.isInline()&&t.isEmpty()&&t.remove()}const we=e.defineExtension({build:(e,t,n)=>$(t),config:e.safeCast({disabled:!1}),name:"@lexical/NormalizeInlineElements",register:(t,n,i)=>{const o=i.getOutput();return R(()=>{if(!o.disabled.value){const n=[];for(const{klass:i,transforms:o}of t._nodes.values())i.prototype instanceof e.ElementNode&&i.prototype.isInline!==e.ElementNode.prototype.isInline&&(o.add(De),n.push(()=>o.delete(De)));return()=>n.forEach(e=>e())}})}}),Ie=new Set([e.SKIP_SELECTION_FOCUS_TAG,e.SKIP_SCROLL_INTO_VIEW_TAG]);const Me=e.defineExtension({build:(e,t,n)=>$(t),config:e.safeCast({$fixFocusOverselection:function(){const t=e.$getSelection();if(e.$isRangeSelection(t)&&!t.isCollapsed()){const n=e.$getCaretRangeInDirection(e.$caretRangeFromSelection(t),"next");let i=n.focus;for(e.$isTextPointCaret(i)&&n.anchor.origin!==i.origin&&0===i.offset&&(i=e.$rewindSiblingCaret(i.getSiblingCaret())),e.$isSiblingCaret(i)&&n.anchor.origin!==i.origin&&e.$isLineBreakNode(i.origin)&&(i=e.$rewindSiblingCaret(i));e.$isChildCaret(i)&&n.anchor.origin!==i.origin;)i=e.$rewindSiblingCaret(e.$getSiblingCaret(i.origin,"next"));if(e.$isSiblingCaret(i)&&e.$isElementNode(i.origin)&&(i=e.$normalizeCaret(e.$getChildCaret(i.origin,"previous")).getFlipped()),i=e.$normalizeCaret(i),!i.isSamePointCaret(n.focus)){const t=e.$setSelectionFromCaretRange(e.$getCaretRange(n.anchor,i)),o=e.$getEditor().getRootElement(),s=o&&e.getDOMSelection(o.ownerDocument.defaultView);s&&e.$updateDOMSelection(e.$getPreviousSelection(),t,e.$getEditor(),s,Ie,o)}}},dateNow:Date.now,disabled:!1,thresholdMsec:100}),name:"@lexical/NormalizeTripleClickSelection",register:(t,n,i)=>R(()=>{const n=i.getOutput();if(!n.disabled.value)return t.registerRootListener(i=>{if(!i)return;let o=0;const s=e=>{if(e?3===e.detail:o>0){const t=n.dateNow.peek()();o=e&&"mousedown"===e.type||t-o<=n.thresholdMsec.peek()?t:0}return o};return e.mergeRegister(t.registerCommand(e.SELECTION_CHANGE_COMMAND,()=>(s(null)&&(o=0,n.$fixFocusOverselection.peek()()),!1),e.COMMAND_PRIORITY_BEFORE_CRITICAL),(()=>{const e=["mouseup","mousedown"];return e.forEach(e=>i.addEventListener(e,s,!0)),()=>e.forEach(e=>i.removeEventListener(e,s,!0))})())})})}),_e=e.defineExtension({build:(e,t,n)=>$(t),config:e.safeCast({disabled:!1,onReposition:void 0}),name:"@lexical/utils/SelectionAlwaysOnDisplay",register:(e,n,i)=>{const o=i.getOutput();return R(()=>{if(!o.disabled.value)return t.selectionAlwaysOnDisplay(e,o.onReposition.value)})}});function Te(e){return e.canIndent()}function Ae(n,i,o=Te){return e.mergeRegister(n.registerCommand(e.KEY_TAB_COMMAND,i=>{const o=e.$getSelection();if(!e.$isRangeSelection(o))return!1;i.preventDefault();const s=function(n){if(n.getNodes().filter(t=>e.$isBlockElementNode(t)&&t.canIndent()).length>0)return!0;const i=n.anchor,o=n.focus,s=o.isBefore(i)?o:i,r=s.getNode(),a=t.$getNearestBlockElementAncestorOrThrow(r);if(a.canIndent()){const t=a.getKey();let n=e.$createRangeSelection();if(n.anchor.set(t,0,"element"),n.focus.set(t,0,"element"),n=e.$normalizeSelection__EXPERIMENTAL(n),n.anchor.is(s))return!0}return!1}(o)?i.shiftKey?e.OUTDENT_CONTENT_COMMAND:e.INDENT_CONTENT_COMMAND:e.INSERT_TAB_COMMAND;return n.dispatchCommand(s,void 0)},e.COMMAND_PRIORITY_EDITOR),n.registerCommand(e.INDENT_CONTENT_COMMAND,()=>{const n="number"==typeof i?i:i?i.peek():null,s=e.$getSelection();if(!e.$isRangeSelection(s))return!1;const r="function"==typeof o?o:o.peek();return t.$handleIndentAndOutdent(e=>{if(r(e)){const t=e.getIndent()+1;(!n||t<n)&&e.setIndent(t)}})},e.COMMAND_PRIORITY_CRITICAL))}const Fe=e.defineExtension({build:(e,t,n)=>$(t),config:e.safeCast({$canIndent:Te,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(e,t,n){const{disabled:i,maxIndent:o,$canIndent:s}=n.getOutput();return R(()=>{if(!i.value)return Ae(e,o,s)})}});exports.configExtension=e.configExtension,exports.declarePeerDependency=e.declarePeerDependency,exports.defineExtension=e.defineExtension,exports.safeCast=e.safeCast,exports.shallowMergeConfig=e.shallowMergeConfig,exports.$createHorizontalRuleNode=Ce,exports.$defaultShouldInsertAfter=_,exports.$getExtensionDependency=xe,exports.$getExtensionOutput=function(e){return xe(e).output},exports.$getPeerDependency=function(t){return Ee(e.$getEditor(),t)},exports.$isDecoratorTextNode=k,exports.$isHorizontalRuleNode=Oe,exports.AutoFocusExtension=D,exports.ClearEditorExtension=M,exports.ClickAfterLastBlockExtension=A,exports.DecoratorTextExtension=j,exports.DecoratorTextNode=L,exports.EditorStateExtension=U,exports.HorizontalRuleExtension=Re,exports.HorizontalRuleNode=Ne,exports.INSERT_HORIZONTAL_RULE_COMMAND=ye,exports.InitialStateExtension=de,exports.LexicalBuilder=pe,exports.NestedEditorExtension=$e,exports.NodeSelectionExtension=ve,exports.NormalizeInlineElementsExtension=we,exports.NormalizeTripleClickSelectionExtension=Me,exports.SelectionAlwaysOnDisplayExtension=_e,exports.TabIndentationExtension=Fe,exports.applyFormatFromStyle=function(e,t,n){const i=t.fontWeight,o=t.textDecoration.split(" "),s="700"===i||"bold"===i,r=o.includes("line-through"),a="italic"===t.fontStyle,c=o.includes("underline"),d=t.verticalAlign;return s&&!e.hasFormat("bold")&&e.toggleFormat("bold"),r&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),a&&!e.hasFormat("italic")&&e.toggleFormat("italic"),c&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==d||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==d||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e},exports.applyFormatToDom=function(e,t,n=z){for(const[i,o]of Object.entries(n))e.hasFormat(o)&&(t=K(t,i));return t},exports.batch=o,exports.buildEditorFromExtensions=function(...e){return pe.fromExtensions(e).buildEditor()},exports.computed=y,exports.effect=R,exports.getExtensionDependencyFromEditor=me,exports.getKnownTypesAndNodes=function(t){const n=new Set,i=new Set;for(const o of F(t)){const t="function"==typeof o?o:o.replace;e.getStaticNodeConfig(t),n.add(t.getType()),i.add(t)}return{nodes:i,types:n}},exports.getPeerDependencyFromEditor=Ee,exports.getPeerDependencyFromEditorOrThrow=function(e,t){const n=Ee(e,t);return void 0===n&&Y(291,t),n},exports.namedSignals=$,exports.registerClearEditor=I,exports.registerTabIndentation=Ae,exports.signal=m,exports.untracked=a,exports.watchedSignal=B;
@@ -6,4 +6,4 @@
6
6
  *
7
7
  */
8
8
 
9
- import{defineExtension as t,safeCast as e,CLEAR_EDITOR_COMMAND as n,COMMAND_PRIORITY_EDITOR as i,$getRoot as o,$getSelection as s,$createParagraphNode as r,$isRangeSelection as c,$isDecoratorNode as a,$isElementNode as d,stopLexicalPropagation as u,getStaticNodeConfig as l,FORMAT_TEXT_COMMAND as f,$isNodeSelection as h,COMMAND_PRIORITY_LOW as g,DecoratorNode as p,$getState as m,toggleTextFormatType as v,$setState as E,TEXT_TYPE_TO_FORMAT as x,createState as y,shallowMergeConfig as S,RootNode as b,TextNode as w,LineBreakNode as N,TabNode as O,ParagraphNode as C,$isEditorState as R,HISTORY_MERGE_TAG as D,createEditor as F,mergeRegister as I,$getEditor as M,$getNodeByKey as k,$create as _,CLICK_COMMAND as A,isDOMNode as P,$getNodeFromDOMNode as $,addClassNamesToElement as L,createCommand as j,$createNodeSelection as K,$setSelection as z,removeClassNamesFromElement as U,ElementNode as T,$getCaretRangeInDirection as B,$caretRangeFromSelection as V,$isTextPointCaret as W,$rewindSiblingCaret as G,$isSiblingCaret as Z,$isLineBreakNode as J,$isChildCaret as H,$getSiblingCaret as Y,$normalizeCaret as q,$getChildCaret as Q,$setSelectionFromCaretRange as X,$getCaretRange as tt,getDOMSelection as et,$updateDOMSelection as nt,$getPreviousSelection as it,SKIP_SELECTION_FOCUS_TAG as ot,SKIP_SCROLL_INTO_VIEW_TAG as st,SELECTION_CHANGE_COMMAND as rt,COMMAND_PRIORITY_BEFORE_CRITICAL as ct,KEY_TAB_COMMAND as at,OUTDENT_CONTENT_COMMAND as dt,INDENT_CONTENT_COMMAND as ut,INSERT_TAB_COMMAND as lt,COMMAND_PRIORITY_CRITICAL as ft,$isBlockElementNode as ht,$createRangeSelection as gt,$normalizeSelection__EXPERIMENTAL as pt}from"lexical";export{configExtension,declarePeerDependency,defineExtension,safeCast,shallowMergeConfig}from"lexical";import{$insertNodeToNearestRoot as mt,selectionAlwaysOnDisplay as vt,$handleIndentAndOutdent as Et,$getNearestBlockElementAncestorOrThrow as xt}from"@lexical/utils";const yt=Symbol.for("preact-signals");function St(){if(Rt>1)return void Rt--;let t,e=!1;for(!function(){let t=Ct;for(Ct=void 0;void 0!==t;)t.S.v===t.v&&(t.S.i=t.i),t=t.o}();void 0!==Nt;){let n=Nt;for(Nt=void 0,Dt++;void 0!==n;){const i=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Pt(n))try{n.c()}catch(n){e||(t=n,e=!0)}n=i}}if(Dt=0,Rt--,e)throw t}function bt(t){if(Rt>0)return t();It=++Ft,Rt++;try{return t()}finally{St()}}let wt,Nt;function Ot(t){const e=wt;wt=void 0;try{return t()}finally{wt=e}}let Ct,Rt=0,Dt=0,Ft=0,It=0,Mt=0;function kt(t){if(void 0===wt)return;let e=t.n;return void 0===e||e.t!==wt?(e={i:0,S:t,p:wt.s,n:void 0,t:wt,e:void 0,x:void 0,r:e},void 0!==wt.s&&(wt.s.n=e),wt.s=e,t.n=e,32&wt.f&&t.S(e),e):-1===e.i?(e.i=0,void 0!==e.n&&(e.n.p=e.p,void 0!==e.p&&(e.p.n=e.n),e.p=wt.s,e.n=void 0,wt.s.n=e,wt.s=e),e):void 0}function _t(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=null==e?void 0:e.watched,this.Z=null==e?void 0:e.unwatched,this.name=null==e?void 0:e.name}function At(t,e){return new _t(t,e)}function Pt(t){for(let e=t.s;void 0!==e;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function $t(t){for(let e=t.s;void 0!==e;e=e.n){const n=e.S.n;if(void 0!==n&&(e.r=n),e.S.n=e,e.i=-1,void 0===e.n){t.s=e;break}}}function Lt(t){let e,n=t.s;for(;void 0!==n;){const t=n.p;-1===n.i?(n.S.U(n),void 0!==t&&(t.n=n.n),void 0!==n.n&&(n.n.p=t)):e=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=t}t.s=e}function jt(t,e){_t.call(this,void 0),this.x=t,this.s=void 0,this.g=Mt-1,this.f=4,this.W=null==e?void 0:e.watched,this.Z=null==e?void 0:e.unwatched,this.name=null==e?void 0:e.name}function Kt(t,e){return new jt(t,e)}function zt(t){const e=t.m;if(t.m=void 0,"function"==typeof e){Rt++;const n=wt;wt=void 0;try{e()}catch(e){throw t.f&=-2,t.f|=8,Ut(t),e}finally{wt=n,St()}}}function Ut(t){for(let e=t.s;void 0!==e;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,zt(t)}function Tt(t){if(wt!==this)throw new Error("Out-of-order effect");Lt(this),wt=t,this.f&=-2,8&this.f&&Ut(this),St()}function Bt(t,e){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=null==e?void 0:e.name}function Vt(t,e){const n=new Bt(t,e);try{n.c()}catch(t){throw n.d(),t}const i=n.d.bind(n);return i[Symbol.dispose]=i,i}function Wt(t,e={}){const n={};for(const i in t){const o=e[i],s=At(void 0===o?t[i]:o);n[i]=s}return n}_t.prototype.brand=yt,_t.prototype.h=function(){return!0},_t.prototype.S=function(t){const e=this.t;e!==t&&void 0===t.e&&(t.x=e,this.t=t,void 0!==e?e.e=t:Ot(()=>{var t;null==(t=this.W)||t.call(this)}))},_t.prototype.U=function(t){if(void 0!==this.t){const e=t.e,n=t.x;void 0!==e&&(e.x=n,t.e=void 0),void 0!==n&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n,void 0===n&&Ot(()=>{var t;null==(t=this.Z)||t.call(this)}))}},_t.prototype.subscribe=function(t){return Vt(()=>{const e=this.value,n=wt;wt=void 0;try{t(e)}finally{wt=n}},{name:"sub"})},_t.prototype.valueOf=function(){return this.value},_t.prototype.toString=function(){return this.value+""},_t.prototype.toJSON=function(){return this.value},_t.prototype.peek=function(){const t=wt;wt=void 0;try{return this.value}finally{wt=t}},Object.defineProperty(_t.prototype,"value",{get(){const t=kt(this);return void 0!==t&&(t.i=this.i),this.v},set(t){if(t!==this.v){if(Dt>100)throw new Error("Cycle detected");!function(t){0!==Rt&&0===Dt&&t.l!==It&&(t.l=It,Ct={S:t,v:t.v,i:t.i,o:Ct})}(this),this.v=t,this.i++,Mt++,Rt++;try{for(let t=this.t;void 0!==t;t=t.x)t.t.N()}finally{St()}}}}),jt.prototype=new _t,jt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===Mt)return!0;if(this.g=Mt,this.f|=1,this.i>0&&!Pt(this))return this.f&=-2,!0;const t=wt;try{$t(this),wt=this;const t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return wt=t,Lt(this),this.f&=-2,!0},jt.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(let t=this.s;void 0!==t;t=t.n)t.S.S(t)}_t.prototype.S.call(this,t)},jt.prototype.U=function(t){if(void 0!==this.t&&(_t.prototype.U.call(this,t),void 0===this.t)){this.f&=-33;for(let t=this.s;void 0!==t;t=t.n)t.S.U(t)}},jt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let t=this.t;void 0!==t;t=t.x)t.t.N()}},Object.defineProperty(jt.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const t=kt(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),Bt.prototype.c=function(){const t=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const t=this.x();"function"==typeof t&&(this.m=t)}finally{t()}},Bt.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,zt(this),$t(this),Rt++;const t=wt;return wt=this,Tt.bind(this,t)},Bt.prototype.N=function(){2&this.f||(this.f|=2,this.u=Nt,Nt=this)},Bt.prototype.d=function(){this.f|=8,1&this.f||Ut(this)},Bt.prototype.dispose=function(){this.d()};const Gt=t({build:(t,e,n)=>Wt(e),config:e({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(t,e,n){const i=n.getOutput();return Vt(()=>i.disabled.value?void 0:t.registerRootListener(e=>{t.focus(()=>{const t=document.activeElement;null===e||null!==t&&e.contains(t)||e.focus({preventScroll:!0})},{defaultSelection:i.defaultSelection.peek()})}))}});function Zt(){const t=o(),e=s(),n=r();t.clear(),t.append(n),null!==e&&n.select(),c(e)&&(e.format=0)}function Jt(t,e=Zt){return t.registerCommand(n,n=>(t.update(e),!0),i)}const Ht=t({build:(t,e,n)=>Wt(e),config:e({$onClear:Zt}),name:"@lexical/extension/ClearEditor",register(t,e,n){const{$onClear:i}=n.getOutput();return Vt(()=>Jt(t,i.value))}});function Yt(t){return!!a(t)||!(!d(t)||!t.isShadowRoot())}function qt(t,e,n,i){return!!t.isEditable()&&(n.target===e&&t.getEditorState().read(()=>{const e=o().getLastChild();if(null===e)return!1;const s=t.getElementByKey(e.getKey());return null!==s&&(!(n.clientY<=s.getBoundingClientRect().bottom)&&i(e))},{editor:t}))}const Qt=t({build:(t,e)=>Wt(e),config:e({$shouldInsertAfter:Yt,disabled:!1}),name:"@lexical/ClickAfterLastBlock",register:(t,e,n)=>Vt(()=>{const e=n.getOutput();if(!e.disabled.value)return t.registerRootListener(n=>{if(null===n)return;const i=i=>{qt(t,n,i,e.$shouldInsertAfter.peek())&&i.preventDefault()},s=i=>{qt(t,n,i,e.$shouldInsertAfter.peek())&&(i.preventDefault(),u(i),t.update(()=>{const t=o().getLastChild();if(null===t)return;if(!e.$shouldInsertAfter.peek()(t))return;const n=r();t.insertAfter(n),n.select()}))};return n.addEventListener("mousedown",i,!0),n.addEventListener("click",s,!0),()=>{n.removeEventListener("mousedown",i,!0),n.removeEventListener("click",s,!0)}})})});function Xt(t){const e=new Set,n=new Set;for(const i of te(t)){const t="function"==typeof i?i:i.replace;l(t),e.add(t.getType()),n.add(t)}return{nodes:n,types:e}}function te(t){return("function"==typeof t.nodes?t.nodes():t.nodes)||[]}const ee=y("format",{parse:t=>"number"==typeof t?t:0});class ne extends p{$config(){return this.config("decorator-text",{extends:p,stateConfigs:[{flat:!0,stateConfig:ee}]})}getFormat(){return m(this,ee)}getFormatFlags(t,e){return v(this.getFormat(),t,e)}hasFormat(t){const e=x[t];return 0!==(this.getFormat()&e)}setFormat(t){return E(this,ee,t)}toggleFormat(t){const e=this.getFormat(),n=v(e,t,null);return this.setFormat(n)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}}function ie(t){return t instanceof ne}function oe(t,e,n){const i=e.fontWeight,o=e.textDecoration.split(" "),s="700"===i||"bold"===i,r=o.includes("line-through"),c="italic"===e.fontStyle,a=o.includes("underline"),d=e.verticalAlign;return s&&!t.hasFormat("bold")&&t.toggleFormat("bold"),r&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),c&&!t.hasFormat("italic")&&t.toggleFormat("italic"),a&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==d||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==d||t.hasFormat("superscript")||t.toggleFormat("superscript"),n&&!t.hasFormat(n)&&t.toggleFormat(n),t}function se(t,e,n=ce){for(const[i,o]of Object.entries(n))t.hasFormat(o)&&(e=re(e,i));return e}function re(t,e){const n=document.createElement(e);return n.appendChild(t),n}const ce={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},ae=t({name:"@lexical/extension/DecoratorText",nodes:()=>[ne],register:(t,e,n)=>t.registerCommand(f,t=>{const e=s();if(h(e)||c(e))for(const n of e.getNodes())ie(n)&&n.toggleFormat(t);return!1},g)});function de(t,e){let n;return At(t(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=t(),n=e(this)}})}const ue=t({build:t=>de(()=>t.getEditorState(),e=>t.registerUpdateListener(t=>{e.value=t.editorState})),name:"@lexical/extension/EditorState"});function le(t,...e){const n=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",t);for(const t of e)i.append("v",t);throw n.search=i.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let fe;try{fe="0.45.0+prod.esm"}catch(t){}const he=fe??"0.45.0+source";function ge(t,e){if(t&&e&&!Array.isArray(e)&&"object"==typeof t&&"object"==typeof e){const n=t,i=e;for(const t in i)n[t]=ge(n[t],i[t]);return t}return e}const pe=0,me=1,ve=2,Ee=3,xe=4,ye=5,Se=6,be=7;function we(t){return t.id===pe}function Ne(t){return t.id===ve}function Oe(t){return function(t){return t.id===me}(t)||le(305,String(t.id),String(me)),Object.assign(t,{id:ve})}const Ce=new Set;class Re{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,e){this.builder=t,this.extension=e,this.configs=new Set,this.state={id:pe}}mergeConfigs(){let t=this.extension.config||{};const e=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):S;for(const n of this.configs)t=e(t,n);return t}init(t){const e=this.state;Ne(e)||le(306,String(e.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},i={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},o=function(t,e,n){return Object.assign(t,{config:e,id:Ee,registerState:n})}(e,this.mergeConfigs(),n);let s;this.state=o,this.extension.init&&(s=this.extension.init(t,o.config,n)),this.state=function(t,e,n){return Object.assign(t,{id:xe,initResult:e,registerState:n})}(o,s,i)}build(t){const e=this.state;let n;e.id!==xe&&le(307,String(e.id),String(ye)),this.extension.build&&(n=this.extension.build(t,e.config,e.registerState));const i={...e.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(t,e,n){return Object.assign(t,{id:ye,output:e,registerState:n})}(e,n,i)}register(t,e){this._signal=e;const n=this.state;n.id!==ye&&le(308,String(n.id),String(ye));const i=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=function(t){return Object.assign(t,{id:Se})}(n),()=>{const t=this.state;t.id!==be&&le(309,String(n.id),String(be)),this.state=function(t){return Object.assign(t,{id:ye})}(t),i&&i()}}afterRegistration(t){const e=this.state;let n;return e.id!==Se&&le(310,String(e.id),String(Se)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(t,e.config,e.registerState)),this.state=function(t){return Object.assign(t,{id:be})}(e),n}getSignal(){return void 0===this._signal&&le(311),this._signal}getInitResult(){void 0===this.extension.init&&le(312,this.extension.name);const t=this.state;return function(t){return t.id>=xe}(t)||le(313,String(t.id),String(xe)),t.initResult}getInitPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionInitDependency():void 0}getExtensionInitDependency(){const t=this.state;return function(t){return t.id>=Ee}(t)||le(314,String(t.id),String(Ee)),{config:t.config}}getPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionDependency():void 0}getInitDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&le(315,this.extension.name,t.name),e.getExtensionInitDependency()}getDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&le(315,this.extension.name,t.name),e.getExtensionDependency()}getState(){const t=this.state;return function(t){return t.id>=be}(t)||le(316,String(t.id),String(be)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Ce}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([t])=>t)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){const t=this.state;(function(t){return t.id>=ye})(t)||le(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}}const De={tag:D};function Fe(){const t=o();t.isEmpty()&&t.append(r())}const Ie=t({config:e({setOptions:De,updateOptions:De}),init:({$initialEditorState:t=Fe})=>({$initialEditorState:t,initialized:!1}),afterRegistration(t,{updateOptions:e,setOptions:n},i){const o=i.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:i}=o;if(R(i))t.setEditorState(i,n);else if("function"==typeof i)t.update(()=>{i(t)},e);else if(i&&("string"==typeof i||"object"==typeof i)){const e=t.parseEditorState(i);t.setEditorState(e,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[b,w,N,O,C]}),Me=Symbol.for("@lexical/extension/LexicalBuilder");function ke(...t){return Le.fromExtensions(t).buildEditor()}function _e(){}function Ae(t){throw t}function Pe(t){return Array.isArray(t)?t:[t]}const $e=he;class Le{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=$e,this.roots=t;for(const e of t)this.addExtension(e)}static fromExtensions(t){const e=[Pe(Ie)];for(const n of t)e.push(Pe(n));return new Le(e)}static maybeFromEditor(t){const e=t[Me];return e&&(e.PACKAGE_VERSION!==$e&&le(292,e.PACKAGE_VERSION,$e),e instanceof Le||le(293)),e}static fromEditor(t){const e=Le.maybeFromEditor(t);return void 0===e&&le(294),e}constructEditor(){const{$initialEditorState:t,onError:e,...n}=this.buildCreateEditorArgs(),i=Object.assign(F({...n,...e?{onError:t=>{e(t,i)}}:{}}),{[Me]:this});for(const t of this.sortedExtensionReps())t.build(i);return i}buildEditor(){let t=_e;function e(){try{t()}finally{t=_e}}const n=Object.assign(this.constructEditor(),{dispose:e,[Symbol.dispose]:e});return t=I(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){const e=this.extensionNameMap.get(t.name);if(e)return e.extension!==t&&le(295,t.name),e}addEdge(t,e,n){const i=this.outgoingConfigEdges.get(t);i?i.set(e,n):this.outgoingConfigEdges.set(t,new Map([[e,n]]));const o=this.incomingEdges.get(e);o?o.add(t):this.incomingEdges.set(e,new Set([t]))}addExtension(t){void 0!==this._sortedExtensionReps&&le(296);const e=Pe(t),[n]=e;"string"!=typeof n.name&&le(297,typeof n.name);let i=this.extensionNameMap.get(n.name);if(void 0!==i&&i.extension!==n&&le(298,n.name),!i){i=new Re(this,n),this.extensionNameMap.set(n.name,i);const t=this.conflicts.get(n.name);"string"==typeof t&&le(299,n.name,t);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&le(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=Pe(t);this.addEdge(n.name,e[0].name,e.slice(1)),this.addExtension(e)}for(const[t,e]of n.peerDependencies||[])this.addEdge(n.name,t,e?[e]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const t=[],e=(n,i)=>{let o=n.state;if(Ne(o))return;const s=n.extension.name;var r;we(o)||le(300,s,i||"[unknown]"),we(r=o)||le(304,String(r.id),String(pe)),o=Object.assign(r,{id:me}),n.state=o;const c=this.outgoingConfigEdges.get(s);if(c)for(const t of c.keys()){const n=this.extensionNameMap.get(t);n&&e(n,s)}o=Oe(o),n.state=o,t.push(n)};for(const t of this.extensionNameMap.values())we(t.state)&&e(t);for(const e of t)for(const[t,n]of this.outgoingConfigEdges.get(e.extension.name)||[])if(n.length>0){const e=this.extensionNameMap.get(t);if(e)for(const t of n)e.configs.add(t)}for(const[t,...e]of this.roots)if(e.length>0){const n=this.extensionNameMap.get(t.name);void 0===n&&le(301,t.name);for(const t of e)n.configs.add(t)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){const e=this.sortedExtensionReps(),n=new AbortController,i=[()=>n.abort()],o=n.signal;for(const n of e){const e=n.register(t,o);e&&i.push(e)}for(const n of e){const e=n.afterRegistration(t);e&&i.push(e)}return I(...i)}buildCreateEditorArgs(){const t={},e=new Set,n=new Map,i=new Map,o={},s={},r=this.sortedExtensionReps();for(const c of r){const{extension:r}=c;if(void 0!==r.onError&&(t.onError=r.onError),void 0!==r.disableEvents&&(t.disableEvents=r.disableEvents),void 0!==r.parentEditor&&(t.parentEditor=r.parentEditor),void 0!==r.editable&&(t.editable=r.editable),void 0!==r.namespace&&(t.namespace=r.namespace),void 0!==r.$initialEditorState&&(t.$initialEditorState=r.$initialEditorState),r.nodes)for(const t of te(r)){if("function"!=typeof t){const e=n.get(t.replace);e&&le(302,r.name,t.replace.name,e.extension.name),n.set(t.replace,c)}e.add(t)}if(r.html){if(r.html.export)for(const[t,e]of r.html.export.entries())i.set(t,e);r.html.import&&Object.assign(o,r.html.import)}r.theme&&ge(s,r.theme)}Object.keys(s).length>0&&(t.theme=s),e.size&&(t.nodes=[...e]);const c=Object.keys(o).length>0,a=i.size>0;(c||a)&&(t.html={},c&&(t.html.import=o),a&&(t.html.export=i));for(const e of r)e.init(t);return t.onError||(t.onError=Ae),t}}function je(t,e){const n=Le.fromEditor(t).getExtensionRep(e);return void 0===n&&le(303,e.name),n.getExtensionDependency()}function Ke(t,e){const n=Le.maybeFromEditor(t);if(!n)return;const i=n.extensionNameMap.get(e);return i?i.getExtensionDependency():void 0}function ze(t,e){const n=Ke(t,e);return void 0===n&&le(291,e),n}function Ue(t){return je(M(),t)}function Te(t){return Ue(t).output}function Be(t){return Ke(M(),t)}const Ve=new Set,We=t({build(t,e,n){const i=n.getDependency(ue).output,o=At({watchedNodeKeys:new Map}),r=de(()=>{},()=>Vt(()=>{const t=r.peek(),{watchedNodeKeys:e}=o.value;let n,c=!1;i.value.read(()=>{if(s())for(const[i,o]of e.entries()){if(0===o.size){e.delete(i);continue}const s=k(i),r=s&&s.isSelected()||!1;c=c||r!==(!!t&&t.has(i)),r&&(n=n||new Set,n.add(i))}}),!c&&n&&t&&n.size===t.size||(r.value=n)}));return{watchNodeKey:function(t){const e=Kt(()=>(r.value||Ve).has(t)),{watchedNodeKeys:n}=o.peek();let i=n.get(t);const s=void 0!==i;return i=i||new Set,i.add(e),s||(n.set(t,i),o.value={watchedNodeKeys:n}),e}}},dependencies:[ue],name:"@lexical/extension/NodeSelection"}),Ge=j("INSERT_HORIZONTAL_RULE_COMMAND");class Ze extends p{static getType(){return"horizontalrule"}static clone(t){return new Ze(t.__key)}static importJSON(t){return He().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:Je,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){const e=document.createElement("hr");return L(e,t.theme.hr),e}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function Je(){return{node:He()}}function He(){return _(Ze)}function Ye(t){return t instanceof Ze}const qe=t({dependencies:[ue,We],name:"@lexical/extension/HorizontalRule",nodes:()=>[Ze],register(t,e,n){const{watchNodeKey:o}=n.getDependency(We).output,r=At({nodeSelections:new Map}),a=t._config.theme.hrSelected??"selected";return I(t.registerCommand(Ge,t=>{const e=s();if(!c(e))return!1;if(null!==e.focus.getNode()){const t=He();mt(t)}return!0},i),t.registerCommand(A,t=>{if(P(t.target)){const e=$(t.target);if(Ye(e))return function(t,e=!1){const n=s(),i=t.isSelected(),o=t.getKey();let r;e&&h(n)?r=n:(r=K(),z(r)),i?r.delete(o):r.add(o)}(e,t.shiftKey),!0}return!1},g),t.registerMutationListener(Ze,(e,n)=>{bt(()=>{let n=!1;const{nodeSelections:i}=r.peek();for(const[s,r]of e.entries())if("destroyed"===r)i.delete(s),n=!0;else{const e=i.get(s),r=t.getElementByKey(s);e?e.domNode.value=r:(n=!0,i.set(s,{domNode:At(r),selectedSignal:o(s)}))}n&&(r.value={nodeSelections:i})})}),Vt(()=>{const t=[];for(const{domNode:e,selectedSignal:n}of r.value.nodeSelections.values())t.push(Vt(()=>{const t=e.value;if(t){n.value?L(t,a):U(t,a)}}));return I(...t)}))}});const Qe=t({build:(t,e)=>Wt({inheritEditableFromParent:e.inheritEditableFromParent}),config:e({$getParentEditor:function(){const t=M();return Le.fromEditor(t),t},inheritEditableFromParent:!1}),init:(t,e,n)=>{const i=e.$getParentEditor();t.parentEditor=i,t.theme=t.theme||i._config.theme},name:"@lexical/extension/NestedEditor",register:(t,e,n)=>Vt(()=>{const e=t._parentEditor;if(e&&n.getOutput().inheritEditableFromParent.value)return t.setEditable(e.isEditable()),e.registerEditableListener(t.setEditable.bind(t))})});function Xe(t){d(t)&&t.isInline()&&t.isEmpty()&&t.remove()}const tn=t({build:(t,e,n)=>Wt(e),config:e({disabled:!1}),name:"@lexical/NormalizeInlineElements",register:(t,e,n)=>{const i=n.getOutput();return Vt(()=>{if(!i.disabled.value){const e=[];for(const{klass:n,transforms:i}of t._nodes.values())n.prototype instanceof T&&n.prototype.isInline!==T.prototype.isInline&&(i.add(Xe),e.push(()=>i.delete(Xe)));return()=>e.forEach(t=>t())}})}}),en=new Set([ot,st]);const nn=t({build:(t,e,n)=>Wt(e),config:e({$fixFocusOverselection:function(){const t=s();if(c(t)&&!t.isCollapsed()){const e=B(V(t),"next");let n=e.focus;for(W(n)&&e.anchor.origin!==n.origin&&0===n.offset&&(n=G(n.getSiblingCaret())),Z(n)&&e.anchor.origin!==n.origin&&J(n.origin)&&(n=G(n));H(n)&&e.anchor.origin!==n.origin;)n=G(Y(n.origin,"next"));if(Z(n)&&d(n.origin)&&(n=q(Q(n.origin,"previous")).getFlipped()),n=q(n),!n.isSamePointCaret(e.focus)){const t=X(tt(e.anchor,n)),i=M().getRootElement(),o=i&&et(i.ownerDocument.defaultView);o&&nt(it(),t,M(),o,en,i)}}},dateNow:Date.now,disabled:!1,thresholdMsec:100}),name:"@lexical/NormalizeTripleClickSelection",register:(t,e,n)=>Vt(()=>{const e=n.getOutput();if(!e.disabled.value)return t.registerRootListener(n=>{if(!n)return;let i=0;const o=t=>{if(t?3===t.detail:i>0){const n=e.dateNow.peek()();i=t&&"mousedown"===t.type||n-i<=e.thresholdMsec.peek()?n:0}return i};return I(t.registerCommand(rt,()=>(o(null)&&(i=0,e.$fixFocusOverselection.peek()()),!1),ct),(()=>{const t=["mouseup","mousedown"];return t.forEach(t=>n.addEventListener(t,o,!0)),()=>t.forEach(t=>n.removeEventListener(t,o,!0))})())})})}),on=t({build:(t,e,n)=>Wt(e),config:e({disabled:!1,onReposition:void 0}),name:"@lexical/utils/SelectionAlwaysOnDisplay",register:(t,e,n)=>{const i=n.getOutput();return Vt(()=>{if(!i.disabled.value)return vt(t,i.onReposition.value)})}});function sn(t){return t.canIndent()}function rn(t,e,n=sn){return I(t.registerCommand(at,e=>{const n=s();if(!c(n))return!1;e.preventDefault();const i=function(t){if(t.getNodes().filter(t=>ht(t)&&t.canIndent()).length>0)return!0;const e=t.anchor,n=t.focus,i=n.isBefore(e)?n:e,o=i.getNode(),s=xt(o);if(s.canIndent()){const t=s.getKey();let e=gt();if(e.anchor.set(t,0,"element"),e.focus.set(t,0,"element"),e=pt(e),e.anchor.is(i))return!0}return!1}(n)?e.shiftKey?dt:ut:lt;return t.dispatchCommand(i,void 0)},i),t.registerCommand(ut,()=>{const t="number"==typeof e?e:e?e.peek():null,i=s();if(!c(i))return!1;const o="function"==typeof n?n:n.peek();return Et(e=>{if(o(e)){const n=e.getIndent()+1;(!t||n<t)&&e.setIndent(n)}})},ft))}const cn=t({build:(t,e,n)=>Wt(e),config:e({$canIndent:sn,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(t,e,n){const{disabled:i,maxIndent:o,$canIndent:s}=n.getOutput();return Vt(()=>{if(!i.value)return rn(t,o,s)})}});export{He as $createHorizontalRuleNode,Yt as $defaultShouldInsertAfter,Ue as $getExtensionDependency,Te as $getExtensionOutput,Be as $getPeerDependency,ie as $isDecoratorTextNode,Ye as $isHorizontalRuleNode,Gt as AutoFocusExtension,Ht as ClearEditorExtension,Qt as ClickAfterLastBlockExtension,ae as DecoratorTextExtension,ne as DecoratorTextNode,ue as EditorStateExtension,qe as HorizontalRuleExtension,Ze as HorizontalRuleNode,Ge as INSERT_HORIZONTAL_RULE_COMMAND,Ie as InitialStateExtension,Le as LexicalBuilder,Qe as NestedEditorExtension,We as NodeSelectionExtension,tn as NormalizeInlineElementsExtension,nn as NormalizeTripleClickSelectionExtension,on as SelectionAlwaysOnDisplayExtension,cn as TabIndentationExtension,oe as applyFormatFromStyle,se as applyFormatToDom,bt as batch,ke as buildEditorFromExtensions,Kt as computed,Vt as effect,je as getExtensionDependencyFromEditor,Xt as getKnownTypesAndNodes,Ke as getPeerDependencyFromEditor,ze as getPeerDependencyFromEditorOrThrow,Wt as namedSignals,Jt as registerClearEditor,rn as registerTabIndentation,At as signal,Ot as untracked,de as watchedSignal};
9
+ import{defineExtension as t,safeCast as e,CLEAR_EDITOR_COMMAND as n,COMMAND_PRIORITY_EDITOR as i,$getRoot as o,$getSelection as s,$createParagraphNode as r,$isRangeSelection as c,$isDecoratorNode as a,$isElementNode as d,stopLexicalPropagation as u,getStaticNodeConfig as l,FORMAT_TEXT_COMMAND as f,$isNodeSelection as h,COMMAND_PRIORITY_LOW as g,DecoratorNode as p,$getState as m,toggleTextFormatType as v,$setState as E,TEXT_TYPE_TO_FORMAT as x,createState as y,shallowMergeConfig as S,RootNode as b,TextNode as w,LineBreakNode as N,TabNode as O,ParagraphNode as C,$isEditorState as R,HISTORY_MERGE_TAG as D,createEditor as F,mergeRegister as I,$getEditor as M,$getNodeByKey as k,$create as _,CLICK_COMMAND as A,isDOMNode as P,$getNodeFromDOMNode as $,addClassNamesToElement as L,createCommand as j,$createNodeSelection as K,$setSelection as z,removeClassNamesFromElement as U,ElementNode as T,$getCaretRangeInDirection as B,$caretRangeFromSelection as V,$isTextPointCaret as W,$rewindSiblingCaret as G,$isSiblingCaret as Z,$isLineBreakNode as J,$isChildCaret as H,$getSiblingCaret as Y,$normalizeCaret as q,$getChildCaret as Q,$setSelectionFromCaretRange as X,$getCaretRange as tt,getDOMSelection as et,$updateDOMSelection as nt,$getPreviousSelection as it,SKIP_SELECTION_FOCUS_TAG as ot,SKIP_SCROLL_INTO_VIEW_TAG as st,SELECTION_CHANGE_COMMAND as rt,COMMAND_PRIORITY_BEFORE_CRITICAL as ct,KEY_TAB_COMMAND as at,OUTDENT_CONTENT_COMMAND as dt,INDENT_CONTENT_COMMAND as ut,INSERT_TAB_COMMAND as lt,COMMAND_PRIORITY_CRITICAL as ft,$isBlockElementNode as ht,$createRangeSelection as gt,$normalizeSelection__EXPERIMENTAL as pt}from"lexical";export{configExtension,declarePeerDependency,defineExtension,safeCast,shallowMergeConfig}from"lexical";import{$insertNodeToNearestRoot as mt,selectionAlwaysOnDisplay as vt,$handleIndentAndOutdent as Et,$getNearestBlockElementAncestorOrThrow as xt}from"@lexical/utils";const yt=Symbol.for("preact-signals");function St(){if(Rt>1)return void Rt--;let t,e=!1;for(!function(){let t=Ct;for(Ct=void 0;void 0!==t;)t.S.v===t.v&&(t.S.i=t.i),t=t.o}();void 0!==Nt;){let n=Nt;for(Nt=void 0,Dt++;void 0!==n;){const i=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&Pt(n))try{n.c()}catch(n){e||(t=n,e=!0)}n=i}}if(Dt=0,Rt--,e)throw t}function bt(t){if(Rt>0)return t();It=++Ft,Rt++;try{return t()}finally{St()}}let wt,Nt;function Ot(t){const e=wt;wt=void 0;try{return t()}finally{wt=e}}let Ct,Rt=0,Dt=0,Ft=0,It=0,Mt=0;function kt(t){if(void 0===wt)return;let e=t.n;return void 0===e||e.t!==wt?(e={i:0,S:t,p:wt.s,n:void 0,t:wt,e:void 0,x:void 0,r:e},void 0!==wt.s&&(wt.s.n=e),wt.s=e,t.n=e,32&wt.f&&t.S(e),e):-1===e.i?(e.i=0,void 0!==e.n&&(e.n.p=e.p,void 0!==e.p&&(e.p.n=e.n),e.p=wt.s,e.n=void 0,wt.s.n=e,wt.s=e),e):void 0}function _t(t,e){this.v=t,this.i=0,this.n=void 0,this.t=void 0,this.l=0,this.W=null==e?void 0:e.watched,this.Z=null==e?void 0:e.unwatched,this.name=null==e?void 0:e.name}function At(t,e){return new _t(t,e)}function Pt(t){for(let e=t.s;void 0!==e;e=e.n)if(e.S.i!==e.i||!e.S.h()||e.S.i!==e.i)return!0;return!1}function $t(t){for(let e=t.s;void 0!==e;e=e.n){const n=e.S.n;if(void 0!==n&&(e.r=n),e.S.n=e,e.i=-1,void 0===e.n){t.s=e;break}}}function Lt(t){let e,n=t.s;for(;void 0!==n;){const t=n.p;-1===n.i?(n.S.U(n),void 0!==t&&(t.n=n.n),void 0!==n.n&&(n.n.p=t)):e=n,n.S.n=n.r,void 0!==n.r&&(n.r=void 0),n=t}t.s=e}function jt(t,e){_t.call(this,void 0),this.x=t,this.s=void 0,this.g=Mt-1,this.f=4,this.W=null==e?void 0:e.watched,this.Z=null==e?void 0:e.unwatched,this.name=null==e?void 0:e.name}function Kt(t,e){return new jt(t,e)}function zt(t){const e=t.m;if(t.m=void 0,"function"==typeof e){Rt++;const n=wt;wt=void 0;try{e()}catch(e){throw t.f&=-2,t.f|=8,Ut(t),e}finally{wt=n,St()}}}function Ut(t){for(let e=t.s;void 0!==e;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,zt(t)}function Tt(t){if(wt!==this)throw new Error("Out-of-order effect");Lt(this),wt=t,this.f&=-2,8&this.f&&Ut(this),St()}function Bt(t,e){this.x=t,this.m=void 0,this.s=void 0,this.u=void 0,this.f=32,this.name=null==e?void 0:e.name}function Vt(t,e){const n=new Bt(t,e);try{n.c()}catch(t){throw n.d(),t}const i=n.d.bind(n);return i[Symbol.dispose]=i,i}function Wt(t,e={}){const n={};for(const i in t){const o=e[i],s=At(void 0===o?t[i]:o);n[i]=s}return n}_t.prototype.brand=yt,_t.prototype.h=function(){return!0},_t.prototype.S=function(t){const e=this.t;e!==t&&void 0===t.e&&(t.x=e,this.t=t,void 0!==e?e.e=t:Ot(()=>{var t;null==(t=this.W)||t.call(this)}))},_t.prototype.U=function(t){if(void 0!==this.t){const e=t.e,n=t.x;void 0!==e&&(e.x=n,t.e=void 0),void 0!==n&&(n.e=e,t.x=void 0),t===this.t&&(this.t=n,void 0===n&&Ot(()=>{var t;null==(t=this.Z)||t.call(this)}))}},_t.prototype.subscribe=function(t){return Vt(()=>{const e=this.value,n=wt;wt=void 0;try{t(e)}finally{wt=n}},{name:"sub"})},_t.prototype.valueOf=function(){return this.value},_t.prototype.toString=function(){return this.value+""},_t.prototype.toJSON=function(){return this.value},_t.prototype.peek=function(){const t=wt;wt=void 0;try{return this.value}finally{wt=t}},Object.defineProperty(_t.prototype,"value",{get(){const t=kt(this);return void 0!==t&&(t.i=this.i),this.v},set(t){if(t!==this.v){if(Dt>100)throw new Error("Cycle detected");!function(t){0!==Rt&&0===Dt&&t.l!==It&&(t.l=It,Ct={S:t,v:t.v,i:t.i,o:Ct})}(this),this.v=t,this.i++,Mt++,Rt++;try{for(let t=this.t;void 0!==t;t=t.x)t.t.N()}finally{St()}}}}),jt.prototype=new _t,jt.prototype.h=function(){if(this.f&=-3,1&this.f)return!1;if(32==(36&this.f))return!0;if(this.f&=-5,this.g===Mt)return!0;if(this.g=Mt,this.f|=1,this.i>0&&!Pt(this))return this.f&=-2,!0;const t=wt;try{$t(this),wt=this;const t=this.x();(16&this.f||this.v!==t||0===this.i)&&(this.v=t,this.f&=-17,this.i++)}catch(t){this.v=t,this.f|=16,this.i++}return wt=t,Lt(this),this.f&=-2,!0},jt.prototype.S=function(t){if(void 0===this.t){this.f|=36;for(let t=this.s;void 0!==t;t=t.n)t.S.S(t)}_t.prototype.S.call(this,t)},jt.prototype.U=function(t){if(void 0!==this.t&&(_t.prototype.U.call(this,t),void 0===this.t)){this.f&=-33;for(let t=this.s;void 0!==t;t=t.n)t.S.U(t)}},jt.prototype.N=function(){if(!(2&this.f)){this.f|=6;for(let t=this.t;void 0!==t;t=t.x)t.t.N()}},Object.defineProperty(jt.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const t=kt(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),Bt.prototype.c=function(){const t=this.S();try{if(8&this.f)return;if(void 0===this.x)return;const t=this.x();"function"==typeof t&&(this.m=t)}finally{t()}},Bt.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,zt(this),$t(this),Rt++;const t=wt;return wt=this,Tt.bind(this,t)},Bt.prototype.N=function(){2&this.f||(this.f|=2,this.u=Nt,Nt=this)},Bt.prototype.d=function(){this.f|=8,1&this.f||Ut(this)},Bt.prototype.dispose=function(){this.d()};const Gt=t({build:(t,e,n)=>Wt(e),config:e({defaultSelection:"rootEnd",disabled:!1}),name:"@lexical/extension/AutoFocus",register(t,e,n){const i=n.getOutput();return Vt(()=>i.disabled.value?void 0:t.registerRootListener(e=>{t.focus(()=>{const t=document.activeElement;null===e||null!==t&&e.contains(t)||e.focus({preventScroll:!0})},{defaultSelection:i.defaultSelection.peek()})}))}});function Zt(){const t=o(),e=s(),n=r();t.clear(),t.append(n),null!==e&&n.select(),c(e)&&(e.format=0)}function Jt(t,e=Zt){return t.registerCommand(n,n=>(t.update(e),!0),i)}const Ht=t({build:(t,e,n)=>Wt(e),config:e({$onClear:Zt}),name:"@lexical/extension/ClearEditor",register(t,e,n){const{$onClear:i}=n.getOutput();return Vt(()=>Jt(t,i.value))}});function Yt(t){return!!a(t)||!(!d(t)||!t.isShadowRoot())}function qt(t,e,n,i){return!!t.isEditable()&&(n.target===e&&t.getEditorState().read(()=>{const e=o().getLastChild();if(null===e)return!1;const s=t.getElementByKey(e.getKey());return null!==s&&(!(n.clientY<=s.getBoundingClientRect().bottom)&&i(e))},{editor:t}))}const Qt=t({build:(t,e)=>Wt(e),config:e({$shouldInsertAfter:Yt,disabled:!1}),name:"@lexical/ClickAfterLastBlock",register:(t,e,n)=>Vt(()=>{const e=n.getOutput();if(!e.disabled.value)return t.registerRootListener(n=>{if(null===n)return;const i=i=>{qt(t,n,i,e.$shouldInsertAfter.peek())&&i.preventDefault()},s=i=>{qt(t,n,i,e.$shouldInsertAfter.peek())&&(i.preventDefault(),u(i),t.update(()=>{const t=o().getLastChild();if(null===t)return;if(!e.$shouldInsertAfter.peek()(t))return;const n=r();t.insertAfter(n),n.select()}))};return n.addEventListener("mousedown",i,!0),n.addEventListener("click",s,!0),()=>{n.removeEventListener("mousedown",i,!0),n.removeEventListener("click",s,!0)}})})});function Xt(t){const e=new Set,n=new Set;for(const i of te(t)){const t="function"==typeof i?i:i.replace;l(t),e.add(t.getType()),n.add(t)}return{nodes:n,types:e}}function te(t){return("function"==typeof t.nodes?t.nodes():t.nodes)||[]}const ee=y("format",{parse:t=>"number"==typeof t?t:0});class ne extends p{$config(){return this.config("decorator-text",{extends:p,stateConfigs:[{flat:!0,stateConfig:ee}]})}getFormat(){return m(this,ee)}getFormatFlags(t,e){return v(this.getFormat(),t,e)}hasFormat(t){const e=x[t];return 0!==(this.getFormat()&e)}setFormat(t){return E(this,ee,t)}toggleFormat(t){const e=this.getFormat(),n=v(e,t,null);return this.setFormat(n)}isInline(){return!0}createDOM(){return document.createElement("span")}updateDOM(){return!1}}function ie(t){return t instanceof ne}function oe(t,e,n){const i=e.fontWeight,o=e.textDecoration.split(" "),s="700"===i||"bold"===i,r=o.includes("line-through"),c="italic"===e.fontStyle,a=o.includes("underline"),d=e.verticalAlign;return s&&!t.hasFormat("bold")&&t.toggleFormat("bold"),r&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),c&&!t.hasFormat("italic")&&t.toggleFormat("italic"),a&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==d||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==d||t.hasFormat("superscript")||t.toggleFormat("superscript"),n&&!t.hasFormat(n)&&t.toggleFormat(n),t}function se(t,e,n=ce){for(const[i,o]of Object.entries(n))t.hasFormat(o)&&(e=re(e,i));return e}function re(t,e){const n=document.createElement(e);return n.appendChild(t),n}const ce={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},ae=t({name:"@lexical/extension/DecoratorText",nodes:()=>[ne],register:(t,e,n)=>t.registerCommand(f,t=>{const e=s();if(h(e)||c(e))for(const n of e.getNodes())ie(n)&&n.toggleFormat(t);return!1},g)});function de(t,e){let n;return At(t(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=t(),n=e(this)}})}const ue=t({build:t=>de(()=>t.getEditorState(),e=>t.registerUpdateListener(t=>{e.value=t.editorState})),name:"@lexical/extension/EditorState"});function le(t,...e){const n=new URL("https://lexical.dev/docs/error"),i=new URLSearchParams;i.append("code",t);for(const t of e)i.append("v",t);throw n.search=i.toString(),Error(`Minified Lexical error #${t}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}let fe;try{fe="0.45.1-nightly.20260529.0+prod.esm"}catch(t){}const he=fe??"0.45.1-nightly.20260529.0+source";function ge(t,e){if(t&&e&&!Array.isArray(e)&&"object"==typeof t&&"object"==typeof e){const n=t,i=e;for(const t in i)n[t]=ge(n[t],i[t]);return t}return e}const pe=0,me=1,ve=2,Ee=3,xe=4,ye=5,Se=6,be=7;function we(t){return t.id===pe}function Ne(t){return t.id===ve}function Oe(t){return function(t){return t.id===me}(t)||le(305,String(t.id),String(me)),Object.assign(t,{id:ve})}const Ce=new Set;class Re{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,e){this.builder=t,this.extension=e,this.configs=new Set,this.state={id:pe}}mergeConfigs(){let t=this.extension.config||{};const e=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):S;for(const n of this.configs)t=e(t,n);return t}init(t){const e=this.state;Ne(e)||le(306,String(e.id));const n={getDependency:this.getInitDependency.bind(this),getDirectDependentNames:this.getDirectDependentNames.bind(this),getPeer:this.getInitPeer.bind(this),getPeerNameSet:this.getPeerNameSet.bind(this)},i={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},o=function(t,e,n){return Object.assign(t,{config:e,id:Ee,registerState:n})}(e,this.mergeConfigs(),n);let s;this.state=o,this.extension.init&&(s=this.extension.init(t,o.config,n)),this.state=function(t,e,n){return Object.assign(t,{id:xe,initResult:e,registerState:n})}(o,s,i)}build(t){const e=this.state;let n;e.id!==xe&&le(307,String(e.id),String(ye)),this.extension.build&&(n=this.extension.build(t,e.config,e.registerState));const i={...e.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(t,e,n){return Object.assign(t,{id:ye,output:e,registerState:n})}(e,n,i)}register(t,e){this._signal=e;const n=this.state;n.id!==ye&&le(308,String(n.id),String(ye));const i=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=function(t){return Object.assign(t,{id:Se})}(n),()=>{const t=this.state;t.id!==be&&le(309,String(n.id),String(be)),this.state=function(t){return Object.assign(t,{id:ye})}(t),i&&i()}}afterRegistration(t){const e=this.state;let n;return e.id!==Se&&le(310,String(e.id),String(Se)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(t,e.config,e.registerState)),this.state=function(t){return Object.assign(t,{id:be})}(e),n}getSignal(){return void 0===this._signal&&le(311),this._signal}getInitResult(){void 0===this.extension.init&&le(312,this.extension.name);const t=this.state;return function(t){return t.id>=xe}(t)||le(313,String(t.id),String(xe)),t.initResult}getInitPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionInitDependency():void 0}getExtensionInitDependency(){const t=this.state;return function(t){return t.id>=Ee}(t)||le(314,String(t.id),String(Ee)),{config:t.config}}getPeer(t){const e=this.builder.extensionNameMap.get(t);return e?e.getExtensionDependency():void 0}getInitDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&le(315,this.extension.name,t.name),e.getExtensionInitDependency()}getDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&le(315,this.extension.name,t.name),e.getExtensionDependency()}getState(){const t=this.state;return function(t){return t.id>=be}(t)||le(316,String(t.id),String(be)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Ce}getPeerNameSet(){let t=this._peerNameSet;return t||(t=new Set((this.extension.peerDependencies||[]).map(([t])=>t)),this._peerNameSet=t),t}getExtensionDependency(){if(!this._dependency){const t=this.state;(function(t){return t.id>=ye})(t)||le(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}}const De={tag:D};function Fe(){const t=o();t.isEmpty()&&t.append(r())}const Ie=t({config:e({setOptions:De,updateOptions:De}),init:({$initialEditorState:t=Fe})=>({$initialEditorState:t,initialized:!1}),afterRegistration(t,{updateOptions:e,setOptions:n},i){const o=i.getInitResult();if(!o.initialized){o.initialized=!0;const{$initialEditorState:i}=o;if(R(i))t.setEditorState(i,n);else if("function"==typeof i)t.update(()=>{i(t)},e);else if(i&&("string"==typeof i||"object"==typeof i)){const e=t.parseEditorState(i);t.setEditorState(e,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[b,w,N,O,C]}),Me=Symbol.for("@lexical/extension/LexicalBuilder");function ke(...t){return Le.fromExtensions(t).buildEditor()}function _e(){}function Ae(t){throw t}function Pe(t){return Array.isArray(t)?t:[t]}const $e=he;class Le{roots;extensionNameMap;outgoingConfigEdges;incomingEdges;conflicts;_sortedExtensionReps;PACKAGE_VERSION;constructor(t){this.outgoingConfigEdges=new Map,this.incomingEdges=new Map,this.extensionNameMap=new Map,this.conflicts=new Map,this.PACKAGE_VERSION=$e,this.roots=t;for(const e of t)this.addExtension(e)}static fromExtensions(t){const e=[Pe(Ie)];for(const n of t)e.push(Pe(n));return new Le(e)}static maybeFromEditor(t){const e=t[Me];return e&&(e.PACKAGE_VERSION!==$e&&le(292,e.PACKAGE_VERSION,$e),e instanceof Le||le(293)),e}static fromEditor(t){const e=Le.maybeFromEditor(t);return void 0===e&&le(294),e}constructEditor(){const{$initialEditorState:t,onError:e,...n}=this.buildCreateEditorArgs(),i=Object.assign(F({...n,...e?{onError:t=>{e(t,i)}}:{}}),{[Me]:this});for(const t of this.sortedExtensionReps())t.build(i);return i}buildEditor(){let t=_e;function e(){try{t()}finally{t=_e}}const n=Object.assign(this.constructEditor(),{dispose:e,[Symbol.dispose]:e});return t=I(this.registerEditor(n),()=>n.setRootElement(null)),n}hasExtensionByName(t){return this.extensionNameMap.has(t)}getExtensionRep(t){const e=this.extensionNameMap.get(t.name);if(e)return e.extension!==t&&le(295,t.name),e}addEdge(t,e,n){const i=this.outgoingConfigEdges.get(t);i?i.set(e,n):this.outgoingConfigEdges.set(t,new Map([[e,n]]));const o=this.incomingEdges.get(e);o?o.add(t):this.incomingEdges.set(e,new Set([t]))}addExtension(t){void 0!==this._sortedExtensionReps&&le(296);const e=Pe(t),[n]=e;"string"!=typeof n.name&&le(297,typeof n.name);let i=this.extensionNameMap.get(n.name);if(void 0!==i&&i.extension!==n&&le(298,n.name),!i){i=new Re(this,n),this.extensionNameMap.set(n.name,i);const t=this.conflicts.get(n.name);"string"==typeof t&&le(299,n.name,t);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&le(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=Pe(t);this.addEdge(n.name,e[0].name,e.slice(1)),this.addExtension(e)}for(const[t,e]of n.peerDependencies||[])this.addEdge(n.name,t,e?[e]:[])}}sortedExtensionReps(){if(this._sortedExtensionReps)return this._sortedExtensionReps;const t=[],e=(n,i)=>{let o=n.state;if(Ne(o))return;const s=n.extension.name;var r;we(o)||le(300,s,i||"[unknown]"),we(r=o)||le(304,String(r.id),String(pe)),o=Object.assign(r,{id:me}),n.state=o;const c=this.outgoingConfigEdges.get(s);if(c)for(const t of c.keys()){const n=this.extensionNameMap.get(t);n&&e(n,s)}o=Oe(o),n.state=o,t.push(n)};for(const t of this.extensionNameMap.values())we(t.state)&&e(t);for(const e of t)for(const[t,n]of this.outgoingConfigEdges.get(e.extension.name)||[])if(n.length>0){const e=this.extensionNameMap.get(t);if(e)for(const t of n)e.configs.add(t)}for(const[t,...e]of this.roots)if(e.length>0){const n=this.extensionNameMap.get(t.name);void 0===n&&le(301,t.name);for(const t of e)n.configs.add(t)}return this._sortedExtensionReps=t,this._sortedExtensionReps}registerEditor(t){const e=this.sortedExtensionReps(),n=new AbortController,i=[()=>n.abort()],o=n.signal;for(const n of e){const e=n.register(t,o);e&&i.push(e)}for(const n of e){const e=n.afterRegistration(t);e&&i.push(e)}return I(...i)}buildCreateEditorArgs(){const t={},e=new Set,n=new Map,i=new Map,o={},s={},r=this.sortedExtensionReps();for(const c of r){const{extension:r}=c;if(void 0!==r.onError&&(t.onError=r.onError),void 0!==r.disableEvents&&(t.disableEvents=r.disableEvents),void 0!==r.parentEditor&&(t.parentEditor=r.parentEditor),void 0!==r.editable&&(t.editable=r.editable),void 0!==r.namespace&&(t.namespace=r.namespace),void 0!==r.$initialEditorState&&(t.$initialEditorState=r.$initialEditorState),r.nodes)for(const t of te(r)){if("function"!=typeof t){const e=n.get(t.replace);e&&le(302,r.name,t.replace.name,e.extension.name),n.set(t.replace,c)}e.add(t)}if(r.html){if(r.html.export)for(const[t,e]of r.html.export.entries())i.set(t,e);r.html.import&&Object.assign(o,r.html.import)}r.theme&&ge(s,r.theme)}Object.keys(s).length>0&&(t.theme=s),e.size&&(t.nodes=[...e]);const c=Object.keys(o).length>0,a=i.size>0;(c||a)&&(t.html={},c&&(t.html.import=o),a&&(t.html.export=i));for(const e of r)e.init(t);return t.onError||(t.onError=Ae),t}}function je(t,e){const n=Le.fromEditor(t).getExtensionRep(e);return void 0===n&&le(303,e.name),n.getExtensionDependency()}function Ke(t,e){const n=Le.maybeFromEditor(t);if(!n)return;const i=n.extensionNameMap.get(e);return i?i.getExtensionDependency():void 0}function ze(t,e){const n=Ke(t,e);return void 0===n&&le(291,e),n}function Ue(t){return je(M(),t)}function Te(t){return Ue(t).output}function Be(t){return Ke(M(),t)}const Ve=new Set,We=t({build(t,e,n){const i=n.getDependency(ue).output,o=At({watchedNodeKeys:new Map}),r=de(()=>{},()=>Vt(()=>{const t=r.peek(),{watchedNodeKeys:e}=o.value;let n,c=!1;i.value.read(()=>{if(s())for(const[i,o]of e.entries()){if(0===o.size){e.delete(i);continue}const s=k(i),r=s&&s.isSelected()||!1;c=c||r!==(!!t&&t.has(i)),r&&(n=n||new Set,n.add(i))}}),!c&&n&&t&&n.size===t.size||(r.value=n)}));return{watchNodeKey:function(t){const e=Kt(()=>(r.value||Ve).has(t)),{watchedNodeKeys:n}=o.peek();let i=n.get(t);const s=void 0!==i;return i=i||new Set,i.add(e),s||(n.set(t,i),o.value={watchedNodeKeys:n}),e}}},dependencies:[ue],name:"@lexical/extension/NodeSelection"}),Ge=j("INSERT_HORIZONTAL_RULE_COMMAND");class Ze extends p{static getType(){return"horizontalrule"}static clone(t){return new Ze(t.__key)}static importJSON(t){return He().updateFromJSON(t)}static importDOM(){return{hr:()=>({conversion:Je,priority:0})}}exportDOM(){return{element:document.createElement("hr")}}createDOM(t){const e=document.createElement("hr");return L(e,t.theme.hr),e}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function Je(){return{node:He()}}function He(){return _(Ze)}function Ye(t){return t instanceof Ze}const qe=t({dependencies:[ue,We],name:"@lexical/extension/HorizontalRule",nodes:()=>[Ze],register(t,e,n){const{watchNodeKey:o}=n.getDependency(We).output,r=At({nodeSelections:new Map}),a=t._config.theme.hrSelected??"selected";return I(t.registerCommand(Ge,t=>{const e=s();if(!c(e))return!1;if(null!==e.focus.getNode()){const t=He();mt(t)}return!0},i),t.registerCommand(A,t=>{if(P(t.target)){const e=$(t.target);if(Ye(e))return function(t,e=!1){const n=s(),i=t.isSelected(),o=t.getKey();let r;e&&h(n)?r=n:(r=K(),z(r)),i?r.delete(o):r.add(o)}(e,t.shiftKey),!0}return!1},g),t.registerMutationListener(Ze,(e,n)=>{bt(()=>{let n=!1;const{nodeSelections:i}=r.peek();for(const[s,r]of e.entries())if("destroyed"===r)i.delete(s),n=!0;else{const e=i.get(s),r=t.getElementByKey(s);e?e.domNode.value=r:(n=!0,i.set(s,{domNode:At(r),selectedSignal:o(s)}))}n&&(r.value={nodeSelections:i})})}),Vt(()=>{const t=[];for(const{domNode:e,selectedSignal:n}of r.value.nodeSelections.values())t.push(Vt(()=>{const t=e.value;if(t){n.value?L(t,a):U(t,a)}}));return I(...t)}))}});const Qe=t({build:(t,e)=>Wt({inheritEditableFromParent:e.inheritEditableFromParent}),config:e({$getParentEditor:function(){const t=M();return Le.fromEditor(t),t},inheritEditableFromParent:!1}),init:(t,e,n)=>{const i=e.$getParentEditor();t.parentEditor=i,t.theme=t.theme||i._config.theme},name:"@lexical/extension/NestedEditor",register:(t,e,n)=>Vt(()=>{const e=t._parentEditor;if(e&&n.getOutput().inheritEditableFromParent.value)return t.setEditable(e.isEditable()),e.registerEditableListener(t.setEditable.bind(t))})});function Xe(t){d(t)&&t.isInline()&&t.isEmpty()&&t.remove()}const tn=t({build:(t,e,n)=>Wt(e),config:e({disabled:!1}),name:"@lexical/NormalizeInlineElements",register:(t,e,n)=>{const i=n.getOutput();return Vt(()=>{if(!i.disabled.value){const e=[];for(const{klass:n,transforms:i}of t._nodes.values())n.prototype instanceof T&&n.prototype.isInline!==T.prototype.isInline&&(i.add(Xe),e.push(()=>i.delete(Xe)));return()=>e.forEach(t=>t())}})}}),en=new Set([ot,st]);const nn=t({build:(t,e,n)=>Wt(e),config:e({$fixFocusOverselection:function(){const t=s();if(c(t)&&!t.isCollapsed()){const e=B(V(t),"next");let n=e.focus;for(W(n)&&e.anchor.origin!==n.origin&&0===n.offset&&(n=G(n.getSiblingCaret())),Z(n)&&e.anchor.origin!==n.origin&&J(n.origin)&&(n=G(n));H(n)&&e.anchor.origin!==n.origin;)n=G(Y(n.origin,"next"));if(Z(n)&&d(n.origin)&&(n=q(Q(n.origin,"previous")).getFlipped()),n=q(n),!n.isSamePointCaret(e.focus)){const t=X(tt(e.anchor,n)),i=M().getRootElement(),o=i&&et(i.ownerDocument.defaultView);o&&nt(it(),t,M(),o,en,i)}}},dateNow:Date.now,disabled:!1,thresholdMsec:100}),name:"@lexical/NormalizeTripleClickSelection",register:(t,e,n)=>Vt(()=>{const e=n.getOutput();if(!e.disabled.value)return t.registerRootListener(n=>{if(!n)return;let i=0;const o=t=>{if(t?3===t.detail:i>0){const n=e.dateNow.peek()();i=t&&"mousedown"===t.type||n-i<=e.thresholdMsec.peek()?n:0}return i};return I(t.registerCommand(rt,()=>(o(null)&&(i=0,e.$fixFocusOverselection.peek()()),!1),ct),(()=>{const t=["mouseup","mousedown"];return t.forEach(t=>n.addEventListener(t,o,!0)),()=>t.forEach(t=>n.removeEventListener(t,o,!0))})())})})}),on=t({build:(t,e,n)=>Wt(e),config:e({disabled:!1,onReposition:void 0}),name:"@lexical/utils/SelectionAlwaysOnDisplay",register:(t,e,n)=>{const i=n.getOutput();return Vt(()=>{if(!i.disabled.value)return vt(t,i.onReposition.value)})}});function sn(t){return t.canIndent()}function rn(t,e,n=sn){return I(t.registerCommand(at,e=>{const n=s();if(!c(n))return!1;e.preventDefault();const i=function(t){if(t.getNodes().filter(t=>ht(t)&&t.canIndent()).length>0)return!0;const e=t.anchor,n=t.focus,i=n.isBefore(e)?n:e,o=i.getNode(),s=xt(o);if(s.canIndent()){const t=s.getKey();let e=gt();if(e.anchor.set(t,0,"element"),e.focus.set(t,0,"element"),e=pt(e),e.anchor.is(i))return!0}return!1}(n)?e.shiftKey?dt:ut:lt;return t.dispatchCommand(i,void 0)},i),t.registerCommand(ut,()=>{const t="number"==typeof e?e:e?e.peek():null,i=s();if(!c(i))return!1;const o="function"==typeof n?n:n.peek();return Et(e=>{if(o(e)){const n=e.getIndent()+1;(!t||n<t)&&e.setIndent(n)}})},ft))}const cn=t({build:(t,e,n)=>Wt(e),config:e({$canIndent:sn,disabled:!1,maxIndent:null}),name:"@lexical/extension/TabIndentation",register(t,e,n){const{disabled:i,maxIndent:o,$canIndent:s}=n.getOutput();return Vt(()=>{if(!i.value)return rn(t,o,s)})}});export{He as $createHorizontalRuleNode,Yt as $defaultShouldInsertAfter,Ue as $getExtensionDependency,Te as $getExtensionOutput,Be as $getPeerDependency,ie as $isDecoratorTextNode,Ye as $isHorizontalRuleNode,Gt as AutoFocusExtension,Ht as ClearEditorExtension,Qt as ClickAfterLastBlockExtension,ae as DecoratorTextExtension,ne as DecoratorTextNode,ue as EditorStateExtension,qe as HorizontalRuleExtension,Ze as HorizontalRuleNode,Ge as INSERT_HORIZONTAL_RULE_COMMAND,Ie as InitialStateExtension,Le as LexicalBuilder,Qe as NestedEditorExtension,We as NodeSelectionExtension,tn as NormalizeInlineElementsExtension,nn as NormalizeTripleClickSelectionExtension,on as SelectionAlwaysOnDisplayExtension,cn as TabIndentationExtension,oe as applyFormatFromStyle,se as applyFormatToDom,bt as batch,ke as buildEditorFromExtensions,Kt as computed,Vt as effect,je as getExtensionDependencyFromEditor,Xt as getKnownTypesAndNodes,Ke as getPeerDependencyFromEditor,ze as getPeerDependencyFromEditorOrThrow,Wt as namedSignals,Jt as registerClearEditor,rn as registerTabIndentation,At as signal,Ot as untracked,de as watchedSignal};
package/package.json CHANGED
@@ -6,7 +6,7 @@
6
6
  "extension",
7
7
  "plugin"
8
8
  ],
9
- "version": "0.45.0",
9
+ "version": "0.45.1-nightly.20260529.0",
10
10
  "license": "MIT",
11
11
  "repository": {
12
12
  "type": "git",
@@ -24,9 +24,9 @@
24
24
  "module": "./dist/LexicalExtension.mjs",
25
25
  "dependencies": {
26
26
  "@preact/signals-core": "^1.14.1",
27
- "@lexical/internal": "0.45.0",
28
- "@lexical/utils": "0.45.0",
29
- "lexical": "0.45.0"
27
+ "@lexical/internal": "0.45.1-nightly.20260529.0",
28
+ "lexical": "0.45.1-nightly.20260529.0",
29
+ "@lexical/utils": "0.45.1-nightly.20260529.0"
30
30
  },
31
31
  "exports": {
32
32
  ".": {