@lyfie/luthor 2.3.1 → 2.3.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.
package/dist/index.d.ts CHANGED
@@ -7,8 +7,7 @@ export { luthorHeadless as headless };
7
7
  export { CodeIntelligenceCommands, CodeIntelligenceConfig, CodeIntelligenceExtension, codeIntelligenceExtension } from '@lyfie/luthor-headless';
8
8
  import * as react_jsx_runtime from 'react/jsx-runtime';
9
9
  import * as react from 'react';
10
- import { ReactNode } from 'react';
11
- import * as lucide_react from 'lucide-react';
10
+ import { ForwardRefExoticComponent, SVGProps, RefAttributes, ReactNode } from 'react';
12
11
  export { ChatWindowEditor, ChatWindowEditorProps, ChatWindowEditorSendPayload, chatWindowPreset } from './presets/chat-window/index.js';
13
12
  export { EmailComposeEditor, EmailComposeEditorProps, emailComposePreset } from './presets/email-compose/index.js';
14
13
  import { S as StyleVarRecord, a as StyleVarValueRecord, F as FeatureFlagsLike, b as FeatureShortcutSpec, T as ToolbarFeatureMap, P as PresetModeCache } from './index-DFnca6tP.js';
@@ -77,45 +76,162 @@ interface LinkHoverBubbleProps {
77
76
  }
78
77
  declare function LinkHoverBubble({ editor, commands, editorTheme, disabled, }: LinkHoverBubbleProps): react.ReactPortal | null;
79
78
 
80
- declare const BoldIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
81
- declare const ItalicIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
82
- declare const UnderlineIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
83
- declare const StrikethroughIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
84
- declare const CodeIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
85
- declare const CodeBlockIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
86
- declare const LinkIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
87
- declare const UnlinkIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
88
- declare const ListIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
89
- declare const ListCheckIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
90
- declare const ListOrderedIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
91
- declare const UndoIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
92
- declare const RedoIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
93
- declare const ImageIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
94
- declare const AlignLeftIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
95
- declare const AlignCenterIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
96
- declare const AlignJustifyIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
97
- declare const AlignRightIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
98
- declare const UploadIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
99
- declare const MinusIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
100
- declare const TableIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
101
- declare const FileCodeIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
102
- declare const EyeIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
103
- declare const HighlighterIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
104
- declare const PencilIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
105
- declare const CommandIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
106
- declare const PaletteIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
107
- declare const TypeIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
108
- declare const QuoteIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
109
- declare const IndentIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
110
- declare const OutdentIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
111
- declare const SunIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
112
- declare const MoonIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
113
- declare const SearchIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
114
- declare const EmojiIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
115
- declare const SubscriptIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
116
- declare const SuperscriptIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
117
- declare const ChevronDownIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
118
- declare const CloseIcon: react.ForwardRefExoticComponent<Omit<lucide_react.LucideProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
79
+ declare const BoldIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
80
+ size?: number | string;
81
+ strokeWidth?: number | string;
82
+ } & RefAttributes<SVGSVGElement>>;
83
+ declare const ItalicIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
84
+ size?: number | string;
85
+ strokeWidth?: number | string;
86
+ } & RefAttributes<SVGSVGElement>>;
87
+ declare const UnderlineIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
88
+ size?: number | string;
89
+ strokeWidth?: number | string;
90
+ } & RefAttributes<SVGSVGElement>>;
91
+ declare const StrikethroughIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
92
+ size?: number | string;
93
+ strokeWidth?: number | string;
94
+ } & RefAttributes<SVGSVGElement>>;
95
+ declare const CodeIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
96
+ size?: number | string;
97
+ strokeWidth?: number | string;
98
+ } & RefAttributes<SVGSVGElement>>;
99
+ declare const CodeBlockIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
100
+ size?: number | string;
101
+ strokeWidth?: number | string;
102
+ } & RefAttributes<SVGSVGElement>>;
103
+ declare const LinkIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
104
+ size?: number | string;
105
+ strokeWidth?: number | string;
106
+ } & RefAttributes<SVGSVGElement>>;
107
+ declare const UnlinkIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
108
+ size?: number | string;
109
+ strokeWidth?: number | string;
110
+ } & RefAttributes<SVGSVGElement>>;
111
+ declare const ListIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
112
+ size?: number | string;
113
+ strokeWidth?: number | string;
114
+ } & RefAttributes<SVGSVGElement>>;
115
+ declare const ListCheckIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
116
+ size?: number | string;
117
+ strokeWidth?: number | string;
118
+ } & RefAttributes<SVGSVGElement>>;
119
+ declare const ListOrderedIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
120
+ size?: number | string;
121
+ strokeWidth?: number | string;
122
+ } & RefAttributes<SVGSVGElement>>;
123
+ declare const UndoIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
124
+ size?: number | string;
125
+ strokeWidth?: number | string;
126
+ } & RefAttributes<SVGSVGElement>>;
127
+ declare const RedoIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
128
+ size?: number | string;
129
+ strokeWidth?: number | string;
130
+ } & RefAttributes<SVGSVGElement>>;
131
+ declare const ImageIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
132
+ size?: number | string;
133
+ strokeWidth?: number | string;
134
+ } & RefAttributes<SVGSVGElement>>;
135
+ declare const AlignLeftIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
136
+ size?: number | string;
137
+ strokeWidth?: number | string;
138
+ } & RefAttributes<SVGSVGElement>>;
139
+ declare const AlignCenterIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
140
+ size?: number | string;
141
+ strokeWidth?: number | string;
142
+ } & RefAttributes<SVGSVGElement>>;
143
+ declare const AlignJustifyIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
144
+ size?: number | string;
145
+ strokeWidth?: number | string;
146
+ } & RefAttributes<SVGSVGElement>>;
147
+ declare const AlignRightIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
148
+ size?: number | string;
149
+ strokeWidth?: number | string;
150
+ } & RefAttributes<SVGSVGElement>>;
151
+ declare const UploadIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
152
+ size?: number | string;
153
+ strokeWidth?: number | string;
154
+ } & RefAttributes<SVGSVGElement>>;
155
+ declare const MinusIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
156
+ size?: number | string;
157
+ strokeWidth?: number | string;
158
+ } & RefAttributes<SVGSVGElement>>;
159
+ declare const TableIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
160
+ size?: number | string;
161
+ strokeWidth?: number | string;
162
+ } & RefAttributes<SVGSVGElement>>;
163
+ declare const FileCodeIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
164
+ size?: number | string;
165
+ strokeWidth?: number | string;
166
+ } & RefAttributes<SVGSVGElement>>;
167
+ declare const EyeIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
168
+ size?: number | string;
169
+ strokeWidth?: number | string;
170
+ } & RefAttributes<SVGSVGElement>>;
171
+ declare const HighlighterIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
172
+ size?: number | string;
173
+ strokeWidth?: number | string;
174
+ } & RefAttributes<SVGSVGElement>>;
175
+ declare const PencilIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
176
+ size?: number | string;
177
+ strokeWidth?: number | string;
178
+ } & RefAttributes<SVGSVGElement>>;
179
+ declare const CommandIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
180
+ size?: number | string;
181
+ strokeWidth?: number | string;
182
+ } & RefAttributes<SVGSVGElement>>;
183
+ declare const PaletteIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
184
+ size?: number | string;
185
+ strokeWidth?: number | string;
186
+ } & RefAttributes<SVGSVGElement>>;
187
+ declare const TypeIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
188
+ size?: number | string;
189
+ strokeWidth?: number | string;
190
+ } & RefAttributes<SVGSVGElement>>;
191
+ declare const QuoteIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
192
+ size?: number | string;
193
+ strokeWidth?: number | string;
194
+ } & RefAttributes<SVGSVGElement>>;
195
+ declare const IndentIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
196
+ size?: number | string;
197
+ strokeWidth?: number | string;
198
+ } & RefAttributes<SVGSVGElement>>;
199
+ declare const OutdentIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
200
+ size?: number | string;
201
+ strokeWidth?: number | string;
202
+ } & RefAttributes<SVGSVGElement>>;
203
+ declare const SunIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
204
+ size?: number | string;
205
+ strokeWidth?: number | string;
206
+ } & RefAttributes<SVGSVGElement>>;
207
+ declare const MoonIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
208
+ size?: number | string;
209
+ strokeWidth?: number | string;
210
+ } & RefAttributes<SVGSVGElement>>;
211
+ declare const SearchIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
212
+ size?: number | string;
213
+ strokeWidth?: number | string;
214
+ } & RefAttributes<SVGSVGElement>>;
215
+ declare const EmojiIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
216
+ size?: number | string;
217
+ strokeWidth?: number | string;
218
+ } & RefAttributes<SVGSVGElement>>;
219
+ declare const SubscriptIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
220
+ size?: number | string;
221
+ strokeWidth?: number | string;
222
+ } & RefAttributes<SVGSVGElement>>;
223
+ declare const SuperscriptIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
224
+ size?: number | string;
225
+ strokeWidth?: number | string;
226
+ } & RefAttributes<SVGSVGElement>>;
227
+ declare const ChevronDownIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
228
+ size?: number | string;
229
+ strokeWidth?: number | string;
230
+ } & RefAttributes<SVGSVGElement>>;
231
+ declare const CloseIcon: ForwardRefExoticComponent<SVGProps<SVGSVGElement> & {
232
+ size?: number | string;
233
+ strokeWidth?: number | string;
234
+ } & RefAttributes<SVGSVGElement>>;
119
235
 
120
236
  declare function ModeTabs({ mode, onModeChange, labels, availableModes, isConverting, }: {
121
237
  mode: CoreEditorMode;
package/dist/index.js CHANGED
@@ -1,3 +1 @@
1
- import {ImageExtension,TableExtension,IframeEmbedExtension,YouTubeEmbedExtension,ContextMenuExtension,CommandPaletteExtension,SlashCommandExtension,EmojiExtension,DraggableBlockExtension,LinkExtension,textColorExtension,textHighlightExtension,createCustomNodeExtension,createEditorSystem,mergeThemes,defaultLuthorTheme,createEditorThemeStyleVars,FloatingToolbarExtension,FontFamilyExtension,FontSizeExtension,LineHeightExtension,codeExtension,codeIntelligenceExtension,boldExtension,italicExtension,underlineExtension,strikethroughExtension,subscriptExtension,superscriptExtension,horizontalRuleExtension,listExtension,historyExtension,blockFormatExtension,codeFormatExtension,tabIndentExtension,enterKeyBehaviorExtension,RichText,clearLexicalSelection,resolveLinkNodeKeyFromAnchor,richTextExtension,jsonbToMarkdown,markdownToJSONB}from'@lyfie/luthor-headless';import*as luthorHeadless from'@lyfie/luthor-headless';export{luthorHeadless as headless };export{CodeIntelligenceExtension,codeIntelligenceExtension}from'@lyfie/luthor-headless';import zi,{forwardRef,useState,useMemo,useEffect,useRef,useImperativeHandle,createElement,useLayoutEffect,useCallback}from'react';import {AlignLeft,AlignCenter,AlignRight,Bold,Italic,Underline,Strikethrough,Code,Quote,Unlink,Link,List,ListOrdered,ListChecks,Search,Command,Sun,Moon,Redo2,Undo2,Image,FileCode,Smile,Upload,Type,Table,Minus,IndentDecrease,IndentIncrease,Code2,AlignJustify,Superscript,Subscript,X,ChevronDown,Highlighter,Palette,Eye,Pencil}from'lucide-react';import {jsxs,Fragment,jsx}from'react/jsx-runtime';import {createPortal}from'react-dom';var Le=["h1","h2","h3","h4","h5","h6"],Qa={sections:[{items:["fontFamily","fontSize","lineHeight","textColor","textHighlight","bold","italic","underline","strikethrough","subscript","superscript","code","link"]},{items:["blockFormat","quote","alignLeft","alignCenter","alignRight","alignJustify","codeBlock"]},{items:["unorderedList","orderedList","checkList","indentList","outdentList"]},{items:["horizontalRule"]},{items:["table"]},{items:["image"]},{items:["emoji"]},{items:["embed"]},{items:["undo","redo"]},{items:["commandPalette"]},{items:["themeToggle"]}]},zt={sections:[{items:["fontFamily","fontSize","lineHeight"]},{items:["bold","italic","underline","strikethrough","textColor","textHighlight"]},{items:["subscript","superscript","code","link"]},{items:["blockFormat","quote","alignLeft","alignCenter","alignRight","alignJustify"]},{items:["unorderedList","orderedList","checkList","indentList","outdentList"]},{items:["table","image","emoji","embed","horizontalRule"]},{items:["codeBlock"]},{items:["undo","redo"]},{items:["commandPalette","themeToggle"]}]};function bn(e){if(!(e instanceof Element))return false;if(e.closest('[contenteditable="true"]'))return true;let t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"}function yn(e,t){return bn(e.target)?Go(t):false}function Go(e){let t=e.key.toLowerCase();return !(!!e.ctrlKey||!!e.metaKey)||e.altKey?false:t==="b"||t==="i"||t==="u"||t==="k"||(t==="z"||t==="y")}function Yo(e){return typeof e.setCodeLanguage=="function"&&typeof e.autoDetectCodeLanguage=="function"}function vn(e){return typeof e.toggleSubscript=="function"}function Cn(e){return typeof e.toggleSuperscript=="function"}function En(e){return typeof e.insertIframeEmbed=="function"}function xn(e){return typeof e.insertYouTubeEmbed=="function"}function kn(e){return typeof e.insertEmoji=="function"}function Tn(e){return e.slice(1)}function Sn(e){switch(e){case "h1":return "Convert to large heading";case "h2":return "Convert to medium heading";case "h3":return "Convert to small heading";case "h4":return "Convert to heading level 4";case "h5":return "Convert to heading level 5";case "h6":return "Convert to heading level 6"}}function Ln(e){if(!e||e.length===0)return [...Le];let t=new Set,r=[];for(let o of e)!Le.includes(o)||t.has(o)||(t.add(o),r.push(o));return r.length>0?r:[...Le]}function fo(e,t){return Nn(po(t),t?.shortcutConfig).filter(o=>!o.condition||o.condition(e))}function j(e,t){return typeof e[t]=="function"}function Mt(e){if(!e||e.length===0)return new Set;let t=e.map(r=>r.trim()).filter(r=>r.length>0);return new Set(t)}function wn(e){if(!e)return {allowlist:new Set,denylist:new Set};if(Array.isArray(e)){let r=[];for(let o of e)for(let[l,n]of Object.entries(o))n&&r.push(l);return {allowlist:Mt(r),denylist:new Set}}let t=e;return {allowlist:Mt(t.allowlist),denylist:Mt(t.denylist)}}function Wo(e){let t=e.key.trim();return t?{key:t,ctrlKey:!!e.ctrlKey,metaKey:!!e.metaKey,shiftKey:!!e.shiftKey,altKey:!!e.altKey,preventDefault:e.preventDefault}:null}function Fn(e){if(e===false||e===null)return [];let t=Array.isArray(e)?e:[e],r=[];for(let o of t){let l=Wo(o);l&&r.push(l);}return r}function In(e){return [e.key.toLowerCase(),e.ctrlKey?"ctrl":"",e.metaKey?"meta":"",e.shiftKey?"shift":"",e.altKey?"alt":""].join(":")}function Nn(e,t){if(!t)return [...e];let r=Mt(t.disabledCommandIds),o=t.bindings,l=t.preventNativeConflicts!==false,n=t.preventCollisions!==false,i=new Set;return e.filter(u=>!r.has(u.id)).map(u=>{let d=u.shortcuts?[...u.shortcuts]:void 0;if(!!o&&Object.prototype.hasOwnProperty.call(o,u.id)&&o){let c=o[u.id],p=c===void 0?[]:Fn(c);d=p.length>0?p:void 0;}if(d&&d.length>0){let c=[];for(let p of d){let m=Wo(p);if(!m||l&&Go(m))continue;let h=In(m);n&&i.has(h)||(i.add(h),c.push(m));}d=c.length>0?c:void 0;}return {...u,shortcuts:d}})}function po(e){let t=e?.isFeatureEnabled??(()=>true),r=Ln(e?.headingOptions),o=e?.paragraphLabel?.trim()||"Paragraph",l=r.map(n=>{let i=Tn(n);return {id:`block.heading${i}`,label:`Heading ${i}`,description:Sn(n),category:"Block",action:a=>a.toggleHeading?.(n),shortcuts:[{key:i,ctrlKey:true,altKey:true}],keywords:["heading",n],condition:a=>t("blockFormat")&&j(a,"toggleHeading")}});return [{id:"format.bold",label:"Toggle Bold",description:"Make text bold or remove bold formatting",category:"Format",action:n=>n.toggleBold?.(),shortcuts:[{key:"b",ctrlKey:true}],keywords:["bold","strong","format"],condition:n=>t("bold")&&j(n,"toggleBold")},{id:"format.italic",label:"Toggle Italic",description:"Make text italic or remove italic formatting",category:"Format",action:n=>n.toggleItalic?.(),shortcuts:[{key:"i",ctrlKey:true}],keywords:["italic","emphasis","format"],condition:n=>t("italic")&&j(n,"toggleItalic")},{id:"format.underline",label:"Toggle Underline",description:"Add or remove underline formatting",category:"Format",action:n=>n.toggleUnderline?.(),shortcuts:[{key:"u",ctrlKey:true}],keywords:["underline","format"],condition:n=>t("underline")&&j(n,"toggleUnderline")},{id:"format.strikethrough",label:"Toggle Strikethrough",description:"Add or remove strikethrough formatting",category:"Format",action:n=>n.toggleStrikethrough?.(),keywords:["strikethrough","format"],condition:n=>t("strikethrough")&&j(n,"toggleStrikethrough")},{id:"format.subscript",label:"Toggle Subscript",description:"Format text as subscript",category:"Format",action:n=>n.toggleSubscript?.(),keywords:["subscript","format"],condition:n=>t("subscript")&&vn(n)},{id:"format.superscript",label:"Toggle Superscript",description:"Format text as superscript",category:"Format",action:n=>n.toggleSuperscript?.(),keywords:["superscript","format"],condition:n=>t("superscript")&&Cn(n)},{id:"format.code",label:"Toggle Inline Code",description:"Format text as inline code",category:"Format",action:n=>n.formatText?.("code"),shortcuts:[{key:"`",ctrlKey:true}],keywords:["code","inline","format"],condition:n=>t("codeFormat")&&j(n,"formatText")},{id:"block.paragraph",label:o,description:"Convert to paragraph",category:"Block",action:n=>n.toggleParagraph?.(),shortcuts:[{key:"0",ctrlKey:true,altKey:true}],keywords:["paragraph","text"],condition:n=>t("blockFormat")&&j(n,"toggleParagraph")},...l,{id:"block.quote",label:"Quote",description:"Convert to blockquote",category:"Block",action:n=>n.toggleQuote?.(),keywords:["quote","blockquote"],condition:n=>t("blockFormat")&&j(n,"toggleQuote")},{id:"block.align-left",label:"Align Left",description:"Align selected blocks to the left",category:"Block",action:n=>n.setTextAlignment?.("left"),keywords:["align","left","text"],condition:n=>t("blockFormat")&&j(n,"setTextAlignment")},{id:"block.align-center",label:"Align Center",description:"Center-align selected blocks",category:"Block",action:n=>n.setTextAlignment?.("center"),keywords:["align","center","text"],condition:n=>t("blockFormat")&&j(n,"setTextAlignment")},{id:"block.align-right",label:"Align Right",description:"Align selected blocks to the right",category:"Block",action:n=>n.setTextAlignment?.("right"),keywords:["align","right","text"],condition:n=>t("blockFormat")&&j(n,"setTextAlignment")},{id:"block.align-justify",label:"Justify",description:"Justify selected blocks",category:"Block",action:n=>n.setTextAlignment?.("justify"),keywords:["align","justify","text"],condition:n=>t("blockFormat")&&j(n,"setTextAlignment")},{id:"block.codeblock",label:"Code Block",description:"Convert to code block",category:"Block",action:n=>n.toggleCodeBlock?.(),shortcuts:[{key:"`",ctrlKey:true,shiftKey:true}],keywords:["code","block"],condition:n=>t("code")&&j(n,"toggleCodeBlock")},{id:"block.code-language",label:"Set Code Language",description:"Set language for selected code block",category:"Block",action:n=>{if(!n.setCodeLanguage)return;let i=prompt("Code language (e.g. ts, css, python):")?.trim();i&&n.setCodeLanguage(i);},keywords:["code","language","syntax"],condition:n=>t("codeIntelligence")&&Yo(n)},{id:"block.code-language.auto",label:"Auto-Detect Code Language",description:"Detect language from selected code block",category:"Block",action:n=>{n.autoDetectCodeLanguage?.();},keywords:["code","language","auto","detect"],condition:n=>t("codeIntelligence")&&Yo(n)},{id:"list.bullet",label:"Bullet List",description:"Create or toggle bullet list",category:"List",action:n=>n.toggleUnorderedList?.(),shortcuts:[{key:"l",ctrlKey:true,shiftKey:true}],keywords:["list","bullet"],condition:n=>t("list")&&j(n,"toggleUnorderedList")},{id:"list.numbered",label:"Numbered List",description:"Create or toggle numbered list",category:"List",action:n=>n.toggleOrderedList?.(),shortcuts:[{key:"l",ctrlKey:true,altKey:true}],keywords:["list","numbered"],condition:n=>t("list")&&j(n,"toggleOrderedList")},{id:"list.check",label:"Checklist",description:"Create or toggle checklist",category:"List",action:n=>n.toggleCheckList?.(),shortcuts:[{key:"x",ctrlKey:true,shiftKey:true}],keywords:["list","check","todo","task"],condition:n=>t("list")&&j(n,"toggleCheckList")},{id:"link.insert",label:"Insert Link",description:"Insert or edit a link",category:"Insert",action:n=>n.insertLink?.(),shortcuts:[{key:"k",ctrlKey:true}],keywords:["link","url"],condition:n=>t("link")&&j(n,"insertLink")},{id:"link.remove",label:"Remove Link",description:"Remove link formatting",category:"Format",action:n=>n.removeLink?.(),shortcuts:[{key:"k",ctrlKey:true,shiftKey:true}],keywords:["unlink","remove","link"],condition:n=>t("link")&&j(n,"removeLink")},{id:"insert.horizontal-rule",label:"Insert Horizontal Rule",description:"Insert a horizontal line separator",category:"Insert",action:n=>n.insertHorizontalRule?.(),keywords:["horizontal","rule","hr","divider","separator"],condition:n=>t("horizontalRule")&&j(n,"insertHorizontalRule")},{id:"insert.image",label:"Insert Image",description:"Insert an image from URL",category:"Insert",action:n=>{let i=prompt("Enter image URL:");if(i){let a=prompt("Enter alt text:")||"";n.insertImage?.({src:i,alt:a});}},keywords:["image","photo"],condition:n=>t("image")&&j(n,"insertImage")},{id:"insert.gif",label:"Insert GIF",description:"Insert an animated GIF from URL",category:"Insert",action:n=>{let i=prompt("Enter GIF URL:");i&&n.insertImage?.({src:i,alt:"GIF"});},keywords:["gif","animated","image"],condition:n=>t("image")&&j(n,"insertImage")},{id:"insert.emoji",label:"Insert Emoji",description:"Insert an emoji character",category:"Insert",action:n=>{let i=prompt("Enter emoji or shortcode (example :sparkles:):")?.trim();if(!i||typeof n.insertEmoji!="function")return;let a=i.match(/^:([a-z0-9_+-]+):$/i);if(a){let u=a[1];if(!u)return;if(typeof n.resolveEmojiShortcode=="function"){let d=n.resolveEmojiShortcode(u);if(d?.emoji){n.insertEmoji(d.emoji);return}}else if(typeof n.getEmojiSuggestions=="function"){let[d]=n.getEmojiSuggestions(u);if(d?.emoji){n.insertEmoji(d.emoji);return}}}n.insertEmoji(i);},keywords:["emoji","reaction","symbol","smile"],condition:n=>t("emoji")&&kn(n)},{id:"insert.table",label:"Insert Table",description:"Insert a 3x3 table",category:"Insert",action:n=>n.insertTable?.({rows:3,columns:3,includeHeaders:true}),keywords:["table","grid"],condition:n=>t("table")&&j(n,"insertTable")},{id:"insert.iframe",label:"Insert iframe",description:"Insert an iframe embed from URL",category:"Insert",action:n=>{if(typeof n.insertIframeEmbed!="function")return;let i=prompt("Enter iframe URL:");i&&n.insertIframeEmbed(i);},keywords:["iframe","embed","url"],condition:n=>t("iframeEmbed")&&En(n)},{id:"insert.youtube",label:"Insert YouTube Video",description:"Insert an embedded YouTube video",category:"Insert",action:n=>{if(typeof n.insertYouTubeEmbed!="function")return;let i=prompt("Enter YouTube URL:");i&&n.insertYouTubeEmbed(i);},keywords:["youtube","video","embed"],condition:n=>t("youTubeEmbed")&&xn(n)},{id:"edit.undo",label:"Undo",description:"Undo the last action",category:"Edit",action:n=>n.undo?.(),shortcuts:[{key:"z",ctrlKey:true}],keywords:["undo","revert"],condition:n=>t("history")&&j(n,"undo")},{id:"edit.redo",label:"Redo",description:"Redo the last undone action",category:"Edit",action:n=>n.redo?.(),shortcuts:[{key:"y",ctrlKey:true},{key:"z",ctrlKey:true,shiftKey:true}],keywords:["redo","repeat"],condition:n=>t("history")&&j(n,"redo")},{id:"palette.show",label:"Show Command Palette",description:"Open the command palette",category:"View",action:n=>n.showCommandPalette?.(),shortcuts:[{key:"p",ctrlKey:true,shiftKey:true}],keywords:["command","palette"],condition:n=>t("commandPalette")&&j(n,"showCommandPalette")}]}function Qo(e,t){let r=t?.commandPaletteShortcutOnly===true;return fo(e,t).filter(o=>!r||!!o.shortcuts&&o.shortcuts.length>0).map(o=>({id:o.id,label:o.label,description:o.description,category:o.category,action:()=>o.action(e),keywords:o.keywords,shortcut:o.shortcuts?.[0]?Zo(o.shortcuts[0]):void 0}))}function Xo(e,t){let r=new Set(["block.paragraph","block.quote","block.codeblock"]),o=a=>a.category==="Insert"||a.category==="List"?true:a.category==="Block"?a.id.startsWith("block.heading")?true:r.has(a.id):false,{allowlist:l,denylist:n}=wn(t?.slashCommandVisibility),i=l.size>0;return fo(e,t).filter(o).filter(a=>n.has(a.id)?false:i?l.has(a.id):true).map(a=>({id:a.id,label:a.label,description:a.description,category:a.category,action:()=>a.action(e),keywords:a.keywords,shortcut:a.shortcuts?.[0]?Zo(a.shortcuts[0]):void 0}))}function Zo(e){let t=[];return e.ctrlKey&&t.push("Ctrl"),e.metaKey&&t.push("Cmd"),e.altKey&&t.push("Alt"),e.shiftKey&&t.push("Shift"),t.push(e.key.toUpperCase()),t.join("+")}function er(e,t=document.body,r){let o=fo(e,r),l=n=>{let i=typeof r?.scope=="function"?r.scope():r?.scope;if(!(i&&n.target instanceof Node&&!i.contains(n.target))){for(let a of o)if(a.shortcuts){for(let u of a.shortcuts)if(!(r?.shortcutConfig?.preventNativeConflicts!==false&&yn(n,u))&&n.key.toLowerCase()===u.key.toLowerCase()&&!!n.ctrlKey==!!u.ctrlKey&&!!n.metaKey==!!u.metaKey&&!!n.shiftKey==!!u.shiftKey&&!!n.altKey==!!u.altKey){u.preventDefault!==false&&n.preventDefault(),(!a.condition||a.condition(e))&&a.action(e);return}}}};return t.addEventListener("keydown",l),()=>t.removeEventListener("keydown",l)}var At=Bold,Dt=Italic,Kt=Underline,jt=Strikethrough,Ut=Code,tr=Code2,dt=Link,nt=Unlink,_t=List,Vt=ListChecks,$t=ListOrdered,or=Undo2,rr=Redo2,ho=Image,ct=AlignLeft,it=AlignCenter,nr=AlignJustify,mt=AlignRight,bo=Upload,ir=Minus,lr=Table,ar=FileCode,ls=Eye,sr=Highlighter,as=Pencil,Jt=Command,ur=Palette,dr=Type,qt=Quote,cr=IndentIncrease,mr=IndentDecrease,gr=Sun,fr=Moon,pr=Search,yo=Smile,hr=Subscript,br=Superscript,yr=ChevronDown,vr=X;function xr({isOpen:e,onClose:t,commands:r}){let[o,l]=useState(""),[n,i]=useState(0),a=useRef(null),u=useRef(null),d=r.filter(p=>`${p.label} ${p.description||""} ${p.keywords?.join(" ")||""}`.toLowerCase().includes(o.toLowerCase())),b=d.reduce((p,m)=>{let h=m.category||"Other";return p[h]||(p[h]=[]),p[h].push(m),p},{}),c=d;return useEffect(()=>{i(0);},[o]),useEffect(()=>{e&&a.current&&(a.current.focus({preventScroll:true}),l(""),i(0));},[e]),useEffect(()=>{if(!e)return;let p=u.current;if(!p)return;p.querySelector(".luthor-command-palette-item.selected")?.scrollIntoView({block:"nearest"});},[e,n,o]),useEffect(()=>{let p=m=>{if(e)switch(m.key){case "Escape":m.preventDefault(),m.stopPropagation(),t();break;case "ArrowDown":m.preventDefault(),m.stopPropagation(),i(h=>Math.min(h+1,c.length-1));break;case "ArrowUp":m.preventDefault(),m.stopPropagation(),i(h=>Math.max(h-1,0));break;case "Enter":m.preventDefault(),m.stopPropagation(),c[n]&&(c[n].action(),t());break}};return document.addEventListener("keydown",p,true),()=>document.removeEventListener("keydown",p,true)},[e,n,c,t]),e?jsx("div",{className:"luthor-command-palette-overlay",onClick:t,children:jsxs("div",{className:"luthor-command-palette",role:"dialog","aria-modal":"true","aria-label":"Command Palette",onClick:p=>p.stopPropagation(),children:[jsxs("div",{className:"luthor-command-palette-header",children:[jsx(pr,{size:16,className:"luthor-command-palette-icon"}),jsx("input",{ref:a,type:"text",placeholder:"Type a command or search...",value:o,onChange:p=>l(p.target.value),className:"luthor-command-palette-input"}),jsx("kbd",{className:"luthor-command-palette-kbd",children:"ESC"})]}),jsx("div",{ref:u,className:"luthor-command-palette-list",children:Object.keys(b).length===0?jsx("div",{className:"luthor-command-palette-empty",children:"No commands found"}):Object.entries(b).map(([p,m])=>jsxs("div",{className:"luthor-command-palette-group",children:[jsx("div",{className:"luthor-command-palette-group-title",children:p}),m.map(h=>{let O=c.indexOf(h);return jsxs("div",{className:`luthor-command-palette-item ${O===n?"selected":""}`,onClick:()=>{h.action(),t();},onMouseEnter:()=>i(O),children:[jsxs("div",{className:"luthor-command-palette-item-content",children:[jsx("div",{className:"luthor-command-palette-item-title",children:h.label}),h.description&&jsx("div",{className:"luthor-command-palette-item-description",children:h.description})]}),h.shortcut&&jsx("kbd",{className:"luthor-command-palette-item-shortcut",children:h.shortcut})]},h.id)})]},p))}),jsx("div",{className:"luthor-command-palette-footer",children:jsxs("span",{className:"luthor-command-palette-hint",children:[jsx(Jt,{size:14}),jsx("span",{children:"Use arrow keys, Enter, ESC"})]})})]})}):null}var hi={"--luthor-bg":"#ffffff","--luthor-fg":"#0f172a","--luthor-border":"#e2e8f0","--luthor-border-hover":"#cbd5e1","--luthor-border-active":"#94a3b8","--luthor-accent":"#0f172a","--luthor-accent-hover":"#1e293b","--luthor-shadow":"rgba(0, 0, 0, 0.08)","--luthor-muted":"#f8fafc","--luthor-muted-fg":"#64748b","--luthor-theme-transition":"0.2s ease","--luthor-drag-gutter-width":"56px","--luthor-line-height-ratio":"1","--luthor-toolbar-bg":"#f8fafc","--luthor-toolbar-section-border":"#e2e8f0","--luthor-toolbar-button-fg":"#0f172a","--luthor-toolbar-button-hover-bg":"#f8fafc","--luthor-toolbar-button-hover-border":"#cbd5e1","--luthor-toolbar-button-hover-shadow":"0 4px 12px rgba(0, 0, 0, 0.15)","--luthor-toolbar-button-press-shadow":"0 2px 8px rgba(0, 0, 0, 0.1)","--luthor-toolbar-button-active-bg":"#0f172a","--luthor-toolbar-button-active-border":"#0f172a","--luthor-toolbar-button-active-fg":"#ffffff","--luthor-toolbar-button-active-shadow":"0 2px 8px rgba(0, 0, 0, 0.2)","--luthor-toolbar-button-overlay":"linear-gradient(135deg, rgba(255, 255, 255, 0.1) 0%, rgba(255, 255, 255, 0.05) 100%)","--luthor-toolbar-button-active-overlay":"linear-gradient(135deg, rgba(255, 255, 255, 0.2) 0%, rgba(255, 255, 255, 0.1) 100%)","--luthor-toolbar-color-indicator-border":"#e2e8f0","--luthor-toolbar-highlight-bg":"#f8fafc","--luthor-quote-bg":"#f8fafc","--luthor-quote-fg":"#0f172a","--luthor-quote-border":"#0f172a","--luthor-syntax-comment":"#64748b","--luthor-syntax-keyword":"#64748b","--luthor-syntax-string":"#64748b","--luthor-syntax-number":"#64748b","--luthor-syntax-function":"#64748b","--luthor-syntax-variable":"#64748b","--luthor-floating-bg":"#ffffff","--luthor-floating-fg":"#0f172a","--luthor-floating-border":"#e2e8f0","--luthor-floating-shadow":"rgba(0, 0, 0, 0.08)","--luthor-floating-muted":"#f8fafc","--luthor-floating-border-hover":"#cbd5e1","--luthor-floating-border-active":"#94a3b8","--luthor-floating-accent":"#0f172a","--luthor-floating-accent-fg":"#ffffff","--luthor-z-dropdown":"20","--luthor-z-popover":"24","--luthor-z-menu":"28","--luthor-z-overlay":"32","--luthor-z-modal":"36","--luthor-preset-bg":"#ffffff","--luthor-preset-fg":"#0f172a","--luthor-preset-border":"#dbe2ea","--luthor-preset-muted":"#f8fafc","--luthor-preset-muted-fg":"#64748b","--luthor-preset-accent":"#2563eb","--luthor-preset-radius":"10px","--luthor-preset-shadow":"0 1px 3px rgba(15, 23, 42, 0.08)","--luthor-preset-content-padding":"16px","--luthor-preset-content-min-height":"180px"};function bi(e){return e?e.closest(".luthor-editor-wrapper"):null}function yi(e){return e?bi(e)??e:null}function vi(e){if(typeof window>"u"||!e)return {};let t=window.getComputedStyle(e),r={};for(let[o,l]of Object.entries(hi)){let n=t.getPropertyValue(o).trim()||l;r[o]=n;}return r}function Xe(e){return vi(yi(e))}function ft(){if(typeof window>"u")return {};let t=window.getSelection()?.anchorNode;if(!t)return {};let r=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;return Xe(r)}function Tr({isOpen:e,query:t,position:r,suggestions:o,onClose:l,onExecute:n}){let[i,a]=useState(0);if(useEffect(()=>{a(0);},[t,e]),useEffect(()=>{if(!e)return;let d=b=>{let c=o.length>0;switch(b.key){case "Escape":b.preventDefault(),b.stopPropagation(),l();break;case "ArrowDown":if(!c)return;b.preventDefault(),b.stopPropagation(),a(p=>Math.min(p+1,Math.max(o.length-1,0)));break;case "ArrowUp":if(!c)return;b.preventDefault(),b.stopPropagation(),a(p=>Math.max(p-1,0));break;case "Enter":case "Tab":if(!c||!o[i])return;b.preventDefault(),b.stopPropagation(),n(o[i].emoji);break}};return document.addEventListener("keydown",d,true),()=>document.removeEventListener("keydown",d,true)},[e,l,n,i,o]),!e||!r)return null;let u=jsxs("div",{className:"luthor-emoji-menu",style:{left:r.x,top:r.y,...ft()},onPointerDown:d=>{d.stopPropagation();},onMouseDown:d=>{d.stopPropagation();},children:[jsxs("div",{className:"luthor-emoji-menu-header",children:[jsx("span",{className:"luthor-emoji-menu-title",children:"Emoji"}),jsxs("span",{className:"luthor-emoji-menu-query",children:[":",t]})]}),jsx("div",{className:"luthor-emoji-menu-list",children:o.length===0?jsx("div",{className:"luthor-emoji-menu-empty",children:"No matching emoji"}):o.map((d,b)=>{let c=b===i,p=d.shortcodes[0]?`:${d.shortcodes[0]}:`:"";return jsxs("button",{type:"button",className:`luthor-emoji-menu-item ${c?"selected":""}`,onMouseEnter:()=>a(b),onMouseDown:m=>{m.preventDefault(),m.stopPropagation();},onClick:m=>{m.preventDefault(),m.stopPropagation(),n(d.emoji);},children:[jsx("span",{className:"luthor-emoji-menu-item-symbol","aria-hidden":"true",children:d.emoji}),jsxs("span",{className:"luthor-emoji-menu-item-content",children:[jsx("span",{className:"luthor-emoji-menu-item-title",children:d.label}),p&&jsx("span",{className:"luthor-emoji-menu-item-shortcode",children:p})]})]},`${d.emoji}-${d.label}`)})})]});return typeof document>"u"?u:createPortal(u,document.body)}function wr({isOpen:e,query:t,position:r,commands:o,onClose:l,onExecute:n}){let[i,a]=useState(0),u=useMemo(()=>{let c=t.trim().toLowerCase();return c?o.filter(p=>`${p.label} ${p.description||""} ${p.keywords?.join(" ")||""}`.toLowerCase().includes(c)):o},[o,t]),d=useMemo(()=>u.reduce((c,p)=>{let m=p.category||"Other";return c[m]||(c[m]=[]),c[m].push(p),c},{}),[u]);if(useEffect(()=>{a(0);},[t,e]),useEffect(()=>{if(!e)return;let c=p=>{let m=u.length>0;switch(p.key){case "Escape":p.preventDefault(),p.stopPropagation(),l();break;case "ArrowDown":if(!m)return;p.preventDefault(),p.stopPropagation(),a(h=>Math.min(h+1,Math.max(u.length-1,0)));break;case "ArrowUp":if(!m)return;p.preventDefault(),p.stopPropagation(),a(h=>Math.max(h-1,0));break;case "Enter":case "Tab":if(!m||!u[i])return;p.preventDefault(),p.stopPropagation(),n(u[i].id);break}};return document.addEventListener("keydown",c,true),()=>document.removeEventListener("keydown",c,true)},[u,e,l,n,i]),!e||!r)return null;let b=jsxs("div",{className:"luthor-slash-menu",style:{left:r.x,top:r.y,...ft()},onPointerDown:c=>{c.stopPropagation();},onMouseDown:c=>{c.stopPropagation();},children:[jsxs("div",{className:"luthor-slash-menu-header",children:[jsx("span",{className:"luthor-slash-menu-title",children:"Insert block"}),jsxs("span",{className:"luthor-slash-menu-query",children:["/",t]})]}),jsx("div",{className:"luthor-slash-menu-list",children:u.length===0?jsx("div",{className:"luthor-slash-menu-empty",children:"No matching commands"}):Object.entries(d).map(([c,p])=>jsxs("div",{className:"luthor-slash-menu-group",children:[jsx("div",{className:"luthor-slash-menu-group-title",children:c}),p.map(m=>{let h=u.indexOf(m);return jsxs("button",{type:"button",className:`luthor-slash-menu-item ${h===i?"selected":""}`,onMouseEnter:()=>a(h),onMouseDown:S=>{S.preventDefault(),S.stopPropagation();},onClick:S=>{S.preventDefault(),S.stopPropagation(),n(m.id);},children:[jsxs("span",{className:"luthor-slash-menu-item-content",children:[jsx("span",{className:"luthor-slash-menu-item-title",children:m.label}),m.description&&jsx("span",{className:"luthor-slash-menu-item-description",children:m.description})]}),m.shortcut&&jsx("kbd",{className:"luthor-slash-menu-item-shortcut",children:m.shortcut})]},m.id)})]},c))})]});return typeof document>"u"?b:createPortal(b,document.body)}function L({children:e,onClick:t,title:r,active:o,disabled:l,className:n,type:i="button"}){return jsx("button",{type:i,className:`luthor-toolbar-button${o?" active":""}${n?` ${n}`:""}`,onClick:t,title:r,disabled:l,children:e})}function Co({children:e,onClick:t,variant:r="primary",type:o="button",className:l}){return jsx("button",{type:o,onClick:t,className:`${r==="primary"?"luthor-button-primary":"luthor-button-secondary"}${l?` ${l}`:""}`,children:e})}function Tt({value:e,onValueChange:t,options:r,placeholder:o="Select..."}){let[l,n]=useState(false),[i,a]=useState(void 0),u=useRef(null),d=useRef(null);useEffect(()=>{if(!l)return;let c=()=>{let p=u.current?.querySelector(".luthor-select-trigger");if(!p)return;let m=p.getBoundingClientRect();a({position:"fixed",top:m.bottom+4,left:m.left,width:m.width,...Xe(p)});};return c(),window.addEventListener("resize",c),window.addEventListener("scroll",c,true),()=>{window.removeEventListener("resize",c),window.removeEventListener("scroll",c,true);}},[l]),useEffect(()=>{function c(p){let m=p.target;u.current?.contains(m)||d.current?.contains(m)||n(false);}return document.addEventListener("mousedown",c),()=>document.removeEventListener("mousedown",c)},[]);let b=r.find(c=>c.value===e);return jsxs("div",{className:"luthor-select",ref:u,children:[jsxs("button",{className:`luthor-select-trigger ${l?"open":""}`,onClick:()=>n(!l),type:"button",children:[jsx("span",{children:b?.label||o}),jsx(yr,{size:14})]}),l&&typeof document<"u"&&createPortal(jsx("div",{ref:d,className:"luthor-select-dropdown",style:i,children:r.map(c=>jsx("button",{className:`luthor-select-option ${e===c.value?"selected":""}`,onClick:()=>{t(c.value),n(false);},type:"button",children:c.label},c.value))}),document.body)]})}function St({trigger:e,children:t,isOpen:r,onOpenChange:o}){let l=useRef(null),n=useRef(null),i=useRef(null),[a,u]=useState(void 0);return useEffect(()=>{if(!r)return;let d=()=>{let b=n.current;if(!b)return;let c=b.getBoundingClientRect();u({position:"fixed",top:c.bottom+4,left:c.left,...Xe(b)});};return d(),window.addEventListener("resize",d),window.addEventListener("scroll",d,true),()=>{window.removeEventListener("resize",d),window.removeEventListener("scroll",d,true);}},[r]),useEffect(()=>{function d(b){let c=b.target;l.current?.contains(c)||i.current?.contains(c)||o(false);}return document.addEventListener("mousedown",d),()=>document.removeEventListener("mousedown",d)},[o]),jsxs("div",{className:"luthor-dropdown",ref:l,children:[jsx("div",{ref:n,onClick:()=>o(!r),children:e}),r&&typeof document<"u"&&createPortal(jsx("div",{ref:i,className:"luthor-dropdown-content",style:a,children:t}),document.body)]})}function Ir({isOpen:e,onClose:t,title:r,children:o}){let l=useRef(null);return useEffect(()=>{function n(a){l.current&&!l.current.contains(a.target)&&t();}function i(a){a.key==="Escape"&&t();}return e&&(document.addEventListener("mousedown",n),document.addEventListener("keydown",i)),()=>{document.removeEventListener("mousedown",n),document.removeEventListener("keydown",i);}},[e,t]),e?jsx("div",{className:"luthor-dialog-overlay",children:jsxs("div",{className:"luthor-dialog",ref:l,children:[jsxs("div",{className:"luthor-dialog-header",children:[jsx("h3",{className:"luthor-dialog-title",children:r}),jsx("button",{className:"luthor-dialog-close",onClick:t,type:"button",children:jsx(vr,{size:16})})]}),jsx("div",{className:"luthor-dialog-content",children:o})]})}):null}function Nr({isVisible:e,selectionRect:t,commands:r,activeStates:o,editorTheme:l="light",hide:n,isFeatureEnabled:i=()=>true}){let a=useRef(null),[u,d]=useState(""),[b,c]=useState(""),[p,m]=useState(""),[h,O]=useState(""),[S,P]=useState(""),[U,_]=useState(""),[C,oe]=useState(null),[ae,$]=useState(null),[g,I]=useState(null),E=!!o.isIframeEmbedSelected,D=!!o.isYouTubeEmbedSelected,R=i("iframeEmbed"),X=i("youTubeEmbed"),B=i("image"),he=R&&E||X&&D;if(useEffect(()=>{if(!e)return;let F=w=>{let V=w.target;V&&(a.current?.contains(V)||n?.());};return document.addEventListener("mousedown",F,true),document.addEventListener("touchstart",F,true),()=>{document.removeEventListener("mousedown",F,true),document.removeEventListener("touchstart",F,true);}},[e,n]),useEffect(()=>{if(!e||!E)return;let F=false;return typeof r.getIframeEmbedCaption=="function"&&r.getIframeEmbedCaption().then(w=>{F||c(w??"");}),typeof r.getIframeEmbedUrl=="function"&&r.getIframeEmbedUrl().then(w=>{F||d(w??"");}),oe(null),()=>{F=true;}},[r,E,e]),useEffect(()=>{if(!e||!o.imageSelected)return;let F=false;return typeof r.getImageCaption=="function"&&r.getImageCaption().then(w=>{F||m(w??"");}),()=>{F=true;}},[o.imageSelected,r,e]),useEffect(()=>{if(!e||!D)return;let F=false;return typeof r.getYouTubeEmbedCaption=="function"&&r.getYouTubeEmbedCaption().then(w=>{F||O(w??"");}),typeof r.getYouTubeEmbedUrl=="function"&&r.getYouTubeEmbedUrl().then(w=>{F||P(w??"");}),$(null),()=>{F=true;}},[r,e,D]),useEffect(()=>{if(!e||!o.isLink)return;let F=false;return typeof r.getCurrentLink=="function"&&r.getCurrentLink().then(w=>{!F&&w&&_(w.url??"");}),I(null),()=>{F=true;}},[o.isLink,r,e]),!e||!t)return null;let ne={...ft(),position:"absolute",top:t.y,left:t.positionFromRight?"auto":t.x,right:t.positionFromRight?10:"auto",zIndex:9999,pointerEvents:"auto"};if(he){let F=M=>{if(E){r.setIframeEmbedAlignment?.(M);return}D&&r.setYouTubeEmbedAlignment?.(M);},w=E?o.isIframeEmbedAlignedLeft:o.isYouTubeEmbedAlignedLeft,V=E?o.isIframeEmbedAlignedCenter:o.isYouTubeEmbedAlignedCenter,ot=E?o.isIframeEmbedAlignedRight:o.isYouTubeEmbedAlignedRight,ye=E?typeof r.setIframeEmbedCaption=="function":typeof r.setYouTubeEmbedCaption=="function",ke=E?typeof r.updateIframeEmbedUrl=="function":typeof r.updateYouTubeEmbedUrl=="function",qe=E?b:h,Te=E?c:O,Me=E?u:S,G=E?C:ae,Se=()=>{if(ye){if(E){r.setIframeEmbedCaption?.(b);return}r.setYouTubeEmbedCaption?.(h);}},Re=M=>{E?oe(M):$(M);},ie=M=>{E?d(M):P(M);},ve=()=>{if(!ke)return;if(!(E?r.updateIframeEmbedUrl?.(u)??false:r.updateYouTubeEmbedUrl?.(S)??false)){Re(E?"Enter a valid http(s) URL":"Enter a valid YouTube URL"),E&&typeof r.getIframeEmbedUrl=="function"?r.getIframeEmbedUrl().then(Be=>d(Be??"")):!E&&typeof r.getYouTubeEmbedUrl=="function"&&r.getYouTubeEmbedUrl().then(Be=>P(Be??""));return}Re(null);};return jsxs("div",{className:"luthor-floating-toolbar","data-theme":l,ref:a,style:ne,children:[jsx(L,{onClick:()=>F("left"),active:w,title:"Align Left",children:jsx(ct,{size:14})}),jsx(L,{onClick:()=>F("center"),active:V,title:"Align Center",children:jsx(it,{size:14})}),jsx(L,{onClick:()=>F("right"),active:ot,title:"Align Right",children:jsx(mt,{size:14})}),ye||ke?jsxs(Fragment,{children:[jsx("div",{className:"luthor-floating-toolbar-separator"}),jsxs("div",{className:"luthor-floating-toolbar-fields",children:[ke?jsxs("div",{className:"luthor-floating-toolbar-field-row",children:[jsx("input",{type:"url",value:Me,className:`luthor-floating-toolbar-input${G?" is-error":""}`,placeholder:E?"https://example.com/embed":"https://youtube.com/watch?v=...","aria-label":E?"Iframe URL":"YouTube URL","aria-invalid":G?true:void 0,onChange:M=>{ie(M.target.value),G&&Re(null);},onBlur:ve,onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),ve());}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-floating-toolbar-action luthor-floating-toolbar-action-primary",onClick:ve,children:"Update URL"})]}):null,ye?jsxs("div",{className:"luthor-floating-toolbar-field-row",children:[jsx("input",{type:"text",value:qe,className:"luthor-floating-toolbar-input",placeholder:"Add caption","aria-label":E?"Iframe caption":"YouTube caption",onChange:M=>Te(M.target.value),onBlur:Se,onKeyDown:M=>{M.key==="Enter"&&(M.preventDefault(),Se());}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-floating-toolbar-action",onClick:Se,children:"Update Caption"})]}):null]})]}):null]})}if(B&&o.imageSelected){let F=typeof r.setImageCaption=="function",w=()=>{F&&r.setImageCaption(p);};return jsxs("div",{className:"luthor-floating-toolbar","data-theme":l,ref:a,style:ne,children:[jsx(L,{onClick:()=>r.setImageAlignment("left"),active:o.isImageAlignedLeft,title:"Align Left",children:jsx(ct,{size:14})}),jsx(L,{onClick:()=>r.setImageAlignment("center"),active:o.isImageAlignedCenter,title:"Align Center",children:jsx(it,{size:14})}),jsx(L,{onClick:()=>r.setImageAlignment("right"),active:o.isImageAlignedRight,title:"Align Right",children:jsx(mt,{size:14})}),F?jsxs(Fragment,{children:[jsx("div",{className:"luthor-floating-toolbar-separator"}),jsxs("div",{className:"luthor-floating-toolbar-field-row",children:[jsx("input",{type:"text",value:p,className:"luthor-floating-toolbar-input",placeholder:"Add caption","aria-label":"Image caption",onChange:V=>m(V.target.value),onBlur:w,onKeyDown:V=>{V.key==="Enter"&&(V.preventDefault(),w());}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-floating-toolbar-action",onClick:w,children:"Update Caption"})]})]}):null]})}let we=i("bold"),se=i("italic"),Fe=i("underline"),Ie=i("strikethrough"),Ne=i("codeFormat"),ce=i("blockFormat"),Pe=i("link"),ze=i("list"),Oe=we||se||Fe||Ie,me=Ne||ce||Pe,He=ze,be=!!o.isLink&&typeof r.updateLink=="function"&&typeof r.removeLink=="function",ge=()=>{if(!be)return;if(!(r.updateLink?.(U)??false)){I("Enter a valid URL"),typeof r.getCurrentLink=="function"&&r.getCurrentLink().then(w=>{_(w?.url??"");});return}I(null);};return !Oe&&!me&&!He?null:jsxs("div",{className:"luthor-floating-toolbar","data-theme":l,ref:a,style:ne,children:[Oe?jsxs(Fragment,{children:[we?jsx(L,{onClick:()=>r.toggleBold(),active:o.bold,title:"Bold",children:jsx(At,{size:14})}):null,se?jsx(L,{onClick:()=>r.toggleItalic(),active:o.italic,title:"Italic",children:jsx(Dt,{size:14})}):null,Fe?jsx(L,{onClick:()=>r.toggleUnderline(),active:o.underline,title:"Underline",children:jsx(Kt,{size:14})}):null,Ie?jsx(L,{onClick:()=>r.toggleStrikethrough(),active:o.strikethrough,title:"Strikethrough",children:jsx(jt,{size:14})}):null]}):null,Oe&&me?jsx("div",{className:"luthor-floating-toolbar-separator"}):null,me?jsxs(Fragment,{children:[Ne?jsx(L,{onClick:()=>r.formatText("code"),active:o.code,title:"Inline Code",children:jsx(Ut,{size:14})}):null,ce?jsx(L,{onClick:()=>r.toggleQuote(),active:o.isQuote,title:"Quote",children:jsx(qt,{size:14})}):null,Pe?jsxs(Fragment,{children:[jsx(L,{onClick:()=>o.isLink?r.removeLink():r.insertLink(),active:o.isLink,title:o.isLink?"Remove Link":"Insert Link",children:o.isLink?jsx(nt,{size:14}):jsx(dt,{size:14})}),be?jsxs("div",{className:"luthor-floating-toolbar-field-row",children:[jsx("input",{type:"url",value:U,className:`luthor-floating-toolbar-input${g?" is-error":""}`,placeholder:"https://example.com","aria-label":"Link URL","aria-invalid":g?true:void 0,onChange:F=>{_(F.target.value),g&&I(null);},onBlur:ge,onKeyDown:F=>{F.key==="Enter"&&(F.preventDefault(),ge());}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-floating-toolbar-action luthor-floating-toolbar-action-primary",onClick:ge,children:"Update Link"}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-floating-toolbar-action luthor-floating-toolbar-action-danger",onClick:()=>r.removeLink(),"aria-label":"Unlink",children:jsx(nt,{size:13})})]}):null]}):null]}):null,(Oe||me)&&He?jsx("div",{className:"luthor-floating-toolbar-separator"}):null,He?jsxs(Fragment,{children:[jsx(L,{onClick:()=>r.toggleUnorderedList(),active:o.unorderedList,title:"Bullet List",children:jsx(_t,{size:14})}),jsx(L,{onClick:()=>r.toggleOrderedList(),active:o.orderedList,title:"Numbered List",children:jsx($t,{size:14})}),jsx(L,{onClick:()=>r.toggleCheckList(),active:o.checkList,title:"Checklist",children:jsx(Vt,{size:14})})]}):null]})}var De={commands:{},activeStates:{},editorTheme:"light",isFeatureEnabled:()=>true};function Eo(e,t,r,o=()=>true){De.commands=e,De.activeStates=t,De.editorTheme=r,De.isFeatureEnabled=o;}function Pr(){let e=Nr,t=new FloatingToolbarExtension;return t.config={...t.config,render:r=>createElement(e,{...r,commands:De.commands,activeStates:De.activeStates,editorTheme:De.editorTheme,isFeatureEnabled:De.isFeatureEnabled}),getCommands:()=>De.commands,getActiveStates:()=>De.activeStates},t}var Pi=120,Oi=58;function Hi(e,t=Oi){return e.length<=t?e:`${e.slice(0,t-3)}...`}function Hr(){let e=window.getSelection();return !e||e.rangeCount===0?false:!e.getRangeAt(0).collapsed}function Rr(e,t){if(!(e instanceof Element))return null;let r=e.closest("a");return !(r instanceof HTMLAnchorElement)||!t.contains(r)?null:r}function Mr({editor:e,commands:t,editorTheme:r="light",disabled:o=false}){let l=useRef(null),n=useRef(null),[i,a]=useState(null),[u,d]=useState(false),[b,c]=useState(""),[p,m]=useState(null),[h,O]=useState(null),S=useCallback(()=>{n.current!==null&&(window.clearTimeout(n.current),n.current=null);},[]),P=useCallback(()=>{S(),a(null),d(false),c(""),m(null),O(null);},[S]),U=useCallback(()=>{S(),n.current=window.setTimeout(()=>{P();},Pi);},[S,P]),_=useCallback(g=>{let I=g.getBoundingClientRect(),E=I.bottom+8,D=Math.max(10,Math.min(I.left,window.innerWidth-340));O({top:E,left:D});},[]),C=useCallback((g,I)=>{if(typeof t.getLinkByKey!="function"){a(E=>!E||E.nodeKey!==g?E:{...E,url:I});return}t.getLinkByKey(g).then(E=>{if(!E){P();return}a(D=>!D||D.nodeKey!==g?D:{...D,url:E.url});});},[t,P]);useEffect(()=>{if(!e||o||typeof window>"u"){P();return}let g=e.getRootElement();if(!g){P();return}let I=X=>{let B=Rr(X.target,g);if(!B)return;if(Hr()){P();return}S();let he=resolveLinkNodeKeyFromAnchor(e,B);if(!he)return;let ne=B.getAttribute("href")??B.href;a({nodeKey:he,url:ne,anchorEl:B}),_(B),m(null),u||c(ne),C(he,ne);},E=X=>{if(!i)return;let B=X.relatedTarget;B&&l.current?.contains(B)||Rr(B,g)||U();},D=()=>{Hr()&&P();},R=()=>{a(X=>{if(!X)return X;let B=X.anchorEl.isConnected&&g.contains(X.anchorEl)?X.anchorEl:g.querySelector(`a[data-lexical-node-key="${X.nodeKey}"]`);return B?(_(B),{...X,anchorEl:B,url:B.getAttribute("href")??B.href}):(P(),null)});};return g.addEventListener("mouseover",I),g.addEventListener("mouseout",E),document.addEventListener("selectionchange",D),window.addEventListener("scroll",R,true),window.addEventListener("resize",R),()=>{g.removeEventListener("mouseover",I),g.removeEventListener("mouseout",E),document.removeEventListener("selectionchange",D),window.removeEventListener("scroll",R,true),window.removeEventListener("resize",R),S();}},[t,o,e,i,u,P,U,C,_,S]);let oe=useMemo(()=>{if(!(!i||!h))return {...Xe(i.anchorEl),position:"fixed",top:h.top,left:h.left,zIndex:10040}},[i,h]);if(!i||!h||typeof document>"u")return null;let ae=()=>{(t.removeLinkByKey?.(i.nodeKey)??false)&&P();},$=()=>{let g=b.trim();if(!(t.updateLinkByKey?.(i.nodeKey,g)??false)){m("Enter a valid URL"),C(i.nodeKey,i.url);return}a(E=>!E||E.nodeKey!==i.nodeKey?E:{...E,url:g}),m(null),d(false),queueMicrotask(()=>{C(i.nodeKey,g);});};return createPortal(jsx("div",{ref:l,className:"luthor-floating-toolbar luthor-link-hover-bubble","data-theme":r,style:oe,onMouseEnter:S,onMouseLeave:U,children:u?jsxs(Fragment,{children:[jsx("input",{type:"url",value:b,className:`luthor-link-hover-bubble-input${p?" is-error":""}`,placeholder:"https://example.com","aria-label":"Edit link URL","aria-invalid":p?true:void 0,onChange:g=>{c(g.target.value),p&&m(null);},onKeyDown:g=>{if(g.key==="Enter"){g.preventDefault(),$();return}g.key==="Escape"&&(g.preventDefault(),d(false),c(i.url),m(null));}}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-link-hover-bubble-button luthor-link-hover-bubble-button-primary",onClick:$,children:"Update"}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-link-hover-bubble-button",onClick:()=>{d(false),c(i.url),m(null);},children:"Cancel"})]}):jsxs(Fragment,{children:[jsx("span",{className:"luthor-link-hover-bubble-url",title:i.url,children:Hi(i.url)}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-link-hover-bubble-button",onClick:()=>{c(i.url),d(true),m(null);},children:"Edit"}),jsx("button",{type:"button",className:"luthor-toolbar-button luthor-link-hover-bubble-button luthor-link-hover-bubble-button-danger",onClick:ae,"aria-label":"Unlink",children:jsx(nt,{size:13})})]})}),document.body)}function Ar({mode:e,onModeChange:t,labels:r,availableModes:o,isConverting:l}){let n=o??["visual","jsonb"],i={visual:r?.visual??"Visual",jsonb:r?.jsonb??"JSONB"};return jsxs("div",{className:"luthor-mode-tabs",children:[n.includes("visual")&&jsxs("button",{className:`luthor-mode-tab ${e==="visual"?"active":""}`,onClick:()=>t("visual"),children:[i.visual,l==="visual"&&jsx("span",{className:"luthor-tab-converting-spinner"})]}),n.includes("jsonb")&&jsxs("button",{className:`luthor-mode-tab ${e==="jsonb"?"active":""}`,onClick:()=>t("jsonb"),children:[i.jsonb,l==="jsonb"&&jsx("span",{className:"luthor-tab-converting-spinner"})]})]})}function Dr({value:e,onChange:t,placeholder:r,className:o}){let l=useRef(null);return useLayoutEffect(()=>{let n=l.current;if(!n)return;n.style.height="auto";let i=Math.max(n.scrollHeight,280);n.style.height=`${i}px`;},[e]),jsx("textarea",{ref:l,className:`luthor-source-view${o?` ${o}`:""}`,value:e,onChange:n=>t(n.target.value),placeholder:r,spellCheck:false})}function ee(e,t){let r=`luthor-preset-${e}`;return {placeholder:t,classNames:{container:`luthor-preset ${r} ${r}__container`,contentEditable:`luthor-content-editable ${r}__content`,placeholder:`luthor-placeholder ${r}__placeholder`}}}function Kr(e){return e.replace(/\r\n?/g,`
2
- `)}function To(e){let t=Kr(e).trim();if(!t)return "";try{let r=JSON.parse(t);return JSON.stringify(r,null,2)}catch{return t}}function jr(e){return Kr(e).trim()}var So=6,Di=["#ffffff","#f2f2f2","#d9d9d9","#bfbfbf","#808080","#404040","#000000","#fbe5d6","#f8cbad","#f4b183","#ed7d31","#c55a11","#fff2cc","#ffe699","#ffd966","#ffc000","#bf9000","#7f6000","#e2f0d9","#c6e0b4","#a9d18e","#70ad47","#548235","#375623","#ddebf7","#bdd7ee","#9dc3e6","#5b9bd5","#2f75b5","#1f4e78","#e4dfec","#d9c2e9","#b4a7d6","#8e7cc3","#674ea7","#351c75"];function Wt(e){return e.trim().toLowerCase().replace(/\s+/g,"")}function Ki(e,t){let r=Wt(t);for(let o of e)if(Wt(o.value)===r)return o.color;return null}function ji(e,t,r){if(!e||e==="default")return r;let o=Ki(t,e);return o||e}function Ui(e,t){let r=e.trim();return /^#([\da-f]{6})$/i.test(r)?r:/^#([\da-f]{3})$/i.test(r)?`#${r.slice(1).split("").map(l=>`${l}${l}`).join("")}`:t}function Ue(e){return e.trim().toLowerCase().replace(/\s+/g,"")}function _r(e){let t=e.split(",")[0]??"";return Ue(t.replace(/["']/g,""))}function Qt(e){let t=e.trim().toLowerCase().match(/^(-?\d*\.?\d+)px$/);if(!t)return null;let r=Number(t[1]);return Number.isFinite(r)?r:null}function Gt(){if(typeof window>"u")return null;let t=window.getSelection()?.anchorNode;if(!t)return null;let r=t.nodeType===Node.ELEMENT_NODE?t:t.parentElement;if(!r||!r.closest(".luthor-content-editable"))return null;let l=window.getComputedStyle(r);return {fontFamily:l.fontFamily,fontSize:l.fontSize,lineHeight:l.lineHeight}}function _i(e,t){if(!e)return null;let r=_r(e);return r?t.find(l=>Ue(l.value)===r?true:_r(l.fontFamily)===r)?.value??null:null}function Vi(e,t){if(!e)return null;let r=Ue(e),o=t.find(i=>Ue(String(i.value))===r?true:Ue(String(i.fontSize))===r);if(o)return String(o.value);let l=Qt(e);if(l==null)return null;let n=null;for(let i of t){let a=Qt(String(i.fontSize));if(a==null)continue;let u=Math.abs(a-l);(!n||u<n.distance)&&(n={value:String(i.value),distance:u});}return n?.value??null}function $i(e,t,r){if(!e)return null;let o=Ue(e),l=r.find(d=>Ue(d.value)===o?true:Ue(d.lineHeight)===o);if(l)return l.value;let n=t?Qt(t):null,i=Qt(e),a=null;if(i!=null&&n!=null&&n>0)a=i/n;else {let d=Number(e);Number.isFinite(d)&&(a=d);}if(a==null)return null;let u=null;for(let d of r){let b=Number(d.lineHeight);if(!Number.isFinite(b))continue;let c=Math.abs(b-a);(!u||c<u.distance)&&(u={value:d.value,distance:c});}return u?.value??null}function Vr({title:e,value:t,options:r,recentColors:o,active:l,fallbackColor:n,highlight:i,onChange:a,onClear:u,onAddRecent:d}){let b=useRef(null),c=useRef(null),p=useRef(null),m=useRef(null),h=useRef(null),[O,S]=useState(false),[P,U]=useState(void 0),_=ji(t,r,n),C=useMemo(()=>Di,[]),oe=useMemo(()=>{let g=[...o].slice(0,So);for(;g.length<So;)g.push("");return g},[o]);useEffect(()=>()=>{m.current&&window.cancelAnimationFrame(m.current);},[]);let ae=useCallback(g=>{h.current=g,!m.current&&(m.current=window.requestAnimationFrame(()=>{m.current=null,h.current&&(a(h.current),h.current=null);}));},[a]),$=useCallback(g=>{let I=b.current;if(!I)return;let E=I.getBoundingClientRect();U({position:"fixed",top:E.bottom+6,left:E.left,width:230,visibility:g?"visible":"hidden",...Xe(I)});},[]);return useLayoutEffect(()=>{if(!O)return;$(false);let g=window.requestAnimationFrame(()=>{$(true);});return ()=>{window.cancelAnimationFrame(g);}},[O,$]),useEffect(()=>{if(!O)return;let g=D=>{let R=D.target;b.current?.contains(R)||c.current?.contains(R)||S(false);},I=D=>{D.key==="Escape"&&S(false);},E=()=>$(true);return window.addEventListener("resize",E),window.addEventListener("scroll",E,true),document.addEventListener("mousedown",g),document.addEventListener("keydown",I),()=>{window.removeEventListener("resize",E),window.removeEventListener("scroll",E,true),document.removeEventListener("mousedown",g),document.removeEventListener("keydown",I);}},[O,$]),jsxs(Fragment,{children:[jsxs("button",{ref:b,type:"button",className:`luthor-toolbar-button luthor-color-button${l?" active":""}${i?" is-highlight":""}`,title:e,"aria-label":e,onClick:()=>S(g=>!g),children:[i?jsx(sr,{size:15,className:"luthor-color-button-highlighter"}):jsx("span",{className:"luthor-color-button-letter",children:"A"}),jsx("span",{className:"luthor-color-button-indicator",style:{backgroundColor:_}})]}),O&&typeof document<"u"&&createPortal(jsxs("div",{ref:c,className:"luthor-color-picker",style:P,children:[jsx("div",{className:"luthor-color-picker-header",children:jsx("span",{className:"luthor-color-picker-title",children:e})}),jsxs("div",{className:"luthor-color-picker-section",children:[jsx("p",{className:"luthor-color-picker-label",children:"Colors"}),jsx("div",{className:"luthor-color-swatch-grid",children:C.map(g=>jsx("button",{type:"button",className:"luthor-color-swatch",style:{backgroundColor:g},"aria-label":`Use color ${g}`,onClick:()=>{a(g),d(g),S(false);}},g))})]}),jsxs("div",{className:"luthor-color-picker-section",children:[jsx("p",{className:"luthor-color-picker-label",children:"Recent colors"}),jsx("div",{className:"luthor-color-swatch-row",children:oe.map((g,I)=>jsx("button",{type:"button",className:"luthor-color-swatch",style:{backgroundColor:g||"transparent"},"aria-label":g?`Use recent color ${g}`:"Empty recent color slot",disabled:!g,onClick:()=>{g&&(a(g),d(g),S(false));}},`${g||"empty"}-${I}`))})]}),jsxs("div",{className:"luthor-color-picker-footer",children:[jsx("button",{type:"button",className:"luthor-color-picker-clear",onClick:()=>{u(),S(false);},children:"Reset to Default"}),jsxs("button",{type:"button",className:"luthor-color-picker-custom",onClick:()=>p.current?.click(),children:[jsx(ur,{size:14}),jsx("span",{children:"Custom Color"})]}),jsx("input",{ref:p,type:"color",className:"luthor-color-picker-native luthor-color-picker-native-hidden",value:Ui(_,n),onInput:g=>{ae(g.target.value);},onChange:g=>{let I=g.target.value;a(I),d(I);}})]})]}),document.body)]})}function Ji(e,t){let r=useRef(null),o=useRef(null);return {handlers:useMemo(()=>({insertFromUrl:()=>{let n=prompt("Enter image URL:");if(!n)return;let i=prompt("Enter alt text:")||"",a=prompt("Enter caption (optional):")||void 0;e.insertImage({src:n,alt:i,caption:a});},insertFromFile:()=>r.current?.click(),insertGifFromUrl:()=>{let n=prompt("Enter GIF URL:");if(!n)return;let i=prompt("Enter alt text (optional):")||"GIF";e.insertImage({src:n,alt:i});},insertGifFromFile:()=>o.current?.click(),handleUpload:async n=>{let i=n.target.files?.[0];if(!i)return;let a;if(t)try{a=await t(i);}catch{alert("Failed to upload image");return}else a=URL.createObjectURL(i);e.insertImage({src:a,alt:i.name,file:i}),n.target.value="";},handleGifUpload:async n=>{let i=n.target.files?.[0];if(!i)return;if(!(i.type==="image/gif"||i.name.toLowerCase().endsWith(".gif"))){alert("Please select a GIF file."),n.target.value="";return}let u;if(t)try{u=await t(i);}catch{alert("Failed to upload GIF");return}else u=URL.createObjectURL(i);e.insertImage({src:u,alt:i.name||"GIF",file:i}),n.target.value="";},setAlignment:n=>{e.setImageAlignment(n);},setCaption:()=>{let n=prompt("Enter caption:")||"";e.setImageCaption(n);}}),[e,t]),fileInputRef:r,gifInputRef:o}}function qi(e){return useMemo(()=>({insertIframe:()=>{let t=prompt("Enter iframe URL:");t&&typeof e.insertIframeEmbed=="function"&&e.insertIframeEmbed(t);},insertYouTube:()=>{let t=prompt("Enter YouTube URL:");t&&typeof e.insertYouTubeEmbed=="function"&&e.insertYouTubeEmbed(t);}}),[e])}function Yi(e,t){switch(e){case "fontFamily":return t("fontFamily");case "fontSize":return t("fontSize");case "lineHeight":return t("lineHeight");case "textColor":return t("textColor");case "textHighlight":return t("textHighlight");case "subscript":return t("subscript");case "superscript":return t("superscript");case "blockFormat":case "quote":case "alignLeft":case "alignCenter":case "alignRight":case "alignJustify":return t("blockFormat");case "codeBlock":return t("code");case "unorderedList":case "orderedList":case "checkList":case "indentList":case "outdentList":return t("list");case "horizontalRule":return t("horizontalRule");case "table":return t("table");case "image":return t("image");case "emoji":return t("emoji");case "embed":return t("iframeEmbed")||t("youtubeEmbed");case "undo":case "redo":return t("history");default:return true}}function Gi(e,t,r){return Yi(e,t)?r?.[e]!==false:false}function Wi(e,t,r){return {sections:e.sections.map(o=>({...o,items:o.items.filter(l=>Gi(l,t,r))})).filter(o=>o.items.length>0)}}function $r({commands:e,hasExtension:t,activeStates:r,isDark:o,toggleTheme:l,onCommandPaletteOpen:n,imageUploadHandler:i,classNames:a,toolbarStyleVars:u,layout:d,toolbarVisibility:b,headingOptions:c,paragraphLabel:p}){let{handlers:m,fileInputRef:h,gifInputRef:O}=Ji(e,i),S=qi(e),P=t("iframeEmbed")||t("youtubeEmbed"),U=r.isIframeEmbedSelected||r.isYouTubeEmbedSelected,[_,C]=useState(false),[oe,ae]=useState(false),[$,g]=useState(false),[I,E]=useState(false),[D,R]=useState(false),[X,B]=useState("default"),[he,ne]=useState([{value:"default",label:"Default"}]),[we,se]=useState("default"),[Fe,Ie]=useState([{value:"default",label:"Default"}]),[Ne,ce]=useState("default"),[Pe,ze]=useState([{value:"default",label:"Default"}]),[Oe,me]=useState("default"),[He,be]=useState([{value:"default",label:"Default",color:"inherit"}]),[ge,F]=useState([]),[w,V]=useState("default"),[ot,ye]=useState([{value:"default",label:"Default",color:"transparent"}]),[ke,qe]=useState([]),[Te,Me]=useState(0),[G,Se]=useState({rows:3,columns:3,includeHeaders:false});useEffect(()=>{if(typeof document>"u")return;let f=()=>{Gt()&&Me(H=>H+1);};return document.addEventListener("selectionchange",f),()=>{document.removeEventListener("selectionchange",f);}},[]);let Re=useMemo(()=>t("emoji")?typeof e.getEmojiSuggestions=="function"?e.getEmojiSuggestions(""):typeof e.getEmojiCatalog=="function"?e.getEmojiCatalog():[]:[],[e,t]);useEffect(()=>{if(!t("fontFamily")||typeof e.getFontFamilyOptions!="function")return;let f=e.getFontFamilyOptions().map(H=>({value:H.value,label:H.label})),y=f.length>0?f:[{value:"default",label:"Default"}];ne(y),B(H=>y.some(z=>z.value===H)?H:"default");},[e,t]),useEffect(()=>{if(!t("fontFamily")||typeof e.getCurrentFontFamily!="function")return;let f=e.getFontFamilyOptions;if(typeof f!="function")return;let y=false;return e.getCurrentFontFamily().then(H=>{if(y)return;if(H&&H!=="default"){B(H);return}let z=Gt(),ue=_i(z?.fontFamily,f());B(ue??"default");}),()=>{y=true;}},[r,e,t,Te]),useEffect(()=>{if(!t("fontSize")||typeof e.getFontSizeOptions!="function")return;let f=e.getFontSizeOptions().map(z=>({value:String(z.value).trim(),label:String(z.label).trim()})).filter(z=>z.value.length>0&&z.label.length>0),y=f.some(z=>Ue(z.value)==="default"),H=f.length===0?[{value:"default",label:"Default"}]:y?f:[{value:"default",label:"Default"},...f];Ie(H),se(z=>H.some(ue=>ue.value===z)?z:"default");},[e,t]),useEffect(()=>{if(!t("fontSize")||typeof e.getCurrentFontSize!="function")return;let f=e.getFontSizeOptions;if(typeof f!="function")return;let y=false;return e.getCurrentFontSize().then(H=>{if(y)return;if(H&&H!=="default"){se(H);return}let z=Gt(),ue=Vi(z?.fontSize,f());se(ue??"default");}),()=>{y=true;}},[r,e,t,Te]),useEffect(()=>{if(!t("lineHeight")||typeof e.getLineHeightOptions!="function")return;let f=e.getLineHeightOptions().map(y=>({value:y.value,label:y.label}));f.length>0&&ze(f);},[e,t]),useEffect(()=>{if(!t("lineHeight")||typeof e.getCurrentLineHeight!="function")return;let f=e.getLineHeightOptions;if(typeof f!="function")return;let y=false;return e.getCurrentLineHeight().then(H=>{if(y)return;if(H){ce(H);return}let z=Gt(),ue=$i(z?.lineHeight,z?.fontSize,f());ce(ue??"default");}),()=>{y=true;}},[r,e,t,Te]),useEffect(()=>{if(!t("textColor")||typeof e.getTextColorOptions!="function")return;let f=e.getTextColorOptions().map(y=>({value:y.value,label:y.label,color:y.color}));f.length>0&&be(f);},[e,t]),useEffect(()=>{if(!t("textColor")||typeof e.getCurrentTextColor!="function")return;let f=false;return e.getCurrentTextColor().then(y=>{f||me(y??"default");}),()=>{f=true;}},[r,e,t,Te]),useEffect(()=>{if(!t("textHighlight")||typeof e.getTextHighlightOptions!="function")return;let f=e.getTextHighlightOptions().map(y=>({value:y.value,label:y.label,color:y.backgroundColor}));f.length>0&&ye(f);},[e,t]),useEffect(()=>{if(!t("textHighlight")||typeof e.getCurrentTextHighlight!="function")return;let f=false;return e.getCurrentTextHighlight().then(y=>{f||V(y??"default");}),()=>{f=true;}},[r,e,t,Te]);let ie=useMemo(()=>{if(!c||c.length===0)return [...Le];let f=new Set,y=[];for(let H of c)!Le.includes(H)||f.has(H)||(f.add(H),y.push(H));return y.length>0?y:[...Le]},[c]),ve=p?.trim()||"Paragraph",Ae=useMemo(()=>{let f=ie.map(y=>({value:y,label:`Heading ${y.slice(1)}`}));return [{value:"p",label:ve},...f]},[ie,ve]),M=r.isH1?"h1":r.isH2?"h2":r.isH3?"h3":r.isH4?"h4":r.isH5?"h5":r.isH6?"h6":"p",Be=Ae.some(f=>f.value===M)?M:"p",rt=f=>{f==="p"?e.toggleParagraph():f.startsWith("h")&&ie.includes(f)&&e.toggleHeading(f);},Ye=f=>{f==="default"?e.clearFontFamily?.():e.setFontFamily?.(f),B(f);},Ge=f=>{f==="default"?e.clearFontSize?.():e.setFontSize?.(f),se(f);},We=f=>{e.setLineHeight?.(f),ce(f);},v=(f,y)=>{f(H=>{let z=Wt(y),ue=H.filter(de=>Wt(de)!==z);return [y,...ue].slice(0,So)});},k=f=>{if(f==="default"){e.clearTextColor?.(),me("default");return}e.setTextColor?.(f),me(f);},K=f=>{if(f==="default"){e.clearTextHighlight?.(),V("default");return}e.setTextHighlight?.(f),V(f);},Z=f=>{switch(f){case "fontFamily":return t("fontFamily")?jsx(Tt,{value:X,onValueChange:Ye,options:he,placeholder:"Font"},"fontFamily"):null;case "fontSize":return t("fontSize")?jsx(Tt,{value:we,onValueChange:Ge,options:Fe,placeholder:"Size"},"fontSize"):null;case "lineHeight":return t("lineHeight")?jsx(Tt,{value:Ne,onValueChange:We,options:Pe,placeholder:"Line"},"lineHeight"):null;case "textColor":return t("textColor")?jsx(Vr,{title:"Text Color",value:Oe,options:He,recentColors:ge,active:r.hasCustomTextColor,fallbackColor:"#0f172a",onChange:k,onClear:()=>k("default"),onAddRecent:y=>v(F,y)},"textColor"):null;case "textHighlight":return t("textHighlight")?jsx(Vr,{title:"Text Highlight",value:w,options:ot,recentColors:ke,active:r.hasTextHighlight,fallbackColor:"#fef08a",highlight:true,onChange:K,onClear:()=>K("default"),onAddRecent:y=>v(qe,y)},"textHighlight"):null;case "bold":return jsx(L,{onClick:()=>e.toggleBold(),active:r.bold,title:"Bold (Ctrl+B)",children:jsx(At,{size:16})},"bold");case "italic":return jsx(L,{onClick:()=>e.toggleItalic(),active:r.italic,title:"Italic (Ctrl+I)",children:jsx(Dt,{size:16})},"italic");case "underline":return jsx(L,{onClick:()=>e.toggleUnderline(),active:r.underline,title:"Underline (Ctrl+U)",children:jsx(Kt,{size:16})},"underline");case "strikethrough":return jsx(L,{onClick:()=>e.toggleStrikethrough(),active:r.strikethrough,title:"Strikethrough",children:jsx(jt,{size:16})},"strikethrough");case "subscript":return t("subscript")?jsx(L,{onClick:()=>e.toggleSubscript?.(),active:r.subscript,title:"Subscript",children:jsx(hr,{size:16})},"subscript"):null;case "superscript":return t("superscript")?jsx(L,{onClick:()=>e.toggleSuperscript?.(),active:r.superscript,title:"Superscript",children:jsx(br,{size:16})},"superscript"):null;case "code":return jsx(L,{onClick:()=>e.formatText("code"),active:r.code,title:"Inline Code",children:jsx(Ut,{size:16})},"code");case "link":return jsx(L,{onClick:()=>r.isLink?e.removeLink():e.insertLink(),active:r.isLink,title:r.isLink?"Remove Link":"Insert Link",children:r.isLink?jsx(nt,{size:16}):jsx(dt,{size:16})},"link");case "blockFormat":return t("blockFormat")?jsx(Tt,{value:Be,onValueChange:rt,options:Ae,placeholder:"Format"},"blockFormat"):null;case "quote":return t("blockFormat")?jsx(L,{onClick:()=>e.toggleQuote(),active:r.isQuote,title:"Quote",children:jsx(qt,{size:16})},"quote"):null;case "alignLeft":return t("blockFormat")?jsx(L,{onClick:()=>e.setTextAlignment("left"),active:r.isTextAlignedLeft,title:"Align Left",children:jsx(ct,{size:16})},"alignLeft"):null;case "alignCenter":return t("blockFormat")?jsx(L,{onClick:()=>e.setTextAlignment("center"),active:r.isTextAlignedCenter,title:"Align Center",children:jsx(it,{size:16})},"alignCenter"):null;case "alignRight":return t("blockFormat")?jsx(L,{onClick:()=>e.setTextAlignment("right"),active:r.isTextAlignedRight,title:"Align Right",children:jsx(mt,{size:16})},"alignRight"):null;case "alignJustify":return t("blockFormat")?jsx(L,{onClick:()=>e.setTextAlignment("justify"),active:r.isTextAlignedJustify,title:"Justify",children:jsx(nr,{size:16})},"alignJustify"):null;case "codeBlock":return t("code")?jsx(L,{onClick:()=>e.toggleCodeBlock(),active:r.isInCodeBlock,title:"Code Block",children:jsx(tr,{size:16})},"codeBlock"):null;case "unorderedList":return t("list")?jsx(L,{onClick:()=>e.toggleUnorderedList(),active:r.unorderedList,title:"Bullet List",children:jsx(_t,{size:16})},"unorderedList"):null;case "orderedList":return t("list")?jsx(L,{onClick:()=>e.toggleOrderedList(),active:r.orderedList,title:"Numbered List",children:jsx($t,{size:16})},"orderedList"):null;case "checkList":return t("list")?jsx(L,{onClick:()=>e.toggleCheckList(),active:r.checkList,title:"Checklist",children:jsx(Vt,{size:16})},"checkList"):null;case "indentList":return t("list")?jsx(L,{onClick:()=>e.indentList(),title:"Indent List",disabled:r.checkList,children:jsx(cr,{size:14})},"indentList"):null;case "outdentList":return t("list")?jsx(L,{onClick:()=>e.outdentList(),title:"Outdent List",disabled:r.checkList,children:jsx(mr,{size:14})},"outdentList"):null;case "horizontalRule":return t("horizontalRule")?jsx(L,{onClick:()=>e.insertHorizontalRule(),title:"Insert Horizontal Rule",children:jsx(ir,{size:16})},"horizontalRule"):null;case "table":return t("table")?jsx(L,{onClick:()=>R(true),title:"Insert Table",children:jsx(lr,{size:16})},"table"):null;case "image":return t("image")?jsxs(Fragment,{children:[jsxs(St,{trigger:jsx("button",{className:`luthor-toolbar-button ${r.imageSelected?"active":""}`,title:"Insert Image",children:jsx(ho,{size:16})}),isOpen:_,onOpenChange:C,children:[jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{m.insertFromUrl(),C(false);},children:[jsx(dt,{size:16}),jsx("span",{children:"From URL"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{m.insertFromFile(),C(false);},children:[jsx(bo,{size:16}),jsx("span",{children:"Upload File"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{m.insertGifFromUrl(),C(false);},children:[jsx(yo,{size:16}),jsx("span",{children:"Insert GIF URL"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{m.insertGifFromFile(),C(false);},children:[jsx(bo,{size:16}),jsx("span",{children:"Upload GIF"})]})]},"image"),r.imageSelected&&jsxs(St,{trigger:jsx("button",{className:"luthor-toolbar-button",title:"Align Image",children:jsx(it,{size:16})}),isOpen:$,onOpenChange:g,children:[jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{m.setAlignment("left"),g(false);},children:[jsx(ct,{size:16}),jsx("span",{children:"Align Left"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{m.setAlignment("center"),g(false);},children:[jsx(it,{size:16}),jsx("span",{children:"Align Center"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{m.setAlignment("right"),g(false);},children:[jsx(mt,{size:16}),jsx("span",{children:"Align Right"})]}),jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{m.setCaption(),g(false);},children:[jsx(dr,{size:16}),jsx("span",{children:"Set Caption"})]})]},"imageAlign")]}):null;case "emoji":return !t("emoji")||Re.length===0?null:jsx(St,{trigger:jsx("button",{className:"luthor-toolbar-button",title:"Insert Emoji",children:jsx(yo,{size:16})}),isOpen:oe,onOpenChange:ae,children:jsx("div",{className:"luthor-emoji-picker-grid",role:"listbox","aria-label":"Emoji picker",children:Re.map(y=>jsx("button",{type:"button",className:"luthor-emoji-picker-item",title:y.shortcodes[0]?`${y.label} (:${y.shortcodes[0]}:)`:y.label,onClick:()=>{e.insertEmoji?.(y.emoji),ae(false);},children:y.emoji},`${y.emoji}-${y.label}`))})},"emoji");case "embed":return P?jsxs(St,{trigger:jsx("button",{className:`luthor-toolbar-button ${U?"active":""}`,title:"Insert Embed",children:jsx(ar,{size:16})}),isOpen:I,onOpenChange:E,children:[t("iframeEmbed")?jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{S.insertIframe(),E(false);},children:[jsx(dt,{size:16}),jsx("span",{children:"Embed iframe"})]}):null,t("youtubeEmbed")?jsxs("button",{className:"luthor-dropdown-item",onClick:()=>{S.insertYouTube(),E(false);},children:[jsx(ho,{size:16}),jsx("span",{children:"Embed YouTube Video"})]}):null]},"embed"):null;case "undo":return t("history")?jsx(L,{onClick:()=>e.undo(),disabled:!r.canUndo,title:"Undo (Ctrl+Z)",children:jsx(or,{size:16})},"undo"):null;case "redo":return t("history")?jsx(L,{onClick:()=>e.redo(),disabled:!r.canRedo,title:"Redo (Ctrl+Y)",children:jsx(rr,{size:16})},"redo"):null;case "commandPalette":return jsx(L,{onClick:()=>n?.(),title:"Command Palette (Ctrl+Shift+P)",children:jsx(Jt,{size:16})},"commandPalette");case "themeToggle":return jsx(L,{onClick:l,title:o?"Light Mode":"Dark Mode",children:o?jsx(gr,{size:16}):jsx(fr,{size:16})},"themeToggle");default:return null}},q=d??zt,Qe=useMemo(()=>Wi(q,t,b),[q,t,b]);return jsxs(Fragment,{children:[jsx("div",{className:a?.toolbar??"luthor-toolbar",style:u,children:Qe.sections.map((f,y)=>{let H=f.items.map((z,ue)=>{let de=Z(z);return de?Array.isArray(de)?de.map((W,Bt)=>W&&typeof W=="object"&&"key"in W&&W.key!=null?W:jsx("span",{children:W},`toolbar-item-${y}-${ue}-${Bt}`)):de.type===zi.Fragment?jsx("span",{children:de},`toolbar-item-${y}-${ue}`):de&&typeof de=="object"&&"key"in de&&de.key!=null?de:jsx("span",{children:de},`toolbar-item-${y}-${ue}`):null}).flat().filter(z=>z!==null);return H.length===0?null:jsx("div",{className:a?.section??"luthor-toolbar-section",children:H},y)})}),jsx("input",{ref:h,type:"file",accept:"image/*",onChange:m.handleUpload,className:"luthor-file-input"}),jsx("input",{ref:O,type:"file",accept:"image/gif",onChange:m.handleGifUpload,className:"luthor-file-input"}),jsx(Ir,{isOpen:D,onClose:()=>R(false),title:"Insert Table",children:jsxs("div",{className:"luthor-table-dialog",children:[jsxs("div",{className:"luthor-form-group",children:[jsx("label",{htmlFor:"table-rows",children:"Rows:"}),jsx("input",{id:"table-rows",type:"number",min:"1",max:"20",value:G.rows,onChange:f=>Se(y=>({...y,rows:parseInt(f.target.value)||1})),className:"luthor-input"})]}),jsxs("div",{className:"luthor-form-group",children:[jsx("label",{htmlFor:"table-columns",children:"Columns:"}),jsx("input",{id:"table-columns",type:"number",min:"1",max:"20",value:G.columns,onChange:f=>Se(y=>({...y,columns:parseInt(f.target.value)||1})),className:"luthor-input"})]}),jsx("div",{className:"luthor-form-group",children:jsxs("label",{className:"luthor-checkbox-label",children:[jsx("input",{type:"checkbox",checked:G.includeHeaders||false,onChange:f=>Se(y=>({...y,includeHeaders:f.target.checked})),className:"luthor-checkbox"}),"Include headers"]})}),jsxs("div",{className:"luthor-dialog-actions",children:[jsx(Co,{variant:"secondary",onClick:()=>R(false),children:"Cancel"}),jsx(Co,{variant:"primary",onClick:()=>{e.insertTable(G),R(false);},children:"Insert Table"})]})]})})]})}var Ho=["bold","italic","underline","strikethrough","fontFamily","fontSize","lineHeight","textColor","textHighlight","subscript","superscript","link","horizontalRule","table","list","history","image","blockFormat","code","codeIntelligence","codeFormat","tabIndent","enterKeyBehavior","iframeEmbed","youTubeEmbed","floatingToolbar","contextMenu","commandPalette","slashCommand","emoji","draggableBlock","customNode","themeToggle"],Qr={bold:true,italic:true,underline:true,strikethrough:true,fontFamily:true,fontSize:true,lineHeight:true,textColor:true,textHighlight:true,subscript:true,superscript:true,link:true,horizontalRule:true,table:true,list:true,history:true,image:true,blockFormat:true,code:true,codeIntelligence:true,codeFormat:true,tabIndent:true,enterKeyBehavior:true,iframeEmbed:true,youTubeEmbed:true,floatingToolbar:true,contextMenu:true,commandPalette:true,slashCommand:true,emoji:true,draggableBlock:true,customNode:true,themeToggle:true};function Nt(e){let t={...Qr};if(!e)return t;for(let r of Ho)typeof e[r]=="boolean"&&(t[r]=e[r]);return t}function Xr(e,t){return e[t]!==false}var Yr=[{value:"default",label:"Default",fontFamily:"inherit"},{value:"inter",label:"Inter",fontFamily:"'Inter', 'Segoe UI', Arial, sans-serif",cssImportUrl:"https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap"},{value:"merriweather",label:"Merriweather",fontFamily:"'Merriweather', Georgia, 'Times New Roman', serif",cssImportUrl:"https://fonts.googleapis.com/css2?family=Merriweather:wght@400;700&display=swap"},{value:"jetbrains-mono",label:"JetBrains Mono",fontFamily:"'JetBrains Mono', 'Courier New', monospace",cssImportUrl:"https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;500;700&display=swap"}],Ll={value:"default",label:"Default",fontFamily:"inherit"},Gr=[{value:"default",label:"Default",fontSize:"inherit"},{value:"12",label:"12px",fontSize:"12px"},{value:"14",label:"14px",fontSize:"14px"},{value:"16",label:"16px",fontSize:"16px"},{value:"18",label:"18px",fontSize:"18px"},{value:"20",label:"20px",fontSize:"20px"},{value:"24",label:"24px",fontSize:"24px"},{value:"32",label:"32px",fontSize:"32px"}],wl={value:"default",label:"Default",fontSize:"inherit"},Wr=[{value:"default",label:"Default",lineHeight:"1.5"},{value:"1",label:"1.0",lineHeight:"1"},{value:"1.15",label:"1.15",lineHeight:"1.15"},{value:"1.5",label:"1.5",lineHeight:"1.5"},{value:"1.75",label:"1.75",lineHeight:"1.75"},{value:"2",label:"2.0",lineHeight:"2"}],Fl={value:"default",label:"Default",lineHeight:"1.5"},It="1.5",Il=1;function st(e){return e.trim().toLowerCase()}function Zr(e){return /^[a-z0-9][a-z0-9-]*$/i.test(e)}function Nl(e){return st(e)==="default"?true:Xt(e)!==null}function Pl(e){let t=e??Yr,r=new Set,o=[];for(let n of t){let i=n.value.trim(),a=n.label.trim(),u=n.fontFamily.trim();if(!i||!a||!u||!Zr(i))continue;let d=st(i);r.has(d)||(r.add(d),o.push({value:i,label:a,fontFamily:u,cssImportUrl:n.cssImportUrl?.trim()||void 0}));}return o.length===0?Yr:o.some(n=>st(n.value)==="default")?o:[Ll,...o]}function Ol(e){let t=e??Gr,r=new Set,o=[];for(let n of t){let i=String(n.value).trim(),a=String(n.label).trim(),u=String(n.fontSize).trim();if(!i||!a||!u||!Zr(i))continue;let d=st(i);r.has(d)||(r.add(d),o.push({value:i,label:a,fontSize:u}));}return o.length===0?Gr:o.some(n=>st(n.value)==="default")?o:[wl,...o]}function Xt(e){let t=e.trim();if(!/^\d*\.?\d+$/.test(t))return null;let r=Number(t);return !Number.isFinite(r)||r<Il?null:r.toString()}function Hl(e){return typeof e=="number"?Number.isFinite(e)?Xt(e.toString())??It:It:typeof e=="string"?Xt(e)??It:It}function Rl(e,t=It){let r=e??Wr,o=new Set,l=[];for(let i of r){let a=String(i.value).trim(),u=String(i.label).trim();if(!a||!u||!Nl(a))continue;let d=st(a);if(o.has(d))continue;if(d==="default"){o.add(d),l.push({value:a,label:u,lineHeight:t});continue}let b=Xt(String(i.lineHeight));b&&(o.add(d),l.push({value:a,label:u,lineHeight:b}));}return l.length===0?Wr:l.some(i=>st(i.value)==="default")?l:[{...Fl,lineHeight:t},...l]}function tt({children:e}){return jsx("svg",{viewBox:"0 0 24 24",width:"16",height:"16",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:e})}var Bl=()=>jsxs(tt,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M3.5 11h17"}),jsx("path",{d:"M10.5 14.5h3"}),jsx("path",{d:"M12 2.8v4.4"}),jsx("path",{d:"M9.8 5h4.4"})]}),zl=()=>jsxs(tt,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M3.5 11h17"}),jsx("path",{d:"M10.5 8.5h3"}),jsx("path",{d:"M12 16.8v4.4"}),jsx("path",{d:"M9.8 19h4.4"})]}),Ml=()=>jsxs(tt,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M11.5 5v14"}),jsx("path",{d:"M7.5 10.5v3"}),jsx("path",{d:"M2.8 12h4.4"}),jsx("path",{d:"M5 9.8v4.4"})]}),Al=()=>jsxs(tt,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M12.5 5v14"}),jsx("path",{d:"M16.5 10.5v3"}),jsx("path",{d:"M16.8 12h4.4"}),jsx("path",{d:"M19 9.8v4.4"})]}),Dl=()=>jsxs(tt,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M3.5 11h17"}),jsx("path",{d:"M9.8 14.8l4.4 4.4"}),jsx("path",{d:"M14.2 14.8l-4.4 4.4"})]}),Kl=()=>jsxs(tt,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M12 5v14"}),jsx("path",{d:"M14.8 9.8l4.4 4.4"}),jsx("path",{d:"M19.2 9.8l-4.4 4.4"})]}),jl=()=>jsxs(tt,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M3.5 10.5h17"}),jsx("path",{d:"M10.5 5v14"}),jsx("path",{d:"M14.8 9.8l4.4 4.4"}),jsx("path",{d:"M19.2 9.8l-4.4 4.4"})]}),Ul=()=>jsxs(tt,{children:[jsx("rect",{x:"3.5",y:"5",width:"17",height:"14",rx:"1.5"}),jsx("path",{d:"M3.5 10.5h17"}),jsx("path",{d:"M10.5 5v14"}),jsx("path",{d:"M3.5 8h17"})]}),Zt=new ImageExtension;Zt.config={...Zt.config,uploadHandler:async e=>URL.createObjectURL(e),defaultAlignment:"center",resizable:true,pasteListener:{insert:true,replace:true},debug:false};var wo=new TableExtension;wo.config={...wo.config,enableContextMenu:true,tableBubbleRenderer:({headersEnabled:e,setHeadersEnabled:t,actions:r})=>jsxs(Fragment,{children:[jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon",title:"Insert row above","aria-label":"Insert row above",onClick:r.insertRowAbove,children:jsx(Bl,{})}),jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon",title:"Insert row below","aria-label":"Insert row below",onClick:r.insertRowBelow,children:jsx(zl,{})}),jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon",title:"Insert column left","aria-label":"Insert column left",onClick:r.insertColumnLeft,children:jsx(Ml,{})}),jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon",title:"Insert column right","aria-label":"Insert column right",onClick:r.insertColumnRight,children:jsx(Al,{})}),jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon",title:"Delete selected row","aria-label":"Delete selected row",onClick:r.deleteSelectedRow,children:jsx(Dl,{})}),jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon",title:"Delete selected column","aria-label":"Delete selected column",onClick:r.deleteSelectedColumn,children:jsx(Kl,{})}),jsx("label",{className:"luthor-table-bubble-checkbox",title:"Use first row as table headers",children:jsx("button",{type:"button",className:`luthor-table-bubble-button luthor-table-bubble-button-icon${e?" luthor-table-bubble-button-active":""}`,title:"Use first row as table headers","aria-label":"Use first row as table headers","aria-pressed":e,onClick:()=>t(!e),children:jsx(Ul,{})})}),jsx("button",{type:"button",className:"luthor-table-bubble-button luthor-table-bubble-button-icon luthor-table-bubble-button-danger",title:"Delete table","aria-label":"Delete table",onClick:r.deleteTable,children:jsx(jl,{})})]})};var Fo=new IframeEmbedExtension;Fo.config={...Fo.config,defaultWidth:720,defaultHeight:405,defaultAlignment:"center"};var Io=new YouTubeEmbedExtension;Io.config={...Io.config,defaultWidth:720,defaultHeight:405,defaultAlignment:"center",nocookie:true,controls:true,rel:1};var _l=Pr(),No=new ContextMenuExtension;No.config={...No.config,preventDefault:true};var Vl=new CommandPaletteExtension,$l=new SlashCommandExtension,Jl=new EmojiExtension,Po=new DraggableBlockExtension;Po.config={...Po.config,buttonStackPosition:"left"};var Oo=new LinkExtension;Oo.config={...Oo.config,linkSelectedTextOnPaste:true,autoLinkText:true,autoLinkUrls:true};var ql=textColorExtension.configure({options:[{value:"default",label:"Default",color:"inherit"},{value:"slate",label:"Slate",color:"#334155"},{value:"red",label:"Red",color:"#dc2626"},{value:"orange",label:"Orange",color:"#ea580c"},{value:"green",label:"Green",color:"#16a34a"},{value:"blue",label:"Blue",color:"#2563eb"},{value:"purple",label:"Purple",color:"#7c3aed"}]}),Yl=textHighlightExtension.configure({options:[{value:"default",label:"Default",backgroundColor:"transparent"},{value:"yellow",label:"Yellow",backgroundColor:"#fef08a"},{value:"green",label:"Green",backgroundColor:"#bbf7d0"},{value:"blue",label:"Blue",backgroundColor:"#bfdbfe"},{value:"pink",label:"Pink",backgroundColor:"#fbcfe8"},{value:"orange",label:"Orange",backgroundColor:"#fed7aa"}]}),{extension:Gl}=createCustomNodeExtension({nodeType:"featureCard",defaultPayload:{title:"Headless Custom Node",description:"This block is rendered by createCustomNodeExtension from @lyfie/luthor-headless.",tag:"Custom"},render:({payload:e,isSelected:t})=>jsxs("aside",{className:`luthor-extensive-feature-card${t?" is-selected":""}`,children:[jsx("div",{className:"luthor-extensive-feature-card__tag",children:e.tag??"Custom"}),jsx("h4",{className:"luthor-extensive-feature-card__title",children:e.title??"Custom Node"}),jsx("p",{className:"luthor-extensive-feature-card__description",children:e.description??"Insert strongly typed custom content blocks."})]})});function en({fontFamilyOptions:e,fontSizeOptions:t,lineHeightOptions:r,minimumDefaultLineHeight:o,featureFlags:l,isDraggableBoxEnabled:n,scaleByRatio:i,syntaxHighlighting:a,codeHighlightProvider:u,loadCodeHighlightProvider:d,maxAutoDetectCodeLength:b,isCopyAllowed:c,languageOptions:p}={}){let m=Nt(l),h=oe=>Xr(m,oe),O=(n??true)&&h("draggableBlock"),S=Hl(o),P=new FontFamilyExtension().configure({options:Pl(e),cssLoadStrategy:"on-demand"}),U=new FontSizeExtension().configure({options:Ol(t)}),_=new LineHeightExtension().configure({options:Rl(r,S),defaultLineHeight:S});Zt.configure({scaleByRatio:i??false}),codeExtension.configure({syntaxHighlighting:a??"auto",provider:u??void 0,loadProvider:d}),codeIntelligenceExtension.configure({provider:u??void 0,loadProvider:d,maxAutoDetectLength:b,isCopyAllowed:c??true,languageOptions:p});let C=[];return h("bold")&&C.push(boldExtension),h("italic")&&C.push(italicExtension),h("underline")&&C.push(underlineExtension),h("strikethrough")&&C.push(strikethroughExtension),h("fontFamily")&&C.push(P),h("fontSize")&&C.push(U),h("lineHeight")&&C.push(_),h("textColor")&&C.push(ql),h("textHighlight")&&C.push(Yl),h("subscript")&&C.push(subscriptExtension),h("superscript")&&C.push(superscriptExtension),h("link")&&C.push(Oo),h("horizontalRule")&&C.push(horizontalRuleExtension),h("table")&&C.push(wo),h("list")&&C.push(listExtension),h("history")&&C.push(historyExtension),h("image")&&C.push(Zt),h("blockFormat")&&C.push(blockFormatExtension),h("code")&&C.push(codeExtension),h("codeIntelligence")&&C.push(codeIntelligenceExtension),h("codeFormat")&&C.push(codeFormatExtension),h("tabIndent")&&C.push(tabIndentExtension),h("enterKeyBehavior")&&C.push(enterKeyBehaviorExtension),h("iframeEmbed")&&C.push(Fo),h("youTubeEmbed")&&C.push(Io),h("floatingToolbar")&&C.push(_l),h("contextMenu")&&C.push(No),h("commandPalette")&&C.push(Vl),h("slashCommand")&&C.push($l),h("emoji")&&C.push(Jl),O&&C.push(Po),h("customNode")&&C.push(Gl),C}function Q(e){return en(e)}var eo=en();function tn(e){if(!e)return "__default__";let t=Object.entries(e).filter(([,r])=>typeof r=="string"&&r.trim().length>0).sort(([r],[o])=>r.localeCompare(o));return t.length>0?JSON.stringify(t):"__default__"}function on(e){if(!e)return;let t={},r=(o,l)=>{typeof l=="string"&&l.trim().length>0&&(t[o]=l.trim());};return r("--luthor-fg",e.font?.color),r("--luthor-text-bold-color",e.font?.boldColor),r("--luthor-link-color",e.link?.color),r("--luthor-list-marker-color",e.list?.markerColor),r("--luthor-list-checkbox-color",e.list?.checkboxColor),r("--luthor-quote-bg",e.quote?.backgroundColor),r("--luthor-quote-fg",e.quote?.color),r("--luthor-quote-border",e.quote?.indicatorColor),r("--luthor-table-border-color",e.table?.borderColor),r("--luthor-table-header-bg",e.table?.headerBackgroundColor),r("--luthor-hr-color",e.hr?.color),r("--luthor-placeholder-color",e.placeholder?.color),r("--luthor-codeblock-bg",e.codeblock?.backgroundColor),r("--luthor-toolbar-bg",e.toolbar?.backgroundColor),Object.keys(t).length>0?t:void 0}function rn(e){if(!(e instanceof Element))return false;if(e.closest('[contenteditable="true"]'))return true;let t=e.tagName.toLowerCase();return t==="input"||t==="textarea"||t==="select"}function nn(e,t){if(e.key.toLowerCase()!==t.key.toLowerCase())return false;let r=e.ctrlKey||e.metaKey;return !(!!t.requiresPrimary!==r||!!t.shift!=!!e.shiftKey||!!t.alt!=!!e.altKey)}function ln(e,t,r){let o={...e??{}};for(let[l,n]of Object.entries(r))(Array.isArray(n)?n:[n]).some(u=>t[u]!==false)||(o[l]=false);return o}function an(e,t,r){let o={...e},l=(n,i)=>{t[n]===false&&i();};return l("bold",()=>{o.toggleBold=()=>{};}),l("italic",()=>{o.toggleItalic=()=>{};}),l("underline",()=>{o.toggleUnderline=()=>{};}),l("strikethrough",()=>{o.toggleStrikethrough=()=>{};}),l("codeFormat",()=>{o.formatText=()=>{};}),l("fontFamily",()=>{o.setFontFamily=()=>{},o.clearFontFamily=()=>{};}),l("fontSize",()=>{o.setFontSize=()=>{},o.clearFontSize=()=>{};}),l("lineHeight",()=>{o.setLineHeight=()=>{},o.clearLineHeight=()=>{};}),l("textColor",()=>{o.setTextColor=()=>{},o.clearTextColor=()=>{};}),l("textHighlight",()=>{o.setTextHighlight=()=>{},o.clearTextHighlight=()=>{};}),l("subscript",()=>{o.toggleSubscript=()=>{};}),l("superscript",()=>{o.toggleSuperscript=()=>{};}),l("link",()=>{o.insertLink=()=>{},o.removeLink=()=>{},o.updateLink=()=>false,o.getCurrentLink=async()=>null,o.getLinkByKey=async()=>null,o.updateLinkByKey=()=>false,o.removeLinkByKey=()=>false;}),l("blockFormat",()=>{o.toggleParagraph=()=>{},o.toggleHeading=()=>{},o.toggleQuote=()=>{},o.setTextAlignment=()=>{};}),l("code",()=>{o.toggleCodeBlock=()=>{};}),l("codeIntelligence",()=>{o.setCodeLanguage=()=>{},o.autoDetectCodeLanguage=async()=>null,o.copySelectedCodeBlock=async()=>false;}),l("list",()=>{o.toggleUnorderedList=()=>{},o.toggleOrderedList=()=>{},o.toggleCheckList=()=>{},o.indentList=()=>{},o.outdentList=()=>{};}),l("horizontalRule",()=>{o.insertHorizontalRule=()=>{};}),l("table",()=>{o.insertTable=()=>{};}),l("image",()=>{o.insertImage=()=>{},o.setImageAlignment=()=>{},o.setImageCaption=()=>{},o.getImageCaption=async()=>"";}),l("emoji",()=>{o.insertEmoji=()=>{},o.executeEmojiSuggestion=()=>false,o.closeEmojiSuggestions=()=>{},o.getEmojiSuggestions=()=>[],o.getEmojiCatalog=()=>[],o.resolveEmojiShortcode=()=>null,o.setEmojiCatalog=()=>{},o.setEmojiCatalogAdapter=()=>{},o.getEmojiCatalogAdapter=()=>({search:()=>[],resolveShortcode:()=>null,getAll:()=>[]});}),l("iframeEmbed",()=>{o.insertIframeEmbed=()=>{},o.setIframeEmbedAlignment=()=>{},o.resizeIframeEmbed=()=>{},o.setIframeEmbedCaption=()=>{},o.getIframeEmbedCaption=async()=>"",o.updateIframeEmbedUrl=()=>false,o.getIframeEmbedUrl=async()=>"";}),l("youTubeEmbed",()=>{o.insertYouTubeEmbed=()=>{},o.setYouTubeEmbedAlignment=()=>{},o.resizeYouTubeEmbed=()=>{},o.setYouTubeEmbedCaption=()=>{},o.getYouTubeEmbedCaption=async()=>"",o.updateYouTubeEmbedUrl=()=>false,o.getYouTubeEmbedUrl=async()=>"";}),l("history",()=>{o.undo=()=>{},o.redo=()=>{};}),l("commandPalette",()=>{o.showCommandPalette=()=>{},o.hideCommandPalette=()=>{},o.registerCommand=()=>{},o.unregisterCommand=()=>{};}),l("slashCommand",()=>{o.registerSlashCommand=()=>{},o.unregisterSlashCommand=()=>{},o.setSlashCommands=()=>{},o.closeSlashMenu=()=>{},o.executeSlashCommand=()=>false;}),r&&(o.toggleBold=()=>{},o.toggleItalic=()=>{},o.toggleUnderline=()=>{},o.toggleStrikethrough=()=>{},o.formatText=()=>{},o.setFontFamily=()=>{},o.clearFontFamily=()=>{},o.setFontSize=()=>{},o.clearFontSize=()=>{},o.setLineHeight=()=>{},o.clearLineHeight=()=>{},o.setTextColor=()=>{},o.clearTextColor=()=>{},o.setTextHighlight=()=>{},o.clearTextHighlight=()=>{},o.toggleSubscript=()=>{},o.toggleSuperscript=()=>{},o.insertLink=()=>{},o.removeLink=()=>{},o.updateLink=()=>false,o.toggleParagraph=()=>{},o.toggleHeading=()=>{},o.toggleQuote=()=>{},o.setTextAlignment=()=>{},o.toggleUnorderedList=()=>{},o.toggleOrderedList=()=>{},o.toggleCheckList=()=>{},o.indentList=()=>{},o.outdentList=()=>{},o.insertHorizontalRule=()=>{},o.insertTable=()=>{},o.insertImage=()=>{},o.setImageAlignment=()=>{},o.setImageCaption=()=>{},o.insertIframeEmbed=()=>{},o.setIframeEmbedAlignment=()=>{},o.resizeIframeEmbed=()=>{},o.setIframeEmbedCaption=()=>{},o.updateIframeEmbedUrl=()=>false,o.insertYouTubeEmbed=()=>{},o.setYouTubeEmbedAlignment=()=>{},o.resizeYouTubeEmbed=()=>{},o.setYouTubeEmbedCaption=()=>{},o.updateYouTubeEmbedUrl=()=>false),o}function to(e){return new Set(e)}function oo(e,t){e.clear();for(let r of t)e.add(r);}function ro(e,t){return e.has(t)}function Pt(e,t){e.add(t);}var N=(e,t=0,r="")=>({type:"text",version:1,text:e,detail:0,format:t,mode:"normal",style:r}),pe=(e,t="",r=0)=>({type:"paragraph",version:1,format:t,indent:r,direction:null,children:e}),Ro={root:{type:"root",version:1,format:"",indent:0,direction:null,children:[{type:"heading",version:1,tag:"h1",format:"",indent:0,direction:null,children:[N("Extensive Preset: JSONB-First Feature Showcase")]},pe([N("This starter content is now a native "),N("JSONB",1),N(" document that demonstrates visual editing without Markdown conversion.")]),{type:"heading",version:1,tag:"h2",format:"",indent:0,direction:null,children:[N("Inline formatting + typography")]},pe([N("Bold",1),N(" \u2022 "),N("Italic",2),N(" \u2022 "),N("Underline",8),N(" \u2022 "),N("Strikethrough",4),N(" \u2022 "),N("Inline Code",16),N(" \u2022 "),N("Subscript",32),N(" \u2022 "),N("Superscript",64)]),pe([N("Font family + size + color + highlight + line-height can be combined in one sentence.",0,"font-family: 'Inter', 'Segoe UI', Arial, sans-serif; font-size: 18px; line-height: 1.75; color: #2563eb; background-color: #bfdbfe;")]),{type:"paragraph",version:1,format:"center",indent:0,direction:null,children:[N("Centered paragraph with custom style",0,"font-size: 20px; color: #7c3aed;")]},{type:"paragraph",version:1,format:"right",indent:0,direction:null,children:[N("Right-aligned paragraph with highlight",128,"background-color: #fef08a;")]},{type:"quote",version:1,format:"",indent:0,direction:null,children:[N("\u201CEverything in this demo is persisted in JSONB and can round-trip via visual mode.\u201D")]},{type:"paragraph",version:1,format:"",indent:0,direction:null,children:[{type:"link",version:1,rel:"noreferrer",target:"_blank",title:"Luthor documentation",url:"https://github.com/facebook/lexical",format:"",indent:0,direction:null,children:[N("Example link node")]},N(" with regular sibling text and emoji support \u{1F389}\u{1F525}\u2705.")]},{type:"heading",version:1,tag:"h2",format:"",indent:0,direction:null,children:[N("Lists")]},{type:"list",version:1,listType:"bullet",start:1,tag:"ul",format:"",indent:0,direction:null,children:[{type:"listitem",version:1,value:1,format:"",indent:0,direction:null,children:[pe([N("Bullet item with styled text",0,"color: #16a34a;")])]},{type:"listitem",version:1,value:2,format:"",indent:0,direction:null,children:[pe([N("Nested formatting in lists",1),N(" works great.")])]}]},{type:"list",version:1,listType:"number",start:1,tag:"ol",format:"",indent:0,direction:null,children:[{type:"listitem",version:1,value:1,format:"",indent:0,direction:null,children:[pe([N("Numbered item 1")])]},{type:"listitem",version:1,value:2,format:"",indent:0,direction:null,children:[pe([N("Numbered item 2")])]}]},{type:"list",version:1,listType:"check",start:1,tag:"ul",format:"",indent:0,direction:null,children:[{type:"listitem",version:1,value:1,checked:true,format:"",indent:0,direction:null,children:[pe([N("Checked task item")])]},{type:"listitem",version:1,value:2,checked:false,format:"",indent:0,direction:null,children:[pe([N("Unchecked task item")])]}]},{children:[{detail:0,format:0,mode:"normal",style:"",text:"const",type:"code-highlight",version:1,highlightType:"keyword"},{detail:0,format:0,mode:"normal",style:"",text:" content ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:"=",type:"code-highlight",version:1,highlightType:"operator"},{detail:0,format:0,mode:"normal",style:"",text:" exportApi",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:".",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:"toJSON",type:"code-highlight",version:1,highlightType:"function"},{detail:0,format:0,mode:"normal",style:"",text:"(",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:")",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:";",type:"code-highlight",version:1,highlightType:"punctuation"},{type:"linebreak",version:1},{detail:0,format:0,mode:"normal",style:"",text:"await",type:"code-highlight",version:1,highlightType:"keyword"},{detail:0,format:0,mode:"normal",style:"",text:" ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:"saveToDatabase",type:"code-highlight",version:1,highlightType:"function"},{detail:0,format:0,mode:"normal",style:"",text:"(",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:"{",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:" jsonb",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:":",type:"code-highlight",version:1,highlightType:"operator"},{detail:0,format:0,mode:"normal",style:"",text:" content ",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:"}",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:")",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:";",type:"code-highlight",version:1,highlightType:"punctuation"},{type:"linebreak",version:1},{detail:0,format:0,mode:"normal",style:"",text:"importApi",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:".",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:"fromJSON",type:"code-highlight",version:1,highlightType:"function"},{detail:0,format:0,mode:"normal",style:"",text:"(",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:"content",type:"code-highlight",version:1},{detail:0,format:0,mode:"normal",style:"",text:")",type:"code-highlight",version:1,highlightType:"punctuation"},{detail:0,format:0,mode:"normal",style:"",text:";",type:"code-highlight",version:1,highlightType:"punctuation"}],direction:null,format:"",indent:0,type:"code",version:1,language:"typescript"},{type:"horizontalrule",version:1},{type:"featureCard",version:1,payload:{title:"Custom Node: Feature Card",description:"This block is rendered with createCustomNodeExtension and persists as structured payload.",tag:"Custom"},format:"",indent:0,direction:null,children:[]},{type:"image",version:1,src:"https://images.unsplash.com/photo-1461749280684-dccba630e2f6?auto=format&fit=crop&w=1200&q=80",alt:"Code editor on a laptop",caption:"Image node with caption, center alignment, and persisted dimensions.",alignment:"center",width:780,height:420},{type:"youtube-embed",version:1,src:"https://www.youtube.com/embed/dQw4w9WgXcQ",width:720,height:405,alignment:"center",start:0},{type:"iframe-embed",version:1,src:"https://example.com",width:720,height:405,alignment:"center",title:"Iframe embed example"},{type:"table",version:1,format:"",indent:0,direction:null,children:[{type:"tablerow",version:1,children:[{type:"tablecell",version:1,headerState:3,colSpan:1,rowSpan:1,width:240,backgroundColor:null,children:[pe([N("Feature")])]},{type:"tablecell",version:1,headerState:3,colSpan:1,rowSpan:1,width:320,backgroundColor:null,children:[pe([N("Status")])]}]},{type:"tablerow",version:1,children:[{type:"tablecell",version:1,headerState:0,colSpan:1,rowSpan:1,width:240,backgroundColor:null,children:[pe([N("Visual \u2194 JSONB switching")])]},{type:"tablecell",version:1,headerState:0,colSpan:1,rowSpan:1,width:320,backgroundColor:null,children:[pe([N("Round-trip ready \u2705")])]}]}]},pe([N("Use the toolbar, floating toolbar, slash commands (/), and command palette (Ctrl/Cmd+Shift+P) to explore the full preset.")])]}};JSON.stringify(Ro);var{Provider:ia,useEditor:la}=createEditorSystem(),sn="Write anything...",un="Enter JSONB document content...";function aa(e){let r=e.replace(/\r\n?/g,`
3
- `).trim().split(/\n{2,}/).map(l=>l.replace(/\s+/g," ").trim()).filter(l=>l.length>0);return {root:{type:"root",version:1,format:"",indent:0,direction:null,children:(r.length>0?r:[""]).map(l=>({type:"paragraph",version:1,format:"",indent:0,direction:null,children:[{type:"text",version:1,text:l,detail:0,format:0,mode:"normal",style:""}]}))}}}function sa(e){try{let t=JSON.parse(e);return JSON.stringify(t)}catch{return JSON.stringify(aa(e))}}function ua(e){return !e||e.length===0?"__default__":JSON.stringify(e.map(t=>({value:t.value.trim(),label:t.label.trim(),fontFamily:t.fontFamily.trim(),cssImportUrl:t.cssImportUrl?.trim()||""})))}function da(e){return !e||e.length===0?"__default__":JSON.stringify(e.map(t=>({value:String(t.value).trim(),label:String(t.label).trim(),fontSize:String(t.fontSize).trim()})))}function ca(e){return !e||e.length===0?"__default__":JSON.stringify(e.map(t=>({value:String(t.value).trim(),label:String(t.label).trim(),lineHeight:String(t.lineHeight).trim()})))}function ma(e){if(typeof e=="number")return !Number.isFinite(e)||e<1?"1.5":e.toString();if(typeof e=="string"){let r=e.trim();if(r.length===0)return "1.5";let o=Number(r);return !Number.isFinite(o)||o<1?"1.5":o.toString()}return "1.5"}function Bo(e){return tn(e)}function ga(e){if(!e)return "__default__";if(Array.isArray(e))return JSON.stringify({mode:"append",values:e.map(o=>o.trim())});let t=e,r=Array.isArray(t.values)?t.values:[];return JSON.stringify({mode:t.mode??"append",values:r.map(o=>o.trim())})}function fa(e){return on(e)}function pa(e){let t=Nt(e);return JSON.stringify(Ho.map(r=>[r,t[r]]))}function dn(e){return rn(e)}var ha=[{feature:"bold",key:"b",requiresPrimary:true},{feature:"italic",key:"i",requiresPrimary:true},{feature:"underline",key:"u",requiresPrimary:true},{feature:"link",key:"k",requiresPrimary:true},{feature:"history",key:"z",requiresPrimary:true},{feature:"history",key:"y",requiresPrimary:true},{feature:"history",key:"z",requiresPrimary:true,shift:true},{feature:"commandPalette",key:"p",requiresPrimary:true,shift:true},{feature:"codeFormat",key:"`",requiresPrimary:true},{feature:"code",key:"`",requiresPrimary:true,shift:true},{feature:"list",key:"l",requiresPrimary:true,shift:true},{feature:"list",key:"l",requiresPrimary:true,alt:true},{feature:"list",key:"x",requiresPrimary:true,shift:true},{feature:"blockFormat",key:"0",requiresPrimary:true,alt:true},{feature:"blockFormat",key:"1",requiresPrimary:true,alt:true},{feature:"blockFormat",key:"2",requiresPrimary:true,alt:true},{feature:"blockFormat",key:"3",requiresPrimary:true,alt:true},{feature:"blockFormat",key:"4",requiresPrimary:true,alt:true},{feature:"blockFormat",key:"5",requiresPrimary:true,alt:true},{feature:"blockFormat",key:"6",requiresPrimary:true,alt:true}];function ba(e,t){return nn(e,t)}function ya(e,t,r){return an(e,t,r)}var va={fontFamily:"fontFamily",fontSize:"fontSize",lineHeight:"lineHeight",textColor:"textColor",textHighlight:"textHighlight",bold:"bold",italic:"italic",underline:"underline",strikethrough:"strikethrough",subscript:"subscript",superscript:"superscript",code:"codeFormat",link:"link",blockFormat:"blockFormat",quote:"blockFormat",alignLeft:"blockFormat",alignCenter:"blockFormat",alignRight:"blockFormat",alignJustify:"blockFormat",codeBlock:"code",unorderedList:"list",orderedList:"list",checkList:"list",indentList:"list",outdentList:"list",horizontalRule:"horizontalRule",table:"table",image:"image",emoji:"emoji",embed:["iframeEmbed","youTubeEmbed"],undo:"history",redo:"history",commandPalette:"commandPalette",themeToggle:"themeToggle"};function Ca(e,t){return ln(e,t,va)}function Ea(e){if(!e||e.length===0)return [...Le];let t=new Set,r=[];for(let o of e)!Le.includes(o)||t.has(o)||(t.add(o),r.push(o));return r.length>0?r:[...Le]}function xa(e){if(!e)return "__default__";if(Array.isArray(e)){let n=new Set,i=[];for(let a of e)for(let[u,d]of Object.entries(a)){let b=u.trim();!d||!b||n.has(b)||(n.add(b),i.push(b));}return i.length===0?"__default__":JSON.stringify({allowlist:i,denylist:[]})}let t=n=>{if(!n||n.length===0)return [];let i=new Set,a=[];for(let u of n){let d=u.trim();!d||i.has(d)||(i.add(d),a.push(d));}return a},r=e,o=t(r.allowlist),l=t(r.denylist);return o.length===0&&l.length===0?"__default__":JSON.stringify({allowlist:o,denylist:l})}function ka(e){if(!e||e.length===0)return [];let t=new Set,r=[];for(let o of e){let l=o.trim();!l||t.has(l)||(t.add(l),r.push(l));}return r}function Ta(e,t){return e.key.toLowerCase()===t.key.toLowerCase()&&!!e.ctrlKey==!!t.ctrlKey&&!!e.metaKey==!!t.metaKey&&!!e.shiftKey==!!t.shiftKey&&!!e.altKey==!!t.altKey}function Sa(e){if(!e)return "__default__";let t=Array.isArray(e.disabledCommandIds)?[...e.disabledCommandIds].map(o=>o.trim()).filter(o=>o.length>0).sort((o,l)=>o.localeCompare(l)):[],r=e.bindings?Object.entries(e.bindings).map(([o,l])=>{if(l===false||l===null)return [o,false];let i=(Array.isArray(l)?l:[l]).map(a=>({key:a.key.trim(),ctrlKey:!!a.ctrlKey,metaKey:!!a.metaKey,shiftKey:!!a.shiftKey,altKey:!!a.altKey,preventDefault:a.preventDefault})).filter(a=>a.key.length>0).sort((a,u)=>{let d=`${a.key}:${a.ctrlKey?1:0}:${a.metaKey?1:0}:${a.shiftKey?1:0}:${a.altKey?1:0}`,b=`${u.key}:${u.ctrlKey?1:0}:${u.metaKey?1:0}:${u.shiftKey?1:0}:${u.altKey?1:0}`;return d.localeCompare(b)});return i.length===0?[o,false]:[o,i]}).sort(([o],[l])=>o.localeCompare(l)):[];return JSON.stringify({disabledCommandIds:t,bindings:r,preventCollisions:e.preventCollisions!==false,preventNativeConflicts:e.preventNativeConflicts!==false})}function La({isDark:e,toggleTheme:t,visualPlaceholder:r,jsonbPlaceholder:o,initialMode:l,availableModes:n,onReady:i,toolbarLayout:a,toolbarVisibility:u,toolbarPosition:d,toolbarAlignment:b,toolbarClassName:c,toolbarStyleVars:p,isToolbarEnabled:m,headingOptions:h,paragraphLabel:O,syncHeadingOptionsWithCommands:S,slashCommandVisibility:P,shortcutConfig:U,commandPaletteShortcutOnly:_,featureFlags:C}){let{commands:oe,hasExtension:ae,activeStates:$,lexical:g,extensions:I,export:E,import:D}=la(),[R,X]=useState(l),[B,he]=useState({jsonb:""}),[ne,we]=useState(null),[se,Fe]=useState(null),[Ie,Ne]=useState({isOpen:false,commands:[]}),[ce,Pe]=useState({isOpen:false,query:"",position:null,commands:[]}),[ze,Oe]=useState({isOpen:false,query:"",position:null,suggestions:[]}),me=useRef(false),He=useMemo(()=>Ea(h),[h]),be=S?He:void 0,ge=S?O:void 0,F=$.isInCodeBlock===true,w=useMemo(()=>ya(oe,C,F),[oe,C,F]),V=useMemo(()=>v=>Object.prototype.hasOwnProperty.call(C,v)?C[v]!==false:true,[C]),ot=useMemo(()=>Ca(u,C),[u,C]),ye=C.draggableBlock!==false,ke=xa(P),qe=useRef(P),Te=useRef(ke),Me=Sa(U),G=useRef(U),Se=useRef(Me),Re=useMemo(()=>ka(U?.disabledCommandIds),[U?.disabledCommandIds]),ie=useMemo(()=>new Set(Re),[Re]),ve=useMemo(()=>ie.size===0?[]:po({headingOptions:be,paragraphLabel:ge,isFeatureEnabled:V}).filter(v=>ie.has(v.id)).flatMap(v=>v.shortcuts??[]),[ie,be,ge,V]);Te.current!==ke&&(Te.current=ke,qe.current=P),Se.current!==Me&&(Se.current=Me,G.current=U);let Ae=useRef(to(["visual"])),M=useRef(0);useEffect(()=>{Eo(w,$,e?"dark":"light",V);},[w,$,e,V]);let Be=useMemo(()=>({injectJSONB:v=>{setTimeout(()=>{try{let k=JSON.parse(v);D.fromJSON(k);}catch(k){console.error("Failed to inject JSONB:",k);return}},100);},getJSONB:()=>To(JSON.stringify(E.toJSON()))}),[E,D]);useEffect(()=>{if(!g||!w)return;let v=w,k=Qo(v,{headingOptions:be,paragraphLabel:ge,isFeatureEnabled:V,shortcutConfig:G.current,commandPaletteShortcutOnly:_});typeof v.registerCommand=="function"&&k.forEach(q=>v.registerCommand(q));let K=Xo(v,{headingOptions:be,paragraphLabel:ge,slashCommandVisibility:qe.current,isFeatureEnabled:V,shortcutConfig:G.current});typeof v.setSlashCommands=="function"?v.setSlashCommands(K):K.forEach(q=>v.registerSlashCommand?.(q));let Z=er(v,document.body,{headingOptions:be,paragraphLabel:ge,isFeatureEnabled:V,shortcutConfig:G.current,scope:()=>g.getRootElement()});return me.current||(me.current=true,i?.(Be)),()=>{Z(),typeof v.unregisterCommand=="function"&&k.forEach(q=>v.unregisterCommand(q.id)),typeof v.setSlashCommands=="function"?v.setSlashCommands([]):K.forEach(q=>v.unregisterSlashCommand?.(q.id));}},[g,w,Be,i,be,ge,ke,Me,V,_]),useEffect(()=>{let v=()=>g?.getRootElement(),k=ha.filter(Z=>C[Z.feature]===false);if(k.length===0)return;let K=Z=>{let q=v();q&&Z.target instanceof Node&&!q.contains(Z.target)||!dn(Z.target)||!k.some(f=>ba(Z,f))||(Z.preventDefault(),Z.stopPropagation());};return document.addEventListener("keydown",K,true),()=>{document.removeEventListener("keydown",K,true);}},[g,C]),useEffect(()=>{let v=I.find(k=>k.name==="commandPalette");if(!(!v||!v.subscribe))return v.subscribe((k,K)=>{let Z=K.filter(q=>ie.has(q.id)?false:_?typeof q.shortcut=="string"&&q.shortcut.trim().length>0:true);Ne({isOpen:k,commands:Z});})},[I,ie,_]),useEffect(()=>{if(ve.length===0)return;let v=()=>g?.getRootElement(),k=K=>{let Z=v();Z&&K.target instanceof Node&&!Z.contains(K.target)||!dn(K.target)||!ve.some(Qe=>Ta(K,Qe))||(K.preventDefault(),K.stopPropagation());};return document.addEventListener("keydown",k,true),()=>{document.removeEventListener("keydown",k,true);}},[g,ve]),useEffect(()=>{let v=I.find(k=>k.name==="slashCommand");if(!(!v||!v.subscribe))return v.subscribe(k=>{Pe({isOpen:k.isOpen,query:k.query,position:k.position,commands:k.commands});})},[I]),useEffect(()=>{let v=I.find(k=>k.name==="emoji");if(!(!v||!v.subscribe))return v.subscribe(k=>{Oe({isOpen:k.isOpen,query:k.query,position:k.position,suggestions:k.suggestions});})},[I]),useEffect(()=>!g||!E?void 0:g.registerUpdateListener(()=>{M.current+=1,oo(Ae.current,["visual"]);}),[g,E]);let rt=async v=>{if(n.includes(v))try{if(Fe(null),R==="jsonb"&&v!=="jsonb"){let k=JSON.parse(B.jsonb);D.fromJSON(k),await new Promise(K=>setTimeout(K,50));}if(R==="visual"&&v!=="visual"&&(g&&clearLexicalSelection(g),g?.getRootElement()?.blur()),X(v),v==="jsonb"&&R!=="jsonb"&&!ro(Ae.current,"jsonb")){we("jsonb"),await new Promise(k=>setTimeout(k,50));try{let k=To(JSON.stringify(E.toJSON()));he(K=>({...K,jsonb:k})),Pt(Ae.current,"jsonb");}finally{we(null);}}v==="visual"&&setTimeout(()=>g?.focus(),100);}catch(k){let K=k instanceof Error?k.message:"Invalid format - could not parse content";Fe({mode:R,error:K});}},Ye=m?jsx($r,{commands:w,hasExtension:v=>ae(v),activeStates:$,isDark:e,toggleTheme:t,onCommandPaletteOpen:()=>{C.commandPalette!==false&&w.showCommandPalette();},imageUploadHandler:v=>I.find(k=>k.name==="image")?.config?.uploadHandler?.(v)??Promise.resolve(URL.createObjectURL(v)),layout:a??zt,toolbarVisibility:ot,toolbarStyleVars:p,headingOptions:He,paragraphLabel:O,classNames:{toolbar:`luthor-toolbar luthor-toolbar--align-${b}${c?` ${c}`:""}`}}):null,Ge=R==="visual"&&m&&d==="top",We=R==="visual"&&m&&d==="bottom";return jsxs(Fragment,{children:[jsxs("div",{className:"luthor-editor-header",children:[jsx(Ar,{mode:R,onModeChange:rt,availableModes:n,isConverting:ne}),Ge&&jsx("div",{className:"luthor-editor-toolbar-slot luthor-editor-toolbar-slot--top",children:Ye})]}),jsxs("div",{className:`luthor-editor${ye?"":" luthor-editor--draggable-disabled"}`,"data-mode":R,children:[jsxs("div",{className:`luthor-editor-visual-shell${R==="visual"?"":" is-hidden"}${ye?"":" luthor-editor-visual-shell--no-gutter"}`,"aria-hidden":R!=="visual",children:[ye&&jsx("div",{className:"luthor-editor-visual-gutter","aria-hidden":"true"}),jsx(RichText,{placeholder:r,classNames:{container:"luthor-richtext-container luthor-preset-extensive__container",contentEditable:"luthor-content-editable luthor-preset-extensive__content",placeholder:"luthor-placeholder luthor-preset-extensive__placeholder"}})]}),R!=="visual"&&jsxs("div",{className:"luthor-source-panel",children:[se&&se.mode===R&&jsxs("div",{className:"luthor-source-error",children:[jsx("div",{className:"luthor-source-error-icon",children:"\u26A0\uFE0F"}),jsxs("div",{className:"luthor-source-error-message",children:[jsx("strong",{children:"Invalid JSONB"}),jsx("p",{children:se.error}),jsx("small",{children:"Fix the errors above and try switching modes again"})]})]}),R==="jsonb"&&jsx(Dr,{value:B.jsonb,onChange:v=>he(k=>({...k,jsonb:v})),placeholder:o})]})]}),jsx(Mr,{editor:g,commands:w,editorTheme:e?"dark":"light",disabled:R!=="visual"}),We&&jsx("div",{className:"luthor-editor-toolbar-slot luthor-editor-toolbar-slot--bottom",children:Ye}),jsx(xr,{isOpen:Ie.isOpen,onClose:()=>w.hideCommandPalette(),commands:Ie.commands}),jsx(wr,{isOpen:ce.isOpen,query:ce.query,position:ce.position,commands:ce.commands,onClose:()=>w.closeSlashMenu?.(),onExecute:v=>{w.executeSlashCommand?.(v);}}),jsx(Tr,{isOpen:ze.isOpen,query:ze.query,position:ze.position,suggestions:ze.suggestions,onClose:()=>w.closeEmojiSuggestions?.(),onExecute:v=>{w.executeEmojiSuggestion?.(v);}})]})}var te=forwardRef(({className:e,onReady:t,initialTheme:r="light",theme:o,defaultContent:l,showDefaultContent:n=true,placeholder:i=sn,initialMode:a="visual",availableModes:u=["visual","jsonb"],variantClassName:d,toolbarLayout:b,toolbarVisibility:c,toolbarPosition:p="top",toolbarAlignment:m="left",toolbarClassName:h,toolbarStyleVars:O,quoteClassName:S,quoteStyleVars:P,defaultSettings:U,editorThemeOverrides:_,isToolbarEnabled:C=true,fontFamilyOptions:oe,fontSizeOptions:ae,lineHeightOptions:$,minimumDefaultLineHeight:g=1.5,scaleByRatio:I=false,headingOptions:E,paragraphLabel:D,syncHeadingOptionsWithCommands:R=true,slashCommandVisibility:X,shortcutConfig:B,commandPaletteShortcutOnly:he=false,isDraggableBoxEnabled:ne,featureFlags:we,syntaxHighlighting:se,codeHighlightProvider:Fe,loadCodeHighlightProvider:Ie,maxAutoDetectCodeLength:Ne,isCopyAllowed:ce=true,languageOptions:Pe},ze)=>{let[Oe,me]=useState(r),He=Oe==="dark",be=u.includes(a)?a:u[0]??"visual",ge=()=>me(He?"light":"dark"),F=useMemo(()=>typeof i=="string"?{visual:i,jsonb:un}:{visual:i.visual??sn,jsonb:i.jsonb??un},[i]);useEffect(()=>{me(r);},[r]);let w=useMemo(()=>ua(oe),[oe]),V=useMemo(()=>da(ae),[ae]),ot=useMemo(()=>ca($),[$]),ye=useMemo(()=>ma(g),[g]),ke=se??"unset",qe=typeof Ne=="number"?Ne.toString():"unset",Te=useMemo(()=>ga(Pe),[Pe]),Me=ce?"copy-on":"copy-off",G=useMemo(()=>typeof ne!="boolean"?we:{...we??{},draggableBlock:ne},[we,ne]),Se=useMemo(()=>pa(G),[G]),Re=useMemo(()=>Nt(G),[G]),ie=`${w}::${V}::${ot}::${ye}::${I?"ratio-on":"ratio-off"}::${ke}::${qe}::${Me}::${Te}::${Se}`,ve=useRef(oe),Ae=useRef(ae),M=useRef($),Be=useRef(g),rt=useRef(G),Ye=useRef(Pe),Ge=useRef(Fe),We=useRef(Ie),v=useRef(ie);(v.current!==ie||Ge.current!==Fe||We.current!==Ie)&&(v.current=ie,ve.current=oe,Ae.current=ae,M.current=$,Be.current=g,rt.current=G,Ye.current=Pe,Ge.current=Fe,We.current=Ie);let k=useRef(null);if(!k.current||k.current.key!==ie){let W={fontFamilyOptions:ve.current,fontSizeOptions:Ae.current,lineHeightOptions:M.current,minimumDefaultLineHeight:Be.current,scaleByRatio:I,...se!==void 0?{syntaxHighlighting:se}:{},...Ge.current!==void 0?{codeHighlightProvider:Ge.current}:{},...We.current!==void 0?{loadCodeHighlightProvider:We.current}:{},...Ne!==void 0?{maxAutoDetectCodeLength:Ne}:{},isCopyAllowed:ce,...Ye.current!==void 0?{languageOptions:Ye.current}:{},...typeof ne=="boolean"?{isDraggableBoxEnabled:ne}:{},...rt.current?{featureFlags:rt.current}:{}};k.current={key:ie,value:Q(W)};}let K=k.current.value,Z=useMemo(()=>{let W=mergeThemes(defaultLuthorTheme,o??{});return S?{...W,quote:`${W.quote??""} ${S}`.trim()}:W},[o,S]),q=useMemo(()=>Bo(_),[_]),Qe=useMemo(()=>Bo(P),[P]),f=useMemo(()=>fa(U),[U]),y=useMemo(()=>Bo(f),[f]),H=useMemo(()=>{let W=f,Bt=createEditorThemeStyleVars(_),Jo=P,qo={"--luthor-default-line-height":ye};return !W&&!Bt&&!Jo?qo:{...W??{},...Bt,...Jo??{},...qo}},[ye,f,_,P,y,q,Qe]),[z,ue]=useState(null);useImperativeHandle(ze,()=>z,[z]);let de=W=>{ue(W),n&&l===void 0?W.injectJSONB(JSON.stringify(Ro)):l&&W.injectJSONB(sa(l)),t?.(W);};return jsx("div",{className:`luthor-preset luthor-preset-extensive luthor-editor-wrapper ${d||""} ${e||""}`.trim(),"data-editor-theme":Oe,style:H,children:jsx(ia,{extensions:K,config:{theme:Z},children:jsx(La,{isDark:He,toggleTheme:ge,visualPlaceholder:F.visual,jsonbPlaceholder:F.jsonb,initialMode:be,availableModes:u,onReady:de,toolbarLayout:b,toolbarVisibility:c,toolbarPosition:p,toolbarAlignment:m,toolbarClassName:h,toolbarStyleVars:O,isToolbarEnabled:C,headingOptions:E,paragraphLabel:D,syncHeadingOptionsWithCommands:R,slashCommandVisibility:X,shortcutConfig:B,commandPaletteShortcutOnly:he,featureFlags:Re})})})});te.displayName="ExtensiveEditor";var cn=["undo","redo","heading","fontFamily","fontSize","lineHeight","textColor","textHighlight","bold","italic","underline","strikethrough","subscript","superscript","link","image","table","horizontalRule","iframeEmbed","youtubeEmbed","blockquote","code","codeBlock","bulletedList","numberedList","checkList","commandPalette","floatingToolbar","contextMenu","draggableBlock","customNode","sourceMode","themeToggle"],no={id:"extensive",label:"Extensive",description:"All features enabled for power users.",extensions:[...eo],components:{Editor:te},toolbar:[...cn],config:ee("extensive","Write anything..."),css:"extensive/styles.css"};function mn(e={}){return {...no,extensions:[...Q({fontFamilyOptions:e.fontFamilyOptions,fontSizeOptions:e.fontSizeOptions,lineHeightOptions:e.lineHeightOptions,minimumDefaultLineHeight:e.minimumDefaultLineHeight,isCopyAllowed:e.isCopyAllowed,languageOptions:e.languageOptions})]}}var Ia={bold:false,italic:false,underline:false,strikethrough:false,fontFamily:false,fontSize:false,lineHeight:false,textColor:false,textHighlight:false,subscript:false,superscript:false,link:false,horizontalRule:false,table:false,list:false,image:false,blockFormat:false,code:false,codeIntelligence:false,codeFormat:false,iframeEmbed:false,youTubeEmbed:false,floatingToolbar:false,contextMenu:false,commandPalette:false,slashCommand:false,emoji:false,draggableBlock:false,customNode:false,themeToggle:false},Ot=forwardRef(({className:e,variantClassName:t,hideToolbarByDefault:r=true,isToolbarEnabled:o,...l},n)=>jsx(te,{ref:n,...l,className:["luthor-preset-simple-text",e].filter(Boolean).join(" "),variantClassName:["luthor-preset-simple-text__variant",t].filter(Boolean).join(" "),availableModes:["visual"],initialMode:"visual",isToolbarEnabled:r?false:o,featureFlags:Ia}));Ot.displayName="SimpleTextEditor";var zo={id:"simple-text",label:"Simple Text",description:"Plain text writing with rich formatting disabled.",extensions:Q({featureFlags:{bold:false,italic:false,underline:false,strikethrough:false,link:false,list:false,blockFormat:false,image:false,table:false,code:false,codeFormat:false,commandPalette:false,slashCommand:false,emoji:false,draggableBlock:false}}),components:{Editor:Ot},toolbar:[],config:ee("simple-text","Write plain text..."),css:"simple-text/styles.css"};var Oa={bold:true,italic:true,underline:true,strikethrough:true,list:true,history:true,link:true,blockFormat:true,codeFormat:true,image:false,table:false,iframeEmbed:false,youTubeEmbed:false,emoji:false,floatingToolbar:false,contextMenu:false,commandPalette:false,slashCommand:false,draggableBlock:false,customNode:false},Ht=forwardRef(({className:e,variantClassName:t,compactToolbar:r=false,toolbarClassName:o,featureFlags:l,...n},i)=>jsx(te,{ref:i,...n,className:["luthor-preset-rich-text-box",e].filter(Boolean).join(" "),variantClassName:[r?"luthor-preset-rich-text-box--compact":"",t].filter(Boolean).join(" "),toolbarClassName:[r?"luthor-preset-rich-text-box__toolbar--compact":"",o].filter(Boolean).join(" "),featureFlags:{...Oa,...l??{}}}));Ht.displayName="RichTextBoxEditor";var Mo={id:"rich-text-box",label:"Rich Text Box",description:"Inline formatting and list-focused rich text editing.",extensions:Q({featureFlags:{image:false,table:false,iframeEmbed:false,youTubeEmbed:false,emoji:false,commandPalette:false,slashCommand:false,draggableBlock:false}}),components:{Editor:Ht},toolbar:["bold","italic","underline","strikethrough","unorderedList","orderedList","checkList","undo","redo"],config:ee("rich-text-box","Write rich text..."),css:"rich-text-box/styles.css"};function lo({className:e,variantClassName:t,onSend:r,submitOnEnter:o=true,allowShiftEnter:l=true,showVoiceButton:n=false,showImageButton:i=true,showSendButton:a=true,...u}){let d=useRef(null),b=useCallback(()=>{r&&r({jsonb:d.current?.getJSONB()??""});},[r]),c=useCallback(p=>{!o||p.key!=="Enter"||p.nativeEvent.isComposing||p.shiftKey&&l||(p.preventDefault(),b());},[l,b,o]);return jsxs("div",{className:["luthor-preset-chat-window",e].filter(Boolean).join(" "),onKeyDownCapture:c,children:[jsx(te,{ref:d,...u,variantClassName:["luthor-preset-chat-window__variant",t].filter(Boolean).join(" "),isToolbarEnabled:false,availableModes:["visual"],initialMode:"visual",featureFlags:{bold:false,italic:false,underline:false,strikethrough:false,fontFamily:false,fontSize:false,lineHeight:false,textColor:false,textHighlight:false,subscript:false,superscript:false,link:true,horizontalRule:false,table:false,list:true,image:false,blockFormat:false,code:false,codeIntelligence:false,codeFormat:false,iframeEmbed:false,youTubeEmbed:false,floatingToolbar:false,contextMenu:false,commandPalette:false,slashCommand:false,emoji:true,draggableBlock:false,customNode:false,themeToggle:false}}),jsxs("div",{className:"luthor-chat-window-actions","data-testid":"chat-actions",children:[n&&jsx("button",{type:"button",className:"luthor-chat-window-action","data-testid":"chat-voice-button","aria-label":"Voice input",children:"Voice"}),i&&jsx("button",{type:"button",className:"luthor-chat-window-action","data-testid":"chat-image-button","aria-label":"Add image",children:"Image"}),a&&jsx("button",{type:"button",className:"luthor-chat-window-action luthor-chat-window-action-send","data-testid":"chat-send-button",onClick:b,"aria-label":"Send message",children:"Send"})]})]})}var Ao={id:"chat-window",label:"Chat Window",description:"Chat composer with action row and send controls.",extensions:Q({featureFlags:{bold:false,italic:false,underline:false,strikethrough:false,table:false,image:false,blockFormat:false,code:false,codeIntelligence:false,codeFormat:false,iframeEmbed:false,youTubeEmbed:false,commandPalette:false,slashCommand:false,draggableBlock:false,customNode:false}}),components:{Editor:lo},toolbar:[],config:ee("chat-window","Write a message..."),css:"chat-window/styles.css"};function ao({className:e,variantClassName:t,showTo:r=true,showCc:o=false,showBcc:l=false,showSubject:n=true,...i}){return jsxs("div",{className:["luthor-preset-email-compose",e].filter(Boolean).join(" "),children:[jsxs("div",{className:"luthor-email-compose-shell",children:[r&&jsxs("label",{className:"luthor-email-compose-row","data-testid":"email-row-to",children:[jsx("span",{children:"To"}),jsx("input",{type:"text",readOnly:true,value:""})]}),o&&jsxs("label",{className:"luthor-email-compose-row","data-testid":"email-row-cc",children:[jsx("span",{children:"Cc"}),jsx("input",{type:"text",readOnly:true,value:""})]}),l&&jsxs("label",{className:"luthor-email-compose-row","data-testid":"email-row-bcc",children:[jsx("span",{children:"Bcc"}),jsx("input",{type:"text",readOnly:true,value:""})]}),n&&jsxs("label",{className:"luthor-email-compose-row","data-testid":"email-row-subject",children:[jsx("span",{children:"Subject"}),jsx("input",{type:"text",readOnly:true,value:""})]})]}),jsx(te,{...i,variantClassName:["luthor-preset-email-compose__variant",t].filter(Boolean).join(" "),featureFlags:{bold:true,italic:true,underline:true,strikethrough:false,link:true,list:true,history:true,blockFormat:true,table:false,image:false,iframeEmbed:false,youTubeEmbed:false,emoji:true,customNode:false}})]})}var Do={id:"email-compose",label:"Email Compose",description:"Compose shell with rich email body editing.",extensions:Q({featureFlags:{table:false,image:false,iframeEmbed:false,youTubeEmbed:false,customNode:false}}),components:{Editor:ao},toolbar:["bold","italic","underline","link","unorderedList","orderedList","undo","redo"],config:ee("email-compose","Write your email..."),css:"email-compose/styles.css"};function uo({className:e,variantClassName:t,initialMode:r="visual",...o}){let l=useRef(null),n=useRef(to(["visual"])),i=useRef(""),a=useRef(null),[u,d]=useState(r),[b,c]=useState(""),[p,m]=useState(null),h=O=>{if(O!==u)try{if(m(null),O==="markdown")if(ro(n.current,"markdown"))c(i.current);else {let S=l.current?.getJSONB()??"",P=S?JSON.parse(S):void 0,U=jr(jsonbToMarkdown(P));i.current=U,c(U),Pt(n.current,"markdown");}if(O==="visual"){let S=markdownToJSONB(b);a.current=JSON.stringify(S);}d(O),O==="visual"&&setTimeout(()=>{a.current&&(l.current?.injectJSONB(a.current),a.current=null);},0);}catch(S){let P=S instanceof Error?S.message:"Failed to parse markdown";m(P);}};return jsxs("div",{className:["luthor-preset-md-text",e].filter(Boolean).join(" "),onInputCapture:()=>{u==="visual"&&oo(n.current,["visual"]);},children:[jsxs("div",{className:"luthor-md-text-tabs",children:[jsx("button",{type:"button",className:u==="visual"?"active":"",onClick:()=>h("visual"),children:"Visual"}),jsx("button",{type:"button",className:u==="markdown"?"active":"",onClick:()=>h("markdown"),children:"Markdown"})]}),u==="visual"&&jsx(te,{ref:l,...o,className:"luthor-preset-md-text__editor",variantClassName:["luthor-preset-md-text__variant",t].filter(Boolean).join(" "),availableModes:["visual"],initialMode:"visual",featureFlags:{table:false,image:false,iframeEmbed:false,youTubeEmbed:false,customNode:false}}),u==="markdown"&&jsxs("div",{className:"luthor-md-text-source-shell",children:[jsx("textarea",{className:"luthor-md-text-source",value:b,onChange:O=>{c(O.target.value),i.current=O.target.value,Pt(n.current,"markdown");},placeholder:"Write markdown..."}),p&&jsx("p",{className:"luthor-md-text-error",children:p})]})]})}var Uo={id:"md-text",label:"MD Text",description:"Visual and markdown editing with conversion bridge.",extensions:Q({featureFlags:{table:false,image:false,iframeEmbed:false,youTubeEmbed:false,customNode:false}}),components:{Editor:uo},toolbar:["bold","italic","underline","strikethrough","link","unorderedList","orderedList"],config:ee("md-text","Write markdown..."),css:"md-text/styles.css"};var Ma={slashCommand:true,draggableBlock:true,commandPalette:true,floatingToolbar:false,contextMenu:false};function co({className:e,variantClassName:t,slashVisibility:r,isDraggableEnabled:o=true,featureFlags:l,isToolbarEnabled:n=false,...i}){return jsx(te,{...i,className:["luthor-preset-notion-like",e].filter(Boolean).join(" "),variantClassName:["luthor-preset-notion-like__variant",t].filter(Boolean).join(" "),isToolbarEnabled:n,slashCommandVisibility:r,featureFlags:{...Ma,draggableBlock:o,...l??{}}})}var _o={id:"notion-like",label:"Notion Like",description:"Slash-first writing with draggable block defaults.",extensions:Q({featureFlags:{slashCommand:true,draggableBlock:true,floatingToolbar:false,contextMenu:false}}),components:{Editor:co},toolbar:[],config:ee("notion-like","Type '/' for commands..."),css:"notion-like/styles.css"};var qa=[richTextExtension,historyExtension,boldExtension,italicExtension,underlineExtension,listExtension],{Provider:Ya,useEditor:Ga}=createEditorSystem();function Wa(){let{commands:e,activeStates:t}=Ga();return jsxs("div",{className:"luthor-headless-controls",role:"toolbar","aria-label":"Headless editor controls",children:[jsx("button",{type:"button",onClick:()=>e.toggleBold?.(),"aria-pressed":t.bold===true,children:"bold"}),jsx("button",{type:"button",onClick:()=>e.toggleItalic?.(),"aria-pressed":t.italic===true,children:"italic"}),jsx("button",{type:"button",onClick:()=>e.toggleUnderline?.(),"aria-pressed":t.underline===true,children:"underline"}),jsx("button",{type:"button",onClick:()=>e.toggleUnorderedList?.(),children:"bullet list"}),jsx("button",{type:"button",onClick:()=>e.undo?.(),children:"undo"}),jsx("button",{type:"button",onClick:()=>e.redo?.(),children:"redo"})]})}function mo({className:e,placeholder:t="Start writing..."}){return jsx("div",{className:["luthor-headless-preset",e].filter(Boolean).join(" "),children:jsxs(Ya,{extensions:qa,children:[jsx(Wa,{}),jsx(RichText,{placeholder:t,classNames:{container:"luthor-headless-editor-container",contentEditable:"luthor-headless-editor-content",placeholder:"luthor-headless-editor-placeholder"}})]})})}var Vo={id:"headless-editor",label:"Headless Editor",description:"Minimal plain-control preset for customization starters.",components:{Editor:mo},toolbar:["bold","italic","underline","unorderedList","undo","redo"],config:ee("headless-editor","Start writing..."),css:"headless-editor/styles.css"};function go({className:e,variantClassName:t,showTitle:r=true,title:o="",onTitleChange:l,showActions:n=true,onPin:i,onArchive:a,onColorChange:u,colorOptions:d=["#fef3c7","#dbeafe","#dcfce7"],...b}){return jsxs("div",{className:["luthor-preset-notes",e].filter(Boolean).join(" "),children:[r&&jsx("input",{"data-testid":"notes-title",className:"luthor-notes-title",placeholder:"Title",value:o,onChange:c=>l?.(c.target.value)}),n&&jsxs("div",{className:"luthor-notes-actions","data-testid":"notes-actions",children:[jsx("button",{type:"button",onClick:i,"aria-label":"Pin note",children:"Pin"}),jsx("button",{type:"button",onClick:a,"aria-label":"Archive note",children:"Archive"}),jsx("select",{"aria-label":"Change note color",onChange:c=>u?.(c.target.value),children:d.map(c=>jsx("option",{value:c,children:c},c))})]}),jsx(te,{...b,variantClassName:["luthor-preset-notes__variant",t].filter(Boolean).join(" "),featureFlags:{bold:true,italic:true,underline:true,strikethrough:false,link:true,list:true,blockFormat:false,table:false,image:false,iframeEmbed:false,youTubeEmbed:false,commandPalette:false,slashCommand:false,draggableBlock:false,customNode:false,emoji:false},isToolbarEnabled:false})]})}var $o={id:"notes",label:"Notes",description:"Compact notes editor with title and actions.",extensions:Q({featureFlags:{list:true,image:false,table:false,iframeEmbed:false,youTubeEmbed:false,commandPalette:false,slashCommand:false,draggableBlock:false,customNode:false}}),components:{Editor:go},toolbar:[],config:ee("notes","Take a note..."),css:"notes/styles.css"};var qc={extensive:no,"simple-text":zo,"rich-text-box":Mo,"chat-window":Ao,"email-compose":Do,"md-text":Uo,"notion-like":_o,"headless-editor":Vo,notes:$o};export{it as AlignCenterIcon,nr as AlignJustifyIcon,ct as AlignLeftIcon,mt as AlignRightIcon,Le as BLOCK_HEADING_LEVELS,At as BoldIcon,Co as Button,lo as ChatWindowEditor,yr as ChevronDownIcon,vr as CloseIcon,tr as CodeBlockIcon,Ut as CodeIcon,Jt as CommandIcon,xr as CommandPalette,Qa as DEFAULT_TOOLBAR_LAYOUT,Ir as Dialog,St as Dropdown,ao as EmailComposeEditor,yo as EmojiIcon,Tr as EmojiSuggestionMenu,te as ExtensiveEditor,ls as EyeIcon,ar as FileCodeIcon,Nr as FloatingToolbar,mo as HeadlessEditorPreset,sr as HighlighterIcon,L as IconButton,ho as ImageIcon,cr as IndentIcon,Dt as ItalicIcon,Mr as LinkHoverBubble,dt as LinkIcon,Vt as ListCheckIcon,_t as ListIcon,$t as ListOrderedIcon,uo as MDTextEditor,ir as MinusIcon,Ar as ModeTabs,fr as MoonIcon,go as NotesEditor,co as NotionLikeEditor,mr as OutdentIcon,ur as PaletteIcon,as as PencilIcon,qt as QuoteIcon,rr as RedoIcon,Ht as RichTextBoxEditor,pr as SearchIcon,Tt as Select,Ot as SimpleTextEditor,wr as SlashCommandMenu,Dr as SourceView,jt as StrikethroughIcon,hr as SubscriptIcon,gr as SunIcon,br as SuperscriptIcon,zt as TRADITIONAL_TOOLBAR_LAYOUT,lr as TableIcon,$r as Toolbar,dr as TypeIcon,Kt as UnderlineIcon,or as UndoIcon,nt as UnlinkIcon,bo as UploadIcon,Ao as chatWindowPreset,Qo as commandsToCommandPaletteItems,Xo as commandsToSlashCommandItems,on as createDefaultSettingsStyleVarRecord,Q as createExtensiveExtensions,mn as createExtensivePreset,an as createFeatureGuardedCommands,Pr as createFloatingToolbarExtension,to as createModeCache,ee as createPresetEditorConfig,Do as emailComposePreset,eo as extensiveExtensions,no as extensivePreset,Wi as filterToolbarLayout,To as formatJSONBSource,jr as formatMarkdownSource,po as generateCommands,Vo as headlessEditorPreset,oo as invalidateModeCache,rn as isEditableCommandTarget,ro as isModeCached,nn as isShortcutMatch,Yi as isToolbarItemSupported,Gi as isToolbarItemVisible,Pt as markModeCached,Uo as mdTextPreset,ln as mergeToolbarVisibilityWithFeatures,tn as normalizeStyleVarsKey,$o as notesPreset,_o as notionLikePreset,qc as presetRegistry,er as registerKeyboardShortcuts,Mo as richTextBoxPreset,Eo as setFloatingToolbarContext,zo as simpleTextPreset};
1
+ import {b as b$6}from'./chunk-UF2XGVNR.js';export{a as RichTextBoxEditor,b as richTextBoxPreset}from'./chunk-UF2XGVNR.js';import {b as b$7}from'./chunk-CFX2B2AM.js';export{a as SimpleTextEditor,b as simpleTextPreset}from'./chunk-CFX2B2AM.js';import {b as b$5}from'./chunk-GM3JMQAK.js';export{a as ChatWindowEditor,b as chatWindowPreset}from'./chunk-GM3JMQAK.js';import {b as b$4}from'./chunk-USP5DTF7.js';export{a as EmailComposeEditor,b as emailComposePreset}from'./chunk-USP5DTF7.js';import {b as b$1}from'./chunk-YI6UVUPP.js';export{a as HeadlessEditorPreset,b as headlessEditorPreset}from'./chunk-YI6UVUPP.js';import {b as b$3}from'./chunk-CRS52AWJ.js';export{a as MDTextEditor,b as mdTextPreset}from'./chunk-CRS52AWJ.js';import {b}from'./chunk-YA4LF3BW.js';export{a as NotesEditor,b as notesPreset}from'./chunk-YA4LF3BW.js';import {b as b$2}from'./chunk-EY5S5M6E.js';export{a as NotionLikeEditor,b as notionLikePreset}from'./chunk-EY5S5M6E.js';import {Da}from'./chunk-5KKKDUJW.js';export{w as AlignCenterIcon,x as AlignJustifyIcon,v as AlignLeftIcon,y as AlignRightIcon,a as BLOCK_HEADING_LEVELS,h as BoldIcon,Y as Button,S as ChevronDownIcon,T as CloseIcon,m as CodeBlockIcon,l as CodeIcon,G as CommandIcon,U as CommandPalette,b as DEFAULT_TOOLBAR_LAYOUT,$ as Dialog,_ as Dropdown,P as EmojiIcon,V as EmojiSuggestionMenu,Ba as ExtensiveEditor,D as EyeIcon,C as FileCodeIcon,aa as FloatingToolbar,E as HighlighterIcon,X as IconButton,u as ImageIcon,K as IndentIcon,i as ItalicIcon,da as LinkHoverBubble,n as LinkIcon,q as ListCheckIcon,p as ListIcon,r as ListOrderedIcon,A as MinusIcon,ea as ModeTabs,N as MoonIcon,L as OutdentIcon,H as PaletteIcon,F as PencilIcon,J as QuoteIcon,t as RedoIcon,O as SearchIcon,Z as Select,W as SlashCommandMenu,fa as SourceView,k as StrikethroughIcon,Q as SubscriptIcon,M as SunIcon,R as SuperscriptIcon,c as TRADITIONAL_TOOLBAR_LAYOUT,B as TableIcon,la as Toolbar,I as TypeIcon,j as UnderlineIcon,s as UndoIcon,o as UnlinkIcon,z as UploadIcon,e as commandsToCommandPaletteItems,f as commandsToSlashCommandItems,sa as createDefaultSettingsStyleVarRecord,pa as createExtensiveExtensions,Ea as createExtensivePreset,wa as createFeatureGuardedCommands,ca as createFloatingToolbarExtension,xa as createModeCache,qa as extensiveExtensions,Da as extensivePreset,ka as filterToolbarLayout,ga as formatJSONBSource,ha as formatMarkdownSource,d as generateCommands,ya as invalidateModeCache,ta as isEditableCommandTarget,za as isModeCached,ua as isShortcutMatch,ia as isToolbarItemSupported,ja as isToolbarItemVisible,Aa as markModeCached,va as mergeToolbarVisibilityWithFeatures,ra as normalizeStyleVarsKey,g as registerKeyboardShortcuts,ba as setFloatingToolbarContext}from'./chunk-5KKKDUJW.js';export{a as createPresetEditorConfig}from'./chunk-MDSRHDWB.js';import*as luthorHeadless from'@lyfie/luthor-headless';export{luthorHeadless as headless };export{CodeIntelligenceExtension,codeIntelligenceExtension}from'@lyfie/luthor-headless';var it={extensive:Da,"simple-text":b$7,"rich-text-box":b$6,"chat-window":b$5,"email-compose":b$4,"md-text":b$3,"notion-like":b$2,"headless-editor":b$1,notes:b};export{it as presetRegistry};