bible-note 0.5.0 → 0.6.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/README.md +349 -293
  2. package/dist/bible-note.cjs +100 -101
  3. package/dist/bible-note.css +1 -1
  4. package/dist/bible-note.mjs +7799 -7717
  5. package/dist/chunks/{ContentEditable-C_wyHFh1.mjs → ContentEditable-BaXBKC3m.mjs} +1 -1
  6. package/dist/chunks/{ContentEditable-DgthEFHJ.cjs → ContentEditable-Ce294XLd.cjs} +2 -2
  7. package/dist/chunks/{ExcalidrawComponent-bEqDGYRW.cjs → ExcalidrawComponent-DdmtbuXc.cjs} +1 -1
  8. package/dist/chunks/{ExcalidrawComponent-iTobN_Hf.mjs → ExcalidrawComponent-OMjYgJCL.mjs} +2 -2
  9. package/dist/chunks/{ExcalidrawModal-DAEdxIBk.mjs → ExcalidrawModal-DSotOBGc.mjs} +2 -2
  10. package/dist/chunks/{ExcalidrawModal-Bbez9U5x.cjs → ExcalidrawModal-Db1LI01l.cjs} +2 -2
  11. package/dist/chunks/LexicalUtils.prod-CYv8J7Gq.cjs +3 -0
  12. package/dist/chunks/{LexicalUtils.prod-5zbJxaQa.mjs → LexicalUtils.prod-D2Igim2c.mjs} +28 -32
  13. package/dist/chunks/{MediaComponent-BTaaADsV.mjs → MediaComponent-D-AMKM9e.mjs} +3 -3
  14. package/dist/chunks/{MediaComponent-BhjGu3D-.cjs → MediaComponent-D69mEyrJ.cjs} +1 -1
  15. package/dist/chunks/{MediaResizer-C7UGQ3Kl.mjs → MediaResizer-C_ZJbHAU.mjs} +1 -1
  16. package/dist/chunks/{MediaResizer-DGw5LvDR.cjs → MediaResizer-Dzro5TVg.cjs} +1 -1
  17. package/dist/chunks/{StickyComponent-B8skHBRs.mjs → StickyComponent-B1GQ5G8T.mjs} +2 -2
  18. package/dist/chunks/{StickyComponent-C6xBrvrK.cjs → StickyComponent-DsQhvYHJ.cjs} +1 -1
  19. package/dist/chunks/{StickyNode-GgIn3-zY.cjs → StickyNode-B7sXOkJV.cjs} +1 -1
  20. package/dist/chunks/{StickyNode-B2B6di-N.mjs → StickyNode-C5dwEb8E.mjs} +3 -3
  21. package/dist/chunks/{TreeViewPlugin-DkUjU27t.cjs → TreeViewPlugin-8-uPZF17.cjs} +3 -3
  22. package/dist/chunks/{TreeViewPlugin-B0UnxNiM.mjs → TreeViewPlugin-Cd1KNBRW.mjs} +18 -18
  23. package/knowledge/development.md +222 -7
  24. package/knowledge/ui-rag.md +185 -135
  25. package/package.json +1 -1
  26. package/types/AppComp.d.ts +4 -2
  27. package/types/BibleNote.d.ts +31 -5
  28. package/types/actionButtonList.d.ts +23 -0
  29. package/types/bibleNoteHelpers.d.ts +3 -1
  30. package/types/floatingActionButtons.d.ts +118 -0
  31. package/types/lib.d.ts +1 -0
  32. package/dist/chunks/LexicalUtils.prod-W-Xb5dGB.cjs +0 -3
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bible-note",
3
- "version": "0.5.0",
3
+ "version": "0.6.2",
4
4
  "description": "A Bible study tool for taking notes and organizing your thoughts.",
5
5
  "license": "MIT",
6
6
  "author": "raksa <eng.raksa@gmail.com>",
@@ -7,6 +7,7 @@
7
7
  */
8
8
  import type { LibraryItems } from './excalidrawTypes';
9
9
  import { type JSX, type ReactNode } from 'react';
10
+ import { type BibleNoteFloatingActionButtonControllerOwner } from './floatingActionButtons';
10
11
  import { type BibleNoteFooterActionButtonControllerOwner } from './footerActionButtons';
11
12
  import type { LocationsLookupManager, NamesLookupManager } from './LookupManager';
12
13
  import type { ExtraFontFamilyOption } from './utils/fontFamilyOptions';
@@ -23,6 +24,7 @@ type PlaygroundAppProps = {
23
24
  excalidrawLibraryItems?: LibraryItems;
24
25
  excalidrawLoadLibrariesFileList?: () => string[];
25
26
  excalidrawSaveLibrariesFile?: (librariesFile: string) => void;
27
+ floatingActionButtonController?: BibleNoteFloatingActionButtonControllerOwner;
26
28
  footerActionButtonController?: BibleNoteFooterActionButtonControllerOwner;
27
29
  isMinimize: boolean;
28
30
  isOnApp: boolean;
@@ -63,6 +65,6 @@ type BibleNoteEditorController = {
63
65
  export type BibleNoteEditorControllerOwner = {
64
66
  connectEditorController: (controller: BibleNoteEditorController) => () => void;
65
67
  };
66
- export declare function BibleNoteApp({ detectTextLanguage, editorController, editorExtraFontFamilies, excalidrawClearLibrariesFileList, excalidrawLibraryItems, excalidrawLoadLibrariesFileList, excalidrawSaveLibrariesFile, footerActionButtonController, isMinimize, isOnApp, print, resolveFilePath, revealFile, settings, settingsContainerElement, settingsController, stickyNoteExtraFontFamilies, shortToVerseData, verseFullTextToListShorts, changeBibleKey, }: PlaygroundAppProps): JSX.Element;
67
- export declare function AppComp({ detectTextLanguage, namesLookupManager, locationsLookupManager, editorController, editorExtraFontFamilies, excalidrawClearLibrariesFileList, excalidrawLibraryItems, excalidrawLoadLibrariesFileList, excalidrawSaveLibrariesFile, footerActionButtonController, print, resolveFilePath, revealFile, settings, settingsContainerElement, settingsController, stickyNoteExtraFontFamilies, storageManager, isMinimize, isOnApp, shortToVerseData, verseFullTextToListShorts, changeBibleKey, }: PlaygroundAppProps): JSX.Element;
68
+ export declare function BibleNoteApp({ detectTextLanguage, editorController, editorExtraFontFamilies, excalidrawClearLibrariesFileList, excalidrawLibraryItems, excalidrawLoadLibrariesFileList, excalidrawSaveLibrariesFile, floatingActionButtonController, footerActionButtonController, isMinimize, isOnApp, print, resolveFilePath, revealFile, settings, settingsContainerElement, settingsController, stickyNoteExtraFontFamilies, shortToVerseData, verseFullTextToListShorts, changeBibleKey, }: PlaygroundAppProps): JSX.Element;
69
+ export declare function AppComp({ detectTextLanguage, namesLookupManager, locationsLookupManager, editorController, editorExtraFontFamilies, excalidrawClearLibrariesFileList, excalidrawLibraryItems, excalidrawLoadLibrariesFileList, excalidrawSaveLibrariesFile, floatingActionButtonController, footerActionButtonController, print, resolveFilePath, revealFile, settings, settingsContainerElement, settingsController, stickyNoteExtraFontFamilies, storageManager, isMinimize, isOnApp, shortToVerseData, verseFullTextToListShorts, changeBibleKey, }: PlaygroundAppProps): JSX.Element;
68
70
  export {};
@@ -1,6 +1,8 @@
1
+ import type { BibleNoteFloatingActionButton } from './floatingActionButtons';
1
2
  import type { BibleNoteFooterActionButton } from './footerActionButtons';
2
3
  import type { BibleNoteColorScheme } from './params/colorScheme';
3
4
  import { type BibleNoteProps, type BibleNoteRenderOptions } from './bibleNoteHelpers';
5
+ export type { BibleNoteFloatingActionButton, BibleNoteFloatingActionButtonClickEvent, BibleNoteFloatingActionButtons, BibleNoteSelectionPoint, BibleNoteTextSelection, } from './floatingActionButtons';
4
6
  export type { BibleNoteFooterActionButton, BibleNoteFooterActionButtons, } from './footerActionButtons';
5
7
  /**
6
8
  * The BibleNote editor. Construct it with the host's datasets and storage
@@ -25,11 +27,14 @@ declare class BibleNote {
25
27
  private pendingColorScheme;
26
28
  private readOnlyOverride;
27
29
  private footerActionButtonController;
28
- private footerActionButtons;
30
+ private readonly footerActionButtons;
31
+ private floatingActionButtonController;
32
+ private readonly floatingActionButtons;
29
33
  private root;
30
34
  private settingsController;
31
35
  private readonly editorControllerOwner;
32
36
  private readonly footerActionButtonControllerOwner;
37
+ private readonly floatingActionButtonControllerOwner;
33
38
  private readonly storageManager;
34
39
  private readonly settingsControllerOwner;
35
40
  /** Creates the editor; nothing is rendered until `render` is called. */
@@ -83,13 +88,34 @@ declare class BibleNote {
83
88
  getFooterActionButton(id: string): BibleNoteFooterActionButton | null;
84
89
  /** Removes the host footer button with this `id`; `false` when there was none. */
85
90
  removeFooterActionButton(id: string): boolean;
86
- private setFooterActionButton;
87
- private getFooterActionButtonsSnapshot;
91
+ /**
92
+ * Adds a host button to the floating toolbar that appears over selected
93
+ * text, after its built-in buttons (after Insert comment). Its `onClick`
94
+ * receives the selection — text, HTML and range — and can replace the
95
+ * selected text. A button whose `id` is already present is replaced in
96
+ * place, keeping its position.
97
+ */
98
+ appendFloatingActionButton(actionButton: BibleNoteFloatingActionButton): void;
99
+ /**
100
+ * Adds a host button to the floating toolbar before its built-in buttons
101
+ * (before Bold), ahead of any prepended earlier. A button whose `id` is
102
+ * already present is replaced in place, keeping its position.
103
+ */
104
+ prependFloatingActionButton(actionButton: BibleNoteFloatingActionButton): void;
105
+ /** The host floating toolbar button with this `id`, or `null`. */
106
+ getFloatingActionButton(id: string): BibleNoteFloatingActionButton | null;
107
+ /**
108
+ * Removes the host floating toolbar button with this `id`; `false` when there
109
+ * was none.
110
+ */
111
+ removeFloatingActionButton(id: string): boolean;
88
112
  private syncFooterActionButtons;
113
+ private syncFloatingActionButtons;
89
114
  private runOrQueueEditorAction;
90
115
  private connectEditorController;
91
116
  private connectSettingsController;
92
117
  private connectFooterActionButtonController;
118
+ private connectFloatingActionButtonController;
93
119
  private syncColorSchemeFromSettings;
94
120
  /**
95
121
  * Drives the editor's find bar. A string opens the bar (or updates the query
@@ -104,8 +130,8 @@ declare class BibleNote {
104
130
  */
105
131
  render(containerElement: HTMLElement, options?: BibleNoteRenderOptions): void;
106
132
  /**
107
- * Unmounts the editor. The instance keeps its props and footer buttons and
108
- * can be rendered again.
133
+ * Unmounts the editor. The instance keeps its props, footer buttons and
134
+ * floating toolbar buttons and can be rendered again.
109
135
  */
110
136
  unmount(): void;
111
137
  /**
@@ -0,0 +1,23 @@
1
+ /** Which side of an editor's built-in buttons a host button sits on. */
2
+ export type ActionButtonPlacement = 'before' | 'after';
3
+ /** Host buttons on each side of an editor's built-in buttons, in order. */
4
+ export type PlacedActionButtons<T> = Readonly<{
5
+ before: ReadonlyArray<T>;
6
+ after: ReadonlyArray<T>;
7
+ }>;
8
+ /**
9
+ * The host buttons of one button bar, split around its built-in buttons. Ids are
10
+ * unique across both sides: adding a button whose id is already present
11
+ * replaces that button in place, whatever placement is asked for.
12
+ */
13
+ export declare class ActionButtonList<T extends {
14
+ readonly id: string;
15
+ }> {
16
+ private before;
17
+ private after;
18
+ get(id: string): T | null;
19
+ set(actionButton: T, placement: ActionButtonPlacement): void;
20
+ /** Removes the button with this id; `false` when there was none. */
21
+ remove(id: string): boolean;
22
+ snapshot(): PlacedActionButtons<T>;
23
+ }
@@ -2,6 +2,7 @@ import type { CSSProperties, ReactNode } from 'react';
2
2
  import type { LibraryItems } from './excalidrawTypes';
3
3
  import type { Root } from 'react-dom/client';
4
4
  import type { BibleNoteEditorControllerOwner, BibleNoteSettingsControllerOwner } from './AppComp';
5
+ import type { BibleNoteFloatingActionButtonControllerOwner } from './floatingActionButtons';
5
6
  import type { BibleNoteFooterActionButtonControllerOwner } from './footerActionButtons';
6
7
  import type { BibleNoteColorScheme } from './params/colorScheme';
7
8
  import type { BibleNoteStorageManager } from './storageManager';
@@ -149,10 +150,11 @@ export type BibleNoteRenderOptions = {
149
150
  settingsContainerElement?: Element | DocumentFragment;
150
151
  };
151
152
  export declare function createBibleNoteStorageManager({ loadData, saveData, storageManager, }: BibleNoteProps): BibleNoteStorageManager;
152
- export declare function renderEditor({ props, containerElement, editorControllerOwner, footerActionButtonControllerOwner, settingsControllerOwner, storageManager, }: {
153
+ export declare function renderEditor({ props, containerElement, editorControllerOwner, floatingActionButtonControllerOwner, footerActionButtonControllerOwner, settingsControllerOwner, storageManager, }: {
153
154
  props: BibleNoteProps;
154
155
  containerElement: HTMLElement;
155
156
  editorControllerOwner: BibleNoteEditorControllerOwner;
157
+ floatingActionButtonControllerOwner: BibleNoteFloatingActionButtonControllerOwner;
156
158
  footerActionButtonControllerOwner: BibleNoteFooterActionButtonControllerOwner;
157
159
  settingsControllerOwner: BibleNoteSettingsControllerOwner;
158
160
  storageManager: BibleNoteStorageManager;
@@ -0,0 +1,118 @@
1
+ import type { MouseEvent as ReactMouseEvent, ReactNode } from 'react';
2
+ import type { PlacedActionButtons } from './actionButtonList';
3
+ /**
4
+ * A position in the open note, addressed the way the editor addresses it: a
5
+ * node, and an offset inside that node.
6
+ */
7
+ export type BibleNoteSelectionPoint = Readonly<{
8
+ /**
9
+ * The editor's key for the node the point sits in. Keys identify nodes of
10
+ * the note as it is open right now: they are not saved with `content`, and
11
+ * they change when the note is loaded again.
12
+ */
13
+ key: string;
14
+ /**
15
+ * For a `'text'` point, the character offset inside that text node. For an
16
+ * `'element'` point, the index of the child the point sits before.
17
+ */
18
+ offset: number;
19
+ /**
20
+ * `'text'` when `key` names a text node; `'element'` when it names an element
21
+ * node such as a paragraph or a list item.
22
+ */
23
+ type: 'text' | 'element';
24
+ }>;
25
+ /**
26
+ * The text selection a floating action button was clicked on. It is a snapshot
27
+ * taken at the click: it does not follow later edits or selection changes.
28
+ */
29
+ export type BibleNoteTextSelection = Readonly<{
30
+ /**
31
+ * The selected text as plain text — what Copy puts on the clipboard as
32
+ * `text/plain`. Paragraphs are separated by `\n`. Never empty: the toolbar
33
+ * only appears over a selection that contains text.
34
+ */
35
+ text: string;
36
+ /**
37
+ * The selected content as HTML, formatting included — what Copy puts on the
38
+ * clipboard as `text/html`.
39
+ */
40
+ html: string;
41
+ /** Where the selection begins, in document order. */
42
+ start: BibleNoteSelectionPoint;
43
+ /** Where the selection ends, in document order. */
44
+ end: BibleNoteSelectionPoint;
45
+ /**
46
+ * `true` when the user selected from the end back toward the start, so the
47
+ * caret sits at `start`; `false` when the caret sits at `end`.
48
+ */
49
+ isBackward: boolean;
50
+ /**
51
+ * A copy of the browser's DOM `Range` for the selection, or `null` when the
52
+ * browser had no selection inside the editor at the click. Use it to measure
53
+ * the text on screen (`domRange.getBoundingClientRect()`); it stops matching
54
+ * the page once the note changes.
55
+ */
56
+ domRange: Range | null;
57
+ }>;
58
+ /** What a floating action button's `onClick` receives. */
59
+ export type BibleNoteFloatingActionButtonClickEvent = Readonly<{
60
+ /** The `id` of the button that was clicked. */
61
+ id: string;
62
+ /** The selection the button was clicked on. */
63
+ selection: BibleNoteTextSelection;
64
+ /**
65
+ * Replaces the text of the captured selection with `text`, inserted the way
66
+ * `BibleNote.addText` inserts it: as plain text, as if pasted, so the paste
67
+ * rules apply and `\n` starts a new paragraph. An empty string deletes the
68
+ * selected text. The selection is restored from `selection.start` and
69
+ * `selection.end` first, so this still works after the user has clicked
70
+ * elsewhere or after an `await`.
71
+ *
72
+ * Returns `false`, and changes nothing, when the note is read-only or when
73
+ * that range no longer holds `selection.text` — because the note was edited
74
+ * since the click, or the text was already replaced.
75
+ */
76
+ replaceText: (text: string) => boolean;
77
+ /** The React click event of the button. */
78
+ mouseEvent: ReactMouseEvent<HTMLButtonElement>;
79
+ }>;
80
+ /**
81
+ * A host-supplied button in the floating toolbar that appears over selected
82
+ * text — the bar with Bold, Italic, Underline, … and Insert comment.
83
+ *
84
+ * Unlike a footer button, the editor renders the `<button>` itself, so it
85
+ * matches the built-in ones; `children` is only what goes inside it.
86
+ */
87
+ export type BibleNoteFloatingActionButton = {
88
+ /** Unique per editor; adding a button with an existing id replaces it in place. */
89
+ id: string;
90
+ /** What the button does: its tooltip and its accessible name. */
91
+ description: string;
92
+ /**
93
+ * The content of the button, normally a Bootstrap icon given the `format`
94
+ * class so it is sized and tinted like the built-in icons:
95
+ * `<i className="bi bi-clipboard format" />`.
96
+ */
97
+ children: ReactNode;
98
+ /**
99
+ * Called on click with the selection the toolbar is showing for. Not called
100
+ * when the selection has collapsed to a caret by the time of the click.
101
+ */
102
+ onClick: (event: BibleNoteFloatingActionButtonClickEvent) => void;
103
+ /**
104
+ * `true` shows the button only while the note can be edited, like the
105
+ * built-in formatting buttons. By default it shows in read-only mode too,
106
+ * like Insert comment — right for actions that only read the selection.
107
+ */
108
+ isHiddenWhenReadOnly?: boolean;
109
+ };
110
+ /** The host floating toolbar buttons on each side of the built-in ones, in order. */
111
+ export type BibleNoteFloatingActionButtons = PlacedActionButtons<BibleNoteFloatingActionButton>;
112
+ export type BibleNoteFloatingActionButtonController = {
113
+ setFloatingActionButtons: (actionButtons: BibleNoteFloatingActionButtons) => void;
114
+ };
115
+ export type BibleNoteFloatingActionButtonControllerOwner = {
116
+ connectFloatingActionButtonController: (controller: BibleNoteFloatingActionButtonController) => () => void;
117
+ };
118
+ export declare const EMPTY_BIBLE_NOTE_FLOATING_ACTION_BUTTONS: BibleNoteFloatingActionButtons;
package/types/lib.d.ts CHANGED
@@ -13,6 +13,7 @@ export { EDITOR_STATE_LOCAL_STORAGE_KEY } from './editorStateStorage';
13
13
  export { applyBibleNoteColorScheme, clearBibleNoteColorScheme, } from './params/colorScheme';
14
14
  export { BIBLE_NOTE_STORAGE_MANAGER_KEYS, createBrowserStorageManager, } from './storageManager';
15
15
  export { getLookupRecordValues, getMentionKjvName, LocationsLookupManager, NamesLookupManager, normalizeMentionNameType, parseMentionLocationMatch, parseMentionLocationMatches, parseMentionNameMatch, parseMentionNameMatches, } from './LookupManager';
16
+ export type { BibleNoteFloatingActionButton, BibleNoteFloatingActionButtonClickEvent, BibleNoteFloatingActionButtons, BibleNoteSelectionPoint, BibleNoteTextSelection, } from './floatingActionButtons';
16
17
  export type { BibleNoteFooterActionButton, BibleNoteFooterActionButtonPlacement, BibleNoteFooterActionButtons, } from './footerActionButtons';
17
18
  export type { BibleNoteProps, BibleNoteRenderOptions, } from './bibleNoteHelpers';
18
19
  export type { LocationsLookupManagerDataMap, LocationsLookupManagerLangData, LookupManagerStyle, LookupPaginationOptions, LookupPaginationResult, LookupSearchOptions, MentionLocationCoordinates, MentionLocationLink, MentionLocationMatch, MentionLocationPreview, MentionNameLink, MentionNameMatch, MentionNamePreview, MentionNameType, MentionNameYearRange, NamesLookupManagerDataMap, NamesLookupManagerLangData, NamesLookupPaginationOptions, NamesLookupSearchOptions, NameTypeCount, VerseRecordIdsMap, } from './LookupManager';
@@ -1,3 +0,0 @@
1
- const e=require("./Lexical.prod-C9Xekspf.cjs");function t(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function n(e){let t=e;for(;t!=null;){if(t.nodeType===Node.TEXT_NODE)return t;t=t.firstChild}return null}function r(e){let t=e.parentNode;if(t==null)throw Error(`Should never happen`);return[t,Array.from(t.childNodes).indexOf(e)]}function i(t,i,a,o,s){let c=i.getKey(),l=o.getKey(),u=e.E(t.getRootElement()).createRange(),d=t.getElementByKey(c),f=t.getElementByKey(l),p=a,m=s;if(e.Jt(i)&&(d=n(d)),e.Jt(o)&&(f=n(f)),i===void 0||o===void 0||d===null||f===null)return null;d.nodeName===`BR`&&([d,p]=r(d)),f.nodeName===`BR`&&([f,m]=r(f));let h=d.firstChild;d===f&&h!=null&&h.nodeName===`BR`&&p===0&&m===0&&(m=1);try{u.setStart(d,p),u.setEnd(f,m)}catch{return null}return!u.collapsed||p===m&&c===l||(u.setStart(f,m),u.setEnd(d,p)),u}function a(e,t){let n=e.getRootElement();if(n===null)return[];let r=n.getBoundingClientRect(),i=getComputedStyle(n),a=parseFloat(i.paddingLeft)+parseFloat(i.paddingRight),o=Array.from(t.getClientRects()),s,c=o.length;o.sort((e,t)=>{let n=e.top-t.top;return Math.abs(n)<=3?e.left-t.left:n});for(let e=0;e<c;e++){let t=o[e],n=s&&s.top<=t.top&&s.top+s.height>t.top&&s.left+s.width>t.left,i=t.width+a===r.width;n||i?(o.splice(e--,1),c--):s=t}return o}function o(e){let t=``;for(let n in e)n&&(t+=`${n}: ${e[n]};`);return t}function s(t){let n=e.s().getElementByKey(t.getKey());if(n===null)return null;let r=n.ownerDocument.defaultView;return r===null?null:r.getComputedStyle(n)}function c(t){return s(e.ri(t)?t:t.getParentOrThrow())}function l(e){let t=c(e);return t!==null&&t.direction===`rtl`}function u(t,n,r=`self`){let i=t.getStartEndPoints();if(n.isSelected(t)&&!e.L(n)&&i!==null){let[a,o]=i,s=t.isBackward(),c=a.getNode(),l=o.getNode(),u=n.is(c),d=n.is(l);if(u||d){let[i,a]=e.sn(t),o=c.is(l),u=n.is(s?l:c),d=n.is(s?c:l),f,p=0;o?(p=i>a?a:i,f=i>a?i:a):u?(p=s?a:i,f=void 0):d&&(p=0,f=s?i:a);let m=n.__text.slice(p,f);m!==n.__text&&(r===`clone`&&(n=e.r(n)),n.__text=m)}}return n}function d(n){if(n.type===`text`)return n.offset===n.getNode().getTextContentSize();let r=n.getNode();return e.vt(r)||t(177),n.offset===r.getChildrenSize()}function f(t,n,r){let i=n.getNode(),a=r;if(e.vt(i)){let e=i.getDescendantByIndex(n.offset);e!==null&&(i=e)}for(;a>0&&i!==null;){if(e.vt(i)){let e=i.getLastDescendant();e!==null&&(i=e)}let r=i.getPreviousSibling(),o=0;if(r===null){let e=i.getParentOrThrow(),t=e.getPreviousSibling();for(;t===null;){if(e=e.getParent(),e===null){r=null;break}t=e.getPreviousSibling()}e!==null&&(o=e.isInline()?0:2,r=t)}let s=i.getTextContent();s===``&&e.vt(i)&&!i.isInline()&&(s=`
2
-
3
- `);let c=s.length;if(!e.Jt(i)||a>=c){let t=i.getParent();i.remove(),t==null||t.getChildrenSize()!==0||e.ri(t)||t.remove(),a-=c+o,i=r}else{let r=i.getKey(),o=t.read(`latest`,()=>{let t=e.Ht(r);return e.Jt(t)&&t.isSimpleText()?t.getTextContent():null}),l=c-a,u=s.slice(0,l);if(o!==null&&o!==s){let t=e.Y(),n=i;if(i.isSimpleText())i.setTextContent(o);else{let t=e.D(o);i.replace(t),n=t}if(e.bn(t)&&t.isCollapsed()){let e=t.anchor.offset;n.select(e,e)}}else if(i.isSimpleText()){let e=n.key===r,t=n.offset;t<a&&(t=c);let o=e?t-a:0,s=e?t:l;if(e&&o===0){let[e]=i.splitText(o,s);e.remove()}else{let[,e]=i.splitText(o,s);e.remove()}}else{let t=e.D(u);i.replace(t)}a=0}}}function p(n,r){(e.bn(n)?n.isCollapsed():e.Jt(n)||e.vt(n))||t(280);let i=e.ot(e.bn(n)?n.style:e.Jt(n)?n.getStyle():n.getTextStyle()),a=o(Object.entries(r).reduce((e,[t,r])=>(typeof r==`function`?e[t]=r(i[t],n):r===null?delete e[t]:e[t]=r,e),{...i}));e.bn(n)||e.Jt(n)?n.setStyle(a):n.setTextStyle(a)}function m(t,n){if(e.bn(t)&&t.isCollapsed()){p(t,n);let r=t.anchor.getNode();e.vt(r)&&r.isEmpty()&&p(r,n)}h(e=>{p(e,n)});let r=t.getNodes();if(r.length>0){let t=new Set;for(let i of r){if(!e.vt(i)||!i.canBeEmpty()||i.getChildrenSize()!==0)continue;let r=i.getKey();t.has(r)||(t.add(r),p(i,n))}}}function h(t){let n=e.tt();if(!n)return;let r=new Map,i=e=>r.get(e.getKey())||[0,e.getTextContentSize()];if(e.bn(n))for(let t of e.An(n).getTextSlices())t&&r.set(t.caret.origin.getKey(),t.getSliceIndices());let a=n.getNodes();for(let n of a){if(!e.Jt(n)||!n.canHaveFormat())continue;let[r,a]=i(n);a!==r&&(e.L(n)||r===0&&a===n.getTextContentSize()?t(n):t(n.splitText(r,a)[r===0?0:1]))}e.bn(n)&&n.anchor.type===`text`&&n.focus.type===`text`&&n.anchor.key===n.focus.key&&g(n)}function g(e){if(e.isBackward()){let{anchor:t,focus:n}=e,{key:r,offset:i,type:a}=t;t.set(n.key,n.offset,n.type),n.set(r,i,a)}}function _(e,t){let n=e.getFormatType(),r=e.getIndent();n!==t.getFormatType()&&t.setFormat(n),r!==t.getIndent()&&t.setIndent(r)}function v(t,n,r){let i=e.Gt(t,r);if(e.$n(i))return!1;for(;i;i=i.getParentCaret()){let e=i.getParentAtCaret();if(!e||i.getNodeAtCaret())return!1;if(n.is(e))return!0}return!1}function y(t,n,r=_){if(!t)return;let i=t.getStartEndPoints(),a=!1,o=null,s=new Map;if(i){let[n,r]=i,c=e.B(n.getNode(),e.Kr);o=e.B(r.getNode(),e.Kr);let l=t.isBackward()?`previous`:`next`;a=e.vt(o)&&!o.is(c)&&function(t,n,r){let i=t.getNode();return(!e.vt(i)||!i.isEmpty())&&v(t,n,r)}(r,o,e.Ot(l)),e.vt(c)&&s.set(c.getKey(),c),e.vt(o)&&!a&&s.set(o.getKey(),o)}for(let n of t.getNodes())if(e.vt(n)&&e.Kr(n)){if(a&&n.is(o))continue;s.set(n.getKey(),n)}else if(!i){let t=e.B(n,e.Kr);e.vt(t)&&s.set(t.getKey(),t)}for(let e of s.values()){let t=n();r(e,t),e.replace(t,!0)}}function b(e){let t=x(e);return t!==null&&t.writingMode===`vertical-rl`}function x(t){let n=t.anchor.getNode();return e.vt(n)?s(n):c(n)}function S(t,n){let r=b(t)?!n:n;w(t)&&(r=!r);let i=e.Gt(t.focus,r?`previous`:`next`);if(e.$n(i))return!1;if(e.mn(i)&&!e.On(i.origin)&&i.origin.isUnmergeable()){let t=i.getNodeAtCaret();if(e.Jt(t)&&!e.On(t))return!0}for(let t of e.Ft(i)){if(e._(t))return!t.origin.isInline();if(!e.vt(t.origin)){if(e.$(t.origin))return!0;break}}return!1}function C(e,t,n,r){e.modify(t?`extend`:`move`,n,r)}function w(e){let t=x(e);return t!==null&&t.direction===`rtl`}function T(e,t,n){let r=w(e),i;i=b(e)||r?!n:n,C(e,t,i,`character`)}function ee(t,n,r){let i=e.ot(t.getStyle());return i!==null&&i[n]||r}function E(t,n,r=``){let i=null,a=t.getNodes(),o,s;if(e.bn(t)){if(t.isCollapsed()&&t.style!==``){let r=e.ot(t.style);if(r!==null&&n in r)return r[n]}let{anchor:r,focus:i}=t,a=t.isBackward(),c=a?i.getNode():r.getNode(),l=a?r.getNode():i.getNode(),u=a?i.offset:r.offset,d=a?r.offset:i.offset;e.Jt(c)&&u===c.getTextContentSize()&&(o=c),d===0&&(s=l)}for(let t=0;t<a.length;t++){let c=a[t];if(e.Jt(c)&&!c.is(t===0?o:s)){let e=ee(c,n,r);if(i===null)i=e;else if(i!==e){i=``;break}}}return i===null?r:i}function D(e,...t){let n=new URL(`https://lexical.dev/docs/error`),r=new URLSearchParams;r.append(`code`,e);for(let e of t)r.append(`v`,e);throw n.search=r.toString(),Error(`Minified Lexical error #${e}; visit ${n.toString()} for the full message or use the non-minified dev environment for full errors and additional helpful warnings.`)}function O(e){let t=(e,t)=>t.left>=e.left-1&&t.top>=e.top-1&&t.right<=e.right+1&&t.bottom<=e.bottom+1,n=[];for(let r of Array.from(e))if(!(r.width<.5||r.height<.5||n.some(e=>t(r,e)))){for(let e=n.length-1;e>=0;e--)t(n[e],r)&&n.splice(e,1);n.push(r)}return n}function k(e){return`${e}px`}var A={attributes:!0,characterData:!0,childList:!0,subtree:!0};function te(t,n,r){let i=null,o=null,s=null,c=[],l=e.E(t.getRootElement()).createElement(`div`);function u(){i===null&&D(182),o===null&&D(183);let{left:s,top:u}=o.getBoundingClientRect(),d=O(a(t,n));var f,p;l.isConnected||(p=l,(f=o).insertBefore(p,f.firstChild));let m=!1;for(let t=0;t<d.length;t++){let n=d[t],r=c[t]||e.E(i).createElement(`div`),a=r.style;a.position!==`absolute`&&(a.position=`absolute`,m=!0);let o=k(n.left-s);a.left!==o&&(a.left=o,m=!0);let f=k(n.top-u);a.top!==f&&(r.style.top=f,m=!0);let p=k(n.width);a.width!==p&&(r.style.width=p,m=!0);let h=k(n.height);a.height!==h&&(r.style.height=h,m=!0),r.parentNode!==l&&(l.append(r),m=!0),c[t]=r}for(;c.length>d.length;)c.pop()?.remove();m&&r(c)}function d(){o=null,i=null,s!==null&&s.disconnect(),s=null,l.remove();for(let e of c)e.remove();c=[]}l.style.position=`relative`;let f=t.registerRootListener(function n(){let r=t.getRootElement();if(r===null)return d();let a=r.parentElement;if(!e.Sn(a))return d();d(),i=r,o=a,s=new MutationObserver(e=>{let r=t.getRootElement(),a=r&&r.parentElement;if(r!==i||a!==o)return n();for(let t of e)if(!l.contains(t.target))return u()}),s.observe(a,A),u()});return()=>{f(),d()}}function j(t,n,r,i){if(n.type!==`text`&&e.vt(r)){let a=e.Lr(r,i,t);return[a.element,a.getFirstChildOffset()+n.offset]}return[(e.Jt(r)?e.lt(r,i,t):e.ai(i))||i,n.offset]}function ne(e){for(let t of e){let e=t.style;e.background!==`Highlight`&&(e.background=`Highlight`),e.color!==`HighlightText`&&(e.color=`HighlightText`),e.marginTop!==k(-1.5)&&(e.marginTop=k(-1.5)),e.paddingTop!==k(4)&&(e.paddingTop=k(4)),e.paddingBottom!==k(0)&&(e.paddingBottom=k(0))}}function re(t,n=ne){let r=null,i=null,a=null,o=null,s=null,c=null,l=()=>{};function u(u){u.read(()=>{let u=e.tt();if(!e.bn(u))return r=null,a=null,o=null,c=null,l(),void(l=()=>{});let[d,f]=function(e){let t=e.getStartEndPoints();return e.isBackward()?[t[1],t[0]]:t}(u),p=d.getNode(),m=p.getKey(),h=d.offset,g=f.getNode(),_=g.getKey(),v=f.offset,y=t.getElementByKey(m),b=t.getElementByKey(_),x=r===null||y!==i||h!==a||m!==r.getKey(),S=o===null||b!==s||v!==c||_!==o.getKey();if((x||S)&&y!==null&&b!==null){let e=function(e,t,n,r,i,a,o){let s=(e._window?e._window.document:document).createRange();return s.setStart(...j(e,t,n,r)),s.setEnd(...j(e,i,a,o)),s}(t,d,p,y,f,g,b);l(),l=te(t,e,n)}r=p,i=y,a=h,o=g,s=b,c=v},{editor:t})}return u(t.getEditorState()),e.Yn(t.registerUpdateListener(({editorState:e})=>u(e)),()=>{l()})}function ie(t,n){let r=null,i=()=>{let i=t.getRootElement(),a=i===null?null:i.ownerDocument.defaultView,o=a===null?null:a.getSelection(),s=o===null?null:e.Er(o,i).anchorNode;s!==null&&i!==null&&i.contains(s)?r!==null&&(r(),r=null):r===null&&(r=re(t,n))};return t.registerRootListener(t=>{if(t){let n=t.ownerDocument,a=e.Yn(e.yt(n,`selectionchange`,i),()=>{r!==null&&r()});return i(),a}})}function M(t,n){let r=t.ownerDocument,i=r.defaultView||window,a=i.getComputedStyle(t),o=a.position===`absolute`,s=n?/(auto|scroll|hidden)/:/(auto|scroll)/;if(a.position===`fixed`)return r.body;for(let n=t;n=e.ut(n);)if(a=i.getComputedStyle(n),(!o||a.position!==`static`)&&s.test(a.overflow+a.overflowY+a.overflowX))return n;return r.body}function N(e,t){for(let n of t)if(e.type.startsWith(n))return!0;return!1}function P(e,t){let n=e[Symbol.iterator]();return new Promise((e,r)=>{let i=[],a=()=>{let{done:o,value:s}=n.next();if(o)return e(i);let c=new FileReader;c.addEventListener(`error`,r),c.addEventListener(`load`,()=>{let e=c.result;typeof e==`string`&&i.push({file:s,result:e}),a()}),N(s,t)?c.readAsDataURL(s):a()};a()})}function F(e,t){return Array.from(I(e,t))}function I(e,t){return V(`next`,e,t)}function L(e,t){return Array.from(R(e,t))}function*R(t,n){for(let r of V(`next`,t,n)){yield r;let{node:t,depth:i}=r;if(e.Xt(t)&&!t.is(n))for(let n of e.or(t)){let r=e.lr(t,n);r!==null&&(yield*z(r,i+1))}}}function*z(t,n){yield{depth:n,node:t};let r=n+1;if(e.Xt(t))for(let n of e.or(t)){let i=e.lr(t,n);i!==null&&(yield*z(i,r))}if(e.vt(t))for(let e of t.getChildren())yield*z(e,r)}function B(t,n){let r=e.Mn(e.f(t,n));return r&&r[0]}function V(t,n,r){let i=e.Dr(),a=n||i,o=e.vt(a)?e.Z(a,t):e.f(a,t),s=H(a),c=r?e.ni(e.G(e.f(r,t)))||B(r,t):B(a,t),l=s;return e.z({hasNext:e=>e!==null,initial:o,map:e=>({depth:l,node:e.origin}),step:t=>{if(t.isSameNodeCaret(c))return null;e._(t)&&l++;let n=e.Mn(t);return!n||n[0].isSameNodeCaret(c)?null:(l+=n[1],n[0])}})}function H(t){let n=-1;for(let r=t;r!==null;r=r.getParent()??e.wt(r))n++;return n}function U(t){let n=e.Mn(e.G(e.f(t,`previous`)),`root`);return n&&n[0].origin}function W(e,t){let n=e;for(;n!=null;){if(n instanceof t)return n;n=n.getParent()}return null}function G(t){let n=e.B(t,t=>e.vt(t)&&!t.isInline());return e.vt(n)||D(4,t.__key),n}function K(e,t,n,r){let i=e=>e instanceof t;return e.registerNodeTransform(t,e=>{let t=(e=>{let t=e.getChildren();for(let e=0;e<t.length;e++){let n=t[e];if(i(n))return null}let n=e,r=e;for(;n!==null;)if(r=n,n=n.getParent(),i(n))return{child:r,parent:n};return null})(e);if(t!==null){let{child:i,parent:a}=t;if(i.is(e)){r(a,e);let t=i.getNextSiblings(),o=t.length;if(a.insertAfter(i),o!==0){let e=n(a);i.insertAfter(e);for(let n=0;n<o;n++)e.append(t[n])}a.canBeEmpty()||a.getChildrenSize()!==0||a.remove()}}})}function q(t,n){let r=new Map,i=t._pendingEditorState;for(let[t,i]of n._nodeMap)r.set(t,e.rt(i));i&&(i._nodeMap=r),e.an();let a=n._selection;e.En(a===null?null:a.clone())}function ae(t){let n=e.tt()||e.Y(),r;if(e.bn(n))r=e.Gt(n.focus,`next`);else{if(n!=null){let t=n.getNodes(),i=t[t.length-1];i&&(r=e.f(i,`next`))}r||=e.Z(e.Dr(),`previous`).getFlipped().insert(e.Ar())}let i=e.cn(t,r),a=e.ni(i);return e.en(e.t(e._(a)?e.wr(a):i)),t.getLatest()}function J(e,t){let n=t();return e.replace(n),n.append(e),n}function Y(e,t){return e!==null&&Object.getPrototypeOf(e).constructor.name===t.name}function oe(e){let t=null;if(Y(e,DragEvent)?t=e.dataTransfer:Y(e,ClipboardEvent)&&(t=e.clipboardData),t===null)return[!1,[],!1];let n=t.types,r=n.includes(`Files`),i=n.includes(`text/html`)||n.includes(`text/plain`);return[r,Array.from(t.files),i]}function se(t){let n=e.tt();if(!e.bn(n))return!1;let r=new Set,i=n.getNodes();for(let n=0;n<i.length;n++){let a=i[n],o=a.getKey();if(r.has(o))continue;let s=e.B(a,t=>e.vt(t)&&!t.isInline());if(s===null)continue;let c=s.getKey();s.canIndent()&&!r.has(c)&&(r.add(c),t(s))}return r.size>0}function ce(t,n){e.Z(t,`next`).insert(n)}var X=!(e.Vn||!e.ar)&&void 0;function le(t,n=!1){let r=1;if(function(){if(X===void 0){let e=document.createElement(`div`);e.style.position=`absolute`,e.style.opacity=`0`,e.style.width=`100px`,e.style.left=`-1000px`,document.body.appendChild(e);let t=e.getBoundingClientRect();e.style.setProperty(`zoom`,`2`),X=e.getBoundingClientRect().width===t.width,document.body.removeChild(e)}return X}()||n){let n=t&&t.ownerDocument.defaultView||window;for(;t;)r*=Number(n.getComputedStyle(t).getPropertyValue(`zoom`)),t=e.ut(t)}return r}function ue(e){return e._parentEditor!==null}function de(e,t){return Z(e,t,null)}function Z(t,n,r){let i=!1;for(let a of Q(t))n(a)?r!==null&&r(a):(i=!0,e.vt(a)&&Z(a,n,r||(e=>a.insertAfter(e))),a.remove());return i}function fe(t,n){let r=[],i=Array.from(t).reverse();for(let t=i.pop();t!==void 0;t=i.pop())if(n(t))r.push(t);else if(e.vt(t))for(let e of Q(t))i.push(e);return r}function Q(t){return pe(e.Z(t,`previous`))}function pe(t){return e.z({hasNext:e.Hr,initial:t.getAdjacentCaret(),map:e=>e.origin.getLatest(),step:e=>e.getAdjacentCaret()})}function me(t){e.cr(e.f(t,`next`)).splice(1,t.getChildren())}function he(t,n){let r=e.tt();if(e.bn(r)&&r.isCollapsed()){let i=e.B(r.anchor.getNode(),t);if(i){let t=i.getParent();if(t!==null&&t.getFirstChild()===i&&$(r.anchor,i))return i.insertBefore(e.Ar()).selectEnd(),n&&n.preventDefault(),!0}}return!1}function ge(t,n){let r=e.tt();if(e.bn(r)&&r.isCollapsed()){let i=e.B(r.anchor.getNode(),t);if(i){let t=i.getParent();if(t!==null&&t.getLastChild()===i&&_e(r.anchor,i))return i.insertAfter(e.Ar()).selectEnd(),n&&n.preventDefault(),!0}}return!1}function $(e,t){return v(e,t,`previous`)}function _e(e,t){return v(e,t,`next`)}Object.defineProperty(exports,"A",{enumerable:!0,get:function(){return i}}),Object.defineProperty(exports,"C",{enumerable:!0,get:function(){return M}}),Object.defineProperty(exports,"D",{enumerable:!0,get:function(){return u}}),Object.defineProperty(exports,"E",{enumerable:!0,get:function(){return f}}),Object.defineProperty(exports,"F",{enumerable:!0,get:function(){return y}}),Object.defineProperty(exports,"I",{enumerable:!0,get:function(){return S}}),Object.defineProperty(exports,"L",{enumerable:!0,get:function(){return a}}),Object.defineProperty(exports,"M",{enumerable:!0,get:function(){return m}}),Object.defineProperty(exports,"N",{enumerable:!0,get:function(){return T}}),Object.defineProperty(exports,"O",{enumerable:!0,get:function(){return d}}),Object.defineProperty(exports,"P",{enumerable:!0,get:function(){return w}}),Object.defineProperty(exports,"S",{enumerable:!0,get:function(){return ie}}),Object.defineProperty(exports,"T",{enumerable:!0,get:function(){return de}}),Object.defineProperty(exports,"_",{enumerable:!0,get:function(){return P}}),Object.defineProperty(exports,"a",{enumerable:!0,get:function(){return ce}}),Object.defineProperty(exports,"b",{enumerable:!0,get:function(){return I}}),Object.defineProperty(exports,"c",{enumerable:!0,get:function(){return K}}),Object.defineProperty(exports,"d",{enumerable:!0,get:function(){return le}}),Object.defineProperty(exports,"f",{enumerable:!0,get:function(){return fe}}),Object.defineProperty(exports,"g",{enumerable:!0,get:function(){return F}}),Object.defineProperty(exports,"h",{enumerable:!0,get:function(){return N}}),Object.defineProperty(exports,"i",{enumerable:!0,get:function(){return oe}}),Object.defineProperty(exports,"j",{enumerable:!0,get:function(){return E}}),Object.defineProperty(exports,"k",{enumerable:!0,get:function(){return l}}),Object.defineProperty(exports,"l",{enumerable:!0,get:function(){return he}}),Object.defineProperty(exports,"m",{enumerable:!0,get:function(){return W}}),Object.defineProperty(exports,"n",{enumerable:!0,get:function(){return ae}}),Object.defineProperty(exports,"o",{enumerable:!0,get:function(){return G}}),Object.defineProperty(exports,"p",{enumerable:!0,get:function(){return ge}}),Object.defineProperty(exports,"r",{enumerable:!0,get:function(){return q}}),Object.defineProperty(exports,"s",{enumerable:!0,get:function(){return Y}}),Object.defineProperty(exports,"t",{enumerable:!0,get:function(){return se}}),Object.defineProperty(exports,"u",{enumerable:!0,get:function(){return J}}),Object.defineProperty(exports,"v",{enumerable:!0,get:function(){return L}}),Object.defineProperty(exports,"w",{enumerable:!0,get:function(){return U}}),Object.defineProperty(exports,"x",{enumerable:!0,get:function(){return me}}),Object.defineProperty(exports,"y",{enumerable:!0,get:function(){return ue}});