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