@lexical/extension 0.50.0 → 0.50.1-nightly.20260903.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.
|
@@ -568,9 +568,9 @@ function formatDevErrorMessage(message) {
|
|
|
568
568
|
*
|
|
569
569
|
*/
|
|
570
570
|
|
|
571
|
-
// `"0.50.0+dev.cjs"` is statically replaced with the build-specific
|
|
571
|
+
// `"0.50.1-nightly.20260903.0+dev.cjs"` 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.50.0+dev.cjs"` member
|
|
573
|
+
// inject it the same way — so the exact `"0.50.1-nightly.20260903.0+dev.cjs"` 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,7 +579,7 @@ function formatDevErrorMessage(message) {
|
|
|
579
579
|
// `pnpm run update-version`.
|
|
580
580
|
let envLexicalVersion;
|
|
581
581
|
try {
|
|
582
|
-
envLexicalVersion = "0.50.0+dev.cjs";
|
|
582
|
+
envLexicalVersion = "0.50.1-nightly.20260903.0+dev.cjs";
|
|
583
583
|
} catch (_unused) {
|
|
584
584
|
// `process` is not defined in some browser bundles; use the fallback.
|
|
585
585
|
}
|
|
@@ -567,9 +567,9 @@ function formatDevErrorMessage(message) {
|
|
|
567
567
|
*
|
|
568
568
|
*/
|
|
569
569
|
|
|
570
|
-
// `"0.50.0+dev.esm"` is statically replaced with the build-specific
|
|
570
|
+
// `"0.50.1-nightly.20260903.0+dev.esm"` is statically replaced with the build-specific
|
|
571
571
|
// version string in a Rollup build, and a consumer's bundler `define` can
|
|
572
|
-
// inject it the same way — so the exact `"0.50.0+dev.esm"` member
|
|
572
|
+
// inject it the same way — so the exact `"0.50.1-nightly.20260903.0+dev.esm"` member
|
|
573
573
|
// expression must be preserved for that substitution to match. Reading it
|
|
574
574
|
// inside a try/catch lets the source be consumed directly (via the `source`
|
|
575
575
|
// export condition) in a browser bundle, where `process` is undefined and
|
|
@@ -578,7 +578,7 @@ function formatDevErrorMessage(message) {
|
|
|
578
578
|
// `pnpm run update-version`.
|
|
579
579
|
let envLexicalVersion;
|
|
580
580
|
try {
|
|
581
|
-
envLexicalVersion = "0.50.0+dev.esm";
|
|
581
|
+
envLexicalVersion = "0.50.1-nightly.20260903.0+dev.esm";
|
|
582
582
|
} catch (_unused) {
|
|
583
583
|
// `process` is not defined in some browser bundles; use the fallback.
|
|
584
584
|
}
|
|
@@ -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 o(){if(l>1)return void l--;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!==s;){let n=s;for(s=void 0,d++;void 0!==n;){const o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&y(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=o}}if(d=0,l--,t)throw e}function i(e){if(l>0)return e();f=++u,l++;try{return e()}finally{o()}}let r,s;function a(e){const t=r;r=void 0;try{return e()}finally{r=t}}let c,l=0,d=0,u=0,f=0,g=0;function p(e){if(void 0===r)return;let t=e.n;return void 0===t||t.t!==r?(t={i:0,S:e,p:r.s,n:void 0,t:r,e:void 0,x:void 0,r:t},void 0!==r.s&&(r.s.n=t),r.s=t,e.n=t,32&r.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=r.s,t.n=void 0,r.s.n=t,r.s=t),t):void 0}function h(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 h(e,t)}function y(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 E(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 x(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 S(e,t){h.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 v(e,t){return new S(e,t)}function b(e){const t=e.m;if(e.m=void 0,"function"==typeof t){l++;const n=r;r=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,N(e),t}finally{r=n,o()}}}function N(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,b(e)}function _(e){if(r!==this)throw new Error("Out-of-order effect");x(this),r=e,this.f&=-2,8&this.f&&N(this),o()}function R(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 O(e,t){const n=new R(e,t);try{n.c()}catch(e){throw n.d(),e}const o=n.d.bind(n);return o[Symbol.dispose]=o,o}function $(e,t={}){const n={};for(const o in e){const i=t[o],r=m(void 0===i?e[o]:i);n[o]=r}return n}h.prototype.brand=n,h.prototype.h=function(){return!0},h.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)}))},h.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)}))}},h.prototype.subscribe=function(e){return O(()=>{const t=this.value,n=r;r=void 0;try{e(t)}finally{r=n}},{name:"sub"})},h.prototype.valueOf=function(){return this.value},h.prototype.toString=function(){return this.value+""},h.prototype.toJSON=function(){return this.value},h.prototype.peek=function(){const e=r;r=void 0;try{return this.value}finally{r=e}},Object.defineProperty(h.prototype,"value",{get(){const e=p(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(d>100)throw new Error("Cycle detected");!function(e){0!==l&&0===d&&e.l!==f&&(e.l=f,c={S:e,v:e.v,i:e.i,o:c})}(this),this.v=e,this.i++,g++,l++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{o()}}}}),S.prototype=new h,S.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&&!y(this))return this.f&=-2,!0;const e=r;try{E(this),r=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 r=e,x(this),this.f&=-2,!0},S.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)}h.prototype.S.call(this,e)},S.prototype.U=function(e){if(void 0!==this.t&&(h.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)}},S.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(S.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=p(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),R.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()}},R.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,b(this),E(this),l++;const e=r;return r=this,_.bind(this,e)},R.prototype.N=function(){2&this.f||(this.f|=2,this.u=s,s=this)},R.prototype.d=function(){this.f|=8,1&this.f||N(this)},R.prototype.dispose=function(){this.d()};const C={build:(e,t,n)=>$(t),config:{defaultSelection:"rootEnd",disabled:!1},name:"@lexical/extension/AutoFocus",register(t,n,o){const i=o.getOutput();return O(()=>i.disabled.value?void 0:t.registerRootListener(n=>{t.focus(()=>{const t=null!==n?e.getActiveElement(n):null;null===n||null!==t&&n.contains(t)||n.focus({preventScroll:!0})},{defaultSelection:i.defaultSelection.peek()})}))}};function A(){const t=e.$getRoot(),n=e.$getSelection(),o=e.$createParagraphNode();t.clear(),t.append(o),null!==n&&o.select(),e.$isRangeSelection(n)&&(n.format=0)}function M(t,n=A){return t.registerCommand(e.CLEAR_EDITOR_COMMAND,()=>(n(),!0),e.COMMAND_PRIORITY_EDITOR)}const T={build:(e,t,n)=>$(t),config:{$onClear:A},name:"@lexical/extension/ClearEditor",register(e,t,n){const{$onClear:o}=n.getOutput();return O(()=>M(e,o.value))}};function w(t){return!!e.$isDecoratorNode(t)||!(!e.$isElementNode(t)||!t.isShadowRoot())}function D(t,n,o,i){return!!t.isEditable()&&(o.target===n&&t.read("latest",()=>{const n=e.$getRoot().getLastChild();if(null===n)return!1;const r=t.getElementByKey(n.getKey());return null!==r&&(!(o.clientY<=r.getBoundingClientRect().bottom)&&i(n))}))}const I={build:(e,t)=>$(t),config:{$shouldInsertAfter:w,disabled:!1},name:"@lexical/ClickAfterLastBlock",register:(t,n,o)=>O(()=>{const n=o.getOutput();if(!n.disabled.value)return t.registerRootListener(o=>{if(null===o)return;return e.registerEventListeners(o,{click:i=>{D(t,o,i,n.$shouldInsertAfter.peek())&&(i.preventDefault(),e.stopLexicalPropagation(i),t.update(()=>{const t=e.$getRoot().getLastChild();if(null===t)return;if(!n.$shouldInsertAfter.peek()(t))return;const o=e.$createParagraphNode();t.insertAfter(o),o.select()}))},mousedown:e=>{D(t,o,e,n.$shouldInsertAfter.peek())&&e.preventDefault()}},!0)})})};function k(t){const n=new Set,o=new Set;for(const i of F(t)){const t="function"==typeof i?i:i.replace;e.getStaticNodeConfig(t),n.add(t.getType()),o.add(t)}return{nodes:o,types:n}}function F(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}const L=/* @__PURE__ */e.createState("format",{parse:e=>"number"==typeof e?e:0});class P extends e.DecoratorNode{get __isInlineFormattable(){return!0}$config(){return this.config("decorator-text",{extends:e.DecoratorNode,stateConfigs:[{flat:!0,stateConfig:L}]})}getFormat(t){return e.$getState(this,L,t)}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,L,t)}toggleFormat(t){const n=this.getFormat(),o=e.toggleTextFormatType(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(t,n){return e.$getDocument().createElement("span")}}function K(e,t,n=B){let o=t;for(const[t,i]of Object.entries(n))e.hasFormat(i)&&(o=j(o,t));return o}const z=K;function j(e,t){const n=e.ownerDocument.createElement(t);return n.appendChild(e),n}const B={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},H={name:"@lexical/extension/DecoratorText",nodes:()=>[P]};function U(e,t){let n;return m(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}const W={build:e=>U(()=>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"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw n.search=o.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.50.0+prod.cjs"}catch(e){}const V=G??'"<unknown>+source"',Z=new Set(["__proto__","constructor","prototype"]);function J(e,t){if(e&&t&&!Array.isArray(t)&&"object"==typeof e&&"object"==typeof t){const n=e,o=t;for(const e in o)!Z.has(e)&&Object.prototype.hasOwnProperty.call(o,e)&&(n[e]=J(n[e],o[e]));return e}return t}const X=0,q=1,Q=2,ee=3,te=4,ne=5,oe=6,ie=7;function re(e){return e.id===X}function se(e){return e.id===Q}function ae(e){return function(e){return e.id===q}(e)||Y(305,String(e.id),String(q)),Object.assign(e,{id:Q})}const ce=new Set;class le{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:X}}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;se(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)},o={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:ee,registerState:n})}(t,this.mergeConfigs(),n);let r;this.state=i,this.extension.init&&(r=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:te,initResult:t,registerState:n})}(i,r,o)}build(e){const t=this.state;let n;t.id!==te&&Y(307,String(t.id),String(ne)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));const o={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:ne,output:t,registerState:n})}(t,n,o)}register(e,t){this._signal=t;const n=this.state;n.id!==ne&&Y(308,String(n.id),String(ne));const o=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:oe})}(n),()=>{const e=this.state;e.id!==ie&&Y(309,String(n.id),String(ie)),this.state=function(e){return Object.assign(e,{id:ne})}(e),o&&o()}}afterRegistration(e){const t=this.state;let n;return t.id!==oe&&Y(310,String(t.id),String(oe)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:ie})}(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>=te}(e)||Y(313,String(e.id),String(te)),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>=ee}(e)||Y(314,String(e.id),String(ee)),{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>=ie}(e)||Y(316,String(e.id),String(ie)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||ce}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>=ne})(e)||Y(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}}const de={tag:e.HISTORY_MERGE_TAG};function ue(){const t=e.$getRoot();t.isEmpty()&&t.append(e.$createParagraphNode())}const fe={config:{setOptions:de,updateOptions:de},init:({$initialEditorState:e=ue})=>({$initialEditorState:e,initialized:!1}),afterRegistration(t,{updateOptions:n,setOptions:o},i){const r=i.getInitResult();if(!r.initialized){r.initialized=!0;const{$initialEditorState:i}=r;if(e.$isEditorState(i))t.setEditorState(i,o);else if("function"==typeof i)t.update(()=>{i(t)},n);else if(i&&("string"==typeof i||"object"==typeof i)){const e=t.parseEditorState(i);t.setEditorState(e,o)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[e.RootNode,e.TextNode,e.LineBreakNode,e.TabNode,e.ParagraphNode]},ge=Symbol.for("@lexical/extension/LexicalBuilder");function pe(){}function he(e){throw e}function me(e){return Array.isArray(e)?e:[e]}const ye=V;class Ee{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=ye,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[me(fe)];for(const n of e)t.push(me(n));return new Ee(t)}static maybeFromEditor(e){const t=e[ge];return t&&(t.PACKAGE_VERSION!==ye&&Y(292,t.PACKAGE_VERSION,ye),t instanceof Ee||Y(293)),t}static fromEditor(e){const t=Ee.maybeFromEditor(e);return void 0===t&&Y(294),t}constructEditor(){const{$initialEditorState:t,onError:n,onWarn:o,...i}=this.buildCreateEditorArgs(),r=Object.assign(e.createEditor({...i,...n?{onError:e=>{n(e,r)}}:{},...o?{onWarn:e=>{o(e,r)}}:{}}),{[ge]:this});for(const e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let t=pe;function n(){try{t()}finally{t=pe}}const o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=e.mergeRegister(this.registerEditor(o),()=>o.setRootElement(null)),o}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 o=this.outgoingConfigEdges.get(e);if(o){const e=o.get(t);e?e.push(...n):o.set(t,n)}else this.outgoingConfigEdges.set(e,new Map([[t,n]]));const i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&Y(296);const t=me(e),[n]=t;"string"!=typeof n.name&&Y(297,typeof n.name);let o=this.extensionNameMap.get(n.name);if(void 0!==o&&o.extension!==n&&Y(298,n.name),!o){o=new le(this,n),this.extensionNameMap.set(n.name,o);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=me(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,o)=>{let i=n.state;if(se(i))return;const r=n.extension.name;var s;re(i)||Y(300,r,o||"[unknown]"),re(s=i)||Y(304,String(s.id),String(X)),i=Object.assign(s,{id:q}),n.state=i;const a=this.outgoingConfigEdges.get(r);if(a)for(const e of a.keys()){const n=this.extensionNameMap.get(e);n&&t(n,r)}i=ae(i),n.state=i,e.push(n)};for(const e of this.extensionNameMap.values())re(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(),o=new AbortController,i=[()=>o.abort()],r=o.signal;for(const e of n){const n=e.register(t,r);n&&i.push(n)}for(const e of n){const n=e.afterRegistration(t);n&&i.push(n)}return e.mergeRegister(...i)}buildCreateEditorArgs(){const e={},t=new Set,n=new Map,o=new Map,i={},r={},s=this.sortedExtensionReps();for(const a of s){const{extension:s}=a;if(void 0!==s.onError&&(e.onError=s.onError),void 0!==s.onWarn&&(e.onWarn=s.onWarn),void 0!==s.disableEvents&&(e.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(e.parentEditor=s.parentEditor),void 0!==s.editable&&(e.editable=s.editable),void 0!==s.namespace&&(e.namespace=s.namespace),void 0!==s.$initialEditorState&&(e.$initialEditorState=s.$initialEditorState),s.nodes)for(const e of F(s)){if("function"!=typeof e){const t=n.get(e.replace);t&&Y(302,s.name,e.replace.name,t.extension.name),n.set(e.replace,a)}t.add(e)}if(s.html){if(s.html.export)for(const[e,t]of s.html.export.entries())o.set(e,t);s.html.import&&Object.assign(i,s.html.import)}s.theme&&J(r,s.theme)}Object.keys(r).length>0&&(e.theme=r),t.size&&(e.nodes=[...t]);const a=Object.keys(i).length>0,c=o.size>0;(a||c)&&(e.html={},a&&(e.html.import=i),c&&(e.html.export=o));for(const t of s)t.init(e);return e.onError||(e.onError=he),e}}function xe(e,t){const n=Ee.fromEditor(e).getExtensionRep(t);return void 0===n&&Y(303,t.name),n.getExtensionDependency()}function Se(e,t){const n=Ee.maybeFromEditor(e);if(!n)return;const o=n.extensionNameMap.get(t);return o?o.getExtensionDependency():void 0}function ve(t){return xe(e.$getEditor(),t)}const be={root:{children:[],direction:null,format:"",indent:0,type:"root",version:1}};function Ne(t){const n=t.exportJSON();delete n.children,delete n.$slots;const o={json:n,key:t.__key,next:t.__next,parent:t.__parent,prev:t.__prev};e.$isElementNode(t)&&(o.first=t.__first,o.last=t.__last,o.size=t.__size);const{__slotHost:i,__slots:r}=t;return null!=r&&(o.slots=[...r]),null!=i&&(o.slotHost=i),o}function _e(t){const n=new Map,o=[],i=t.map(t=>t.read(()=>{const i=[];for(const e of t._nodeMap.values()){let t=n.get(e);void 0===t&&(t=o.length,n.set(e,t),o.push(Ne(e))),i.push(t)}return{nodes:i,selection:(r=t._selection,e.$isRangeSelection(r)?{anchor:{key:r.anchor.key,offset:r.anchor.offset,type:r.anchor.type},focus:{key:r.focus.key,offset:r.focus.offset,type:r.focus.type},format:r.format,style:r.style,type:"range"}:e.$isNodeSelection(r)?{keys:[...r._nodes],type:"node"}:null)};var r}));return{nodes:o,states:i}}function Re(e){return null!=e&&"object"==typeof e}function Oe(e){return null==e||"string"==typeof e}function $e(e){if(!Re(e))return!1;const{first:t,json:n,key:o,last:i,next:r,parent:s,prev:a,size:c,slotHost:l,slots:d}=e;return Re(n)&&"string"==typeof n.type&&"string"==typeof o&&Oe(s)&&Oe(a)&&Oe(r)&&Oe(t)&&Oe(i)&&(void 0===c||"number"==typeof c)&&Oe(l)&&(void 0===d||Array.isArray(d)&&d.every(e=>Array.isArray(e)&&2===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]))}function Ce(e){return Re(e)&&"string"==typeof e.key&&"number"==typeof e.offset&&("text"===e.type||"element"===e.type)}function Ae(e){if(!Re(e))return!1;const{nodes:t,states:n}=e;return Array.isArray(t)&&Array.isArray(n)&&t.every($e)&&n.every(e=>Re(e)&&Array.isArray(e.nodes)&&e.nodes.every(e=>"number"==typeof e&&e>=0&&e<t.length)&&function(e){return null==e||!!Re(e)&&("node"===e.type?Array.isArray(e.keys)&&e.keys.every(e=>"string"==typeof e):"range"===e.type&&Ce(e.anchor)&&Ce(e.focus)&&"number"==typeof e.format&&"string"==typeof e.style)}(e.selection))}function Me(t,n){if("root"!==t.type)return e.$parseSerializedNode(t);let o;if(n.parseEditorState({root:t},()=>{o=e.$getRoot()}),void 0===o)throw new Error("editorStateFamily: the root version did not parse");return o}function Te(t,n){const o=[],i=new Map;let r=!1,s=!1;const a=n.parseEditorState(be,()=>{for(const e of t.nodes){let t=null;try{t=Me(e.json,n)}catch(e){o.push(null);continue}const r=i.get(e.key);void 0===r?i.set(e.key,t.__key):t.__key=r,o.push(t)}const a=e=>null===e?null:i.get(e)??null;for(const[n,i]of t.nodes.entries()){const t=o[n];if(null===t)continue;t.__parent=a(i.parent),t.__prev=a(i.prev),t.__next=a(i.next),e.$isElementNode(t)&&(t.__first=a(i.first??null),t.__last=a(i.last??null),t.__size=i.size??0);const s=t;void 0!==i.slots&&(r=!0,s.__slots=new Map(i.slots.flatMap(([e,t])=>{const n=a(t);return null===n?[]:[[e,n]]}))),void 0!==i.slotHost&&(s.__slotHost=a(i.slotHost))}s=!0});return s?t.states.map(t=>{const n=new Map;for(const e of t.nodes){const t=o[e];if(null==t)return null;n.set(t.__key,t)}if(!n.has("root"))return null;const s=a.clone(function(t,n){if(null==t)return null;if("node"===t.type){const o=e.$createNodeSelection();for(const e of t.keys){const t=n.get(e);if(void 0===t)return null;o._nodes.add(t)}return o}const o=n.get(t.anchor.key),i=n.get(t.focus.key);if(void 0===o||void 0===i)return null;const r=e.$createRangeSelection();return r.anchor.key=o,r.anchor.offset=t.anchor.offset,r.anchor.type=t.anchor.type,r.focus.key=i,r.focus.offset=t.focus.offset,r.focus.type=t.focus.type,r.format=t.format,r.style=t.style,r}(t.selection,i));return s._nodeMap=n,s._slotsUsed=r,s._parsed=!1,s}):t.states.map(()=>null)}const we={build:e=>U(()=>e.getRootElement(),t=>e.registerRootListener(e=>{t.value=e})),name:"@lexical/extension/RootElement"},De={build:e=>U(()=>e.isEditable(),t=>e.registerEditableListener(e=>{t.value=e})),name:"@lexical/extension/WatchEditable"};function Ie(e,t){return function(e,t){const n=`lexicalHMR:${encodeURIComponent(t)}`;return void 0!==e?`${n}:${encodeURIComponent(e)}`:n}(""===t?void 0:t,ke(e)?e._config.namespace:"")}function ke(e){const t=Ee.maybeFromEditor(e);if(!t)return!1;for(const n of t.extensionNameMap.values()){const{namespace:t}=n.extension;if(t&&t===e._config.namespace)return!0}return null!==e._parentEditor&&ke(e._parentEditor)}function Fe(e,t){return e.data[t]}function Le(e){if(null==e||"object"!=typeof e)return!1;const t=e,n=e=>Object.prototype.hasOwnProperty.call(t,e);return n("editable")&&n("editorState")&&"boolean"==typeof t.editable&&function(e){return"object"==typeof e&&null!==e&&"function"==typeof e.toJSON&&"function"==typeof e.isEmpty}(t.editorState)}const Pe={afterRegistration(t,{hot:n,id:o},i){if(!n)return()=>{};const r=Ie(t,o),s=Se(t,"@lexical/history/History");let a=!1;const c=Fe(n,r);if(Le(c))try{t.setEditable(c.editable);const n="function"==typeof c.serialize?c.serialize():null;if(function(e){if(null==e||"object"!=typeof e)return!1;const{family:t,history:n}=e;if(!Ae(t))return!1;if(null==n)return!0;const o=e=>"number"==typeof e&&e>=0&&e<t.states.length,{current:i,redoStack:r,undoStack:s}=n;return(null===i||o(i))&&Array.isArray(r)&&r.every(o)&&Array.isArray(s)&&s.every(o)}(n)){const o=Te(n.family,t),i=o[0];null==i||i.isEmpty()||(i._parsed=!0,t.setEditorState(i,{tag:e.HISTORY_MERGE_TAG}),null!=n.history&&s&&(s.output.historyState.value=function(e,t,n){const o=e=>{const o=t[e];return null==o||o.isEmpty()?null:{editor:n,editorState:o}},i=e=>e.map(o).filter(e=>null!==e),r=null===e.current?null:o(e.current),s=i(e.undoStack);return{current:r,redoStack:i(e.redoStack),undoStack:s}}(n.history,o,t)),a=!0)}else;}catch(e){}a&&i.getInitResult().restoreCount.value++;const l=i.getDependency(W).output,d=i.getDependency(De).output,u=i.getDependency(we).output;let f=null;return O(()=>{const e=l.value,o=d.value,i=null!==u.value,a=Fe(n,r);if(null!==f&&f.editorState===e&&f.editable===o)return void(Le(a)&&a.owner===t&&(a.mounted=i));f={editable:o,editorState:e};const c={...(e.isEmpty()&&Le(a)?a:null)??{editorState:e,serialize:()=>function(e,t,n){const o=[t],i=t=>t.editor===e,r=e=>o.push(e.editorState)-1,s=e=>e.filter(i).map(r),a=n?{current:n.current&&i(n.current)?r(n.current):null,redoStack:s(n.redoStack),undoStack:s(n.undoStack)}:null;return{family:_e(o),history:a}}(t,e,s?s.output.historyState.peek():null)},editable:o,mounted:i,owner:t};n.data[r]=c})},build:(e,t,n)=>n.getInitResult(),config:{hot:null},dependencies:[W,we,De],init:()=>({restoreCount:m(0)}),name:"@lexical/extension/HMR"},Ke=new Set,ze={build(t,n,o){const i=o.getDependency(W).output,r=m({watchedNodeKeys:new Map}),s=U(()=>{},()=>O(()=>{const t=s.peek(),{watchedNodeKeys:n}=r.value;let o,a=!1;i.value.read(()=>{if(e.$getSelection())for(const[i,r]of n.entries()){if(0===r.size){n.delete(i);continue}const s=e.$getNodeByKey(i),c=s&&s.isSelected()||!1;a=a||c!==(!!t&&t.has(i)),c&&(o=o||new Set,o.add(i))}}),!a&&o&&t&&o.size===t.size||(s.value=o)}));return{watchNodeKey:function(e){const t=v(()=>(s.value||Ke).has(e)),{watchedNodeKeys:n}=r.peek();let o=n.get(e);const i=void 0!==o;return o=o||new Set,o.add(t),i||(n.set(e,o),r.value={watchedNodeKeys:n}),t}}},dependencies:[W],name:"@lexical/extension/NodeSelection"},je=/* @__PURE__ */e.createCommand("INSERT_HORIZONTAL_RULE_COMMAND");class Be extends e.DecoratorNode{$config(){return this.config("horizontalrule",{importDOM:{hr:()=>({conversion:He,priority:0})}})}exportDOM(){return{element:e.$getDocument().createElement("hr")}}createDOM(t){const n=e.$getDocument().createElement("hr");return e.addClassNamesToElement(n,t.theme.hr),n}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function He(){return{node:Ue()}}function Ue(){return e.$create(Be)}function We(e){return e instanceof Be}const Ye={dependencies:[W,ze],name:"@lexical/extension/HorizontalRule",nodes:()=>[Be],register(n,o,r){const{watchNodeKey:s}=r.getDependency(ze).output,a=m({nodeSelections:new Map}),c=n._config.theme.hrSelected??"selected";return e.mergeRegister(n.registerCommand(je,n=>{const o=e.$getSelection();if(!e.$isRangeSelection(o))return!1;if(null!==o.focus.getNode()){const e=Ue();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(We(n))return function(t,n=!1){const o=e.$getSelection(),i=t.isSelected(),r=t.getKey();let s;n&&e.$isNodeSelection(o)?s=o:(s=e.$createNodeSelection(),e.$setSelection(s)),i?s.delete(r):s.add(r)}(n,t.shiftKey),!0}return!1},e.COMMAND_PRIORITY_LOW),n.registerMutationListener(Be,(e,t)=>{i(()=>{let t=!1;const{nodeSelections:o}=a.peek();for(const[i,r]of e.entries())if("destroyed"===r)o.delete(i),t=!0;else{const e=o.get(i),r=n.getElementByKey(i);e?e.domNode.value=r:(t=!0,o.set(i,{domNode:m(r),selectedSignal:s(i)}))}t&&(a.value={nodeSelections:o})})}),O(()=>{const t=[];for(const{domNode:n,selectedSignal:o}of a.value.nodeSelections.values())t.push(O(()=>{const t=n.value;if(t){o.value?e.addClassNamesToElement(t,c):e.removeClassNamesFromElement(t,c)}}));return e.mergeRegister(...t)}))}},Ge={build:e=>({composingTextNode:m(null),compositionKey:m(null)}),name:"@lexical/extension/IME",register(t,n,o){const{compositionKey:i,composingTextNode:r}=o.getOutput(),s=t.registerCommand(e.COMPOSITION_START_COMMAND,()=>{const t=e.$getSelection();return e.$isRangeSelection(t)&&(i.value=t.anchor.key),!1},e.COMMAND_PRIORITY_BEFORE_EDITOR),a=O(()=>{const n=i.value;r.value=null!==n?t.read("latest",()=>{const t=e.$getNodeByKey(n);return e.$isTextNode(t)?t:null}):null}),c=t.registerUpdateListener(({tags:t,editorState:n})=>{t.has(e.COMPOSITION_START_TAG)&&n.read(()=>{const t=e.$getSelection();if(!e.$isRangeSelection(t))return;const n=t.anchor.getNode();e.$isTextNode(n)&&(r.value=n)})}),l=t.registerRootListener(t=>{if(null===t)return void(i.value=null);return e.registerEventListener(t,"compositionend",()=>{i.value=null})});return e.mergeRegister(s,a,c,l)}},Ve=[["ctrlKey","Ctrl"],["altKey","Alt"],["shiftKey","Shift"],["metaKey","Meta"]],Ze={" ":"Space"},Je={...Ze,Alt:"\u2325",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",ArrowUp:"\u2191",Backspace:"\u232b",CapsLock:"\u21ea",Ctrl:"\u2303",Delete:"\u2326",End:"\u2198",Enter:"\u21a9",Escape:"\u238b",Home:"\u2196",Meta:"\u2318",PageDown:"\u21df",PageUp:"\u21de",Shift:"\u21e7",Tab:"\u21e5"},Xe={...Je,Tab:"\u21e4"};function qe(e){return function(e){return Array.isArray(e)}(e)?e:e?[e]:[]}const Qe={build:(e,t,n)=>$(t),config:{disabled:!1,priority:e.COMMAND_PRIORITY_NORMAL,shortcuts:{}},mergeConfig(t,n){const o=e.shallowMergeConfig(t,n);return o.shortcuts=function(e,t){if(!t)return e;const n={...t};for(const[t,o]of Object.entries(e))void 0===n[t]&&(n[t]=o);return n}(t.shortcuts,n.shortcuts),o},name:"@lexical/extension/KeyboardShortcuts",register(t,n,o){const{disabled:i,priority:r,shortcuts:s}=o.getOutput();return O(()=>{if(!i.value){const n=[];for(const e of Object.values(s.value))for(const t of qe(e))n.push(t);return function(t,n,o){const i=e.compileKeyboardShortcuts(n);return t.registerCommand(e.KEY_DOWN_COMMAND,(n,o)=>{let r;for(const s of i.matches(n)){if(t!==o&&!s.bubbleFromNestedEditors)continue;if(s.$disabled&&(void 0===r&&(r=e.$getSelection()),s.$disabled(r,o)))continue;const i=o.dispatchCommand.bind(o,s.command,n);if(s.$dispatch?s.$dispatch(s.command,n,i,o):i())return!0}return!1},o)}(t,n,r.value)}})}};const et={build:(e,t)=>$({inheritEditableFromParent:t.inheritEditableFromParent}),config:{$getParentEditor:function(){const t=e.$getEditor();return Ee.fromEditor(t),t},inheritEditableFromParent:!1},init:(e,t,n)=>{const o=t.$getParentEditor();e.parentEditor=o,e.theme=e.theme||o._config.theme},name:"@lexical/extension/NestedEditor",register:(e,t,n)=>O(()=>{const t=e._parentEditor;if(t&&n.getOutput().inheritEditableFromParent.value)return e.setEditable(t.isEditable()),t.registerEditableListener(e.setEditable.bind(e))})},tt={config:{attribute:"data-selected",nodes:[]},init(t,n){const o=new Set,i=e.getRegisteredSubtypeMap(k(t).nodes);for(const e of n.nodes){const t=e.getType(),n=i.get(t);void 0===n&&Y(339,e.name,t),o.add(t);for(const e of n)o.add(e)}return{matchTypes:o}},mergeConfig:(t,n)=>e.shallowMergeConfig(t,{...n,...n.nodes&&{nodes:[...t.nodes,...n.nodes]}}),name:"@lexical/extension/NodeSelectionDataSelected",register(t,n,o){const{attribute:i}=n,{matchTypes:r}=o.getInitResult(),s=new Map,a=n=>{const o=new Set;n.read(()=>{const t=e.$getSelection();if(e.$isNodeSelection(t))for(const e of t.getNodes())r.has(e.getType())&&o.add(e.getKey())});for(const[e,t]of s)o.has(e)||(t.removeAttribute(i),s.delete(e));for(const e of o){const n=t.getElementByKey(e);null!==n&&(n.setAttribute(i,"true"),s.set(e,n))}};a(t.getEditorState());const c=t.registerUpdateListener(({editorState:e})=>a(e));return()=>{c();for(const e of s.values())e.removeAttribute(i);s.clear()}}};function nt(t){e.$isElementNode(t)&&t.isInline()&&t.isEmpty()&&t.remove()}const ot={build:(e,t,n)=>$(t),config:{disabled:!1},name:"@lexical/NormalizeInlineElements",register:(t,n,o)=>{const i=o.getOutput();return O(()=>{if(!i.disabled.value){const n=[];for(const{klass:o,transforms:i}of t._nodes.values())o.prototype instanceof e.ElementNode&&o.prototype.isInline!==e.ElementNode.prototype.isInline&&(i.add(nt),n.push(()=>i.delete(nt)));return()=>n.forEach(e=>e())}})}},it=new Set([e.SKIP_SELECTION_FOCUS_TAG,e.SKIP_SCROLL_INTO_VIEW_TAG]);const rt={build:(e,t,n)=>$(t),config:{$fixFocusOverselection:function(){const t=e.$getSelection();if(e.$isRangeSelection(t)&&!t.isCollapsed()){const n=e.$getCaretRangeInDirection(e.$caretRangeFromSelection(t),"next");let o=n.focus;for(e.$isTextPointCaret(o)&&n.anchor.origin!==o.origin&&0===o.offset&&(o=e.$rewindSiblingCaret(o.getSiblingCaret())),e.$isSiblingCaret(o)&&n.anchor.origin!==o.origin&&e.$isLineBreakNode(o.origin)&&(o=e.$rewindSiblingCaret(o));e.$isChildCaret(o)&&n.anchor.origin!==o.origin;)o=e.$rewindSiblingCaret(e.$getSiblingCaret(o.origin,"next"));if(e.$isSiblingCaret(o)&&e.$isElementNode(o.origin)&&(o=e.$normalizeCaret(e.$getChildCaret(o.origin,"previous")).getFlipped()),o=e.$normalizeCaret(o),!o.isSamePointCaret(n.focus)){const t=e.$setSelectionFromCaretRange(e.$getCaretRange(n.anchor,o)),i=e.$getEditor().getRootElement(),r=i&&e.getDOMSelection(i.ownerDocument.defaultView);r&&e.$updateDOMSelection(e.$getPreviousSelection(),t,e.$getEditor(),r,it,i)}}},dateNow:Date.now,disabled:!1,thresholdMsec:100},name:"@lexical/NormalizeTripleClickSelection",register:(t,n,o)=>O(()=>{const n=o.getOutput();if(!n.disabled.value)return t.registerRootListener(o=>{if(!o)return;let i=0;const r=e=>{if(e?e.detail>2:i>0){const t=n.dateNow.peek()();i=e&&"mousedown"===e.type||t-i<=n.thresholdMsec.peek()?t:0}return i};return e.mergeRegister(t.registerCommand(e.SELECTION_CHANGE_COMMAND,()=>(r(null)&&(i=0,n.$fixFocusOverselection.peek()()),!1),e.COMMAND_PRIORITY_BEFORE_CRITICAL),e.registerEventListeners(o,{mousedown:r,mouseup:r},!0))})})};function st(t){const n=t.target;e.isExactShortcutMatch(t,"a",e.CONTROL_OR_META)&&e.isHTMLElement(n)&&("INPUT"===n.tagName||"TEXTAREA"===n.tagName)&&n.addEventListener("keydown",e.stopLexicalPropagation,{once:!0})}const at={build:(e,t,n)=>$(t),config:{disabled:!1},name:"@lexical/extension/PreventSelectAll",register:(t,n,o)=>{const i=o.getOutput();return O(()=>{if(!i.disabled.value)return t.registerRootListener(t=>{if(t)return e.registerEventListener(t,"keydown",st,!0)})})}};const ct={build:(e,t,n)=>$(t),config:{cascadeSelection:!1,disabled:!1},dependencies:[at],name:"@lexical/extension/SelectBlock",register:(t,n,o)=>{const i=o.getOutput(),r=o.getDependency(at).output;return e.mergeRegister(O(()=>{r.disabled.value=i.disabled.value}),O(()=>{if(!i.disabled.value)return t.registerCommand(e.SELECT_ALL_COMMAND,(n,o)=>{if(o!==t){if(!i.cascadeSelection.peek())return!1;return!!o.read("pending",()=>{const t=e.$getSelection();return e.$isRangeSelection(t)&&e.$isBlockFullySelected(e.$getRoot(),t)})&&(e.$selectAll(),!0)}const r=e.$getSelection();if(e.$isNodeSelection(r)){const t=r.getNodes(),n=t[0];if(!n)return!1;const o=n.getTopLevelElement();return!o||e.$isRootNode(o)||o.is(n)||t.length>1&&(s=o,!t.every(e=>s.is(e.getTopLevelElement())))?e.$selectAll():e.$isElementNode(o)&&o.select(0,o.getChildrenSize()),!0}var s;if(!e.$isRangeSelection(r))return!1;const a=r.anchor.getNode(),c=a.getTopLevelElement();if(c&&c.is(r.focus.getNode().getTopLevelElement())&&!e.$isBlockFullySelected(c,r))return c.select(0,c.getChildrenSize()),!0;let l=e.$getSlotFrame(a);for(;null!==l;){if(e.$isElementNode(l)&&!e.$isBlockFullySelected(l,r))return l.select(0,l.getChildrenSize()),!0;const t=e.$getSlotHost(l);l=null===t?null:e.$getSlotFrame(t)}return e.$isBlockFullySelected(e.$getRoot(),r)||e.$selectAll(),!0},e.COMMAND_PRIORITY_LOW)}))}},lt={build:(e,t,n)=>$(t),config:{disabled:!1,onReposition:void 0},name:"@lexical/utils/SelectionAlwaysOnDisplay",register:(e,n,o)=>{const i=o.getOutput();return O(()=>{if(!i.disabled.value)return t.selectionAlwaysOnDisplay(e,i.onReposition.value)})}};function dt(e){return e.canIndent()}function ut(n,o,i=dt){return e.mergeRegister(n.registerCommand(e.KEY_TAB_COMMAND,o=>{const i=e.$getSelection();if(!e.$isRangeSelection(i))return!1;o.preventDefault();const r=function(n){if(n.getNodes().filter(t=>e.$isBlockElementNode(t)&&t.canIndent()).length>0)return!0;const o=n.anchor,i=n.focus,r=i.isBefore(o)?i:o,s=r.getNode(),a=t.$getNearestBlockElementAncestorOrThrow(s);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(r))return!0}return!1}(i)?o.shiftKey?e.OUTDENT_CONTENT_COMMAND:e.INDENT_CONTENT_COMMAND:e.INSERT_TAB_COMMAND;return n.dispatchCommand(r)},e.COMMAND_PRIORITY_EDITOR),n.registerCommand(e.INDENT_CONTENT_COMMAND,()=>{const n="number"==typeof o?o:o?o.peek():null,r=e.$getSelection();if(!e.$isRangeSelection(r))return!1;const s="function"==typeof i?i:i.peek();return t.$handleIndentAndOutdent(e=>{if(s(e)){const t=e.getIndent()+1;(!n||t<n)&&e.setIndent(t)}})},e.COMMAND_PRIORITY_CRITICAL))}const ft={build:(e,t,n)=>$(t),config:{$canIndent:dt,disabled:!1,maxIndent:null},name:"@lexical/extension/TabIndentation",register(e,t,n){const{disabled:o,maxIndent:i,$canIndent:r}=n.getOutput();return O(()=>{if(!o.value)return ut(e,i,r)})}};exports.CONTROL_OR_ALT=e.CONTROL_OR_ALT,exports.CONTROL_OR_META=e.CONTROL_OR_META,exports.compileKeyboardShortcuts=e.compileKeyboardShortcuts,exports.configExtension=e.configExtension,exports.declarePeerDependency=e.declarePeerDependency,exports.defineExtension=e.defineExtension,exports.safeCast=e.safeCast,exports.shallowMergeConfig=e.shallowMergeConfig,exports.$applyFormatToDom=z,exports.$createHorizontalRuleNode=Ue,exports.$defaultShouldInsertAfter=w,exports.$getExtensionDependency=ve,exports.$getExtensionOutput=function(e){return ve(e).output},exports.$getPeerDependency=function(t){return Se(e.$getEditor(),t)},exports.$isDecoratorTextNode=function(e){return e instanceof P},exports.$isHorizontalRuleNode=We,exports.AutoFocusExtension=C,exports.ClearEditorExtension=T,exports.ClickAfterLastBlockExtension=I,exports.DecoratorTextExtension=H,exports.DecoratorTextNode=P,exports.EditorStateExtension=W,exports.HMRExtension=Pe,exports.HorizontalRuleExtension=Ye,exports.HorizontalRuleNode=Be,exports.IMEExtension=Ge,exports.INSERT_HORIZONTAL_RULE_COMMAND=je,exports.InitialStateExtension=fe,exports.KeyboardShortcutsExtension=Qe,exports.LexicalBuilder=Ee,exports.NestedEditorExtension=et,exports.NodeSelectionDataSelectedExtension=tt,exports.NodeSelectionExtension=ze,exports.NormalizeInlineElementsExtension=ot,exports.NormalizeTripleClickSelectionExtension=rt,exports.PreventSelectAllExtension=at,exports.RootElementExtension=we,exports.SelectBlockExtension=ct,exports.SelectionAlwaysOnDisplayExtension=lt,exports.TabIndentationExtension=ft,exports.WatchEditableExtension=De,exports.applyFormatFromStyle=function(e,t,n){const o=t.fontWeight,i=t.textDecoration.split(" "),r="700"===o||"bold"===o,s=i.includes("line-through"),a="italic"===t.fontStyle,c=i.includes("underline"),l=t.verticalAlign;return r&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),a&&!e.hasFormat("italic")&&e.toggleFormat("italic"),c&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==l||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==l||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e},exports.applyFormatToDom=K,exports.batch=i,exports.buildEditorFromExtensions=function(...e){return Ee.fromExtensions(e).buildEditor()},exports.computed=v,exports.effect=O,exports.formatKeyboardShortcut=function(t,n={}){const{isApple:o=e.IS_APPLE}=n,{unshiftedKey:i,key:r}=t,s=e.keyboardEventMaskForPlatform(t.modifiers||{},o),a=[],c=o?!0===s.shiftKey?Xe:Je:Ze;for(const[e,t]of Ve)if(!0===s[e]){if(o&&"shiftKey"===e&&i&&1===r.length)continue;a.push(c[t]||t)}return a.push(c[r]||!o&&!0===s.shiftKey&&i||1===r.length&&r.toUpperCase()||r),a},exports.getExtensionDependencyFromEditor=xe,exports.getKnownTypesAndNodes=k,exports.getPeerDependencyFromEditor=Se,exports.getPeerDependencyFromEditorOrThrow=function(e,t){const n=Se(e,t);return void 0===n&&Y(291,t),n},exports.namedSignals=$,exports.registerClearEditor=M,exports.registerTabIndentation=ut,exports.signal=m,exports.untracked=a,exports.watchedSignal=U;
|
|
9
|
+
"use strict";var e=require("lexical"),t=require("@lexical/utils");const n=Symbol.for("preact-signals");function o(){if(l>1)return void l--;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!==s;){let n=s;for(s=void 0,d++;void 0!==n;){const o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&y(n))try{n.c()}catch(n){t||(e=n,t=!0)}n=o}}if(d=0,l--,t)throw e}function i(e){if(l>0)return e();f=++u,l++;try{return e()}finally{o()}}let r,s;function a(e){const t=r;r=void 0;try{return e()}finally{r=t}}let c,l=0,d=0,u=0,f=0,g=0;function p(e){if(void 0===r)return;let t=e.n;return void 0===t||t.t!==r?(t={i:0,S:e,p:r.s,n:void 0,t:r,e:void 0,x:void 0,r:t},void 0!==r.s&&(r.s.n=t),r.s=t,e.n=t,32&r.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=r.s,t.n=void 0,r.s.n=t,r.s=t),t):void 0}function h(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 h(e,t)}function y(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 E(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 x(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 S(e,t){h.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 v(e,t){return new S(e,t)}function b(e){const t=e.m;if(e.m=void 0,"function"==typeof t){l++;const n=r;r=void 0;try{t()}catch(t){throw e.f&=-2,e.f|=8,N(e),t}finally{r=n,o()}}}function N(e){for(let t=e.s;void 0!==t;t=t.n)t.S.U(t);e.x=void 0,e.s=void 0,b(e)}function _(e){if(r!==this)throw new Error("Out-of-order effect");x(this),r=e,this.f&=-2,8&this.f&&N(this),o()}function R(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 O(e,t){const n=new R(e,t);try{n.c()}catch(e){throw n.d(),e}const o=n.d.bind(n);return o[Symbol.dispose]=o,o}function $(e,t={}){const n={};for(const o in e){const i=t[o],r=m(void 0===i?e[o]:i);n[o]=r}return n}h.prototype.brand=n,h.prototype.h=function(){return!0},h.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)}))},h.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)}))}},h.prototype.subscribe=function(e){return O(()=>{const t=this.value,n=r;r=void 0;try{e(t)}finally{r=n}},{name:"sub"})},h.prototype.valueOf=function(){return this.value},h.prototype.toString=function(){return this.value+""},h.prototype.toJSON=function(){return this.value},h.prototype.peek=function(){const e=r;r=void 0;try{return this.value}finally{r=e}},Object.defineProperty(h.prototype,"value",{get(){const e=p(this);return void 0!==e&&(e.i=this.i),this.v},set(e){if(e!==this.v){if(d>100)throw new Error("Cycle detected");!function(e){0!==l&&0===d&&e.l!==f&&(e.l=f,c={S:e,v:e.v,i:e.i,o:c})}(this),this.v=e,this.i++,g++,l++;try{for(let e=this.t;void 0!==e;e=e.x)e.t.N()}finally{o()}}}}),S.prototype=new h,S.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&&!y(this))return this.f&=-2,!0;const e=r;try{E(this),r=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 r=e,x(this),this.f&=-2,!0},S.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)}h.prototype.S.call(this,e)},S.prototype.U=function(e){if(void 0!==this.t&&(h.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)}},S.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(S.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const e=p(this);if(this.h(),void 0!==e&&(e.i=this.i),16&this.f)throw this.v;return this.v}}),R.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()}},R.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,b(this),E(this),l++;const e=r;return r=this,_.bind(this,e)},R.prototype.N=function(){2&this.f||(this.f|=2,this.u=s,s=this)},R.prototype.d=function(){this.f|=8,1&this.f||N(this)},R.prototype.dispose=function(){this.d()};const C={build:(e,t,n)=>$(t),config:{defaultSelection:"rootEnd",disabled:!1},name:"@lexical/extension/AutoFocus",register(t,n,o){const i=o.getOutput();return O(()=>i.disabled.value?void 0:t.registerRootListener(n=>{t.focus(()=>{const t=null!==n?e.getActiveElement(n):null;null===n||null!==t&&n.contains(t)||n.focus({preventScroll:!0})},{defaultSelection:i.defaultSelection.peek()})}))}};function A(){const t=e.$getRoot(),n=e.$getSelection(),o=e.$createParagraphNode();t.clear(),t.append(o),null!==n&&o.select(),e.$isRangeSelection(n)&&(n.format=0)}function M(t,n=A){return t.registerCommand(e.CLEAR_EDITOR_COMMAND,()=>(n(),!0),e.COMMAND_PRIORITY_EDITOR)}const T={build:(e,t,n)=>$(t),config:{$onClear:A},name:"@lexical/extension/ClearEditor",register(e,t,n){const{$onClear:o}=n.getOutput();return O(()=>M(e,o.value))}};function w(t){return!!e.$isDecoratorNode(t)||!(!e.$isElementNode(t)||!t.isShadowRoot())}function D(t,n,o,i){return!!t.isEditable()&&(o.target===n&&t.read("latest",()=>{const n=e.$getRoot().getLastChild();if(null===n)return!1;const r=t.getElementByKey(n.getKey());return null!==r&&(!(o.clientY<=r.getBoundingClientRect().bottom)&&i(n))}))}const I={build:(e,t)=>$(t),config:{$shouldInsertAfter:w,disabled:!1},name:"@lexical/ClickAfterLastBlock",register:(t,n,o)=>O(()=>{const n=o.getOutput();if(!n.disabled.value)return t.registerRootListener(o=>{if(null===o)return;return e.registerEventListeners(o,{click:i=>{D(t,o,i,n.$shouldInsertAfter.peek())&&(i.preventDefault(),e.stopLexicalPropagation(i),t.update(()=>{const t=e.$getRoot().getLastChild();if(null===t)return;if(!n.$shouldInsertAfter.peek()(t))return;const o=e.$createParagraphNode();t.insertAfter(o),o.select()}))},mousedown:e=>{D(t,o,e,n.$shouldInsertAfter.peek())&&e.preventDefault()}},!0)})})};function k(t){const n=new Set,o=new Set;for(const i of F(t)){const t="function"==typeof i?i:i.replace;e.getStaticNodeConfig(t),n.add(t.getType()),o.add(t)}return{nodes:o,types:n}}function F(e){return("function"==typeof e.nodes?e.nodes():e.nodes)||[]}const L=/* @__PURE__ */e.createState("format",{parse:e=>"number"==typeof e?e:0});class P extends e.DecoratorNode{get __isInlineFormattable(){return!0}$config(){return this.config("decorator-text",{extends:e.DecoratorNode,stateConfigs:[{flat:!0,stateConfig:L}]})}getFormat(t){return e.$getState(this,L,t)}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,L,t)}toggleFormat(t){const n=this.getFormat(),o=e.toggleTextFormatType(n,t,null);return this.setFormat(o)}isInline(){return!0}createDOM(t,n){return e.$getDocument().createElement("span")}}function K(e,t,n=B){let o=t;for(const[t,i]of Object.entries(n))e.hasFormat(i)&&(o=j(o,t));return o}const z=K;function j(e,t){const n=e.ownerDocument.createElement(t);return n.appendChild(e),n}const B={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},H={name:"@lexical/extension/DecoratorText",nodes:()=>[P]};function U(e,t){let n;return m(e(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=e(),n=t(this)}})}const W={build:e=>U(()=>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"),o=new URLSearchParams;o.append("code",e);for(const e of t)o.append("v",e);throw n.search=o.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.50.1-nightly.20260903.0+prod.cjs"}catch(e){}const V=G??'"<unknown>+source"',Z=new Set(["__proto__","constructor","prototype"]);function J(e,t){if(e&&t&&!Array.isArray(t)&&"object"==typeof e&&"object"==typeof t){const n=e,o=t;for(const e in o)!Z.has(e)&&Object.prototype.hasOwnProperty.call(o,e)&&(n[e]=J(n[e],o[e]));return e}return t}const X=0,q=1,Q=2,ee=3,te=4,ne=5,oe=6,ie=7;function re(e){return e.id===X}function se(e){return e.id===Q}function ae(e){return function(e){return e.id===q}(e)||Y(305,String(e.id),String(q)),Object.assign(e,{id:Q})}const ce=new Set;class le{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(e,t){this.builder=e,this.extension=t,this.configs=new Set,this.state={id:X}}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;se(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)},o={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(e,t,n){return Object.assign(e,{config:t,id:ee,registerState:n})}(t,this.mergeConfigs(),n);let r;this.state=i,this.extension.init&&(r=this.extension.init(e,i.config,n)),this.state=function(e,t,n){return Object.assign(e,{id:te,initResult:t,registerState:n})}(i,r,o)}build(e){const t=this.state;let n;t.id!==te&&Y(307,String(t.id),String(ne)),this.extension.build&&(n=this.extension.build(e,t.config,t.registerState));const o={...t.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(e,t,n){return Object.assign(e,{id:ne,output:t,registerState:n})}(t,n,o)}register(e,t){this._signal=t;const n=this.state;n.id!==ne&&Y(308,String(n.id),String(ne));const o=this.extension.register&&this.extension.register(e,n.config,n.registerState);return this.state=function(e){return Object.assign(e,{id:oe})}(n),()=>{const e=this.state;e.id!==ie&&Y(309,String(n.id),String(ie)),this.state=function(e){return Object.assign(e,{id:ne})}(e),o&&o()}}afterRegistration(e){const t=this.state;let n;return t.id!==oe&&Y(310,String(t.id),String(oe)),this.extension.afterRegistration&&(n=this.extension.afterRegistration(e,t.config,t.registerState)),this.state=function(e){return Object.assign(e,{id:ie})}(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>=te}(e)||Y(313,String(e.id),String(te)),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>=ee}(e)||Y(314,String(e.id),String(ee)),{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>=ie}(e)||Y(316,String(e.id),String(ie)),e}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||ce}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>=ne})(e)||Y(317,this.extension.name),this._dependency={config:e.config,init:e.initResult,output:e.output}}return this._dependency}}const de={tag:e.HISTORY_MERGE_TAG};function ue(){const t=e.$getRoot();t.isEmpty()&&t.append(e.$createParagraphNode())}const fe={config:{setOptions:de,updateOptions:de},init:({$initialEditorState:e=ue})=>({$initialEditorState:e,initialized:!1}),afterRegistration(t,{updateOptions:n,setOptions:o},i){const r=i.getInitResult();if(!r.initialized){r.initialized=!0;const{$initialEditorState:i}=r;if(e.$isEditorState(i))t.setEditorState(i,o);else if("function"==typeof i)t.update(()=>{i(t)},n);else if(i&&("string"==typeof i||"object"==typeof i)){const e=t.parseEditorState(i);t.setEditorState(e,o)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[e.RootNode,e.TextNode,e.LineBreakNode,e.TabNode,e.ParagraphNode]},ge=Symbol.for("@lexical/extension/LexicalBuilder");function pe(){}function he(e){throw e}function me(e){return Array.isArray(e)?e:[e]}const ye=V;class Ee{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=ye,this.roots=e;for(const t of e)this.addExtension(t)}static fromExtensions(e){const t=[me(fe)];for(const n of e)t.push(me(n));return new Ee(t)}static maybeFromEditor(e){const t=e[ge];return t&&(t.PACKAGE_VERSION!==ye&&Y(292,t.PACKAGE_VERSION,ye),t instanceof Ee||Y(293)),t}static fromEditor(e){const t=Ee.maybeFromEditor(e);return void 0===t&&Y(294),t}constructEditor(){const{$initialEditorState:t,onError:n,onWarn:o,...i}=this.buildCreateEditorArgs(),r=Object.assign(e.createEditor({...i,...n?{onError:e=>{n(e,r)}}:{},...o?{onWarn:e=>{o(e,r)}}:{}}),{[ge]:this});for(const e of this.sortedExtensionReps())e.build(r);return r}buildEditor(){let t=pe;function n(){try{t()}finally{t=pe}}const o=Object.assign(this.constructEditor(),{dispose:n,[Symbol.dispose]:n});return t=e.mergeRegister(this.registerEditor(o),()=>o.setRootElement(null)),o}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 o=this.outgoingConfigEdges.get(e);if(o){const e=o.get(t);e?e.push(...n):o.set(t,n)}else this.outgoingConfigEdges.set(e,new Map([[t,n]]));const i=this.incomingEdges.get(t);i?i.add(e):this.incomingEdges.set(t,new Set([e]))}addExtension(e){void 0!==this._sortedExtensionReps&&Y(296);const t=me(e),[n]=t;"string"!=typeof n.name&&Y(297,typeof n.name);let o=this.extensionNameMap.get(n.name);if(void 0!==o&&o.extension!==n&&Y(298,n.name),!o){o=new le(this,n),this.extensionNameMap.set(n.name,o);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=me(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,o)=>{let i=n.state;if(se(i))return;const r=n.extension.name;var s;re(i)||Y(300,r,o||"[unknown]"),re(s=i)||Y(304,String(s.id),String(X)),i=Object.assign(s,{id:q}),n.state=i;const a=this.outgoingConfigEdges.get(r);if(a)for(const e of a.keys()){const n=this.extensionNameMap.get(e);n&&t(n,r)}i=ae(i),n.state=i,e.push(n)};for(const e of this.extensionNameMap.values())re(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(),o=new AbortController,i=[()=>o.abort()],r=o.signal;for(const e of n){const n=e.register(t,r);n&&i.push(n)}for(const e of n){const n=e.afterRegistration(t);n&&i.push(n)}return e.mergeRegister(...i)}buildCreateEditorArgs(){const e={},t=new Set,n=new Map,o=new Map,i={},r={},s=this.sortedExtensionReps();for(const a of s){const{extension:s}=a;if(void 0!==s.onError&&(e.onError=s.onError),void 0!==s.onWarn&&(e.onWarn=s.onWarn),void 0!==s.disableEvents&&(e.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(e.parentEditor=s.parentEditor),void 0!==s.editable&&(e.editable=s.editable),void 0!==s.namespace&&(e.namespace=s.namespace),void 0!==s.$initialEditorState&&(e.$initialEditorState=s.$initialEditorState),s.nodes)for(const e of F(s)){if("function"!=typeof e){const t=n.get(e.replace);t&&Y(302,s.name,e.replace.name,t.extension.name),n.set(e.replace,a)}t.add(e)}if(s.html){if(s.html.export)for(const[e,t]of s.html.export.entries())o.set(e,t);s.html.import&&Object.assign(i,s.html.import)}s.theme&&J(r,s.theme)}Object.keys(r).length>0&&(e.theme=r),t.size&&(e.nodes=[...t]);const a=Object.keys(i).length>0,c=o.size>0;(a||c)&&(e.html={},a&&(e.html.import=i),c&&(e.html.export=o));for(const t of s)t.init(e);return e.onError||(e.onError=he),e}}function xe(e,t){const n=Ee.fromEditor(e).getExtensionRep(t);return void 0===n&&Y(303,t.name),n.getExtensionDependency()}function Se(e,t){const n=Ee.maybeFromEditor(e);if(!n)return;const o=n.extensionNameMap.get(t);return o?o.getExtensionDependency():void 0}function ve(t){return xe(e.$getEditor(),t)}const be={root:{children:[],direction:null,format:"",indent:0,type:"root",version:1}};function Ne(t){const n=t.exportJSON();delete n.children,delete n.$slots;const o={json:n,key:t.__key,next:t.__next,parent:t.__parent,prev:t.__prev};e.$isElementNode(t)&&(o.first=t.__first,o.last=t.__last,o.size=t.__size);const{__slotHost:i,__slots:r}=t;return null!=r&&(o.slots=[...r]),null!=i&&(o.slotHost=i),o}function _e(t){const n=new Map,o=[],i=t.map(t=>t.read(()=>{const i=[];for(const e of t._nodeMap.values()){let t=n.get(e);void 0===t&&(t=o.length,n.set(e,t),o.push(Ne(e))),i.push(t)}return{nodes:i,selection:(r=t._selection,e.$isRangeSelection(r)?{anchor:{key:r.anchor.key,offset:r.anchor.offset,type:r.anchor.type},focus:{key:r.focus.key,offset:r.focus.offset,type:r.focus.type},format:r.format,style:r.style,type:"range"}:e.$isNodeSelection(r)?{keys:[...r._nodes],type:"node"}:null)};var r}));return{nodes:o,states:i}}function Re(e){return null!=e&&"object"==typeof e}function Oe(e){return null==e||"string"==typeof e}function $e(e){if(!Re(e))return!1;const{first:t,json:n,key:o,last:i,next:r,parent:s,prev:a,size:c,slotHost:l,slots:d}=e;return Re(n)&&"string"==typeof n.type&&"string"==typeof o&&Oe(s)&&Oe(a)&&Oe(r)&&Oe(t)&&Oe(i)&&(void 0===c||"number"==typeof c)&&Oe(l)&&(void 0===d||Array.isArray(d)&&d.every(e=>Array.isArray(e)&&2===e.length&&"string"==typeof e[0]&&"string"==typeof e[1]))}function Ce(e){return Re(e)&&"string"==typeof e.key&&"number"==typeof e.offset&&("text"===e.type||"element"===e.type)}function Ae(e){if(!Re(e))return!1;const{nodes:t,states:n}=e;return Array.isArray(t)&&Array.isArray(n)&&t.every($e)&&n.every(e=>Re(e)&&Array.isArray(e.nodes)&&e.nodes.every(e=>"number"==typeof e&&e>=0&&e<t.length)&&function(e){return null==e||!!Re(e)&&("node"===e.type?Array.isArray(e.keys)&&e.keys.every(e=>"string"==typeof e):"range"===e.type&&Ce(e.anchor)&&Ce(e.focus)&&"number"==typeof e.format&&"string"==typeof e.style)}(e.selection))}function Me(t,n){if("root"!==t.type)return e.$parseSerializedNode(t);let o;if(n.parseEditorState({root:t},()=>{o=e.$getRoot()}),void 0===o)throw new Error("editorStateFamily: the root version did not parse");return o}function Te(t,n){const o=[],i=new Map;let r=!1,s=!1;const a=n.parseEditorState(be,()=>{for(const e of t.nodes){let t=null;try{t=Me(e.json,n)}catch(e){o.push(null);continue}const r=i.get(e.key);void 0===r?i.set(e.key,t.__key):t.__key=r,o.push(t)}const a=e=>null===e?null:i.get(e)??null;for(const[n,i]of t.nodes.entries()){const t=o[n];if(null===t)continue;t.__parent=a(i.parent),t.__prev=a(i.prev),t.__next=a(i.next),e.$isElementNode(t)&&(t.__first=a(i.first??null),t.__last=a(i.last??null),t.__size=i.size??0);const s=t;void 0!==i.slots&&(r=!0,s.__slots=new Map(i.slots.flatMap(([e,t])=>{const n=a(t);return null===n?[]:[[e,n]]}))),void 0!==i.slotHost&&(s.__slotHost=a(i.slotHost))}s=!0});return s?t.states.map(t=>{const n=new Map;for(const e of t.nodes){const t=o[e];if(null==t)return null;n.set(t.__key,t)}if(!n.has("root"))return null;const s=a.clone(function(t,n){if(null==t)return null;if("node"===t.type){const o=e.$createNodeSelection();for(const e of t.keys){const t=n.get(e);if(void 0===t)return null;o._nodes.add(t)}return o}const o=n.get(t.anchor.key),i=n.get(t.focus.key);if(void 0===o||void 0===i)return null;const r=e.$createRangeSelection();return r.anchor.key=o,r.anchor.offset=t.anchor.offset,r.anchor.type=t.anchor.type,r.focus.key=i,r.focus.offset=t.focus.offset,r.focus.type=t.focus.type,r.format=t.format,r.style=t.style,r}(t.selection,i));return s._nodeMap=n,s._slotsUsed=r,s._parsed=!1,s}):t.states.map(()=>null)}const we={build:e=>U(()=>e.getRootElement(),t=>e.registerRootListener(e=>{t.value=e})),name:"@lexical/extension/RootElement"},De={build:e=>U(()=>e.isEditable(),t=>e.registerEditableListener(e=>{t.value=e})),name:"@lexical/extension/WatchEditable"};function Ie(e,t){return function(e,t){const n=`lexicalHMR:${encodeURIComponent(t)}`;return void 0!==e?`${n}:${encodeURIComponent(e)}`:n}(""===t?void 0:t,ke(e)?e._config.namespace:"")}function ke(e){const t=Ee.maybeFromEditor(e);if(!t)return!1;for(const n of t.extensionNameMap.values()){const{namespace:t}=n.extension;if(t&&t===e._config.namespace)return!0}return null!==e._parentEditor&&ke(e._parentEditor)}function Fe(e,t){return e.data[t]}function Le(e){if(null==e||"object"!=typeof e)return!1;const t=e,n=e=>Object.prototype.hasOwnProperty.call(t,e);return n("editable")&&n("editorState")&&"boolean"==typeof t.editable&&function(e){return"object"==typeof e&&null!==e&&"function"==typeof e.toJSON&&"function"==typeof e.isEmpty}(t.editorState)}const Pe={afterRegistration(t,{hot:n,id:o},i){if(!n)return()=>{};const r=Ie(t,o),s=Se(t,"@lexical/history/History");let a=!1;const c=Fe(n,r);if(Le(c))try{t.setEditable(c.editable);const n="function"==typeof c.serialize?c.serialize():null;if(function(e){if(null==e||"object"!=typeof e)return!1;const{family:t,history:n}=e;if(!Ae(t))return!1;if(null==n)return!0;const o=e=>"number"==typeof e&&e>=0&&e<t.states.length,{current:i,redoStack:r,undoStack:s}=n;return(null===i||o(i))&&Array.isArray(r)&&r.every(o)&&Array.isArray(s)&&s.every(o)}(n)){const o=Te(n.family,t),i=o[0];null==i||i.isEmpty()||(i._parsed=!0,t.setEditorState(i,{tag:e.HISTORY_MERGE_TAG}),null!=n.history&&s&&(s.output.historyState.value=function(e,t,n){const o=e=>{const o=t[e];return null==o||o.isEmpty()?null:{editor:n,editorState:o}},i=e=>e.map(o).filter(e=>null!==e),r=null===e.current?null:o(e.current),s=i(e.undoStack);return{current:r,redoStack:i(e.redoStack),undoStack:s}}(n.history,o,t)),a=!0)}else;}catch(e){}a&&i.getInitResult().restoreCount.value++;const l=i.getDependency(W).output,d=i.getDependency(De).output,u=i.getDependency(we).output;let f=null;return O(()=>{const e=l.value,o=d.value,i=null!==u.value,a=Fe(n,r);if(null!==f&&f.editorState===e&&f.editable===o)return void(Le(a)&&a.owner===t&&(a.mounted=i));f={editable:o,editorState:e};const c={...(e.isEmpty()&&Le(a)?a:null)??{editorState:e,serialize:()=>function(e,t,n){const o=[t],i=t=>t.editor===e,r=e=>o.push(e.editorState)-1,s=e=>e.filter(i).map(r),a=n?{current:n.current&&i(n.current)?r(n.current):null,redoStack:s(n.redoStack),undoStack:s(n.undoStack)}:null;return{family:_e(o),history:a}}(t,e,s?s.output.historyState.peek():null)},editable:o,mounted:i,owner:t};n.data[r]=c})},build:(e,t,n)=>n.getInitResult(),config:{hot:null},dependencies:[W,we,De],init:()=>({restoreCount:m(0)}),name:"@lexical/extension/HMR"},Ke=new Set,ze={build(t,n,o){const i=o.getDependency(W).output,r=m({watchedNodeKeys:new Map}),s=U(()=>{},()=>O(()=>{const t=s.peek(),{watchedNodeKeys:n}=r.value;let o,a=!1;i.value.read(()=>{if(e.$getSelection())for(const[i,r]of n.entries()){if(0===r.size){n.delete(i);continue}const s=e.$getNodeByKey(i),c=s&&s.isSelected()||!1;a=a||c!==(!!t&&t.has(i)),c&&(o=o||new Set,o.add(i))}}),!a&&o&&t&&o.size===t.size||(s.value=o)}));return{watchNodeKey:function(e){const t=v(()=>(s.value||Ke).has(e)),{watchedNodeKeys:n}=r.peek();let o=n.get(e);const i=void 0!==o;return o=o||new Set,o.add(t),i||(n.set(e,o),r.value={watchedNodeKeys:n}),t}}},dependencies:[W],name:"@lexical/extension/NodeSelection"},je=/* @__PURE__ */e.createCommand("INSERT_HORIZONTAL_RULE_COMMAND");class Be extends e.DecoratorNode{$config(){return this.config("horizontalrule",{importDOM:{hr:()=>({conversion:He,priority:0})}})}exportDOM(){return{element:e.$getDocument().createElement("hr")}}createDOM(t){const n=e.$getDocument().createElement("hr");return e.addClassNamesToElement(n,t.theme.hr),n}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function He(){return{node:Ue()}}function Ue(){return e.$create(Be)}function We(e){return e instanceof Be}const Ye={dependencies:[W,ze],name:"@lexical/extension/HorizontalRule",nodes:()=>[Be],register(n,o,r){const{watchNodeKey:s}=r.getDependency(ze).output,a=m({nodeSelections:new Map}),c=n._config.theme.hrSelected??"selected";return e.mergeRegister(n.registerCommand(je,n=>{const o=e.$getSelection();if(!e.$isRangeSelection(o))return!1;if(null!==o.focus.getNode()){const e=Ue();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(We(n))return function(t,n=!1){const o=e.$getSelection(),i=t.isSelected(),r=t.getKey();let s;n&&e.$isNodeSelection(o)?s=o:(s=e.$createNodeSelection(),e.$setSelection(s)),i?s.delete(r):s.add(r)}(n,t.shiftKey),!0}return!1},e.COMMAND_PRIORITY_LOW),n.registerMutationListener(Be,(e,t)=>{i(()=>{let t=!1;const{nodeSelections:o}=a.peek();for(const[i,r]of e.entries())if("destroyed"===r)o.delete(i),t=!0;else{const e=o.get(i),r=n.getElementByKey(i);e?e.domNode.value=r:(t=!0,o.set(i,{domNode:m(r),selectedSignal:s(i)}))}t&&(a.value={nodeSelections:o})})}),O(()=>{const t=[];for(const{domNode:n,selectedSignal:o}of a.value.nodeSelections.values())t.push(O(()=>{const t=n.value;if(t){o.value?e.addClassNamesToElement(t,c):e.removeClassNamesFromElement(t,c)}}));return e.mergeRegister(...t)}))}},Ge={build:e=>({composingTextNode:m(null),compositionKey:m(null)}),name:"@lexical/extension/IME",register(t,n,o){const{compositionKey:i,composingTextNode:r}=o.getOutput(),s=t.registerCommand(e.COMPOSITION_START_COMMAND,()=>{const t=e.$getSelection();return e.$isRangeSelection(t)&&(i.value=t.anchor.key),!1},e.COMMAND_PRIORITY_BEFORE_EDITOR),a=O(()=>{const n=i.value;r.value=null!==n?t.read("latest",()=>{const t=e.$getNodeByKey(n);return e.$isTextNode(t)?t:null}):null}),c=t.registerUpdateListener(({tags:t,editorState:n})=>{t.has(e.COMPOSITION_START_TAG)&&n.read(()=>{const t=e.$getSelection();if(!e.$isRangeSelection(t))return;const n=t.anchor.getNode();e.$isTextNode(n)&&(r.value=n)})}),l=t.registerRootListener(t=>{if(null===t)return void(i.value=null);return e.registerEventListener(t,"compositionend",()=>{i.value=null})});return e.mergeRegister(s,a,c,l)}},Ve=[["ctrlKey","Ctrl"],["altKey","Alt"],["shiftKey","Shift"],["metaKey","Meta"]],Ze={" ":"Space"},Je={...Ze,Alt:"\u2325",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",ArrowUp:"\u2191",Backspace:"\u232b",CapsLock:"\u21ea",Ctrl:"\u2303",Delete:"\u2326",End:"\u2198",Enter:"\u21a9",Escape:"\u238b",Home:"\u2196",Meta:"\u2318",PageDown:"\u21df",PageUp:"\u21de",Shift:"\u21e7",Tab:"\u21e5"},Xe={...Je,Tab:"\u21e4"};function qe(e){return function(e){return Array.isArray(e)}(e)?e:e?[e]:[]}const Qe={build:(e,t,n)=>$(t),config:{disabled:!1,priority:e.COMMAND_PRIORITY_NORMAL,shortcuts:{}},mergeConfig(t,n){const o=e.shallowMergeConfig(t,n);return o.shortcuts=function(e,t){if(!t)return e;const n={...t};for(const[t,o]of Object.entries(e))void 0===n[t]&&(n[t]=o);return n}(t.shortcuts,n.shortcuts),o},name:"@lexical/extension/KeyboardShortcuts",register(t,n,o){const{disabled:i,priority:r,shortcuts:s}=o.getOutput();return O(()=>{if(!i.value){const n=[];for(const e of Object.values(s.value))for(const t of qe(e))n.push(t);return function(t,n,o){const i=e.compileKeyboardShortcuts(n);return t.registerCommand(e.KEY_DOWN_COMMAND,(n,o)=>{let r;for(const s of i.matches(n)){if(t!==o&&!s.bubbleFromNestedEditors)continue;if(s.$disabled&&(void 0===r&&(r=e.$getSelection()),s.$disabled(r,o)))continue;const i=o.dispatchCommand.bind(o,s.command,n);if(s.$dispatch?s.$dispatch(s.command,n,i,o):i())return!0}return!1},o)}(t,n,r.value)}})}};const et={build:(e,t)=>$({inheritEditableFromParent:t.inheritEditableFromParent}),config:{$getParentEditor:function(){const t=e.$getEditor();return Ee.fromEditor(t),t},inheritEditableFromParent:!1},init:(e,t,n)=>{const o=t.$getParentEditor();e.parentEditor=o,e.theme=e.theme||o._config.theme},name:"@lexical/extension/NestedEditor",register:(e,t,n)=>O(()=>{const t=e._parentEditor;if(t&&n.getOutput().inheritEditableFromParent.value)return e.setEditable(t.isEditable()),t.registerEditableListener(e.setEditable.bind(e))})},tt={config:{attribute:"data-selected",nodes:[]},init(t,n){const o=new Set,i=e.getRegisteredSubtypeMap(k(t).nodes);for(const e of n.nodes){const t=e.getType(),n=i.get(t);void 0===n&&Y(339,e.name,t),o.add(t);for(const e of n)o.add(e)}return{matchTypes:o}},mergeConfig:(t,n)=>e.shallowMergeConfig(t,{...n,...n.nodes&&{nodes:[...t.nodes,...n.nodes]}}),name:"@lexical/extension/NodeSelectionDataSelected",register(t,n,o){const{attribute:i}=n,{matchTypes:r}=o.getInitResult(),s=new Map,a=n=>{const o=new Set;n.read(()=>{const t=e.$getSelection();if(e.$isNodeSelection(t))for(const e of t.getNodes())r.has(e.getType())&&o.add(e.getKey())});for(const[e,t]of s)o.has(e)||(t.removeAttribute(i),s.delete(e));for(const e of o){const n=t.getElementByKey(e);null!==n&&(n.setAttribute(i,"true"),s.set(e,n))}};a(t.getEditorState());const c=t.registerUpdateListener(({editorState:e})=>a(e));return()=>{c();for(const e of s.values())e.removeAttribute(i);s.clear()}}};function nt(t){e.$isElementNode(t)&&t.isInline()&&t.isEmpty()&&t.remove()}const ot={build:(e,t,n)=>$(t),config:{disabled:!1},name:"@lexical/NormalizeInlineElements",register:(t,n,o)=>{const i=o.getOutput();return O(()=>{if(!i.disabled.value){const n=[];for(const{klass:o,transforms:i}of t._nodes.values())o.prototype instanceof e.ElementNode&&o.prototype.isInline!==e.ElementNode.prototype.isInline&&(i.add(nt),n.push(()=>i.delete(nt)));return()=>n.forEach(e=>e())}})}},it=new Set([e.SKIP_SELECTION_FOCUS_TAG,e.SKIP_SCROLL_INTO_VIEW_TAG]);const rt={build:(e,t,n)=>$(t),config:{$fixFocusOverselection:function(){const t=e.$getSelection();if(e.$isRangeSelection(t)&&!t.isCollapsed()){const n=e.$getCaretRangeInDirection(e.$caretRangeFromSelection(t),"next");let o=n.focus;for(e.$isTextPointCaret(o)&&n.anchor.origin!==o.origin&&0===o.offset&&(o=e.$rewindSiblingCaret(o.getSiblingCaret())),e.$isSiblingCaret(o)&&n.anchor.origin!==o.origin&&e.$isLineBreakNode(o.origin)&&(o=e.$rewindSiblingCaret(o));e.$isChildCaret(o)&&n.anchor.origin!==o.origin;)o=e.$rewindSiblingCaret(e.$getSiblingCaret(o.origin,"next"));if(e.$isSiblingCaret(o)&&e.$isElementNode(o.origin)&&(o=e.$normalizeCaret(e.$getChildCaret(o.origin,"previous")).getFlipped()),o=e.$normalizeCaret(o),!o.isSamePointCaret(n.focus)){const t=e.$setSelectionFromCaretRange(e.$getCaretRange(n.anchor,o)),i=e.$getEditor().getRootElement(),r=i&&e.getDOMSelection(i.ownerDocument.defaultView);r&&e.$updateDOMSelection(e.$getPreviousSelection(),t,e.$getEditor(),r,it,i)}}},dateNow:Date.now,disabled:!1,thresholdMsec:100},name:"@lexical/NormalizeTripleClickSelection",register:(t,n,o)=>O(()=>{const n=o.getOutput();if(!n.disabled.value)return t.registerRootListener(o=>{if(!o)return;let i=0;const r=e=>{if(e?e.detail>2:i>0){const t=n.dateNow.peek()();i=e&&"mousedown"===e.type||t-i<=n.thresholdMsec.peek()?t:0}return i};return e.mergeRegister(t.registerCommand(e.SELECTION_CHANGE_COMMAND,()=>(r(null)&&(i=0,n.$fixFocusOverselection.peek()()),!1),e.COMMAND_PRIORITY_BEFORE_CRITICAL),e.registerEventListeners(o,{mousedown:r,mouseup:r},!0))})})};function st(t){const n=t.target;e.isExactShortcutMatch(t,"a",e.CONTROL_OR_META)&&e.isHTMLElement(n)&&("INPUT"===n.tagName||"TEXTAREA"===n.tagName)&&n.addEventListener("keydown",e.stopLexicalPropagation,{once:!0})}const at={build:(e,t,n)=>$(t),config:{disabled:!1},name:"@lexical/extension/PreventSelectAll",register:(t,n,o)=>{const i=o.getOutput();return O(()=>{if(!i.disabled.value)return t.registerRootListener(t=>{if(t)return e.registerEventListener(t,"keydown",st,!0)})})}};const ct={build:(e,t,n)=>$(t),config:{cascadeSelection:!1,disabled:!1},dependencies:[at],name:"@lexical/extension/SelectBlock",register:(t,n,o)=>{const i=o.getOutput(),r=o.getDependency(at).output;return e.mergeRegister(O(()=>{r.disabled.value=i.disabled.value}),O(()=>{if(!i.disabled.value)return t.registerCommand(e.SELECT_ALL_COMMAND,(n,o)=>{if(o!==t){if(!i.cascadeSelection.peek())return!1;return!!o.read("pending",()=>{const t=e.$getSelection();return e.$isRangeSelection(t)&&e.$isBlockFullySelected(e.$getRoot(),t)})&&(e.$selectAll(),!0)}const r=e.$getSelection();if(e.$isNodeSelection(r)){const t=r.getNodes(),n=t[0];if(!n)return!1;const o=n.getTopLevelElement();return!o||e.$isRootNode(o)||o.is(n)||t.length>1&&(s=o,!t.every(e=>s.is(e.getTopLevelElement())))?e.$selectAll():e.$isElementNode(o)&&o.select(0,o.getChildrenSize()),!0}var s;if(!e.$isRangeSelection(r))return!1;const a=r.anchor.getNode(),c=a.getTopLevelElement();if(c&&c.is(r.focus.getNode().getTopLevelElement())&&!e.$isBlockFullySelected(c,r))return c.select(0,c.getChildrenSize()),!0;let l=e.$getSlotFrame(a);for(;null!==l;){if(e.$isElementNode(l)&&!e.$isBlockFullySelected(l,r))return l.select(0,l.getChildrenSize()),!0;const t=e.$getSlotHost(l);l=null===t?null:e.$getSlotFrame(t)}return e.$isBlockFullySelected(e.$getRoot(),r)||e.$selectAll(),!0},e.COMMAND_PRIORITY_LOW)}))}},lt={build:(e,t,n)=>$(t),config:{disabled:!1,onReposition:void 0},name:"@lexical/utils/SelectionAlwaysOnDisplay",register:(e,n,o)=>{const i=o.getOutput();return O(()=>{if(!i.disabled.value)return t.selectionAlwaysOnDisplay(e,i.onReposition.value)})}};function dt(e){return e.canIndent()}function ut(n,o,i=dt){return e.mergeRegister(n.registerCommand(e.KEY_TAB_COMMAND,o=>{const i=e.$getSelection();if(!e.$isRangeSelection(i))return!1;o.preventDefault();const r=function(n){if(n.getNodes().filter(t=>e.$isBlockElementNode(t)&&t.canIndent()).length>0)return!0;const o=n.anchor,i=n.focus,r=i.isBefore(o)?i:o,s=r.getNode(),a=t.$getNearestBlockElementAncestorOrThrow(s);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(r))return!0}return!1}(i)?o.shiftKey?e.OUTDENT_CONTENT_COMMAND:e.INDENT_CONTENT_COMMAND:e.INSERT_TAB_COMMAND;return n.dispatchCommand(r)},e.COMMAND_PRIORITY_EDITOR),n.registerCommand(e.INDENT_CONTENT_COMMAND,()=>{const n="number"==typeof o?o:o?o.peek():null,r=e.$getSelection();if(!e.$isRangeSelection(r))return!1;const s="function"==typeof i?i:i.peek();return t.$handleIndentAndOutdent(e=>{if(s(e)){const t=e.getIndent()+1;(!n||t<n)&&e.setIndent(t)}})},e.COMMAND_PRIORITY_CRITICAL))}const ft={build:(e,t,n)=>$(t),config:{$canIndent:dt,disabled:!1,maxIndent:null},name:"@lexical/extension/TabIndentation",register(e,t,n){const{disabled:o,maxIndent:i,$canIndent:r}=n.getOutput();return O(()=>{if(!o.value)return ut(e,i,r)})}};exports.CONTROL_OR_ALT=e.CONTROL_OR_ALT,exports.CONTROL_OR_META=e.CONTROL_OR_META,exports.compileKeyboardShortcuts=e.compileKeyboardShortcuts,exports.configExtension=e.configExtension,exports.declarePeerDependency=e.declarePeerDependency,exports.defineExtension=e.defineExtension,exports.safeCast=e.safeCast,exports.shallowMergeConfig=e.shallowMergeConfig,exports.$applyFormatToDom=z,exports.$createHorizontalRuleNode=Ue,exports.$defaultShouldInsertAfter=w,exports.$getExtensionDependency=ve,exports.$getExtensionOutput=function(e){return ve(e).output},exports.$getPeerDependency=function(t){return Se(e.$getEditor(),t)},exports.$isDecoratorTextNode=function(e){return e instanceof P},exports.$isHorizontalRuleNode=We,exports.AutoFocusExtension=C,exports.ClearEditorExtension=T,exports.ClickAfterLastBlockExtension=I,exports.DecoratorTextExtension=H,exports.DecoratorTextNode=P,exports.EditorStateExtension=W,exports.HMRExtension=Pe,exports.HorizontalRuleExtension=Ye,exports.HorizontalRuleNode=Be,exports.IMEExtension=Ge,exports.INSERT_HORIZONTAL_RULE_COMMAND=je,exports.InitialStateExtension=fe,exports.KeyboardShortcutsExtension=Qe,exports.LexicalBuilder=Ee,exports.NestedEditorExtension=et,exports.NodeSelectionDataSelectedExtension=tt,exports.NodeSelectionExtension=ze,exports.NormalizeInlineElementsExtension=ot,exports.NormalizeTripleClickSelectionExtension=rt,exports.PreventSelectAllExtension=at,exports.RootElementExtension=we,exports.SelectBlockExtension=ct,exports.SelectionAlwaysOnDisplayExtension=lt,exports.TabIndentationExtension=ft,exports.WatchEditableExtension=De,exports.applyFormatFromStyle=function(e,t,n){const o=t.fontWeight,i=t.textDecoration.split(" "),r="700"===o||"bold"===o,s=i.includes("line-through"),a="italic"===t.fontStyle,c=i.includes("underline"),l=t.verticalAlign;return r&&!e.hasFormat("bold")&&e.toggleFormat("bold"),s&&!e.hasFormat("strikethrough")&&e.toggleFormat("strikethrough"),a&&!e.hasFormat("italic")&&e.toggleFormat("italic"),c&&!e.hasFormat("underline")&&e.toggleFormat("underline"),"sub"!==l||e.hasFormat("subscript")||e.toggleFormat("subscript"),"super"!==l||e.hasFormat("superscript")||e.toggleFormat("superscript"),n&&!e.hasFormat(n)&&e.toggleFormat(n),e},exports.applyFormatToDom=K,exports.batch=i,exports.buildEditorFromExtensions=function(...e){return Ee.fromExtensions(e).buildEditor()},exports.computed=v,exports.effect=O,exports.formatKeyboardShortcut=function(t,n={}){const{isApple:o=e.IS_APPLE}=n,{unshiftedKey:i,key:r}=t,s=e.keyboardEventMaskForPlatform(t.modifiers||{},o),a=[],c=o?!0===s.shiftKey?Xe:Je:Ze;for(const[e,t]of Ve)if(!0===s[e]){if(o&&"shiftKey"===e&&i&&1===r.length)continue;a.push(c[t]||t)}return a.push(c[r]||!o&&!0===s.shiftKey&&i||1===r.length&&r.toUpperCase()||r),a},exports.getExtensionDependencyFromEditor=xe,exports.getKnownTypesAndNodes=k,exports.getPeerDependencyFromEditor=Se,exports.getPeerDependencyFromEditorOrThrow=function(e,t){const n=Se(e,t);return void 0===n&&Y(291,t),n},exports.namedSignals=$,exports.registerClearEditor=M,exports.registerTabIndentation=ut,exports.signal=m,exports.untracked=a,exports.watchedSignal=U;
|
|
@@ -6,4 +6,4 @@
|
|
|
6
6
|
*
|
|
7
7
|
*/
|
|
8
8
|
|
|
9
|
-
import{getActiveElement as t,$getRoot as e,$getSelection as n,$createParagraphNode as o,$isRangeSelection as i,CLEAR_EDITOR_COMMAND as r,COMMAND_PRIORITY_EDITOR as s,$isDecoratorNode as c,$isElementNode as a,registerEventListeners as u,stopLexicalPropagation as l,getStaticNodeConfig as d,DecoratorNode as f,$getState as h,toggleTextFormatType as p,$setState as g,$getDocument as m,TEXT_TYPE_TO_FORMAT as y,createState as v,shallowMergeConfig as b,RootNode as x,TextNode as S,LineBreakNode as E,TabNode as w,ParagraphNode as _,HISTORY_MERGE_TAG as N,$isEditorState as k,createEditor as O,mergeRegister as C,$getEditor as R,$parseSerializedNode as A,$createNodeSelection as M,$createRangeSelection as D,$isNodeSelection as I,$getNodeByKey as F,$create as K,CLICK_COMMAND as L,isDOMNode as $,$getNodeFromDOMNode as j,COMMAND_PRIORITY_LOW as P,addClassNamesToElement as T,createCommand as z,$setSelection as U,removeClassNamesFromElement as H,COMPOSITION_START_COMMAND as W,COMMAND_PRIORITY_BEFORE_EDITOR as B,COMPOSITION_START_TAG as V,$isTextNode as G,registerEventListener as Z,COMMAND_PRIORITY_NORMAL as J,keyboardEventMaskForPlatform as X,IS_APPLE as Y,compileKeyboardShortcuts as q,KEY_DOWN_COMMAND as Q,getRegisteredSubtypeMap as tt,ElementNode as et,$getCaretRangeInDirection as nt,$caretRangeFromSelection as ot,$isTextPointCaret as it,$rewindSiblingCaret as rt,$isSiblingCaret as st,$isLineBreakNode as ct,$isChildCaret as at,$getSiblingCaret as ut,$normalizeCaret as lt,$getChildCaret as dt,$setSelectionFromCaretRange as ft,$getCaretRange as ht,getDOMSelection as pt,$updateDOMSelection as gt,$getPreviousSelection as mt,SKIP_SELECTION_FOCUS_TAG as yt,SKIP_SCROLL_INTO_VIEW_TAG as vt,SELECTION_CHANGE_COMMAND as bt,COMMAND_PRIORITY_BEFORE_CRITICAL as xt,isExactShortcutMatch as St,CONTROL_OR_META as Et,isHTMLElement as wt,SELECT_ALL_COMMAND as _t,$isBlockFullySelected as Nt,$selectAll as kt,$isRootNode as Ot,$getSlotFrame as Ct,$getSlotHost as Rt,KEY_TAB_COMMAND as At,OUTDENT_CONTENT_COMMAND as Mt,INDENT_CONTENT_COMMAND as Dt,INSERT_TAB_COMMAND as It,COMMAND_PRIORITY_CRITICAL as Ft,$isBlockElementNode as Kt,$normalizeSelection__EXPERIMENTAL as Lt}from"lexical";export{CONTROL_OR_ALT,CONTROL_OR_META,compileKeyboardShortcuts,configExtension,declarePeerDependency,defineExtension,safeCast,shallowMergeConfig}from"lexical";import{$insertNodeToNearestRoot as $t,selectionAlwaysOnDisplay as jt,$handleIndentAndOutdent as Pt,$getNearestBlockElementAncestorOrThrow as Tt}from"@lexical/utils";const zt=Symbol.for("preact-signals");function Ut(){if(Zt>1)return void Zt--;let t,e=!1;for(!function(){let t=Gt;for(Gt=void 0;void 0!==t;)t.S.v===t.v&&(t.S.i=t.i),t=t.o}();void 0!==Bt;){let n=Bt;for(Bt=void 0,Jt++;void 0!==n;){const o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ne(n))try{n.c()}catch(n){e||(t=n,e=!0)}n=o}}if(Jt=0,Zt--,e)throw t}function Ht(t){if(Zt>0)return t();Yt=++Xt,Zt++;try{return t()}finally{Ut()}}let Wt,Bt;function Vt(t){const e=Wt;Wt=void 0;try{return t()}finally{Wt=e}}let Gt,Zt=0,Jt=0,Xt=0,Yt=0,qt=0;function Qt(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 te(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 ee(t,e){return new te(t,e)}function ne(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 oe(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 ie(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 re(t,e){te.call(this,void 0),this.x=t,this.s=void 0,this.g=qt-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 se(t,e){return new re(t,e)}function ce(t){const e=t.m;if(t.m=void 0,"function"==typeof e){Zt++;const n=Wt;Wt=void 0;try{e()}catch(e){throw t.f&=-2,t.f|=8,ae(t),e}finally{Wt=n,Ut()}}}function ae(t){for(let e=t.s;void 0!==e;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,ce(t)}function ue(t){if(Wt!==this)throw new Error("Out-of-order effect");ie(this),Wt=t,this.f&=-2,8&this.f&&ae(this),Ut()}function le(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 de(t,e){const n=new le(t,e);try{n.c()}catch(t){throw n.d(),t}const o=n.d.bind(n);return o[Symbol.dispose]=o,o}function fe(t,e={}){const n={};for(const o in t){const i=e[o],r=ee(void 0===i?t[o]:i);n[o]=r}return n}te.prototype.brand=zt,te.prototype.h=function(){return!0},te.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:Vt(()=>{var t;null==(t=this.W)||t.call(this)}))},te.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&&Vt(()=>{var t;null==(t=this.Z)||t.call(this)}))}},te.prototype.subscribe=function(t){return de(()=>{const e=this.value,n=Wt;Wt=void 0;try{t(e)}finally{Wt=n}},{name:"sub"})},te.prototype.valueOf=function(){return this.value},te.prototype.toString=function(){return this.value+""},te.prototype.toJSON=function(){return this.value},te.prototype.peek=function(){const t=Wt;Wt=void 0;try{return this.value}finally{Wt=t}},Object.defineProperty(te.prototype,"value",{get(){const t=Qt(this);return void 0!==t&&(t.i=this.i),this.v},set(t){if(t!==this.v){if(Jt>100)throw new Error("Cycle detected");!function(t){0!==Zt&&0===Jt&&t.l!==Yt&&(t.l=Yt,Gt={S:t,v:t.v,i:t.i,o:Gt})}(this),this.v=t,this.i++,qt++,Zt++;try{for(let t=this.t;void 0!==t;t=t.x)t.t.N()}finally{Ut()}}}}),re.prototype=new te,re.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===qt)return!0;if(this.g=qt,this.f|=1,this.i>0&&!ne(this))return this.f&=-2,!0;const t=Wt;try{oe(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,ie(this),this.f&=-2,!0},re.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)}te.prototype.S.call(this,t)},re.prototype.U=function(t){if(void 0!==this.t&&(te.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)}},re.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(re.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const t=Qt(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),le.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()}},le.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ce(this),oe(this),Zt++;const t=Wt;return Wt=this,ue.bind(this,t)},le.prototype.N=function(){2&this.f||(this.f|=2,this.u=Bt,Bt=this)},le.prototype.d=function(){this.f|=8,1&this.f||ae(this)},le.prototype.dispose=function(){this.d()};const he={build:(t,e,n)=>fe(e),config:{defaultSelection:"rootEnd",disabled:!1},name:"@lexical/extension/AutoFocus",register(e,n,o){const i=o.getOutput();return de(()=>i.disabled.value?void 0:e.registerRootListener(n=>{e.focus(()=>{const e=null!==n?t(n):null;null===n||null!==e&&n.contains(e)||n.focus({preventScroll:!0})},{defaultSelection:i.defaultSelection.peek()})}))}};function pe(){const t=e(),r=n(),s=o();t.clear(),t.append(s),null!==r&&s.select(),i(r)&&(r.format=0)}function ge(t,e=pe){return t.registerCommand(r,()=>(e(),!0),s)}const me={build:(t,e,n)=>fe(e),config:{$onClear:pe},name:"@lexical/extension/ClearEditor",register(t,e,n){const{$onClear:o}=n.getOutput();return de(()=>ge(t,o.value))}};function ye(t){return!!c(t)||!(!a(t)||!t.isShadowRoot())}function ve(t,n,o,i){return!!t.isEditable()&&(o.target===n&&t.read("latest",()=>{const n=e().getLastChild();if(null===n)return!1;const r=t.getElementByKey(n.getKey());return null!==r&&(!(o.clientY<=r.getBoundingClientRect().bottom)&&i(n))}))}const be={build:(t,e)=>fe(e),config:{$shouldInsertAfter:ye,disabled:!1},name:"@lexical/ClickAfterLastBlock",register:(t,n,i)=>de(()=>{const n=i.getOutput();if(!n.disabled.value)return t.registerRootListener(i=>{if(null===i)return;return u(i,{click:r=>{ve(t,i,r,n.$shouldInsertAfter.peek())&&(r.preventDefault(),l(r),t.update(()=>{const t=e().getLastChild();if(null===t)return;if(!n.$shouldInsertAfter.peek()(t))return;const i=o();t.insertAfter(i),i.select()}))},mousedown:e=>{ve(t,i,e,n.$shouldInsertAfter.peek())&&e.preventDefault()}},!0)})})};function xe(t){const e=new Set,n=new Set;for(const o of Se(t)){const t="function"==typeof o?o:o.replace;d(t),e.add(t.getType()),n.add(t)}return{nodes:n,types:e}}function Se(t){return("function"==typeof t.nodes?t.nodes():t.nodes)||[]}const Ee=/* @__PURE__ */v("format",{parse:t=>"number"==typeof t?t:0});class we extends f{get __isInlineFormattable(){return!0}$config(){return this.config("decorator-text",{extends:f,stateConfigs:[{flat:!0,stateConfig:Ee}]})}getFormat(t){return h(this,Ee,t)}getFormatFlags(t,e){return p(this.getFormat(),t,e)}hasFormat(t){const e=y[t];return 0!==(this.getFormat()&e)}setFormat(t){return g(this,Ee,t)}toggleFormat(t){const e=this.getFormat(),n=p(e,t,null);return this.setFormat(n)}isInline(){return!0}createDOM(t,e){return m().createElement("span")}}function _e(t){return t instanceof we}function Ne(t,e,n){const o=e.fontWeight,i=e.textDecoration.split(" "),r="700"===o||"bold"===o,s=i.includes("line-through"),c="italic"===e.fontStyle,a=i.includes("underline"),u=e.verticalAlign;return r&&!t.hasFormat("bold")&&t.toggleFormat("bold"),s&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),c&&!t.hasFormat("italic")&&t.toggleFormat("italic"),a&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==u||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==u||t.hasFormat("superscript")||t.toggleFormat("superscript"),n&&!t.hasFormat(n)&&t.toggleFormat(n),t}function ke(t,e,n=Re){let o=e;for(const[e,i]of Object.entries(n))t.hasFormat(i)&&(o=Ce(o,e));return o}const Oe=ke;function Ce(t,e){const n=t.ownerDocument.createElement(e);return n.appendChild(t),n}const Re={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},Ae={name:"@lexical/extension/DecoratorText",nodes:()=>[we]};function Me(t,e){let n;return ee(t(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=t(),n=e(this)}})}const De={build:t=>Me(()=>t.getEditorState(),e=>t.registerUpdateListener(t=>{e.value=t.editorState})),name:"@lexical/extension/EditorState"};function Ie(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.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.50.0+prod.esm"}catch(t){}const Ke=Fe??'"<unknown>+source"',Le=new Set(["__proto__","constructor","prototype"]);function $e(t,e){if(t&&e&&!Array.isArray(e)&&"object"==typeof t&&"object"==typeof e){const n=t,o=e;for(const t in o)!Le.has(t)&&Object.prototype.hasOwnProperty.call(o,t)&&(n[t]=$e(n[t],o[t]));return t}return e}const je=0,Pe=1,Te=2,ze=3,Ue=4,He=5,We=6,Be=7;function Ve(t){return t.id===je}function Ge(t){return t.id===Te}function Ze(t){return function(t){return t.id===Pe}(t)||Ie(305,String(t.id),String(Pe)),Object.assign(t,{id:Te})}const Je=new Set;class Xe{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,e){this.builder=t,this.extension=e,this.configs=new Set,this.state={id:je}}mergeConfigs(){let t=this.extension.config||{};const e=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):b;for(const n of this.configs)t=e(t,n);return t}init(t){const e=this.state;Ge(e)||Ie(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)},o={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(t,e,n){return Object.assign(t,{config:e,id:ze,registerState:n})}(e,this.mergeConfigs(),n);let r;this.state=i,this.extension.init&&(r=this.extension.init(t,i.config,n)),this.state=function(t,e,n){return Object.assign(t,{id:Ue,initResult:e,registerState:n})}(i,r,o)}build(t){const e=this.state;let n;e.id!==Ue&&Ie(307,String(e.id),String(He)),this.extension.build&&(n=this.extension.build(t,e.config,e.registerState));const o={...e.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(t,e,n){return Object.assign(t,{id:He,output:e,registerState:n})}(e,n,o)}register(t,e){this._signal=e;const n=this.state;n.id!==He&&Ie(308,String(n.id),String(He));const o=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=function(t){return Object.assign(t,{id:We})}(n),()=>{const t=this.state;t.id!==Be&&Ie(309,String(n.id),String(Be)),this.state=function(t){return Object.assign(t,{id:He})}(t),o&&o()}}afterRegistration(t){const e=this.state;let n;return e.id!==We&&Ie(310,String(e.id),String(We)),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&&Ie(311),this._signal}getInitResult(){void 0===this.extension.init&&Ie(312,this.extension.name);const t=this.state;return function(t){return t.id>=Ue}(t)||Ie(313,String(t.id),String(Ue)),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>=ze}(t)||Ie(314,String(t.id),String(ze)),{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&&Ie(315,this.extension.name,t.name),e.getExtensionInitDependency()}getDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&Ie(315,this.extension.name,t.name),e.getExtensionDependency()}getState(){const t=this.state;return function(t){return t.id>=Be}(t)||Ie(316,String(t.id),String(Be)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Je}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>=He})(t)||Ie(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}}const Ye={tag:N};function qe(){const t=e();t.isEmpty()&&t.append(o())}const Qe={config:{setOptions:Ye,updateOptions:Ye},init:({$initialEditorState:t=qe})=>({$initialEditorState:t,initialized:!1}),afterRegistration(t,{updateOptions:e,setOptions:n},o){const i=o.getInitResult();if(!i.initialized){i.initialized=!0;const{$initialEditorState:o}=i;if(k(o))t.setEditorState(o,n);else if("function"==typeof o)t.update(()=>{o(t)},e);else if(o&&("string"==typeof o||"object"==typeof o)){const e=t.parseEditorState(o);t.setEditorState(e,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[x,S,E,w,_]},tn=Symbol.for("@lexical/extension/LexicalBuilder");function en(...t){return cn.fromExtensions(t).buildEditor()}function nn(){}function on(t){throw t}function rn(t){return Array.isArray(t)?t:[t]}const sn=Ke;class cn{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=sn,this.roots=t;for(const e of t)this.addExtension(e)}static fromExtensions(t){const e=[rn(Qe)];for(const n of t)e.push(rn(n));return new cn(e)}static maybeFromEditor(t){const e=t[tn];return e&&(e.PACKAGE_VERSION!==sn&&Ie(292,e.PACKAGE_VERSION,sn),e instanceof cn||Ie(293)),e}static fromEditor(t){const e=cn.maybeFromEditor(t);return void 0===e&&Ie(294),e}constructEditor(){const{$initialEditorState:t,onError:e,onWarn:n,...o}=this.buildCreateEditorArgs(),i=Object.assign(O({...o,...e?{onError:t=>{e(t,i)}}:{},...n?{onWarn:t=>{n(t,i)}}:{}}),{[tn]:this});for(const t of this.sortedExtensionReps())t.build(i);return i}buildEditor(){let t=nn;function e(){try{t()}finally{t=nn}}const n=Object.assign(this.constructEditor(),{dispose:e,[Symbol.dispose]:e});return t=C(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&&Ie(295,t.name),e}addEdge(t,e,n){const o=this.outgoingConfigEdges.get(t);if(o){const t=o.get(e);t?t.push(...n):o.set(e,n)}else this.outgoingConfigEdges.set(t,new Map([[e,n]]));const i=this.incomingEdges.get(e);i?i.add(t):this.incomingEdges.set(e,new Set([t]))}addExtension(t){void 0!==this._sortedExtensionReps&&Ie(296);const e=rn(t),[n]=e;"string"!=typeof n.name&&Ie(297,typeof n.name);let o=this.extensionNameMap.get(n.name);if(void 0!==o&&o.extension!==n&&Ie(298,n.name),!o){o=new Xe(this,n),this.extensionNameMap.set(n.name,o);const t=this.conflicts.get(n.name);"string"==typeof t&&Ie(299,n.name,t);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&Ie(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=rn(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,o)=>{let i=n.state;if(Ge(i))return;const r=n.extension.name;var s;Ve(i)||Ie(300,r,o||"[unknown]"),Ve(s=i)||Ie(304,String(s.id),String(je)),i=Object.assign(s,{id:Pe}),n.state=i;const c=this.outgoingConfigEdges.get(r);if(c)for(const t of c.keys()){const n=this.extensionNameMap.get(t);n&&e(n,r)}i=Ze(i),n.state=i,t.push(n)};for(const t of this.extensionNameMap.values())Ve(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&&Ie(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,o=[()=>n.abort()],i=n.signal;for(const n of e){const e=n.register(t,i);e&&o.push(e)}for(const n of e){const e=n.afterRegistration(t);e&&o.push(e)}return C(...o)}buildCreateEditorArgs(){const t={},e=new Set,n=new Map,o=new Map,i={},r={},s=this.sortedExtensionReps();for(const c of s){const{extension:s}=c;if(void 0!==s.onError&&(t.onError=s.onError),void 0!==s.onWarn&&(t.onWarn=s.onWarn),void 0!==s.disableEvents&&(t.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(t.parentEditor=s.parentEditor),void 0!==s.editable&&(t.editable=s.editable),void 0!==s.namespace&&(t.namespace=s.namespace),void 0!==s.$initialEditorState&&(t.$initialEditorState=s.$initialEditorState),s.nodes)for(const t of Se(s)){if("function"!=typeof t){const e=n.get(t.replace);e&&Ie(302,s.name,t.replace.name,e.extension.name),n.set(t.replace,c)}e.add(t)}if(s.html){if(s.html.export)for(const[t,e]of s.html.export.entries())o.set(t,e);s.html.import&&Object.assign(i,s.html.import)}s.theme&&$e(r,s.theme)}Object.keys(r).length>0&&(t.theme=r),e.size&&(t.nodes=[...e]);const c=Object.keys(i).length>0,a=o.size>0;(c||a)&&(t.html={},c&&(t.html.import=i),a&&(t.html.export=o));for(const e of s)e.init(t);return t.onError||(t.onError=on),t}}function an(t,e){const n=cn.fromEditor(t).getExtensionRep(e);return void 0===n&&Ie(303,e.name),n.getExtensionDependency()}function un(t,e){const n=cn.maybeFromEditor(t);if(!n)return;const o=n.extensionNameMap.get(e);return o?o.getExtensionDependency():void 0}function ln(t,e){const n=un(t,e);return void 0===n&&Ie(291,e),n}function dn(t){return an(R(),t)}function fn(t){return dn(t).output}function hn(t){return un(R(),t)}const pn={root:{children:[],direction:null,format:"",indent:0,type:"root",version:1}};function gn(t){const e=t.exportJSON();delete e.children,delete e.$slots;const n={json:e,key:t.__key,next:t.__next,parent:t.__parent,prev:t.__prev};a(t)&&(n.first=t.__first,n.last=t.__last,n.size=t.__size);const{__slotHost:o,__slots:i}=t;return null!=i&&(n.slots=[...i]),null!=o&&(n.slotHost=o),n}function mn(t){const e=new Map,n=[],o=t.map(t=>t.read(()=>{const o=[];for(const i of t._nodeMap.values()){let t=e.get(i);void 0===t&&(t=n.length,e.set(i,t),n.push(gn(i))),o.push(t)}return{nodes:o,selection:(r=t._selection,i(r)?{anchor:{key:r.anchor.key,offset:r.anchor.offset,type:r.anchor.type},focus:{key:r.focus.key,offset:r.focus.offset,type:r.focus.type},format:r.format,style:r.style,type:"range"}:I(r)?{keys:[...r._nodes],type:"node"}:null)};var r}));return{nodes:n,states:o}}function yn(t){return null!=t&&"object"==typeof t}function vn(t){return null==t||"string"==typeof t}function bn(t){if(!yn(t))return!1;const{first:e,json:n,key:o,last:i,next:r,parent:s,prev:c,size:a,slotHost:u,slots:l}=t;return yn(n)&&"string"==typeof n.type&&"string"==typeof o&&vn(s)&&vn(c)&&vn(r)&&vn(e)&&vn(i)&&(void 0===a||"number"==typeof a)&&vn(u)&&(void 0===l||Array.isArray(l)&&l.every(t=>Array.isArray(t)&&2===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]))}function xn(t){return yn(t)&&"string"==typeof t.key&&"number"==typeof t.offset&&("text"===t.type||"element"===t.type)}function Sn(t){if(!yn(t))return!1;const{nodes:e,states:n}=t;return Array.isArray(e)&&Array.isArray(n)&&e.every(bn)&&n.every(t=>yn(t)&&Array.isArray(t.nodes)&&t.nodes.every(t=>"number"==typeof t&&t>=0&&t<e.length)&&function(t){return null==t||!!yn(t)&&("node"===t.type?Array.isArray(t.keys)&&t.keys.every(t=>"string"==typeof t):"range"===t.type&&xn(t.anchor)&&xn(t.focus)&&"number"==typeof t.format&&"string"==typeof t.style)}(t.selection))}function En(t,n){if("root"!==t.type)return A(t);let o;if(n.parseEditorState({root:t},()=>{o=e()}),void 0===o)throw new Error("editorStateFamily: the root version did not parse");return o}function wn(t,e){const n=[],o=new Map;let i=!1,r=!1;const s=e.parseEditorState(pn,()=>{for(const i of t.nodes){let t=null;try{t=En(i.json,e)}catch(t){n.push(null);continue}const r=o.get(i.key);void 0===r?o.set(i.key,t.__key):t.__key=r,n.push(t)}const s=t=>null===t?null:o.get(t)??null;for(const[e,o]of t.nodes.entries()){const t=n[e];if(null===t)continue;t.__parent=s(o.parent),t.__prev=s(o.prev),t.__next=s(o.next),a(t)&&(t.__first=s(o.first??null),t.__last=s(o.last??null),t.__size=o.size??0);const r=t;void 0!==o.slots&&(i=!0,r.__slots=new Map(o.slots.flatMap(([t,e])=>{const n=s(e);return null===n?[]:[[t,n]]}))),void 0!==o.slotHost&&(r.__slotHost=s(o.slotHost))}r=!0});return r?t.states.map(t=>{const e=new Map;for(const o of t.nodes){const t=n[o];if(null==t)return null;e.set(t.__key,t)}if(!e.has("root"))return null;const r=s.clone(function(t,e){if(null==t)return null;if("node"===t.type){const n=M();for(const o of t.keys){const t=e.get(o);if(void 0===t)return null;n._nodes.add(t)}return n}const n=e.get(t.anchor.key),o=e.get(t.focus.key);if(void 0===n||void 0===o)return null;const i=D();return i.anchor.key=n,i.anchor.offset=t.anchor.offset,i.anchor.type=t.anchor.type,i.focus.key=o,i.focus.offset=t.focus.offset,i.focus.type=t.focus.type,i.format=t.format,i.style=t.style,i}(t.selection,o));return r._nodeMap=e,r._slotsUsed=i,r._parsed=!1,r}):t.states.map(()=>null)}const _n={build:t=>Me(()=>t.getRootElement(),e=>t.registerRootListener(t=>{e.value=t})),name:"@lexical/extension/RootElement"},Nn={build:t=>Me(()=>t.isEditable(),e=>t.registerEditableListener(t=>{e.value=t})),name:"@lexical/extension/WatchEditable"};function kn(t,e){return function(t,e){const n=`lexicalHMR:${encodeURIComponent(e)}`;return void 0!==t?`${n}:${encodeURIComponent(t)}`:n}(""===e?void 0:e,On(t)?t._config.namespace:"")}function On(t){const e=cn.maybeFromEditor(t);if(!e)return!1;for(const n of e.extensionNameMap.values()){const{namespace:e}=n.extension;if(e&&e===t._config.namespace)return!0}return null!==t._parentEditor&&On(t._parentEditor)}function Cn(t,e){return t.data[e]}function Rn(t){if(null==t||"object"!=typeof t)return!1;const e=t,n=t=>Object.prototype.hasOwnProperty.call(e,t);return n("editable")&&n("editorState")&&"boolean"==typeof e.editable&&function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.toJSON&&"function"==typeof t.isEmpty}(e.editorState)}const An={afterRegistration(t,{hot:e,id:n},o){if(!e)return()=>{};const i=kn(t,n),r=un(t,"@lexical/history/History");let s=!1;const c=Cn(e,i);if(Rn(c))try{t.setEditable(c.editable);const e="function"==typeof c.serialize?c.serialize():null;if(function(t){if(null==t||"object"!=typeof t)return!1;const{family:e,history:n}=t;if(!Sn(e))return!1;if(null==n)return!0;const o=t=>"number"==typeof t&&t>=0&&t<e.states.length,{current:i,redoStack:r,undoStack:s}=n;return(null===i||o(i))&&Array.isArray(r)&&r.every(o)&&Array.isArray(s)&&s.every(o)}(e)){const n=wn(e.family,t),o=n[0];null==o||o.isEmpty()||(o._parsed=!0,t.setEditorState(o,{tag:N}),null!=e.history&&r&&(r.output.historyState.value=function(t,e,n){const o=t=>{const o=e[t];return null==o||o.isEmpty()?null:{editor:n,editorState:o}},i=t=>t.map(o).filter(t=>null!==t),r=null===t.current?null:o(t.current),s=i(t.undoStack);return{current:r,redoStack:i(t.redoStack),undoStack:s}}(e.history,n,t)),s=!0)}else;}catch(t){}s&&o.getInitResult().restoreCount.value++;const a=o.getDependency(De).output,u=o.getDependency(Nn).output,l=o.getDependency(_n).output;let d=null;return de(()=>{const n=a.value,o=u.value,s=null!==l.value,c=Cn(e,i);if(null!==d&&d.editorState===n&&d.editable===o)return void(Rn(c)&&c.owner===t&&(c.mounted=s));d={editable:o,editorState:n};const f={...(n.isEmpty()&&Rn(c)?c:null)??{editorState:n,serialize:()=>function(t,e,n){const o=[e],i=e=>e.editor===t,r=t=>o.push(t.editorState)-1,s=t=>t.filter(i).map(r),c=n?{current:n.current&&i(n.current)?r(n.current):null,redoStack:s(n.redoStack),undoStack:s(n.undoStack)}:null;return{family:mn(o),history:c}}(t,n,r?r.output.historyState.peek():null)},editable:o,mounted:s,owner:t};e.data[i]=f})},build:(t,e,n)=>n.getInitResult(),config:{hot:null},dependencies:[De,_n,Nn],init:()=>({restoreCount:ee(0)}),name:"@lexical/extension/HMR"},Mn=new Set,Dn={build(t,e,o){const i=o.getDependency(De).output,r=ee({watchedNodeKeys:new Map}),s=Me(()=>{},()=>de(()=>{const t=s.peek(),{watchedNodeKeys:e}=r.value;let o,c=!1;i.value.read(()=>{if(n())for(const[n,i]of e.entries()){if(0===i.size){e.delete(n);continue}const r=F(n),s=r&&r.isSelected()||!1;c=c||s!==(!!t&&t.has(n)),s&&(o=o||new Set,o.add(n))}}),!c&&o&&t&&o.size===t.size||(s.value=o)}));return{watchNodeKey:function(t){const e=se(()=>(s.value||Mn).has(t)),{watchedNodeKeys:n}=r.peek();let o=n.get(t);const i=void 0!==o;return o=o||new Set,o.add(e),i||(n.set(t,o),r.value={watchedNodeKeys:n}),e}}},dependencies:[De],name:"@lexical/extension/NodeSelection"},In=/* @__PURE__ */z("INSERT_HORIZONTAL_RULE_COMMAND");class Fn extends f{$config(){return this.config("horizontalrule",{importDOM:{hr:()=>({conversion:Kn,priority:0})}})}exportDOM(){return{element:m().createElement("hr")}}createDOM(t){const e=m().createElement("hr");return T(e,t.theme.hr),e}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function Kn(){return{node:Ln()}}function Ln(){return K(Fn)}function $n(t){return t instanceof Fn}const jn={dependencies:[De,Dn],name:"@lexical/extension/HorizontalRule",nodes:()=>[Fn],register(t,e,o){const{watchNodeKey:r}=o.getDependency(Dn).output,c=ee({nodeSelections:new Map}),a=t._config.theme.hrSelected??"selected";return C(t.registerCommand(In,t=>{const e=n();if(!i(e))return!1;if(null!==e.focus.getNode()){const t=Ln();$t(t)}return!0},s),t.registerCommand(L,t=>{if($(t.target)){const e=j(t.target);if($n(e))return function(t,e=!1){const o=n(),i=t.isSelected(),r=t.getKey();let s;e&&I(o)?s=o:(s=M(),U(s)),i?s.delete(r):s.add(r)}(e,t.shiftKey),!0}return!1},P),t.registerMutationListener(Fn,(e,n)=>{Ht(()=>{let n=!1;const{nodeSelections:o}=c.peek();for(const[i,s]of e.entries())if("destroyed"===s)o.delete(i),n=!0;else{const e=o.get(i),s=t.getElementByKey(i);e?e.domNode.value=s:(n=!0,o.set(i,{domNode:ee(s),selectedSignal:r(i)}))}n&&(c.value={nodeSelections:o})})}),de(()=>{const t=[];for(const{domNode:e,selectedSignal:n}of c.value.nodeSelections.values())t.push(de(()=>{const t=e.value;if(t){n.value?T(t,a):H(t,a)}}));return C(...t)}))}},Pn={build:t=>({composingTextNode:ee(null),compositionKey:ee(null)}),name:"@lexical/extension/IME",register(t,e,o){const{compositionKey:r,composingTextNode:s}=o.getOutput(),c=t.registerCommand(W,()=>{const t=n();return i(t)&&(r.value=t.anchor.key),!1},B),a=de(()=>{const e=r.value;s.value=null!==e?t.read("latest",()=>{const t=F(e);return G(t)?t:null}):null}),u=t.registerUpdateListener(({tags:t,editorState:e})=>{t.has(V)&&e.read(()=>{const t=n();if(!i(t))return;const e=t.anchor.getNode();G(e)&&(s.value=e)})}),l=t.registerRootListener(t=>{if(null===t)return void(r.value=null);return Z(t,"compositionend",()=>{r.value=null})});return C(c,a,u,l)}},Tn=[["ctrlKey","Ctrl"],["altKey","Alt"],["shiftKey","Shift"],["metaKey","Meta"]],zn={" ":"Space"},Un={...zn,Alt:"\u2325",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",ArrowUp:"\u2191",Backspace:"\u232b",CapsLock:"\u21ea",Ctrl:"\u2303",Delete:"\u2326",End:"\u2198",Enter:"\u21a9",Escape:"\u238b",Home:"\u2196",Meta:"\u2318",PageDown:"\u21df",PageUp:"\u21de",Shift:"\u21e7",Tab:"\u21e5"},Hn={...Un,Tab:"\u21e4"};function Wn(t,e={}){const{isApple:n=Y}=e,{unshiftedKey:o,key:i}=t,r=X(t.modifiers||{},n),s=[],c=n?!0===r.shiftKey?Hn:Un:zn;for(const[t,e]of Tn)if(!0===r[t]){if(n&&"shiftKey"===t&&o&&1===i.length)continue;s.push(c[e]||e)}return s.push(c[i]||!n&&!0===r.shiftKey&&o||1===i.length&&i.toUpperCase()||i),s}function Bn(t){return function(t){return Array.isArray(t)}(t)?t:t?[t]:[]}const Vn={build:(t,e,n)=>fe(e),config:{disabled:!1,priority:J,shortcuts:{}},mergeConfig(t,e){const n=b(t,e);return n.shortcuts=function(t,e){if(!e)return t;const n={...e};for(const[e,o]of Object.entries(t))void 0===n[e]&&(n[e]=o);return n}(t.shortcuts,e.shortcuts),n},name:"@lexical/extension/KeyboardShortcuts",register(t,e,o){const{disabled:i,priority:r,shortcuts:s}=o.getOutput();return de(()=>{if(!i.value){const e=[];for(const t of Object.values(s.value))for(const n of Bn(t))e.push(n);return function(t,e,o){const i=q(e);return t.registerCommand(Q,(e,o)=>{let r;for(const s of i.matches(e)){if(t!==o&&!s.bubbleFromNestedEditors)continue;if(s.$disabled&&(void 0===r&&(r=n()),s.$disabled(r,o)))continue;const i=o.dispatchCommand.bind(o,s.command,e);if(s.$dispatch?s.$dispatch(s.command,e,i,o):i())return!0}return!1},o)}(t,e,r.value)}})}};const Gn={build:(t,e)=>fe({inheritEditableFromParent:e.inheritEditableFromParent}),config:{$getParentEditor:function(){const t=R();return cn.fromEditor(t),t},inheritEditableFromParent:!1},init:(t,e,n)=>{const o=e.$getParentEditor();t.parentEditor=o,t.theme=t.theme||o._config.theme},name:"@lexical/extension/NestedEditor",register:(t,e,n)=>de(()=>{const e=t._parentEditor;if(e&&n.getOutput().inheritEditableFromParent.value)return t.setEditable(e.isEditable()),e.registerEditableListener(t.setEditable.bind(t))})},Zn={config:{attribute:"data-selected",nodes:[]},init(t,e){const n=new Set,o=tt(xe(t).nodes);for(const t of e.nodes){const e=t.getType(),i=o.get(e);void 0===i&&Ie(339,t.name,e),n.add(e);for(const t of i)n.add(t)}return{matchTypes:n}},mergeConfig:(t,e)=>b(t,{...e,...e.nodes&&{nodes:[...t.nodes,...e.nodes]}}),name:"@lexical/extension/NodeSelectionDataSelected",register(t,e,o){const{attribute:i}=e,{matchTypes:r}=o.getInitResult(),s=new Map,c=e=>{const o=new Set;e.read(()=>{const t=n();if(I(t))for(const e of t.getNodes())r.has(e.getType())&&o.add(e.getKey())});for(const[t,e]of s)o.has(t)||(e.removeAttribute(i),s.delete(t));for(const e of o){const n=t.getElementByKey(e);null!==n&&(n.setAttribute(i,"true"),s.set(e,n))}};c(t.getEditorState());const a=t.registerUpdateListener(({editorState:t})=>c(t));return()=>{a();for(const t of s.values())t.removeAttribute(i);s.clear()}}};function Jn(t){a(t)&&t.isInline()&&t.isEmpty()&&t.remove()}const Xn={build:(t,e,n)=>fe(e),config:{disabled:!1},name:"@lexical/NormalizeInlineElements",register:(t,e,n)=>{const o=n.getOutput();return de(()=>{if(!o.disabled.value){const e=[];for(const{klass:n,transforms:o}of t._nodes.values())n.prototype instanceof et&&n.prototype.isInline!==et.prototype.isInline&&(o.add(Jn),e.push(()=>o.delete(Jn)));return()=>e.forEach(t=>t())}})}},Yn=new Set([yt,vt]);const qn={build:(t,e,n)=>fe(e),config:{$fixFocusOverselection:function(){const t=n();if(i(t)&&!t.isCollapsed()){const e=nt(ot(t),"next");let n=e.focus;for(it(n)&&e.anchor.origin!==n.origin&&0===n.offset&&(n=rt(n.getSiblingCaret())),st(n)&&e.anchor.origin!==n.origin&&ct(n.origin)&&(n=rt(n));at(n)&&e.anchor.origin!==n.origin;)n=rt(ut(n.origin,"next"));if(st(n)&&a(n.origin)&&(n=lt(dt(n.origin,"previous")).getFlipped()),n=lt(n),!n.isSamePointCaret(e.focus)){const t=ft(ht(e.anchor,n)),o=R().getRootElement(),i=o&&pt(o.ownerDocument.defaultView);i&>(mt(),t,R(),i,Yn,o)}}},dateNow:Date.now,disabled:!1,thresholdMsec:100},name:"@lexical/NormalizeTripleClickSelection",register:(t,e,n)=>de(()=>{const e=n.getOutput();if(!e.disabled.value)return t.registerRootListener(n=>{if(!n)return;let o=0;const i=t=>{if(t?t.detail>2:o>0){const n=e.dateNow.peek()();o=t&&"mousedown"===t.type||n-o<=e.thresholdMsec.peek()?n:0}return o};return C(t.registerCommand(bt,()=>(i(null)&&(o=0,e.$fixFocusOverselection.peek()()),!1),xt),u(n,{mousedown:i,mouseup:i},!0))})})};function Qn(t){const e=t.target;St(t,"a",Et)&&wt(e)&&("INPUT"===e.tagName||"TEXTAREA"===e.tagName)&&e.addEventListener("keydown",l,{once:!0})}const to={build:(t,e,n)=>fe(e),config:{disabled:!1},name:"@lexical/extension/PreventSelectAll",register:(t,e,n)=>{const o=n.getOutput();return de(()=>{if(!o.disabled.value)return t.registerRootListener(t=>{if(t)return Z(t,"keydown",Qn,!0)})})}};const eo={build:(t,e,n)=>fe(e),config:{cascadeSelection:!1,disabled:!1},dependencies:[to],name:"@lexical/extension/SelectBlock",register:(t,o,r)=>{const s=r.getOutput(),c=r.getDependency(to).output;return C(de(()=>{c.disabled.value=s.disabled.value}),de(()=>{if(!s.disabled.value)return t.registerCommand(_t,(o,r)=>{if(r!==t){if(!s.cascadeSelection.peek())return!1;return!!r.read("pending",()=>{const t=n();return i(t)&&Nt(e(),t)})&&(kt(),!0)}const c=n();if(I(c)){const t=c.getNodes(),e=t[0];if(!e)return!1;const n=e.getTopLevelElement();return!n||Ot(n)||n.is(e)||t.length>1&&(u=n,!t.every(t=>u.is(t.getTopLevelElement())))?kt():a(n)&&n.select(0,n.getChildrenSize()),!0}var u;if(!i(c))return!1;const l=c.anchor.getNode(),d=l.getTopLevelElement();if(d&&d.is(c.focus.getNode().getTopLevelElement())&&!Nt(d,c))return d.select(0,d.getChildrenSize()),!0;let f=Ct(l);for(;null!==f;){if(a(f)&&!Nt(f,c))return f.select(0,f.getChildrenSize()),!0;const t=Rt(f);f=null===t?null:Ct(t)}return Nt(e(),c)||kt(),!0},P)}))}},no={build:(t,e,n)=>fe(e),config:{disabled:!1,onReposition:void 0},name:"@lexical/utils/SelectionAlwaysOnDisplay",register:(t,e,n)=>{const o=n.getOutput();return de(()=>{if(!o.disabled.value)return jt(t,o.onReposition.value)})}};function oo(t){return t.canIndent()}function io(t,e,o=oo){return C(t.registerCommand(At,e=>{const o=n();if(!i(o))return!1;e.preventDefault();const r=function(t){if(t.getNodes().filter(t=>Kt(t)&&t.canIndent()).length>0)return!0;const e=t.anchor,n=t.focus,o=n.isBefore(e)?n:e,i=o.getNode(),r=Tt(i);if(r.canIndent()){const t=r.getKey();let e=D();if(e.anchor.set(t,0,"element"),e.focus.set(t,0,"element"),e=Lt(e),e.anchor.is(o))return!0}return!1}(o)?e.shiftKey?Mt:Dt:It;return t.dispatchCommand(r)},s),t.registerCommand(Dt,()=>{const t="number"==typeof e?e:e?e.peek():null,r=n();if(!i(r))return!1;const s="function"==typeof o?o:o.peek();return Pt(e=>{if(s(e)){const n=e.getIndent()+1;(!t||n<t)&&e.setIndent(n)}})},Ft))}const ro={build:(t,e,n)=>fe(e),config:{$canIndent:oo,disabled:!1,maxIndent:null},name:"@lexical/extension/TabIndentation",register(t,e,n){const{disabled:o,maxIndent:i,$canIndent:r}=n.getOutput();return de(()=>{if(!o.value)return io(t,i,r)})}};export{Oe as $applyFormatToDom,Ln as $createHorizontalRuleNode,ye as $defaultShouldInsertAfter,dn as $getExtensionDependency,fn as $getExtensionOutput,hn as $getPeerDependency,_e as $isDecoratorTextNode,$n as $isHorizontalRuleNode,he as AutoFocusExtension,me as ClearEditorExtension,be as ClickAfterLastBlockExtension,Ae as DecoratorTextExtension,we as DecoratorTextNode,De as EditorStateExtension,An as HMRExtension,jn as HorizontalRuleExtension,Fn as HorizontalRuleNode,Pn as IMEExtension,In as INSERT_HORIZONTAL_RULE_COMMAND,Qe as InitialStateExtension,Vn as KeyboardShortcutsExtension,cn as LexicalBuilder,Gn as NestedEditorExtension,Zn as NodeSelectionDataSelectedExtension,Dn as NodeSelectionExtension,Xn as NormalizeInlineElementsExtension,qn as NormalizeTripleClickSelectionExtension,to as PreventSelectAllExtension,_n as RootElementExtension,eo as SelectBlockExtension,no as SelectionAlwaysOnDisplayExtension,ro as TabIndentationExtension,Nn as WatchEditableExtension,Ne as applyFormatFromStyle,ke as applyFormatToDom,Ht as batch,en as buildEditorFromExtensions,se as computed,de as effect,Wn as formatKeyboardShortcut,an as getExtensionDependencyFromEditor,xe as getKnownTypesAndNodes,un as getPeerDependencyFromEditor,ln as getPeerDependencyFromEditorOrThrow,fe as namedSignals,ge as registerClearEditor,io as registerTabIndentation,ee as signal,Vt as untracked,Me as watchedSignal};
|
|
9
|
+
import{getActiveElement as t,$getRoot as e,$getSelection as n,$createParagraphNode as o,$isRangeSelection as i,CLEAR_EDITOR_COMMAND as r,COMMAND_PRIORITY_EDITOR as s,$isDecoratorNode as c,$isElementNode as a,registerEventListeners as u,stopLexicalPropagation as l,getStaticNodeConfig as d,DecoratorNode as f,$getState as h,toggleTextFormatType as p,$setState as g,$getDocument as m,TEXT_TYPE_TO_FORMAT as y,createState as v,shallowMergeConfig as b,RootNode as x,TextNode as S,LineBreakNode as E,TabNode as w,ParagraphNode as _,HISTORY_MERGE_TAG as N,$isEditorState as k,createEditor as O,mergeRegister as C,$getEditor as R,$parseSerializedNode as A,$createNodeSelection as M,$createRangeSelection as D,$isNodeSelection as I,$getNodeByKey as F,$create as K,CLICK_COMMAND as L,isDOMNode as $,$getNodeFromDOMNode as j,COMMAND_PRIORITY_LOW as P,addClassNamesToElement as T,createCommand as z,$setSelection as U,removeClassNamesFromElement as H,COMPOSITION_START_COMMAND as W,COMMAND_PRIORITY_BEFORE_EDITOR as B,COMPOSITION_START_TAG as V,$isTextNode as G,registerEventListener as Z,COMMAND_PRIORITY_NORMAL as J,keyboardEventMaskForPlatform as X,IS_APPLE as Y,compileKeyboardShortcuts as q,KEY_DOWN_COMMAND as Q,getRegisteredSubtypeMap as tt,ElementNode as et,$getCaretRangeInDirection as nt,$caretRangeFromSelection as ot,$isTextPointCaret as it,$rewindSiblingCaret as rt,$isSiblingCaret as st,$isLineBreakNode as ct,$isChildCaret as at,$getSiblingCaret as ut,$normalizeCaret as lt,$getChildCaret as dt,$setSelectionFromCaretRange as ft,$getCaretRange as ht,getDOMSelection as pt,$updateDOMSelection as gt,$getPreviousSelection as mt,SKIP_SELECTION_FOCUS_TAG as yt,SKIP_SCROLL_INTO_VIEW_TAG as vt,SELECTION_CHANGE_COMMAND as bt,COMMAND_PRIORITY_BEFORE_CRITICAL as xt,isExactShortcutMatch as St,CONTROL_OR_META as Et,isHTMLElement as wt,SELECT_ALL_COMMAND as _t,$isBlockFullySelected as Nt,$selectAll as kt,$isRootNode as Ot,$getSlotFrame as Ct,$getSlotHost as Rt,KEY_TAB_COMMAND as At,OUTDENT_CONTENT_COMMAND as Mt,INDENT_CONTENT_COMMAND as Dt,INSERT_TAB_COMMAND as It,COMMAND_PRIORITY_CRITICAL as Ft,$isBlockElementNode as Kt,$normalizeSelection__EXPERIMENTAL as Lt}from"lexical";export{CONTROL_OR_ALT,CONTROL_OR_META,compileKeyboardShortcuts,configExtension,declarePeerDependency,defineExtension,safeCast,shallowMergeConfig}from"lexical";import{$insertNodeToNearestRoot as $t,selectionAlwaysOnDisplay as jt,$handleIndentAndOutdent as Pt,$getNearestBlockElementAncestorOrThrow as Tt}from"@lexical/utils";const zt=Symbol.for("preact-signals");function Ut(){if(Zt>1)return void Zt--;let t,e=!1;for(!function(){let t=Gt;for(Gt=void 0;void 0!==t;)t.S.v===t.v&&(t.S.i=t.i),t=t.o}();void 0!==Bt;){let n=Bt;for(Bt=void 0,Jt++;void 0!==n;){const o=n.u;if(n.u=void 0,n.f&=-3,!(8&n.f)&&ne(n))try{n.c()}catch(n){e||(t=n,e=!0)}n=o}}if(Jt=0,Zt--,e)throw t}function Ht(t){if(Zt>0)return t();Yt=++Xt,Zt++;try{return t()}finally{Ut()}}let Wt,Bt;function Vt(t){const e=Wt;Wt=void 0;try{return t()}finally{Wt=e}}let Gt,Zt=0,Jt=0,Xt=0,Yt=0,qt=0;function Qt(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 te(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 ee(t,e){return new te(t,e)}function ne(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 oe(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 ie(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 re(t,e){te.call(this,void 0),this.x=t,this.s=void 0,this.g=qt-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 se(t,e){return new re(t,e)}function ce(t){const e=t.m;if(t.m=void 0,"function"==typeof e){Zt++;const n=Wt;Wt=void 0;try{e()}catch(e){throw t.f&=-2,t.f|=8,ae(t),e}finally{Wt=n,Ut()}}}function ae(t){for(let e=t.s;void 0!==e;e=e.n)e.S.U(e);t.x=void 0,t.s=void 0,ce(t)}function ue(t){if(Wt!==this)throw new Error("Out-of-order effect");ie(this),Wt=t,this.f&=-2,8&this.f&&ae(this),Ut()}function le(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 de(t,e){const n=new le(t,e);try{n.c()}catch(t){throw n.d(),t}const o=n.d.bind(n);return o[Symbol.dispose]=o,o}function fe(t,e={}){const n={};for(const o in t){const i=e[o],r=ee(void 0===i?t[o]:i);n[o]=r}return n}te.prototype.brand=zt,te.prototype.h=function(){return!0},te.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:Vt(()=>{var t;null==(t=this.W)||t.call(this)}))},te.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&&Vt(()=>{var t;null==(t=this.Z)||t.call(this)}))}},te.prototype.subscribe=function(t){return de(()=>{const e=this.value,n=Wt;Wt=void 0;try{t(e)}finally{Wt=n}},{name:"sub"})},te.prototype.valueOf=function(){return this.value},te.prototype.toString=function(){return this.value+""},te.prototype.toJSON=function(){return this.value},te.prototype.peek=function(){const t=Wt;Wt=void 0;try{return this.value}finally{Wt=t}},Object.defineProperty(te.prototype,"value",{get(){const t=Qt(this);return void 0!==t&&(t.i=this.i),this.v},set(t){if(t!==this.v){if(Jt>100)throw new Error("Cycle detected");!function(t){0!==Zt&&0===Jt&&t.l!==Yt&&(t.l=Yt,Gt={S:t,v:t.v,i:t.i,o:Gt})}(this),this.v=t,this.i++,qt++,Zt++;try{for(let t=this.t;void 0!==t;t=t.x)t.t.N()}finally{Ut()}}}}),re.prototype=new te,re.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===qt)return!0;if(this.g=qt,this.f|=1,this.i>0&&!ne(this))return this.f&=-2,!0;const t=Wt;try{oe(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,ie(this),this.f&=-2,!0},re.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)}te.prototype.S.call(this,t)},re.prototype.U=function(t){if(void 0!==this.t&&(te.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)}},re.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(re.prototype,"value",{get(){if(1&this.f)throw new Error("Cycle detected");const t=Qt(this);if(this.h(),void 0!==t&&(t.i=this.i),16&this.f)throw this.v;return this.v}}),le.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()}},le.prototype.S=function(){if(1&this.f)throw new Error("Cycle detected");this.f|=1,this.f&=-9,ce(this),oe(this),Zt++;const t=Wt;return Wt=this,ue.bind(this,t)},le.prototype.N=function(){2&this.f||(this.f|=2,this.u=Bt,Bt=this)},le.prototype.d=function(){this.f|=8,1&this.f||ae(this)},le.prototype.dispose=function(){this.d()};const he={build:(t,e,n)=>fe(e),config:{defaultSelection:"rootEnd",disabled:!1},name:"@lexical/extension/AutoFocus",register(e,n,o){const i=o.getOutput();return de(()=>i.disabled.value?void 0:e.registerRootListener(n=>{e.focus(()=>{const e=null!==n?t(n):null;null===n||null!==e&&n.contains(e)||n.focus({preventScroll:!0})},{defaultSelection:i.defaultSelection.peek()})}))}};function pe(){const t=e(),r=n(),s=o();t.clear(),t.append(s),null!==r&&s.select(),i(r)&&(r.format=0)}function ge(t,e=pe){return t.registerCommand(r,()=>(e(),!0),s)}const me={build:(t,e,n)=>fe(e),config:{$onClear:pe},name:"@lexical/extension/ClearEditor",register(t,e,n){const{$onClear:o}=n.getOutput();return de(()=>ge(t,o.value))}};function ye(t){return!!c(t)||!(!a(t)||!t.isShadowRoot())}function ve(t,n,o,i){return!!t.isEditable()&&(o.target===n&&t.read("latest",()=>{const n=e().getLastChild();if(null===n)return!1;const r=t.getElementByKey(n.getKey());return null!==r&&(!(o.clientY<=r.getBoundingClientRect().bottom)&&i(n))}))}const be={build:(t,e)=>fe(e),config:{$shouldInsertAfter:ye,disabled:!1},name:"@lexical/ClickAfterLastBlock",register:(t,n,i)=>de(()=>{const n=i.getOutput();if(!n.disabled.value)return t.registerRootListener(i=>{if(null===i)return;return u(i,{click:r=>{ve(t,i,r,n.$shouldInsertAfter.peek())&&(r.preventDefault(),l(r),t.update(()=>{const t=e().getLastChild();if(null===t)return;if(!n.$shouldInsertAfter.peek()(t))return;const i=o();t.insertAfter(i),i.select()}))},mousedown:e=>{ve(t,i,e,n.$shouldInsertAfter.peek())&&e.preventDefault()}},!0)})})};function xe(t){const e=new Set,n=new Set;for(const o of Se(t)){const t="function"==typeof o?o:o.replace;d(t),e.add(t.getType()),n.add(t)}return{nodes:n,types:e}}function Se(t){return("function"==typeof t.nodes?t.nodes():t.nodes)||[]}const Ee=/* @__PURE__ */v("format",{parse:t=>"number"==typeof t?t:0});class we extends f{get __isInlineFormattable(){return!0}$config(){return this.config("decorator-text",{extends:f,stateConfigs:[{flat:!0,stateConfig:Ee}]})}getFormat(t){return h(this,Ee,t)}getFormatFlags(t,e){return p(this.getFormat(),t,e)}hasFormat(t){const e=y[t];return 0!==(this.getFormat()&e)}setFormat(t){return g(this,Ee,t)}toggleFormat(t){const e=this.getFormat(),n=p(e,t,null);return this.setFormat(n)}isInline(){return!0}createDOM(t,e){return m().createElement("span")}}function _e(t){return t instanceof we}function Ne(t,e,n){const o=e.fontWeight,i=e.textDecoration.split(" "),r="700"===o||"bold"===o,s=i.includes("line-through"),c="italic"===e.fontStyle,a=i.includes("underline"),u=e.verticalAlign;return r&&!t.hasFormat("bold")&&t.toggleFormat("bold"),s&&!t.hasFormat("strikethrough")&&t.toggleFormat("strikethrough"),c&&!t.hasFormat("italic")&&t.toggleFormat("italic"),a&&!t.hasFormat("underline")&&t.toggleFormat("underline"),"sub"!==u||t.hasFormat("subscript")||t.toggleFormat("subscript"),"super"!==u||t.hasFormat("superscript")||t.toggleFormat("superscript"),n&&!t.hasFormat(n)&&t.toggleFormat(n),t}function ke(t,e,n=Re){let o=e;for(const[e,i]of Object.entries(n))t.hasFormat(i)&&(o=Ce(o,e));return o}const Oe=ke;function Ce(t,e){const n=t.ownerDocument.createElement(e);return n.appendChild(t),n}const Re={b:"bold",code:"code",em:"italic",i:"italic",mark:"highlight",s:"strikethrough",strong:"bold",sub:"subscript",sup:"superscript",u:"underline"},Ae={name:"@lexical/extension/DecoratorText",nodes:()=>[we]};function Me(t,e){let n;return ee(t(),{unwatched(){n&&(n(),n=void 0)},watched(){this.value=t(),n=e(this)}})}const De={build:t=>Me(()=>t.getEditorState(),e=>t.registerUpdateListener(t=>{e.value=t.editorState})),name:"@lexical/extension/EditorState"};function Ie(t,...e){const n=new URL("https://lexical.dev/docs/error"),o=new URLSearchParams;o.append("code",t);for(const t of e)o.append("v",t);throw n.search=o.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.50.1-nightly.20260903.0+prod.esm"}catch(t){}const Ke=Fe??'"<unknown>+source"',Le=new Set(["__proto__","constructor","prototype"]);function $e(t,e){if(t&&e&&!Array.isArray(e)&&"object"==typeof t&&"object"==typeof e){const n=t,o=e;for(const t in o)!Le.has(t)&&Object.prototype.hasOwnProperty.call(o,t)&&(n[t]=$e(n[t],o[t]));return t}return e}const je=0,Pe=1,Te=2,ze=3,Ue=4,He=5,We=6,Be=7;function Ve(t){return t.id===je}function Ge(t){return t.id===Te}function Ze(t){return function(t){return t.id===Pe}(t)||Ie(305,String(t.id),String(Pe)),Object.assign(t,{id:Te})}const Je=new Set;class Xe{builder;configs;_dependency;_peerNameSet;extension;state;_signal;constructor(t,e){this.builder=t,this.extension=e,this.configs=new Set,this.state={id:je}}mergeConfigs(){let t=this.extension.config||{};const e=this.extension.mergeConfig?this.extension.mergeConfig.bind(this.extension):b;for(const n of this.configs)t=e(t,n);return t}init(t){const e=this.state;Ge(e)||Ie(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)},o={...n,getDependency:this.getDependency.bind(this),getInitResult:this.getInitResult.bind(this),getPeer:this.getPeer.bind(this)},i=function(t,e,n){return Object.assign(t,{config:e,id:ze,registerState:n})}(e,this.mergeConfigs(),n);let r;this.state=i,this.extension.init&&(r=this.extension.init(t,i.config,n)),this.state=function(t,e,n){return Object.assign(t,{id:Ue,initResult:e,registerState:n})}(i,r,o)}build(t){const e=this.state;let n;e.id!==Ue&&Ie(307,String(e.id),String(He)),this.extension.build&&(n=this.extension.build(t,e.config,e.registerState));const o={...e.registerState,getOutput:()=>n,getSignal:this.getSignal.bind(this)};this.state=function(t,e,n){return Object.assign(t,{id:He,output:e,registerState:n})}(e,n,o)}register(t,e){this._signal=e;const n=this.state;n.id!==He&&Ie(308,String(n.id),String(He));const o=this.extension.register&&this.extension.register(t,n.config,n.registerState);return this.state=function(t){return Object.assign(t,{id:We})}(n),()=>{const t=this.state;t.id!==Be&&Ie(309,String(n.id),String(Be)),this.state=function(t){return Object.assign(t,{id:He})}(t),o&&o()}}afterRegistration(t){const e=this.state;let n;return e.id!==We&&Ie(310,String(e.id),String(We)),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&&Ie(311),this._signal}getInitResult(){void 0===this.extension.init&&Ie(312,this.extension.name);const t=this.state;return function(t){return t.id>=Ue}(t)||Ie(313,String(t.id),String(Ue)),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>=ze}(t)||Ie(314,String(t.id),String(ze)),{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&&Ie(315,this.extension.name,t.name),e.getExtensionInitDependency()}getDependency(t){const e=this.builder.getExtensionRep(t);return void 0===e&&Ie(315,this.extension.name,t.name),e.getExtensionDependency()}getState(){const t=this.state;return function(t){return t.id>=Be}(t)||Ie(316,String(t.id),String(Be)),t}getDirectDependentNames(){return this.builder.incomingEdges.get(this.extension.name)||Je}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>=He})(t)||Ie(317,this.extension.name),this._dependency={config:t.config,init:t.initResult,output:t.output}}return this._dependency}}const Ye={tag:N};function qe(){const t=e();t.isEmpty()&&t.append(o())}const Qe={config:{setOptions:Ye,updateOptions:Ye},init:({$initialEditorState:t=qe})=>({$initialEditorState:t,initialized:!1}),afterRegistration(t,{updateOptions:e,setOptions:n},o){const i=o.getInitResult();if(!i.initialized){i.initialized=!0;const{$initialEditorState:o}=i;if(k(o))t.setEditorState(o,n);else if("function"==typeof o)t.update(()=>{o(t)},e);else if(o&&("string"==typeof o||"object"==typeof o)){const e=t.parseEditorState(o);t.setEditorState(e,n)}}return()=>{}},name:"@lexical/extension/InitialState",nodes:[x,S,E,w,_]},tn=Symbol.for("@lexical/extension/LexicalBuilder");function en(...t){return cn.fromExtensions(t).buildEditor()}function nn(){}function on(t){throw t}function rn(t){return Array.isArray(t)?t:[t]}const sn=Ke;class cn{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=sn,this.roots=t;for(const e of t)this.addExtension(e)}static fromExtensions(t){const e=[rn(Qe)];for(const n of t)e.push(rn(n));return new cn(e)}static maybeFromEditor(t){const e=t[tn];return e&&(e.PACKAGE_VERSION!==sn&&Ie(292,e.PACKAGE_VERSION,sn),e instanceof cn||Ie(293)),e}static fromEditor(t){const e=cn.maybeFromEditor(t);return void 0===e&&Ie(294),e}constructEditor(){const{$initialEditorState:t,onError:e,onWarn:n,...o}=this.buildCreateEditorArgs(),i=Object.assign(O({...o,...e?{onError:t=>{e(t,i)}}:{},...n?{onWarn:t=>{n(t,i)}}:{}}),{[tn]:this});for(const t of this.sortedExtensionReps())t.build(i);return i}buildEditor(){let t=nn;function e(){try{t()}finally{t=nn}}const n=Object.assign(this.constructEditor(),{dispose:e,[Symbol.dispose]:e});return t=C(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&&Ie(295,t.name),e}addEdge(t,e,n){const o=this.outgoingConfigEdges.get(t);if(o){const t=o.get(e);t?t.push(...n):o.set(e,n)}else this.outgoingConfigEdges.set(t,new Map([[e,n]]));const i=this.incomingEdges.get(e);i?i.add(t):this.incomingEdges.set(e,new Set([t]))}addExtension(t){void 0!==this._sortedExtensionReps&&Ie(296);const e=rn(t),[n]=e;"string"!=typeof n.name&&Ie(297,typeof n.name);let o=this.extensionNameMap.get(n.name);if(void 0!==o&&o.extension!==n&&Ie(298,n.name),!o){o=new Xe(this,n),this.extensionNameMap.set(n.name,o);const t=this.conflicts.get(n.name);"string"==typeof t&&Ie(299,n.name,t);for(const t of n.conflictsWith||[])this.extensionNameMap.has(t)&&Ie(299,n.name,t),this.conflicts.set(t,n.name);for(const t of n.dependencies||[]){const e=rn(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,o)=>{let i=n.state;if(Ge(i))return;const r=n.extension.name;var s;Ve(i)||Ie(300,r,o||"[unknown]"),Ve(s=i)||Ie(304,String(s.id),String(je)),i=Object.assign(s,{id:Pe}),n.state=i;const c=this.outgoingConfigEdges.get(r);if(c)for(const t of c.keys()){const n=this.extensionNameMap.get(t);n&&e(n,r)}i=Ze(i),n.state=i,t.push(n)};for(const t of this.extensionNameMap.values())Ve(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&&Ie(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,o=[()=>n.abort()],i=n.signal;for(const n of e){const e=n.register(t,i);e&&o.push(e)}for(const n of e){const e=n.afterRegistration(t);e&&o.push(e)}return C(...o)}buildCreateEditorArgs(){const t={},e=new Set,n=new Map,o=new Map,i={},r={},s=this.sortedExtensionReps();for(const c of s){const{extension:s}=c;if(void 0!==s.onError&&(t.onError=s.onError),void 0!==s.onWarn&&(t.onWarn=s.onWarn),void 0!==s.disableEvents&&(t.disableEvents=s.disableEvents),void 0!==s.parentEditor&&(t.parentEditor=s.parentEditor),void 0!==s.editable&&(t.editable=s.editable),void 0!==s.namespace&&(t.namespace=s.namespace),void 0!==s.$initialEditorState&&(t.$initialEditorState=s.$initialEditorState),s.nodes)for(const t of Se(s)){if("function"!=typeof t){const e=n.get(t.replace);e&&Ie(302,s.name,t.replace.name,e.extension.name),n.set(t.replace,c)}e.add(t)}if(s.html){if(s.html.export)for(const[t,e]of s.html.export.entries())o.set(t,e);s.html.import&&Object.assign(i,s.html.import)}s.theme&&$e(r,s.theme)}Object.keys(r).length>0&&(t.theme=r),e.size&&(t.nodes=[...e]);const c=Object.keys(i).length>0,a=o.size>0;(c||a)&&(t.html={},c&&(t.html.import=i),a&&(t.html.export=o));for(const e of s)e.init(t);return t.onError||(t.onError=on),t}}function an(t,e){const n=cn.fromEditor(t).getExtensionRep(e);return void 0===n&&Ie(303,e.name),n.getExtensionDependency()}function un(t,e){const n=cn.maybeFromEditor(t);if(!n)return;const o=n.extensionNameMap.get(e);return o?o.getExtensionDependency():void 0}function ln(t,e){const n=un(t,e);return void 0===n&&Ie(291,e),n}function dn(t){return an(R(),t)}function fn(t){return dn(t).output}function hn(t){return un(R(),t)}const pn={root:{children:[],direction:null,format:"",indent:0,type:"root",version:1}};function gn(t){const e=t.exportJSON();delete e.children,delete e.$slots;const n={json:e,key:t.__key,next:t.__next,parent:t.__parent,prev:t.__prev};a(t)&&(n.first=t.__first,n.last=t.__last,n.size=t.__size);const{__slotHost:o,__slots:i}=t;return null!=i&&(n.slots=[...i]),null!=o&&(n.slotHost=o),n}function mn(t){const e=new Map,n=[],o=t.map(t=>t.read(()=>{const o=[];for(const i of t._nodeMap.values()){let t=e.get(i);void 0===t&&(t=n.length,e.set(i,t),n.push(gn(i))),o.push(t)}return{nodes:o,selection:(r=t._selection,i(r)?{anchor:{key:r.anchor.key,offset:r.anchor.offset,type:r.anchor.type},focus:{key:r.focus.key,offset:r.focus.offset,type:r.focus.type},format:r.format,style:r.style,type:"range"}:I(r)?{keys:[...r._nodes],type:"node"}:null)};var r}));return{nodes:n,states:o}}function yn(t){return null!=t&&"object"==typeof t}function vn(t){return null==t||"string"==typeof t}function bn(t){if(!yn(t))return!1;const{first:e,json:n,key:o,last:i,next:r,parent:s,prev:c,size:a,slotHost:u,slots:l}=t;return yn(n)&&"string"==typeof n.type&&"string"==typeof o&&vn(s)&&vn(c)&&vn(r)&&vn(e)&&vn(i)&&(void 0===a||"number"==typeof a)&&vn(u)&&(void 0===l||Array.isArray(l)&&l.every(t=>Array.isArray(t)&&2===t.length&&"string"==typeof t[0]&&"string"==typeof t[1]))}function xn(t){return yn(t)&&"string"==typeof t.key&&"number"==typeof t.offset&&("text"===t.type||"element"===t.type)}function Sn(t){if(!yn(t))return!1;const{nodes:e,states:n}=t;return Array.isArray(e)&&Array.isArray(n)&&e.every(bn)&&n.every(t=>yn(t)&&Array.isArray(t.nodes)&&t.nodes.every(t=>"number"==typeof t&&t>=0&&t<e.length)&&function(t){return null==t||!!yn(t)&&("node"===t.type?Array.isArray(t.keys)&&t.keys.every(t=>"string"==typeof t):"range"===t.type&&xn(t.anchor)&&xn(t.focus)&&"number"==typeof t.format&&"string"==typeof t.style)}(t.selection))}function En(t,n){if("root"!==t.type)return A(t);let o;if(n.parseEditorState({root:t},()=>{o=e()}),void 0===o)throw new Error("editorStateFamily: the root version did not parse");return o}function wn(t,e){const n=[],o=new Map;let i=!1,r=!1;const s=e.parseEditorState(pn,()=>{for(const i of t.nodes){let t=null;try{t=En(i.json,e)}catch(t){n.push(null);continue}const r=o.get(i.key);void 0===r?o.set(i.key,t.__key):t.__key=r,n.push(t)}const s=t=>null===t?null:o.get(t)??null;for(const[e,o]of t.nodes.entries()){const t=n[e];if(null===t)continue;t.__parent=s(o.parent),t.__prev=s(o.prev),t.__next=s(o.next),a(t)&&(t.__first=s(o.first??null),t.__last=s(o.last??null),t.__size=o.size??0);const r=t;void 0!==o.slots&&(i=!0,r.__slots=new Map(o.slots.flatMap(([t,e])=>{const n=s(e);return null===n?[]:[[t,n]]}))),void 0!==o.slotHost&&(r.__slotHost=s(o.slotHost))}r=!0});return r?t.states.map(t=>{const e=new Map;for(const o of t.nodes){const t=n[o];if(null==t)return null;e.set(t.__key,t)}if(!e.has("root"))return null;const r=s.clone(function(t,e){if(null==t)return null;if("node"===t.type){const n=M();for(const o of t.keys){const t=e.get(o);if(void 0===t)return null;n._nodes.add(t)}return n}const n=e.get(t.anchor.key),o=e.get(t.focus.key);if(void 0===n||void 0===o)return null;const i=D();return i.anchor.key=n,i.anchor.offset=t.anchor.offset,i.anchor.type=t.anchor.type,i.focus.key=o,i.focus.offset=t.focus.offset,i.focus.type=t.focus.type,i.format=t.format,i.style=t.style,i}(t.selection,o));return r._nodeMap=e,r._slotsUsed=i,r._parsed=!1,r}):t.states.map(()=>null)}const _n={build:t=>Me(()=>t.getRootElement(),e=>t.registerRootListener(t=>{e.value=t})),name:"@lexical/extension/RootElement"},Nn={build:t=>Me(()=>t.isEditable(),e=>t.registerEditableListener(t=>{e.value=t})),name:"@lexical/extension/WatchEditable"};function kn(t,e){return function(t,e){const n=`lexicalHMR:${encodeURIComponent(e)}`;return void 0!==t?`${n}:${encodeURIComponent(t)}`:n}(""===e?void 0:e,On(t)?t._config.namespace:"")}function On(t){const e=cn.maybeFromEditor(t);if(!e)return!1;for(const n of e.extensionNameMap.values()){const{namespace:e}=n.extension;if(e&&e===t._config.namespace)return!0}return null!==t._parentEditor&&On(t._parentEditor)}function Cn(t,e){return t.data[e]}function Rn(t){if(null==t||"object"!=typeof t)return!1;const e=t,n=t=>Object.prototype.hasOwnProperty.call(e,t);return n("editable")&&n("editorState")&&"boolean"==typeof e.editable&&function(t){return"object"==typeof t&&null!==t&&"function"==typeof t.toJSON&&"function"==typeof t.isEmpty}(e.editorState)}const An={afterRegistration(t,{hot:e,id:n},o){if(!e)return()=>{};const i=kn(t,n),r=un(t,"@lexical/history/History");let s=!1;const c=Cn(e,i);if(Rn(c))try{t.setEditable(c.editable);const e="function"==typeof c.serialize?c.serialize():null;if(function(t){if(null==t||"object"!=typeof t)return!1;const{family:e,history:n}=t;if(!Sn(e))return!1;if(null==n)return!0;const o=t=>"number"==typeof t&&t>=0&&t<e.states.length,{current:i,redoStack:r,undoStack:s}=n;return(null===i||o(i))&&Array.isArray(r)&&r.every(o)&&Array.isArray(s)&&s.every(o)}(e)){const n=wn(e.family,t),o=n[0];null==o||o.isEmpty()||(o._parsed=!0,t.setEditorState(o,{tag:N}),null!=e.history&&r&&(r.output.historyState.value=function(t,e,n){const o=t=>{const o=e[t];return null==o||o.isEmpty()?null:{editor:n,editorState:o}},i=t=>t.map(o).filter(t=>null!==t),r=null===t.current?null:o(t.current),s=i(t.undoStack);return{current:r,redoStack:i(t.redoStack),undoStack:s}}(e.history,n,t)),s=!0)}else;}catch(t){}s&&o.getInitResult().restoreCount.value++;const a=o.getDependency(De).output,u=o.getDependency(Nn).output,l=o.getDependency(_n).output;let d=null;return de(()=>{const n=a.value,o=u.value,s=null!==l.value,c=Cn(e,i);if(null!==d&&d.editorState===n&&d.editable===o)return void(Rn(c)&&c.owner===t&&(c.mounted=s));d={editable:o,editorState:n};const f={...(n.isEmpty()&&Rn(c)?c:null)??{editorState:n,serialize:()=>function(t,e,n){const o=[e],i=e=>e.editor===t,r=t=>o.push(t.editorState)-1,s=t=>t.filter(i).map(r),c=n?{current:n.current&&i(n.current)?r(n.current):null,redoStack:s(n.redoStack),undoStack:s(n.undoStack)}:null;return{family:mn(o),history:c}}(t,n,r?r.output.historyState.peek():null)},editable:o,mounted:s,owner:t};e.data[i]=f})},build:(t,e,n)=>n.getInitResult(),config:{hot:null},dependencies:[De,_n,Nn],init:()=>({restoreCount:ee(0)}),name:"@lexical/extension/HMR"},Mn=new Set,Dn={build(t,e,o){const i=o.getDependency(De).output,r=ee({watchedNodeKeys:new Map}),s=Me(()=>{},()=>de(()=>{const t=s.peek(),{watchedNodeKeys:e}=r.value;let o,c=!1;i.value.read(()=>{if(n())for(const[n,i]of e.entries()){if(0===i.size){e.delete(n);continue}const r=F(n),s=r&&r.isSelected()||!1;c=c||s!==(!!t&&t.has(n)),s&&(o=o||new Set,o.add(n))}}),!c&&o&&t&&o.size===t.size||(s.value=o)}));return{watchNodeKey:function(t){const e=se(()=>(s.value||Mn).has(t)),{watchedNodeKeys:n}=r.peek();let o=n.get(t);const i=void 0!==o;return o=o||new Set,o.add(e),i||(n.set(t,o),r.value={watchedNodeKeys:n}),e}}},dependencies:[De],name:"@lexical/extension/NodeSelection"},In=/* @__PURE__ */z("INSERT_HORIZONTAL_RULE_COMMAND");class Fn extends f{$config(){return this.config("horizontalrule",{importDOM:{hr:()=>({conversion:Kn,priority:0})}})}exportDOM(){return{element:m().createElement("hr")}}createDOM(t){const e=m().createElement("hr");return T(e,t.theme.hr),e}getTextContent(){return"\n"}isInline(){return!1}updateDOM(){return!1}}function Kn(){return{node:Ln()}}function Ln(){return K(Fn)}function $n(t){return t instanceof Fn}const jn={dependencies:[De,Dn],name:"@lexical/extension/HorizontalRule",nodes:()=>[Fn],register(t,e,o){const{watchNodeKey:r}=o.getDependency(Dn).output,c=ee({nodeSelections:new Map}),a=t._config.theme.hrSelected??"selected";return C(t.registerCommand(In,t=>{const e=n();if(!i(e))return!1;if(null!==e.focus.getNode()){const t=Ln();$t(t)}return!0},s),t.registerCommand(L,t=>{if($(t.target)){const e=j(t.target);if($n(e))return function(t,e=!1){const o=n(),i=t.isSelected(),r=t.getKey();let s;e&&I(o)?s=o:(s=M(),U(s)),i?s.delete(r):s.add(r)}(e,t.shiftKey),!0}return!1},P),t.registerMutationListener(Fn,(e,n)=>{Ht(()=>{let n=!1;const{nodeSelections:o}=c.peek();for(const[i,s]of e.entries())if("destroyed"===s)o.delete(i),n=!0;else{const e=o.get(i),s=t.getElementByKey(i);e?e.domNode.value=s:(n=!0,o.set(i,{domNode:ee(s),selectedSignal:r(i)}))}n&&(c.value={nodeSelections:o})})}),de(()=>{const t=[];for(const{domNode:e,selectedSignal:n}of c.value.nodeSelections.values())t.push(de(()=>{const t=e.value;if(t){n.value?T(t,a):H(t,a)}}));return C(...t)}))}},Pn={build:t=>({composingTextNode:ee(null),compositionKey:ee(null)}),name:"@lexical/extension/IME",register(t,e,o){const{compositionKey:r,composingTextNode:s}=o.getOutput(),c=t.registerCommand(W,()=>{const t=n();return i(t)&&(r.value=t.anchor.key),!1},B),a=de(()=>{const e=r.value;s.value=null!==e?t.read("latest",()=>{const t=F(e);return G(t)?t:null}):null}),u=t.registerUpdateListener(({tags:t,editorState:e})=>{t.has(V)&&e.read(()=>{const t=n();if(!i(t))return;const e=t.anchor.getNode();G(e)&&(s.value=e)})}),l=t.registerRootListener(t=>{if(null===t)return void(r.value=null);return Z(t,"compositionend",()=>{r.value=null})});return C(c,a,u,l)}},Tn=[["ctrlKey","Ctrl"],["altKey","Alt"],["shiftKey","Shift"],["metaKey","Meta"]],zn={" ":"Space"},Un={...zn,Alt:"\u2325",ArrowDown:"\u2193",ArrowLeft:"\u2190",ArrowRight:"\u2192",ArrowUp:"\u2191",Backspace:"\u232b",CapsLock:"\u21ea",Ctrl:"\u2303",Delete:"\u2326",End:"\u2198",Enter:"\u21a9",Escape:"\u238b",Home:"\u2196",Meta:"\u2318",PageDown:"\u21df",PageUp:"\u21de",Shift:"\u21e7",Tab:"\u21e5"},Hn={...Un,Tab:"\u21e4"};function Wn(t,e={}){const{isApple:n=Y}=e,{unshiftedKey:o,key:i}=t,r=X(t.modifiers||{},n),s=[],c=n?!0===r.shiftKey?Hn:Un:zn;for(const[t,e]of Tn)if(!0===r[t]){if(n&&"shiftKey"===t&&o&&1===i.length)continue;s.push(c[e]||e)}return s.push(c[i]||!n&&!0===r.shiftKey&&o||1===i.length&&i.toUpperCase()||i),s}function Bn(t){return function(t){return Array.isArray(t)}(t)?t:t?[t]:[]}const Vn={build:(t,e,n)=>fe(e),config:{disabled:!1,priority:J,shortcuts:{}},mergeConfig(t,e){const n=b(t,e);return n.shortcuts=function(t,e){if(!e)return t;const n={...e};for(const[e,o]of Object.entries(t))void 0===n[e]&&(n[e]=o);return n}(t.shortcuts,e.shortcuts),n},name:"@lexical/extension/KeyboardShortcuts",register(t,e,o){const{disabled:i,priority:r,shortcuts:s}=o.getOutput();return de(()=>{if(!i.value){const e=[];for(const t of Object.values(s.value))for(const n of Bn(t))e.push(n);return function(t,e,o){const i=q(e);return t.registerCommand(Q,(e,o)=>{let r;for(const s of i.matches(e)){if(t!==o&&!s.bubbleFromNestedEditors)continue;if(s.$disabled&&(void 0===r&&(r=n()),s.$disabled(r,o)))continue;const i=o.dispatchCommand.bind(o,s.command,e);if(s.$dispatch?s.$dispatch(s.command,e,i,o):i())return!0}return!1},o)}(t,e,r.value)}})}};const Gn={build:(t,e)=>fe({inheritEditableFromParent:e.inheritEditableFromParent}),config:{$getParentEditor:function(){const t=R();return cn.fromEditor(t),t},inheritEditableFromParent:!1},init:(t,e,n)=>{const o=e.$getParentEditor();t.parentEditor=o,t.theme=t.theme||o._config.theme},name:"@lexical/extension/NestedEditor",register:(t,e,n)=>de(()=>{const e=t._parentEditor;if(e&&n.getOutput().inheritEditableFromParent.value)return t.setEditable(e.isEditable()),e.registerEditableListener(t.setEditable.bind(t))})},Zn={config:{attribute:"data-selected",nodes:[]},init(t,e){const n=new Set,o=tt(xe(t).nodes);for(const t of e.nodes){const e=t.getType(),i=o.get(e);void 0===i&&Ie(339,t.name,e),n.add(e);for(const t of i)n.add(t)}return{matchTypes:n}},mergeConfig:(t,e)=>b(t,{...e,...e.nodes&&{nodes:[...t.nodes,...e.nodes]}}),name:"@lexical/extension/NodeSelectionDataSelected",register(t,e,o){const{attribute:i}=e,{matchTypes:r}=o.getInitResult(),s=new Map,c=e=>{const o=new Set;e.read(()=>{const t=n();if(I(t))for(const e of t.getNodes())r.has(e.getType())&&o.add(e.getKey())});for(const[t,e]of s)o.has(t)||(e.removeAttribute(i),s.delete(t));for(const e of o){const n=t.getElementByKey(e);null!==n&&(n.setAttribute(i,"true"),s.set(e,n))}};c(t.getEditorState());const a=t.registerUpdateListener(({editorState:t})=>c(t));return()=>{a();for(const t of s.values())t.removeAttribute(i);s.clear()}}};function Jn(t){a(t)&&t.isInline()&&t.isEmpty()&&t.remove()}const Xn={build:(t,e,n)=>fe(e),config:{disabled:!1},name:"@lexical/NormalizeInlineElements",register:(t,e,n)=>{const o=n.getOutput();return de(()=>{if(!o.disabled.value){const e=[];for(const{klass:n,transforms:o}of t._nodes.values())n.prototype instanceof et&&n.prototype.isInline!==et.prototype.isInline&&(o.add(Jn),e.push(()=>o.delete(Jn)));return()=>e.forEach(t=>t())}})}},Yn=new Set([yt,vt]);const qn={build:(t,e,n)=>fe(e),config:{$fixFocusOverselection:function(){const t=n();if(i(t)&&!t.isCollapsed()){const e=nt(ot(t),"next");let n=e.focus;for(it(n)&&e.anchor.origin!==n.origin&&0===n.offset&&(n=rt(n.getSiblingCaret())),st(n)&&e.anchor.origin!==n.origin&&ct(n.origin)&&(n=rt(n));at(n)&&e.anchor.origin!==n.origin;)n=rt(ut(n.origin,"next"));if(st(n)&&a(n.origin)&&(n=lt(dt(n.origin,"previous")).getFlipped()),n=lt(n),!n.isSamePointCaret(e.focus)){const t=ft(ht(e.anchor,n)),o=R().getRootElement(),i=o&&pt(o.ownerDocument.defaultView);i&>(mt(),t,R(),i,Yn,o)}}},dateNow:Date.now,disabled:!1,thresholdMsec:100},name:"@lexical/NormalizeTripleClickSelection",register:(t,e,n)=>de(()=>{const e=n.getOutput();if(!e.disabled.value)return t.registerRootListener(n=>{if(!n)return;let o=0;const i=t=>{if(t?t.detail>2:o>0){const n=e.dateNow.peek()();o=t&&"mousedown"===t.type||n-o<=e.thresholdMsec.peek()?n:0}return o};return C(t.registerCommand(bt,()=>(i(null)&&(o=0,e.$fixFocusOverselection.peek()()),!1),xt),u(n,{mousedown:i,mouseup:i},!0))})})};function Qn(t){const e=t.target;St(t,"a",Et)&&wt(e)&&("INPUT"===e.tagName||"TEXTAREA"===e.tagName)&&e.addEventListener("keydown",l,{once:!0})}const to={build:(t,e,n)=>fe(e),config:{disabled:!1},name:"@lexical/extension/PreventSelectAll",register:(t,e,n)=>{const o=n.getOutput();return de(()=>{if(!o.disabled.value)return t.registerRootListener(t=>{if(t)return Z(t,"keydown",Qn,!0)})})}};const eo={build:(t,e,n)=>fe(e),config:{cascadeSelection:!1,disabled:!1},dependencies:[to],name:"@lexical/extension/SelectBlock",register:(t,o,r)=>{const s=r.getOutput(),c=r.getDependency(to).output;return C(de(()=>{c.disabled.value=s.disabled.value}),de(()=>{if(!s.disabled.value)return t.registerCommand(_t,(o,r)=>{if(r!==t){if(!s.cascadeSelection.peek())return!1;return!!r.read("pending",()=>{const t=n();return i(t)&&Nt(e(),t)})&&(kt(),!0)}const c=n();if(I(c)){const t=c.getNodes(),e=t[0];if(!e)return!1;const n=e.getTopLevelElement();return!n||Ot(n)||n.is(e)||t.length>1&&(u=n,!t.every(t=>u.is(t.getTopLevelElement())))?kt():a(n)&&n.select(0,n.getChildrenSize()),!0}var u;if(!i(c))return!1;const l=c.anchor.getNode(),d=l.getTopLevelElement();if(d&&d.is(c.focus.getNode().getTopLevelElement())&&!Nt(d,c))return d.select(0,d.getChildrenSize()),!0;let f=Ct(l);for(;null!==f;){if(a(f)&&!Nt(f,c))return f.select(0,f.getChildrenSize()),!0;const t=Rt(f);f=null===t?null:Ct(t)}return Nt(e(),c)||kt(),!0},P)}))}},no={build:(t,e,n)=>fe(e),config:{disabled:!1,onReposition:void 0},name:"@lexical/utils/SelectionAlwaysOnDisplay",register:(t,e,n)=>{const o=n.getOutput();return de(()=>{if(!o.disabled.value)return jt(t,o.onReposition.value)})}};function oo(t){return t.canIndent()}function io(t,e,o=oo){return C(t.registerCommand(At,e=>{const o=n();if(!i(o))return!1;e.preventDefault();const r=function(t){if(t.getNodes().filter(t=>Kt(t)&&t.canIndent()).length>0)return!0;const e=t.anchor,n=t.focus,o=n.isBefore(e)?n:e,i=o.getNode(),r=Tt(i);if(r.canIndent()){const t=r.getKey();let e=D();if(e.anchor.set(t,0,"element"),e.focus.set(t,0,"element"),e=Lt(e),e.anchor.is(o))return!0}return!1}(o)?e.shiftKey?Mt:Dt:It;return t.dispatchCommand(r)},s),t.registerCommand(Dt,()=>{const t="number"==typeof e?e:e?e.peek():null,r=n();if(!i(r))return!1;const s="function"==typeof o?o:o.peek();return Pt(e=>{if(s(e)){const n=e.getIndent()+1;(!t||n<t)&&e.setIndent(n)}})},Ft))}const ro={build:(t,e,n)=>fe(e),config:{$canIndent:oo,disabled:!1,maxIndent:null},name:"@lexical/extension/TabIndentation",register(t,e,n){const{disabled:o,maxIndent:i,$canIndent:r}=n.getOutput();return de(()=>{if(!o.value)return io(t,i,r)})}};export{Oe as $applyFormatToDom,Ln as $createHorizontalRuleNode,ye as $defaultShouldInsertAfter,dn as $getExtensionDependency,fn as $getExtensionOutput,hn as $getPeerDependency,_e as $isDecoratorTextNode,$n as $isHorizontalRuleNode,he as AutoFocusExtension,me as ClearEditorExtension,be as ClickAfterLastBlockExtension,Ae as DecoratorTextExtension,we as DecoratorTextNode,De as EditorStateExtension,An as HMRExtension,jn as HorizontalRuleExtension,Fn as HorizontalRuleNode,Pn as IMEExtension,In as INSERT_HORIZONTAL_RULE_COMMAND,Qe as InitialStateExtension,Vn as KeyboardShortcutsExtension,cn as LexicalBuilder,Gn as NestedEditorExtension,Zn as NodeSelectionDataSelectedExtension,Dn as NodeSelectionExtension,Xn as NormalizeInlineElementsExtension,qn as NormalizeTripleClickSelectionExtension,to as PreventSelectAllExtension,_n as RootElementExtension,eo as SelectBlockExtension,no as SelectionAlwaysOnDisplayExtension,ro as TabIndentationExtension,Nn as WatchEditableExtension,Ne as applyFormatFromStyle,ke as applyFormatToDom,Ht as batch,en as buildEditorFromExtensions,se as computed,de as effect,Wn as formatKeyboardShortcut,an as getExtensionDependencyFromEditor,xe as getKnownTypesAndNodes,un as getPeerDependencyFromEditor,ln as getPeerDependencyFromEditorOrThrow,fe as namedSignals,ge as registerClearEditor,io as registerTabIndentation,ee as signal,Vt as untracked,Me as watchedSignal};
|
package/package.json
CHANGED
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
"extension",
|
|
7
7
|
"plugin"
|
|
8
8
|
],
|
|
9
|
-
"version": "0.50.0",
|
|
9
|
+
"version": "0.50.1-nightly.20260903.0",
|
|
10
10
|
"license": "MIT",
|
|
11
11
|
"repository": {
|
|
12
12
|
"type": "git",
|
|
@@ -23,10 +23,10 @@
|
|
|
23
23
|
"sideEffects": false,
|
|
24
24
|
"module": "./dist/LexicalExtension.mjs",
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@lexical/internal": "0.50.0",
|
|
27
|
-
"@lexical/utils": "0.50.0",
|
|
26
|
+
"@lexical/internal": "0.50.1-nightly.20260903.0",
|
|
27
|
+
"@lexical/utils": "0.50.1-nightly.20260903.0",
|
|
28
28
|
"@preact/signals-core": "^1.14.1",
|
|
29
|
-
"lexical": "0.50.0"
|
|
29
|
+
"lexical": "0.50.1-nightly.20260903.0"
|
|
30
30
|
},
|
|
31
31
|
"exports": {
|
|
32
32
|
".": {
|